[SeaBIOS] [PATCH 08/23] Move function definitions for output.c from util.h to new file output.h.

Kevin O'Connor kevin at koconnor.net
Sun Sep 15 07:09:58 CEST 2013


Also, sort the order of include files in the c files.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/apm.c            |  9 +++----
 src/block.c          |  8 +++----
 src/boot.c           | 11 +++++----
 src/boot.h           |  2 ++
 src/bootsplash.c     | 11 +++++----
 src/cdrom.c          |  6 ++---
 src/clock.c          |  6 ++---
 src/disk.c           | 10 ++++----
 src/fw/acpi.c        |  9 +++----
 src/fw/biostables.c  |  5 ++--
 src/fw/coreboot.c    | 15 ++++++------
 src/fw/csm.c         | 17 ++++++-------
 src/fw/mptable.c     |  5 ++--
 src/fw/mtrr.c        |  3 ++-
 src/fw/paravirt.c    | 19 ++++++++-------
 src/fw/pciinit.c     | 13 +++++-----
 src/fw/pirtable.c    |  4 ++--
 src/fw/shadow.c      |  9 +++----
 src/fw/smbios.c      |  7 +++---
 src/fw/smm.c         |  9 +++----
 src/fw/smp.c         |  3 ++-
 src/fw/xen.c         | 12 +++++-----
 src/hw/ahci.c        | 18 +++++++-------
 src/hw/ahci.h        |  3 +++
 src/hw/ata.c         | 20 ++++++++--------
 src/hw/blockcmd.c    | 19 ++++++++-------
 src/hw/esp-scsi.c    | 15 ++++++------
 src/hw/floppy.c      | 14 +++++------
 src/hw/lsi-scsi.c    | 15 ++++++------
 src/hw/megasas.c     | 13 +++++-----
 src/hw/pci.c         |  9 +++----
 src/hw/pic.c         |  6 ++---
 src/hw/ps2port.c     |  7 +++---
 src/hw/ramdisk.c     |  8 +++----
 src/hw/timer.c       |  9 +++----
 src/hw/usb-ehci.c    | 15 ++++++------
 src/hw/usb-hid.c     |  9 +++----
 src/hw/usb-hub.c     |  7 +++---
 src/hw/usb-msc.c     | 10 ++++----
 src/hw/usb-ohci.c    | 13 +++++-----
 src/hw/usb-uas.c     | 10 ++++----
 src/hw/usb-uhci.c    | 13 +++++-----
 src/hw/usb.c         | 19 ++++++++-------
 src/hw/virtio-blk.c  | 15 ++++++------
 src/hw/virtio-pci.c  |  6 ++---
 src/hw/virtio-ring.c |  4 ++--
 src/hw/virtio-scsi.c | 17 ++++++-------
 src/kbd.c            |  5 ++--
 src/malloc.c         |  8 +++----
 src/memmap.c         |  4 ++--
 src/misc.c           |  4 ++--
 src/mouse.c          |  3 ++-
 src/optionroms.c     |  9 +++----
 src/output.c         |  3 ++-
 src/output.h         | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/pcibios.c        |  8 +++----
 src/pmm.c            |  3 ++-
 src/pnpbios.c        |  3 ++-
 src/post.c           | 27 +++++++++++----------
 src/resume.c         | 11 +++++----
 src/romfile.c        |  2 +-
 src/serial.c         |  3 ++-
 src/stacks.c         |  3 ++-
 src/system.c         |  9 +++----
 src/util.h           | 63 +-----------------------------------------------
 src/vgahooks.c       |  9 +++----
 vgasrc/bochsvga.c    | 10 ++++----
 vgasrc/clext.c       |  8 +++----
 vgasrc/geodevga.c    | 10 ++++----
 vgasrc/stdvgamodes.c |  4 ++--
 vgasrc/vbe.c         | 10 ++++----
 vgasrc/vgabios.c     | 17 ++++++-------
 vgasrc/vgafb.c       |  4 ++--
 73 files changed, 425 insertions(+), 370 deletions(-)
 create mode 100644 src/output.h

diff --git a/src/apm.c b/src/apm.c
index 32d1f4b..b4b9ed9 100644
--- a/src/apm.c
+++ b/src/apm.c
@@ -6,14 +6,15 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
+#include "biosvar.h" // GET_GLOBAL
 #include "bregs.h" // struct bregs
-#include "ioport.h" // outb
-#include "util.h" // dprintf
 #include "config.h" // CONFIG_*
-#include "biosvar.h" // GET_GLOBAL
-#include "fw/paravirt.h" // runningOnQEMU
 #include "fw/acpi.h" // acpi_pm_ctl
+#include "fw/paravirt.h" // runningOnQEMU
+#include "ioport.h" // outb
+#include "output.h" // dprintf
 #include "stacks.h" // yield_toirq
+#include "util.h" // apm_shutdown
 
 static void
 out_str(const char *str_cs)
diff --git a/src/block.c b/src/block.c
index 5c8bf75..73d6068 100644
--- a/src/block.c
+++ b/src/block.c
@@ -5,15 +5,15 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "disk.h" // struct ata_s
 #include "biosvar.h" // GET_GLOBAL
-#include "hw/cmos.h" // inb_cmos
-#include "util.h" // dprintf
+#include "disk.h" // struct ata_s
 #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/cmos.h" // inb_cmos
 #include "hw/blockcmd.h" // cdb_*
+#include "hw/virtio-blk.h" // process_virtio_blk_op
 #include "malloc.h" // malloc_low
+#include "output.h" // dprintf
 #include "stacks.h" // stack_hop
 #include "string.h" // checksum
 
diff --git a/src/boot.c b/src/boot.c
index cb85325..1cb49d4 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -5,20 +5,21 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
+#include "boot.h" // boot_init
+#include "bregs.h" // struct bregs
 #include "config.h" // CONFIG_*
 #include "disk.h" // cdrom_boot
-#include "bregs.h" // struct bregs
-#include "boot.h" // func defs
-#include "hw/cmos.h" // inb_cmos
+#include "fw/csm.h" // csm_bootprio_*
 #include "fw/paravirt.h" // qemu_cfg_show_boot_menu
+#include "hw/cmos.h" // inb_cmos
 #include "hw/pci.h" // pci_bdf_to_*
 #include "hw/usb.h" // struct usbdevice_s
-#include "fw/csm.h" // csm_bootprio_*
 #include "list.h" // hlist_node
 #include "malloc.h" // free
+#include "output.h" // dprintf
 #include "romfile.h" // romfile_loadint
 #include "string.h" // memset
