Move code centered around specific hardware devices to src/hw/

Move many C files from the src/ directory to the new src/hw/ directory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2013-09-02 20:48:46 -04:00
parent 3cb0f504a7
commit 5d369d8d9e
83 changed files with 91 additions and 91 deletions

View File

@ -8,19 +8,19 @@
OUT=out/
# Source files
SRCBOTH=misc.c stacks.c output.c util.c block.c floppy.c ata.c mouse.c \
kbd.c pci.c serial.c timer.c clock.c pic.c cdrom.c ps2port.c smp.c resume.c \
pnpbios.c vgahooks.c ramdisk.c pcibios.c blockcmd.c \
usb.c usb-uhci.c usb-ohci.c usb-ehci.c usb-hid.c usb-msc.c \
virtio-ring.c virtio-pci.c virtio-blk.c virtio-scsi.c apm.c ahci.c \
usb-uas.c lsi-scsi.c esp-scsi.c megasas.c
SRCBOTH=misc.c stacks.c output.c util.c block.c hw/floppy.c hw/ata.c mouse.c \
kbd.c hw/pci.c serial.c hw/timer.c clock.c hw/pic.c cdrom.c hw/ps2port.c smp.c resume.c \
pnpbios.c vgahooks.c hw/ramdisk.c pcibios.c hw/blockcmd.c \
hw/usb.c hw/usb-uhci.c hw/usb-ohci.c hw/usb-ehci.c hw/usb-hid.c hw/usb-msc.c \
hw/virtio-ring.c hw/virtio-pci.c hw/virtio-blk.c hw/virtio-scsi.c apm.c hw/ahci.c \
hw/usb-uas.c hw/lsi-scsi.c hw/esp-scsi.c hw/megasas.c
SRC16=$(SRCBOTH) system.c disk.c font.c
SRC32FLAT=$(SRCBOTH) post.c shadow.c memmap.c pmm.c coreboot.c boot.c \
acpi.c smm.c mptable.c pirtable.c smbios.c pciinit.c optionroms.c mtrr.c \
lzmadecode.c bootsplash.c jpeg.c usb-hub.c paravirt.c \
lzmadecode.c bootsplash.c jpeg.c hw/usb-hub.c paravirt.c \
biostables.c xen.c bmp.c romfile.c csm.c
SRC32SEG=util.c output.c pci.c pcibios.c apm.c stacks.c
DIRS=src vgasrc
SRC32SEG=util.c output.c hw/pci.c pcibios.c apm.c stacks.c
DIRS=src src/hw vgasrc
# Default compiler flags
cc-option=$(shell if test -z "`$(1) $(2) -S -o /dev/null -xc /dev/null 2>&1`" \
@ -28,7 +28,7 @@ cc-option=$(shell if test -z "`$(1) $(2) -S -o /dev/null -xc /dev/null 2>&1`" \
CPPFLAGS = -P -MD -MT $@
COMMONCFLAGS := -I$(OUT) -Os -MD -g \
COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \
-Wall -Wno-strict-aliasing -Wold-style-definition \
$(call cc-option,$(CC),-Wtype-limits,) \
-m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 \
@ -175,7 +175,7 @@ $(OUT)bios.bin.elf $(OUT)bios.bin: $(OUT)rom.o scripts/checkrom.py
################ VGA build rules
# VGA src files
SRCVGA=src/output.c src/util.c src/pci.c \
SRCVGA=src/output.c src/util.c src/hw/pci.c \
vgasrc/vgabios.c vgasrc/vgafb.c vgasrc/vgafonts.c vgasrc/vbe.c \
vgasrc/stdvga.c vgasrc/stdvgamodes.c vgasrc/stdvgaio.c \
vgasrc/clext.c vgasrc/bochsvga.c vgasrc/geodevga.c

View File

@ -8,9 +8,9 @@
#include "acpi.h" // struct rsdp_descriptor
#include "util.h" // memcpy
#include "byteorder.h" // cpu_to_le16
#include "pci.h" // pci_find_init_device
#include "pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "pci_regs.h" // PCI_INTERRUPT_LINE
#include "hw/pci.h" // pci_find_init_device
#include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "hw/pci_regs.h" // PCI_INTERRUPT_LINE
#include "ioport.h" // inl
#include "config.h" // CONFIG_*
#include "paravirt.h" // RamSize

View File

@ -6,7 +6,7 @@
#include "config.h" // CONFIG_*
#include "util.h" // dprintf
#include "pci.h" // struct pir_header
#include "hw/pci.h" // struct pir_header
#include "acpi.h" // struct rsdp_descriptor
#include "mptable.h" // MPTABLE_SIGNATURE
#include "smbios.h" // struct smbios_entry_point

View File

@ -7,12 +7,12 @@
#include "disk.h" // struct ata_s
#include "biosvar.h" // GET_GLOBAL
#include "cmos.h" // inb_cmos
#include "hw/cmos.h" // inb_cmos
#include "util.h" // dprintf
#include "ata.h" // process_ata_op
#include "ahci.h" // process_ahci_op
#include "virtio-blk.h" // process_virtio_blk_op
#include "blockcmd.h" // cdb_*
#include "hw/ata.h" // process_ata_op
#include "hw/ahci.h" // process_ahci_op
#include "hw/virtio-blk.h" // process_virtio_blk_op
#include "hw/blockcmd.h" // cdb_*
u8 FloppyCount VARFSEG;
u8 CDCount;

View File

@ -10,10 +10,10 @@
#include "disk.h" // cdrom_boot
#include "bregs.h" // struct bregs
#include "boot.h" // func defs
#include "cmos.h" // inb_cmos
#include "hw/cmos.h" // inb_cmos
#include "paravirt.h" // qemu_cfg_show_boot_menu
#include "pci.h" // pci_bdf_to_*
#include "usb.h" // struct usbdevice_s
#include "hw/pci.h" // pci_bdf_to_*
#include "hw/usb.h" // struct usbdevice_s
#include "csm.h" // csm_bootprio_*
#include "list.h" // hlist_node

View File

@ -9,8 +9,8 @@
#include "util.h" // memset
#include "bregs.h" // struct bregs
#include "biosvar.h" // GET_GLOBAL
#include "ata.h" // ATA_CMD_REQUEST_SENSE
#include "blockcmd.h" // CDB_CMD_REQUEST_SENSE
#include "hw/ata.h" // ATA_CMD_REQUEST_SENSE
#include "hw/blockcmd.h" // CDB_CMD_REQUEST_SENSE
// Locks for removable devices
u8 CDRom_locks[BUILD_MAX_EXTDRIVE] VARLOW;

View File

@ -8,12 +8,12 @@
#include "biosvar.h" // SET_BDA
#include "util.h" // debug_enter
#include "disk.h" // floppy_tick
#include "cmos.h" // inb_cmos
#include "pic.h" // pic_eoi1
#include "pit.h" // PM_SEL_TIMER0
#include "hw/cmos.h" // inb_cmos
#include "hw/pic.h" // pic_eoi1
#include "hw/pit.h" // PM_SEL_TIMER0
#include "bregs.h" // struct bregs
#include "biosvar.h" // GET_GLOBAL
#include "usb-hid.h" // usb_check_event
#include "hw/usb-hid.h" // usb_check_event
// RTC register flags
#define RTC_A_UIP 0x80

View File

@ -13,7 +13,7 @@
#include "disk.h" // MAXDESCSIZE
#include "config.h" // CONFIG_*
#include "acpi.h" // find_acpi_features
#include "pci.h" // pci_probe_devices
#include "hw/pci.h" // pci_probe_devices
#include "paravirt.h" // PlatformRunningOn

View File

@ -9,14 +9,14 @@
#include "util.h" // checksum
#include "bregs.h"
#include "optionroms.h"
#include "pci.h"
#include "hw/pci.h"
#include "memmap.h"
#include "biosvar.h"
#include "post.h"
#include "acpi.h"
#include "boot.h"
#include "smbios.h"
#include "pic.h"
#include "hw/pic.h"
struct rsdp_descriptor csm_rsdp VARFSEG __aligned(16);

View File

@ -2,13 +2,13 @@
#define __CSM_H
#include "types.h"
#include "pci.h"
#define UINT8 u8
#define UINT16 u16
#define UINT32 u32
// csm.c
struct pci_device;
int csm_bootprio_fdc(struct pci_device *pci, int port, int fdid);
int csm_bootprio_ata(struct pci_device *pci, int chanid, int slave);
int csm_bootprio_pci(struct pci_device *pci);

View File

@ -9,10 +9,10 @@
#include "biosvar.h" // SET_BDA
#include "config.h" // CONFIG_*
#include "util.h" // debug_enter
#include "pic.h" // pic_eoi2
#include "hw/pic.h" // pic_eoi2
#include "bregs.h" // struct bregs
#include "pci.h" // pci_bdf_to_bus
#include "ata.h" // ATA_CB_DC
#include "hw/pci.h" // pci_bdf_to_bus
#include "hw/ata.h" // ATA_CB_DC
/****************************************************************

View File

@ -9,8 +9,8 @@
#include "util.h" // debug_enter
#include "config.h" // CONFIG_*
#include "bregs.h" // struct bregs
#include "ps2port.h" // ps2_kbd_command
#include "usb-hid.h" // usb_kbd_command
#include "hw/ps2port.h" // ps2_kbd_command
#include "hw/usb-hid.h" // usb_kbd_command
// Bit definitions for BDA kbd_flag[012]
#define KF0_RSHIFT (1<<0)

View File

@ -8,7 +8,7 @@
#include "bregs.h" // struct bregs
#include "biosvar.h" // GET_BDA
#include "util.h" // debug_enter
#include "pic.h" // enable_hwirq
#include "hw/pic.h" // enable_hwirq
/****************************************************************

View File

@ -8,8 +8,8 @@
#include "biosvar.h" // GET_EBDA
#include "util.h" // dprintf
#include "bregs.h" // struct bregs
#include "ps2port.h" // ps2_mouse_command
#include "usb-hid.h" // usb_mouse_command
#include "hw/ps2port.h" // ps2_mouse_command
#include "hw/usb-hid.h" // usb_mouse_command
void
mouse_init(void)

View File

@ -8,8 +8,8 @@
#include "util.h" // dprintf
#include "config.h" // CONFIG_*
#include "mptable.h" // MPTABLE_SIGNATURE
#include "pci.h"
#include "pci_regs.h"
#include "hw/pci.h"
#include "hw/pci_regs.h"
void
mptable_setup(void)

View File

@ -6,7 +6,7 @@
#include "util.h" // dprintf
#include "config.h" // CONFIG_*
#include "pci.h" // pcimem_start
#include "hw/pci.h" // pcimem_start
#include "paravirt.h" // RamSize
#define MSR_MTRRcap 0x000000fe

View File

@ -9,9 +9,9 @@
#include "farptr.h" // FLATPTR_TO_SEG
#include "config.h" // CONFIG_*
#include "util.h" // dprintf
#include "pci.h" // foreachpci
#include "pci_regs.h" // PCI_ROM_ADDRESS
#include "pci_ids.h" // PCI_CLASS_DISPLAY_VGA
#include "hw/pci.h" // foreachpci
#include "hw/pci_regs.h" // PCI_ROM_ADDRESS
#include "hw/pci_ids.h" // PCI_CLASS_DISPLAY_VGA
#include "boot.h" // IPL
#include "optionroms.h" // struct rom_header

View File

@ -15,10 +15,10 @@
#include "paravirt.h" // qemu_cfg_preinit
#include "smbios.h" // smbios_setup
#include "memmap.h" // add_e820
#include "cmos.h" // CMOS_*
#include "hw/cmos.h" // CMOS_*
#include "acpi.h" // acpi_setup
#include "mptable.h" // mptable_setup
#include "pci.h" // create_pirtable
#include "hw/pci.h" // create_pirtable
#include "xen.h" // xen_biostable_setup
// Amount of continuous ram under 4Gig

View File

@ -7,10 +7,10 @@
#include "types.h" // u32
#include "util.h" // handle_1ab1
#include "pci.h" // pci_config_readl
#include "hw/pci.h" // pci_config_readl
#include "bregs.h" // struct bregs
#include "biosvar.h" // GET_GLOBAL
#include "pci_regs.h" // PCI_VENDOR_ID
#include "hw/pci_regs.h" // PCI_VENDOR_ID
// romlayout.S
extern void entry_bios32(void);

View File

@ -6,9 +6,9 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "util.h" // dprintf
#include "pci.h" // pci_config_readl
#include "pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "pci_regs.h" // PCI_COMMAND
#include "hw/pci.h" // pci_config_readl
#include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "hw/pci_regs.h" // PCI_COMMAND
#include "ioport.h" // PORT_ATA1_CMD_BASE
#include "config.h" // CONFIG_*
#include "memmap.h" // add_e820

View File

@ -5,7 +5,7 @@
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "pci.h" // struct pir_header
#include "hw/pci.h" // struct pir_header
#include "config.h" // CONFIG_*
#include "util.h" // checksum

View File

@ -6,25 +6,25 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "config.h" // CONFIG_*
#include "cmos.h" // CMOS_*
#include "hw/cmos.h" // CMOS_*
#include "util.h" // memset
#include "biosvar.h" // struct bios_data_area_s
#include "disk.h" // floppy_setup
#include "ata.h" // ata_setup
#include "ahci.h" // ahci_setup
#include "hw/ata.h" // ata_setup
#include "hw/ahci.h" // ahci_setup
#include "memmap.h" // add_e820
#include "pic.h" // pic_setup
#include "hw/pic.h" // pic_setup
#include "bregs.h" // struct bregs
#include "boot.h" // boot_init
#include "usb.h" // usb_setup
#include "hw/usb.h" // usb_setup
#include "paravirt.h" // qemu_cfg_preinit
#include "xen.h" // xen_preinit
#include "ps2port.h" // ps2port_setup
#include "virtio-blk.h" // virtio_blk_setup
#include "virtio-scsi.h" // virtio_scsi_setup
#include "lsi-scsi.h" // lsi_scsi_setup
#include "esp-scsi.h" // esp_scsi_setup
#include "megasas.h" // megasas_setup
#include "hw/ps2port.h" // ps2port_setup
#include "hw/virtio-blk.h" // virtio_blk_setup
#include "hw/virtio-scsi.h" // virtio_scsi_setup
#include "hw/lsi-scsi.h" // lsi_scsi_setup
#include "hw/esp-scsi.h" // esp_scsi_setup
#include "hw/megasas.h" // megasas_setup
#include "post.h" // interface_init

View File

@ -6,13 +6,13 @@
#include "util.h" // dprintf
#include "ioport.h" // outb
#include "pic.h" // pic_eoi2
#include "hw/pic.h" // pic_eoi2
#include "biosvar.h" // struct bios_data_area_s
#include "bregs.h" // struct bregs
#include "acpi.h" // find_resume_vector
#include "ps2port.h" // i8042_reboot
#include "pci.h" // pci_reboot
#include "cmos.h" // inb_cmos
#include "hw/ps2port.h" // i8042_reboot
#include "hw/pci.h" // pci_reboot
#include "hw/cmos.h" // inb_cmos
// Indicator if POST phase has been run.
int HaveRunPost VARFSEG;

View File

@ -8,7 +8,7 @@
#include "config.h" // CONFIG_*
#include "ioport.h" // PORT_A20
#include "bregs.h" // CR0_*
#include "cmos.h" // CMOS_RESET_CODE
#include "hw/cmos.h" // CMOS_RESET_CODE
#include "asm-offsets.h" // BREGS_*
#include "entryfuncs.S" // ENTRY_*

View File

@ -6,10 +6,10 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "util.h" // memcpy
#include "pci.h" // pci_config_writeb
#include "hw/pci.h" // pci_config_writeb
#include "config.h" // CONFIG_*
#include "pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "pci_regs.h" // PCI_VENDOR_ID
#include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "hw/pci_regs.h" // PCI_VENDOR_ID
#include "paravirt.h" // runningOnXen
#include "dev-q35.h" // PCI_VENDOR_ID_INTEL

View File

@ -5,12 +5,12 @@
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "pci.h" // pci_config_writel
#include "pci_regs.h" // PCI_DEVICE_ID
#include "hw/pci.h" // pci_config_writel
#include "hw/pci_regs.h" // PCI_DEVICE_ID
#include "util.h" // wbinvd
#include "config.h" // CONFIG_*
#include "ioport.h" // outb
#include "pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "dev-q35.h"
extern u8 smm_relocation_start, smm_relocation_end;

View File

@ -7,7 +7,7 @@
#include "util.h" // dprintf
#include "config.h" // CONFIG_*
#include "cmos.h" // CMOS_BIOS_SMP_COUNT
#include "hw/cmos.h" // CMOS_BIOS_SMP_COUNT
#define APIC_ICR_LOW ((u8*)BUILD_APIC_ADDR + 0x300)
#define APIC_SVR ((u8*)BUILD_APIC_ADDR + 0x0F0)

View File

@ -9,7 +9,7 @@
#include "biosvar.h" // BIOS_CONFIG_TABLE
#include "ioport.h" // inb
#include "memmap.h" // E820_RAM
#include "pic.h" // pic_reset
#include "hw/pic.h" // pic_reset
#include "bregs.h" // struct bregs
// Use PS2 System Control port A to set A20 enable

View File

@ -281,7 +281,7 @@ void handle_1586(struct bregs *regs);
void useRTC(void);
void releaseRTC(void);
// timer.c
// hw/timer.c
void timer_setup(void);
void pmtimer_setup(u16 ioport);
u32 timer_calc(u32 msecs);

View File

@ -6,9 +6,9 @@
#include "bregs.h" // set_code_invalid
#include "biosvar.h" // GET_GLOBAL
#include "pci.h" // pci_find_device
#include "pci_regs.h" // PCI_VENDOR_ID
#include "pci_ids.h" // PCI_VENDOR_ID_VIA
#include "hw/pci.h" // pci_find_device
#include "hw/pci_regs.h" // PCI_VENDOR_ID
#include "hw/pci_ids.h" // PCI_VENDOR_ID_VIA
#include "util.h" // handle_155f
#include "config.h" // CONFIG_*

View File

@ -13,8 +13,8 @@
#include "config.h" // CONFIG_*
#include "biosvar.h" // GET_GLOBAL
#include "stdvga.h" // VGAREG_SEQU_ADDRESS
#include "pci.h" // pci_config_readl
#include "pci_regs.h" // PCI_BASE_ADDRESS_0
#include "hw/pci.h" // pci_config_readl
#include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0
/****************************************************************

View File

@ -11,8 +11,8 @@
#include "util.h" // dprintf
#include "bregs.h" // struct bregs
#include "stdvga.h" // VGAREG_SEQU_ADDRESS
#include "pci.h" // pci_config_readl
#include "pci_regs.h" // PCI_BASE_ADDRESS_0
#include "hw/pci.h" // pci_config_readl
#include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0
/****************************************************************

View File

@ -12,8 +12,8 @@
#include "vgabios.h" // VGAREG_*
#include "util.h" // memset
#include "stdvga.h" // stdvga_crtc_write
#include "pci.h" // pci_config_readl
#include "pci_regs.h" // PCI_BASE_ADDRESS_0
#include "hw/pci.h" // pci_config_readl
#include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0
/****************************************************************

View File

@ -15,8 +15,8 @@
#include "clext.h" // clext_1012
#include "vgahw.h" // vgahw_set_mode
#include "vbe.h" // VBE_RETURN_STATUS_FAILED
#include "pci.h" // pci_config_readw
#include "pci_regs.h" // PCI_VENDOR_ID
#include "hw/pci.h" // pci_config_readw
#include "hw/pci_regs.h" // PCI_VENDOR_ID
// Standard Video Save Pointer Table
struct VideoSavePointer_s {