Normalize POST initialization function name suffixes.

The POST phase has to invoke many initialization functions, and these
functions can have complex inter-dependencies.  Try to categorize the
functions into 4 classes:

preinit - functions called very early in POST where function ordering
    is very important and the code has limited access to other
    interfaces.

init - functions that initialize internal interfaces and standard
    external interfaces.  This code is generally not dependent on
    particular hardware and typically does not communicate directly
    with any hardware devices.

setup - functions which access hardware or are dependent on particular
    hardware or platform devices.

prepboot - functions that finalize internal interfaces and that
    prepare for the boot phase.

This patch attempts to normalize the suffixes - functions that used
_init(), _setup(), _finalize(), or similar that did not follow the
above pattern were renamed.  Other than function name changes, there
should be no code impact to this patch.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
diff --git a/src/acpi.c b/src/acpi.c
index 6267d7b..03cda34 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -236,7 +236,7 @@
 
 #define PIIX4_PM_INTRRUPT       9       // irq 9
 
-static void piix4_fadt_init(struct pci_device *pci, void *arg)
+static void piix4_fadt_setup(struct pci_device *pci, void *arg)
 {
     struct fadt_descriptor_rev1 *fadt = arg;
 
@@ -262,7 +262,7 @@
 }
 
 /* PCI_VENDOR_ID_INTEL && PCI_DEVICE_ID_INTEL_ICH9_LPC */
-void ich9_lpc_fadt_init(struct pci_device *dev, void *arg)
+void ich9_lpc_fadt_setup(struct pci_device *dev, void *arg)
 {
     struct fadt_descriptor_rev1 *fadt = arg;
 
@@ -290,9 +290,9 @@
 static const struct pci_device_id fadt_init_tbl[] = {
     /* PIIX4 Power Management device (for ACPI) */
     PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3,
-               piix4_fadt_init),
+               piix4_fadt_setup),
     PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_LPC,
-               ich9_lpc_fadt_init),
+               ich9_lpc_fadt_setup),
     PCI_DEVICE_END
 };
 
@@ -325,7 +325,7 @@
     /* FADT */
     memset(fadt, 0, sizeof(*fadt));
     fadt->firmware_ctrl = cpu_to_le32((u32)facs);
-    fadt->dsdt = 0;  /* dsdt will be filled later in acpi_bios_init()
+    fadt->dsdt = 0;  /* dsdt will be filled later in acpi_setup()
                         by fill_dsdt() */
     pci_init_device(fadt_init_tbl, pci, fadt);
 
@@ -796,7 +796,7 @@
 
 #define MAX_ACPI_TABLES 20
 void
