Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/apm.c | 1 - src/byteorder.h | 2 ++ src/fw/acpi.c | 4 +++- src/fw/biostables.c | 2 +- src/fw/coreboot.c | 1 - src/fw/csm.c | 2 +- src/fw/paravirt.c | 1 - src/fw/pciinit.c | 1 - src/fw/xen.c | 1 - src/resume.c | 1 - src/{fw => std}/acpi.h | 10 ---------- src/util.h | 10 ++++++++++ 12 files changed, 17 insertions(+), 19 deletions(-) rename src/{fw => std}/acpi.h (96%)
diff --git a/src/apm.c b/src/apm.c index b4b9ed9..7f400fb 100644 --- a/src/apm.c +++ b/src/apm.c @@ -9,7 +9,6 @@ #include "biosvar.h" // GET_GLOBAL #include "bregs.h" // struct bregs #include "config.h" // CONFIG_* -#include "fw/acpi.h" // acpi_pm_ctl #include "fw/paravirt.h" // runningOnQEMU #include "ioport.h" // outb #include "output.h" // dprintf diff --git a/src/byteorder.h b/src/byteorder.h index 7362aeb..928c1b8 100644 --- a/src/byteorder.h +++ b/src/byteorder.h @@ -1,6 +1,8 @@ #ifndef __BYTEORDER_H #define __BYTEORDER_H
+#include "types.h" // u32 + static inline u16 __swab16_constant(u16 val) { return (val<<8) | (val>>8); } diff --git a/src/fw/acpi.c b/src/fw/acpi.c index cba3f68..8f99b34 100644 --- a/src/fw/acpi.c +++ b/src/fw/acpi.c @@ -5,7 +5,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "acpi.h" // struct rsdp_descriptor #include "byteorder.h" // cpu_to_le16 #include "config.h" // CONFIG_* #include "dev-q35.h" @@ -17,6 +16,7 @@ #include "output.h" // dprintf #include "paravirt.h" // RamSize #include "romfile.h" // romfile_loadint +#include "std/acpi.h" // struct rsdp_descriptor #include "string.h" // memset #include "util.h" // MaxCountCPUs #include "x86.h" // readl @@ -756,6 +756,8 @@ find_acpi_features(void) static struct acpi_20_generic_address acpi_reset_reg; static u8 acpi_reset_val;
+#define acpi_ga_to_bdf(addr) pci_to_bdf(0, (addr >> 32) & 0xffff, (addr >> 16) & 0xffff) + void acpi_reboot(void) { diff --git a/src/fw/biostables.c b/src/fw/biostables.c index fea7511..a3ee827 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -4,10 +4,10 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "acpi.h" // struct rsdp_descriptor #include "config.h" // CONFIG_* #include "malloc.h" // malloc_fseg #include "output.h" // dprintf +#include "std/acpi.h" // struct rsdp_descriptor #include "std/mptable.h" // MPTABLE_SIGNATURE #include "std/pirtable.h" // struct pir_header #include "std/smbios.h" // struct smbios_entry_point diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c index 5daed86..e9874e2 100644 --- a/src/fw/coreboot.c +++ b/src/fw/coreboot.c @@ -4,7 +4,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "acpi.h" // find_acpi_features #include "boot.h" // boot_add_cbfs #include "byteorder.h" // be32_to_cpu #include "config.h" // CONFIG_* diff --git a/src/fw/csm.c b/src/fw/csm.c index eca97a7..dda6af4 100644 --- a/src/fw/csm.c +++ b/src/fw/csm.c @@ -4,7 +4,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "acpi.h" #include "biosvar.h" #include "boot.h" #include "bregs.h" @@ -16,6 +15,7 @@ #include "output.h" // dprintf #include "post.h" #include "stacks.h" // wait_threads +#include "std/acpi.h" // RSDP_SIGNATURE #include "std/optionrom.h" // struct rom_header #include "util.h" // copy_smbios
diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c index 573511c..2524b7b 100644 --- a/src/fw/paravirt.c +++ b/src/fw/paravirt.c @@ -8,7 +8,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "acpi.h" // acpi_setup #include "byteorder.h" // be32_to_cpu #include "config.h" // CONFIG_QEMU #include "hw/cmos.h" // CMOS_* diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index 834847b..b29db99 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -5,7 +5,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "acpi.h" // acpi_pm1a_cnt #include "config.h" // CONFIG_* #include "dev-q35.h" // Q35_HOST_BRIDGE_PCIEXBAR_ADDR #include "hw/pci.h" // pci_config_readl diff --git a/src/fw/xen.c b/src/fw/xen.c index 9252721..9b00030 100644 --- a/src/fw/xen.c +++ b/src/fw/xen.c @@ -4,7 +4,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "acpi.h" // find_acpi_features #include "config.h" #include "malloc.h" // memalign_high #include "memmap.h" // add_e820 diff --git a/src/resume.c b/src/resume.c index 31643a7..96c63d5 100644 --- a/src/resume.c +++ b/src/resume.c @@ -6,7 +6,6 @@
#include "biosvar.h" // struct bios_data_area_s #include "bregs.h" // struct bregs -#include "fw/acpi.h" // find_resume_vector #include "hw/cmos.h" // inb_cmos #include "hw/pci.h" // pci_reboot #include "hw/pic.h" // pic_eoi2 diff --git a/src/fw/acpi.h b/src/std/acpi.h similarity index 96% rename from src/fw/acpi.h rename to src/std/acpi.h index f0d24d4..fad6ac2 100644 --- a/src/fw/acpi.h +++ b/src/std/acpi.h @@ -13,13 +13,6 @@ struct acpi_20_generic_address { u8 reserved; u64 address; } PACKED; -#define acpi_ga_to_bdf(addr) pci_to_bdf(0, (addr >> 32) & 0xffff, (addr >> 16) & 0xffff) - -void acpi_setup(void); -u32 find_resume_vector(void); -void find_acpi_features(void); -void acpi_set_reset_reg(struct acpi_20_generic_address *reg, u8 val); -void acpi_reboot(void);
#define RSDP_SIGNATURE 0x2052545020445352LL // "RSD PTR "
@@ -35,9 +28,6 @@ struct rsdp_descriptor { /* Root System Descriptor Pointer */ u8 reserved [3]; /* Reserved field must be 0 */ };
-extern struct rsdp_descriptor *RsdpAddr; -extern u32 acpi_pm1a_cnt; - /* Table structure from Linux kernel (the ACPI tables are under the BSD license) */
diff --git a/src/util.h b/src/util.h index ab45ac6..95be57f 100644 --- a/src/util.h +++ b/src/util.h @@ -55,6 +55,16 @@ void callrom(struct rom_header *rom, u16 bdf); void handle_1ab1(struct bregs *regs); void bios32_init(void);
+// fw/acpi.c +extern struct rsdp_descriptor *RsdpAddr; +extern u32 acpi_pm1a_cnt; +void acpi_setup(void); +u32 find_resume_vector(void); +void find_acpi_features(void); +struct acpi_20_generic_address; +void acpi_set_reset_reg(struct acpi_20_generic_address *reg, u8 val); +void acpi_reboot(void); + // fw/csm.c struct pci_device; int csm_bootprio_fdc(struct pci_device *pci, int port, int fdid);