[SeaBIOS] [PATCH 2/3] acpi: remove PORT_ACPI_PM_BASE constant

Gerd Hoffmann kraxel at redhat.com
Tue May 20 12:20:36 CEST 2014


Use the new acpi_pm_base variable instead.

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 src/fw/acpi.c       | 14 +++++++-------
 src/fw/biostables.c |  1 +
 src/fw/paravirt.h   |  2 --
 src/fw/pciinit.c    | 16 ++++++++--------
 src/fw/smm.c        |  4 ++--
 src/util.h          |  1 +
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/fw/acpi.c b/src/fw/acpi.c
index 5ad2eec..733ca4d 100644
--- a/src/fw/acpi.c
+++ b/src/fw/acpi.c
@@ -55,9 +55,9 @@ static void piix4_fadt_setup(struct pci_device *pci, void *arg)
     fadt->smi_cmd = cpu_to_le32(PORT_SMI_CMD);
     fadt->acpi_enable = PIIX4_ACPI_ENABLE;
     fadt->acpi_disable = PIIX4_ACPI_DISABLE;
-    fadt->pm1a_evt_blk = cpu_to_le32(PORT_ACPI_PM_BASE);
-    fadt->pm1a_cnt_blk = cpu_to_le32(PORT_ACPI_PM_BASE + 0x04);
-    fadt->pm_tmr_blk = cpu_to_le32(PORT_ACPI_PM_BASE + 0x08);
+    fadt->pm1a_evt_blk = cpu_to_le32(acpi_pm_base);
+    fadt->pm1a_cnt_blk = cpu_to_le32(acpi_pm_base + 0x04);
+    fadt->pm_tmr_blk = cpu_to_le32(acpi_pm_base + 0x08);
     fadt->gpe0_blk = cpu_to_le32(PIIX4_GPE0_BLK);
     fadt->pm1_evt_len = 4;
     fadt->pm1_cnt_len = 2;
@@ -81,10 +81,10 @@ static void ich9_lpc_fadt_setup(struct pci_device *dev, void *arg)
     fadt->smi_cmd = cpu_to_le32(PORT_SMI_CMD);
     fadt->acpi_enable = ICH9_ACPI_ENABLE;
     fadt->acpi_disable = ICH9_ACPI_DISABLE;
-    fadt->pm1a_evt_blk = cpu_to_le32(PORT_ACPI_PM_BASE);
-    fadt->pm1a_cnt_blk = cpu_to_le32(PORT_ACPI_PM_BASE + 0x04);
-    fadt->pm_tmr_blk = cpu_to_le32(PORT_ACPI_PM_BASE + 0x08);
-    fadt->gpe0_blk = cpu_to_le32(PORT_ACPI_PM_BASE + ICH9_PMIO_GPE0_STS);
+    fadt->pm1a_evt_blk = cpu_to_le32(acpi_pm_base);
+    fadt->pm1a_cnt_blk = cpu_to_le32(acpi_pm_base + 0x04);
+    fadt->pm_tmr_blk = cpu_to_le32(acpi_pm_base + 0x08);
+    fadt->gpe0_blk = cpu_to_le32(acpi_pm_base + ICH9_PMIO_GPE0_STS);
     fadt->pm1_evt_len = 4;
     fadt->pm1_cnt_len = 2;
     fadt->pm_tmr_len = 4;
diff --git a/src/fw/biostables.c b/src/fw/biostables.c
index 17bee8e..50a891b 100644
--- a/src/fw/biostables.c
+++ b/src/fw/biostables.c
@@ -170,6 +170,7 @@ find_resume_vector(void)
 static struct acpi_20_generic_address acpi_reset_reg;
 static u8 acpi_reset_val;
 u32 acpi_pm1a_cnt VARFSEG;
+u16 acpi_pm_base = 0xb000;
 
 #define acpi_ga_to_bdf(addr) pci_to_bdf(0, (addr >> 32) & 0xffff, (addr >> 16) & 0xffff)
 
diff --git a/src/fw/paravirt.h b/src/fw/paravirt.h
index 04fb4b9..95ffb92 100644
--- a/src/fw/paravirt.h
+++ b/src/fw/paravirt.h
@@ -29,8 +29,6 @@ static inline int runningOnKVM(void) {
 #define PORT_SMI_STATUS        0x00b3
 #define PORT_QEMU_CFG_CTL      0x0510
 #define PORT_QEMU_CFG_DATA     0x0511
-#define PORT_ACPI_PM_BASE      0xb000
-#define PORT_SMB_BASE          0xb100
 
 void qemu_preinit(void);
 void qemu_platform_setup(void);
diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
index bbaecd6..9ffda49 100644
--- a/src/fw/pciinit.c
+++ b/src/fw/pciinit.c
@@ -185,13 +185,13 @@ static void mch_isa_bridge_setup(struct pci_device *dev, void *arg)
 
     /* pm io base */
     pci_config_writel(bdf, ICH9_LPC_PMBASE,
-                      PORT_ACPI_PM_BASE | ICH9_LPC_PMBASE_RTE);
+                      acpi_pm_base | ICH9_LPC_PMBASE_RTE);
 
     /* acpi enable, SCI: IRQ9 000b = irq9*/
     pci_config_writeb(bdf, ICH9_LPC_ACPI_CTRL, ICH9_LPC_ACPI_CTRL_ACPI_EN);
 