-acpi_bios_init(void)
+acpi_setup(void)
 {
     if (! CONFIG_ACPI)
         return;
diff --git a/src/acpi.h b/src/acpi.h
index 715d19d..8bbf25c 100644
--- a/src/acpi.h
+++ b/src/acpi.h
@@ -3,7 +3,7 @@
 
 #include "types.h" // u32
 
-void acpi_bios_init(void);
+void acpi_setup(void);
 u32 find_resume_vector(void);
 
 #define RSDP_SIGNATURE 0x2052545020445352LL // "RSD PTR "
diff --git a/src/ahci.c b/src/ahci.c
index 4a8eafb..879a991 100644
--- a/src/ahci.c
+++ b/src/ahci.c
@@ -422,7 +422,7 @@
 #define MAXMODEL 40
 
 /* See ahci spec chapter 10.1 "Software Initialization of HBA" */
-static int ahci_port_init(struct ahci_port_s *port)
+static int ahci_port_setup(struct ahci_port_s *port)
 {
     struct ahci_ctrl_s *ctrl = port->ctrl;
     u32 pnr = port->pnr;
@@ -549,7 +549,7 @@
 
     dprintf(2, "AHCI/%d: probing\n", port->pnr);
     ahci_port_reset(port->ctrl, port->pnr);
-    rc = ahci_port_init(port);
+    rc = ahci_port_setup(port);
     if (rc < 0)
         ahci_port_release(port);
     else {
@@ -567,7 +567,7 @@
 
 // Initialize an ata controller and detect its drives.
 static void
-ahci_init_controller(struct pci_device *pci)
+ahci_controller_setup(struct pci_device *pci)
 {
     struct ahci_ctrl_s *ctrl = malloc_fseg(sizeof(*ctrl));
     struct ahci_port_s *port;
@@ -579,7 +579,7 @@
         return;
     }
 
-    if (bounce_buf_init() < 0) {
+    if (create_bounce_buf() < 0) {
         warn_noalloc();
         free(ctrl);
         return;
@@ -616,7 +616,7 @@
 
 // Locate and init ahci controllers.
 static void
-ahci_init(void)
+ahci_scan(void)
 {
     // Scan PCI bus for ATA adapters
     struct pci_device *pci;
@@ -625,7 +625,7 @@
             continue;
         if (pci->prog_if != 1 /* AHCI rev 1 */)
             continue;
-        ahci_init_controller(pci);
+        ahci_controller_setup(pci);
     }
 }
 
@@ -637,5 +637,5 @@
         return;
 
     dprintf(3, "init ahci\n");
-    ahci_init();
+    ahci_scan();
 }
diff --git a/src/ata.c b/src/ata.c
index f604b37..d1d8dff 100644
--- a/src/ata.c
+++ b/src/ata.c
@@ -1006,7 +1006,7 @@
 
 // Locate and init ata controllers.
 static void
-ata_init(void)
+ata_scan(void)
 {
     if (!CONFIG_COREBOOT && !PCIDevices) {
         // No PCI devices found - probably a QEMU "-M isapc" machine.
@@ -1035,7 +1035,7 @@
     dprintf(3, "init hard drives\n");
 
     SpinupEnd = calc_future_tsc(IDE_TIMEOUT);
-    ata_init();
+    ata_scan();
 
     SET_BDA(disk_control_byte, 0xc0);
 
diff --git a/src/block.c b/src/block.c
index cfe5c33..e5f3038 100644
--- a/src/block.c
+++ b/src/block.c
@@ -40,7 +40,7 @@
     return -1;
 }
 
-int bounce_buf_init(void)
+int create_bounce_buf(void)
 {
     if (bounce_buf_fl)
         return 0;
diff --git a/src/blockcmd.c b/src/blockcmd.c
index 81b191b..e033ba7 100644
--- a/src/blockcmd.c
+++ b/src/blockcmd.c
@@ -101,7 +101,7 @@
 
 // Validate drive, find block size / sector count, and register drive.
 int
-scsi_init_drive(struct drive_s *drive, const char *s, int prio)
+scsi_drive_setup(struct drive_s *drive, const char *s, int prio)
 {
     struct disk_op_s dop;
     memset(&dop, 0, sizeof(dop));
diff --git a/src/blockcmd.h b/src/blockcmd.h
index b45bbb7..8bacfcf 100644
--- a/src/blockcmd.h
+++ b/src/blockcmd.h
@@ -113,6 +113,6 @@
 
 int scsi_is_ready(struct disk_op_s *op);
 struct drive_s;
-int scsi_init_drive(struct drive_s *drive, const char *s, int prio);
+int scsi_drive_setup(struct drive_s *drive, const char *s, int prio);
 
 #endif // blockcmd.h
diff --git a/src/boot.c b/src/boot.c
index 56843e3..2cb3b86 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -238,7 +238,7 @@
 static int DefaultBEVPrio    = 104;
 
 void
-boot_setup(void)
+boot_init(void)
 {
     if (! CONFIG_BOOT)
         return;
@@ -476,7 +476,7 @@
 
 // Prepare for boot - show menu and run bcvs.
 void
-boot_prep(void)
+boot_prepboot(void)
 {
     if (! CONFIG_BOOT) {
         wait_threads();
@@ -695,7 +695,7 @@
 void VISIBLE32FLAT
 handle_18(void)
 {
-    debug_serial_setup();
+    debug_serial_preinit();
     debug_enter(NULL, DEBUG_HDL_18);
     int seq = BootSequence + 1;
     BootSequence = seq;
@@ -706,7 +706,7 @@
 void VISIBLE32FLAT
 handle_19(void)
 {
-    debug_serial_setup();
+    debug_serial_preinit();
     debug_enter(NULL, DEBUG_HDL_19);
     BootSequence = 0;
     do_boot(0);
diff --git a/src/boot.h b/src/boot.h
index afe9f2e..4a93d0f 100644
--- a/src/boot.h
+++ b/src/boot.h
@@ -3,7 +3,7 @@
 #define __BOOT_H
 
 // boot.c
-void boot_setup(void);
+void boot_init(void);
 void boot_add_bev(u16 seg, u16 bev, u16 desc, int prio);
 void boot_add_bcv(u16 seg, u16 ip, u16 desc, int prio);
 struct drive_s;
@@ -11,7 +11,7 @@
 void boot_add_hd(struct drive_s *drive_g, const char *desc, int prio);
 void boot_add_cd(struct drive_s *drive_g, const char *desc, int prio);
 void boot_add_cbfs(void *data, const char *desc, int prio);
-void boot_prep(void);
+void boot_prepboot(void);
 struct pci_device;
 int bootprio_find_pci_device(struct pci_device *pci);
 int bootprio_find_scsi_device(struct pci_device *pci, int target, int lun);
diff --git a/src/cdrom.c b/src/cdrom.c
index 42d8e08..81b97f7 100644
--- a/src/cdrom.c
+++ b/src/cdrom.c
@@ -107,13 +107,13 @@
 }
 
 void
-cdemu_setup(void)
+cdrom_prepboot(void)
 {
     if (!CONFIG_CDROM_EMU)
         return;
     if (!CDCount)
         return;
-    if (bounce_buf_init() < 0)
+    if (create_bounce_buf() < 0)
         return;
 
     struct drive_s *drive_g = malloc_fseg(sizeof(*drive_g));
diff --git a/src/clock.c b/src/clock.c
index 71b913e..3edcaf5 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -133,7 +133,7 @@
 u32 pmtimer_wraps VARLOW;
 u32 pmtimer_last VARLOW;
 
-void pmtimer_init(u16 ioport, u32 khz)
+void pmtimer_setup(u16 ioport, u32 khz)
 {
     if (!CONFIG_PMTIMER)
         return;
@@ -266,7 +266,7 @@
 }
 
 static void
-init_rtc(void)
+rtc_setup(void)
 {
     outb_cmos(0x26, CMOS_STATUS_A);    // 32,768Khz src, 976.5625us updates
     u8 regB = inb_cmos(CMOS_STATUS_B);
@@ -288,7 +288,7 @@
     calibrate_tsc();
     pit_setup();
 
-    init_rtc();
+    rtc_setup();
     rtc_updating();
     u32 seconds = bcd2bin(inb_cmos(CMOS_RTC_SECONDS));
     u32 minutes = bcd2bin(inb_cmos(CMOS_RTC_MINUTES));
@@ -393,7 +393,7 @@
     // Bit4 in try#1 flipped in hardware (forced low) due to bit7=1
     // My assumption: RegB = ((RegB & 01100000b) | 00000010b)
     if (rtc_updating()) {
-        init_rtc();
+        rtc_setup();
         // fall through as if an update were not in progress
     }
     outb_cmos(regs->dh, CMOS_RTC_SECONDS);
@@ -447,7 +447,7 @@
     // Bit4 in try#1 flipped in hardware (forced low) due to bit7=1
     // My assumption: RegB = (RegB & 01111111b)
     if (rtc_updating()) {
-        init_rtc();
+        rtc_setup();
         set_invalid(regs);
         return;
     }
@@ -486,7 +486,7 @@
         return;
     }
     if (rtc_updating()) {
-        init_rtc();
+        rtc_setup();
         // fall through as if an update were not in progress
     }
     outb_cmos(regs->dh, CMOS_RTC_SECONDS_ALARM);
diff --git a/src/coreboot.c b/src/coreboot.c
index e4767f1..5d013cf 100644
--- a/src/coreboot.c
+++ b/src/coreboot.c
@@ -123,7 +123,7 @@
 
 // Populate max ram and e820 map info by scanning for a coreboot table.
 void
-coreboot_setup(void)
+coreboot_preinit(void)
 {
     dprintf(3, "Attempting to find coreboot table\n");
 
@@ -204,7 +204,7 @@
 }
 
 void
-coreboot_copy_biostable(void)
+coreboot_biostable_setup(void)
 {
     struct cb_memory *cbm = CBMemTable;
     if (! CONFIG_COREBOOT || !cbm)
@@ -324,7 +324,7 @@
 }
 
 void
-coreboot_cbfs_setup(void)
+coreboot_cbfs_init(void)
 {
     if (!CONFIG_COREBOOT || !CONFIG_COREBOOT_FLASH)
         return;
diff --git a/src/disk.h b/src/disk.h
index 21debec..8e49124 100644
--- a/src/disk.h
+++ b/src/disk.h
@@ -266,7 +266,7 @@
 void map_cd_drive(struct drive_s *drive_g);
 int process_op(struct disk_op_s *op);
 int send_disk_op(struct disk_op_s *op);
-int bounce_buf_init(void);
+int create_bounce_buf(void);
 
 // floppy.c
 extern struct floppy_ext_dbt_s diskette_param_table2;
@@ -281,7 +281,7 @@
 extern struct cdemu_s CDEmu;
 extern struct drive_s *cdemu_drive_gf;
 int process_cdemu_op(struct disk_op_s *op);
-void cdemu_setup(void);
+void cdrom_prepboot(void);
 void cdemu_134b(struct bregs *regs);
 int cdrom_boot(struct drive_s *drive_g);
 
diff --git a/src/esp-scsi.c b/src/esp-scsi.c
index c43e55b..4d1f7d2 100644
--- a/src/esp-scsi.c
+++ b/src/esp-scsi.c
@@ -17,7 +17,7 @@
 #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_init_drive
+#include "blockcmd.h" // scsi_drive_setup
 #include "disk.h"
 
 #define ESP_TCLO      0x00
@@ -174,7 +174,7 @@
                           pci_bdf_to_bus(pci->bdf), pci_bdf_to_dev(pci->bdf),
                           pci_bdf_to_fn(pci->bdf), target, lun);
     int prio = bootprio_find_scsi_device(pci, target, lun);
-    int ret = scsi_init_drive(&llun->drive, name, prio);
+    int ret = scsi_drive_setup(&llun->drive, name, prio);
     free(name);
     if (ret)
         goto fail;
diff --git a/src/kbd.c b/src/kbd.c
index e9ea594..05845e5 100644
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -35,7 +35,7 @@
 #define KF2_101KBD     (1<<4)
 
 void
-kbd_setup(void)
+kbd_init(void)
 {
     dprintf(3, "init keyboard\n");
     u16 x = offsetof(struct bios_data_area_s, kbd_buf);
diff --git a/src/lsi-scsi.c b/src/lsi-scsi.c
index f8d715b..76e9d1d 100644
--- a/src/lsi-scsi.c
+++ b/src/lsi-scsi.c
@@ -17,7 +17,7 @@
 #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_init_drive
+#include "blockcmd.h" // scsi_drive_setup
 #include "disk.h"
 
 #define LSI_REG_DSTAT     0x0c
@@ -152,7 +152,7 @@
                           pci_bdf_to_bus(pci->bdf), pci_bdf_to_dev(pci->bdf),
                           pci_bdf_to_fn(pci->bdf), target, lun);
     int prio = bootprio_find_scsi_device(pci, target, lun);
-    int ret = scsi_init_drive(&llun->drive, name, prio);
+    int ret = scsi_drive_setup(&llun->drive, name, prio);
     free(name);
     if (ret)
         goto fail;
diff --git a/src/megasas.c b/src/megasas.c
index 3ccdd0a..170700f 100644
--- a/src/megasas.c
+++ b/src/megasas.c
@@ -17,7 +17,7 @@
 #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_init_drive
+#include "blockcmd.h" // scsi_drive_setup
 #include "disk.h"
 
 #define MFI_DB 0x0 // Doorbell
@@ -223,7 +223,7 @@
                     pci_bdf_to_bus(pci->bdf), pci_bdf_to_dev(pci->bdf),
                     pci_bdf_to_fn(pci->bdf), target, lun);
     prio = bootprio_find_scsi_device(pci, target, lun);
-    ret = scsi_init_drive(&mlun->drive, name, prio);
+    ret = scsi_drive_setup(&mlun->drive, name, prio);
     free(name);
     if (ret) {
         free(mlun->frame);
diff --git a/src/memmap.c b/src/memmap.c
index 3783518..29ca644 100644
--- a/src/memmap.c
+++ b/src/memmap.c
@@ -133,7 +133,7 @@
 
 // Report on final memory locations.
 void
-memmap_finalize(void)
+memmap_prepboot(void)
 {
     dump_map();
 }
diff --git a/src/memmap.h b/src/memmap.h
index 01c7ddb..783a042 100644
--- a/src/memmap.h
+++ b/src/memmap.h
@@ -17,7 +17,7 @@
 };
 
 void add_e820(u64 start, u64 size, u32 type);
-void memmap_finalize(void);
+void memmap_prepboot(void);
 
 // A typical OS page size
 #define PAGE_SIZE 4096
diff --git a/src/misc.c b/src/misc.c
index 54d8aef..bcc450a 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -61,7 +61,7 @@
 }
 
 void
-mathcp_setup(void)
+mathcp_init(void)
 {
     dprintf(3, "math cp init\n");
     // 80x87 coprocessor installed
diff --git a/src/mouse.c b/src/mouse.c
index 7b28a63..5371cf6 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -12,7 +12,7 @@
 #include "usb-hid.h" // usb_mouse_command
 
 void
-mouse_setup(void)
+mouse_init(void)
 {
     if (! CONFIG_MOUSE)
         return;
diff --git a/src/mptable.c b/src/mptable.c
index 3aa3427..2d4e441 100644
--- a/src/mptable.c
+++ b/src/mptable.c
@@ -13,7 +13,7 @@
 #include "pci_regs.h"
 
 void
-mptable_init(void)
+mptable_setup(void)
 {
     if (! CONFIG_MPTABLE)
         return;
diff --git a/src/mptable.h b/src/mptable.h
index c4e3c51..6252854 100644
--- a/src/mptable.h
+++ b/src/mptable.h
@@ -75,6 +75,6 @@
 } PACKED;
 
 // mptable.c
-void mptable_init(void);
+void mptable_setup(void);
 
 #endif // mptable.h
diff --git a/src/optionroms.c b/src/optionroms.c
index 00697b2..c79a706 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -40,7 +40,7 @@
     farcall16big(&br);
     finish_preempt();
 
-    debug_serial_setup();
+    debug_serial_preinit();
 }
 
 // Execute a given option rom at the standard entry vector.
@@ -410,13 +410,13 @@
  * VGA init
  ****************************************************************/
 
-static int S3ResumeVgaInit;
+static int S3ResumeVga;
 int ScreenAndDebug;
 struct rom_header *VgaROM;
 
 // Call into vga code to turn on console.
 void
-vga_setup(void)
+vgarom_setup(void)
 {
     if (! CONFIG_OPTIONROMS)
         return;
@@ -425,7 +425,7 @@
 
     // Load some config settings that impact VGA.
     EnforceChecksum = romfile_loadint("etc/optionroms-checksum", 1);
-    S3ResumeVgaInit = romfile_loadint("etc/s3-resume-vga-init", !CONFIG_COREBOOT);
+    S3ResumeVga = romfile_loadint("etc/s3-resume-vga-init", !CONFIG_COREBOOT);
     ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);
 
     if (CONFIG_OPTIONROMS_DEPLOYED) {
@@ -459,9 +459,9 @@
 }
 
 void
-s3_resume_vga_init(void)
+s3_resume_vga(void)
 {
-    if (!S3ResumeVgaInit)
+    if (!S3ResumeVga)
         return;
     if (!VgaROM || ! is_valid_rom(VgaROM))
         return;
diff --git a/src/output.c b/src/output.c
index 83de7f4..e623d37 100644
--- a/src/output.c
+++ b/src/output.c
@@ -26,7 +26,7 @@
 u16 DebugOutputPort VAR16VISIBLE = 0x402;
 
 void
-debug_serial_setup(void)
+debug_serial_preinit(void)
 {
     if (!CONFIG_DEBUG_SERIAL)
         return;
diff --git a/src/paravirt.c b/src/paravirt.c
index 4b5c441..f180261 100644
--- a/src/paravirt.c
+++ b/src/paravirt.c
@@ -11,7 +11,7 @@
 #include "util.h" // dprintf
 #include "byteorder.h" // be32_to_cpu
 #include "ioport.h" // outw
-#include "paravirt.h" // qemu_cfg_port_probe
+#include "paravirt.h" // qemu_cfg_preinit
 #include "smbios.h" // struct smbios_structure_header
 
 int qemu_cfg_present;
@@ -42,7 +42,7 @@
     qemu_cfg_read(buf, len);
 }
 
-void qemu_cfg_port_probe(void)
+void qemu_cfg_preinit(void)
 {
     char *sig = "QEMU";
     int i;
@@ -321,7 +321,7 @@
     char name[56];
 };
 
-void qemu_cfg_romfile_setup(void)
+void qemu_romfile_init(void)
 {
     if (CONFIG_COREBOOT || !qemu_cfg_present)
         return;
diff --git a/src/paravirt.h b/src/paravirt.h
index a284c41..765a6c1 100644
--- a/src/paravirt.h
+++ b/src/paravirt.h
@@ -43,7 +43,7 @@
 
 extern int qemu_cfg_present;
 
-void qemu_cfg_port_probe(void);
+void qemu_cfg_preinit(void);
 int qemu_cfg_show_boot_menu(void);
 void qemu_cfg_get_uuid(u8 *uuid);
 int qemu_cfg_irq0_override(void);
@@ -64,6 +64,6 @@
 };
 u32 qemu_cfg_e820_entries(void);
 void* qemu_cfg_e820_load_next(void *addr);
-void qemu_cfg_romfile_setup(void);
+void qemu_romfile_init(void);
 
 #endif
diff --git a/src/pci.h b/src/pci.h
index fe663b8..aa54dd7 100644
--- a/src/pci.h
+++ b/src/pci.h
@@ -118,7 +118,7 @@
 void pci_writel(u32 addr, u32 val);
 
 // pirtable.c
-void create_pirtable(void);
+void pirtable_setup(void);
 
 
 /****************************************************************
diff --git a/src/pcibios.c b/src/pcibios.c
index e4bd7c0..f084fa1 100644
--- a/src/pcibios.c
+++ b/src/pcibios.c
@@ -229,7 +229,7 @@
 };
 
 void
-bios32_setup(void)
+bios32_init(void)
 {
     dprintf(3, "init bios32\n");
 
diff --git a/src/pciinit.c b/src/pciinit.c
index a406bbd..34b47b6 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -105,7 +105,7 @@
 }
 
 /* PIIX3/PIIX4 PCI to ISA bridge */
-static void piix_isa_bridge_init(struct pci_device *pci, void *arg)
+static void piix_isa_bridge_setup(struct pci_device *pci, void *arg)
 {
     int i, irq;
     u8 elcr[2];
@@ -126,7 +126,7 @@
 
 /* ICH9 LPC PCI to ISA bridge */
 /* PCI_VENDOR_ID_INTEL && PCI_DEVICE_ID_INTEL_ICH9_LPC */
-void mch_isa_bridge_init(struct pci_device *dev, void *arg)
+void mch_isa_bridge_setup(struct pci_device *dev, void *arg)
 {
     u16 bdf = dev->bdf;
     int i, irq;
@@ -160,10 +160,10 @@
     /* acpi enable, SCI: IRQ9 000b = irq9*/
     pci_config_writeb(bdf, ICH9_LPC_ACPI_CTRL, ICH9_LPC_ACPI_CTRL_ACPI_EN);
 
-    pmtimer_init(PORT_ACPI_PM_BASE + 0x08, PM_TIMER_FREQUENCY / 1000);
+    pmtimer_setup(PORT_ACPI_PM_BASE + 0x08, PM_TIMER_FREQUENCY / 1000);
 }
 
-static void storage_ide_init(struct pci_device *pci, void *arg)
+static void storage_ide_setup(struct pci_device *pci, void *arg)
 {
     /* IDE: we map it as in ISA mode */
     pci_set_io_region_addr(pci, 0, PORT_ATA1_CMD_BASE, 0);
@@ -173,27 +173,27 @@
 }
 
 /* PIIX3/PIIX4 IDE */
-static void piix_ide_init(struct pci_device *pci, void *arg)
+static void piix_ide_setup(struct pci_device *pci, void *arg)
 {
     u16 bdf = pci->bdf;
     pci_config_writew(bdf, 0x40, 0x8000); // enable IDE0
     pci_config_writew(bdf, 0x42, 0x8000); // enable IDE1
 }
 
-static void pic_ibm_init(struct pci_device *pci, void *arg)
+static void pic_ibm_setup(struct pci_device *pci, void *arg)
 {
     /* PIC, IBM, MPIC & MPIC2 */
     pci_set_io_region_addr(pci, 0, 0x80800000 + 0x00040000, 0);
 }
 
-static void apple_macio_init(struct pci_device *pci, void *arg)
+static void apple_macio_setup(struct pci_device *pci, void *arg)
 {
     /* macio bridge */
     pci_set_io_region_addr(pci, 0, 0x80800000, 0);
 }
 
 /* PIIX4 Power Management device (for ACPI) */
-static void piix4_pm_init(struct pci_device *pci, void *arg)
+static void piix4_pm_setup(struct pci_device *pci, void *arg)
 {
     u16 bdf = pci->bdf;
     // acpi sci is hardwired to 9
@@ -204,12 +204,12 @@
     pci_config_writel(bdf, 0x90, PORT_SMB_BASE | 1);
     pci_config_writeb(bdf, 0xd2, 0x09); /* enable SMBus io space */
 
-    pmtimer_init(PORT_ACPI_PM_BASE + 0x08, PM_TIMER_FREQUENCY / 1000);
+    pmtimer_setup(PORT_ACPI_PM_BASE + 0x08, PM_TIMER_FREQUENCY / 1000);
 }
 
 /* ICH9 SMBUS */
 /* PCI_VENDOR_ID_INTEL && PCI_DEVICE_ID_INTEL_ICH9_SMBUS */
-void ich9_smbus_init(struct pci_device *dev, void *arg)
+void ich9_smbus_setup(struct pci_device *dev, void *arg)
 {
     u16 bdf = dev->bdf;
     /* map smbus into io space */
@@ -223,35 +223,35 @@
 static const struct pci_device_id pci_device_tbl[] = {
     /* PIIX3/PIIX4 PCI to ISA bridge */
     PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371SB_0,
-               piix_isa_bridge_init),
+               piix_isa_bridge_setup),
     PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0,
-               piix_isa_bridge_init),
+               piix_isa_bridge_setup),
     PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_LPC,
-               mch_isa_bridge_init),
+               mch_isa_bridge_setup),
 
     /* STORAGE IDE */
     PCI_DEVICE_CLASS(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371SB_1,
-                     PCI_CLASS_STORAGE_IDE, piix_ide_init),
+                     PCI_CLASS_STORAGE_IDE, piix_ide_setup),
     PCI_DEVICE_CLASS(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB,
-                     PCI_CLASS_STORAGE_IDE, piix_ide_init),
+                     PCI_CLASS_STORAGE_IDE, piix_ide_setup),
     PCI_DEVICE_CLASS(PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE,
-                     storage_ide_init),
+                     storage_ide_setup),
 
     /* PIC, IBM, MIPC & MPIC2 */
     PCI_DEVICE_CLASS(PCI_VENDOR_ID_IBM, 0x0046, PCI_CLASS_SYSTEM_PIC,
-                     pic_ibm_init),
+                     pic_ibm_setup),
     PCI_DEVICE_CLASS(PCI_VENDOR_ID_IBM, 0xFFFF, PCI_CLASS_SYSTEM_PIC,
-                     pic_ibm_init),
+                     pic_ibm_setup),
 
     /* PIIX4 Power Management device (for ACPI) */
     PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3,
-               piix4_pm_init),
+               piix4_pm_setup),
     PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_SMBUS,
-               ich9_smbus_init),
+               ich9_smbus_setup),
 
     /* 0xff00 */
