summaryrefslogtreecommitdiff
path: root/hw/i386/acpi-build.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2018-02-28 15:23:53 +0100
committerMichael S. Tsirkin <mst@redhat.com>2018-03-13 23:09:50 +0200
commit8612f8bd9fb667c62e9a56c67ab2e3af2798dd9c (patch)
treef017e3a7c5614603694146003447b2099b183d4d /hw/i386/acpi-build.c
parent5d7a334f7c40dcb6aab3e4496ac826e813ccdb07 (diff)
downloadqemu-8612f8bd9fb667c62e9a56c67ab2e3af2798dd9c.zip
acpi: move build_fadt() from i386 specific to generic ACPI source
It will be extended and reused by follow up patch for ARM target. PS: Since it's generic function now, don't patch FIRMWARE_CTRL, DSDT fields if they don't point to tables since platform might not provide them and use X_ variants instead if applicable. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Tested-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/i386/acpi-build.c')
-rw-r--r--hw/i386/acpi-build.c102
1 files changed, 0 insertions, 102 deletions
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index d1b387e77b..ebde2cda9d 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -298,108 +298,6 @@ build_facs(GArray *table_data, BIOSLinker *linker)
facs->length = cpu_to_le32(sizeof(*facs));
}
-/* FADT */
-static void
-build_fadt(GArray *tbl, BIOSLinker *linker, AcpiFadtData *f,
- const char *oem_id, const char *oem_table_id)
-{
- int off;
- int fadt_start = tbl->len;
-
- acpi_data_push(tbl, sizeof(AcpiTableHeader));
-
- /* FACS address to be filled by Guest linker at runtime */
- off = tbl->len;
- build_append_int_noprefix(tbl, 0, 4); /* FIRMWARE_CTRL */
- bios_linker_loader_add_pointer(linker,
- ACPI_BUILD_TABLE_FILE, off, 4,
- ACPI_BUILD_TABLE_FILE, *f->facs_tbl_offset);
-
- /* DSDT address to be filled by Guest linker at runtime */
- off = tbl->len;
- build_append_int_noprefix(tbl, 0, 4); /* DSDT */
- bios_linker_loader_add_pointer(linker,
- ACPI_BUILD_TABLE_FILE, off, 4,
- ACPI_BUILD_TABLE_FILE, *f->dsdt_tbl_offset);
-
- /* ACPI1.0: INT_MODEL, ACPI2.0+: Reserved */
- build_append_int_noprefix(tbl, f->int_model /* Multiple APIC */, 1);
- /* Preferred_PM_Profile */
- build_append_int_noprefix(tbl, 0 /* Unspecified */, 1);
- build_append_int_noprefix(tbl, f->sci_int, 2); /* SCI_INT */
- build_append_int_noprefix(tbl, f->smi_cmd, 4); /* SMI_CMD */
- build_append_int_noprefix(tbl, f->acpi_enable_cmd, 1); /* ACPI_ENABLE */
- build_append_int_noprefix(tbl, f->acpi_disable_cmd, 1); /* ACPI_DISABLE */
- build_append_int_noprefix(tbl, 0 /* not supported */, 1); /* S4BIOS_REQ */
- /* ACPI1.0: Reserved, ACPI2.0+: PSTATE_CNT */
- build_append_int_noprefix(tbl, 0, 1);
- build_append_int_noprefix(tbl, f->pm1a_evt.address, 4); /* PM1a_EVT_BLK */
- build_append_int_noprefix(tbl, 0, 4); /* PM1b_EVT_BLK */
- build_append_int_noprefix(tbl, f->pm1a_cnt.address, 4); /* PM1a_CNT_BLK */
- build_append_int_noprefix(tbl, 0, 4); /* PM1b_CNT_BLK */
- build_append_int_noprefix(tbl, 0, 4); /* PM2_CNT_BLK */
- build_append_int_noprefix(tbl, f->pm_tmr.address, 4); /* PM_TMR_BLK */
- build_append_int_noprefix(tbl, f->gpe0_blk.address, 4); /* GPE0_BLK */
- build_append_int_noprefix(tbl, 0, 4); /* GPE1_BLK */
- /* PM1_EVT_LEN */
- build_append_int_noprefix(tbl, f->pm1a_evt.bit_width / 8, 1);
- /* PM1_CNT_LEN */
- build_append_int_noprefix(tbl, f->pm1a_cnt.bit_width / 8, 1);
- build_append_int_noprefix(tbl, 0, 1); /* PM2_CNT_LEN */
- build_append_int_noprefix(tbl, f->pm_tmr.bit_width / 8, 1); /* PM_TMR_LEN */
- /* GPE0_BLK_LEN */
- build_append_int_noprefix(tbl, f->gpe0_blk.bit_width / 8, 1);
- build_append_int_noprefix(tbl, 0, 1); /* GPE1_BLK_LEN */
- build_append_int_noprefix(tbl, 0, 1); /* GPE1_BASE */
- build_append_int_noprefix(tbl, 0, 1); /* CST_CNT */
- build_append_int_noprefix(tbl, f->plvl2_lat, 2); /* P_LVL2_LAT */
- build_append_int_noprefix(tbl, f->plvl3_lat, 2); /* P_LVL3_LAT */
- build_append_int_noprefix(tbl, 0, 2); /* FLUSH_SIZE */
- build_append_int_noprefix(tbl, 0, 2); /* FLUSH_STRIDE */
- build_append_int_noprefix(tbl, 0, 1); /* DUTY_OFFSET */
- build_append_int_noprefix(tbl, 0, 1); /* DUTY_WIDTH */
- build_append_int_noprefix(tbl, 0, 1); /* DAY_ALRM */
- build_append_int_noprefix(tbl, 0, 1); /* MON_ALRM */
- build_append_int_noprefix(tbl, f->rtc_century, 1); /* CENTURY */
- build_append_int_noprefix(tbl, 0, 2); /* IAPC_BOOT_ARCH */
- build_append_int_noprefix(tbl, 0, 1); /* Reserved */
- build_append_int_noprefix(tbl, f->flags, 4); /* Flags */
-
- if (f->rev == 1) {
- goto build_hdr;
- }
-
- build_append_gas_from_struct(tbl, &f->reset_reg); /* RESET_REG */
- build_append_int_noprefix(tbl, f->reset_val, 1); /* RESET_VALUE */
- build_append_int_noprefix(tbl, 0, 3); /* Reserved, ACPI 3.0 */
- build_append_int_noprefix(tbl, 0, 8); /* X_FIRMWARE_CTRL */
-
- /* XDSDT address to be filled by Guest linker at runtime */
- off = tbl->len;
- build_append_int_noprefix(tbl, 0, 8); /* X_DSDT */
- if (f->xdsdt_tbl_offset) {
- bios_linker_loader_add_pointer(linker,
- ACPI_BUILD_TABLE_FILE, off, 8,
- ACPI_BUILD_TABLE_FILE, *f->xdsdt_tbl_offset);
- }
-
- build_append_gas_from_struct(tbl, &f->pm1a_evt); /* X_PM1a_EVT_BLK */
- /* X_PM1b_EVT_BLK */
- build_append_gas(tbl, AML_AS_SYSTEM_MEMORY, 0 , 0, 0, 0);
- build_append_gas_from_struct(tbl, &f->pm1a_cnt); /* X_PM1a_CNT_BLK */
- /* X_PM1b_CNT_BLK */
- build_append_gas(tbl, AML_AS_SYSTEM_MEMORY, 0 , 0, 0, 0);
- /* X_PM2_CNT_BLK */
- build_append_gas(tbl, AML_AS_SYSTEM_MEMORY, 0 , 0, 0, 0);
- build_append_gas_from_struct(tbl, &f->pm_tmr); /* X_PM_TMR_BLK */
- build_append_gas_from_struct(tbl, &f->gpe0_blk); /* X_GPE0_BLK */
- build_append_gas(tbl, AML_AS_SYSTEM_MEMORY, 0 , 0, 0, 0); /* X_GPE1_BLK */
-
-build_hdr:
- build_header(linker, tbl, (void *)(tbl->data + fadt_start),
- "FACP", tbl->len - fadt_start, f->rev, oem_id, oem_table_id);
-}
-
void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
const CPUArchIdList *apic_ids, GArray *entry)
{