-    acpi_pm1a_cnt = PORT_ACPI_PM_BASE + 0x04;
-    pmtimer_setup(PORT_ACPI_PM_BASE + 0x08);
+    acpi_pm1a_cnt = acpi_pm_base + 0x04;
+    pmtimer_setup(acpi_pm_base + 0x08);
 }
 
 static void storage_ide_setup(struct pci_device *pci, void *arg)
@@ -228,9 +228,9 @@ static void piix4_pm_config_setup(u16 bdf)
     // acpi sci is hardwired to 9
     pci_config_writeb(bdf, PCI_INTERRUPT_LINE, 9);
 
-    pci_config_writel(bdf, 0x40, PORT_ACPI_PM_BASE | 1);
+    pci_config_writel(bdf, 0x40, acpi_pm_base | 1);
     pci_config_writeb(bdf, 0x80, 0x01); /* enable PM io space */
-    pci_config_writel(bdf, 0x90, PORT_SMB_BASE | 1);
+    pci_config_writel(bdf, 0x90, (acpi_pm_base + 0x100) | 1);
     pci_config_writeb(bdf, 0xd2, 0x09); /* enable SMBus io space */
 }
 
@@ -242,8 +242,8 @@ static void piix4_pm_setup(struct pci_device *pci, void *arg)
     PiixPmBDF = pci->bdf;
     piix4_pm_config_setup(pci->bdf);
 
-    acpi_pm1a_cnt = PORT_ACPI_PM_BASE + 0x04;
-    pmtimer_setup(PORT_ACPI_PM_BASE + 0x08);
+    acpi_pm1a_cnt = acpi_pm_base + 0x04;
+    pmtimer_setup(acpi_pm_base + 0x08);
 }
 
 /* ICH9 SMBUS */
@@ -253,7 +253,7 @@ static void ich9_smbus_setup(struct pci_device *dev, void *arg)
     u16 bdf = dev->bdf;
     /* map smbus into io space */
     pci_config_writel(bdf, ICH9_SMB_SMB_BASE,
-                      PORT_SMB_BASE | PCI_BASE_ADDRESS_SPACE_IO);
+                      (acpi_pm_base + 0x100) | PCI_BASE_ADDRESS_SPACE_IO);
 
     /* enable SMBus */
     pci_config_writeb(bdf, ICH9_SMB_HOSTC, ICH9_SMB_HOSTC_HST_EN);
diff --git a/src/fw/smm.c b/src/fw/smm.c
index 5ae6f32..0f59f20 100644
--- a/src/fw/smm.c
+++ b/src/fw/smm.c
@@ -116,7 +116,7 @@ static void piix4_apmc_smm_setup(int isabdf, int i440_bdf)
 void ich9_lpc_apmc_smm_setup(int isabdf, int mch_bdf)
 {
     /* check if SMM init is already done */
-    u32 value = inl(PORT_ACPI_PM_BASE + ICH9_PMIO_SMI_EN);
+    u32 value = inl(acpi_pm_base + ICH9_PMIO_SMI_EN);
     if (value & ICH9_PMIO_SMI_EN_APMC_EN)
         return;
 
@@ -127,7 +127,7 @@ void ich9_lpc_apmc_smm_setup(int isabdf, int mch_bdf)
 
     /* enable SMI generation when writing to the APMC register */
     outl(value | ICH9_PMIO_SMI_EN_APMC_EN,
-         PORT_ACPI_PM_BASE + ICH9_PMIO_SMI_EN);
+         acpi_pm_base + ICH9_PMIO_SMI_EN);
 
     smm_relocate_and_restore();
 
diff --git a/src/util.h b/src/util.h
index 0cbea48..b54271b 100644
--- a/src/util.h
+++ b/src/util.h
@@ -70,6 +70,7 @@ extern struct pir_header *PirAddr;
 void copy_acpi_rsdp(void *pos);
 extern struct rsdp_descriptor *RsdpAddr;
 extern u32 acpi_pm1a_cnt;
+extern u16 acpi_pm_base;
 void *find_acpi_rsdp(void);
 u32 find_resume_vector(void);
 void acpi_reboot(void);
-- 
1.8.3.1




More information about the SeaBIOS mailing list