[SeaBIOS] [PATCH 1/2] acpi: use specified macro instead of magic-number

zhanghailiang zhang.zhanghailiang at huawei.com
Thu Aug 21 11:23:40 CEST 2014


Instead of magic numbers, use specified macros for FADT Fixed Feature Flags.

Signed-off-by: zhanghailiang <zhang.zhanghailiang at huawei.com>
---
 src/fw/acpi.c  | 16 ++++++++++------
 src/std/acpi.h | 25 +++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/src/fw/acpi.c b/src/fw/acpi.c
index 47e4c07..482e2f9 100644
--- a/src/fw/acpi.c
+++ b/src/fw/acpi.c
@@ -59,9 +59,11 @@ static void piix4_fadt_setup(struct pci_device *pci, void *arg)
     fadt->gpe0_blk_len = PIIX_GPE0_BLK_LEN;
     fadt->plvl2_lat = cpu_to_le16(0xfff); // C2 state not supported
     fadt->plvl3_lat = cpu_to_le16(0xfff); // C3 state not supported
-    /* WBINVD + PROC_C1 + SLP_BUTTON + RTC_S4 + USE_PLATFORM_CLOCK */
-    fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 7) |
-                              (1 << 15));
+    fadt->flags = cpu_to_le32(ACPI_FADT_F_WBINVD |
+                              ACPI_FADT_F_PROC_C1 | 
+                              ACPI_FADT_F_SLP_BUTTON |
+                              ACPI_FADT_F_RTC_S4 |
+                              ACPI_FADT_F_USE_PLATFORM_CLOCK);
 }
 
 /* PCI_VENDOR_ID_INTEL && PCI_DEVICE_ID_INTEL_ICH9_LPC */
@@ -85,9 +87,11 @@ static void ich9_lpc_fadt_setup(struct pci_device *dev, void *arg)
     fadt->gpe0_blk_len = ICH9_PMIO_GPE0_BLK_LEN;
     fadt->plvl2_lat = cpu_to_le16(0xfff); // C2 state not supported
     fadt->plvl3_lat = cpu_to_le16(0xfff); // C3 state not supported
-    /* WBINVD + PROC_C1 + SLP_BUTTON + RTC_S4 + USE_PLATFORM_CLOCK */
-    fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 7) |
-                              (1 << 15));
+    fadt->flags = cpu_to_le32(ACPI_FADT_F_WBINVD |
+                              ACPI_FADT_F_PROC_C1 |
+                              ACPI_FADT_F_SLP_BUTTON |
+                              ACPI_FADT_F_RTC_S4 |
+                              ACPI_FADT_F_USE_PLATFORM_CLOCK);
 }
 
 static const struct pci_device_id fadt_init_tbl[] = {
diff --git a/src/std/acpi.h b/src/std/acpi.h
index fad6ac2..e0d9516 100644
--- a/src/std/acpi.h
+++ b/src/std/acpi.h
@@ -42,6 +42,31 @@ struct rsdp_descriptor {        /* Root System Descriptor Pointer */
     u8  asl_compiler_id [4];    /* ASL compiler vendor ID */ \
     u32 asl_compiler_revision;  /* ASL compiler revision number */
 
+/*
+ * Fixed ACPI Description Table Fixed Feature Flags
+ */
+#define    ACPI_FADT_F_WBINVD            (1 << 0)
+#define    ACPI_FADT_F_WBINVD_FLUSH      (1 << 1)
+#define    ACPI_FADT_F_PROC_C1           (1 << 2)
+#define    ACPI_FADT_F_P_LVL2_UP         (1 << 3)
+#define    ACPI_FADT_F_PWR_BUTTON        (1 << 4)
+#define    ACPI_FADT_F_SLP_BUTTON        (1 << 5)
+#define    ACPI_FADT_F_FIX_RTC           (1 << 6)
+#define    ACPI_FADT_F_RTC_S4            (1 << 7)
+#define    ACPI_FADT_F_TMR_VAL_EXT       (1 << 8)
+#define    ACPI_FADT_F_DCK_CAP           (1 << 9)
+#define    ACPI_FADT_F_RESET_REG_SUP     (1 << 10)
+#define    ACPI_FADT_F_SEALED_CASE       (1 << 11)
+#define    ACPI_FADT_F_HEADLESS          (1 << 12)
+#define    ACPI_FADT_F_CPU_SW_SLP        (1 << 13)
+#define    ACPI_FADT_F_PCI_EXP_WAK       (1 << 14)
+#define    ACPI_FADT_F_USE_PLATFORM_CLOCK (1 << 15)
+#define    ACPI_FADT_F_S4_RTC_STS_VALID   (1 << 16)
+#define    ACPI_FADT_F_REMOTE_POWER_ON_CAPABLE  (1 << 17)
+#define    ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL  (1 << 18)
+#define    ACPI_FADT_F_FORCE_APIC_PHYSICAL_DESTINATION_MODE  (1 << 19)
+#define    ACPI_FADT_F_HW_REDUCED_ACPI    (1 << 20)
+#define    ACPI_FADT_F_LOW_POWER_S0_IDLE_CAPABLE  (1 << 21)
 
 /*
  * ACPI 1.0 Fixed ACPI Description Table (FADT)
-- 
1.7.12.4





More information about the SeaBIOS mailing list