Skip to contentSkip to conversation

acpi: add reset register to fadt

RFC PATCH In review Reza Jelveh 2 participants 2 messages Mar 30, 2015 – Mar 31, 2015

lore
Share & tools
lore
#0 lore raw

RFC PATCH v2 1/1 acpi: add reset register to fadt

Some operating systems such as FreeBSD and Mac OSX need the reset_register section of the FADT filled to know which port to write to for a system reset.

---
 hw/i386/acpi-build.c | 9 +++++++++
 hw/i386/acpi-defs.h  | 2 ++
 2 files changed, 11 insertions(+)
hw/i386/acpi-build.c +9 -0
index d0a5c85..d029896 100644
@@ -338,6 +338,8 @@ build_facs(GArray *table_data, GArray *linker, PcGuestInfo *guest_info)
 /* Load chipset information in FADT */
 static void fadt_setup(AcpiFadtDescriptorRev1 *fadt, AcpiPmInfo *pm)
 {
+    Object *lpc = ich9_lpc_find();
+
     fadt->model = 1;
     fadt->reserved1 = 0;
     fadt->sci_int = cpu_to_le16(pm->sci_int);
@@ -361,6 +363,13 @@ static void fadt_setup(AcpiFadtDescriptorRev1 *fadt, AcpiPmInfo *pm)
                               (1 << ACPI_FADT_F_SLP_BUTTON) |
                               (1 << ACPI_FADT_F_RTC_S4));
     fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_USE_PLATFORM_CLOCK);
+    if (lpc) {
+      fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_RESET_REG_SUP);
+      fadt->reset_val = 0xA;
+      fadt->reset_reg.address_space_id   = aml_system_io;
+      fadt->reset_reg.register_bit_width = 8;
+      fadt->reset_reg.address            = ICH9_RST_CNT_IOPORT;
+    }
     /* APIC destination mode ("Flat Logical") has an upper limit of 8 CPUs
      * For more than 8 CPUs, "Clustered Logical" mode has to be used
      */
hw/i386/acpi-defs.h +2 -0
index c4468f8..960c833 100644
@@ -132,6 +132,8 @@ struct AcpiFadtDescriptorRev1
     uint8_t  reserved4a;             /* Reserved */
     uint8_t  reserved4b;             /* Reserved */
     uint32_t flags;
+    Acpi20GenericAddress reset_reg;
+    uint8_t reset_val;
 } QEMU_PACKED;
 typedef struct AcpiFadtDescriptorRev1 AcpiFadtDescriptorRev1;
 
Signature · 1 line
2.3.4
#1 lore raw

Am 30.03.2015 um 13:34 schrieb Reza Jelveh:

Quoted 23 lines

Some operating systems such as FreeBSD and Mac OSX need the reset_register section of the FADT filled to know which port to write to for a system reset.

---
 hw/i386/acpi-build.c | 9 +++++++++
 hw/i386/acpi-defs.h  | 2 ++
 2 files changed, 11 insertions(+)
hw/i386/acpi-build.c +2 -0
index d0a5c85..d029896 100644
@@ -338,6 +338,8 @@ build_facs(GArray *table_data, GArray *linker, PcGuestInfo *guest_info)
 /* Load chipset information in FADT */
 static void fadt_setup(AcpiFadtDescriptorRev1 *fadt, AcpiPmInfo *pm)
 {
+    Object *lpc = ich9_lpc_find();
+
     fadt->model = 1;
     fadt->reserved1 = 0;
     fadt->sci_int = cpu_to_le16(pm->sci_int);

hw/i386/acpi-build.c static void fadt_setup(AcpiFadtDescriptorRev1 *fadt, AcpiPmInfo *pm) · line 371

Quoted 9 lines
hw/i386/acpi-build.c +6 -0
@@ -361,6 +363,13 @@ static void fadt_setup(AcpiFadtDescriptorRev1 *fadt, AcpiPmInfo *pm)
                               (1 << ACPI_FADT_F_SLP_BUTTON) |
                               (1 << ACPI_FADT_F_RTC_S4));
     fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_USE_PLATFORM_CLOCK);
+    if (lpc) {
+      fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_RESET_REG_SUP);
+      fadt->reset_val = 0xA;
+      fadt->reset_reg.address_space_id   = aml_system_io;
+      fadt->reset_reg.register_bit_width = 8;
+      fadt->reset_reg.address            = ICH9_RST_CNT_IOPORT;

Indentation is 4 spaces.

Regards,
Andreas

Quoted 17 lines
hw/i386/acpi-build.c +1 -0
+    }
     /* APIC destination mode ("Flat Logical") has an upper limit of 8 CPUs
      * For more than 8 CPUs, "Clustered Logical" mode has to be used
      */
hw/i386/acpi-defs.h +2 -0
index c4468f8..960c833 100644
@@ -132,6 +132,8 @@ struct AcpiFadtDescriptorRev1
     uint8_t  reserved4a;             /* Reserved */
     uint8_t  reserved4b;             /* Reserved */
     uint32_t flags;
+    Acpi20GenericAddress reset_reg;
+    uint8_t reset_val;
 } QEMU_PACKED;
 typedef struct AcpiFadtDescriptorRev1 AcpiFadtDescriptorRev1;
 
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)