+#include "util.h" // irqtimer_calc
 
 
 /****************************************************************
diff --git a/src/boot.h b/src/boot.h
index 4d4943b..e6b81bd 100644
--- a/src/boot.h
+++ b/src/boot.h
@@ -2,6 +2,8 @@
 #ifndef __BOOT_H
 #define __BOOT_H
 
+#include "types.h" // u16
+
 // boot.c
 void boot_init(void);
 void boot_add_bev(u16 seg, u16 bev, u16 desc, int prio);
diff --git a/src/bootsplash.c b/src/bootsplash.c
index 1bea722..b7b3eb8 100644
--- a/src/bootsplash.c
+++ b/src/bootsplash.c
@@ -5,18 +5,19 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
+#include "bmp.h" // bmp_alloc
 #include "bregs.h" // struct bregs
-#include "farptr.h" // FLATPTR_TO_SEG
 #include "config.h" // CONFIG_*
-#include "util.h" // dprintf
-#include "jpeg.h" // splash
-#include "vbe.h" // struct vbe_info
-#include "bmp.h" // bmp_alloc
+#include "farptr.h" // FLATPTR_TO_SEG
 #include "fw/smbios.h" // display_uuid
+#include "jpeg.h" // jpeg_alloc
 #include "malloc.h" // free
+#include "output.h" // dprintf
 #include "romfile.h" // romfile_loadfile
 #include "stacks.h" // call16_int
 #include "string.h" // memset
+#include "util.h" // enable_bootsplash
+#include "vbe.h" // struct vbe_info
 
 
 /****************************************************************
diff --git a/src/cdrom.c b/src/cdrom.c
index a9ac9e4..c499cf9 100644
--- a/src/cdrom.c
+++ b/src/cdrom.c
@@ -5,13 +5,13 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "disk.h" // cdrom_13
-#include "util.h" // dprintf
-#include "bregs.h" // struct bregs
 #include "biosvar.h" // GET_GLOBAL
+#include "bregs.h" // struct bregs
+#include "disk.h" // cdrom_13
 #include "hw/ata.h" // ATA_CMD_REQUEST_SENSE
 #include "hw/blockcmd.h" // CDB_CMD_REQUEST_SENSE
 #include "malloc.h" // free
+#include "output.h" // dprintf
 #include "string.h" // memset
 
 // Locks for removable devices
diff --git a/src/clock.c b/src/clock.c
index 6b27aa9..d7de59e 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -6,16 +6,16 @@
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "biosvar.h" // SET_BDA
-#include "util.h" // debug_enter
+#include "bregs.h" // struct bregs
 #include "disk.h" // floppy_tick
 #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 "hw/usb-hid.h" // usb_check_event
+#include "output.h" // debug_enter
 #include "stacks.h" // yield
 #include "string.h" // memset
+#include "util.h" // clock_setup
 
 // RTC register flags
 #define RTC_A_UIP 0x80
diff --git a/src/disk.c b/src/disk.c
index 2d335e6..b149b6d 100644
--- a/src/disk.c
+++ b/src/disk.c
@@ -5,14 +5,14 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "disk.h" // floppy_13
 #include "biosvar.h" // SET_BDA
-#include "config.h" // CONFIG_*
-#include "util.h" // debug_enter
-#include "hw/pic.h" // pic_eoi2
 #include "bregs.h" // struct bregs
-#include "hw/pci.h" // pci_bdf_to_bus
+#include "config.h" // CONFIG_*
+#include "disk.h" // floppy_13
 #include "hw/ata.h" // ATA_CB_DC
+#include "hw/pci.h" // pci_bdf_to_bus
+#include "hw/pic.h" // pic_eoi2
+#include "output.h" // debug_enter
 #include "stacks.h" // call16_int
 #include "string.h" // memset
 
diff --git a/src/fw/acpi.c b/src/fw/acpi.c
index 8ad3673..cba3f68 100644
--- a/src/fw/acpi.c
+++ b/src/fw/acpi.c
@@ -6,18 +6,19 @@
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "acpi.h" // struct rsdp_descriptor
-#include "util.h" // dprintf
 #include "byteorder.h" // cpu_to_le16
+#include "config.h" // CONFIG_*
+#include "dev-q35.h"
 #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
-#include "dev-q35.h"
 #include "malloc.h" // free
+#include "output.h" // dprintf
+#include "paravirt.h" // RamSize
 #include "romfile.h" // romfile_loadint
 #include "string.h" // memset
+#include "util.h" // MaxCountCPUs
 #include "x86.h" // readl
 
 #include "src/fw/acpi-dsdt.hex"
diff --git a/src/fw/biostables.c b/src/fw/biostables.c
index 06cd864..8fa9fac 100644
--- a/src/fw/biostables.c
+++ b/src/fw/biostables.c
@@ -4,14 +4,15 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
+#include "acpi.h" // struct rsdp_descriptor
 #include "config.h" // CONFIG_*
-#include "util.h" // dprintf
 #include "hw/pci.h" // struct pir_header
-#include "acpi.h" // struct rsdp_descriptor
 #include "malloc.h" // malloc_fseg
 #include "mptable.h" // MPTABLE_SIGNATURE
+#include "output.h" // dprintf
 #include "smbios.h" // struct smbios_entry_point
 #include "string.h" // memcpy
+#include "util.h" // copy_table
 
 static void
 copy_pir(void *pos)
diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c
index 9971f82..c82dd4e 100644
--- a/src/fw/coreboot.c
+++ b/src/fw/coreboot.c
@@ -4,21 +4,22 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "memmap.h" // add_e820
-#include "util.h" // dprintf
-#include "byteorder.h" // be32_to_cpu
-#include "lzmadecode.h" // LzmaDecode
-#include "smbios.h" // smbios_init
+#include "acpi.h" // find_acpi_features
 #include "boot.h" // boot_add_cbfs
-#include "disk.h" // MAXDESCSIZE
+#include "byteorder.h" // be32_to_cpu
 #include "config.h" // CONFIG_*
-#include "acpi.h" // find_acpi_features
+#include "disk.h" // MAXDESCSIZE
 #include "hw/pci.h" // pci_probe_devices
+#include "lzmadecode.h" // LzmaDecode
 #include "malloc.h" // free
+#include "memmap.h" // add_e820
+#include "output.h" // dprintf
 #include "paravirt.h" // PlatformRunningOn
 #include "romfile.h" // romfile_findprefix
+#include "smbios.h" // smbios_init
 #include "stacks.h" // yield
 #include "string.h" // memset
+#include "util.h" // coreboot_preinit
 
 
 /****************************************************************
diff --git a/src/fw/csm.c b/src/fw/csm.c
index 9e73a40..7a926b1 100644
--- a/src/fw/csm.c
+++ b/src/fw/csm.c
@@ -4,21 +4,22 @@
 //
 // 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"
 #include "config.h" // CONFIG_*
 #include "csm.h"
-#include "util.h" // dprintf
-#include "bregs.h"
-#include "optionroms.h"
 #include "hw/pci.h"
+#include "hw/pic.h"
+#include "malloc.h" // csm_malloc_preinit
 #include "memmap.h"
-#include "biosvar.h"
+#include "optionroms.h"
+#include "output.h" // dprintf
 #include "post.h"
-#include "acpi.h"
-#include "boot.h"
 #include "smbios.h"
-#include "hw/pic.h"
-#include "malloc.h" // csm_malloc_preinit
 #include "stacks.h" // wait_threads
+#include "util.h" // copy_smbios
 
 struct rsdp_descriptor csm_rsdp VARFSEG __aligned(16);
 
diff --git a/src/fw/mptable.c b/src/fw/mptable.c
index 4562a46..9877bae 100644
--- a/src/fw/mptable.c
+++ b/src/fw/mptable.c
@@ -5,14 +5,15 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
 #include "config.h" // CONFIG_*
-#include "mptable.h" // MPTABLE_SIGNATURE
 #include "hw/pci.h"
 #include "hw/pci_regs.h"
 #include "malloc.h" // free
+#include "mptable.h" // MPTABLE_SIGNATURE
+#include "output.h" // dprintf
 #include "romfile.h" // romfile_loadint
 #include "string.h" // memset
+#include "util.h" // MaxCountCPUs
 #include "x86.h" // cpuid
 
 void
diff --git a/src/fw/mtrr.c b/src/fw/mtrr.c
index 855457a..913580e 100644
--- a/src/fw/mtrr.c
+++ b/src/fw/mtrr.c
@@ -4,10 +4,11 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
 #include "config.h" // CONFIG_*
 #include "hw/pci.h" // pcimem_start
+#include "output.h" // dprintf
 #include "paravirt.h" // RamSize
+#include "util.h" // mtrr_setup
 #include "x86.h" // cpuid
 
 #define MSR_MTRRcap                    0x000000fe
diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c
index ea2bbfb..b76c1db 100644
--- a/src/fw/paravirt.c
+++ b/src/fw/paravirt.c
@@ -8,22 +8,23 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "config.h" // CONFIG_QEMU
-#include "util.h" // dprintf
+#include "acpi.h" // acpi_setup
 #include "byteorder.h" // be32_to_cpu
-#include "ioport.h" // outw
-#include "paravirt.h" // qemu_cfg_preinit
-#include "smbios.h" // smbios_setup
-#include "memmap.h" // add_e820
+#include "config.h" // CONFIG_QEMU
 #include "hw/cmos.h" // CMOS_*
-#include "acpi.h" // acpi_setup
-#include "mptable.h" // mptable_setup
 #include "hw/pci.h" // create_pirtable
-#include "xen.h" // xen_biostable_setup
+#include "ioport.h" // outw
 #include "malloc.h" // malloc_tmp
+#include "memmap.h" // add_e820
+#include "mptable.h" // mptable_setup
+#include "output.h" // dprintf
+#include "paravirt.h" // qemu_cfg_preinit
 #include "romfile.h" // romfile_loadint
+#include "smbios.h" // smbios_setup
 #include "string.h" // memset
+#include "util.h" // pci_setup
 #include "x86.h" // cpuid
+#include "xen.h" // xen_biostable_setup
 
 // Amount of continuous ram under 4Gig
 u32 RamSize;
diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
index 549c940..834847b 100644
--- a/src/fw/pciinit.c
+++ b/src/fw/pciinit.c
@@ -5,19 +5,20 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
+#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
 #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
-#include "paravirt.h" // RamSize
-#include "dev-q35.h" // Q35_HOST_BRIDGE_PCIEXBAR_ADDR
 #include "list.h" // struct hlist_node
-#include "acpi.h" // acpi_pm1a_cnt
 #include "malloc.h" // free
+#include "memmap.h" // add_e820
+#include "output.h" // dprintf
+#include "paravirt.h" // RamSize
 #include "string.h" // memset
+#include "util.h" // pci_setup
 
 #define PCI_DEVICE_MEM_MIN     0x1000
 #define PCI_BRIDGE_IO_MIN      0x1000
diff --git a/src/fw/pirtable.c b/src/fw/pirtable.c
index d66d21b..bd4a6aa 100644
--- a/src/fw/pirtable.c
+++ b/src/fw/pirtable.c
@@ -5,9 +5,9 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "hw/pci.h" // struct pir_header
 #include "config.h" // CONFIG_*
-#include "util.h" // dprintf
+#include "hw/pci.h" // struct pir_header
+#include "output.h" // dprintf
 #include "string.h" // checksum
 
 struct pir_header *PirAddr VARFSEG;
diff --git a/src/fw/shadow.c b/src/fw/shadow.c
index c470592..82d6753 100644
--- a/src/fw/shadow.c
+++ b/src/fw/shadow.c
@@ -5,15 +5,16 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "hw/pci.h" // pci_config_writeb
 #include "config.h" // CONFIG_*
+#include "dev-q35.h" // PCI_VENDOR_ID_INTEL
+#include "hw/pci.h" // pci_config_writeb
 #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
 #include "malloc.h" // rom_get_last
+#include "output.h" // dprintf
+#include "paravirt.h" // runningOnXen
 #include "string.h" // memset
+#include "util.h" // make_bios_writable
 #include "x86.h" // wbinvd
 
 // On the emulators, the bios at 0xf0000 is also at 0xffff0000
diff --git a/src/fw/smbios.c b/src/fw/smbios.c
index beb3143..a8969da 100644
--- a/src/fw/smbios.c
+++ b/src/fw/smbios.c
@@ -5,13 +5,14 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
 #include "config.h" // CONFIG_*
-#include "paravirt.h" // RamSize
-#include "smbios.h" // struct smbios_entry_point
 #include "malloc.h" // free
+#include "output.h" // dprintf
+#include "paravirt.h" // RamSize
 #include "romfile.h" // romfile_findprefix
+#include "smbios.h" // struct smbios_entry_point
 #include "string.h" // memset
+#include "util.h" // MaxCountCPUs
 #include "x86.h" // cpuid
 
 struct smbios_entry_point *SMBiosAddr;
diff --git a/src/fw/smm.c b/src/fw/smm.c
index 8ca1e83..7142ac0 100644
--- a/src/fw/smm.c
+++ b/src/fw/smm.c
@@ -5,14 +5,15 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
+#include "config.h" // CONFIG_*
+#include "dev-q35.h"
 #include "hw/pci.h" // pci_config_writel
+#include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL
 #include "hw/pci_regs.h" // PCI_DEVICE_ID
-#include "util.h" // dprintf
-#include "config.h" // CONFIG_*
 #include "ioport.h" // outb
-#include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL
-#include "dev-q35.h"
+#include "output.h" // dprintf
 #include "string.h" // memcpy
+#include "util.h" // smm_setup
 #include "x86.h" // wbinvd
 
 extern u8 smm_relocation_start, smm_relocation_end;
diff --git a/src/fw/smp.c b/src/fw/smp.c
index cc6fb80..b96bcfd 100644
--- a/src/fw/smp.c
+++ b/src/fw/smp.c
@@ -5,11 +5,12 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
 #include "config.h" // CONFIG_*
 #include "hw/cmos.h" // CMOS_BIOS_SMP_COUNT
+#include "output.h" // dprintf
 #include "romfile.h" // romfile_loadint
 #include "stacks.h" // yield
+#include "util.h" // smp_setup
 #include "x86.h" // wrmsr
 
 #define APIC_ICR_LOW ((u8*)BUILD_APIC_ADDR + 0x300)
diff --git a/src/fw/xen.c b/src/fw/xen.c
index 8412330..9252721 100644
--- a/src/fw/xen.c
+++ b/src/fw/xen.c
@@ -4,16 +4,16 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "config.h"
-#include "xen.h"
-#include "paravirt.h" // PlatformRunningOn
-#include "memmap.h" // add_e820
-#include "types.h" // ASM32FLAT
-#include "util.h" // copy_acpi_rsdp
 #include "acpi.h" // find_acpi_features
+#include "config.h"
 #include "malloc.h" // memalign_high
+#include "memmap.h" // add_e820
+#include "output.h" // dprintf
+#include "paravirt.h" // PlatformRunningOn
 #include "string.h" // memcpy
+#include "util.h" // copy_acpi_rsdp
 #include "x86.h" // cpuid
+#include "xen.h"
 
 #define INFO_PHYSICAL_ADDRESS 0x00001000
 
diff --git a/src/hw/ahci.c b/src/hw/ahci.c
index b3530f9..bf70e23 100644
--- a/src/hw/ahci.c
+++ b/src/hw/ahci.c
@@ -4,21 +4,21 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "types.h" // u8
-#include "ioport.h" // inb
-#include "util.h" // dprintf
+#include "ahci.h" // CDB_CMD_READ_10
+#include "ata.h" // ATA_CB_STAT
 #include "biosvar.h" // GET_GLOBAL
+#include "blockcmd.h" // CDB_CMD_READ_10
+#include "boot.h" // add_bcv_hd
+#include "disk.h" // struct drive_s
+#include "ioport.h" // inb
+#include "malloc.h" // free
+#include "output.h" // dprintf
 #include "pci.h" // foreachpci
 #include "pci_ids.h" // PCI_CLASS_STORAGE_OTHER
 #include "pci_regs.h" // PCI_INTERRUPT_LINE
-#include "boot.h" // add_bcv_hd
-#include "disk.h" // struct ata_s
-#include "ata.h" // ATA_CB_STAT
-#include "ahci.h" // CDB_CMD_READ_10
-#include "blockcmd.h" // CDB_CMD_READ_10
-#include "malloc.h" // free
 #include "stacks.h" // yield
 #include "string.h" // memset
+#include "util.h" // timer_calc
 
 #define AHCI_REQUEST_TIMEOUT 32000 // 32 seconds max for IDE ops
 #define AHCI_RESET_TIMEOUT     500 // 500 miliseconds
diff --git a/src/hw/ahci.h b/src/hw/ahci.h
index c3d3a70..c3d2402 100644
--- a/src/hw/ahci.h
+++ b/src/hw/ahci.h
@@ -1,6 +1,9 @@
 #ifndef __AHCI_H
 #define __AHCI_H
 
+#include "types.h" // u32
+#include "disk.h" // struct drive_s
+
 struct sata_cmd_fis {
     u8 reg;
     u8 pmp_type;
diff --git a/src/hw/ata.c b/src/hw/ata.c
index b58ecc3..7338ebf 100644
--- a/src/hw/ata.c
+++ b/src/hw/ata.c
@@ -5,23 +5,23 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "types.h" // u8
-#include "ioport.h" // inb
-#include "util.h" // dprintf
+#include "ata.h" // ATA_CB_STAT
+#include "biosvar.h" // GET_GLOBAL
+#include "blockcmd.h" // CDB_CMD_READ_10
+#include "boot.h" // boot_add_hd
 #include "byteorder.h" // be16_to_cpu
 #include "cmos.h" // inb_cmos
-#include "pic.h" // enable_hwirq
-#include "biosvar.h" // GET_GLOBAL
+#include "disk.h" // struct ata_s
+#include "ioport.h" // inb
+#include "malloc.h" // malloc_fseg
+#include "output.h" // dprintf
 #include "pci.h" // foreachpci
 #include "pci_ids.h" // PCI_CLASS_STORAGE_OTHER
 #include "pci_regs.h" // PCI_INTERRUPT_LINE
-#include "boot.h" // boot_add_hd
-#include "disk.h" // struct ata_s
-#include "ata.h" // ATA_CB_STAT
-#include "blockcmd.h" // CDB_CMD_READ_10
-#include "malloc.h" // malloc_fseg
+#include "pic.h" // enable_hwirq
 #include "stacks.h" // yield
 #include "string.h" // memset
+#include "util.h" // timer_calc
 
 #define IDE_TIMEOUT 32000 //32 seconds max for IDE ops
 
diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c
index 6f79cc5..59f5763 100644
--- a/src/hw/blockcmd.c
+++ b/src/hw/blockcmd.c
@@ -5,21 +5,22 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
+#include "ahci.h" // atapi_cmd_data
+#include "ata.h" // atapi_cmd_data
 #include "biosvar.h" // GET_GLOBAL
-#include "util.h" // dprintf
+#include "blockcmd.h" // struct cdb_request_sense
+#include "boot.h" // boot_add_hd
 #include "byteorder.h" // be32_to_cpu
 #include "disk.h" // struct disk_op_s
-#include "blockcmd.h" // struct cdb_request_sense
-#include "ata.h" // atapi_cmd_data
-#include "ahci.h" // atapi_cmd_data
-#include "usb-msc.h" // usb_cmd_data
-#include "usb-uas.h" // usb_cmd_data
-#include "virtio-scsi.h" // virtio_scsi_cmd_data
-#include "lsi-scsi.h" // lsi_scsi_cmd_data
 #include "esp-scsi.h" // esp_scsi_cmd_data
+#include "lsi-scsi.h" // lsi_scsi_cmd_data
 #include "megasas.h" // megasas_cmd_data
-#include "boot.h" // boot_add_hd
+#include "output.h" // dprintf
 #include "string.h" // memset
+#include "usb-msc.h" // usb_cmd_data
+#include "usb-uas.h" // usb_cmd_data
+#include "util.h" // timer_calc
+#include "virtio-scsi.h" // virtio_scsi_cmd_data
 
 // Route command to low-level handler.
 static int
diff --git a/src/hw/esp-scsi.c b/src/hw/esp-scsi.c
index 0f55bb9..65a67cd 100644
--- a/src/hw/esp-scsi.c
+++ b/src/hw/esp-scsi.c
@@ -10,18 +10,19 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "pci.h" // foreachpci
-#include "config.h" // CONFIG_*
 #include "biosvar.h" // GET_GLOBAL
-#include "pci_ids.h" // PCI_DEVICE_ID
-#include "pci_regs.h" // PCI_VENDOR_ID
-#include "boot.h" // bootprio_find_scsi_device
 #include "blockcmd.h" // scsi_drive_setup
-#include "fw/paravirt.h" // runningOnQEMU
+#include "boot.h" // bootprio_find_scsi_device
+#include "config.h" // CONFIG_*
 #include "disk.h"
+#include "fw/paravirt.h" // runningOnQEMU
 #include "malloc.h" // free
+#include "output.h" // dprintf
+#include "pci.h" // foreachpci
+#include "pci_ids.h" // PCI_DEVICE_ID
+#include "pci_regs.h" // PCI_VENDOR_ID
 #include "string.h" // memset
+#include "util.h" // usleep
 
 #define ESP_TCLO      0x00
 #define ESP_TCMID     0x04
diff --git a/src/hw/floppy.c b/src/hw/floppy.c
index baae88b..e2db2f8 100644
--- a/src/hw/floppy.c
+++ b/src/hw/floppy.c
@@ -5,21 +5,21 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "types.h" // u8
-#include "disk.h" // DISK_RET_SUCCESS
-#include "config.h" // CONFIG_FLOPPY
 #include "biosvar.h" // SET_BDA
-#include "util.h" // dprintf
-#include "cmos.h" // inb_cmos
-#include "pic.h" // pic_eoi1
-#include "bregs.h" // struct bregs
 #include "boot.h" // boot_add_floppy
+#include "bregs.h" // struct bregs
+#include "cmos.h" // inb_cmos
+#include "config.h" // CONFIG_FLOPPY
+#include "disk.h" // DISK_RET_SUCCESS
 #include "malloc.h" // malloc_fseg
+#include "output.h" // dprintf
 #include "pci.h" // pci_to_bdf
 #include "pci_ids.h" // PCI_CLASS_BRIDGE_ISA
+#include "pic.h" // pic_eoi1
 #include "romfile.h" // romfile_loadint
 #include "stacks.h" // yield
 #include "string.h" // memset
+#include "util.h" // timer_calc
 
 #define FLOPPY_SIZE_CODE 0x02 // 512 byte sectors
 #define FLOPPY_DATALEN 0xff   // Not used - because size code is 0x02
diff --git a/src/hw/lsi-scsi.c b/src/hw/lsi-scsi.c
index 91ed198..87751aa 100644
--- a/src/hw/lsi-scsi.c
+++ b/src/hw/lsi-scsi.c
@@ -10,18 +10,19 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "pci.h" // foreachpci
-#include "config.h" // CONFIG_*
 #include "biosvar.h" // GET_GLOBAL
-#include "pci_ids.h" // PCI_DEVICE_ID_VIRTIO_BLK
-#include "pci_regs.h" // PCI_VENDOR_ID
-#include "boot.h" // bootprio_find_scsi_device
 #include "blockcmd.h" // scsi_drive_setup
-#include "fw/paravirt.h" // runningOnQEMU
+#include "boot.h" // bootprio_find_scsi_device
+#include "config.h" // CONFIG_*
 #include "disk.h"
+#include "fw/paravirt.h" // runningOnQEMU
 #include "malloc.h" // free
+#include "output.h" // dprintf
+#include "pci.h" // foreachpci
+#include "pci_ids.h" // PCI_DEVICE_ID_VIRTIO_BLK
+#include "pci_regs.h" // PCI_VENDOR_ID
 #include "string.h" // memset
+#include "util.h" // usleep
 
 #define LSI_REG_DSTAT     0x0c
 #define LSI_REG_ISTAT0    0x14
diff --git a/src/hw/megasas.c b/src/hw/megasas.c
index 29143eb..4bba0e1 100644
--- a/src/hw/megasas.c
+++ b/src/hw/megasas.c
@@ -10,18 +10,19 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "pci.h" // foreachpci
-#include "config.h" // CONFIG_*
 #include "biosvar.h" // GET_GLOBAL
-#include "pci_ids.h" // PCI_DEVICE_ID_XXX
-#include "pci_regs.h" // PCI_VENDOR_ID
-#include "boot.h" // bootprio_find_scsi_device
 #include "blockcmd.h" // scsi_drive_setup
+#include "boot.h" // bootprio_find_scsi_device
+#include "config.h" // CONFIG_*
 #include "disk.h"
 #include "malloc.h" // free
+#include "output.h" // dprintf
+#include "pci.h" // foreachpci
+#include "pci_ids.h" // PCI_DEVICE_ID_XXX
+#include "pci_regs.h" // PCI_VENDOR_ID
 #include "stacks.h" // yield
 #include "string.h" // memset
+#include "util.h" // timer_calc
 
 #define MFI_DB 0x0 // Doorbell
 #define MFI_OMSG0 0x18 // Outbound message 0
diff --git a/src/hw/pci.c b/src/hw/pci.c
index 9c287ee..4295d01 100644
--- a/src/hw/pci.c
+++ b/src/hw/pci.c
@@ -6,16 +6,17 @@
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "config.h" // CONFIG_*
-#include "pci.h" // pci_config_writel
-#include "ioport.h" // outl
-#include "util.h" // dprintf
 #include "farptr.h" // MAKE_FLATPTR
+#include "ioport.h" // outl
 #include "malloc.h" // malloc_tmp
-#include "pci_regs.h" // PCI_VENDOR_ID
+#include "output.h" // dprintf
+#include "pci.h" // pci_config_writel
 #include "pci_ids.h" // PCI_CLASS_DISPLAY_VGA
+#include "pci_regs.h" // PCI_VENDOR_ID
 #include "romfile.h" // romfile_loadint
 #include "stacks.h" // call32
 #include "string.h" // memset
+#include "util.h" // udelay
 #include "x86.h" // readl
 
 void pci_config_writel(u16 bdf, u32 addr, u32 val)
diff --git a/src/hw/pic.c b/src/hw/pic.c
index 9a3ea0b..6ff6967 100644
--- a/src/hw/pic.c
+++ b/src/hw/pic.c
@@ -5,10 +5,10 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "pic.h" // pic_*
-#include "util.h" // dprintf
-#include "config.h" // CONFIG_*
 #include "biosvar.h" // SET_IVT
+#include "config.h" // CONFIG_*
+#include "output.h" // dprintf
+#include "pic.h" // pic_*
 
 u16
 pic_irqmask_read(void)
diff --git a/src/hw/ps2port.c b/src/hw/ps2port.c
index 6da297f..936d152 100644
--- a/src/hw/ps2port.c
+++ b/src/hw/ps2port.c
@@ -5,13 +5,14 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "ioport.h" // inb
-#include "util.h" // dprintf
 #include "biosvar.h" // GET_LOW
-#include "ps2port.h" // ps2_kbd_command
+#include "ioport.h" // inb
+#include "output.h" // dprintf
 #include "pic.h" // pic_eoi1
+#include "ps2port.h" // ps2_kbd_command
 #include "romfile.h" // romfile_loadint
 #include "stacks.h" // yield
+#include "util.h" // udelay
 
 
 /****************************************************************
diff --git a/src/hw/ramdisk.c b/src/hw/ramdisk.c
index a50e7c0..2599f9a 100644
--- a/src/hw/ramdisk.c
+++ b/src/hw/ramdisk.c
@@ -4,13 +4,13 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "disk.h" // process_ramdisk_op
-#include "util.h" // dprintf
-#include "memmap.h" // add_e820
 #include "biosvar.h" // GET_GLOBAL
-#include "bregs.h" // struct bregs
 #include "boot.h" // boot_add_floppy
+#include "bregs.h" // struct bregs
+#include "disk.h" // process_ramdisk_op
 #include "malloc.h" // malloc_fseg
+#include "memmap.h" // add_e820
+#include "output.h" // dprintf
 #include "romfile.h" // romfile_findprefix
 #include "stacks.h" // call16_int
 #include "string.h" // memset
diff --git a/src/hw/timer.c b/src/hw/timer.c
index 56c4eca..6477313 100644
--- a/src/hw/timer.c
+++ b/src/hw/timer.c
@@ -4,12 +4,13 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "pit.h" // PM_SEL_TIMER0
-#include "ioport.h" // PORT_PIT_MODE
-#include "config.h" // CONFIG_*
 #include "biosvar.h" // GET_LOW
+#include "config.h" // CONFIG_*
+#include "ioport.h" // PORT_PIT_MODE
+#include "output.h" // dprintf
+#include "pit.h" // PM_SEL_TIMER0
 #include "stacks.h" // yield
+#include "util.h" // timer_setup
 #include "x86.h" // cpuid
 
 // Bits for PORT_PS2_CTRLB
diff --git a/src/hw/usb-ehci.c b/src/hw/usb-ehci.c
index 6786fd3..626f308 100644
--- a/src/hw/usb-ehci.c
+++ b/src/hw/usb-ehci.c
@@ -4,19 +4,20 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "pci.h" // pci_bdf_to_bus
+#include "biosvar.h" // GET_LOWFLAT
 #include "config.h" // CONFIG_*
 #include "ioport.h" // outw
-#include "usb-ehci.h" // struct ehci_qh
+#include "output.h" // dprintf
+#include "malloc.h" // free
+#include "pci.h" // pci_bdf_to_bus
 #include "pci_ids.h" // PCI_CLASS_SERIAL_USB_UHCI
 #include "pci_regs.h" // PCI_BASE_ADDRESS_0
+#include "string.h" // memset
 #include "usb.h" // struct usb_s
-#include "biosvar.h" // GET_LOWFLAT
-#include "usb-uhci.h" // uhci_setup
+#include "usb-ehci.h" // struct ehci_qh
 #include "usb-ohci.h" // ohci_setup
-#include "malloc.h" // free
-#include "string.h" // memset
+#include "usb-uhci.h" // uhci_setup
+#include "util.h" // msleep
 #include "x86.h" // readl
 
 struct usb_ehci_s {
diff --git a/src/hw/usb-hid.c b/src/hw/usb-hid.c
index deb3ea5..e94aa16 100644
--- a/src/hw/usb-hid.c
+++ b/src/hw/usb-hid.c
@@ -4,12 +4,13 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "usb-hid.h" // usb_keyboard_setup
-#include "config.h" // CONFIG_*
-#include "usb.h" // usb_ctrlrequest
 #include "biosvar.h" // GET_GLOBAL
+#include "config.h" // CONFIG_*
+#include "output.h" // dprintf
 #include "ps2port.h" // ATKBD_CMD_GETID
+#include "usb.h" // usb_ctrlrequest
+#include "usb-hid.h" // usb_keyboard_setup
+#include "util.h" // process_key
 
 struct usb_pipe *keyboard_pipe VARFSEG;
 struct usb_pipe *mouse_pipe VARFSEG;
diff --git a/src/hw/usb-hub.c b/src/hw/usb-hub.c
index 5bef26f..477518b 100644
--- a/src/hw/usb-hub.c
+++ b/src/hw/usb-hub.c
@@ -4,11 +4,12 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
 #include "config.h" // CONFIG_USB_HUB
-#include "usb-hub.h" // struct usb_hub_descriptor
-#include "usb.h" // struct usb_s
+#include "output.h" // dprintf
 #include "string.h" // memset
+#include "usb.h" // struct usb_s
+#include "usb-hub.h" // struct usb_hub_descriptor
+#include "util.h" // timer_calc
 
 static int
 get_hub_desc(struct usb_pipe *pipe, struct usb_hub_descriptor *desc)
diff --git a/src/hw/usb-msc.c b/src/hw/usb-msc.c
index f592726..ee1fe20 100644
--- a/src/hw/usb-msc.c
+++ b/src/hw/usb-msc.c
@@ -4,16 +4,16 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "config.h" // CONFIG_USB_MSC
-#include "usb-msc.h" // usb_msc_setup
-#include "usb.h" // struct usb_s
 #include "biosvar.h" // GET_GLOBAL
 #include "blockcmd.h" // cdb_read
-#include "disk.h" // DTYPE_USB
 #include "boot.h" // bootprio_find_usb
+#include "config.h" // CONFIG_USB_MSC
+#include "disk.h" // DTYPE_USB
 #include "malloc.h" // free
+#include "output.h" // dprintf
 #include "string.h" // memset
+#include "usb.h" // struct usb_s
+#include "usb-msc.h" // usb_msc_setup
 
 struct usbdrive_s {
     struct drive_s drive;
diff --git a/src/hw/usb-ohci.c b/src/hw/usb-ohci.c
index c96c1d7..313e3fd 100644
--- a/src/hw/usb-ohci.c
+++ b/src/hw/usb-ohci.c
@@ -4,15 +4,16 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "pci.h" // pci_bdf_to_bus
-#include "config.h" // CONFIG_*
-#include "usb-ohci.h" // struct ohci_hcca
-#include "pci_regs.h" // PCI_BASE_ADDRESS_0
-#include "usb.h" // struct usb_s
 #include "biosvar.h" // GET_LOWFLAT
+#include "config.h" // CONFIG_*
 #include "malloc.h" // free
+#include "output.h" // dprintf
+#include "pci.h" // pci_bdf_to_bus
+#include "pci_regs.h" // PCI_BASE_ADDRESS_0
 #include "string.h" // memset
+#include "usb.h" // struct usb_s
+#include "usb-ohci.h" // struct ohci_hcca
+#include "util.h" // msleep
 #include "x86.h" // readl
 
 #define FIT                     (1 << 31)
diff --git a/src/hw/usb-uas.c b/src/hw/usb-uas.c
index ab9a050..6925f33 100644
--- a/src/hw/usb-uas.c
+++ b/src/hw/usb-uas.c
@@ -14,16 +14,16 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "config.h" // CONFIG_USB_UAS
-#include "usb.h" // struct usb_s
 #include "biosvar.h" // GET_GLOBAL
 #include "blockcmd.h" // cdb_read
-#include "disk.h" // DTYPE_UAS
 #include "boot.h" // bootprio_find_usb
-#include "usb-uas.h" // usb_uas_init
+#include "config.h" // CONFIG_USB_UAS
+#include "disk.h" // DTYPE_UAS
 #include "malloc.h" // free
+#include "output.h" // dprintf
 #include "string.h" // memset
+#include "usb.h" // struct usb_s
+#include "usb-uas.h" // usb_uas_init
 
 #define UAS_UI_COMMAND              0x01
 #define UAS_UI_SENSE                0x03
diff --git a/src/hw/usb-uhci.c b/src/hw/usb-uhci.c
index 2587a56..753e5dd 100644
--- a/src/hw/usb-uhci.c
+++ b/src/hw/usb-uhci.c
@@ -4,16 +4,17 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "pci.h" // pci_bdf_to_bus
+#include "biosvar.h" // GET_LOWFLAT
 #include "config.h" // CONFIG_*
 #include "ioport.h" // outw
-#include "usb-uhci.h" // USBLEGSUP
-#include "pci_regs.h" // PCI_BASE_ADDRESS_4
-#include "usb.h" // struct usb_s
-#include "biosvar.h" // GET_LOWFLAT
 #include "malloc.h" // free
+#include "output.h" // dprintf
+#include "pci.h" // pci_bdf_to_bus
+#include "pci_regs.h" // PCI_BASE_ADDRESS_4
 #include "string.h" // memset
+#include "usb.h" // struct usb_s
+#include "usb-uhci.h" // USBLEGSUP
+#include "util.h" // msleep
 
 struct usb_uhci_s {
     struct usb_s usb;
diff --git a/src/hw/usb.c b/src/hw/usb.c
index 5216cce..59d2a93 100644
--- a/src/hw/usb.c
+++ b/src/hw/usb.c
@@ -4,22 +4,23 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "pci.h" // foreachpci
+#include "biosvar.h" // GET_GLOBAL
 #include "config.h" // CONFIG_*
-#include "pci_regs.h" // PCI_CLASS_REVISION
+#include "malloc.h" // free
+#include "output.h" // dprintf
+#include "pci.h" // foreachpci
 #include "pci_ids.h" // PCI_CLASS_SERIAL_USB_UHCI
-#include "usb-uhci.h" // uhci_setup
-#include "usb-ohci.h" // ohci_setup
+#include "pci_regs.h" // PCI_CLASS_REVISION
+#include "string.h" // memset
+#include "usb.h" // struct usb_s
 #include "usb-ehci.h" // ehci_setup
 #include "usb-hid.h" // usb_keyboard_setup
 #include "usb-hub.h" // usb_hub_setup
 #include "usb-msc.h" // usb_msc_setup
+#include "usb-ohci.h" // ohci_setup
 #include "usb-uas.h" // usb_uas_setup
-#include "usb.h" // struct usb_s
-#include "biosvar.h" // GET_GLOBAL
-#include "malloc.h" // free
-#include "string.h" // memset
+#include "usb-uhci.h" // uhci_setup
+#include "util.h" // msleep
 #include "x86.h" // __fls
 
 
diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c
index 6b628f3..07f6e57 100644
--- a/src/hw/virtio-blk.c
+++ b/src/hw/virtio-blk.c
@@ -7,19 +7,20 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "pci.h" // foreachpci
-#include "config.h" // CONFIG_*
 #include "biosvar.h" // GET_GLOBAL
+#include "boot.h" // boot_add_hd
+#include "config.h" // CONFIG_*
+#include "disk.h"
+#include "malloc.h" // free
+#include "output.h" // dprintf
+#include "pci.h" // foreachpci
 #include "pci_ids.h" // PCI_DEVICE_ID_VIRTIO_BLK
 #include "pci_regs.h" // PCI_VENDOR_ID
-#include "boot.h" // boot_add_hd
+#include "string.h" // memset
+#include "util.h" // usleep
 #include "virtio-pci.h"
 #include "virtio-ring.h"
 #include "virtio-blk.h"
-#include "disk.h"
-#include "malloc.h" // free
-#include "string.h" // memset
 
 struct virtiodrive_s {
     struct drive_s drive;
diff --git a/src/hw/virtio-pci.c b/src/hw/virtio-pci.c
index 07177ac..a382504 100644
--- a/src/hw/virtio-pci.c
+++ b/src/hw/virtio-pci.c
@@ -15,14 +15,14 @@
  * See the COPYING file in the top-level directory.
  */
 
