Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/bmp.c | 15 +++++++++++++-- src/bmp.h | 25 ------------------------- src/boot.c | 1 - src/boot.h | 28 ---------------------------- src/bootsplash.c | 2 -- src/fw/coreboot.c | 1 - src/fw/csm.c | 2 -- src/hw/ahci.c | 1 - src/hw/ata.c | 1 - src/hw/blockcmd.c | 1 - src/hw/esp-scsi.c | 1 - src/hw/floppy.c | 1 - src/hw/lsi-scsi.c | 1 - src/hw/megasas.c | 1 - src/hw/ramdisk.c | 1 - src/hw/usb-msc.c | 2 +- src/hw/usb-uas.c | 2 +- src/hw/virtio-blk.c | 1 - src/hw/virtio-scsi.c | 1 - src/jpeg.c | 2 +- src/jpeg.h | 11 ----------- src/optionroms.c | 1 - src/post.c | 2 -- src/post.h | 10 ---------- src/util.h | 42 +++++++++++++++++++++++++++++++++++++++++- 25 files changed, 57 insertions(+), 99 deletions(-) delete mode 100644 src/bmp.h delete mode 100644 src/boot.h delete mode 100644 src/jpeg.h delete mode 100644 src/post.h
diff --git a/src/bmp.c b/src/bmp.c index 68952f6..d8e76b7 100644 --- a/src/bmp.c +++ b/src/bmp.c @@ -6,9 +6,17 @@ * * This work is licensed under the terms of the GNU LGPLv3. */ -#include "bmp.h" // struct bmp_decdata #include "malloc.h" // malloc_tmphigh #include "string.h" // memcpy +#include "util.h" // struct bmp_decdata + +struct bmp_decdata { + struct tagRGBQUAD *quadp; + unsigned char *datap; + int width; + int height; + int bpp; +};
#define bmp_load4byte(addr) (*(u32 *)(addr)) #define bmp_load2byte(addr) (*(u16 *)(addr)) @@ -59,12 +67,14 @@ static void raw_data_format_adjust_24bpp(u8 *src, u8 *dest, int width, } }
+/* allocate decdata struct */ struct bmp_decdata *bmp_alloc(void) { struct bmp_decdata *bmp = malloc_tmphigh(sizeof(*bmp)); return bmp; }
+/* extract information from bmp file data */ int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size) { if (data_size < 54) @@ -84,13 +94,14 @@ int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size) return 0; }
+/* get bmp properties */ void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height) { *width = bmp->width; *height = bmp->height; }
- +/* flush flat picture data to *pc */ int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width , int height, int depth, int bytes_per_line_dest) { diff --git a/src/bmp.h b/src/bmp.h deleted file mode 100644 index 7ae8e87..0000000 --- a/src/bmp.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef BMP_H -#define BMP_H -#include "types.h" - -struct bmp_decdata { - struct tagRGBQUAD *quadp; - unsigned char *datap; - int width; - int height; - int bpp; -}; - -/* allocate decdata struct */ -struct bmp_decdata *bmp_alloc(void); - -/* extract information from bmp file data */ -int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size); - -/* get bmp properties */ -void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height); - -/* flush flat picture data to *pc */ -int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width - , int height, int depth, int bytes_per_line_dest); -#endif diff --git a/src/boot.c b/src/boot.c index 70888e2..a2851b2 100644 --- a/src/boot.c +++ b/src/boot.c @@ -5,7 +5,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "boot.h" // boot_init #include "block.h" // struct drive_s #include "bregs.h" // struct bregs #include "config.h" // CONFIG_* diff --git a/src/boot.h b/src/boot.h deleted file mode 100644 index e6b81bd..0000000 --- a/src/boot.h +++ /dev/null @@ -1,28 +0,0 @@ -// Storage for boot definitions. -#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); -void boot_add_bcv(u16 seg, u16 ip, u16 desc, int prio); -struct drive_s; -void boot_add_floppy(struct drive_s *drive_g, const char *desc, int prio); -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 interactive_bootmenu(void); -void bcv_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); -int bootprio_find_ata_device(struct pci_device *pci, int chanid, int slave); -int bootprio_find_fdc_device(struct pci_device *pci, int port, int fdid); -int bootprio_find_pci_rom(struct pci_device *pci, int instance); -int bootprio_find_named_rom(const char *name, int instance); -struct usbdevice_s; -int bootprio_find_usb(struct usbdevice_s *usbdev, int lun); - -#endif // __BOOT_H diff --git a/src/bootsplash.c b/src/bootsplash.c index aac7ebe..fb505ce 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -5,11 +5,9 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "bmp.h" // bmp_alloc #include "bregs.h" // struct bregs #include "config.h" // CONFIG_* #include "farptr.h" // FLATPTR_TO_SEG -#include "jpeg.h" // jpeg_alloc #include "malloc.h" // free #include "output.h" // dprintf #include "romfile.h" // romfile_loadfile diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c index 7d877eb..a234e97 100644 --- a/src/fw/coreboot.c +++ b/src/fw/coreboot.c @@ -5,7 +5,6 @@ // This file may be distributed under the terms of the GNU LGPLv3 license.
#include "block.h" // MAXDESCSIZE -#include "boot.h" // boot_add_cbfs #include "byteorder.h" // be32_to_cpu #include "config.h" // CONFIG_* #include "hw/pci.h" // pci_probe_devices diff --git a/src/fw/csm.c b/src/fw/csm.c index d241b17..cd16641 100644 --- a/src/fw/csm.c +++ b/src/fw/csm.c @@ -4,7 +4,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "boot.h" #include "bregs.h" #include "config.h" // CONFIG_* #include "farptr.h" // MAKE_FLATPTR @@ -13,7 +12,6 @@ #include "malloc.h" // csm_malloc_preinit #include "memmap.h" #include "output.h" // dprintf -#include "post.h" #include "stacks.h" // wait_threads #include "std/acpi.h" // RSDP_SIGNATURE #include "std/bda.h" // struct bios_data_area_s diff --git a/src/hw/ahci.c b/src/hw/ahci.c index 6bf0bf0..05474b1 100644 --- a/src/hw/ahci.c +++ b/src/hw/ahci.c @@ -8,7 +8,6 @@ #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 "ioport.h" // inb #include "malloc.h" // free #include "output.h" // dprintf diff --git a/src/hw/ata.c b/src/hw/ata.c index 4ea6cd1..34ba119 100644 --- a/src/hw/ata.c +++ b/src/hw/ata.c @@ -9,7 +9,6 @@ #include "biosvar.h" // GET_GLOBAL #include "block.h" // struct drive_s #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 "ioport.h" // inb diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c index b9e61cd..7bdcf38 100644 --- a/src/hw/blockcmd.c +++ b/src/hw/blockcmd.c @@ -10,7 +10,6 @@ #include "biosvar.h" // GET_GLOBAL #include "block.h" // struct disk_op_s #include "blockcmd.h" // struct cdb_request_sense -#include "boot.h" // boot_add_hd #include "byteorder.h" // be32_to_cpu #include "esp-scsi.h" // esp_scsi_cmd_data #include "lsi-scsi.h" // lsi_scsi_cmd_data diff --git a/src/hw/esp-scsi.c b/src/hw/esp-scsi.c index e6533af..118a1f5 100644 --- a/src/hw/esp-scsi.c +++ b/src/hw/esp-scsi.c @@ -13,7 +13,6 @@ #include "biosvar.h" // GET_GLOBAL #include "block.h" // struct drive_s #include "blockcmd.h" // scsi_drive_setup -#include "boot.h" // bootprio_find_scsi_device #include "config.h" // CONFIG_* #include "fw/paravirt.h" // runningOnQEMU #include "malloc.h" // free diff --git a/src/hw/floppy.c b/src/hw/floppy.c index 05c518f..39efaad 100644 --- a/src/hw/floppy.c +++ b/src/hw/floppy.c @@ -7,7 +7,6 @@
#include "biosvar.h" // SET_BDA #include "block.h" // struct drive_s -#include "boot.h" // boot_add_floppy #include "bregs.h" // struct bregs #include "cmos.h" // inb_cmos #include "config.h" // CONFIG_FLOPPY diff --git a/src/hw/lsi-scsi.c b/src/hw/lsi-scsi.c index b7eb1f1..021aa61 100644 --- a/src/hw/lsi-scsi.c +++ b/src/hw/lsi-scsi.c @@ -13,7 +13,6 @@ #include "biosvar.h" // GET_GLOBAL #include "block.h" // struct drive_s #include "blockcmd.h" // scsi_drive_setup -#include "boot.h" // bootprio_find_scsi_device #include "config.h" // CONFIG_* #include "fw/paravirt.h" // runningOnQEMU #include "malloc.h" // free diff --git a/src/hw/megasas.c b/src/hw/megasas.c index 772fc75..ebc49f9 100644 --- a/src/hw/megasas.c +++ b/src/hw/megasas.c @@ -13,7 +13,6 @@ #include "biosvar.h" // GET_GLOBAL #include "block.h" // struct drive_s #include "blockcmd.h" // scsi_drive_setup -#include "boot.h" // bootprio_find_scsi_device #include "config.h" // CONFIG_* #include "malloc.h" // free #include "output.h" // dprintf diff --git a/src/hw/ramdisk.c b/src/hw/ramdisk.c index f57affd..eeddf25 100644 --- a/src/hw/ramdisk.c +++ b/src/hw/ramdisk.c @@ -6,7 +6,6 @@
#include "biosvar.h" // GET_GLOBAL #include "block.h" // struct drive_s -#include "boot.h" // boot_add_floppy #include "bregs.h" // struct bregs #include "malloc.h" // malloc_fseg #include "memmap.h" // add_e820 diff --git a/src/hw/usb-msc.c b/src/hw/usb-msc.c index 975ec7a..8ee448f 100644 --- a/src/hw/usb-msc.c +++ b/src/hw/usb-msc.c @@ -7,7 +7,6 @@ #include "biosvar.h" // GET_GLOBAL #include "block.h" // DTYPE_USB #include "blockcmd.h" // cdb_read -#include "boot.h" // bootprio_find_usb #include "config.h" // CONFIG_USB_MSC #include "malloc.h" // free #include "output.h" // dprintf @@ -15,6 +14,7 @@ #include "string.h" // memset #include "usb.h" // struct usb_s #include "usb-msc.h" // usb_msc_setup +#include "util.h" // bootprio_find_usb
struct usbdrive_s { struct drive_s drive; diff --git a/src/hw/usb-uas.c b/src/hw/usb-uas.c index 9f4b558..1a9773a 100644 --- a/src/hw/usb-uas.c +++ b/src/hw/usb-uas.c @@ -17,7 +17,6 @@ #include "biosvar.h" // GET_GLOBAL #include "block.h" // DTYPE_USB #include "blockcmd.h" // cdb_read -#include "boot.h" // bootprio_find_usb #include "config.h" // CONFIG_USB_UAS #include "malloc.h" // free #include "output.h" // dprintf @@ -25,6 +24,7 @@ #include "string.h" // memset #include "usb.h" // struct usb_s #include "usb-uas.h" // usb_uas_init +#include "util.h" // bootprio_find_usb
#define UAS_UI_COMMAND 0x01 #define UAS_UI_SENSE 0x03 diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c index c48ea45..0de83b4 100644 --- a/src/hw/virtio-blk.c +++ b/src/hw/virtio-blk.c @@ -8,7 +8,6 @@ // This file may be distributed under the terms of the GNU LGPLv3 license.
#include "biosvar.h" // GET_GLOBAL -#include "boot.h" // boot_add_hd #include "config.h" // CONFIG_* #include "block.h" // struct drive_s #include "malloc.h" // free diff --git a/src/hw/virtio-scsi.c b/src/hw/virtio-scsi.c index f50e335..7cde3bc 100644 --- a/src/hw/virtio-scsi.c +++ b/src/hw/virtio-scsi.c @@ -10,7 +10,6 @@ #include "biosvar.h" // GET_GLOBAL #include "block.h" // struct drive_s #include "blockcmd.h" // scsi_drive_setup -#include "boot.h" // bootprio_find_scsi_device #include "config.h" // CONFIG_* #include "malloc.h" // free #include "output.h" // dprintf diff --git a/src/jpeg.c b/src/jpeg.c index 925aa3d..c2138ed 100644 --- a/src/jpeg.c +++ b/src/jpeg.c @@ -41,8 +41,8 @@
#define __LITTLE_ENDIAN #include "malloc.h" -#include "jpeg.h" #include "string.h" +#include "util.h" #define ISHIFT 11
#define IFIX(a) ((int)((a) * (1 << ISHIFT) + .5)) diff --git a/src/jpeg.h b/src/jpeg.h deleted file mode 100644 index 2d08f45..0000000 --- a/src/jpeg.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __JPEG_H -#define __JPEG_H - -struct jpeg_decdata; -struct jpeg_decdata *jpeg_alloc(void); -int jpeg_decode(struct jpeg_decdata *jpeg, unsigned char *buf); -void jpeg_get_size(struct jpeg_decdata *jpeg, int *width, int *height); -int jpeg_show(struct jpeg_decdata *jpeg, unsigned char *pic, int width - , int height, int depth, int bytes_per_line_dest); - -#endif diff --git a/src/optionroms.c b/src/optionroms.c index 04afb2c..d7c8aef 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -5,7 +5,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "boot.h" // IPL #include "bregs.h" // struct bregs #include "config.h" // CONFIG_* #include "farptr.h" // FLATPTR_TO_SEG diff --git a/src/post.c b/src/post.c index 512c716..592176d 100644 --- a/src/post.c +++ b/src/post.c @@ -6,7 +6,6 @@ // This file may be distributed under the terms of the GNU LGPLv3 license.
#include "biosvar.h" // SET_BDA -#include "boot.h" // boot_init #include "bregs.h" // struct bregs #include "config.h" // CONFIG_* #include "fw/paravirt.h" // qemu_cfg_preinit @@ -25,7 +24,6 @@ #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/post.h b/src/post.h deleted file mode 100644 index 5536eb9..0000000 --- a/src/post.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __POST_H -#define __POST_H - -void interface_init(void); -void device_hardware_setup(void); -void prepareboot(void); -void startBoot(void); -void reloc_preinit(void *f, void *arg); - -#endif // __POST_H diff --git a/src/util.h b/src/util.h index 32a4af4..79a2e7f 100644 --- a/src/util.h +++ b/src/util.h @@ -69,6 +69,40 @@ int irqtimer_check(u32 end); void apm_shutdown(void); void handle_1553(struct bregs *regs);
+// bmp.c +struct bmp_decdata *bmp_alloc(void); +int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size); +void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height); +int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width + , int height, int depth, int bytes_per_line_dest); + +// boot.c +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); +void boot_add_floppy(struct drive_s *drive_g, const char *desc, int prio); +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 interactive_bootmenu(void); +void bcv_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); +int bootprio_find_ata_device(struct pci_device *pci, int chanid, int slave); +int bootprio_find_fdc_device(struct pci_device *pci, int port, int fdid); +int bootprio_find_pci_rom(struct pci_device *pci, int instance); +int bootprio_find_named_rom(const char *name, int instance); +struct usbdevice_s; +int bootprio_find_usb(struct usbdevice_s *usbdev, int lun); + +// jpeg.c +struct jpeg_decdata *jpeg_alloc(void); +int jpeg_decode(struct jpeg_decdata *jpeg, unsigned char *buf); +void jpeg_get_size(struct jpeg_decdata *jpeg, int *width, int *height); +int jpeg_show(struct jpeg_decdata *jpeg, unsigned char *pic, int width + , int height, int depth, int bytes_per_line_dest); + // optionroms.c struct rom_header; void callrom(struct rom_header *rom, u16 bdf); @@ -77,6 +111,13 @@ void callrom(struct rom_header *rom, u16 bdf); void handle_1ab1(struct bregs *regs); void bios32_init(void);
+// post.c +void interface_init(void); +void device_hardware_setup(void); +void prepareboot(void); +void startBoot(void); +void reloc_preinit(void *f, void *arg); + // fw/acpi.c extern struct rsdp_descriptor *RsdpAddr; extern u32 acpi_pm1a_cnt; @@ -88,7 +129,6 @@ void acpi_set_reset_reg(struct acpi_20_generic_address *reg, u8 val); void acpi_reboot(void);
// fw/csm.c -struct pci_device; int csm_bootprio_fdc(struct pci_device *pci, int port, int fdid); int csm_bootprio_ata(struct pci_device *pci, int chanid, int slave); int csm_bootprio_pci(struct pci_device *pci);