i386: ACPI table generation code from seabios
This adds C code for generating ACPI tables at runtime,
imported from seabios git tree
commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd
Although ACPI tables come from a system BIOS on real hw,
it makes sense that the ACPI tables are coupled with the
virtual machine, since they have to abstract the x86 machine to
the OS's.
This is widely desired as a way to avoid the churn
and proliferation of QEMU-specific interfaces
associated with ACPI tables in bios code.
Notes:
As BIOS can reprogram devices prior to loading
ACPI tables, we pre-format ACPI tables but defer loading
hardware configuration there until tables are loaded.
The code structure was intentionally kept as close
to the seabios original as possible, to simplify
comparison and making sure we didn't lose anything
in translation.
Minor code duplication results, to help ensure there are no functional
regressions, I think it's better to merge it like this and do more code
changes in follow-up patches.
Cross-version compatibility concerns have been addressed:
ACPI tables are exposed to guest as FW_CFG entries.
When running with -M 1.5 and older, this patch disables ACPI
table generation, and doesn't expose ACPI
tables to guest.
As table content is likely to change over time,
the following measures are taken to simplify
cross-version migration:
- All tables besides the RSDP are packed in a single FW CFG entry.
This entry size is currently 23K. We round it up to 64K
to avoid too much churn there.
- Tables are placed in special ROM blob (not mapped into guest memory)
which is automatically migrated together with the guest, same
as BIOS code.
- Offsets where hardware configuration is loaded in ACPI tables
are also migrated, this is in case future ACPI changes make us
rearrange the tables in memory.
This patch reuses some code from SeaBIOS, which was originally under
LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This
relicensing has been acked by all contributors that had contributed to the
code since the v2->v3 relicense. ACKs approving the v2+ relicensing are
listed below. The list might include ACKs from people not holding
copyright on any parts of the reused code, but it's better to err on the
side of caution and include them.
Affected SeaBIOS files (GPLv2+ license headers added)
<http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>:
src/acpi-dsdt-cpu-hotplug.dsl
src/acpi-dsdt-dbug.dsl
src/acpi-dsdt-hpet.dsl
src/acpi-dsdt-isa.dsl
src/acpi-dsdt-pci-crs.dsl
src/acpi.c
src/acpi.h
src/ssdt-misc.dsl
src/ssdt-pcihp.dsl
src/ssdt-proc.dsl
tools/acpi_extract.py
tools/acpi_extract_preprocess.py
Each one of the listed people agreed to the following:
> If you allow the use of your contribution in QEMU under the
> terms of GPLv2 or later as proposed by this patch,
> please respond to this mail including the line:
>
> Acked-by: Name <email address>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Jason Baron <jbaron@akamai.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Dave Frodin <dave.frodin@se-eng.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Kevin O'Connor <kevin@koconnor.net>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Magnus Christensson <magnus.christensson@intel.com>
Acked-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-07-24 17:56:14 +02:00
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef QEMU_ACPI_DEFS_H
|
|
|
|
#define QEMU_ACPI_DEFS_H
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ACPI_FADT_F_WBINVD,
|
|
|
|
ACPI_FADT_F_WBINVD_FLUSH,
|
|
|
|
ACPI_FADT_F_PROC_C1,
|
|
|
|
ACPI_FADT_F_P_LVL2_UP,
|
|
|
|
ACPI_FADT_F_PWR_BUTTON,
|
|
|
|
ACPI_FADT_F_SLP_BUTTON,
|
|
|
|
ACPI_FADT_F_FIX_RTC,
|
|
|
|
ACPI_FADT_F_RTC_S4,
|
|
|
|
ACPI_FADT_F_TMR_VAL_EXT,
|
|
|
|
ACPI_FADT_F_DCK_CAP,
|
|
|
|
ACPI_FADT_F_RESET_REG_SUP,
|
|
|
|
ACPI_FADT_F_SEALED_CASE,
|
|
|
|
ACPI_FADT_F_HEADLESS,
|
|
|
|
ACPI_FADT_F_CPU_SW_SLP,
|
|
|
|
ACPI_FADT_F_PCI_EXP_WAK,
|
|
|
|
ACPI_FADT_F_USE_PLATFORM_CLOCK,
|
|
|
|
ACPI_FADT_F_S4_RTC_STS_VALID,
|
|
|
|
ACPI_FADT_F_REMOTE_POWER_ON_CAPABLE,
|
|
|
|
ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL,
|
|
|
|
ACPI_FADT_F_FORCE_APIC_PHYSICAL_DESTINATION_MODE,
|
|
|
|
ACPI_FADT_F_HW_REDUCED_ACPI,
|
|
|
|
ACPI_FADT_F_LOW_POWER_S0_IDLE_CAPABLE,
|
|
|
|
};
|
|
|
|
|
2018-12-17 11:48:34 +01:00
|
|
|
typedef struct AcpiRsdpData {
|
2021-01-19 01:32:13 +01:00
|
|
|
char *oem_id; /* OEM identification */
|
2019-01-03 09:56:36 +01:00
|
|
|
uint8_t revision; /* Must be 0 for 1.0, 2 for 2.0 */
|
2018-12-17 11:48:34 +01:00
|
|
|
|
|
|
|
unsigned *rsdt_tbl_offset;
|
|
|
|
unsigned *xsdt_tbl_offset;
|
|
|
|
} AcpiRsdpData;
|
|
|
|
|
i386: ACPI table generation code from seabios
This adds C code for generating ACPI tables at runtime,
imported from seabios git tree
commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd
Although ACPI tables come from a system BIOS on real hw,
it makes sense that the ACPI tables are coupled with the
virtual machine, since they have to abstract the x86 machine to
the OS's.
This is widely desired as a way to avoid the churn
and proliferation of QEMU-specific interfaces
associated with ACPI tables in bios code.
Notes:
As BIOS can reprogram devices prior to loading
ACPI tables, we pre-format ACPI tables but defer loading
hardware configuration there until tables are loaded.
The code structure was intentionally kept as close
to the seabios original as possible, to simplify
comparison and making sure we didn't lose anything
in translation.
Minor code duplication results, to help ensure there are no functional
regressions, I think it's better to merge it like this and do more code
changes in follow-up patches.
Cross-version compatibility concerns have been addressed:
ACPI tables are exposed to guest as FW_CFG entries.
When running with -M 1.5 and older, this patch disables ACPI
table generation, and doesn't expose ACPI
tables to guest.
As table content is likely to change over time,
the following measures are taken to simplify
cross-version migration:
- All tables besides the RSDP are packed in a single FW CFG entry.
This entry size is currently 23K. We round it up to 64K
to avoid too much churn there.
- Tables are placed in special ROM blob (not mapped into guest memory)
which is automatically migrated together with the guest, same
as BIOS code.
- Offsets where hardware configuration is loaded in ACPI tables
are also migrated, this is in case future ACPI changes make us
rearrange the tables in memory.
This patch reuses some code from SeaBIOS, which was originally under
LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This
relicensing has been acked by all contributors that had contributed to the
code since the v2->v3 relicense. ACKs approving the v2+ relicensing are
listed below. The list might include ACKs from people not holding
copyright on any parts of the reused code, but it's better to err on the
side of caution and include them.
Affected SeaBIOS files (GPLv2+ license headers added)
<http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>:
src/acpi-dsdt-cpu-hotplug.dsl
src/acpi-dsdt-dbug.dsl
src/acpi-dsdt-hpet.dsl
src/acpi-dsdt-isa.dsl
src/acpi-dsdt-pci-crs.dsl
src/acpi.c
src/acpi.h
src/ssdt-misc.dsl
src/ssdt-pcihp.dsl
src/ssdt-proc.dsl
tools/acpi_extract.py
tools/acpi_extract_preprocess.py
Each one of the listed people agreed to the following:
> If you allow the use of your contribution in QEMU under the
> terms of GPLv2 or later as proposed by this patch,
> please respond to this mail including the line:
>
> Acked-by: Name <email address>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Jason Baron <jbaron@akamai.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Dave Frodin <dave.frodin@se-eng.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Kevin O'Connor <kevin@koconnor.net>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Magnus Christensson <magnus.christensson@intel.com>
Acked-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-07-24 17:56:14 +02:00
|
|
|
/* Table structure from Linux kernel (the ACPI tables are under the
|
|
|
|
BSD license) */
|
|
|
|
|
|
|
|
|
|
|
|
#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \
|
|
|
|
uint32_t signature; /* ACPI signature (4 ASCII characters) */ \
|
|
|
|
uint32_t length; /* Length of table, in bytes, including header */ \
|
|
|
|
uint8_t revision; /* ACPI Specification minor version # */ \
|
|
|
|
uint8_t checksum; /* To make sum of entire table == 0 */ \
|
2019-01-03 09:56:36 +01:00
|
|
|
uint8_t oem_id[6] \
|
|
|
|
QEMU_NONSTRING; /* OEM identification */ \
|
|
|
|
uint8_t oem_table_id[8] \
|
|
|
|
QEMU_NONSTRING; /* OEM table identification */ \
|
i386: ACPI table generation code from seabios
This adds C code for generating ACPI tables at runtime,
imported from seabios git tree
commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd
Although ACPI tables come from a system BIOS on real hw,
it makes sense that the ACPI tables are coupled with the
virtual machine, since they have to abstract the x86 machine to
the OS's.
This is widely desired as a way to avoid the churn
and proliferation of QEMU-specific interfaces
associated with ACPI tables in bios code.
Notes:
As BIOS can reprogram devices prior to loading
ACPI tables, we pre-format ACPI tables but defer loading
hardware configuration there until tables are loaded.
The code structure was intentionally kept as close
to the seabios original as possible, to simplify
comparison and making sure we didn't lose anything
in translation.
Minor code duplication results, to help ensure there are no functional
regressions, I think it's better to merge it like this and do more code
changes in follow-up patches.
Cross-version compatibility concerns have been addressed:
ACPI tables are exposed to guest as FW_CFG entries.
When running with -M 1.5 and older, this patch disables ACPI
table generation, and doesn't expose ACPI
tables to guest.
As table content is likely to change over time,
the following measures are taken to simplify
cross-version migration:
- All tables besides the RSDP are packed in a single FW CFG entry.
This entry size is currently 23K. We round it up to 64K
to avoid too much churn there.
- Tables are placed in special ROM blob (not mapped into guest memory)
which is automatically migrated together with the guest, same
as BIOS code.
- Offsets where hardware configuration is loaded in ACPI tables
are also migrated, this is in case future ACPI changes make us
rearrange the tables in memory.
This patch reuses some code from SeaBIOS, which was originally under
LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This
relicensing has been acked by all contributors that had contributed to the
code since the v2->v3 relicense. ACKs approving the v2+ relicensing are
listed below. The list might include ACKs from people not holding
copyright on any parts of the reused code, but it's better to err on the
side of caution and include them.
Affected SeaBIOS files (GPLv2+ license headers added)
<http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>:
src/acpi-dsdt-cpu-hotplug.dsl
src/acpi-dsdt-dbug.dsl
src/acpi-dsdt-hpet.dsl
src/acpi-dsdt-isa.dsl
src/acpi-dsdt-pci-crs.dsl
src/acpi.c
src/acpi.h
src/ssdt-misc.dsl
src/ssdt-pcihp.dsl
src/ssdt-proc.dsl
tools/acpi_extract.py
tools/acpi_extract_preprocess.py
Each one of the listed people agreed to the following:
> If you allow the use of your contribution in QEMU under the
> terms of GPLv2 or later as proposed by this patch,
> please respond to this mail including the line:
>
> Acked-by: Name <email address>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Jason Baron <jbaron@akamai.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Dave Frodin <dave.frodin@se-eng.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Kevin O'Connor <kevin@koconnor.net>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Magnus Christensson <magnus.christensson@intel.com>
Acked-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-07-24 17:56:14 +02:00
|
|
|
uint32_t oem_revision; /* OEM revision number */ \
|
2019-01-03 09:56:36 +01:00
|
|
|
uint8_t asl_compiler_id[4] \
|
|
|
|
QEMU_NONSTRING; /* ASL compiler vendor ID */ \
|
i386: ACPI table generation code from seabios
This adds C code for generating ACPI tables at runtime,
imported from seabios git tree
commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd
Although ACPI tables come from a system BIOS on real hw,
it makes sense that the ACPI tables are coupled with the
virtual machine, since they have to abstract the x86 machine to
the OS's.
This is widely desired as a way to avoid the churn
and proliferation of QEMU-specific interfaces
associated with ACPI tables in bios code.
Notes:
As BIOS can reprogram devices prior to loading
ACPI tables, we pre-format ACPI tables but defer loading
hardware configuration there until tables are loaded.
The code structure was intentionally kept as close
to the seabios original as possible, to simplify
comparison and making sure we didn't lose anything
in translation.
Minor code duplication results, to help ensure there are no functional
regressions, I think it's better to merge it like this and do more code
changes in follow-up patches.
Cross-version compatibility concerns have been addressed:
ACPI tables are exposed to guest as FW_CFG entries.
When running with -M 1.5 and older, this patch disables ACPI
table generation, and doesn't expose ACPI
tables to guest.
As table content is likely to change over time,
the following measures are taken to simplify
cross-version migration:
- All tables besides the RSDP are packed in a single FW CFG entry.
This entry size is currently 23K. We round it up to 64K
to avoid too much churn there.
- Tables are placed in special ROM blob (not mapped into guest memory)
which is automatically migrated together with the guest, same
as BIOS code.
- Offsets where hardware configuration is loaded in ACPI tables
are also migrated, this is in case future ACPI changes make us
rearrange the tables in memory.
This patch reuses some code from SeaBIOS, which was originally under
LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This
relicensing has been acked by all contributors that had contributed to the
code since the v2->v3 relicense. ACKs approving the v2+ relicensing are
listed below. The list might include ACKs from people not holding
copyright on any parts of the reused code, but it's better to err on the
side of caution and include them.
Affected SeaBIOS files (GPLv2+ license headers added)
<http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>:
src/acpi-dsdt-cpu-hotplug.dsl
src/acpi-dsdt-dbug.dsl
src/acpi-dsdt-hpet.dsl
src/acpi-dsdt-isa.dsl
src/acpi-dsdt-pci-crs.dsl
src/acpi.c
src/acpi.h
src/ssdt-misc.dsl
src/ssdt-pcihp.dsl
src/ssdt-proc.dsl
tools/acpi_extract.py
tools/acpi_extract_preprocess.py
Each one of the listed people agreed to the following:
> If you allow the use of your contribution in QEMU under the
> terms of GPLv2 or later as proposed by this patch,
> please respond to this mail including the line:
>
> Acked-by: Name <email address>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Jason Baron <jbaron@akamai.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Dave Frodin <dave.frodin@se-eng.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Kevin O'Connor <kevin@koconnor.net>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Magnus Christensson <magnus.christensson@intel.com>
Acked-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-07-24 17:56:14 +02:00
|
|
|
uint32_t asl_compiler_revision; /* ASL compiler revision number */
|
|
|
|
|
|
|
|
|
2017-05-09 20:10:05 +02:00
|
|
|
/* ACPI common table header */
|
|
|
|
struct AcpiTableHeader {
|
i386: ACPI table generation code from seabios
This adds C code for generating ACPI tables at runtime,
imported from seabios git tree
commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd
Although ACPI tables come from a system BIOS on real hw,
it makes sense that the ACPI tables are coupled with the
virtual machine, since they have to abstract the x86 machine to
the OS's.
This is widely desired as a way to avoid the churn
and proliferation of QEMU-specific interfaces
associated with ACPI tables in bios code.
Notes:
As BIOS can reprogram devices prior to loading
ACPI tables, we pre-format ACPI tables but defer loading
hardware configuration there until tables are loaded.
The code structure was intentionally kept as close
to the seabios original as possible, to simplify
comparison and making sure we didn't lose anything
in translation.
Minor code duplication results, to help ensure there are no functional
regressions, I think it's better to merge it like this and do more code
changes in follow-up patches.
Cross-version compatibility concerns have been addressed:
ACPI tables are exposed to guest as FW_CFG entries.
When running with -M 1.5 and older, this patch disables ACPI
table generation, and doesn't expose ACPI
tables to guest.
As table content is likely to change over time,
the following measures are taken to simplify
cross-version migration:
- All tables besides the RSDP are packed in a single FW CFG entry.
This entry size is currently 23K. We round it up to 64K
to avoid too much churn there.
- Tables are placed in special ROM blob (not mapped into guest memory)
which is automatically migrated together with the guest, same
as BIOS code.
- Offsets where hardware configuration is loaded in ACPI tables
are also migrated, this is in case future ACPI changes make us
rearrange the tables in memory.
This patch reuses some code from SeaBIOS, which was originally under
LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This
relicensing has been acked by all contributors that had contributed to the
code since the v2->v3 relicense. ACKs approving the v2+ relicensing are
listed below. The list might include ACKs from people not holding
copyright on any parts of the reused code, but it's better to err on the
side of caution and include them.
Affected SeaBIOS files (GPLv2+ license headers added)
<http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>:
src/acpi-dsdt-cpu-hotplug.dsl
src/acpi-dsdt-dbug.dsl
src/acpi-dsdt-hpet.dsl
src/acpi-dsdt-isa.dsl
src/acpi-dsdt-pci-crs.dsl
src/acpi.c
src/acpi.h
src/ssdt-misc.dsl
src/ssdt-pcihp.dsl
src/ssdt-proc.dsl
tools/acpi_extract.py
tools/acpi_extract_preprocess.py
Each one of the listed people agreed to the following:
> If you allow the use of your contribution in QEMU under the
> terms of GPLv2 or later as proposed by this patch,
> please respond to this mail including the line:
>
> Acked-by: Name <email address>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Jason Baron <jbaron@akamai.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Dave Frodin <dave.frodin@se-eng.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Kevin O'Connor <kevin@koconnor.net>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Magnus Christensson <magnus.christensson@intel.com>
Acked-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-07-24 17:56:14 +02:00
|
|
|
ACPI_TABLE_HEADER_DEF
|
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiTableHeader AcpiTableHeader;
|
|
|
|
|
2015-05-29 12:28:55 +02:00
|
|
|
struct AcpiGenericAddress {
|
|
|
|
uint8_t space_id; /* Address space where struct or register exists */
|
|
|
|
uint8_t bit_width; /* Size in bits of given register */
|
|
|
|
uint8_t bit_offset; /* Bit offset within the register */
|
2018-02-28 15:23:48 +01:00
|
|
|
uint8_t access_width; /* ACPI 3.0: Minimum Access size (ACPI 3.0),
|
|
|
|
ACPI 2.0: Reserved, Table 5-1 */
|
2015-05-29 12:28:55 +02:00
|
|
|
uint64_t address; /* 64-bit address of struct or register */
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
2018-02-28 15:23:51 +01:00
|
|
|
typedef struct AcpiFadtData {
|
|
|
|
struct AcpiGenericAddress pm1a_cnt; /* PM1a_CNT_BLK */
|
|
|
|
struct AcpiGenericAddress pm1a_evt; /* PM1a_EVT_BLK */
|
|
|
|
struct AcpiGenericAddress pm_tmr; /* PM_TMR_BLK */
|
|
|
|
struct AcpiGenericAddress gpe0_blk; /* GPE0_BLK */
|
|
|
|
struct AcpiGenericAddress reset_reg; /* RESET_REG */
|
2020-05-20 15:19:49 +02:00
|
|
|
struct AcpiGenericAddress sleep_ctl; /* SLEEP_CONTROL_REG */
|
|
|
|
struct AcpiGenericAddress sleep_sts; /* SLEEP_STATUS_REG */
|
2018-02-28 15:23:51 +01:00
|
|
|
uint8_t reset_val; /* RESET_VALUE */
|
|
|
|
uint8_t rev; /* Revision */
|
|
|
|
uint32_t flags; /* Flags */
|
|
|
|
uint32_t smi_cmd; /* SMI_CMD */
|
|
|
|
uint16_t sci_int; /* SCI_INT */
|
|
|
|
uint8_t int_model; /* INT_MODEL */
|
|
|
|
uint8_t acpi_enable_cmd; /* ACPI_ENABLE */
|
|
|
|
uint8_t acpi_disable_cmd; /* ACPI_DISABLE */
|
|
|
|
uint8_t rtc_century; /* CENTURY */
|
|
|
|
uint16_t plvl2_lat; /* P_LVL2_LAT */
|
|
|
|
uint16_t plvl3_lat; /* P_LVL3_LAT */
|
2018-02-28 15:23:54 +01:00
|
|
|
uint16_t arm_boot_arch; /* ARM_BOOT_ARCH */
|
|
|
|
uint8_t minor_ver; /* FADT Minor Version */
|
2018-02-28 15:23:51 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* respective tables offsets within ACPI_BUILD_TABLE_FILE,
|
|
|
|
* NULL if table doesn't exist (in that case field's value
|
|
|
|
* won't be patched by linker and will be kept set to 0)
|
|
|
|
*/
|
|
|
|
unsigned *facs_tbl_offset; /* FACS offset in */
|
|
|
|
unsigned *dsdt_tbl_offset;
|
|
|
|
unsigned *xdsdt_tbl_offset;
|
|
|
|
} AcpiFadtData;
|
|
|
|
|
2017-01-09 12:40:21 +01:00
|
|
|
#define ACPI_FADT_ARM_PSCI_COMPLIANT (1 << 0)
|
|
|
|
#define ACPI_FADT_ARM_PSCI_USE_HVC (1 << 1)
|
2015-05-29 12:28:55 +02:00
|
|
|
|
2015-06-15 19:06:11 +02:00
|
|
|
/*
|
|
|
|
* Serial Port Console Redirection Table (SPCR), Rev. 1.02
|
|
|
|
*
|
|
|
|
* For .interface_type see Debug Port Table 2 (DBG2) serial port
|
|
|
|
* subtypes in Table 3, Rev. May 22, 2012
|
|
|
|
*/
|
|
|
|
struct AcpiSerialPortConsoleRedirection {
|
|
|
|
ACPI_TABLE_HEADER_DEF
|
|
|
|
uint8_t interface_type;
|
|
|
|
uint8_t reserved1[3];
|
|
|
|
struct AcpiGenericAddress base_address;
|
|
|
|
uint8_t interrupt_types;
|
|
|
|
uint8_t irq;
|
|
|
|
uint32_t gsi;
|
|
|
|
uint8_t baud;
|
|
|
|
uint8_t parity;
|
|
|
|
uint8_t stopbits;
|
|
|
|
uint8_t flowctrl;
|
|
|
|
uint8_t term_type;
|
|
|
|
uint8_t reserved2;
|
|
|
|
uint16_t pci_device_id;
|
|
|
|
uint16_t pci_vendor_id;
|
|
|
|
uint8_t pci_bus;
|
|
|
|
uint8_t pci_slot;
|
|
|
|
uint8_t pci_func;
|
|
|
|
uint32_t pci_flags;
|
|
|
|
uint8_t pci_seg;
|
|
|
|
uint32_t reserved3;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiSerialPortConsoleRedirection
|
|
|
|
AcpiSerialPortConsoleRedirection;
|
|
|
|
|
i386: ACPI table generation code from seabios
This adds C code for generating ACPI tables at runtime,
imported from seabios git tree
commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd
Although ACPI tables come from a system BIOS on real hw,
it makes sense that the ACPI tables are coupled with the
virtual machine, since they have to abstract the x86 machine to
the OS's.
This is widely desired as a way to avoid the churn
and proliferation of QEMU-specific interfaces
associated with ACPI tables in bios code.
Notes:
As BIOS can reprogram devices prior to loading
ACPI tables, we pre-format ACPI tables but defer loading
hardware configuration there until tables are loaded.
The code structure was intentionally kept as close
to the seabios original as possible, to simplify
comparison and making sure we didn't lose anything
in translation.
Minor code duplication results, to help ensure there are no functional
regressions, I think it's better to merge it like this and do more code
changes in follow-up patches.
Cross-version compatibility concerns have been addressed:
ACPI tables are exposed to guest as FW_CFG entries.
When running with -M 1.5 and older, this patch disables ACPI
table generation, and doesn't expose ACPI
tables to guest.
As table content is likely to change over time,
the following measures are taken to simplify
cross-version migration:
- All tables besides the RSDP are packed in a single FW CFG entry.
This entry size is currently 23K. We round it up to 64K
to avoid too much churn there.
- Tables are placed in special ROM blob (not mapped into guest memory)
which is automatically migrated together with the guest, same
as BIOS code.
- Offsets where hardware configuration is loaded in ACPI tables
are also migrated, this is in case future ACPI changes make us
rearrange the tables in memory.
This patch reuses some code from SeaBIOS, which was originally under
LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This
relicensing has been acked by all contributors that had contributed to the
code since the v2->v3 relicense. ACKs approving the v2+ relicensing are
listed below. The list might include ACKs from people not holding
copyright on any parts of the reused code, but it's better to err on the
side of caution and include them.
Affected SeaBIOS files (GPLv2+ license headers added)
<http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>:
src/acpi-dsdt-cpu-hotplug.dsl
src/acpi-dsdt-dbug.dsl
src/acpi-dsdt-hpet.dsl
src/acpi-dsdt-isa.dsl
src/acpi-dsdt-pci-crs.dsl
src/acpi.c
src/acpi.h
src/ssdt-misc.dsl
src/ssdt-pcihp.dsl
src/ssdt-proc.dsl
tools/acpi_extract.py
tools/acpi_extract_preprocess.py
Each one of the listed people agreed to the following:
> If you allow the use of your contribution in QEMU under the
> terms of GPLv2 or later as proposed by this patch,
> please respond to this mail including the line:
>
> Acked-by: Name <email address>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Jason Baron <jbaron@akamai.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Dave Frodin <dave.frodin@se-eng.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Kevin O'Connor <kevin@koconnor.net>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Magnus Christensson <magnus.christensson@intel.com>
Acked-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-07-24 17:56:14 +02:00
|
|
|
/*
|
|
|
|
* ACPI 1.0 Firmware ACPI Control Structure (FACS)
|
|
|
|
*/
|
2017-05-09 20:10:05 +02:00
|
|
|
struct AcpiFacsDescriptorRev1 {
|
i386: ACPI table generation code from seabios
This adds C code for generating ACPI tables at runtime,
imported from seabios git tree
commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd
Although ACPI tables come from a system BIOS on real hw,
it makes sense that the ACPI tables are coupled with the
virtual machine, since they have to abstract the x86 machine to
the OS's.
This is widely desired as a way to avoid the churn
and proliferation of QEMU-specific interfaces
associated with ACPI tables in bios code.
Notes:
As BIOS can reprogram devices prior to loading
ACPI tables, we pre-format ACPI tables but defer loading
hardware configuration there until tables are loaded.
The code structure was intentionally kept as close
to the seabios original as possible, to simplify
comparison and making sure we didn't lose anything
in translation.
Minor code duplication results, to help ensure there are no functional
regressions, I think it's better to merge it like this and do more code
changes in follow-up patches.
Cross-version compatibility concerns have been addressed:
ACPI tables are exposed to guest as FW_CFG entries.
When running with -M 1.5 and older, this patch disables ACPI
table generation, and doesn't expose ACPI
tables to guest.
As table content is likely to change over time,
the following measures are taken to simplify
cross-version migration:
- All tables besides the RSDP are packed in a single FW CFG entry.
This entry size is currently 23K. We round it up to 64K
to avoid too much churn there.
- Tables are placed in special ROM blob (not mapped into guest memory)
which is automatically migrated together with the guest, same
as BIOS code.
- Offsets where hardware configuration is loaded in ACPI tables
are also migrated, this is in case future ACPI changes make us
rearrange the tables in memory.
This patch reuses some code from SeaBIOS, which was originally under
LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This
relicensing has been acked by all contributors that had contributed to the
code since the v2->v3 relicense. ACKs approving the v2+ relicensing are
listed below. The list might include ACKs from people not holding
copyright on any parts of the reused code, but it's better to err on the
side of caution and include them.
Affected SeaBIOS files (GPLv2+ license headers added)
<http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>:
src/acpi-dsdt-cpu-hotplug.dsl
src/acpi-dsdt-dbug.dsl
src/acpi-dsdt-hpet.dsl
src/acpi-dsdt-isa.dsl
src/acpi-dsdt-pci-crs.dsl
src/acpi.c
src/acpi.h
src/ssdt-misc.dsl
src/ssdt-pcihp.dsl
src/ssdt-proc.dsl
tools/acpi_extract.py
tools/acpi_extract_preprocess.py
Each one of the listed people agreed to the following:
> If you allow the use of your contribution in QEMU under the
> terms of GPLv2 or later as proposed by this patch,
> please respond to this mail including the line:
>
> Acked-by: Name <email address>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Jason Baron <jbaron@akamai.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Dave Frodin <dave.frodin@se-eng.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Kevin O'Connor <kevin@koconnor.net>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Magnus Christensson <magnus.christensson@intel.com>
Acked-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-07-24 17:56:14 +02:00
|
|
|
uint32_t signature; /* ACPI Signature */
|
|
|
|
uint32_t length; /* Length of structure, in bytes */
|
|
|
|
uint32_t hardware_signature; /* Hardware configuration signature */
|
|
|
|
uint32_t firmware_waking_vector; /* ACPI OS waking vector */
|
|
|
|
uint32_t global_lock; /* Global Lock */
|
|
|
|
uint32_t flags;
|
|
|
|
uint8_t resverved3 [40]; /* Reserved - must be zero */
|
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiFacsDescriptorRev1 AcpiFacsDescriptorRev1;
|
|
|
|
|
|
|
|
/* Values for Type in APIC sub-headers */
|
|
|
|
|
|
|
|
#define ACPI_APIC_PROCESSOR 0
|
|
|
|
#define ACPI_APIC_IO 1
|
|
|
|
#define ACPI_APIC_XRUPT_OVERRIDE 2
|
|
|
|
#define ACPI_APIC_NMI 3
|
|
|
|
#define ACPI_APIC_LOCAL_NMI 4
|
|
|
|
#define ACPI_APIC_ADDRESS_OVERRIDE 5
|
|
|
|
#define ACPI_APIC_IO_SAPIC 6
|
|
|
|
#define ACPI_APIC_LOCAL_SAPIC 7
|
|
|
|
#define ACPI_APIC_XRUPT_SOURCE 8
|
2015-05-29 12:28:56 +02:00
|
|
|
#define ACPI_APIC_LOCAL_X2APIC 9
|
|
|
|
#define ACPI_APIC_LOCAL_X2APIC_NMI 10
|
2017-01-09 12:40:21 +01:00
|
|
|
#define ACPI_APIC_GENERIC_CPU_INTERFACE 11
|
2015-05-29 12:28:56 +02:00
|
|
|
#define ACPI_APIC_GENERIC_DISTRIBUTOR 12
|
|
|
|
#define ACPI_APIC_GENERIC_MSI_FRAME 13
|
|
|
|
#define ACPI_APIC_GENERIC_REDISTRIBUTOR 14
|
2016-10-04 14:28:09 +02:00
|
|
|
#define ACPI_APIC_GENERIC_TRANSLATOR 15
|
|
|
|
#define ACPI_APIC_RESERVED 16 /* 16 and greater are reserved */
|
i386: ACPI table generation code from seabios
This adds C code for generating ACPI tables at runtime,
imported from seabios git tree
commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd
Although ACPI tables come from a system BIOS on real hw,
it makes sense that the ACPI tables are coupled with the
virtual machine, since they have to abstract the x86 machine to
the OS's.
This is widely desired as a way to avoid the churn
and proliferation of QEMU-specific interfaces
associated with ACPI tables in bios code.
Notes:
As BIOS can reprogram devices prior to loading
ACPI tables, we pre-format ACPI tables but defer loading
hardware configuration there until tables are loaded.
The code structure was intentionally kept as close
to the seabios original as possible, to simplify
comparison and making sure we didn't lose anything
in translation.
Minor code duplication results, to help ensure there are no functional
regressions, I think it's better to merge it like this and do more code
changes in follow-up patches.
Cross-version compatibility concerns have been addressed:
ACPI tables are exposed to guest as FW_CFG entries.
When running with -M 1.5 and older, this patch disables ACPI
table generation, and doesn't expose ACPI
tables to guest.
As table content is likely to change over time,
the following measures are taken to simplify
cross-version migration:
- All tables besides the RSDP are packed in a single FW CFG entry.
This entry size is currently 23K. We round it up to 64K
to avoid too much churn there.
- Tables are placed in special ROM blob (not mapped into guest memory)
which is automatically migrated together with the guest, same
as BIOS code.
- Offsets where hardware configuration is loaded in ACPI tables
are also migrated, this is in case future ACPI changes make us
rearrange the tables in memory.
This patch reuses some code from SeaBIOS, which was originally under
LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This
relicensing has been acked by all contributors that had contributed to the
code since the v2->v3 relicense. ACKs approving the v2+ relicensing are
listed below. The list might include ACKs from people not holding
copyright on any parts of the reused code, but it's better to err on the
side of caution and include them.
Affected SeaBIOS files (GPLv2+ license headers added)
<http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>:
src/acpi-dsdt-cpu-hotplug.dsl
src/acpi-dsdt-dbug.dsl
src/acpi-dsdt-hpet.dsl
src/acpi-dsdt-isa.dsl
src/acpi-dsdt-pci-crs.dsl
src/acpi.c
src/acpi.h
src/ssdt-misc.dsl
src/ssdt-pcihp.dsl
src/ssdt-proc.dsl
tools/acpi_extract.py
tools/acpi_extract_preprocess.py
Each one of the listed people agreed to the following:
> If you allow the use of your contribution in QEMU under the
> terms of GPLv2 or later as proposed by this patch,
> please respond to this mail including the line:
>
> Acked-by: Name <email address>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Jason Baron <jbaron@akamai.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Dave Frodin <dave.frodin@se-eng.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Kevin O'Connor <kevin@koconnor.net>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Magnus Christensson <magnus.christensson@intel.com>
Acked-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-07-24 17:56:14 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
|
|
|
|
*/
|
|
|
|
#define ACPI_SUB_HEADER_DEF /* Common ACPI sub-structure header */\
|
|
|
|
uint8_t type; \
|
|
|
|
uint8_t length;
|
|
|
|
|
|
|
|
/* Sub-structures for MADT */
|
|
|
|
|
2017-05-09 20:10:05 +02:00
|
|
|
struct AcpiMadtProcessorApic {
|
i386: ACPI table generation code from seabios
This adds C code for generating ACPI tables at runtime,
imported from seabios git tree
commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd
Although ACPI tables come from a system BIOS on real hw,
it makes sense that the ACPI tables are coupled with the
virtual machine, since they have to abstract the x86 machine to
the OS's.
This is widely desired as a way to avoid the churn
and proliferation of QEMU-specific interfaces
associated with ACPI tables in bios code.
Notes:
As BIOS can reprogram devices prior to loading
ACPI tables, we pre-format ACPI tables but defer loading
hardware configuration there until tables are loaded.
The code structure was intentionally kept as close
to the seabios original as possible, to simplify
comparison and making sure we didn't lose anything
in translation.
Minor code duplication results, to help ensure there are no functional
regressions, I think it's better to merge it like this and do more code
changes in follow-up patches.
Cross-version compatibility concerns have been addressed:
ACPI tables are exposed to guest as FW_CFG entries.
When running with -M 1.5 and older, this patch disables ACPI
table generation, and doesn't expose ACPI
tables to guest.
As table content is likely to change over time,
the following measures are taken to simplify
cross-version migration:
- All tables besides the RSDP are packed in a single FW CFG entry.
This entry size is currently 23K. We round it up to 64K
to avoid too much churn there.
- Tables are placed in special ROM blob (not mapped into guest memory)
which is automatically migrated together with the guest, same
as BIOS code.
- Offsets where hardware configuration is loaded in ACPI tables
are also migrated, this is in case future ACPI changes make us
rearrange the tables in memory.
This patch reuses some code from SeaBIOS, which was originally under
LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This
relicensing has been acked by all contributors that had contributed to the
code since the v2->v3 relicense. ACKs approving the v2+ relicensing are
listed below. The list might include ACKs from people not holding
copyright on any parts of the reused code, but it's better to err on the
side of caution and include them.
Affected SeaBIOS files (GPLv2+ license headers added)
<http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>:
src/acpi-dsdt-cpu-hotplug.dsl
src/acpi-dsdt-dbug.dsl
src/acpi-dsdt-hpet.dsl
src/acpi-dsdt-isa.dsl
src/acpi-dsdt-pci-crs.dsl
src/acpi.c
src/acpi.h
src/ssdt-misc.dsl
src/ssdt-pcihp.dsl
src/ssdt-proc.dsl
tools/acpi_extract.py
tools/acpi_extract_preprocess.py
Each one of the listed people agreed to the following:
> If you allow the use of your contribution in QEMU under the
> terms of GPLv2 or later as proposed by this patch,
> please respond to this mail including the line:
>
> Acked-by: Name <email address>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Jason Baron <jbaron@akamai.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Dave Frodin <dave.frodin@se-eng.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Kevin O'Connor <kevin@koconnor.net>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Magnus Christensson <magnus.christensson@intel.com>
Acked-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-07-24 17:56:14 +02:00
|
|
|
ACPI_SUB_HEADER_DEF
|
|
|
|
uint8_t processor_id; /* ACPI processor id */
|
|
|
|
uint8_t local_apic_id; /* Processor's local APIC id */
|
|
|
|
uint32_t flags;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiMadtProcessorApic AcpiMadtProcessorApic;
|
|
|
|
|
2017-05-09 20:10:05 +02:00
|
|
|
struct AcpiMadtIoApic {
|
i386: ACPI table generation code from seabios
This adds C code for generating ACPI tables at runtime,
imported from seabios git tree
commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd
Although ACPI tables come from a system BIOS on real hw,
it makes sense that the ACPI tables are coupled with the
virtual machine, since they have to abstract the x86 machine to
the OS's.
This is widely desired as a way to avoid the churn
and proliferation of QEMU-specific interfaces
associated with ACPI tables in bios code.
Notes:
As BIOS can reprogram devices prior to loading
ACPI tables, we pre-format ACPI tables but defer loading
hardware configuration there until tables are loaded.
The code structure was intentionally kept as close
to the seabios original as possible, to simplify
comparison and making sure we didn't lose anything
in translation.
Minor code duplication results, to help ensure there are no functional
regressions, I think it's better to merge it like this and do more code
changes in follow-up patches.
Cross-version compatibility concerns have been addressed:
ACPI tables are exposed to guest as FW_CFG entries.
When running with -M 1.5 and older, this patch disables ACPI
table generation, and doesn't expose ACPI
tables to guest.
As table content is likely to change over time,
the following measures are taken to simplify
cross-version migration:
- All tables besides the RSDP are packed in a single FW CFG entry.
This entry size is currently 23K. We round it up to 64K
to avoid too much churn there.
- Tables are placed in special ROM blob (not mapped into guest memory)
which is automatically migrated together with the guest, same
as BIOS code.
- Offsets where hardware configuration is loaded in ACPI tables
are also migrated, this is in case future ACPI changes make us
rearrange the tables in memory.
This patch reuses some code from SeaBIOS, which was originally under
LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This
relicensing has been acked by all contributors that had contributed to the
code since the v2->v3 relicense. ACKs approving the v2+ relicensing are
listed below. The list might include ACKs from people not holding
copyright on any parts of the reused code, but it's better to err on the
side of caution and include them.
Affected SeaBIOS files (GPLv2+ license headers added)
<http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>:
src/acpi-dsdt-cpu-hotplug.dsl
src/acpi-dsdt-dbug.dsl
src/acpi-dsdt-hpet.dsl
src/acpi-dsdt-isa.dsl
src/acpi-dsdt-pci-crs.dsl
src/acpi.c
src/acpi.h
src/ssdt-misc.dsl
src/ssdt-pcihp.dsl
src/ssdt-proc.dsl
tools/acpi_extract.py
tools/acpi_extract_preprocess.py
Each one of the listed people agreed to the following:
> If you allow the use of your contribution in QEMU under the
> terms of GPLv2 or later as proposed by this patch,
> please respond to this mail including the line:
>
> Acked-by: Name <email address>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Jason Baron <jbaron@akamai.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Dave Frodin <dave.frodin@se-eng.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Kevin O'Connor <kevin@koconnor.net>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Magnus Christensson <magnus.christensson@intel.com>
Acked-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-07-24 17:56:14 +02:00
|
|
|
ACPI_SUB_HEADER_DEF
|
|
|
|
uint8_t io_apic_id; /* I/O APIC ID */
|
|
|
|
uint8_t reserved; /* Reserved - must be zero */
|
|
|
|
uint32_t address; /* APIC physical address */
|
|
|
|
uint32_t interrupt; /* Global system interrupt where INTI
|
|
|
|
* lines start */
|
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiMadtIoApic AcpiMadtIoApic;
|
|
|
|
|
|
|
|
struct AcpiMadtIntsrcovr {
|
|
|
|
ACPI_SUB_HEADER_DEF
|
|
|
|
uint8_t bus;
|
|
|
|
uint8_t source;
|
|
|
|
uint32_t gsi;
|
|
|
|
uint16_t flags;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiMadtIntsrcovr AcpiMadtIntsrcovr;
|
|
|
|
|
|
|
|
struct AcpiMadtLocalNmi {
|
|
|
|
ACPI_SUB_HEADER_DEF
|
|
|
|
uint8_t processor_id; /* ACPI processor id */
|
|
|
|
uint16_t flags; /* MPS INTI flags */
|
|
|
|
uint8_t lint; /* Local APIC LINT# */
|
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiMadtLocalNmi AcpiMadtLocalNmi;
|
|
|
|
|
2016-10-19 14:05:31 +02:00
|
|
|
struct AcpiMadtProcessorX2Apic {
|
|
|
|
ACPI_SUB_HEADER_DEF
|
|
|
|
uint16_t reserved;
|
|
|
|
uint32_t x2apic_id; /* Processor's local x2APIC ID */
|
|
|
|
uint32_t flags;
|
|
|
|
uint32_t uid; /* Processor object _UID */
|
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiMadtProcessorX2Apic AcpiMadtProcessorX2Apic;
|
|
|
|
|
|
|
|
struct AcpiMadtLocalX2ApicNmi {
|
|
|
|
ACPI_SUB_HEADER_DEF
|
|
|
|
uint16_t flags; /* MPS INTI flags */
|
|
|
|
uint32_t uid; /* Processor object _UID */
|
|
|
|
uint8_t lint; /* Local APIC LINT# */
|
|
|
|
uint8_t reserved[3]; /* Local APIC LINT# */
|
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiMadtLocalX2ApicNmi AcpiMadtLocalX2ApicNmi;
|
|
|
|
|
2017-01-09 12:40:21 +01:00
|
|
|
struct AcpiMadtGenericCpuInterface {
|
2015-05-29 12:28:56 +02:00
|
|
|
ACPI_SUB_HEADER_DEF
|
|
|
|
uint16_t reserved;
|
|
|
|
uint32_t cpu_interface_number;
|
|
|
|
uint32_t uid;
|
|
|
|
uint32_t flags;
|
|
|
|
uint32_t parking_version;
|
|
|
|
uint32_t performance_interrupt;
|
|
|
|
uint64_t parked_address;
|
|
|
|
uint64_t base_address;
|
|
|
|
uint64_t gicv_base_address;
|
|
|
|
uint64_t gich_base_address;
|
|
|
|
uint32_t vgic_interrupt;
|
|
|
|
uint64_t gicr_base_address;
|
|
|
|
uint64_t arm_mpidr;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
2017-01-09 12:40:21 +01:00
|
|
|
typedef struct AcpiMadtGenericCpuInterface AcpiMadtGenericCpuInterface;
|
|
|
|
|
|
|
|
/* GICC CPU Interface Flags */
|
|
|
|
#define ACPI_MADT_GICC_ENABLED 1
|
2015-05-29 12:28:56 +02:00
|
|
|
|
|
|
|
struct AcpiMadtGenericDistributor {
|
|
|
|
ACPI_SUB_HEADER_DEF
|
|
|
|
uint16_t reserved;
|
|
|
|
uint32_t gic_id;
|
|
|
|
uint64_t base_address;
|
|
|
|
uint32_t global_irq_base;
|
2016-06-17 16:23:48 +02:00
|
|
|
/* ACPI 5.1 Errata 1228 Present GIC version in MADT table */
|
|
|
|
uint8_t version;
|
|
|
|
uint8_t reserved2[3];
|
2015-05-29 12:28:56 +02:00
|
|
|
} QEMU_PACKED;
|
|
|
|
|
|
|
|
typedef struct AcpiMadtGenericDistributor AcpiMadtGenericDistributor;
|
|
|
|
|
2015-06-26 15:22:36 +02:00
|
|
|
struct AcpiMadtGenericMsiFrame {
|
|
|
|
ACPI_SUB_HEADER_DEF
|
|
|
|
uint16_t reserved;
|
|
|
|
uint32_t gic_msi_frame_id;
|
|
|
|
uint64_t base_address;
|
|
|
|
uint32_t flags;
|
|
|
|
uint16_t spi_count;
|
|
|
|
uint16_t spi_base;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
|
|
|
typedef struct AcpiMadtGenericMsiFrame AcpiMadtGenericMsiFrame;
|
|
|
|
|
2015-09-24 02:29:37 +02:00
|
|
|
struct AcpiMadtGenericRedistributor {
|
|
|
|
ACPI_SUB_HEADER_DEF
|
|
|
|
uint16_t reserved;
|
|
|
|
uint64_t base_address;
|
|
|
|
uint32_t range_length;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
|
|
|
typedef struct AcpiMadtGenericRedistributor AcpiMadtGenericRedistributor;
|
|
|
|
|
2016-10-04 14:28:09 +02:00
|
|
|
struct AcpiMadtGenericTranslator {
|
|
|
|
ACPI_SUB_HEADER_DEF
|
|
|
|
uint16_t reserved;
|
|
|
|
uint32_t translation_id;
|
|
|
|
uint64_t base_address;
|
|
|
|
uint32_t reserved2;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
|
|
|
|
typedef struct AcpiMadtGenericTranslator AcpiMadtGenericTranslator;
|
|
|
|
|
2015-05-29 12:28:56 +02:00
|
|
|
/*
|
|
|
|
* Generic Timer Description Table (GTDT)
|
|
|
|
*/
|
2017-01-09 12:40:23 +01:00
|
|
|
#define ACPI_GTDT_INTERRUPT_MODE_LEVEL (0 << 0)
|
2017-01-09 12:40:21 +01:00
|
|
|
#define ACPI_GTDT_INTERRUPT_MODE_EDGE (1 << 0)
|
|
|
|
#define ACPI_GTDT_CAP_ALWAYS_ON (1 << 2)
|
2015-05-29 12:28:56 +02:00
|
|
|
|
|
|
|
struct AcpiGenericTimerTable {
|
|
|
|
ACPI_TABLE_HEADER_DEF
|
|
|
|
uint64_t counter_block_addresss;
|
|
|
|
uint32_t reserved;
|
|
|
|
uint32_t secure_el1_interrupt;
|
|
|
|
uint32_t secure_el1_flags;
|
|
|
|
uint32_t non_secure_el1_interrupt;
|
|
|
|
uint32_t non_secure_el1_flags;
|
|
|
|
uint32_t virtual_timer_interrupt;
|
|
|
|
uint32_t virtual_timer_flags;
|
|
|
|
uint32_t non_secure_el2_interrupt;
|
|
|
|
uint32_t non_secure_el2_flags;
|
|
|
|
uint64_t counter_read_block_address;
|
|
|
|
uint32_t platform_timer_count;
|
|
|
|
uint32_t platform_timer_offset;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiGenericTimerTable AcpiGenericTimerTable;
|
|
|
|
|
2016-10-24 17:26:54 +02:00
|
|
|
/*
|
|
|
|
* Input Output Remapping Table (IORT)
|
|
|
|
* Conforms to "IO Remapping Table System Software on ARM Platforms",
|
|
|
|
* Document number: ARM DEN 0049B, October 2015
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct AcpiIortTable {
|
|
|
|
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
|
|
|
|
uint32_t node_count;
|
|
|
|
uint32_t node_offset;
|
|
|
|
uint32_t reserved;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiIortTable AcpiIortTable;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* IORT node types
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define ACPI_IORT_NODE_HEADER_DEF /* Node format common fields */ \
|
|
|
|
uint8_t type; \
|
|
|
|
uint16_t length; \
|
|
|
|
uint8_t revision; \
|
|
|
|
uint32_t reserved; \
|
|
|
|
uint32_t mapping_count; \
|
|
|
|
uint32_t mapping_offset;
|
|
|
|
|
|
|
|
/* Values for node Type above */
|
|
|
|
enum {
|
|
|
|
ACPI_IORT_NODE_ITS_GROUP = 0x00,
|
|
|
|
ACPI_IORT_NODE_NAMED_COMPONENT = 0x01,
|
|
|
|
ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02,
|
|
|
|
ACPI_IORT_NODE_SMMU = 0x03,
|
|
|
|
ACPI_IORT_NODE_SMMU_V3 = 0x04
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AcpiIortIdMapping {
|
|
|
|
uint32_t input_base;
|
|
|
|
uint32_t id_count;
|
|
|
|
uint32_t output_base;
|
|
|
|
uint32_t output_reference;
|
|
|
|
uint32_t flags;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiIortIdMapping AcpiIortIdMapping;
|
|
|
|
|
|
|
|
struct AcpiIortMemoryAccess {
|
|
|
|
uint32_t cache_coherency;
|
|
|
|
uint8_t hints;
|
|
|
|
uint16_t reserved;
|
|
|
|
uint8_t memory_flags;
|
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiIortMemoryAccess AcpiIortMemoryAccess;
|
|
|
|
|
|
|
|
struct AcpiIortItsGroup {
|
|
|
|
ACPI_IORT_NODE_HEADER_DEF
|
|
|
|
uint32_t its_count;
|
misc: Replace zero-length arrays with flexible array member (automatic)
Description copied from Linux kernel commit from Gustavo A. R. Silva
(see [3]):
--v-- description start --v--
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to
declare variable-length types such as these ones is a flexible
array member [1], introduced in C99:
struct foo {
int stuff;
struct boo array[];
};
By making use of the mechanism above, we will get a compiler
warning in case the flexible array does not occur last in the
structure, which will help us prevent some kind of undefined
behavior bugs from being unadvertenly introduced [2] to the
Linux codebase from now on.
--^-- description end --^--
Do the similar housekeeping in the QEMU codebase (which uses
C99 since commit 7be41675f7cb).
All these instances of code were found with the help of the
following Coccinelle script:
@@
identifier s, m, a;
type t, T;
@@
struct s {
...
t m;
- T a[0];
+ T a[];
};
@@
identifier s, m, a;
type t, T;
@@
struct s {
...
t m;
- T a[0];
+ T a[];
} QEMU_PACKED;
[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=76497732932f
[3] https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=17642a2fbd2c1
Inspired-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-03-04 16:38:15 +01:00
|
|
|
uint32_t identifiers[];
|
2016-10-24 17:26:54 +02:00
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiIortItsGroup AcpiIortItsGroup;
|
|
|
|
|
2019-01-21 11:23:11 +01:00
|
|
|
#define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE 1
|
|
|
|
|
2018-05-04 19:05:52 +02:00
|
|
|
struct AcpiIortSmmu3 {
|
|
|
|
ACPI_IORT_NODE_HEADER_DEF
|
|
|
|
uint64_t base_address;
|
|
|
|
uint32_t flags;
|
|
|
|
uint32_t reserved2;
|
|
|
|
uint64_t vatos_address;
|
|
|
|
uint32_t model;
|
|
|
|
uint32_t event_gsiv;
|
|
|
|
uint32_t pri_gsiv;
|
|
|
|
uint32_t gerr_gsiv;
|
|
|
|
uint32_t sync_gsiv;
|
misc: Replace zero-length arrays with flexible array member (automatic)
Description copied from Linux kernel commit from Gustavo A. R. Silva
(see [3]):
--v-- description start --v--
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to
declare variable-length types such as these ones is a flexible
array member [1], introduced in C99:
struct foo {
int stuff;
struct boo array[];
};
By making use of the mechanism above, we will get a compiler
warning in case the flexible array does not occur last in the
structure, which will help us prevent some kind of undefined
behavior bugs from being unadvertenly introduced [2] to the
Linux codebase from now on.
--^-- description end --^--
Do the similar housekeeping in the QEMU codebase (which uses
C99 since commit 7be41675f7cb).
All these instances of code were found with the help of the
following Coccinelle script:
@@
identifier s, m, a;
type t, T;
@@
struct s {
...
t m;
- T a[0];
+ T a[];
};
@@
identifier s, m, a;
type t, T;
@@
struct s {
...
t m;
- T a[0];
+ T a[];
} QEMU_PACKED;
[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=76497732932f
[3] https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=17642a2fbd2c1
Inspired-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-03-04 16:38:15 +01:00
|
|
|
AcpiIortIdMapping id_mapping_array[];
|
2018-05-04 19:05:52 +02:00
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiIortSmmu3 AcpiIortSmmu3;
|
|
|
|
|
2016-10-24 17:26:54 +02:00
|
|
|
struct AcpiIortRC {
|
|
|
|
ACPI_IORT_NODE_HEADER_DEF
|
|
|
|
AcpiIortMemoryAccess memory_properties;
|
|
|
|
uint32_t ats_attribute;
|
|
|
|
uint32_t pci_segment_number;
|
misc: Replace zero-length arrays with flexible array member (automatic)
Description copied from Linux kernel commit from Gustavo A. R. Silva
(see [3]):
--v-- description start --v--
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to
declare variable-length types such as these ones is a flexible
array member [1], introduced in C99:
struct foo {
int stuff;
struct boo array[];
};
By making use of the mechanism above, we will get a compiler
warning in case the flexible array does not occur last in the
structure, which will help us prevent some kind of undefined
behavior bugs from being unadvertenly introduced [2] to the
Linux codebase from now on.
--^-- description end --^--
Do the similar housekeeping in the QEMU codebase (which uses
C99 since commit 7be41675f7cb).
All these instances of code were found with the help of the
following Coccinelle script:
@@
identifier s, m, a;
type t, T;
@@
struct s {
...
t m;
- T a[0];
+ T a[];
};
@@
identifier s, m, a;
type t, T;
@@
struct s {
...
t m;
- T a[0];
+ T a[];
} QEMU_PACKED;
[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=76497732932f
[3] https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=17642a2fbd2c1
Inspired-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-03-04 16:38:15 +01:00
|
|
|
AcpiIortIdMapping id_mapping_array[];
|
2016-10-24 17:26:54 +02:00
|
|
|
} QEMU_PACKED;
|
|
|
|
typedef struct AcpiIortRC AcpiIortRC;
|
|
|
|
|
i386: ACPI table generation code from seabios
This adds C code for generating ACPI tables at runtime,
imported from seabios git tree
commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd
Although ACPI tables come from a system BIOS on real hw,
it makes sense that the ACPI tables are coupled with the
virtual machine, since they have to abstract the x86 machine to
the OS's.
This is widely desired as a way to avoid the churn
and proliferation of QEMU-specific interfaces
associated with ACPI tables in bios code.
Notes:
As BIOS can reprogram devices prior to loading
ACPI tables, we pre-format ACPI tables but defer loading
hardware configuration there until tables are loaded.
The code structure was intentionally kept as close
to the seabios original as possible, to simplify
comparison and making sure we didn't lose anything
in translation.
Minor code duplication results, to help ensure there are no functional
regressions, I think it's better to merge it like this and do more code
changes in follow-up patches.
Cross-version compatibility concerns have been addressed:
ACPI tables are exposed to guest as FW_CFG entries.
When running with -M 1.5 and older, this patch disables ACPI
table generation, and doesn't expose ACPI
tables to guest.
As table content is likely to change over time,
the following measures are taken to simplify
cross-version migration:
- All tables besides the RSDP are packed in a single FW CFG entry.
This entry size is currently 23K. We round it up to 64K
to avoid too much churn there.
- Tables are placed in special ROM blob (not mapped into guest memory)
which is automatically migrated together with the guest, same
as BIOS code.
- Offsets where hardware configuration is loaded in ACPI tables
are also migrated, this is in case future ACPI changes make us
rearrange the tables in memory.
This patch reuses some code from SeaBIOS, which was originally under
LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This
relicensing has been acked by all contributors that had contributed to the
code since the v2->v3 relicense. ACKs approving the v2+ relicensing are
listed below. The list might include ACKs from people not holding
copyright on any parts of the reused code, but it's better to err on the
side of caution and include them.
Affected SeaBIOS files (GPLv2+ license headers added)
<http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>:
src/acpi-dsdt-cpu-hotplug.dsl
src/acpi-dsdt-dbug.dsl
src/acpi-dsdt-hpet.dsl
src/acpi-dsdt-isa.dsl
src/acpi-dsdt-pci-crs.dsl
src/acpi.c
src/acpi.h
src/ssdt-misc.dsl
src/ssdt-pcihp.dsl
src/ssdt-proc.dsl
tools/acpi_extract.py
tools/acpi_extract_preprocess.py
Each one of the listed people agreed to the following:
> If you allow the use of your contribution in QEMU under the
> terms of GPLv2 or later as proposed by this patch,
> please respond to this mail including the line:
>
> Acked-by: Name <email address>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Jason Baron <jbaron@akamai.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Dave Frodin <dave.frodin@se-eng.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Kevin O'Connor <kevin@koconnor.net>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Magnus Christensson <magnus.christensson@intel.com>
Acked-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-07-24 17:56:14 +02:00
|
|
|
#endif
|