-#include "virtio-ring.h"
-#include "virtio-pci.h"
 #include "config.h" // CONFIG_DEBUG_LEVEL
-#include "util.h" // dprintf
 #include "malloc.h" // free
+#include "output.h" // dprintf
 #include "pci.h" // pci_config_readl
 #include "pci_regs.h" // PCI_BASE_ADDRESS_0
 #include "string.h" // memset
+#include "virtio-pci.h"
+#include "virtio-ring.h"
 
 int vp_find_vq(unsigned int ioaddr, int queue_index,
                struct vring_virtqueue **p_vq)
diff --git a/src/hw/virtio-ring.c b/src/hw/virtio-ring.c
index bddb090..97e0b34 100644
--- a/src/hw/virtio-ring.c
+++ b/src/hw/virtio-ring.c
@@ -16,10 +16,10 @@
  *
  */
 
+#include "biosvar.h" // GET_GLOBAL
+#include "output.h" // panic
 #include "virtio-ring.h"
 #include "virtio-pci.h"
-#include "biosvar.h" // GET_GLOBAL
-#include "util.h" // dprintf
 
 #define BUG() do {                                                      \
             panic("BUG: failure at %d/%s()!\n", __LINE__, __func__);    \
diff --git a/src/hw/virtio-scsi.c b/src/hw/virtio-scsi.c
index 8c9c670..1c3500c 100644
--- a/src/hw/virtio-scsi.c
+++ b/src/hw/virtio-scsi.c
@@ -7,20 +7,21 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "pci.h" // foreachpci
-#include "config.h" // CONFIG_*
 #include "biosvar.h" // GET_GLOBAL
