aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2013-09-02 20:48:46 -0400
committerKevin O'Connor <kevin@koconnor.net>2013-09-02 20:48:46 -0400
commit5d369d8d9eb5326db111cc2e518c74739dbe3f84 (patch)
tree1fe04c2372e2041c5feb7e6c177a25f692cf4e76
parent3cb0f504a782c1a9c790b939631854473c039397 (diff)
downloadseabios-5d369d8d9eb5326db111cc2e518c74739dbe3f84.tar.gz
Move code centered around specific hardware devices to src/hw/
Move many C files from the src/ directory to the new src/hw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--Makefile22
-rw-r--r--src/acpi.c6
-rw-r--r--src/biostables.c2
-rw-r--r--src/block.c10
-rw-r--r--src/boot.c6
-rw-r--r--src/cdrom.c4
-rw-r--r--src/clock.c8
-rw-r--r--src/coreboot.c2
-rw-r--r--src/csm.c4
-rw-r--r--src/csm.h2
-rw-r--r--src/disk.c6
-rw-r--r--src/hw/ahci.c (renamed from src/ahci.c)0
-rw-r--r--src/hw/ahci.h (renamed from src/ahci.h)0
-rw-r--r--src/hw/ata.c (renamed from src/ata.c)0
-rw-r--r--src/hw/ata.h (renamed from src/ata.h)0
-rw-r--r--src/hw/blockcmd.c (renamed from src/blockcmd.c)0
-rw-r--r--src/hw/blockcmd.h (renamed from src/blockcmd.h)0
-rw-r--r--src/hw/cmos.h (renamed from src/cmos.h)0
-rw-r--r--src/hw/esp-scsi.c (renamed from src/esp-scsi.c)0
-rw-r--r--src/hw/esp-scsi.h (renamed from src/esp-scsi.h)0
-rw-r--r--src/hw/floppy.c (renamed from src/floppy.c)0
-rw-r--r--src/hw/lsi-scsi.c (renamed from src/lsi-scsi.c)0
-rw-r--r--src/hw/lsi-scsi.h (renamed from src/lsi-scsi.h)0
-rw-r--r--src/hw/megasas.c (renamed from src/megasas.c)0
-rw-r--r--src/hw/megasas.h (renamed from src/megasas.h)0
-rw-r--r--src/hw/pci.c (renamed from src/pci.c)0
-rw-r--r--src/hw/pci.h (renamed from src/pci.h)0
-rw-r--r--src/hw/pci_ids.h (renamed from src/pci_ids.h)0
-rw-r--r--src/hw/pci_regs.h (renamed from src/pci_regs.h)0
-rw-r--r--src/hw/pic.c (renamed from src/pic.c)0
-rw-r--r--src/hw/pic.h (renamed from src/pic.h)0
-rw-r--r--src/hw/pit.h (renamed from src/pit.h)0
-rw-r--r--src/hw/ps2port.c (renamed from src/ps2port.c)0
-rw-r--r--src/hw/ps2port.h (renamed from src/ps2port.h)0
-rw-r--r--src/hw/ramdisk.c (renamed from src/ramdisk.c)0
-rw-r--r--src/hw/timer.c (renamed from src/timer.c)0
-rw-r--r--src/hw/usb-ehci.c (renamed from src/usb-ehci.c)0
-rw-r--r--src/hw/usb-ehci.h (renamed from src/usb-ehci.h)0
-rw-r--r--src/hw/usb-hid.c (renamed from src/usb-hid.c)0
-rw-r--r--src/hw/usb-hid.h (renamed from src/usb-hid.h)0
-rw-r--r--src/hw/usb-hub.c (renamed from src/usb-hub.c)0
-rw-r--r--src/hw/usb-hub.h (renamed from src/usb-hub.h)0
-rw-r--r--src/hw/usb-msc.c (renamed from src/usb-msc.c)0
-rw-r--r--src/hw/usb-msc.h (renamed from src/usb-msc.h)0
-rw-r--r--src/hw/usb-ohci.c (renamed from src/usb-ohci.c)0
-rw-r--r--src/hw/usb-ohci.h (renamed from src/usb-ohci.h)0
-rw-r--r--src/hw/usb-uas.c (renamed from src/usb-uas.c)0
-rw-r--r--src/hw/usb-uas.h (renamed from src/usb-uas.h)0
-rw-r--r--src/hw/usb-uhci.c (renamed from src/usb-uhci.c)0
-rw-r--r--src/hw/usb-uhci.h (renamed from src/usb-uhci.h)0
-rw-r--r--src/hw/usb.c (renamed from src/usb.c)0
-rw-r--r--src/hw/usb.h (renamed from src/usb.h)0
-rw-r--r--src/hw/virtio-blk.c (renamed from src/virtio-blk.c)0
-rw-r--r--src/hw/virtio-blk.h (renamed from src/virtio-blk.h)0
-rw-r--r--src/hw/virtio-pci.c (renamed from src/virtio-pci.c)0
-rw-r--r--src/hw/virtio-pci.h (renamed from src/virtio-pci.h)0
-rw-r--r--src/hw/virtio-ring.c (renamed from src/virtio-ring.c)0
-rw-r--r--src/hw/virtio-ring.h (renamed from src/virtio-ring.h)0
-rw-r--r--src/hw/virtio-scsi.c (renamed from src/virtio-scsi.c)0
-rw-r--r--src/hw/virtio-scsi.h (renamed from src/virtio-scsi.h)0
-rw-r--r--src/kbd.c4
-rw-r--r--src/misc.c2
-rw-r--r--src/mouse.c4
-rw-r--r--src/mptable.c4
-rw-r--r--src/mtrr.c2
-rw-r--r--src/optionroms.c6
-rw-r--r--src/paravirt.c4
-rw-r--r--src/pcibios.c4
-rw-r--r--src/pciinit.c6
-rw-r--r--src/pirtable.c2
-rw-r--r--src/post.c22
-rw-r--r--src/resume.c8
-rw-r--r--src/romlayout.S2
-rw-r--r--src/shadow.c6
-rw-r--r--src/smm.c6
-rw-r--r--src/smp.c2
-rw-r--r--src/system.c2
-rw-r--r--src/util.h2
-rw-r--r--src/vgahooks.c6
-rw-r--r--vgasrc/bochsvga.c4
-rw-r--r--vgasrc/clext.c4
-rw-r--r--vgasrc/geodevga.c4
-rw-r--r--vgasrc/vgabios.c4
83 files changed, 91 insertions, 91 deletions
diff --git a/Makefile b/Makefile
index bafa2464..a43fa149 100644
--- a/Makefile
+++ b/Makefile
@@ -8,19 +8,19 @@
OUT=out/
# Source files
-SRCBOTH=misc.c stacks.c output.c util.c block.c floppy.c ata.c mouse.c \
- kbd.c pci.c serial.c timer.c clock.c pic.c cdrom.c ps2port.c smp.c resume.c \
- pnpbios.c vgahooks.c ramdisk.c pcibios.c blockcmd.c \
- usb.c usb-uhci.c usb-ohci.c usb-ehci.c usb-hid.c usb-msc.c \
- virtio-ring.c virtio-pci.c virtio-blk.c virtio-scsi.c apm.c ahci.c \
- usb-uas.c lsi-scsi.c esp-scsi.c megasas.c
+SRCBOTH=misc.c stacks.c output.c util.c block.c hw/floppy.c hw/ata.c mouse.c \
+ kbd.c hw/pci.c serial.c hw/timer.c clock.c hw/pic.c cdrom.c hw/ps2port.c smp.c resume.c \
+ pnpbios.c vgahooks.c hw/ramdisk.c pcibios.c hw/blockcmd.c \
+ hw/usb.c hw/usb-uhci.c hw/usb-ohci.c hw/usb-ehci.c hw/usb-hid.c hw/usb-msc.c \
+ hw/virtio-ring.c hw/virtio-pci.c hw/virtio-blk.c hw/virtio-scsi.c apm.c hw/ahci.c \
+ hw/usb-uas.c hw/lsi-scsi.c hw/esp-scsi.c hw/megasas.c
SRC16=$(SRCBOTH) system.c disk.c font.c
SRC32FLAT=$(SRCBOTH) post.c shadow.c memmap.c pmm.c coreboot.c boot.c \
acpi.c smm.c mptable.c pirtable.c smbios.c pciinit.c optionroms.c mtrr.c \
- lzmadecode.c bootsplash.c jpeg.c usb-hub.c paravirt.c \
+ lzmadecode.c bootsplash.c jpeg.c hw/usb-hub.c paravirt.c \
biostables.c xen.c bmp.c romfile.c csm.c
-SRC32SEG=util.c output.c pci.c pcibios.c apm.c stacks.c
-DIRS=src vgasrc
+SRC32SEG=util.c output.c hw/pci.c pcibios.c apm.c stacks.c
+DIRS=src src/hw vgasrc
# Default compiler flags
cc-option=$(shell if test -z "`$(1) $(2) -S -o /dev/null -xc /dev/null 2>&1`" \
@@ -28,7 +28,7 @@ cc-option=$(shell if test -z "`$(1) $(2) -S -o /dev/null -xc /dev/null 2>&1`" \
CPPFLAGS = -P -MD -MT $@
-COMMONCFLAGS := -I$(OUT) -Os -MD -g \
+COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \
-Wall -Wno-strict-aliasing -Wold-style-definition \
$(call cc-option,$(CC),-Wtype-limits,) \
-m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 \
@@ -175,7 +175,7 @@ $(OUT)bios.bin.elf $(OUT)bios.bin: $(OUT)rom.o scripts/checkrom.py
################ VGA build rules
# VGA src files
-SRCVGA=src/output.c src/util.c src/pci.c \
+SRCVGA=src/output.c src/util.c src/hw/pci.c \
vgasrc/vgabios.c vgasrc/vgafb.c vgasrc/vgafonts.c vgasrc/vbe.c \
vgasrc/stdvga.c vgasrc/stdvgamodes.c vgasrc/stdvgaio.c \
vgasrc/clext.c vgasrc/bochsvga.c vgasrc/geodevga.c
diff --git a/src/acpi.c b/src/acpi.c
index 8db1ed4a..774ff956 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -8,9 +8,9 @@
#include "acpi.h" // struct rsdp_descriptor
#include "util.h" // memcpy
#include "byteorder.h" // cpu_to_le16
-#include "pci.h" // pci_find_init_device
-#include "pci_ids.h" // PCI_VENDOR_ID_INTEL
-#include "pci_regs.h" // PCI_INTERRUPT_LINE
+#include "hw/pci.h" // pci_find_init_device
+#include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL
+#include "hw/pci_regs.h" // PCI_INTERRUPT_LINE
#include "ioport.h" // inl
#include "config.h" // CONFIG_*
#include "paravirt.h" // RamSize
diff --git a/src/biostables.c b/src/biostables.c
index 7b860e1d..beb0bed3 100644
--- a/src/biostables.c
+++ b/src/biostables.c
@@ -6,7 +6,7 @@
#include "config.h" // CONFIG_*
#include "util.h" // dprintf
-#include "pci.h" // struct pir_header
+#include "hw/pci.h" // struct pir_header
#include "acpi.h" // struct rsdp_descriptor
#include "mptable.h" // MPTABLE_SIGNATURE
#include "smbios.h" // struct smbios_entry_point
diff --git a/src/block.c b/src/block.c
index af736305..74c64970 100644
--- a/src/block.c
+++ b/src/block.c
@@ -7,12 +7,12 @@
#include "disk.h" // struct ata_s
#include "biosvar.h" // GET_GLOBAL
-#include "cmos.h" // inb_cmos
+#include "hw/cmos.h" // inb_cmos
#include "util.h" // dprintf
-#include "ata.h" // process_ata_op
-#include "ahci.h" // process_ahci_op
-#include "virtio-blk.h" // process_virtio_blk_op
-#include "blockcmd.h" // cdb_*
+#include "hw/ata.h" // process_ata_op
+#include "hw/ahci.h" // process_ahci_op
+#include "hw/virtio-blk.h" // process_virtio_blk_op
+#include "hw/blockcmd.h" // cdb_*
u8 FloppyCount VARFSEG;
u8 CDCount;
diff --git a/src/boot.c b/src/boot.c
index c3438401..4d8f1613 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -10,10 +10,10 @@
#include "disk.h" // cdrom_boot
#include "bregs.h" // struct bregs
#include "boot.h" // func defs
-#include "cmos.h" // inb_cmos
+#include "hw/cmos.h" // inb_cmos
#include "paravirt.h" // qemu_cfg_show_boot_menu
-#include "pci.h" // pci_bdf_to_*
-#include "usb.h" // struct usbdevice_s
+#include "hw/pci.h" // pci_bdf_to_*
+#include "hw/usb.h" // struct usbdevice_s
#include "csm.h" // csm_bootprio_*
#include "list.h" // hlist_node
diff --git a/src/cdrom.c b/src/cdrom.c
index b2811cd0..94265b04 100644
--- a/src/cdrom.c
+++ b/src/cdrom.c
@@ -9,8 +9,8 @@
#include "util.h" // memset
#include "bregs.h" // struct bregs
#include "biosvar.h" // GET_GLOBAL
-#include "ata.h" // ATA_CMD_REQUEST_SENSE
-#include "blockcmd.h" // CDB_CMD_REQUEST_SENSE
+#include "hw/ata.h" // ATA_CMD_REQUEST_SENSE
+#include "hw/blockcmd.h" // CDB_CMD_REQUEST_SENSE
// Locks for removable devices
u8 CDRom_locks[BUILD_MAX_EXTDRIVE] VARLOW;
diff --git a/src/clock.c b/src/clock.c
index 5014b604..cc962e47 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -8,12 +8,12 @@
#include "biosvar.h" // SET_BDA
#include "util.h" // debug_enter
#include "disk.h" // floppy_tick
-#include "cmos.h" // inb_cmos
-#include "pic.h" // pic_eoi1
-#include "pit.h" // PM_SEL_TIMER0
+#include "hw/cmos.h" // inb_cmos
+#include "hw/pic.h" // pic_eoi1
+#include "hw/pit.h" // PM_SEL_TIMER0
#include "bregs.h" // struct bregs
#include "biosvar.h" // GET_GLOBAL
-#include "usb-hid.h" // usb_check_event
+#include "hw/usb-hid.h" // usb_check_event
// RTC register flags
#define RTC_A_UIP 0x80
diff --git a/src/coreboot.c b/src/coreboot.c
index 983a2b58..126649a2 100644
--- a/src/coreboot.c
+++ b/src/coreboot.c
@@ -13,7 +13,7 @@
#include "disk.h" // MAXDESCSIZE
#include "config.h" // CONFIG_*
#include "acpi.h" // find_acpi_features
-#include "pci.h" // pci_probe_devices
+#include "hw/pci.h" // pci_probe_devices
#include "paravirt.h" // PlatformRunningOn
diff --git a/src/csm.c b/src/csm.c
index 20217018..0093bee5 100644
--- a/src/csm.c
+++ b/src/csm.c
@@ -9,14 +9,14 @@
#include "util.h" // checksum
#include "bregs.h"
#include "optionroms.h"
-#include "pci.h"
+#include "hw/pci.h"
#include "memmap.h"
#include "biosvar.h"
#include "post.h"
#include "acpi.h"
#include "boot.h"
#include "smbios.h"
-#include "pic.h"
+#include "hw/pic.h"
struct rsdp_descriptor csm_rsdp VARFSEG __aligned(16);
diff --git a/src/csm.h b/src/csm.h
index 77e5bf05..997e3f79 100644
--- a/src/csm.h
+++ b/src/csm.h
@@ -2,13 +2,13 @@
#define __CSM_H
#include "types.h"
-#include "pci.h"
#define UINT8 u8
#define UINT16 u16
#define UINT32 u32
// csm.c
+struct pci_device;
int csm_bootprio_fdc(struct pci_device *pci, int port, int fdid);
int csm_bootprio_ata(struct pci_device *pci, int chanid, int slave);
int csm_bootprio_pci(struct pci_device *pci);
diff --git a/src/disk.c b/src/disk.c
index 975d053c..78252b14 100644
--- a/src/disk.c
+++ b/src/disk.c
@@ -9,10 +9,10 @@
#include "biosvar.h" // SET_BDA
#include "config.h" // CONFIG_*
#include "util.h" // debug_enter
-#include "pic.h" // pic_eoi2
+#include "hw/pic.h" // pic_eoi2
#include "bregs.h" // struct bregs
-#include "pci.h" // pci_bdf_to_bus
-#include "ata.h" // ATA_CB_DC
+#include "hw/pci.h" // pci_bdf_to_bus
+#include "hw/ata.h" // ATA_CB_DC
/****************************************************************
diff --git a/src/ahci.c b/src/hw/ahci.c
index 0e99d144..0e99d144 100644
--- a/src/ahci.c
+++ b/src/hw/ahci.c
diff --git a/src/ahci.h b/src/hw/ahci.h
index c3d3a703..c3d3a703 100644
--- a/src/ahci.h
+++ b/src/hw/ahci.h
diff --git a/src/ata.c b/src/hw/ata.c
index e319aa96..e319aa96 100644
--- a/src/ata.c
+++ b/src/hw/ata.c
diff --git a/src/ata.h b/src/hw/ata.h
index 1f412335..1f412335 100644
--- a/src/ata.h
+++ b/src/hw/ata.h
diff --git a/src/blockcmd.c b/src/hw/blockcmd.c
index 5cd4eb0e..5cd4eb0e 100644
--- a/src/blockcmd.c
+++ b/src/hw/blockcmd.c
diff --git a/src/blockcmd.h b/src/hw/blockcmd.h
index 8bacfcfb..8bacfcfb 100644
--- a/src/blockcmd.h
+++ b/src/hw/blockcmd.h
diff --git a/src/cmos.h b/src/hw/cmos.h
index 067c7fad..067c7fad 100644
--- a/src/cmos.h
+++ b/src/hw/cmos.h
diff --git a/src/esp-scsi.c b/src/hw/esp-scsi.c
index fe703669..fe703669 100644
--- a/src/esp-scsi.c
+++ b/src/hw/esp-scsi.c
diff --git a/src/esp-scsi.h b/src/hw/esp-scsi.h
index dc555f39..dc555f39 100644
--- a/src/esp-scsi.h
+++ b/src/hw/esp-scsi.h
diff --git a/src/floppy.c b/src/hw/floppy.c
index 37b70924..37b70924 100644
--- a/src/floppy.c
+++ b/src/hw/floppy.c
diff --git a/src/lsi-scsi.c b/src/hw/lsi-scsi.c
index 305610a5..305610a5 100644
--- a/src/lsi-scsi.c
+++ b/src/hw/lsi-scsi.c
diff --git a/src/lsi-scsi.h b/src/hw/lsi-scsi.h
index 9c5a9b21..9c5a9b21 100644
--- a/src/lsi-scsi.h
+++ b/src/hw/lsi-scsi.h
diff --git a/src/megasas.c b/src/hw/megasas.c
index f4eeba07..f4eeba07 100644
--- a/src/megasas.c
+++ b/src/hw/megasas.c
diff --git a/src/megasas.h b/src/hw/megasas.h
index 124042e1..124042e1 100644
--- a/src/megasas.h
+++ b/src/hw/megasas.h
diff --git a/src/pci.c b/src/hw/pci.c
index dc62c5c2..dc62c5c2 100644
--- a/src/pci.c
+++ b/src/hw/pci.c
diff --git a/src/pci.h b/src/hw/pci.h
index 7760d212..7760d212 100644
--- a/src/pci.h
+++ b/src/hw/pci.h
diff --git a/src/pci_ids.h b/src/hw/pci_ids.h
index 665e9455..665e9455 100644
--- a/src/pci_ids.h
+++ b/src/hw/pci_ids.h
diff --git a/src/pci_regs.h b/src/hw/pci_regs.h
index e5effd47..e5effd47 100644
--- a/src/pci_regs.h
+++ b/src/hw/pci_regs.h
diff --git a/src/pic.c b/src/hw/pic.c
index 9a3ea0b4..9a3ea0b4 100644
--- a/src/pic.c
+++ b/src/hw/pic.c
diff --git a/src/pic.h b/src/hw/pic.h
index 19aecba3..19aecba3 100644
--- a/src/pic.h
+++ b/src/hw/pic.h
diff --git a/src/pit.h b/src/hw/pit.h
index 098f2701..098f2701 100644
--- a/src/pit.h
+++ b/src/hw/pit.h
diff --git a/src/ps2port.c b/src/hw/ps2port.c
index 4b6c5df9..4b6c5df9 100644
--- a/src/ps2port.c
+++ b/src/hw/ps2port.c
diff --git a/src/ps2port.h b/src/hw/ps2port.h
index dcae3910..dcae3910 100644
--- a/src/ps2port.h
+++ b/src/hw/ps2port.h
diff --git a/src/ramdisk.c b/src/hw/ramdisk.c
index b9da2ad3..b9da2ad3 100644
--- a/src/ramdisk.c
+++ b/src/hw/ramdisk.c
diff --git a/src/timer.c b/src/hw/timer.c
index b3683627..b3683627 100644
--- a/src/timer.c
+++ b/src/hw/timer.c
diff --git a/src/usb-ehci.c b/src/hw/usb-ehci.c
index 978ca687..978ca687 100644
--- a/src/usb-ehci.c
+++ b/src/hw/usb-ehci.c
diff --git a/src/usb-ehci.h b/src/hw/usb-ehci.h
index 5672033a..5672033a 100644
--- a/src/usb-ehci.h
+++ b/src/hw/usb-ehci.h
diff --git a/src/usb-hid.c b/src/hw/usb-hid.c
index deb3ea54..deb3ea54 100644
--- a/src/usb-hid.c
+++ b/src/hw/usb-hid.c
diff --git a/src/usb-hid.h b/src/hw/usb-hid.h
index ef34e796..ef34e796 100644
--- a/src/usb-hid.h
+++ b/src/hw/usb-hid.h
diff --git a/src/usb-hub.c b/src/hw/usb-hub.c
index 0b55d15d..0b55d15d 100644
--- a/src/usb-hub.c
+++ b/src/hw/usb-hub.c
diff --git a/src/usb-hub.h b/src/hw/usb-hub.h
index 5b099474..5b099474 100644
--- a/src/usb-hub.h
+++ b/src/hw/usb-hub.h
diff --git a/src/usb-msc.c b/src/hw/usb-msc.c
index 7b2524d4..7b2524d4 100644
--- a/src/usb-msc.c
+++ b/src/hw/usb-msc.c
diff --git a/src/usb-msc.h b/src/hw/usb-msc.h
index c40d7555..c40d7555 100644
--- a/src/usb-msc.h
+++ b/src/hw/usb-msc.h
diff --git a/src/usb-ohci.c b/src/hw/usb-ohci.c
index e5c9fa5b..e5c9fa5b 100644
--- a/src/usb-ohci.c
+++ b/src/hw/usb-ohci.c
diff --git a/src/usb-ohci.h b/src/hw/usb-ohci.h
index ad0ffece..ad0ffece 100644
--- a/src/usb-ohci.h
+++ b/src/hw/usb-ohci.h
diff --git a/src/usb-uas.c b/src/hw/usb-uas.c
index 31693896..31693896 100644
--- a/src/usb-uas.c
+++ b/src/hw/usb-uas.c
diff --git a/src/usb-uas.h b/src/hw/usb-uas.h
index ad91c5f6..ad91c5f6 100644
--- a/src/usb-uas.h
+++ b/src/hw/usb-uas.h
diff --git a/src/usb-uhci.c b/src/hw/usb-uhci.c
index d8f9b1e1..d8f9b1e1 100644
--- a/src/usb-uhci.c
+++ b/src/hw/usb-uhci.c
diff --git a/src/usb-uhci.h b/src/hw/usb-uhci.h
index b83c4871..b83c4871 100644
--- a/src/usb-uhci.h
+++ b/src/hw/usb-uhci.h
diff --git a/src/usb.c b/src/hw/usb.c
index 42541ff3..42541ff3 100644
--- a/src/usb.c
+++ b/src/hw/usb.c
diff --git a/src/usb.h b/src/hw/usb.h
index a43e8299..a43e8299 100644
--- a/src/usb.h
+++ b/src/hw/usb.h
diff --git a/src/virtio-blk.c b/src/hw/virtio-blk.c
index 6c0cd74b..6c0cd74b 100644
--- a/src/virtio-blk.c
+++ b/src/hw/virtio-blk.c
diff --git a/src/virtio-blk.h b/src/hw/virtio-blk.h
index b233c744..b233c744 100644
--- a/src/virtio-blk.h
+++ b/src/hw/virtio-blk.h
diff --git a/src/virtio-pci.c b/src/hw/virtio-pci.c
index 4b9ad0ac..4b9ad0ac 100644
--- a/src/virtio-pci.c
+++ b/src/hw/virtio-pci.c
diff --git a/src/virtio-pci.h b/src/hw/virtio-pci.h
index e1d972dc..e1d972dc 100644
--- a/src/virtio-pci.h
+++ b/src/hw/virtio-pci.h
diff --git a/src/virtio-ring.c b/src/hw/virtio-ring.c
index bddb0901..bddb0901 100644
--- a/src/virtio-ring.c
+++ b/src/hw/virtio-ring.c
diff --git a/src/virtio-ring.h b/src/hw/virtio-ring.h
index b7a7aafb..b7a7aafb 100644
--- a/src/virtio-ring.h
+++ b/src/hw/virtio-ring.h
diff --git a/src/virtio-scsi.c b/src/hw/virtio-scsi.c
index 4de1255f..4de1255f 100644
--- a/src/virtio-scsi.c
+++ b/src/hw/virtio-scsi.c
diff --git a/src/virtio-scsi.h b/src/hw/virtio-scsi.h
index 96c3701d..96c3701d 100644
--- a/src/virtio-scsi.h
+++ b/src/hw/virtio-scsi.h
diff --git a/src/kbd.c b/src/kbd.c
index 05845e50..2e2ced7a 100644
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -9,8 +9,8 @@
#include "util.h" // debug_enter
#include "config.h" // CONFIG_*
#include "bregs.h" // struct bregs
-#include "ps2port.h" // ps2_kbd_command
-#include "usb-hid.h" // usb_kbd_command
+#include "hw/ps2port.h" // ps2_kbd_command
+#include "hw/usb-hid.h" // usb_kbd_command
// Bit definitions for BDA kbd_flag[012]
#define KF0_RSHIFT (1<<0)
diff --git a/src/misc.c b/src/misc.c
index c84cac82..338c6073 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -8,7 +8,7 @@
#include "bregs.h" // struct bregs
#include "biosvar.h" // GET_BDA
#include "util.h" // debug_enter
-#include "pic.h" // enable_hwirq
+#include "hw/pic.h" // enable_hwirq
/****************************************************************
diff --git a/src/mouse.c b/src/mouse.c
index 5371cf63..5a7ae0a1 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -8,8 +8,8 @@
#include "biosvar.h" // GET_EBDA
#include "util.h" // dprintf
#include "bregs.h" // struct bregs
-#include "ps2port.h" // ps2_mouse_command
-#include "usb-hid.h" // usb_mouse_command
+#include "hw/ps2port.h" // ps2_mouse_command
+#include "hw/usb-hid.h" // usb_mouse_command
void
mouse_init(void)
diff --git a/src/mptable.c b/src/mptable.c
index 0413063d..2d128653 100644
--- a/src/mptable.c
+++ b/src/mptable.c
@@ -8,8 +8,8 @@
#include "util.h" // dprintf
#include "config.h" // CONFIG_*
#include "mptable.h" // MPTABLE_SIGNATURE
-#include "pci.h"
-#include "pci_regs.h"
+#include "hw/pci.h"
+#include "hw/pci_regs.h"
void
mptable_setup(void)
diff --git a/src/mtrr.c b/src/mtrr.c
index 0f94c2c5..001e2755 100644
--- a/src/mtrr.c
+++ b/src/mtrr.c
@@ -6,7 +6,7 @@
#include "util.h" // dprintf
#include "config.h" // CONFIG_*
-#include "pci.h" // pcimem_start
+#include "hw/pci.h" // pcimem_start
#include "paravirt.h" // RamSize
#define MSR_MTRRcap 0x000000fe
diff --git a/src/optionroms.c b/src/optionroms.c
index ac92613b..ffa426dc 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -9,9 +9,9 @@
#include "farptr.h" // FLATPTR_TO_SEG
#include "config.h" // CONFIG_*
#include "util.h" // dprintf
-#include "pci.h" // foreachpci
-#include "pci_regs.h" // PCI_ROM_ADDRESS
-#include "pci_ids.h" // PCI_CLASS_DISPLAY_VGA
+#include "hw/pci.h" // foreachpci
+#include "hw/pci_regs.h" // PCI_ROM_ADDRESS
+#include "hw/pci_ids.h" // PCI_CLASS_DISPLAY_VGA
#include "boot.h" // IPL
#include "optionroms.h" // struct rom_header
diff --git a/src/paravirt.c b/src/paravirt.c
index d1a5d3e2..b1dd8b0c 100644
--- a/src/paravirt.c
+++ b/src/paravirt.c
@@ -15,10 +15,10 @@
#include "paravirt.h" // qemu_cfg_preinit
#include "smbios.h" // smbios_setup
#include "memmap.h" // add_e820
-#include "cmos.h" // CMOS_*
+#include "hw/cmos.h" // CMOS_*
#include "acpi.h" // acpi_setup
#include "mptable.h" // mptable_setup
-#include "pci.h" // create_pirtable
+#include "hw/pci.h" // create_pirtable
#include "xen.h" // xen_biostable_setup
// Amount of continuous ram under 4Gig
diff --git a/src/pcibios.c b/src/pcibios.c
index 3c5f519f..43eb5471 100644
--- a/src/pcibios.c
+++ b/src/pcibios.c
@@ -7,10 +7,10 @@
#include "types.h" // u32
#include "util.h" // handle_1ab1
-#include "pci.h" // pci_config_readl
+#include "hw/pci.h" // pci_config_readl
#include "bregs.h" // struct bregs
#include "biosvar.h" // GET_GLOBAL
-#include "pci_regs.h" // PCI_VENDOR_ID
+#include "hw/pci_regs.h" // PCI_VENDOR_ID
// romlayout.S
extern void entry_bios32(void);
diff --git a/src/pciinit.c b/src/pciinit.c
index 52598536..ca32d431 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -6,9 +6,9 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "util.h" // dprintf
-#include "pci.h" // pci_config_readl
-#include "pci_ids.h" // PCI_VENDOR_ID_INTEL
-#include "pci_regs.h" // PCI_COMMAND
+#include "hw/pci.h" // pci_config_readl
+#include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL
+#include "hw/pci_regs.h" // PCI_COMMAND
#include "ioport.h" // PORT_ATA1_CMD_BASE
#include "config.h" // CONFIG_*
#include "memmap.h" // add_e820
diff --git a/src/pirtable.c b/src/pirtable.c
index 02e2a678..57fb48f2 100644
--- a/src/pirtable.c
+++ b/src/pirtable.c
@@ -5,7 +5,7 @@
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "pci.h" // struct pir_header
+#include "hw/pci.h" // struct pir_header
#include "config.h" // CONFIG_*
#include "util.h" // checksum
diff --git a/src/post.c b/src/post.c
index 27f5709d..9e61580a 100644
--- a/src/post.c
+++ b/src/post.c
@@ -6,25 +6,25 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "config.h" // CONFIG_*
-#include "cmos.h" // CMOS_*
+#include "hw/cmos.h" // CMOS_*
#include "util.h" // memset
#include "biosvar.h" // struct bios_data_area_s
#include "disk.h" // floppy_setup
-#include "ata.h" // ata_setup
-#include "ahci.h" // ahci_setup
+#include "hw/ata.h" // ata_setup
+#include "hw/ahci.h" // ahci_setup
#include "memmap.h" // add_e820
-#include "pic.h" // pic_setup
+#include "hw/pic.h" // pic_setup
#include "bregs.h" // struct bregs
#include "boot.h" // boot_init
-#include "usb.h" // usb_setup
+#include "hw/usb.h" // usb_setup
#include "paravirt.h" // qemu_cfg_preinit
#include "xen.h" // xen_preinit
-#include "ps2port.h" // ps2port_setup
-#include "virtio-blk.h" // virtio_blk_setup
-#include "virtio-scsi.h" // virtio_scsi_setup
-#include "lsi-scsi.h" // lsi_scsi_setup
-#include "esp-scsi.h" // esp_scsi_setup
-#include "megasas.h" // megasas_setup
+#include "hw/ps2port.h" // ps2port_setup
+#include "hw/virtio-blk.h" // virtio_blk_setup
+#include "hw/virtio-scsi.h" // virtio_scsi_setup
+#include "hw/lsi-scsi.h" // lsi_scsi_setup
+#include "hw/esp-scsi.h" // esp_scsi_setup
+#include "hw/megasas.h" // megasas_setup
#include "post.h" // interface_init
diff --git a/src/resume.c b/src/resume.c
index 48e1bd88..8ec6e37b 100644
--- a/src/resume.c
+++ b/src/resume.c
@@ -6,13 +6,13 @@
#include "util.h" // dprintf
#include "ioport.h" // outb
-#include "pic.h" // pic_eoi2
+#include "hw/pic.h" // pic_eoi2
#include "biosvar.h" // struct bios_data_area_s
#include "bregs.h" // struct bregs
#include "acpi.h" // find_resume_vector
-#include "ps2port.h" // i8042_reboot
-#include "pci.h" // pci_reboot
-#include "cmos.h" // inb_cmos
+#include "hw/ps2port.h" // i8042_reboot
+#include "hw/pci.h" // pci_reboot
+#include "hw/cmos.h" // inb_cmos
// Indicator if POST phase has been run.
int HaveRunPost VARFSEG;
diff --git a/src/romlayout.S b/src/romlayout.S
index 291b7980..cc97f9a9 100644
--- a/src/romlayout.S
+++ b/src/romlayout.S
@@ -8,7 +8,7 @@
#include "config.h" // CONFIG_*
#include "ioport.h" // PORT_A20
#include "bregs.h" // CR0_*
-#include "cmos.h" // CMOS_RESET_CODE
+#include "hw/cmos.h" // CMOS_RESET_CODE
#include "asm-offsets.h" // BREGS_*
#include "entryfuncs.S" // ENTRY_*
diff --git a/src/shadow.c b/src/shadow.c
index 966e88d2..67e943f2 100644
--- a/src/shadow.c
+++ b/src/shadow.c
@@ -6,10 +6,10 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "util.h" // memcpy
-#include "pci.h" // pci_config_writeb
+#include "hw/pci.h" // pci_config_writeb
#include "config.h" // CONFIG_*
-#include "pci_ids.h" // PCI_VENDOR_ID_INTEL
-#include "pci_regs.h" // PCI_VENDOR_ID
+#include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL
+#include "hw/pci_regs.h" // PCI_VENDOR_ID
#include "paravirt.h" // runningOnXen
#include "dev-q35.h" // PCI_VENDOR_ID_INTEL
diff --git a/src/smm.c b/src/smm.c
index 8abf15bf..3f01207e 100644
--- a/src/smm.c
+++ b/src/smm.c
@@ -5,12 +5,12 @@
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "pci.h" // pci_config_writel
-#include "pci_regs.h" // PCI_DEVICE_ID
+#include "hw/pci.h" // pci_config_writel
+#include "hw/pci_regs.h" // PCI_DEVICE_ID
#include "util.h" // wbinvd
#include "config.h" // CONFIG_*
#include "ioport.h" // outb
-#include "pci_ids.h" // PCI_VENDOR_ID_INTEL
+#include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "dev-q35.h"
extern u8 smm_relocation_start, smm_relocation_end;
diff --git a/src/smp.c b/src/smp.c
index 0b31573f..6379d364 100644
--- a/src/smp.c
+++ b/src/smp.c
@@ -7,7 +7,7 @@
#include "util.h" // dprintf
#include "config.h" // CONFIG_*
-#include "cmos.h" // CMOS_BIOS_SMP_COUNT
+#include "hw/cmos.h" // CMOS_BIOS_SMP_COUNT
#define APIC_ICR_LOW ((u8*)BUILD_APIC_ADDR + 0x300)
#define APIC_SVR ((u8*)BUILD_APIC_ADDR + 0x0F0)
diff --git a/src/system.c b/src/system.c
index 3c815b38..5269ccf9 100644
--- a/src/system.c
+++ b/src/system.c
@@ -9,7 +9,7 @@
#include "biosvar.h" // BIOS_CONFIG_TABLE
#include "ioport.h" // inb
#include "memmap.h" // E820_RAM
-#include "pic.h" // pic_reset
+#include "hw/pic.h" // pic_reset
#include "bregs.h" // struct bregs
// Use PS2 System Control port A to set A20 enable
diff --git a/src/util.h b/src/util.h
index 6944cfb6..9b1b7741 100644
--- a/src/util.h
+++ b/src/util.h
@@ -281,7 +281,7 @@ void handle_1586(struct bregs *regs);
void useRTC(void);
void releaseRTC(void);
-// timer.c
+// hw/timer.c
void timer_setup(void);
void pmtimer_setup(u16 ioport);
u32 timer_calc(u32 msecs);
diff --git a/src/vgahooks.c b/src/vgahooks.c
index c9a44488..83d5a74b 100644
--- a/src/vgahooks.c
+++ b/src/vgahooks.c
@@ -6,9 +6,9 @@
#include "bregs.h" // set_code_invalid
#include "biosvar.h" // GET_GLOBAL
-#include "pci.h" // pci_find_device
-#include "pci_regs.h" // PCI_VENDOR_ID
-#include "pci_ids.h" // PCI_VENDOR_ID_VIA
+#include "hw/pci.h" // pci_find_device
+#include "hw/pci_regs.h" // PCI_VENDOR_ID
+#include "hw/pci_ids.h" // PCI_VENDOR_ID_VIA
#include "util.h" // handle_155f
#include "config.h" // CONFIG_*
diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c
index b0ba1ecf..20021182 100644
--- a/vgasrc/bochsvga.c
+++ b/vgasrc/bochsvga.c
@@ -13,8 +13,8 @@
#include "config.h" // CONFIG_*
#include "biosvar.h" // GET_GLOBAL
#include "stdvga.h" // VGAREG_SEQU_ADDRESS
-#include "pci.h" // pci_config_readl
-#include "pci_regs.h" // PCI_BASE_ADDRESS_0
+#include "hw/pci.h" // pci_config_readl
+#include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0
/****************************************************************
diff --git a/vgasrc/clext.c b/vgasrc/clext.c
index 8eb226af..012e2b10 100644
--- a/vgasrc/clext.c
+++ b/vgasrc/clext.c
@@ -11,8 +11,8 @@
#include "util.h" // dprintf
#include "bregs.h" // struct bregs
#include "stdvga.h" // VGAREG_SEQU_ADDRESS
-#include "pci.h" // pci_config_readl
-#include "pci_regs.h" // PCI_BASE_ADDRESS_0
+#include "hw/pci.h" // pci_config_readl
+#include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0
/****************************************************************
diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c
index e508cbd8..cdc9e44a 100644
--- a/vgasrc/geodevga.c
+++ b/vgasrc/geodevga.c
@@ -12,8 +12,8 @@
#include "vgabios.h" // VGAREG_*
#include "util.h" // memset
#include "stdvga.h" // stdvga_crtc_write
-#include "pci.h" // pci_config_readl
-#include "pci_regs.h" // PCI_BASE_ADDRESS_0
+#include "hw/pci.h" // pci_config_readl
+#include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0
/****************************************************************
diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c
index 987a2594..506dd8d7 100644
--- a/vgasrc/vgabios.c
+++ b/vgasrc/vgabios.c
@@ -15,8 +15,8 @@
#include "clext.h" // clext_1012
#include "vgahw.h" // vgahw_set_mode
#include "vbe.h" // VBE_RETURN_STATUS_FAILED
-#include "pci.h" // pci_config_readw
-#include "pci_regs.h" // PCI_VENDOR_ID
+#include "hw/pci.h" // pci_config_readw
+#include "hw/pci_regs.h" // PCI_VENDOR_ID
// Standard Video Save Pointer Table
struct VideoSavePointer_s {