-    PCI_DEVICE_CLASS(PCI_VENDOR_ID_APPLE, 0x0017, 0xff00, apple_macio_init),
-    PCI_DEVICE_CLASS(PCI_VENDOR_ID_APPLE, 0x0022, 0xff00, apple_macio_init),
+    PCI_DEVICE_CLASS(PCI_VENDOR_ID_APPLE, 0x0017, 0xff00, apple_macio_setup),
+    PCI_DEVICE_CLASS(PCI_VENDOR_ID_APPLE, 0x0022, 0xff00, apple_macio_setup),
 
     PCI_DEVICE_END,
 };
@@ -288,7 +288,7 @@
  * Platform device initialization
  ****************************************************************/
 
-void i440fx_mem_addr_init(struct pci_device *dev, void *arg)
+void i440fx_mem_addr_setup(struct pci_device *dev, void *arg)
 {
     if (RamSize <= 0x80000000)
         pcimem_start = 0x80000000;
@@ -296,7 +296,7 @@
         pcimem_start = 0xc0000000;
 }
 
-void mch_mem_addr_init(struct pci_device *dev, void *arg)
+void mch_mem_addr_setup(struct pci_device *dev, void *arg)
 {
     u64 addr = Q35_HOST_BRIDGE_PCIEXBAR_ADDR;
     u32 size = Q35_HOST_BRIDGE_PCIEXBAR_SIZE;
@@ -316,9 +316,9 @@
 
 static const struct pci_device_id pci_platform_tbl[] = {
     PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441,
-               i440fx_mem_addr_init),
+               i440fx_mem_addr_setup),
     PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_Q35_MCH,