+#include "blockcmd.h" // scsi_drive_setup
+#include "boot.h" // bootprio_find_scsi_device
+#include "config.h" // CONFIG_*
+#include "disk.h"
+#include "malloc.h" // free
+#include "output.h" // dprintf
+#include "pci.h" // foreachpci
 #include "pci_ids.h" // PCI_DEVICE_ID_VIRTIO_BLK
 #include "pci_regs.h" // PCI_VENDOR_ID
-#include "boot.h" // bootprio_find_scsi_device
-#include "blockcmd.h" // scsi_drive_setup
+#include "string.h" // memset
+#include "util.h" // usleep
 #include "virtio-pci.h"
 #include "virtio-ring.h"
 #include "virtio-scsi.h"
-#include "disk.h"
-#include "malloc.h" // free
-#include "string.h" // memset
 
 struct virtio_lun_s {
     struct drive_s drive;
diff --git a/src/kbd.c b/src/kbd.c
index 4302a05..33a95a3 100644
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -6,13 +6,14 @@
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "biosvar.h" // GET_BDA
-#include "util.h" // debug_enter
-#include "config.h" // CONFIG_*
 #include "bregs.h" // struct bregs
+#include "config.h" // CONFIG_*
 #include "hw/ps2port.h" // ps2_kbd_command
 #include "hw/usb-hid.h" // usb_kbd_command
+#include "output.h" // debug_enter
 #include "stacks.h" // stack_hop
 #include "string.h" // memset
+#include "util.h" // kbd_init
 
 // Bit definitions for BDA kbd_flag[012]
 #define KF0_RSHIFT       (1<<0)
diff --git a/src/malloc.c b/src/malloc.c
index f4783af..65a0bb1 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -4,13 +4,13 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "config.h" // BUILD_BIOS_ADDR
-#include "memmap.h" // struct e820entry
 #include "biosvar.h" // GET_BDA
-#include "optionroms.h" // OPTION_ROM_ALIGN
+#include "config.h" // BUILD_BIOS_ADDR
 #include "list.h" // hlist_node
 #include "malloc.h" // _malloc
+#include "memmap.h" // struct e820entry
+#include "optionroms.h" // OPTION_ROM_ALIGN
+#include "output.h" // dprintf
 #include "stacks.h" // wait_preempt
 #include "string.h" // memset
 
diff --git a/src/memmap.c b/src/memmap.c
index ab1bcad..e03f8d0 100644
--- a/src/memmap.c
+++ b/src/memmap.c
@@ -4,9 +4,9 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "memmap.h" // struct e820entry
 #include "config.h" // BUILD_MAX_E820
-#include "util.h" // dprintf.h
+#include "memmap.h" // struct e820entry
+#include "output.h" // dprintf
 #include "string.h" // memmove
 
 
diff --git a/src/misc.c b/src/misc.c
index 642bbb1..43dd16f 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -5,10 +5,10 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "bregs.h" // struct bregs
 #include "biosvar.h" // GET_BDA
-#include "util.h" // debug_enter
+#include "bregs.h" // struct bregs
 #include "hw/pic.h" // enable_hwirq
+#include "output.h" // debug_enter
 #include "stacks.h" // call16_int
 #include "string.h" // memset
 
diff --git a/src/mouse.c b/src/mouse.c
index 8e8374c..92ae921 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -6,11 +6,12 @@
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "biosvar.h" // GET_EBDA
-#include "util.h" // dprintf
 #include "bregs.h" // struct bregs
 #include "hw/ps2port.h" // ps2_mouse_command
 #include "hw/usb-hid.h" // usb_mouse_command
+#include "output.h" // dprintf
 #include "stacks.h" // stack_hop
+#include "util.h" // mouse_init
 
 void
 mouse_init(void)
diff --git a/src/optionroms.c b/src/optionroms.c
index 560df81..b38e44e 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -5,19 +5,20 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
+#include "boot.h" // IPL
 #include "bregs.h" // struct bregs
-#include "farptr.h" // FLATPTR_TO_SEG
 #include "config.h" // CONFIG_*
-#include "util.h" // dprintf
+#include "farptr.h" // FLATPTR_TO_SEG
 #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 "hw/pci_regs.h" // PCI_ROM_ADDRESS
 #include "malloc.h" // rom_confirm
 #include "optionroms.h" // struct rom_header
+#include "output.h" // dprintf
 #include "romfile.h" // romfile_loadint
 #include "stacks.h" // farcall16big
 #include "string.h" // memset
+#include "util.h" // get_pnp_offset
 
 
 /****************************************************************
diff --git a/src/output.c b/src/output.c
index e69a09a..c38c70c 100644
--- a/src/output.c
+++ b/src/output.c
@@ -7,14 +7,15 @@
 #include <stdarg.h> // va_list
 
 #include "farptr.h" // GET_VAR
-#include "util.h" // printf
 #include "bregs.h" // struct bregs
 #include "config.h" // CONFIG_*
 #include "biosvar.h" // GET_GLOBAL
 #include "fw/paravirt.h" // PlatformRunningOn
 #include "malloc.h" // malloc_tmp
+#include "output.h" // dprintf
 #include "stacks.h" // call16_int
 #include "string.h" // memset
+#include "util.h" // ScreenAndDebug
 
 struct putcinfo {
     void (*func)(struct putcinfo *info, char c);
diff --git a/src/output.h b/src/output.h
new file mode 100644
index 0000000..bdfdd63
--- /dev/null
+++ b/src/output.h
@@ -0,0 +1,68 @@
+#ifndef __OUTPUT_H
+#define __OUTPUT_H
+
+#include "types.h" // u32
+
+// output.c
+extern u16 DebugOutputPort;
+void debug_serial_preinit(void);
+void panic(const char *fmt, ...)
+    __attribute__ ((format (printf, 1, 2))) __noreturn;
+void printf(const char *fmt, ...)
+    __attribute__ ((format (printf, 1, 2)));
+int snprintf(char *str, size_t size, const char *fmt, ...)
+    __attribute__ ((format (printf, 3, 4)));
+char * znprintf(size_t size, const char *fmt, ...)
+    __attribute__ ((format (printf, 2, 3)));
+void __dprintf(const char *fmt, ...)
+    __attribute__ ((format (printf, 1, 2)));
+struct bregs;
+void __debug_enter(struct bregs *regs, const char *fname);
+void __debug_isr(const char *fname);
+void __debug_stub(struct bregs *regs, int lineno, const char *fname);
+void __warn_invalid(struct bregs *regs, int lineno, const char *fname);
+void __warn_unimplemented(struct bregs *regs, int lineno, const char *fname);
+void __warn_internalerror(int lineno, const char *fname);
+void __warn_noalloc(int lineno, const char *fname);
+void __warn_timeout(int lineno, const char *fname);
+void __set_invalid(struct bregs *regs, int lineno, const char *fname);
+void __set_unimplemented(struct bregs *regs, int lineno, const char *fname);
+void __set_code_invalid(struct bregs *regs, u32 linecode, const char *fname);
+void __set_code_unimplemented(struct bregs *regs, u32 linecode
+                              , const char *fname);
+void hexdump(const void *d, int len);
+
+#define dprintf(lvl, fmt, args...) do {                         \
+        if (CONFIG_DEBUG_LEVEL && (lvl) <= CONFIG_DEBUG_LEVEL)  \
+            __dprintf((fmt) , ##args );                         \
+    } while (0)
+#define debug_enter(regs, lvl) do {                     \
+        if ((lvl) && (lvl) <= CONFIG_DEBUG_LEVEL)       \
+            __debug_enter((regs), __func__);            \
+    } while (0)
+#define debug_isr(lvl) do {                             \
+        if ((lvl) && (lvl) <= CONFIG_DEBUG_LEVEL)       \
+            __debug_isr(__func__);                      \
+    } while (0)
+#define debug_stub(regs)                        \
+    __debug_stub((regs), __LINE__, __func__)
+#define warn_invalid(regs)                      \
+    __warn_invalid((regs), __LINE__, __func__)
+#define warn_unimplemented(regs)                        \
+    __warn_unimplemented((regs), __LINE__, __func__)
+#define warn_internalerror()                    \
+    __warn_internalerror(__LINE__, __func__)
+#define warn_noalloc()                          \
+    __warn_noalloc(__LINE__, __func__)
+#define warn_timeout()                          \
+    __warn_timeout(__LINE__, __func__)
+#define set_invalid(regs)                       \
+    __set_invalid((regs), __LINE__, __func__)
+#define set_code_invalid(regs, code)                                    \
+    __set_code_invalid((regs), (code) | (__LINE__ << 8), __func__)
+#define set_unimplemented(regs)                         \
+    __set_unimplemented((regs), __LINE__, __func__)
+#define set_code_unimplemented(regs, code)                              \
+    __set_code_unimplemented((regs), (code) | (__LINE__ << 8), __func__)
+
+#endif // output.h
diff --git a/src/pcibios.c b/src/pcibios.c
index 5b242c9..8e7e1f9 100644
--- a/src/pcibios.c
+++ b/src/pcibios.c
@@ -5,13 +5,13 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "types.h" // u32
-#include "util.h" // handle_1ab1
-#include "hw/pci.h" // pci_config_readl
-#include "bregs.h" // struct bregs
 #include "biosvar.h" // GET_GLOBAL
+#include "bregs.h" // struct bregs
+#include "hw/pci.h" // pci_config_readl
 #include "hw/pci_regs.h" // PCI_VENDOR_ID
+#include "output.h" // dprintf
 #include "string.h" // checksum
+#include "util.h" // handle_1ab1
 
 // romlayout.S
 extern void entry_bios32(void);
diff --git a/src/pmm.c b/src/pmm.c
index f6319a4..e87cfd1 100644
--- a/src/pmm.c
+++ b/src/pmm.c
@@ -8,8 +8,9 @@
 #include "config.h" // CONFIG_*
 #include "farptr.h" // struct segoff_s
 #include "malloc.h" // _malloc
+#include "output.h" // dprintf
 #include "string.h" // checksum
-#include "util.h" // dprintf
+#include "util.h" // pmm_init
 #include "x86.h" // __ffs
 
 struct pmmheader {
diff --git a/src/pnpbios.c b/src/pnpbios.c
index e67425f..87eea9f 100644
--- a/src/pnpbios.c
+++ b/src/pnpbios.c
@@ -4,10 +4,11 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
 #include "config.h" // BUILD_BIOS_ADDR
 #include "farptr.h" // SET_FARVAR
+#include "output.h" // dprintf
 #include "string.h" // checksum
+#include "util.h" // pnp_init
 
 struct pnpheader {
     u32 signature;
diff --git a/src/post.c b/src/post.c
index 701134f..e84dcae 100644
--- a/src/post.c
+++ b/src/post.c
@@ -5,29 +5,30 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "config.h" // CONFIG_*
-#include "hw/cmos.h" // CMOS_*
-#include "util.h" // dprintf
 #include "biosvar.h" // struct bios_data_area_s
-#include "disk.h" // floppy_setup
-#include "hw/ata.h" // ata_setup
-#include "hw/ahci.h" // ahci_setup
-#include "memmap.h" // add_e820
-#include "hw/pic.h" // pic_setup
-#include "bregs.h" // struct bregs
 #include "boot.h" // boot_init
-#include "hw/usb.h" // usb_setup
+#include "bregs.h" // struct bregs
+#include "config.h" // CONFIG_*
+#include "disk.h" // floppy_setup
 #include "fw/paravirt.h" // qemu_cfg_preinit
 #include "fw/xen.h" // xen_preinit
+#include "hw/ahci.h" // ahci_setup
+#include "hw/ata.h" // ata_setup
+#include "hw/cmos.h" // CMOS_*
+#include "hw/esp-scsi.h" // esp_scsi_setup
+#include "hw/lsi-scsi.h" // lsi_scsi_setup
+#include "hw/megasas.h" // megasas_setup
+#include "hw/pic.h" // pic_setup
 #include "hw/ps2port.h" // ps2port_setup
+#include "hw/usb.h" // usb_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 "malloc.h" // malloc_init
+#include "memmap.h" // add_e820
+#include "output.h" // dprintf
 #include "post.h" // interface_init
 #include "string.h" // memset
+#include "util.h" // kbd_init
 
 
 /****************************************************************
diff --git a/src/resume.c b/src/resume.c
index 892c76c..31643a7 100644
--- a/src/resume.c
+++ b/src/resume.c
@@ -4,17 +4,18 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // dprintf
-#include "ioport.h" // outb
-#include "hw/pic.h" // pic_eoi2
 #include "biosvar.h" // struct bios_data_area_s
 #include "bregs.h" // struct bregs
 #include "fw/acpi.h" // find_resume_vector
-#include "hw/ps2port.h" // i8042_reboot
-#include "hw/pci.h" // pci_reboot
 #include "hw/cmos.h" // inb_cmos
+#include "hw/pci.h" // pci_reboot
+#include "hw/pic.h" // pic_eoi2
+#include "hw/ps2port.h" // i8042_reboot
+#include "ioport.h" // outb
+#include "output.h" // dprintf
 #include "stacks.h" // farcall16big
 #include "string.h" // memset
+#include "util.h" // dma_setup
 
 // Indicator if POST phase has been run.
 int HaveRunPost VARFSEG;
diff --git a/src/romfile.c b/src/romfile.c
index 835ca99..33b6223 100644
--- a/src/romfile.c
+++ b/src/romfile.c
@@ -5,8 +5,8 @@
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "config.h" // CONFIG_*
-#include "util.h" // dprintf
 #include "malloc.h" // free
+#include "output.h" // dprintf
 #include "romfile.h" // struct romfile_s
 #include "string.h" // memcmp
 
diff --git a/src/serial.c b/src/serial.c
index 8fd3067..02f30d6 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -6,9 +6,10 @@
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "biosvar.h" // SET_BDA
-#include "util.h" // debug_enter
 #include "bregs.h" // struct bregs
+#include "output.h" // debug_enter
 #include "stacks.h" // yield
+#include "util.h" // serial_setup
 
 
 /****************************************************************
diff --git a/src/stacks.c b/src/stacks.c
index 19cd869..cc597c6 100644
--- a/src/stacks.c
+++ b/src/stacks.c
@@ -5,11 +5,12 @@
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "biosvar.h" // GET_GLOBAL
-#include "util.h" // dprintf
 #include "bregs.h" // CR0_PE
 #include "list.h" // hlist_node
 #include "malloc.h" // free
+#include "output.h" // dprintf
 #include "stacks.h" // struct mutex_s
+#include "util.h" // useRTC
 
 
 /****************************************************************
diff --git a/src/system.c b/src/system.c
index bd53f7d..4669e62 100644
--- a/src/system.c
+++ b/src/system.c
@@ -5,14 +5,15 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // debug_enter
 #include "biosvar.h" // BIOS_CONFIG_TABLE
-#include "ioport.h" // inb
-#include "memmap.h" // E820_RAM
-#include "hw/pic.h" // pic_reset
 #include "bregs.h" // struct bregs
+#include "hw/pic.h" // pic_reset
+#include "ioport.h" // inb
 #include "malloc.h" // LegacyRamSize
+#include "memmap.h" // E820_RAM
+#include "output.h" // debug_enter
 #include "string.h" // memcpy_far
+#include "util.h" // handle_1553
 
 // Use PS2 System Control port A to set A20 enable
 static inline u8
diff --git a/src/util.h b/src/util.h
index dffc444..2712f46 100644
--- a/src/util.h
+++ b/src/util.h
@@ -4,70 +4,9 @@
 
 #include "types.h" // u32
 
-// output.c
-extern u16 DebugOutputPort;
-void debug_serial_preinit(void);
-void panic(const char *fmt, ...)
-    __attribute__ ((format (printf, 1, 2))) __noreturn;
-void printf(const char *fmt, ...)
-    __attribute__ ((format (printf, 1, 2)));
-int snprintf(char *str, size_t size, const char *fmt, ...)
-    __attribute__ ((format (printf, 3, 4)));
-char * znprintf(size_t size, const char *fmt, ...)
-    __attribute__ ((format (printf, 2, 3)));
-void __dprintf(const char *fmt, ...)
-    __attribute__ ((format (printf, 1, 2)));
-struct bregs;
-void __debug_enter(struct bregs *regs, const char *fname);
-void __debug_isr(const char *fname);
-void __debug_stub(struct bregs *regs, int lineno, const char *fname);
-void __warn_invalid(struct bregs *regs, int lineno, const char *fname);
-void __warn_unimplemented(struct bregs *regs, int lineno, const char *fname);
-void __warn_internalerror(int lineno, const char *fname);
-void __warn_noalloc(int lineno, const char *fname);
-void __warn_timeout(int lineno, const char *fname);
-void __set_invalid(struct bregs *regs, int lineno, const char *fname);
-void __set_unimplemented(struct bregs *regs, int lineno, const char *fname);
-void __set_code_invalid(struct bregs *regs, u32 linecode, const char *fname);
-void __set_code_unimplemented(struct bregs *regs, u32 linecode
-                              , const char *fname);
-void hexdump(const void *d, int len);
-
-#define dprintf(lvl, fmt, args...) do {                         \
-        if (CONFIG_DEBUG_LEVEL && (lvl) <= CONFIG_DEBUG_LEVEL)  \
-            __dprintf((fmt) , ##args );                         \
-    } while (0)
-#define debug_enter(regs, lvl) do {                     \
-        if ((lvl) && (lvl) <= CONFIG_DEBUG_LEVEL)       \
-            __debug_enter((regs), __func__);            \
-    } while (0)
-#define debug_isr(lvl) do {                             \
-        if ((lvl) && (lvl) <= CONFIG_DEBUG_LEVEL)       \
-            __debug_isr(__func__);                      \
-    } while (0)
-#define debug_stub(regs)                        \
-    __debug_stub((regs), __LINE__, __func__)
-#define warn_invalid(regs)                      \
-    __warn_invalid((regs), __LINE__, __func__)
-#define warn_unimplemented(regs)                        \
-    __warn_unimplemented((regs), __LINE__, __func__)
-#define warn_internalerror()                    \
-    __warn_internalerror(__LINE__, __func__)
-#define warn_noalloc()                          \
-    __warn_noalloc(__LINE__, __func__)
-#define warn_timeout()                          \
-    __warn_timeout(__LINE__, __func__)
-#define set_invalid(regs)                       \
-    __set_invalid((regs), __LINE__, __func__)
-#define set_code_invalid(regs, code)                                    \
-    __set_code_invalid((regs), (code) | (__LINE__ << 8), __func__)
-#define set_unimplemented(regs)                         \
-    __set_unimplemented((regs), __LINE__, __func__)
-#define set_code_unimplemented(regs, code)                              \
-    __set_code_unimplemented((regs), (code) | (__LINE__ << 8), __func__)
-
 // kbd.c
 void kbd_init(void);
+struct bregs;
 void handle_15c2(struct bregs *regs);
 void process_key(u8 key);
 
diff --git a/src/vgahooks.c b/src/vgahooks.c
index 9917014..dc3085e 100644
--- a/src/vgahooks.c
+++ b/src/vgahooks.c
@@ -4,14 +4,15 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "bregs.h" // set_code_invalid
 #include "biosvar.h" // GET_GLOBAL
+#include "bregs.h" // set_code_invalid
+#include "config.h" // CONFIG_*
 #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_*
+#include "hw/pci_regs.h" // PCI_VENDOR_ID
+#include "output.h" // dprintf
 #include "string.h" // strcmp
+#include "util.h" // handle_155f
 
 #define VH_VIA 1
 #define VH_INTEL 2
diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c
index 7ea49ff..e038c61 100644
--- a/vgasrc/bochsvga.c
+++ b/vgasrc/bochsvga.c
@@ -6,15 +6,15 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "vgabios.h" // struct vbe_modeinfo
-#include "vbe.h" // VBE_CAPABILITY_8BIT_DAC
+#include "biosvar.h" // GET_GLOBAL
 #include "bochsvga.h" // bochsvga_set_mode
-#include "util.h" // dprintf
 #include "config.h" // CONFIG_*
-#include "biosvar.h" // GET_GLOBAL
-#include "stdvga.h" // VGAREG_SEQU_ADDRESS
 #include "hw/pci.h" // pci_config_readl
 #include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0
+#include "output.h" // dprintf
+#include "stdvga.h" // VGAREG_SEQU_ADDRESS
+#include "vbe.h" // VBE_CAPABILITY_8BIT_DAC
+#include "vgabios.h" // struct vbe_modeinfo
 
 
 /****************************************************************
diff --git a/vgasrc/clext.c b/vgasrc/clext.c
index 6fc6337..93085cf 100644
--- a/vgasrc/clext.c
+++ b/vgasrc/clext.c
@@ -5,15 +5,15 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "clext.h" // clext_setup
-#include "vgabios.h" // VBE_VENDOR_STRING
 #include "biosvar.h" // GET_GLOBAL
-#include "util.h" // dprintf
 #include "bregs.h" // struct bregs
-#include "stdvga.h" // VGAREG_SEQU_ADDRESS
+#include "clext.h" // clext_setup
 #include "hw/pci.h" // pci_config_readl
 #include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0
+#include "output.h" // dprintf
+#include "stdvga.h" // VGAREG_SEQU_ADDRESS
 #include "string.h" // memset16_far
+#include "vgabios.h" // VBE_VENDOR_STRING
 
 
 /****************************************************************
diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c
index 4a63068..f8f61c3 100644
--- a/vgasrc/geodevga.c
+++ b/vgasrc/geodevga.c
@@ -6,14 +6,14 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "geodevga.h" // geodevga_setup
-#include "farptr.h" // SET_FARVAR
 #include "biosvar.h" // GET_BDA
-#include "vgabios.h" // VGAREG_*
-#include "util.h" // dprintf
-#include "stdvga.h" // stdvga_crtc_write
+#include "farptr.h" // SET_FARVAR
+#include "geodevga.h" // geodevga_setup
 #include "hw/pci.h" // pci_config_readl
 #include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0
+#include "output.h" // dprintf
+#include "stdvga.h" // stdvga_crtc_write
+#include "vgabios.h" // VGAREG_*
 
 
 /****************************************************************
diff --git a/vgasrc/stdvgamodes.c b/vgasrc/stdvgamodes.c
index f22f82c..dda35db 100644
--- a/vgasrc/stdvgamodes.c
+++ b/vgasrc/stdvgamodes.c
@@ -5,11 +5,11 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "vgabios.h" // struct VideoParamTableEntry_s
 #include "biosvar.h" // GET_GLOBAL
-#include "util.h" // warn_internalerror
+#include "output.h" // warn_internalerror
 #include "stdvga.h" // stdvga_find_mode
 #include "string.h" // memcpy_far
+#include "vgabios.h" // struct VideoParamTableEntry_s
 
 
 /****************************************************************
diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c
index 8595e69..9026b77 100644
--- a/vgasrc/vbe.c
+++ b/vgasrc/vbe.c
@@ -6,14 +6,14 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "vgabios.h" // handle_104f
-#include "config.h" // CONFIG_*
+#include "biosvar.h" // GET_GLOBAL
 #include "bregs.h" // struct bregs
+#include "config.h" // CONFIG_*
+#include "output.h" // dprintf
+#include "string.h" // memset_far
 #include "vbe.h" // struct vbe_info
-#include "util.h" // dprintf
-#include "biosvar.h" // GET_GLOBAL
+#include "vgabios.h" // handle_104f
 #include "vgahw.h" // vgahw_set_mode
-#include "string.h" // memset_far
 
 u32 VBE_total_memory VAR16 = 256 * 1024;
 u32 VBE_capabilities VAR16;
diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c
index 12cd782..5206da9 100644
--- a/vgasrc/vgabios.c
+++ b/vgasrc/vgabios.c
@@ -5,19 +5,20 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "bregs.h" // struct bregs
 #include "biosvar.h" // GET_BDA
-#include "util.h" // dprintf
-#include "vgabios.h" // calc_page_size
-#include "optionroms.h" // struct pci_data
-#include "config.h" // CONFIG_*
-#include "stdvga.h" // stdvga_set_cursor_shape
+#include "bregs.h" // struct bregs
 #include "clext.h" // clext_1012
-#include "vgahw.h" // vgahw_set_mode
-#include "vbe.h" // VBE_RETURN_STATUS_FAILED
+#include "config.h" // CONFIG_*
 #include "hw/pci.h" // pci_config_readw
 #include "hw/pci_regs.h" // PCI_VENDOR_ID
+#include "optionroms.h" // struct pci_data
+#include "output.h" // dprintf
+#include "stdvga.h" // stdvga_set_cursor_shape
 #include "string.h" // memset_far
+#include "util.h" // VERSION
+#include "vbe.h" // VBE_RETURN_STATUS_FAILED
+#include "vgabios.h" // calc_page_size
+#include "vgahw.h" // vgahw_set_mode
 
 // Standard Video Save Pointer Table
 struct VideoSavePointer_s {
diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c
index 1fa11b5..815d54b 100644
--- a/vgasrc/vgafb.c
+++ b/vgasrc/vgafb.c
@@ -5,12 +5,12 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "vgabios.h" // vgafb_scroll
 #include "biosvar.h" // GET_BDA
-#include "util.h" // dprintf
 #include "byteorder.h" // cpu_to_be16
+#include "output.h" // dprintf
 #include "stdvga.h" // stdvga_planar4_plane
 #include "string.h" // memset_far
+#include "vgabios.h" // vgafb_scroll
 
 
 /****************************************************************
-- 
1.8.3.1




More information about the SeaBIOS mailing list