-               mch_mem_addr_init),
+               mch_mem_addr_setup),
     PCI_DEVICE_END
 };
 
diff --git a/src/pirtable.c b/src/pirtable.c
index 8eadbf0..62b62b8 100644
--- a/src/pirtable.c
+++ b/src/pirtable.c
@@ -92,7 +92,7 @@
 #endif // CONFIG_PIRTABLE && !CONFIG_COREBOOT
 
 void
-create_pirtable(void)
+pirtable_setup(void)
 {
     if (! CONFIG_PIRTABLE)
         return;
diff --git a/src/pmm.c b/src/pmm.c
index 1657c10..098b213 100644
--- a/src/pmm.c
+++ b/src/pmm.c
@@ -217,7 +217,7 @@
  ****************************************************************/
 
 void
-malloc_setup(void)
+malloc_preinit(void)
 {
     ASSERT32FLAT();
     dprintf(3, "malloc setup\n");
@@ -258,7 +258,7 @@
 
 // Update pointers after code relocation.
 void
-malloc_fixupreloc(void)
+malloc_fixupreloc_init(void)
 {
     ASSERT32FLAT();
     if (!CONFIG_RELOCATE_INIT)
@@ -281,7 +281,7 @@
 }
 
 void
-malloc_finalize(void)
+malloc_prepboot(void)
 {
     ASSERT32FLAT();
     dprintf(3, "malloc finalize\n");
@@ -545,7 +545,7 @@
 }
 
 void
-pmm_setup(void)
+pmm_init(void)
 {
     if (! CONFIG_PMM)
         return;
@@ -557,7 +557,7 @@
 }
 
 void
-pmm_finalize(void)
+pmm_prepboot(void)
 {
     if (! CONFIG_PMM)
         return;
diff --git a/src/pnpbios.c b/src/pnpbios.c
index b1bebc9..c8bc8f4 100644
--- a/src/pnpbios.c
+++ b/src/pnpbios.c
@@ -90,7 +90,7 @@
 extern void entry_pnp_prot(void);
 
 void
-pnp_setup(void)
+pnp_init(void)
 {
     if (! CONFIG_PNPBIOS)
         return;
diff --git a/src/post.c b/src/post.c
index f3b56b8..fb7372b 100644
--- a/src/post.c
+++ b/src/post.c
@@ -5,25 +5,24 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "ioport.h" // PORT_*
 #include "config.h" // CONFIG_*
 #include "cmos.h" // CMOS_*
 #include "util.h" // memset
 #include "biosvar.h" // struct bios_data_area_s
-#include "disk.h" // floppy_drive_setup
+#include "disk.h" // floppy_setup
 #include "ata.h" // ata_setup
 #include "ahci.h" // ahci_setup
 #include "memmap.h" // add_e820
 #include "pic.h" // pic_setup
-#include "pci.h" // create_pirtable
-#include "acpi.h" // acpi_bios_init
+#include "pci.h" // pirtable_setup
+#include "acpi.h" // acpi_setup
 #include "bregs.h" // struct bregs
-#include "mptable.h" // mptable_init
-#include "boot.h" // IPL
+#include "mptable.h" // mptable_setup
+#include "boot.h" // boot_init
 #include "usb.h" // usb_setup
-#include "smbios.h" // smbios_init
-#include "paravirt.h" // qemu_cfg_port_probe
-#include "xen.h" // xen_probe_hvm_info
+#include "smbios.h" // smbios_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
@@ -36,7 +35,7 @@
  ****************************************************************/
 
 static void
-init_ivt(void)
+ivt_init(void)
 {
     dprintf(3, "init ivt\n");
 
@@ -76,7 +75,7 @@
 }
 
 static void
-init_bda(void)
+bda_init(void)
 {
     dprintf(3, "init bda\n");
 
@@ -101,13 +100,13 @@
 }
 
 static void
-ram_probe(void)
+ramsize_preinit(void)
 {
     dprintf(3, "Find memory size\n");
     if (CONFIG_COREBOOT) {
-        coreboot_setup();
+        coreboot_preinit();
     } else if (usingXen()) {
-        xen_setup();
+        xen_ramsize_preinit();
     } else {
         // On emulators, get memory size from nvram.
         u32 rs = ((inb_cmos(CMOS_MEM_EXTMEM2_LOW) << 16)
@@ -158,29 +157,29 @@
 }
 
 static void
-init_bios_tables(void)
+biostable_setup(void)
 {
     if (CONFIG_COREBOOT) {
-        coreboot_copy_biostable();
+        coreboot_biostable_setup();
         return;
     }
     if (usingXen()) {
-        xen_copy_biostables();
+        xen_biostable_setup();
         return;
     }
 
-    create_pirtable();
+    pirtable_setup();
 
-    mptable_init();
+    mptable_setup();
 
-    smbios_init();
+    smbios_setup();
 
-    acpi_bios_init();
+    acpi_setup();
 }
 
 // Initialize hardware devices
 static void
-init_hw(void)
+device_hardware_setup(void)
 {
     usb_setup();
     ps2port_setup();
@@ -218,55 +217,55 @@
 maininit(void)
 {
     // Setup romfile items.
-    qemu_cfg_romfile_setup();
-    coreboot_cbfs_setup();
+    qemu_romfile_init();
+    coreboot_cbfs_init();
 
     // Setup ivt/bda/ebda
-    init_ivt();
-    init_bda();
+    ivt_init();
+    bda_init();
 
     // Init base pc hardware.
     pic_setup();
     timer_setup();
-    mathcp_setup();
+    mathcp_init();
 
     // Initialize pci
     pci_setup();
-    smm_init();
+    smm_setup();
 
     // Initialize mtrr
     mtrr_setup();
 
     // Setup Xen hypercalls
-    xen_init_hypercalls();
+    xen_hypercall_setup();
 
     // Initialize internal tables
-    boot_setup();
+    boot_init();
 
     // Start hardware initialization (if optionrom threading)
     if (CONFIG_THREADS && CONFIG_THREAD_OPTIONROMS)
-        init_hw();
+        device_hardware_setup();
 
     // Find and initialize other cpus
-    smp_probe();
+    smp_setup();
 
     // Setup interfaces that option roms may need
-    bios32_setup();
-    pmm_setup();
-    pnp_setup();
-    kbd_setup();
-    mouse_setup();
-    init_bios_tables();
+    bios32_init();
+    pmm_init();
+    pnp_init();
+    kbd_init();
+    mouse_init();
+    biostable_setup();
 
     // Run vga option rom
-    vga_setup();
+    vgarom_setup();
 
     // SMBIOS tables and VGA console are ready, print UUID
     display_uuid();
 
     // Do hardware initialization (if running synchronously)
     if (!CONFIG_THREADS || !CONFIG_THREAD_OPTIONROMS) {
-        init_hw();
+        device_hardware_setup();
         wait_threads();
     }
 
@@ -274,13 +273,13 @@
     optionrom_setup();
 
     // Run BCVs and show optional boot menu
-    boot_prep();
+    boot_prepboot();
 
     // Finalize data structures before boot
-    cdemu_setup();
-    pmm_finalize();
-    malloc_finalize();
-    memmap_finalize();
+    cdrom_prepboot();
+    pmm_prepboot();
+    malloc_prepboot();
+    memmap_prepboot();
 
     // Setup bios checksum.
     BiosChecksum -= checksum((u8*)BUILD_BIOS_ADDR, BUILD_BIOS_SIZE);
@@ -302,7 +301,7 @@
 afterReloc(void)
 {
     // Running at new code address - do code relocation fixups
-    malloc_fixupreloc();
+    malloc_fixupreloc_init();
 
     // Move low-memory initial variable content to new location.
     extern u8 datalow_start[], datalow_end[], final_datalow_start[];
@@ -323,7 +322,7 @@
 
 // Relocate init code and then call maininit() at new address.
 static void
-reloc_init(void)
+reloc_preinit(void)
 {
     if (!CONFIG_RELOCATE_INIT) {
         maininit();
@@ -372,12 +371,12 @@
     HaveRunPost = 1;
 
     // Detect ram and setup internal malloc.
-    qemu_cfg_port_probe();
-    ram_probe();
-    malloc_setup();
+    qemu_cfg_preinit();
+    ramsize_preinit();
+    malloc_preinit();
 
     // Relocate initialization code and call maininit().
-    reloc_init();
+    reloc_preinit();
 }
 
 // Entry point for Power On Self Test (POST) - the BIOS initilization
@@ -386,7 +385,7 @@
 void VISIBLE32FLAT
 handle_post(void)
 {
-    debug_serial_setup();
+    debug_serial_preinit();
     dprintf(1, "Start bios (version %s)\n", VERSION);
 
     // Enable CPU caching
@@ -396,10 +395,10 @@
     outb_cmos(0, CMOS_RESET_CODE);
 
     // Make sure legacy DMA isn't running.
-    init_dma();
+    dma_preinit();
 
     // Check if we are running under Xen.
-    xen_probe();
+    xen_preinit();
 
     // Allow writes to modify bios area (0xf0000)
     make_bios_writable();
diff --git a/src/ps2port.c b/src/ps2port.c
index d4626d6..9b760fd 100644
--- a/src/ps2port.c
+++ b/src/ps2port.c
@@ -417,7 +417,7 @@
  ****************************************************************/
 
 static void
-keyboard_init(void *data)
+ps2_keyboard_setup(void *data)
 {
     /* flush incoming keys */
     int ret = i8042_flush();
@@ -500,5 +500,5 @@
     enable_hwirq(1, FUNC16(entry_09));
     enable_hwirq(12, FUNC16(entry_74));
 
-    run_thread(keyboard_init, NULL);
+    run_thread(ps2_keyboard_setup, NULL);
 }
diff --git a/src/resume.c b/src/resume.c
index f1a96ac..99265cd 100644
--- a/src/resume.c
+++ b/src/resume.c
@@ -19,7 +19,7 @@
 
 // Reset DMA controller
 void
-init_dma(void)
+dma_preinit(void)
 {
     // first reset the DMA controllers
     outb(0, PORT_DMA1_MASTER_CLEAR);
@@ -35,12 +35,12 @@
 handle_resume(void)
 {
     ASSERT16();
-    debug_serial_setup();
+    debug_serial_preinit();
     int status = inb_cmos(CMOS_RESET_CODE);
     outb_cmos(0, CMOS_RESET_CODE);
     dprintf(1, "In resume (status=%d)\n", status);
 
-    init_dma();
+    dma_preinit();
 
     switch (status) {
     case 0x01 ... 0x04:
@@ -109,9 +109,9 @@
     }
 
     pic_setup();
-    smm_init();
+    smm_setup();
 
-    s3_resume_vga_init();
+    s3_resume_vga();
 
     make_bios_readonly();
 
diff --git a/src/smbios.c b/src/smbios.c
index 23713a2..c235564 100644
--- a/src/smbios.c
+++ b/src/smbios.c
@@ -12,10 +12,10 @@
 struct smbios_entry_point *SMBiosAddr;
 
 static void
-smbios_entry_point_init(u16 max_structure_size,
-                        u16 structure_table_length,
-                        void *structure_table_address,
-                        u16 number_of_structures)
+smbios_entry_point_setup(u16 max_structure_size,
+                         u16 structure_table_length,
+                         void *structure_table_address,
+                         u16 number_of_structures)
 {
     struct smbios_entry_point *ep = malloc_fseg(sizeof(*ep));
     void *finaltable;
@@ -441,7 +441,7 @@
 #define TEMPSMBIOSSIZE (32 * 1024)
 
 void
-smbios_init(void)
+smbios_setup(void)
 {
     if (! CONFIG_SMBIOS)
         return;
@@ -518,7 +518,7 @@
 
 #undef add_struct
 
-    smbios_entry_point_init(max_struct_size, p - start, start, nr_structs);
+    smbios_entry_point_setup(max_struct_size, p - start, start, nr_structs);
     free(start);
 }
 
diff --git a/src/smbios.h b/src/smbios.h
index 5bf0392..a4c1444 100644
--- a/src/smbios.h
+++ b/src/smbios.h
@@ -2,7 +2,7 @@
 #define __SMBIOS_H
 
 // smbios.c
-void smbios_init(void);
+void smbios_setup(void);
 
 /* SMBIOS entry point -- must be written to a 16-bit aligned address
    between 0xf0000 and 0xfffff.
diff --git a/src/smm.c b/src/smm.c
index 7977ac7..c69f0fd 100644
--- a/src/smm.c
+++ b/src/smm.c
@@ -112,7 +112,7 @@
 #define PIIX_APMC_EN    (1 << 25)
 
 // This code is hardcoded for PIIX4 Power Management device.
-static void piix4_apmc_smm_init(struct pci_device *pci, void *arg)
+static void piix4_apmc_smm_setup(struct pci_device *pci, void *arg)
 {
     struct pci_device *i440_pci = pci_find_device(PCI_VENDOR_ID_INTEL
                                                   , PCI_DEVICE_ID_INTEL_82441);
@@ -139,7 +139,7 @@
 }
 
 /* PCI_VENDOR_ID_INTEL && PCI_DEVICE_ID_INTEL_ICH9_LPC */
-void ich9_lpc_apmc_smm_init(struct pci_device *dev, void *arg)
+void ich9_lpc_apmc_smm_setup(struct pci_device *dev, void *arg)
 {
     struct pci_device *mch_dev;
     int mch_bdf;
@@ -174,15 +174,15 @@
 
 static const struct pci_device_id smm_init_tbl[] = {
     PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3,
-               piix4_apmc_smm_init),
+               piix4_apmc_smm_setup),
     PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_LPC,
-               ich9_lpc_apmc_smm_init),
+               ich9_lpc_apmc_smm_setup),
 
     PCI_DEVICE_END,
 };
 
 void
-smm_init(void)
+smm_setup(void)
 {
     if (CONFIG_COREBOOT)
         // SMM only supported on emulators.
diff --git a/src/smp.c b/src/smp.c
index 4975412..18bb05f 100644
--- a/src/smp.c
+++ b/src/smp.c
@@ -82,7 +82,7 @@
 
 // find and initialize the CPUs by launching a SIPI to them
 void
-smp_probe(void)
+smp_setup(void)
 {
     ASSERT32FLAT();
     u32 eax, ebx, ecx, cpuid_features;
diff --git a/src/usb-ehci.c b/src/usb-ehci.c
index 2676615..f28f343 100644
--- a/src/usb-ehci.c
+++ b/src/usb-ehci.c
@@ -13,8 +13,8 @@
 #include "pci_regs.h" // PCI_BASE_ADDRESS_0
 #include "usb.h" // struct usb_s
 #include "biosvar.h" // GET_LOWFLAT
-#include "usb-uhci.h" // init_uhci
-#include "usb-ohci.h" // init_ohci
+#include "usb-uhci.h" // uhci_setup
+#include "usb-ohci.h" // ohci_setup
 
 struct usb_ehci_s {
     struct usb_s usb;
@@ -58,13 +58,13 @@
         if (!pci)
             break;
 
-        // ohci/uhci_init call pci_config_XXX - don't run from irq handler.
+        // ohci/uhci_setup call pci_config_X - don't run from irq handler.
         wait_preempt();
 
         if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_UHCI)
-            uhci_init(pci, cntl->usb.busid + i);
+            uhci_setup(pci, cntl->usb.busid + i);
         else if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_OHCI)
-            ohci_init(pci, cntl->usb.busid + i);
+            ohci_setup(pci, cntl->usb.busid + i);
     }
 }
 
@@ -327,7 +327,7 @@
 }
 
 int
-ehci_init(struct pci_device *pci, int busid, struct pci_device *comppci)
+ehci_setup(struct pci_device *pci, int busid, struct pci_device *comppci)
 {
     if (! CONFIG_USB_EHCI)
         return -1;
diff --git a/src/usb-ehci.h b/src/usb-ehci.h
index 32e4109..5672033 100644
--- a/src/usb-ehci.h
+++ b/src/usb-ehci.h
@@ -2,7 +2,7 @@
 #define __USB_EHCI_H
 
 // usb-ehci.c
-int ehci_init(struct pci_device *pci, int busid, struct pci_device *comppci);
+int ehci_setup(struct pci_device *pci, int busid, struct pci_device *comppci);
 struct usbdevice_s;
 struct usb_endpoint_descriptor;
 struct usb_pipe *ehci_alloc_pipe(struct usbdevice_s *usbdev
diff --git a/src/usb-hid.c b/src/usb-hid.c
index 8c4b803..0d5f371 100644
--- a/src/usb-hid.c
+++ b/src/usb-hid.c
@@ -49,8 +49,8 @@
 #define KEYREPEATMS 33
 
 static int
-usb_kbd_init(struct usbdevice_s *usbdev
-             , struct usb_endpoint_descriptor *epdesc)
+usb_kbd_setup(struct usbdevice_s *usbdev
+              , struct usb_endpoint_descriptor *epdesc)
 {
     if (! CONFIG_USB_KEYBOARD)
         return -1;
@@ -79,8 +79,8 @@
 }
 
 static int
-usb_mouse_init(struct usbdevice_s *usbdev
-               , struct usb_endpoint_descriptor *epdesc)
+usb_mouse_setup(struct usbdevice_s *usbdev
+                , struct usb_endpoint_descriptor *epdesc)
 {
     if (! CONFIG_USB_MOUSE)
         return -1;
@@ -106,11 +106,11 @@
 
 // Initialize a found USB HID device (if applicable).
 int
-usb_hid_init(struct usbdevice_s *usbdev)
+usb_hid_setup(struct usbdevice_s *usbdev)
 {
     if (! CONFIG_USB_KEYBOARD || ! CONFIG_USB_MOUSE)
         return -1;
-    dprintf(2, "usb_hid_init %p\n", usbdev->defpipe);
+    dprintf(2, "usb_hid_setup %p\n", usbdev->defpipe);
 
     struct usb_interface_descriptor *iface = usbdev->iface;
     if (iface->bInterfaceSubClass != USB_INTERFACE_SUBCLASS_BOOT)
@@ -126,9 +126,9 @@
     }
 
     if (iface->bInterfaceProtocol == USB_INTERFACE_PROTOCOL_KEYBOARD)
-        return usb_kbd_init(usbdev, epdesc);
+        return usb_kbd_setup(usbdev, epdesc);
     if (iface->bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE)
-        return usb_mouse_init(usbdev, epdesc);
+        return usb_mouse_setup(usbdev, epdesc);
     return -1;
 }
 
diff --git a/src/usb-hid.h b/src/usb-hid.h
index bd6445c..ef34e79 100644
--- a/src/usb-hid.h
+++ b/src/usb-hid.h
@@ -3,7 +3,7 @@
 
 // usb-hid.c
 struct usbdevice_s;
-int usb_hid_init(struct usbdevice_s *usbdev);
+int usb_hid_setup(struct usbdevice_s *usbdev);
 inline int usb_kbd_active(void);
 inline int usb_kbd_command(int command, u8 *param);
 inline int usb_mouse_active(void);
diff --git a/src/usb-hub.c b/src/usb-hub.c
index 6f1aaa1..894ed7d 100644
--- a/src/usb-hub.c
+++ b/src/usb-hub.c
@@ -158,7 +158,7 @@
 
 // Configure a usb hub and then find devices connected to it.
 int
-usb_hub_init(struct usbdevice_s *usbdev)
+usb_hub_setup(struct usbdevice_s *usbdev)
 {
     ASSERT32FLAT();
     if (!CONFIG_USB_HUB)
diff --git a/src/usb-hub.h b/src/usb-hub.h
index a75cbda..5b09947 100644
--- a/src/usb-hub.h
+++ b/src/usb-hub.h
@@ -3,7 +3,7 @@
 
 // usb-hub.c
 struct usbdevice_s;
-int usb_hub_init(struct usbdevice_s *usbdev);
+int usb_hub_setup(struct usbdevice_s *usbdev);
 
 
 /****************************************************************
diff --git a/src/usb-msc.c b/src/usb-msc.c
index 83c7397..7b2524d 100644
--- a/src/usb-msc.c
+++ b/src/usb-msc.c
@@ -6,7 +6,7 @@
 
 #include "util.h" // dprintf
 #include "config.h" // CONFIG_USB_MSC
-#include "usb-msc.h" // usb_msc_init
+#include "usb-msc.h" // usb_msc_setup
 #include "usb.h" // struct usb_s
 #include "biosvar.h" // GET_GLOBAL
 #include "blockcmd.h" // cdb_read
@@ -135,8 +135,8 @@
 }
 
 static int
-usb_msc_init_lun(struct usb_pipe *inpipe, struct usb_pipe *outpipe,
-                 struct usbdevice_s *usbdev, int lun)
+usb_msc_lun_setup(struct usb_pipe *inpipe, struct usb_pipe *outpipe,
+                  struct usbdevice_s *usbdev, int lun)
 {
     // Allocate drive structure.
     struct usbdrive_s *udrive_g = malloc_fseg(sizeof(*udrive_g));
@@ -151,7 +151,7 @@
     udrive_g->lun = lun;
 
     int prio = bootprio_find_usb(usbdev, lun);
-    int ret = scsi_init_drive(&udrive_g->drive, "USB MSC", prio);
+    int ret = scsi_drive_setup(&udrive_g->drive, "USB MSC", prio);
     if (ret) {
         dprintf(1, "Unable to configure USB MSC drive.\n");
         free(udrive_g);
@@ -166,7 +166,7 @@
 
 // Configure a usb msc device.
 int
-usb_msc_init(struct usbdevice_s *usbdev)
+usb_msc_setup(struct usbdevice_s *usbdev)
 {
     if (!CONFIG_USB_MSC)
         return -1;
@@ -198,7 +198,7 @@
     int maxlun = usb_msc_maxlun(usbdev->defpipe);
     int lun, pipesused = 0;
     for (lun = 0; lun < maxlun + 1; lun++) {
-        int ret = usb_msc_init_lun(inpipe, outpipe, usbdev, lun);
+        int ret = usb_msc_lun_setup(inpipe, outpipe, usbdev, lun);
         if (!ret)
             pipesused = 1;
     }
diff --git a/src/usb-msc.h b/src/usb-msc.h
index 3746b77..c40d755 100644
--- a/src/usb-msc.h
+++ b/src/usb-msc.h
@@ -5,6 +5,6 @@
 struct disk_op_s;
 int usb_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize);
 struct usbdevice_s;
-int usb_msc_init(struct usbdevice_s *usbdev);
+int usb_msc_setup(struct usbdevice_s *usbdev);
 
 #endif // ush-msc.h
diff --git a/src/usb-ohci.c b/src/usb-ohci.c
index e219c5f..ef6a52c 100644
--- a/src/usb-ohci.c
+++ b/src/usb-ohci.c
@@ -262,7 +262,7 @@
 }
 
 void
-ohci_init(struct pci_device *pci, int busid)
+ohci_setup(struct pci_device *pci, int busid)
 {
     if (! CONFIG_USB_OHCI)
         return;
diff --git a/src/usb-ohci.h b/src/usb-ohci.h
index 25900a7..ad0ffec 100644
--- a/src/usb-ohci.h
+++ b/src/usb-ohci.h
@@ -2,7 +2,7 @@
 #define __USB_OHCI_H
 
 // usb-ohci.c
-void ohci_init(struct pci_device *pci, int busid);
+void ohci_setup(struct pci_device *pci, int busid);
 struct usbdevice_s;
 struct usb_endpoint_descriptor;
 struct usb_pipe *ohci_alloc_pipe(struct usbdevice_s *usbdev
diff --git a/src/usb-uas.c b/src/usb-uas.c
index be153ed..3169389 100644
--- a/src/usb-uas.c
+++ b/src/usb-uas.c
@@ -164,10 +164,10 @@
 }
 
 static int
-uas_init_lun(struct usbdevice_s *usbdev,
-             struct usb_pipe *command, struct usb_pipe *status,
-             struct usb_pipe *data_in, struct usb_pipe *data_out,
-             int lun)
+uas_lun_setup(struct usbdevice_s *usbdev,
+              struct usb_pipe *command, struct usb_pipe *status,
+              struct usb_pipe *data_in, struct usb_pipe *data_out,
+              int lun)
 {
     // Allocate drive structure.
     struct uasdrive_s *drive = malloc_fseg(sizeof(*drive));
@@ -184,7 +184,7 @@
     drive->lun = lun;
 
     int prio = bootprio_find_usb(usbdev, lun);
-    int ret = scsi_init_drive(&drive->drive, "USB UAS", prio);
+    int ret = scsi_drive_setup(&drive->drive, "USB UAS", prio);
     if (ret) {
         free(drive);
         return -1;
@@ -193,7 +193,7 @@
 }
 
 int
-usb_uas_init(struct usbdevice_s *usbdev)
+usb_uas_setup(struct usbdevice_s *usbdev)
 {
     if (!CONFIG_USB_UAS)
         return -1;
@@ -247,7 +247,7 @@
         goto fail;
 
     /* TODO: send REPORT LUNS.  For now, only LUN 0 is recognized.  */
-    int ret = uas_init_lun(usbdev, command, status, data_in, data_out, 0);
+    int ret = uas_lun_setup(usbdev, command, status, data_in, data_out, 0);
     if (ret < 0) {
         dprintf(1, "Unable to configure UAS drive.\n");
         goto fail;
diff --git a/src/usb-uas.h b/src/usb-uas.h
index ed1d473..ad91c5f 100644
--- a/src/usb-uas.h
+++ b/src/usb-uas.h
@@ -4,6 +4,6 @@
 struct disk_op_s;
 int uas_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize);
 struct usbdevice_s;
-int usb_uas_init(struct usbdevice_s *usbdev);
+int usb_uas_setup(struct usbdevice_s *usbdev);
 
 #endif /* __USB_UAS_H */
diff --git a/src/usb-uhci.c b/src/usb-uhci.c
index 17145e5..4098bf2 100644
--- a/src/usb-uhci.c
+++ b/src/usb-uhci.c
@@ -235,7 +235,7 @@
 }
 
 void
-uhci_init(struct pci_device *pci, int busid)
+uhci_setup(struct pci_device *pci, int busid)
 {
     if (! CONFIG_USB_UHCI)
         return;
diff --git a/src/usb-uhci.h b/src/usb-uhci.h
index 9e3297c..b83c487 100644
--- a/src/usb-uhci.h
+++ b/src/usb-uhci.h
@@ -2,7 +2,7 @@
 #define __USB_UHCI_H
 
 // usb-uhci.c
-void uhci_init(struct pci_device *pci, int busid);
+void uhci_setup(struct pci_device *pci, int busid);
 struct usbdevice_s;
 struct usb_endpoint_descriptor;
 struct usb_pipe *uhci_alloc_pipe(struct usbdevice_s *usbdev
diff --git a/src/usb.c b/src/usb.c
index 421d0b8..6e43f13 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -9,13 +9,13 @@
 #include "config.h" // CONFIG_*
 #include "pci_regs.h" // PCI_CLASS_REVISION
 #include "pci_ids.h" // PCI_CLASS_SERIAL_USB_UHCI
-#include "usb-uhci.h" // uhci_init
-#include "usb-ohci.h" // ohci_init
-#include "usb-ehci.h" // ehci_init
+#include "usb-uhci.h" // uhci_setup
+#include "usb-ohci.h" // ohci_setup
+#include "usb-ehci.h" // ehci_setup
 #include "usb-hid.h" // usb_keyboard_setup
-#include "usb-hub.h" // usb_hub_init
-#include "usb-msc.h" // usb_msc_init
-#include "usb-uas.h" // usb_uas_init
+#include "usb-hub.h" // usb_hub_setup
+#include "usb-msc.h" // usb_msc_setup
+#include "usb-uas.h" // usb_uas_setup
 #include "usb.h" // struct usb_s
 #include "biosvar.h" // GET_GLOBAL
 
@@ -323,14 +323,14 @@
     usbdev->iface = iface;
     usbdev->imax = (void*)config + config->wTotalLength - (void*)iface;
     if (iface->bInterfaceClass == USB_CLASS_HUB)
-        ret = usb_hub_init(usbdev);
+        ret = usb_hub_setup(usbdev);
     else if (iface->bInterfaceClass == USB_CLASS_MASS_STORAGE) {
         if (iface->bInterfaceProtocol == US_PR_BULK)
-            ret = usb_msc_init(usbdev);
+            ret = usb_msc_setup(usbdev);
         if (iface->bInterfaceProtocol == US_PR_UAS)
-            ret = usb_uas_init(usbdev);
+            ret = usb_uas_setup(usbdev);
     } else
-        ret = usb_hid_init(usbdev);
+        ret = usb_hid_setup(usbdev);
     if (ret)
         goto fail;
 
@@ -342,7 +342,7 @@
 }
 
 static void
-usb_init_hub_port(void *data)
+usb_hub_port_setup(void *data)
 {
     struct usbdevice_s *usbdev = data;
     struct usbhub_s *hub = usbdev->hub;
@@ -403,7 +403,7 @@
         memset(usbdev, 0, sizeof(*usbdev));
         usbdev->hub = hub;
         usbdev->port = i;
-        run_thread(usb_init_hub_port, usbdev);
+        run_thread(usb_hub_port_setup, usbdev);
     }
 
     // Wait for threads to complete.
@@ -435,7 +435,7 @@
             for (;;) {
                 if (pci_classprog(ehcipci) == PCI_CLASS_SERIAL_USB_EHCI) {
                     // Found an ehci controller.
-                    int ret = ehci_init(ehcipci, count++, pci);
+                    int ret = ehci_setup(ehcipci, count++, pci);
                     if (ret)
                         // Error
                         break;
@@ -454,8 +454,8 @@
         }
 
         if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_UHCI)
-            uhci_init(pci, count++);
+            uhci_setup(pci, count++);
         else if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_OHCI)
-            ohci_init(pci, count++);
+            ohci_setup(pci, count++);
     }
 }
diff --git a/src/util.h b/src/util.h
index 7723bb1..eb35d02 100644
--- a/src/util.h
+++ b/src/util.h
@@ -202,7 +202,7 @@
 
 // output.c
 extern u16 DebugOutputPort;
-void debug_serial_setup(void);
+void debug_serial_preinit(void);
 void panic(const char *fmt, ...)
     __attribute__ ((format (printf, 1, 2))) __noreturn;
 void printf(const char *fmt, ...)
@@ -262,19 +262,14 @@
     __set_code_unimplemented((regs), (code) | (__LINE__ << 8), __func__)
 
 // kbd.c
-void kbd_setup(void);
+void kbd_init(void);
 void handle_15c2(struct bregs *regs);
 void process_key(u8 key);
 
 // mouse.c
-void mouse_setup(void);
+void mouse_init(void);
 void process_mouse(u8 data);
 
-// system.c
-extern u32 RamSize;
-extern u64 RamSizeOver4G;
-void mathcp_setup(void);
-
 // serial.c
 void serial_setup(void);
 void lpt_setup(void);
@@ -282,7 +277,7 @@
 // clock.c
 #define PIT_TICK_RATE 1193180   // Underlying HZ of PIT
 #define PIT_TICK_INTERVAL 65536 // Default interval for 18.2Hz timer
-void pmtimer_init(u16 ioport, u32 khz);
+void pmtimer_setup(u16 ioport, u32 khz);
 int check_tsc(u64 end);
 void timer_setup(void);
 void ndelay(u32 count);
@@ -307,7 +302,7 @@
 
 // pcibios.c
 void handle_1ab1(struct bregs *regs);
-void bios32_setup(void);
+void bios32_init(void);
 
 // shadow.c
 void make_bios_writable(void);
@@ -319,23 +314,23 @@
 void pci_setup(void);
 
 // smm.c
-void smm_init(void);
+void smm_setup(void);
 
 // smp.c
 extern u32 CountCPUs;
 extern u32 MaxCountCPUs;
 void wrmsr_smp(u32 index, u64 val);
-void smp_probe(void);
+void smp_setup(void);
 int apic_id_is_present(u8 apic_id);
 
 // coreboot.c
 extern const char *CBvendor, *CBpart;
 struct cbfs_file;
 void cbfs_run_payload(struct cbfs_file *file);
-void coreboot_copy_biostable(void);
+void coreboot_biostable_setup(void);
 void cbfs_payload_setup(void);
-void coreboot_setup(void);
-void coreboot_cbfs_setup(void);
+void coreboot_preinit(void);
+void coreboot_cbfs_init(void);
 
 // biostable.c
 void copy_table(void *pos);
@@ -348,8 +343,8 @@
 // optionroms.c
 void call_bcv(u16 seg, u16 ip);
 void optionrom_setup(void);
-void vga_setup(void);
-void s3_resume_vga_init(void);
+void vgarom_setup(void);
+void s3_resume_vga(void);
 extern int ScreenAndDebug;
 
 // bootsplash.c
@@ -359,12 +354,12 @@
 
 // resume.c
 extern int HaveRunPost;
-void init_dma(void);
+void dma_preinit(void);
 
 // pnpbios.c
 #define PNP_SIGNATURE 0x506e5024 // $PnP
 u16 get_pnp_offset(void);
-void pnp_setup(void);
+void pnp_init(void);
 
 // pmm.c
 extern struct zone_s ZoneLow, ZoneHigh, ZoneFSeg, ZoneTmpLow, ZoneTmpHigh;
@@ -372,13 +367,13 @@
 u32 rom_get_last(void);
 struct rom_header *rom_reserve(u32 size);
 int rom_confirm(u32 size);
-void malloc_setup(void);
-void malloc_fixupreloc(void);
-void malloc_finalize(void);
+void malloc_preinit(void);
+void malloc_fixupreloc_init(void);
+void malloc_prepboot(void);
 void *pmm_malloc(struct zone_s *zone, u32 handle, u32 size, u32 align);
 int pmm_free(void *data);
-void pmm_setup(void);
-void pmm_finalize(void);
+void pmm_init(void);
+void pmm_prepboot(void);
 #define PMM_DEFAULT_HANDLE 0xFFFFFFFF
 // Minimum alignment of malloc'd memory
 #define MALLOC_MIN_ALIGN 16
@@ -451,6 +446,9 @@
 void reset_vector(void) __noreturn;
 
 // misc.c
+void mathcp_init(void);
+extern u32 RamSize;
+extern u64 RamSizeOver4G;
 extern u8 BiosChecksum;
 
 // version (auto generated file out/version.c)
diff --git a/src/virtio-scsi.c b/src/virtio-scsi.c
index ab74729..4bbff8f 100644
--- a/src/virtio-scsi.c
+++ b/src/virtio-scsi.c
@@ -14,7 +14,7 @@
 #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_init_drive
+#include "blockcmd.h" // scsi_drive_setup
 #include "virtio-pci.h"
 #include "virtio-ring.h"
 #include "virtio-scsi.h"
@@ -114,7 +114,7 @@
     vlun->lun = lun;
 
     int prio = bootprio_find_scsi_device(pci, target, lun);
-    int ret = scsi_init_drive(&vlun->drive, "virtio-scsi", prio);
+    int ret = scsi_drive_setup(&vlun->drive, "virtio-scsi", prio);
     if (ret)
         goto fail;
     return 0;
diff --git a/src/xen.c b/src/xen.c
index a4669d0..c9759f0 100644
--- a/src/xen.c
+++ b/src/xen.c
@@ -47,7 +47,7 @@
         panic("Bad Xen info checksum\n");
 }
 
-void xen_probe(void)
+void xen_preinit(void)
 {
     u32 base, eax, ebx, ecx, edx;
     char signature[13];
@@ -86,7 +86,7 @@
 }
 
 /* Fill in hypercall transfer pages. */
-void xen_init_hypercalls(void)
+void xen_hypercall_setup(void)
 {
     u32 eax, ebx, ecx, edx;
     xen_extraversion_t extraversion;
@@ -111,7 +111,7 @@
     dprintf(1, "Detected Xen v%u.%u%s\n", eax >> 16, eax & 0xffff, extraversion);
 }
 
-void xen_copy_biostables(void)
+void xen_biostable_setup(void)
 {
     struct xen_seabios_info *info = (void *)INFO_PHYSICAL_ADDRESS;
     void **tables = (void*)info->tables;
@@ -122,7 +122,7 @@
         copy_table(tables[i]);
 }
 
-void xen_setup(void)
+void xen_ramsize_preinit(void)
 {
     u64 maxram = 0, maxram_over4G = 0;
     int i;
diff --git a/src/xen.h b/src/xen.h
index b664d9c..9b4178a 100644
--- a/src/xen.h
+++ b/src/xen.h
@@ -6,10 +6,10 @@
 
 extern u32 xen_cpuid_base;
 
-void xen_probe(void);
-void xen_setup(void);
-void xen_init_hypercalls(void);
-void xen_copy_biostables(void);
+void xen_preinit(void);
+void xen_ramsize_preinit(void);
+void xen_hypercall_setup(void);
+void xen_biostable_setup(void);
 
 static inline int usingXen(void) {
     if (!CONFIG_XEN)
diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c
index 938dba0..bb5a64d 100644
--- a/vgasrc/bochsvga.c
+++ b/vgasrc/bochsvga.c
@@ -329,9 +329,9 @@
  ****************************************************************/
 
 int
-bochsvga_init(void)
+bochsvga_setup(void)
 {
-    int ret = stdvga_init();
+    int ret = stdvga_setup();
     if (ret)
         return ret;
 
diff --git a/vgasrc/bochsvga.h b/vgasrc/bochsvga.h
index 1c98203..87fb6ea 100644
--- a/vgasrc/bochsvga.h
+++ b/vgasrc/bochsvga.h
@@ -66,6 +66,6 @@
 int bochsvga_save_state(u16 seg, void *data, int states);
 int bochsvga_restore_state(u16 seg, void *data, int states);
 int bochsvga_set_mode(struct vgamode_s *vmode_g, int flags);
-int bochsvga_init(void);
+int bochsvga_setup(void);
 
 #endif // bochsvga.h
diff --git a/vgasrc/clext.c b/vgasrc/clext.c
index fc5459a..dd45df3 100644
--- a/vgasrc/clext.c
+++ b/vgasrc/clext.c
@@ -5,7 +5,7 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "clext.h" // clext_init
+#include "clext.h" // clext_setup
 #include "vgabios.h" // VBE_VENDOR_STRING
 #include "biosvar.h" // GET_GLOBAL
 #include "util.h" // dprintf
@@ -603,9 +603,9 @@
 }
 
 int
-clext_init(void)
+clext_setup(void)
 {
-    int ret = stdvga_init();
+    int ret = stdvga_setup();
     if (ret)
         return ret;
 
diff --git a/vgasrc/clext.h b/vgasrc/clext.h
index 78dba01..efc98b9 100644
--- a/vgasrc/clext.h
+++ b/vgasrc/clext.h
@@ -17,6 +17,6 @@
 int clext_set_mode(struct vgamode_s *vmode_g, int flags);
 struct bregs;
 void clext_1012(struct bregs *regs);
-int clext_init(void);
+int clext_setup(void);
 
 #endif // clext.h
diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c
index 5b42e00..c2dabf5 100644
--- a/vgasrc/geodevga.c
+++ b/vgasrc/geodevga.c
@@ -6,7 +6,7 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "geodevga.h" // geodevga_init
+#include "geodevga.h" // geodevga_setup
 #include "farptr.h" // SET_FARVAR
 #include "biosvar.h" // GET_BDA
 #include "vgabios.h" // VGAREG_*
@@ -369,16 +369,16 @@
     0x9b, 0x8d, 0x8f, 0x28, 0x40, 0x98, 0xb9, 0xa3,
     0xff };
 
-int geodevga_init(void)
+int geodevga_setup(void)
 {
-    int ret = stdvga_init();
+    int ret = stdvga_setup();
     if (ret)
         return ret;
 
-    dprintf(1,"GEODEVGA_INIT\n");
+    dprintf(1,"GEODEVGA_SETUP\n");
 
     if ((ret=legacyio_check())) {
-        dprintf(1,"GEODEVGA_INIT legacyio_check=0x%x\n",ret);
+        dprintf(1,"GEODEVGA_SETUP legacyio_check=0x%x\n",ret);
     }
 
     // Updated timings from geode datasheets, table 6-53 in particular
diff --git a/vgasrc/geodevga.h b/vgasrc/geodevga.h
index 5993b23..180bd05 100644
--- a/vgasrc/geodevga.h
+++ b/vgasrc/geodevga.h
@@ -84,6 +84,6 @@
 /* Mask */
 #define DC_CFG_MSK                      0xf000a6
 
-int geodevga_init();
+int geodevga_setup();
 
 #endif
diff --git a/vgasrc/stdvga.c b/vgasrc/stdvga.c
index ae6c0be..a29d6d4 100644
--- a/vgasrc/stdvga.c
+++ b/vgasrc/stdvga.c
@@ -6,7 +6,7 @@
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "vgabios.h" // struct vgamode_s
-#include "stdvga.h" // stdvga_init
+#include "stdvga.h" // stdvga_setup
 #include "ioport.h" // outb
 #include "farptr.h" // SET_FARVAR
 #include "biosvar.h" // GET_GLOBAL
@@ -490,7 +490,7 @@
 }
 
 int
-stdvga_init(void)
+stdvga_setup(void)
 {
     // switch to color mode and enable CPU access 480 lines
     stdvga_misc_write(0xc3);
diff --git a/vgasrc/stdvga.h b/vgasrc/stdvga.h
index c9a9ba1..d712a32 100644
--- a/vgasrc/stdvga.h
+++ b/vgasrc/stdvga.h
@@ -107,6 +107,6 @@
 int stdvga_save_state(u16 seg, void *data, int states);
 int stdvga_restore_state(u16 seg, void *data, int states);
 void stdvga_enable_video_addressing(u8 disable);
-int stdvga_init(void);
+int stdvga_setup(void);
 
 #endif // stdvga.h
diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c
index afaf018..3e26e32 100644
--- a/vgasrc/vgabios.c
+++ b/vgasrc/vgabios.c
@@ -1281,7 +1281,7 @@
 void VISIBLE16
 vga_post(struct bregs *regs)
 {
-    debug_serial_setup();
+    debug_serial_preinit();
     dprintf(1, "Start SeaVGABIOS (version %s)\n", VERSION);
     debug_enter(regs, DEBUG_VGA_POST);
 
@@ -1294,7 +1294,7 @@
             SET_VGA(VgaBDF, bdf);
     }
 
-    int ret = vgahw_init();
+    int ret = vgahw_setup();
     if (ret) {
         dprintf(1, "Failed to initialize VGA hardware.  Exiting.\n");
         return;
diff --git a/vgasrc/vgahw.h b/vgasrc/vgahw.h
index 044cd32..f69a5ac 100644
--- a/vgasrc/vgahw.h
+++ b/vgasrc/vgahw.h
@@ -7,7 +7,7 @@
 #include "clext.h" // clext_set_mode
 #include "bochsvga.h" // bochsvga_set_mode
 #include "stdvga.h" // stdvga_set_mode
-#include "geodevga.h" // geodevga_init
+#include "geodevga.h" // geodevga_setup
 
 static inline struct vgamode_s *vgahw_find_mode(int mode) {
     if (CONFIG_VGA_CIRRUS)
@@ -34,14 +34,14 @@
         stdvga_list_modes(seg, dest, last);
 }
 
-static inline int vgahw_init(void) {
+static inline int vgahw_setup(void) {
     if (CONFIG_VGA_CIRRUS)
-        return clext_init();
+        return clext_setup();
     if (CONFIG_VGA_BOCHS)
-        return bochsvga_init();
+        return bochsvga_setup();
     if (CONFIG_VGA_GEODEGX2 || CONFIG_VGA_GEODELX)
-        return geodevga_init();
-    return stdvga_init();
+        return geodevga_setup();
+    return stdvga_setup();
 }
 
 static inline int vgahw_get_window(struct vgamode_s *vmode_g, int window) {