[SeaBIOS] [PATCH 23/23] Sort the sections of util.h.
Signed-off-by: Kevin O'Connor --- src/util.h | 238 ++--- 1 file changed, 119 insertions(+), 119 deletions(-) diff --git a/src/util.h b/src/util.h index 79a2e7f..880c04a 100644 --- a/src/util.h +++ b/src/util.h @@ -4,69 +4,9 @@ #include "types.h" // u32 -// kbd.c -void kbd_init(void); -struct bregs; -void handle_15c2(struct bregs *regs); -void process_key(u8 key); - -// mouse.c -void mouse_init(void); -void process_mouse(u8 data); - -// serial.c -void serial_setup(void); -void lpt_setup(void); - -// cdrom.c -extern u8 CDRom_locks[]; -extern struct cdemu_s CDEmu; -extern struct drive_s *cdemu_drive_gf; -struct disk_op_s; -int process_cdemu_op(struct disk_op_s *op); -void cdrom_prepboot(void); -void cdemu_134b(struct bregs *regs); -int cdrom_boot(struct drive_s *drive_g); - -// clock.c -void clock_setup(void); -void handle_1583(struct bregs *regs); -void handle_1586(struct bregs *regs); -void useRTC(void); -void releaseRTC(void); - -// hw/floppy.c -extern struct floppy_ext_dbt_s diskette_param_table2; -void floppy_setup(void); -struct drive_s *init_floppy(int floppyid, int ftype); -int find_floppy_type(u32 size); -int process_floppy_op(struct disk_op_s *op); -void floppy_tick(void); - -// hw/ramdisk.c -void ramdisk_setup(void); -int process_ramdisk_op(struct disk_op_s *op); - -// hw/timer.c -void timer_setup(void); -void pmtimer_setup(u16 ioport); -u32 timer_calc(u32 msecs); -u32 timer_calc_usec(u32 usecs); -int timer_check(u32 end); -void ndelay(u32 count); -void udelay(u32 count); -void mdelay(u32 count); -void nsleep(u32 count); -void usleep(u32 count); -void msleep(u32 count); -u32 ticks_to_ms(u32 ticks); -u32 ticks_from_ms(u32 ms); -u32 irqtimer_calc_ticks(u32 count); -u32 irqtimer_calc(u32 msecs); -int irqtimer_check(u32 end); - // apm.c void apm_shutdown(void); +struct bregs; void handle_1553(struct bregs *regs); // bmp.c @@ -80,6 +20,7 @@ int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width 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); @@ -96,27 +37,27 @@ 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); +// bootsplash.c +void enable_vga_console(void); +void enable_bootsplash(void); +void disable_bootsplash(void); -// pcibios.c -void handle_1ab1(struct bregs *regs); -void bios32_init(void); +// cdrom.c +extern u8 CDRom_locks[]; +extern struct cdemu_s CDEmu; +extern struct drive_s *cdemu_drive_gf; +struct disk_op_s; +int process_cdemu_op(struct disk_op_s *op); +void cdrom_prepboot(void); +void cdemu_134b(struct bregs *regs); +int cdrom_boot(struct drive_s *drive_g); -// post.c -void interface_init(void); -void device_hardware_setup(void); -void prepareboot(void); -void startBoot(void); -void reloc_preinit(void *f, void *arg); +// clock.c +void clock_setup(void); +void handle_1583(struct bregs *regs); +void handle_1586(struct bregs *regs); +void useRTC(void); +void releaseRTC(void); // fw/acpi.c extern struct rsdp_descriptor *RsdpAddr; @@ -128,6 +69,20 @@ struct acpi_20_generic_address; void acpi_set_reset_reg(struct acpi_20_generic_address *reg, u8 val); void acpi_reboot(void); +// fw/biostable.c +void copy_smbios(void *pos); +void copy_table(void *pos); + +// fw/coreboot.c +extern const char *CBvendor, *CBpart; +struct cbfs_file; +void debug_cbmem(char c); +void cbfs_run_payload(struct cbfs_file *file); +void coreboot_platform_setup(void); +void cbfs_payload_setup(void); +void coreboot_preinit(void); +void coreboot_cbfs_init(void); + // fw/csm.c int csm_bootprio_fdc(struct pci_device *pci, int port, int fdid); int csm_bootprio_ata(struct pci_device *pci, int chanid, int slave); @@ -136,6 +91,17 @@ int csm_bootprio_pci(struct pci_device *pci); // fw/mptable.c void mptable_setup(void); +// fw/mtrr.c +void mtrr_setup(void); + +// fw/pciinit.c +extern const u8 pci_irqs[4]; +void pci_setup(void); + +// fw/pirtable.c +extern struct pir_header *PirAddr; +void pirtable_setup(void); + // fw/shadow.c void make_bios_writable(void); void make_bios_readonly(void); @@ -146,14 +112,6 @@ extern struct smbios_entry_point *SMBiosAddr; void smbios_setup(void); void display_uuid(void); -/
[SeaBIOS] [PATCH 22/23] Merge bmp.h, boot.h, jpeg.h, and post.h into util.h.
Signed-off-by: Kevin O'Connor --- 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..000 --- 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..000 --- 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
[SeaBIOS] [PATCH 20/23] Split disk.h into block.h and std/disk.h.
Signed-off-by: Kevin O'Connor --- src/block.c | 35 ++- src/block.h | 129 +++ src/boot.c | 3 +- src/cdrom.c | 19 +--- src/clock.c | 1 - src/disk.c | 28 + src/disk.h | 290 --- src/fw/coreboot.c| 2 +- src/hw/ahci.c| 2 +- src/hw/ahci.h| 2 +- src/hw/ata.c | 3 +- src/hw/ata.h | 4 +- src/hw/blockcmd.c| 3 +- src/hw/esp-scsi.c| 3 +- src/hw/floppy.c | 3 +- src/hw/lsi-scsi.c| 3 +- src/hw/megasas.c | 3 +- src/hw/ramdisk.c | 4 +- src/hw/usb-msc.c | 3 +- src/hw/usb-uas.c | 3 +- src/hw/virtio-blk.c | 3 +- src/hw/virtio-scsi.c | 3 +- src/post.c | 1 - src/std/disk.h | 161 src/util.h | 22 25 files changed, 381 insertions(+), 352 deletions(-) create mode 100644 src/block.h delete mode 100644 src/disk.h create mode 100644 src/std/disk.h diff --git a/src/block.c b/src/block.c index 73d6068..4560b24 100644 --- a/src/block.c +++ b/src/block.c @@ -6,7 +6,8 @@ // This file may be distributed under the terms of the GNU LGPLv3 license. #include "biosvar.h" // GET_GLOBAL -#include "disk.h" // struct ata_s +#include "block.h" // process_op +#include "bregs.h" // struct bregs #include "hw/ata.h" // process_ata_op #include "hw/ahci.h" // process_ahci_op #include "hw/cmos.h" // inb_cmos @@ -15,7 +16,9 @@ #include "malloc.h" // malloc_low #include "output.h" // dprintf #include "stacks.h" // stack_hop +#include "std/disk.h" // struct dpte_s #include "string.h" // checksum +#include "util.h" // process_floppy_op u8 FloppyCount VARFSEG; u8 CDCount; @@ -277,6 +280,36 @@ map_floppy_drive(struct drive_s *drive_g) / + * Return status functions + / + +void +__disk_ret(struct bregs *regs, u32 linecode, const char *fname) +{ +u8 code = linecode; +if (regs->dl < EXTSTART_HD) +SET_BDA(floppy_last_status, code); +else +SET_BDA(disk_last_status, code); +if (code) +__set_code_invalid(regs, linecode, fname); +else +set_code_success(regs); +} + +void +__disk_ret_unimplemented(struct bregs *regs, u32 linecode, const char *fname) +{ +u8 code = linecode; +if (regs->dl < EXTSTART_HD) +SET_BDA(floppy_last_status, code); +else +SET_BDA(disk_last_status, code); +__set_code_unimplemented(regs, linecode, fname); +} + + +/ * 16bit calling interface / diff --git a/src/block.h b/src/block.h new file mode 100644 index 000..3492806 --- /dev/null +++ b/src/block.h @@ -0,0 +1,129 @@ +#ifndef __BLOCK_H +#define __BLOCK_H + +#include "types.h" // u32 + + +/ + * Disk command request + / + +struct disk_op_s { +u64 lba; +void *buf_fl; +struct drive_s *drive_g; +u16 count; +u8 command; +}; + +#define CMD_RESET 0x00 +#define CMD_READ0x02 +#define CMD_WRITE 0x03 +#define CMD_VERIFY 0x04 +#define CMD_FORMAT 0x05 +#define CMD_SEEK0x07 +#define CMD_ISREADY 0x10 + + +/ + * Global storage + / + +struct chs_s { +u16 heads; // # heads +u16 cylinders; // # cylinders +u16 spt;// # sectors / track +u16 pad; +}; + +// ElTorito Device Emulation data +struct cdemu_s { +struct drive_s *emulated_drive_gf; +u32 ilba; +u16 buffer_segment; +u16 load_segment; +u16 sector_count; +u8 active; +u8 media; +u8 emulated_extdrive; + +// Virtual device +struct chs_s lchs; +}; + +struct drive_s { +u8 type;// Driver type (DTYPE_*) +u8 floppy_type; // Type of floppy (only for floppy drives). +struct chs_s lchs; // Logical CHS +u64 sectors;// Total sectors count +u32 cntl_id;// Unique id for a given driver type. +u8 removable; // Is media removable (currently unused) + +// Info for EDD calls +u8 translation; // type of translation +u16 blksize;// block size +struct chs_s pchs; // Physical CHS +}; + +#define DISK_SECTOR_SIZE 512 +#define CDROM_SECTOR_SIZE 2048 + +#define DTYPE_NONE 0x00 +#define DTYPE_FLOPPY 0x01 +#define DTYPE_ATA 0x02 +#define DTYPE_ATA_ATAPI0x03 +#define DTYPE_RAMDISK 0x04 +#define DTYPE_CDEMU0x05 +#define DTYPE_AHCI 0x06 +#define DTYPE_AHCI_ATAPI 0x07 +#define DTYPE_VIRTIO_SCSI 0x08 +#define D
[SeaBIOS] [PATCH 19/23] Move pmm definitions to new file std/pmm.h.
Signed-off-by: Kevin O'Connor --- src/pmm.c | 14 +- src/std/pmm.h | 19 +++ 2 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 src/std/pmm.h diff --git a/src/pmm.c b/src/pmm.c index cce0f29..be03bdb 100644 --- a/src/pmm.c +++ b/src/pmm.c @@ -8,23 +8,13 @@ #include "config.h" // CONFIG_* #include "malloc.h" // _malloc #include "output.h" // dprintf +#include "std/pmm.h" // PMM_SIGNATURE #include "string.h" // checksum #include "util.h" // pmm_init #include "x86.h" // __ffs -struct pmmheader { -u32 signature; -u8 version; -u8 length; -u8 checksum; -struct segoff_s entry; -u8 reserved[5]; -} PACKED; - extern struct pmmheader PMMHEADER; -#define PMM_SIGNATURE 0x4d4d5024 // $PMM - #if CONFIG_PMM struct pmmheader PMMHEADER __aligned(16) VARFSEG = { .signature = PMM_SIGNATURE, @@ -33,8 +23,6 @@ struct pmmheader PMMHEADER __aligned(16) VARFSEG = { }; #endif -#define PMM_FUNCTION_NOT_SUPPORTED 0x - // PMM - allocate static u32 handle_pmm00(u16 *args) diff --git a/src/std/pmm.h b/src/std/pmm.h new file mode 100644 index 000..80027f3 --- /dev/null +++ b/src/std/pmm.h @@ -0,0 +1,19 @@ +#ifndef __PMM_H +#define __PMM_H + +#include "types.h" // u32 + +#define PMM_SIGNATURE 0x4d4d5024 // $PMM + +struct pmmheader { +u32 signature; +u8 version; +u8 length; +u8 checksum; +struct segoff_s entry; +u8 reserved[5]; +} PACKED; + +#define PMM_FUNCTION_NOT_SUPPORTED 0x + +#endif // pmm.h -- 1.8.3.1 ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH 21/23] Move standard bda type info from biosvar.h to std/bda.h.
Signed-off-by: Kevin O'Connor --- src/biosvar.h | 161 ++--- src/fw/csm.c | 3 +- src/post.c | 2 +- src/resume.c | 4 +- src/std/bda.h | 159 src/std/disk.h | 16 ++ src/system.c | 2 +- src/util.h | 3 +- 8 files changed, 188 insertions(+), 162 deletions(-) create mode 100644 src/std/bda.h diff --git a/src/biosvar.h b/src/biosvar.h index e49a10a..051cd1e 100644 --- a/src/biosvar.h +++ b/src/biosvar.h @@ -1,24 +1,20 @@ -// Variable layouts of bios. +// Memory access to BIOS variables. // -// Copyright (C) 2008-2010 Kevin O'Connor +// Copyright (C) 2008-2013 Kevin O'Connor // // This file may be distributed under the terms of the GNU LGPLv3 license. #ifndef __BIOSVAR_H #define __BIOSVAR_H -#include "types.h" // u8 -#include "farptr.h" // GET_FARVAR #include "config.h" // SEG_BDA +#include "farptr.h" // GET_FARVAR +#include "std/bda.h" // struct bios_data_area_s / * Interupt vector table / -struct rmode_IVT { -struct segoff_s ivec[256]; -}; - #define GET_IVT(vector) \ GET_FARVAR(SEG_IVT, ((struct rmode_IVT *)0)->ivec[vector]) #define SET_IVT(vector, segoff) \ @@ -35,106 +31,6 @@ struct rmode_IVT { * Bios Data Area (BDA) / -struct bios_data_area_s { -// 40:00 -u16 port_com[4]; -u16 port_lpt[3]; -u16 ebda_seg; -// 40:10 -u16 equipment_list_flags; -u8 pad1; -u16 mem_size_kb; -u8 pad2; -u8 ps2_ctrl_flag; -u8 kbd_flag0; -u8 kbd_flag1; -u8 alt_keypad; -u16 kbd_buf_head; -u16 kbd_buf_tail; -// 40:1e -u8 kbd_buf[32]; -u8 floppy_recalibration_status; -u8 floppy_motor_status; -// 40:40 -u8 floppy_motor_counter; -u8 floppy_last_status; -u8 floppy_return_status[7]; -u8 video_mode; -u16 video_cols; -u16 video_pagesize; -u16 video_pagestart; -// 40:50 -u16 cursor_pos[8]; -// 40:60 -u16 cursor_type; -u8 video_page; -u16 crtc_address; -u8 video_msr; -u8 video_pal; -struct segoff_s jump; -u8 other_6b; -u32 timer_counter; -// 40:70 -u8 timer_rollover; -u8 break_flag; -u16 soft_reset_flag; -u8 disk_last_status; -u8 hdcount; -u8 disk_control_byte; -u8 port_disk; -u8 lpt_timeout[4]; -u8 com_timeout[4]; -// 40:80 -u16 kbd_buf_start_offset; -u16 kbd_buf_end_offset; -u8 video_rows; -u16 char_height; -u8 video_ctl; -u8 video_switches; -u8 modeset_ctl; -u8 dcc_index; -u8 floppy_last_data_rate; -u8 disk_status_controller; -u8 disk_error_controller; -u8 disk_interrupt_flag; -u8 floppy_harddisk_info; -// 40:90 -u8 floppy_media_state[4]; -u8 floppy_track[2]; -u8 kbd_flag2; -u8 kbd_led; -struct segoff_s user_wait_complete_flag; -u32 user_wait_timeout; -// 40:A0 -u8 rtc_wait_flag; -u8 other_a1[7]; -struct segoff_s video_savetable; -u8 other_ac[4]; -// 40:B0 -u8 other_b0[9]; -u8 vbe_flag; -u16 vbe_mode; -u8 other_bc[4]; -// 40:C0 -u8 other_c0[4*16]; -} PACKED; - -// BDA floppy_recalibration_status bitdefs -#define FRS_IRQ (1<<7) - -// BDA rtc_wait_flag bitdefs -#define RWS_WAIT_PENDING (1<<0) -#define RWS_WAIT_ELAPSED (1<<7) - -// BDA floppy_media_state bitdefs -#define FMS_DRIVE_STATE_MASK(0x07) -#define FMS_MEDIA_DRIVE_ESTABLISHED (1<<4) -#define FMS_DOUBLE_STEPPING (1<<5) -#define FMS_DATA_RATE_MASK (0xc0) - -// Limit of BDA timer_counter field -#define TICKS_PER_DAY 1573040 - // Accessor functions #define GET_BDA(var) \ GET_FARVAR(SEG_BDA, ((struct bios_data_area_s *)0)->var) @@ -152,40 +48,6 @@ static inline void set_equipment_flags(u16 clear, u16 set) { * Extended Bios Data Area (EBDA) / -struct fdpt_s { -u16 cylinders; -u8 heads; -u8 a0h_signature; -u8 phys_sectors; -u16 precompensation; -u8 reserved; -u8 drive_control_byte; -u16 phys_cylinders; -u8 phys_heads; -u16 landing_zone; -u8 sectors; -u8 checksum; -} PACKED; - -struct extended_bios_data_area_s { -u8 size; -u8 reserved1[0x21]; -struct segoff_s far_call_pointer; -u8 mouse_flag1; -u8 mouse_flag2; -u8 mouse_data[0x08]; -// 0x30 -u8 other1[0x0d]; - -// 0x3d -struct fdpt_s fdpt[2]; - -// 0x5d -u8 other2[0xC4]; - -// 0x121 - Begin custom storage. -} PACKED; - // The initial size and location of EBDA #define EBDA_SIZE_START \ DIV_ROUND_UP(sizeof(struct extended_bios_data_area_s), 1024) @@ -269,19 +131,4 @@ exter
[SeaBIOS] [PATCH 16/23] Move fw/mptable.h to std/mptable.h.
Signed-off-by: Kevin O'Connor --- src/fw/biostables.c | 2 +- src/fw/mptable.c | 2 +- src/fw/paravirt.c | 1 - src/{fw => std}/mptable.h | 3 --- src/util.h| 3 +++ 5 files changed, 5 insertions(+), 6 deletions(-) rename src/{fw => std}/mptable.h (96%) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 5200e65..fea7511 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -7,8 +7,8 @@ #include "acpi.h" // struct rsdp_descriptor #include "config.h" // CONFIG_* #include "malloc.h" // malloc_fseg -#include "mptable.h" // MPTABLE_SIGNATURE #include "output.h" // dprintf +#include "std/mptable.h" // MPTABLE_SIGNATURE #include "std/pirtable.h" // struct pir_header #include "std/smbios.h" // struct smbios_entry_point #include "string.h" // memcpy diff --git a/src/fw/mptable.c b/src/fw/mptable.c index 9877bae..b453469 100644 --- a/src/fw/mptable.c +++ b/src/fw/mptable.c @@ -9,9 +9,9 @@ #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 "std/mptable.h" // MPTABLE_SIGNATURE #include "string.h" // memset #include "util.h" // MaxCountCPUs #include "x86.h" // cpuid diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c index a49c80a..573511c 100644 --- a/src/fw/paravirt.c +++ b/src/fw/paravirt.c @@ -16,7 +16,6 @@ #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 diff --git a/src/fw/mptable.h b/src/std/mptable.h similarity index 96% rename from src/fw/mptable.h rename to src/std/mptable.h index 6252854..fa6a229 100644 --- a/src/fw/mptable.h +++ b/src/std/mptable.h @@ -74,7 +74,4 @@ struct mpt_intsrc { u8 dstirq; } PACKED; -// mptable.c -void mptable_setup(void); - #endif // mptable.h diff --git a/src/util.h b/src/util.h index 0b3a8e7..ab45ac6 100644 --- a/src/util.h +++ b/src/util.h @@ -61,6 +61,9 @@ 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); +// fw/mptable.c +void mptable_setup(void); + // fw/shadow.c void make_bios_writable(void); void make_bios_readonly(void); -- 1.8.3.1 ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH 15/23] Move fw/smbios.h to std/smbios.h.
Signed-off-by: Kevin O'Connor --- src/bootsplash.c | 1 - src/fw/biostables.c | 2 +- src/fw/coreboot.c| 1 - src/fw/csm.c | 1 - src/fw/paravirt.c| 1 - src/fw/smbios.c | 2 +- src/{fw => std}/smbios.h | 6 +- src/util.h | 5 + 8 files changed, 8 insertions(+), 11 deletions(-) rename src/{fw => std}/smbios.h (97%) diff --git a/src/bootsplash.c b/src/bootsplash.c index 3c08f5d..aac7ebe 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -9,7 +9,6 @@ #include "bregs.h" // struct bregs #include "config.h" // CONFIG_* #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 diff --git a/src/fw/biostables.c b/src/fw/biostables.c index a51e8ee..5200e65 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -9,8 +9,8 @@ #include "malloc.h" // malloc_fseg #include "mptable.h" // MPTABLE_SIGNATURE #include "output.h" // dprintf -#include "smbios.h" // struct smbios_entry_point #include "std/pirtable.h" // struct pir_header +#include "std/smbios.h" // struct smbios_entry_point #include "string.h" // memcpy #include "util.h" // copy_table diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c index c82dd4e..5daed86 100644 --- a/src/fw/coreboot.c +++ b/src/fw/coreboot.c @@ -16,7 +16,6 @@ #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 7829c1e..eca97a7 100644 --- a/src/fw/csm.c +++ b/src/fw/csm.c @@ -15,7 +15,6 @@ #include "memmap.h" #include "output.h" // dprintf #include "post.h" -#include "smbios.h" #include "stacks.h" // wait_threads #include "std/optionrom.h" // struct rom_header #include "util.h" // copy_smbios diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c index b76c1db..a49c80a 100644 --- a/src/fw/paravirt.c +++ b/src/fw/paravirt.c @@ -20,7 +20,6 @@ #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 diff --git a/src/fw/smbios.c b/src/fw/smbios.c index a8969da..affb9be 100644 --- a/src/fw/smbios.c +++ b/src/fw/smbios.c @@ -10,7 +10,7 @@ #include "output.h" // dprintf #include "paravirt.h" // RamSize #include "romfile.h" // romfile_findprefix -#include "smbios.h" // struct smbios_entry_point +#include "std/smbios.h" // struct smbios_entry_point #include "string.h" // memset #include "util.h" // MaxCountCPUs #include "x86.h" // cpuid diff --git a/src/fw/smbios.h b/src/std/smbios.h similarity index 97% rename from src/fw/smbios.h rename to src/std/smbios.h index a4c1444..0513716 100644 --- a/src/fw/smbios.h +++ b/src/std/smbios.h @@ -1,8 +1,7 @@ #ifndef __SMBIOS_H #define __SMBIOS_H -// smbios.c -void smbios_setup(void); +#include "types.h" // u32 /* SMBIOS entry point -- must be written to a 16-bit aligned address between 0xf and 0xf. @@ -24,8 +23,6 @@ struct smbios_entry_point { u8 smbios_bcd_revision; } PACKED; -extern struct smbios_entry_point *SMBiosAddr; - /* This goes at the beginning of every SMBIOS structure. */ struct smbios_structure_header { u8 type; @@ -165,5 +162,4 @@ struct smbios_type_127 { struct smbios_structure_header header; } PACKED; -void display_uuid(void); #endif // smbios.h diff --git a/src/util.h b/src/util.h index dfd6faf..0b3a8e7 100644 --- a/src/util.h +++ b/src/util.h @@ -66,6 +66,11 @@ void make_bios_writable(void); void make_bios_readonly(void); void qemu_prep_reset(void); +// fw/smbios.c +extern struct smbios_entry_point *SMBiosAddr; +void smbios_setup(void); +void display_uuid(void); + // fw/pciinit.c extern const u8 pci_irqs[4]; void pci_setup(void); -- 1.8.3.1 ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH 18/23] Move pnpbios definition to new file std/pnpbios.h.
Signed-off-by: Kevin O'Connor --- src/optionroms.c | 1 + src/pnpbios.c | 19 +-- src/std/pnpbios.h | 24 src/util.h| 1 - 4 files changed, 26 insertions(+), 19 deletions(-) create mode 100644 src/std/pnpbios.h diff --git a/src/optionroms.c b/src/optionroms.c index 8f9bb31..04afb2c 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -17,6 +17,7 @@ #include "romfile.h" // romfile_loadint #include "stacks.h" // farcall16big #include "std/optionrom.h" // struct rom_header +#include "std/pnpbios.h" // PNP_SIGNATURE #include "string.h" // memset #include "util.h" // get_pnp_offset diff --git a/src/pnpbios.c b/src/pnpbios.c index 87eea9f..95ce21f 100644 --- a/src/pnpbios.c +++ b/src/pnpbios.c @@ -7,25 +7,10 @@ #include "config.h" // BUILD_BIOS_ADDR #include "farptr.h" // SET_FARVAR #include "output.h" // dprintf +#include "std/pnpbios.h" // PNP_SIGNATURE #include "string.h" // checksum #include "util.h" // pnp_init -struct pnpheader { -u32 signature; -u8 version; -u8 length; -u16 control; -u8 checksum; -u32 eventloc; -u16 real_ip; -u16 real_cs; -u16 prot_ip; -u32 prot_base; -u32 oemid; -u16 real_ds; -u32 prot_database; -} PACKED; - extern struct pnpheader PNPHEADER; extern char pnp_string[]; @@ -46,8 +31,6 @@ struct pnpheader PNPHEADER __aligned(16) VARFSEG = { char pnp_string[] __aligned(2) VARFSEG = " $PnP"; #endif -#define FUNCTION_NOT_SUPPORTED 0x82 - // BBS - Get Version and Installation Check static u16 handle_pnp60(u16 *args) diff --git a/src/std/pnpbios.h b/src/std/pnpbios.h new file mode 100644 index 000..0871e3a --- /dev/null +++ b/src/std/pnpbios.h @@ -0,0 +1,24 @@ +#ifndef __PNPHEADER_H +#define __PNPHEADER_H + +#define PNP_SIGNATURE 0x506e5024 // $PnP + +struct pnpheader { +u32 signature; +u8 version; +u8 length; +u16 control; +u8 checksum; +u32 eventloc; +u16 real_ip; +u16 real_cs; +u16 prot_ip; +u32 prot_base; +u32 oemid; +u16 real_ds; +u32 prot_database; +} PACKED; + +#define FUNCTION_NOT_SUPPORTED 0x82 + +#endif // pnpheader.h diff --git a/src/util.h b/src/util.h index 95be57f..333d116 100644 --- a/src/util.h +++ b/src/util.h @@ -139,7 +139,6 @@ extern int HaveRunPost; void dma_setup(void); // pnpbios.c -#define PNP_SIGNATURE 0x506e5024 // $PnP u16 get_pnp_offset(void); void pnp_init(void); -- 1.8.3.1 ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH 17/23] Move fw/acpi.h to std/acpi.h.
Signed-off-by: Kevin O'Connor --- src/apm.c | 1 - src/byteorder.h| 2 ++ src/fw/acpi.c | 4 +++- src/fw/biostables.c| 2 +- src/fw/coreboot.c | 1 - src/fw/csm.c | 2 +- src/fw/paravirt.c | 1 - src/fw/pciinit.c | 1 - src/fw/xen.c | 1 - src/resume.c | 1 - src/{fw => std}/acpi.h | 10 -- src/util.h | 10 ++ 12 files changed, 17 insertions(+), 19 deletions(-) rename src/{fw => std}/acpi.h (96%) diff --git a/src/apm.c b/src/apm.c index b4b9ed9..7f400fb 100644 --- a/src/apm.c +++ b/src/apm.c @@ -9,7 +9,6 @@ #include "biosvar.h" // GET_GLOBAL #include "bregs.h" // struct bregs #include "config.h" // CONFIG_* -#include "fw/acpi.h" // acpi_pm_ctl #include "fw/paravirt.h" // runningOnQEMU #include "ioport.h" // outb #include "output.h" // dprintf diff --git a/src/byteorder.h b/src/byteorder.h index 7362aeb..928c1b8 100644 --- a/src/byteorder.h +++ b/src/byteorder.h @@ -1,6 +1,8 @@ #ifndef __BYTEORDER_H #define __BYTEORDER_H +#include "types.h" // u32 + static inline u16 __swab16_constant(u16 val) { return (val<<8) | (val>>8); } diff --git a/src/fw/acpi.c b/src/fw/acpi.c index cba3f68..8f99b34 100644 --- a/src/fw/acpi.c +++ b/src/fw/acpi.c @@ -5,7 +5,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license. -#include "acpi.h" // struct rsdp_descriptor #include "byteorder.h" // cpu_to_le16 #include "config.h" // CONFIG_* #include "dev-q35.h" @@ -17,6 +16,7 @@ #include "output.h" // dprintf #include "paravirt.h" // RamSize #include "romfile.h" // romfile_loadint +#include "std/acpi.h" // struct rsdp_descriptor #include "string.h" // memset #include "util.h" // MaxCountCPUs #include "x86.h" // readl @@ -756,6 +756,8 @@ find_acpi_features(void) static struct acpi_20_generic_address acpi_reset_reg; static u8 acpi_reset_val; +#define acpi_ga_to_bdf(addr) pci_to_bdf(0, (addr >> 32) & 0x, (addr >> 16) & 0x) + void acpi_reboot(void) { diff --git a/src/fw/biostables.c b/src/fw/biostables.c index fea7511..a3ee827 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -4,10 +4,10 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license. -#include "acpi.h" // struct rsdp_descriptor #include "config.h" // CONFIG_* #include "malloc.h" // malloc_fseg #include "output.h" // dprintf +#include "std/acpi.h" // struct rsdp_descriptor #include "std/mptable.h" // MPTABLE_SIGNATURE #include "std/pirtable.h" // struct pir_header #include "std/smbios.h" // struct smbios_entry_point diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c index 5daed86..e9874e2 100644 --- a/src/fw/coreboot.c +++ b/src/fw/coreboot.c @@ -4,7 +4,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license. -#include "acpi.h" // find_acpi_features #include "boot.h" // boot_add_cbfs #include "byteorder.h" // be32_to_cpu #include "config.h" // CONFIG_* diff --git a/src/fw/csm.c b/src/fw/csm.c index eca97a7..dda6af4 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 "acpi.h" #include "biosvar.h" #include "boot.h" #include "bregs.h" @@ -16,6 +15,7 @@ #include "output.h" // dprintf #include "post.h" #include "stacks.h" // wait_threads +#include "std/acpi.h" // RSDP_SIGNATURE #include "std/optionrom.h" // struct rom_header #include "util.h" // copy_smbios diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c index 573511c..2524b7b 100644 --- a/src/fw/paravirt.c +++ b/src/fw/paravirt.c @@ -8,7 +8,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license. -#include "acpi.h" // acpi_setup #include "byteorder.h" // be32_to_cpu #include "config.h" // CONFIG_QEMU #include "hw/cmos.h" // CMOS_* diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index 834847b..b29db99 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -5,7 +5,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license. -#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 diff --git a/src/fw/xen.c b/src/fw/xen.c index 9252721..9b00030 100644 --- a/src/fw/xen.c +++ b/src/fw/xen.c @@ -4,7 +4,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license. -#include "acpi.h" // find_acpi_features #include "config.h" #include "malloc.h" // memalign_high #include "memmap.h" // add_e820 diff --git a/src/resume.c b/src/resume.c index 31643a7..96c63d5 100644 --- a/src/resume.c +++ b/src/resume.c @@ -6,7 +6,6 @@ #include "biosvar.h" // struct bios_data_area_s #include "bregs.h" // struct bregs -#include "fw/acpi.h" // find_resume_vector #include "hw/cmos.h" // inb_cmos #include "hw/pci.h" // pci_reboot #include "hw/pic.h" // pic_eoi2 diff --git a/src/fw/acpi
[SeaBIOS] [PATCH 12/23] Move optionroms.h to std/optionrom.h and util.h.
Signed-off-by: Kevin O'Connor --- src/fw/csm.c | 2 +- src/malloc.c | 2 +- src/optionroms.c | 2 +- src/{optionroms.h => std/optionrom.h} | 3 --- src/util.h| 4 vgasrc/vgabios.c | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) rename src/{optionroms.h => std/optionrom.h} (95%) diff --git a/src/fw/csm.c b/src/fw/csm.c index 7a926b1..b98dc96 100644 --- a/src/fw/csm.c +++ b/src/fw/csm.c @@ -14,11 +14,11 @@ #include "hw/pic.h" #include "malloc.h" // csm_malloc_preinit #include "memmap.h" -#include "optionroms.h" #include "output.h" // dprintf #include "post.h" #include "smbios.h" #include "stacks.h" // wait_threads +#include "std/optionrom.h" // struct rom_header #include "util.h" // copy_smbios struct rsdp_descriptor csm_rsdp VARFSEG __aligned(16); diff --git a/src/malloc.c b/src/malloc.c index 65a0bb1..281f41e 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -9,9 +9,9 @@ #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 "std/optionrom.h" // OPTION_ROM_ALIGN #include "string.h" // memset // Information on a reserved area. diff --git a/src/optionroms.c b/src/optionroms.c index b38e44e..8f9bb31 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -13,10 +13,10 @@ #include "hw/pci_ids.h" // PCI_CLASS_DISPLAY_VGA #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 "std/optionrom.h" // struct rom_header #include "string.h" // memset #include "util.h" // get_pnp_offset diff --git a/src/optionroms.h b/src/std/optionrom.h similarity index 95% rename from src/optionroms.h rename to src/std/optionrom.h index c5ea4ba..94ca4ae 100644 --- a/src/optionroms.h +++ b/src/std/optionrom.h @@ -56,7 +56,4 @@ struct pnp_data { #define OPTION_ROM_INITVECTOR offsetof(struct rom_header, initVector[0]) #define PCIROM_CODETYPE_X86 0 -void -callrom(struct rom_header *rom, u16 bdf); - #endif diff --git a/src/util.h b/src/util.h index 2c65494..06483ba 100644 --- a/src/util.h +++ b/src/util.h @@ -47,6 +47,10 @@ int irqtimer_check(u32 end); void apm_shutdown(void); void handle_1553(struct bregs *regs); +// optionroms.c +struct rom_header; +void callrom(struct rom_header *rom, u16 bdf); + // pcibios.c void handle_1ab1(struct bregs *regs); void bios32_init(void); diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c index 5206da9..a07fc91 100644 --- a/vgasrc/vgabios.c +++ b/vgasrc/vgabios.c @@ -11,8 +11,8 @@ #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 "std/optionrom.h" // struct pci_data #include "stdvga.h" // stdvga_set_cursor_shape #include "string.h" // memset_far #include "util.h" // VERSION -- 1.8.3.1 ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH 14/23] Move fw/LegacyBios.h to std/LegacyBios.h and remove csm.h.
Signed-off-by: Kevin O'Connor --- src/boot.c | 1 - src/fw/csm.c | 6 +- src/fw/csm.h | 18 -- src/{fw => std}/LegacyBios.h | 0 src/util.h | 7 ++- 5 files changed, 11 insertions(+), 21 deletions(-) delete mode 100644 src/fw/csm.h rename src/{fw => std}/LegacyBios.h (100%) diff --git a/src/boot.c b/src/boot.c index 1cb49d4..fbfbf34 100644 --- a/src/boot.c +++ b/src/boot.c @@ -9,7 +9,6 @@ #include "bregs.h" // struct bregs #include "config.h" // CONFIG_* #include "disk.h" // cdrom_boot -#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_* diff --git a/src/fw/csm.c b/src/fw/csm.c index b98dc96..7829c1e 100644 --- a/src/fw/csm.c +++ b/src/fw/csm.c @@ -9,7 +9,6 @@ #include "boot.h" #include "bregs.h" #include "config.h" // CONFIG_* -#include "csm.h" #include "hw/pci.h" #include "hw/pic.h" #include "malloc.h" // csm_malloc_preinit @@ -21,6 +20,11 @@ #include "std/optionrom.h" // struct rom_header #include "util.h" // copy_smbios +#define UINT8 u8 +#define UINT16 u16 +#define UINT32 u32 +#include "std/LegacyBios.h" + struct rsdp_descriptor csm_rsdp VARFSEG __aligned(16); EFI_COMPATIBILITY16_TABLE csm_compat_table VARFSEG __aligned(16) = { diff --git a/src/fw/csm.h b/src/fw/csm.h deleted file mode 100644 index 997e3f7..000 --- a/src/fw/csm.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __CSM_H -#define __CSM_H - -#include "types.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); - -#include "LegacyBios.h" - -#endif // __CSM_H diff --git a/src/fw/LegacyBios.h b/src/std/LegacyBios.h similarity index 100% rename from src/fw/LegacyBios.h rename to src/std/LegacyBios.h diff --git a/src/util.h b/src/util.h index 06483ba..dfd6faf 100644 --- a/src/util.h +++ b/src/util.h @@ -55,6 +55,12 @@ void callrom(struct rom_header *rom, u16 bdf); void handle_1ab1(struct bregs *regs); void bios32_init(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); + // fw/shadow.c void make_bios_writable(void); void make_bios_readonly(void); @@ -95,7 +101,6 @@ void copy_table(void *pos); // vgahooks.c void handle_155f(struct bregs *regs); -struct pci_device; void vgahook_setup(struct pci_device *pci); // optionroms.c -- 1.8.3.1 ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH 10/23] build: Fix import of gcc dependency files.
Make sure dependency file import works with new hw/ and fw/ sub-directories. Signed-off-by: Kevin O'Connor --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fb1f81f..b846491 100644 --- a/Makefile +++ b/Makefile @@ -253,4 +253,4 @@ distclean: clean $(OUT) $(addprefix $(OUT), $(DIRS)): $(Q)mkdir $@ --include $(OUT)*.d +-include $(patsubst %,$(OUT)%/*.d,$(DIRS)) -- 1.8.3.1 ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH 11/23] Move pirtable definitions from hw/pci.h to std/pirtable.h and util.h.
Signed-off-by: Kevin O'Connor --- src/fw/biostables.c | 2 +- src/fw/pirtable.c | 2 +- src/hw/pci.h| 40 src/pcibios.c | 1 + src/std/pirtable.h | 35 +++ src/util.h | 4 6 files changed, 42 insertions(+), 42 deletions(-) create mode 100644 src/std/pirtable.h diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 8fa9fac..a51e8ee 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -6,11 +6,11 @@ #include "acpi.h" // struct rsdp_descriptor #include "config.h" // CONFIG_* -#include "hw/pci.h" // struct pir_header #include "malloc.h" // malloc_fseg #include "mptable.h" // MPTABLE_SIGNATURE #include "output.h" // dprintf #include "smbios.h" // struct smbios_entry_point +#include "std/pirtable.h" // struct pir_header #include "string.h" // memcpy #include "util.h" // copy_table diff --git a/src/fw/pirtable.c b/src/fw/pirtable.c index bd4a6aa..ee2659d 100644 --- a/src/fw/pirtable.c +++ b/src/fw/pirtable.c @@ -6,8 +6,8 @@ // This file may be distributed under the terms of the GNU LGPLv3 license. #include "config.h" // CONFIG_* -#include "hw/pci.h" // struct pir_header #include "output.h" // dprintf +#include "std/pirtable.h" // struct pir_header #include "string.h" // checksum struct pir_header *PirAddr VARFSEG; diff --git a/src/hw/pci.h b/src/hw/pci.h index 7760d21..8fccefc 100644 --- a/src/hw/pci.h +++ b/src/hw/pci.h @@ -118,44 +118,4 @@ void pci_reboot(void); u32 pci_readl(u32 addr); void pci_writel(u32 addr, u32 val); -// pirtable.c -void pirtable_setup(void); - - -/ - * PIR table - / - -struct link_info { -u8 link; -u16 bitmap; -} PACKED; - -struct pir_slot { -u8 bus; -u8 dev; -struct link_info links[4]; -u8 slot_nr; -u8 reserved; -} PACKED; - -struct pir_header { -u32 signature; -u16 version; -u16 size; -u8 router_bus; -u8 router_devfunc; -u16 exclusive_irqs; -u32 compatible_devid; -u32 miniport_data; -u8 reserved[11]; -u8 checksum; -struct pir_slot slots[0]; -} PACKED; - -extern struct pir_header *PirAddr; - -#define PIR_SIGNATURE 0x52495024 // $PIR - - #endif diff --git a/src/pcibios.c b/src/pcibios.c index 8e7e1f9..7e5d972 100644 --- a/src/pcibios.c +++ b/src/pcibios.c @@ -10,6 +10,7 @@ #include "hw/pci.h" // pci_config_readl #include "hw/pci_regs.h" // PCI_VENDOR_ID #include "output.h" // dprintf +#include "std/pirtable.h" // struct pir_header #include "string.h" // checksum #include "util.h" // handle_1ab1 diff --git a/src/std/pirtable.h b/src/std/pirtable.h new file mode 100644 index 000..9de3a43 --- /dev/null +++ b/src/std/pirtable.h @@ -0,0 +1,35 @@ +#ifndef __PIRTABLE_H +#define __PIRTABLE_H + +#include "types.h" // u32 + +struct link_info { +u8 link; +u16 bitmap; +} PACKED; + +struct pir_slot { +u8 bus; +u8 dev; +struct link_info links[4]; +u8 slot_nr; +u8 reserved; +} PACKED; + +struct pir_header { +u32 signature; +u16 version; +u16 size; +u8 router_bus; +u8 router_devfunc; +u16 exclusive_irqs; +u32 compatible_devid; +u32 miniport_data; +u8 reserved[11]; +u8 checksum; +struct pir_slot slots[0]; +} PACKED; + +#define PIR_SIGNATURE 0x52495024 // $PIR + +#endif // pirtable.h diff --git a/src/util.h b/src/util.h index 2712f46..2c65494 100644 --- a/src/util.h +++ b/src/util.h @@ -60,6 +60,10 @@ void qemu_prep_reset(void); extern const u8 pci_irqs[4]; void pci_setup(void); +// fw/pirtable.c +extern struct pir_header *PirAddr; +void pirtable_setup(void); + // fw/smm.c void smm_device_setup(void); void smm_setup(void); -- 1.8.3.1 ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH 13/23] Move vbe.h to std/vbe.h.
Signed-off-by: Kevin O'Connor --- src/bootsplash.c| 2 +- src/{ => std}/vbe.h | 0 vgasrc/bochsvga.c | 2 +- vgasrc/vbe.c| 2 +- vgasrc/vgabios.c| 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename src/{ => std}/vbe.h (100%) diff --git a/src/bootsplash.c b/src/bootsplash.c index b7b3eb8..3c08f5d 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -15,9 +15,9 @@ #include "output.h" // dprintf #include "romfile.h" // romfile_loadfile #include "stacks.h" // call16_int +#include "std/vbe.h" // struct vbe_info #include "string.h" // memset #include "util.h" // enable_bootsplash -#include "vbe.h" // struct vbe_info / diff --git a/src/vbe.h b/src/std/vbe.h similarity index 100% rename from src/vbe.h rename to src/std/vbe.h diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c index e038c61..ed741dc 100644 --- a/vgasrc/bochsvga.c +++ b/vgasrc/bochsvga.c @@ -12,8 +12,8 @@ #include "hw/pci.h" // pci_config_readl #include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0 #include "output.h" // dprintf +#include "std/vbe.h" // VBE_CAPABILITY_8BIT_DAC #include "stdvga.h" // VGAREG_SEQU_ADDRESS -#include "vbe.h" // VBE_CAPABILITY_8BIT_DAC #include "vgabios.h" // struct vbe_modeinfo diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index 9026b77..f7e2203 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -10,8 +10,8 @@ #include "bregs.h" // struct bregs #include "config.h" // CONFIG_* #include "output.h" // dprintf +#include "std/vbe.h" // struct vbe_info #include "string.h" // memset_far -#include "vbe.h" // struct vbe_info #include "vgabios.h" // handle_104f #include "vgahw.h" // vgahw_set_mode diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c index a07fc91..0769330 100644 --- a/vgasrc/vgabios.c +++ b/vgasrc/vgabios.c @@ -13,10 +13,10 @@ #include "hw/pci_regs.h" // PCI_VENDOR_ID #include "output.h" // dprintf #include "std/optionrom.h" // struct pci_data +#include "std/vbe.h" // VBE_RETURN_STATUS_FAILED #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 -- 1.8.3.1 ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH 09/23] Move definition of struct segoff_s from farptr.h to types.h.
The segoff_s definition is used by a number of header files that would not otherwise need farptr.h, so move it to a more central location. Signed-off-by: Kevin O'Connor --- src/bregs.h | 1 - src/disk.h | 2 -- src/farptr.h | 10 -- src/hw/pic.h | 1 - src/pmm.c| 1 - src/types.h | 11 +++ src/vbe.h| 1 - 7 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/bregs.h b/src/bregs.h index 009db99..3df7d9f 100644 --- a/src/bregs.h +++ b/src/bregs.h @@ -8,7 +8,6 @@ #define __BREGS_H #include "types.h" // u16 -#include "farptr.h" // struct segoff_s #include "x86.h" // F_CF diff --git a/src/disk.h b/src/disk.h index 8e49124..48496da 100644 --- a/src/disk.h +++ b/src/disk.h @@ -7,8 +7,6 @@ #define __DISK_H #include "types.h" // u8 -#include "config.h" // CONFIG_* -#include "farptr.h" // struct segoff_s #define DISK_RET_SUCCESS 0x00 #define DISK_RET_EPARAM0x01 diff --git a/src/farptr.h b/src/farptr.h index 5b6c5c1..b64567e 100644 --- a/src/farptr.h +++ b/src/farptr.h @@ -196,16 +196,6 @@ static inline void outsl_fl(u16 port, void *ptr_fl, u16 count) { #endif -// Definition for common 16bit segment/offset pointers. -struct segoff_s { -union { -struct { -u16 offset; -u16 seg; -}; -u32 segoff; -}; -}; #define SEGOFF(s,o) ({struct segoff_s __so; __so.offset=(o); __so.seg=(s); __so;}) static inline struct segoff_s FLATPTR_TO_SEGOFF(void *p) { diff --git a/src/hw/pic.h b/src/hw/pic.h index 19aecba..2a89e3f 100644 --- a/src/hw/pic.h +++ b/src/hw/pic.h @@ -8,7 +8,6 @@ #define __PIC_H #include "ioport.h" // PORT_PIC* -#include "farptr.h" // struct segoff_s // PORT_PIC1 bitdefs #define PIC1_IRQ0 (1<<0) diff --git a/src/pmm.c b/src/pmm.c index e87cfd1..cce0f29 100644 --- a/src/pmm.c +++ b/src/pmm.c @@ -6,7 +6,6 @@ #include "biosvar.h" // FUNC16 #include "config.h" // CONFIG_* -#include "farptr.h" // struct segoff_s #include "malloc.h" // _malloc #include "output.h" // dprintf #include "string.h" // checksum diff --git a/src/types.h b/src/types.h index 9e22ab5..3466b3a 100644 --- a/src/types.h +++ b/src/types.h @@ -21,6 +21,17 @@ union u64_u32_u { u64 val; }; +// Definition for common 16bit segment/offset pointers. +struct segoff_s { +union { +struct { +u16 offset; +u16 seg; +}; +u32 segoff; +}; +}; + #ifdef MANUAL_NO_JUMP_TABLE # define default case 775324556: asm(""); default #endif diff --git a/src/vbe.h b/src/vbe.h index 386613c..94b4ad8 100644 --- a/src/vbe.h +++ b/src/vbe.h @@ -2,7 +2,6 @@ #define __VBE_H #include "types.h" // u8 -#include "farptr.h" // struct segoff_s #define VESA_SIGNATURE 0x41534556 // VESA #define VBE2_SIGNATURE 0x32454256 // VBE2 -- 1.8.3.1 ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH 07/23] Move malloc code from pmm.c to new files malloc.c and malloc.h.
Signed-off-by: Kevin O'Connor --- Makefile | 2 +- src/block.c | 1 + src/bmp.c| 2 +- src/boot.c | 1 + src/bootsplash.c | 1 + src/cdrom.c | 1 + src/fw/acpi.c| 1 + src/fw/biostables.c | 1 + src/fw/coreboot.c| 1 + src/fw/csm.c | 5 +- src/fw/mptable.c | 1 + src/fw/paravirt.c| 1 + src/fw/pciinit.c | 1 + src/fw/shadow.c | 1 + src/fw/smbios.c | 1 + src/fw/xen.c | 1 + src/hw/ahci.c| 1 + src/hw/ata.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/pci.c | 1 + src/hw/ramdisk.c | 1 + src/hw/usb-ehci.c| 1 + src/hw/usb-msc.c | 1 + src/hw/usb-ohci.c| 1 + src/hw/usb-uas.c | 1 + src/hw/usb-uhci.c| 1 + src/hw/usb.c | 1 + src/hw/virtio-blk.c | 1 + src/hw/virtio-pci.c | 1 + src/hw/virtio-scsi.c | 1 + src/jpeg.c | 2 +- src/malloc.c | 529 src/malloc.h | 70 +++ src/optionroms.c | 1 + src/output.c | 1 + src/pmm.c| 558 ++- src/post.c | 1 + src/romfile.c| 1 + src/stacks.c | 1 + src/system.c | 1 + src/util.h | 59 -- 44 files changed, 658 insertions(+), 605 deletions(-) create mode 100644 src/malloc.c create mode 100644 src/malloc.h diff --git a/Makefile b/Makefile index 3a88f45..fb1f81f 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ SRCBOTH=misc.c stacks.c output.c string.c x86.c block.c cdrom.c mouse.c kbd.c \ hw/virtio-ring.c hw/virtio-pci.c hw/virtio-blk.c hw/virtio-scsi.c \ hw/lsi-scsi.c hw/esp-scsi.c hw/megasas.c SRC16=$(SRCBOTH) system.c disk.c font.c -SRC32FLAT=$(SRCBOTH) post.c memmap.c pmm.c romfile.c optionroms.c \ +SRC32FLAT=$(SRCBOTH) post.c memmap.c malloc.c pmm.c romfile.c optionroms.c \ boot.c bootsplash.c jpeg.c bmp.c \ hw/usb-hub.c \ fw/coreboot.c fw/lzmadecode.c fw/csm.c fw/biostables.c \ diff --git a/src/block.c b/src/block.c index 9cfd7dd..5c8bf75 100644 --- a/src/block.c +++ b/src/block.c @@ -13,6 +13,7 @@ #include "hw/ahci.h" // process_ahci_op #include "hw/virtio-blk.h" // process_virtio_blk_op #include "hw/blockcmd.h" // cdb_* +#include "malloc.h" // malloc_low #include "stacks.h" // stack_hop #include "string.h" // checksum diff --git a/src/bmp.c b/src/bmp.c index 81be306..68952f6 100644 --- a/src/bmp.c +++ b/src/bmp.c @@ -6,8 +6,8 @@ * * This work is licensed under the terms of the GNU LGPLv3. */ -#include "util.h" // malloc_tmphigh #include "bmp.h" // struct bmp_decdata +#include "malloc.h" // malloc_tmphigh #include "string.h" // memcpy #define bmp_load4byte(addr) (*(u32 *)(addr)) diff --git a/src/boot.c b/src/boot.c index 08876fa..cb85325 100644 --- a/src/boot.c +++ b/src/boot.c @@ -16,6 +16,7 @@ #include "hw/usb.h" // struct usbdevice_s #include "fw/csm.h" // csm_bootprio_* #include "list.h" // hlist_node +#include "malloc.h" // free #include "romfile.h" // romfile_loadint #include "string.h" // memset diff --git a/src/bootsplash.c b/src/bootsplash.c index 493d60d..1bea722 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -13,6 +13,7 @@ #include "vbe.h" // struct vbe_info #include "bmp.h" // bmp_alloc #include "fw/smbios.h" // display_uuid +#include "malloc.h" // free #include "romfile.h" // romfile_loadfile #include "stacks.h" // call16_int #include "string.h" // memset diff --git a/src/cdrom.c b/src/cdrom.c index 0d3fa1f..a9ac9e4 100644 --- a/src/cdrom.c +++ b/src/cdrom.c @@ -11,6 +11,7 @@ #include "biosvar.h" // GET_GLOBAL #include "hw/ata.h" // ATA_CMD_REQUEST_SENSE #include "hw/blockcmd.h" // CDB_CMD_REQUEST_SENSE +#include "malloc.h" // free #include "string.h" // memset // Locks for removable devices diff --git a/src/fw/acpi.c b/src/fw/acpi.c index f94a6fb..8ad3673 100644 --- a/src/fw/acpi.c +++ b/src/fw/acpi.c @@ -15,6 +15,7 @@ #include "config.h" // CONFIG_* #include "paravirt.h" // RamSize #include "dev-q35.h" +#include "malloc.h" // free #include "romfile.h" // romfile_loadint #include "string.h" // memset #include "x86.h" // readl diff --git a/src/fw/biostables.c b/src/fw/biostables.c index cd58ff9..06cd864 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -8,6 +8,7 @@ #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 "smbios.h" // struct smbios_entry_point #include "string.h" // memcpy diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c index ba65dc6..9971f82 100644 --- a/src/fw/coreboot.c +++ b/src/fw/coreboot.c @@ -14,6 +14,7 @@ #include "config.h" // CONFIG_* #include "acpi.h" // fin
[SeaBIOS] [PATCH 05/23] Move stacks.c definitions from util.h to new file stacks.h.
Signed-off-by: Kevin O'Connor --- src/stacks.h | 34 ++ 1 file changed, 34 insertions(+) create mode 100644 src/stacks.h diff --git a/src/stacks.h b/src/stacks.h new file mode 100644 index 000..5ee4adc --- /dev/null +++ b/src/stacks.h @@ -0,0 +1,34 @@ +// Misc function and variable declarations. +#ifndef __STACKS_H +#define __STACKS_H + +#include "types.h" // u32 + +// stacks.c +extern u8 ExtraStack[], *StackPos; +u32 stack_hop(u32 eax, u32 edx, void *func); +u32 stack_hop_back(u32 eax, u32 edx, void *func); +u32 call32(void *func, u32 eax, u32 errret); +struct bregs; +inline void farcall16(struct bregs *callregs); +inline void farcall16big(struct bregs *callregs); +inline void __call16_int(struct bregs *callregs, u16 offset); +#define call16_int(nr, callregs) do { \ +extern void irq_trampoline_ ##nr ();\ +__call16_int((callregs), (u32)&irq_trampoline_ ##nr ); \ +} while (0) +extern struct thread_info MainThread; +struct thread_info *getCurThread(void); +void yield(void); +void yield_toirq(void); +void run_thread(void (*func)(void*), void *data); +void wait_threads(void); +struct mutex_s { u32 isLocked; }; +void mutex_lock(struct mutex_s *mutex); +void mutex_unlock(struct mutex_s *mutex); +void start_preempt(void); +void finish_preempt(void); +int wait_preempt(void); +void check_preempt(void); + +#endif // stacks.h -- 1.8.3.1 ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH 04/23] Move stacks.c definitions from util.h to new file stacks.h.
Signed-off-by: Kevin O'Connor --- src/apm.c | 1 + src/block.c | 1 + src/bootsplash.c | 1 + src/clock.c | 1 + src/disk.c| 1 + src/fw/coreboot.c | 1 + src/fw/csm.c | 1 + src/fw/smp.c | 1 + src/hw/ahci.c | 1 + src/hw/ata.c | 1 + src/hw/floppy.c | 1 + src/hw/megasas.c | 1 + src/hw/pci.c | 1 + src/hw/ps2port.c | 1 + src/hw/ramdisk.c | 1 + src/hw/timer.c| 1 + src/hw/usb.h | 2 +- src/kbd.c | 1 + src/misc.c| 1 + src/mouse.c | 1 + src/optionroms.c | 1 + src/output.c | 1 + src/pmm.c | 1 + src/resume.c | 1 + src/serial.c | 1 + src/stacks.c | 1 + src/string.c | 2 +- src/util.h| 28 +--- 28 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/apm.c b/src/apm.c index 211424c..32d1f4b 100644 --- a/src/apm.c +++ b/src/apm.c @@ -13,6 +13,7 @@ #include "biosvar.h" // GET_GLOBAL #include "fw/paravirt.h" // runningOnQEMU #include "fw/acpi.h" // acpi_pm_ctl +#include "stacks.h" // yield_toirq static void out_str(const char *str_cs) diff --git a/src/block.c b/src/block.c index c6e4167..9cfd7dd 100644 --- a/src/block.c +++ b/src/block.c @@ -13,6 +13,7 @@ #include "hw/ahci.h" // process_ahci_op #include "hw/virtio-blk.h" // process_virtio_blk_op #include "hw/blockcmd.h" // cdb_* +#include "stacks.h" // stack_hop #include "string.h" // checksum u8 FloppyCount VARFSEG; diff --git a/src/bootsplash.c b/src/bootsplash.c index f4f8ea9..340839b 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -13,6 +13,7 @@ #include "vbe.h" // struct vbe_info #include "bmp.h" // bmp_alloc #include "fw/smbios.h" // display_uuid +#include "stacks.h" // call16_int #include "string.h" // memset diff --git a/src/clock.c b/src/clock.c index fc91db7..6b27aa9 100644 --- a/src/clock.c +++ b/src/clock.c @@ -14,6 +14,7 @@ #include "bregs.h" // struct bregs #include "biosvar.h" // GET_GLOBAL #include "hw/usb-hid.h" // usb_check_event +#include "stacks.h" // yield #include "string.h" // memset // RTC register flags diff --git a/src/disk.c b/src/disk.c index fd80588..2d335e6 100644 --- a/src/disk.c +++ b/src/disk.c @@ -13,6 +13,7 @@ #include "bregs.h" // struct bregs #include "hw/pci.h" // pci_bdf_to_bus #include "hw/ata.h" // ATA_CB_DC +#include "stacks.h" // call16_int #include "string.h" // memset diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c index 6da90b5..c67a62b 100644 --- a/src/fw/coreboot.c +++ b/src/fw/coreboot.c @@ -15,6 +15,7 @@ #include "acpi.h" // find_acpi_features #include "hw/pci.h" // pci_probe_devices #include "paravirt.h" // PlatformRunningOn +#include "stacks.h" // yield #include "string.h" // memset diff --git a/src/fw/csm.c b/src/fw/csm.c index 4a78bac..81159b3 100644 --- a/src/fw/csm.c +++ b/src/fw/csm.c @@ -17,6 +17,7 @@ #include "boot.h" #include "smbios.h" #include "hw/pic.h" +#include "stacks.h" // wait_threads struct rsdp_descriptor csm_rsdp VARFSEG __aligned(16); diff --git a/src/fw/smp.c b/src/fw/smp.c index a8504ab..1906255 100644 --- a/src/fw/smp.c +++ b/src/fw/smp.c @@ -8,6 +8,7 @@ #include "util.h" // dprintf #include "config.h" // CONFIG_* #include "hw/cmos.h" // CMOS_BIOS_SMP_COUNT +#include "stacks.h" // yield #include "x86.h" // wrmsr #define APIC_ICR_LOW ((u8*)BUILD_APIC_ADDR + 0x300) diff --git a/src/hw/ahci.c b/src/hw/ahci.c index 2435b83..6f56cb1 100644 --- a/src/hw/ahci.c +++ b/src/hw/ahci.c @@ -16,6 +16,7 @@ #include "ata.h" // ATA_CB_STAT #include "ahci.h" // CDB_CMD_READ_10 #include "blockcmd.h" // CDB_CMD_READ_10 +#include "stacks.h" // yield #include "string.h" // memset #define AHCI_REQUEST_TIMEOUT 32000 // 32 seconds max for IDE ops diff --git a/src/hw/ata.c b/src/hw/ata.c index 705e106..5e9b905 100644 --- a/src/hw/ata.c +++ b/src/hw/ata.c @@ -19,6 +19,7 @@ #include "disk.h" // struct ata_s #include "ata.h" // ATA_CB_STAT #include "blockcmd.h" // CDB_CMD_READ_10 +#include "stacks.h" // yield #include "string.h" // memset #define IDE_TIMEOUT 32000 //32 seconds max for IDE ops diff --git a/src/hw/floppy.c b/src/hw/floppy.c index ae66bc0..c051f54 100644 --- a/src/hw/floppy.c +++ b/src/hw/floppy.c @@ -16,6 +16,7 @@ #include "boot.h" // boot_add_floppy #include "pci.h" // pci_to_bdf #include "pci_ids.h" // PCI_CLASS_BRIDGE_ISA +#include "stacks.h" // yield #include "string.h" // memset #define FLOPPY_SIZE_CODE 0x02 // 512 byte sectors diff --git a/src/hw/megasas.c b/src/hw/megasas.c index 144fb84..19ed1b4 100644 --- a/src/hw/megasas.c +++ b/src/hw/megasas.c @@ -19,6 +19,7 @@ #include "boot.h" // bootprio_find_scsi_device #include "blockcmd.h" // scsi_drive_setup #include "disk.h" +#include "stacks.h" // yield #include "string.h" // memset #define MFI_DB 0x0 // Doorbell diff --git a/src/hw/pci.c b/src/hw/pci.c index 7fdde2a..295a26d 100644 --- a/src/hw/pci.c +++ b/src/hw/pci.c @@ -12,6 +12,7 @@ #include
[SeaBIOS] [PATCH 06/23] Move romfile definitions from util.h to new file romfile.h.
Signed-off-by: Kevin O'Connor --- src/boot.c| 1 + src/bootsplash.c | 1 + src/fw/acpi.c | 1 + src/fw/coreboot.c | 1 + src/fw/mptable.c | 1 + src/fw/paravirt.c | 1 + src/fw/smbios.c | 1 + src/fw/smp.c | 1 + src/hw/floppy.c | 1 + src/hw/pci.c | 1 + src/hw/ps2port.c | 1 + src/hw/ramdisk.c | 1 + src/optionroms.c | 1 + src/romfile.c | 1 + src/romfile.h | 19 +++ src/util.h| 13 - 16 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 src/romfile.h diff --git a/src/boot.c b/src/boot.c index 68a20d9..08876fa 100644 --- a/src/boot.c +++ b/src/boot.c @@ -16,6 +16,7 @@ #include "hw/usb.h" // struct usbdevice_s #include "fw/csm.h" // csm_bootprio_* #include "list.h" // hlist_node +#include "romfile.h" // romfile_loadint #include "string.h" // memset diff --git a/src/bootsplash.c b/src/bootsplash.c index 340839b..493d60d 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -13,6 +13,7 @@ #include "vbe.h" // struct vbe_info #include "bmp.h" // bmp_alloc #include "fw/smbios.h" // display_uuid +#include "romfile.h" // romfile_loadfile #include "stacks.h" // call16_int #include "string.h" // memset diff --git a/src/fw/acpi.c b/src/fw/acpi.c index 8abd205..f94a6fb 100644 --- a/src/fw/acpi.c +++ b/src/fw/acpi.c @@ -15,6 +15,7 @@ #include "config.h" // CONFIG_* #include "paravirt.h" // RamSize #include "dev-q35.h" +#include "romfile.h" // romfile_loadint #include "string.h" // memset #include "x86.h" // readl diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c index c67a62b..ba65dc6 100644 --- a/src/fw/coreboot.c +++ b/src/fw/coreboot.c @@ -15,6 +15,7 @@ #include "acpi.h" // find_acpi_features #include "hw/pci.h" // pci_probe_devices #include "paravirt.h" // PlatformRunningOn +#include "romfile.h" // romfile_findprefix #include "stacks.h" // yield #include "string.h" // memset diff --git a/src/fw/mptable.c b/src/fw/mptable.c index ecc618a..c79f54f 100644 --- a/src/fw/mptable.c +++ b/src/fw/mptable.c @@ -10,6 +10,7 @@ #include "mptable.h" // MPTABLE_SIGNATURE #include "hw/pci.h" #include "hw/pci_regs.h" +#include "romfile.h" // romfile_loadint #include "string.h" // memset #include "x86.h" // cpuid diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c index 2be4281..fd58184 100644 --- a/src/fw/paravirt.c +++ b/src/fw/paravirt.c @@ -20,6 +20,7 @@ #include "mptable.h" // mptable_setup #include "hw/pci.h" // create_pirtable #include "xen.h" // xen_biostable_setup +#include "romfile.h" // romfile_loadint #include "string.h" // memset #include "x86.h" // cpuid diff --git a/src/fw/smbios.c b/src/fw/smbios.c index f80b42b..2f95d96 100644 --- a/src/fw/smbios.c +++ b/src/fw/smbios.c @@ -9,6 +9,7 @@ #include "config.h" // CONFIG_* #include "paravirt.h" // RamSize #include "smbios.h" // struct smbios_entry_point +#include "romfile.h" // romfile_findprefix #include "string.h" // memset #include "x86.h" // cpuid diff --git a/src/fw/smp.c b/src/fw/smp.c index 1906255..cc6fb80 100644 --- a/src/fw/smp.c +++ b/src/fw/smp.c @@ -8,6 +8,7 @@ #include "util.h" // dprintf #include "config.h" // CONFIG_* #include "hw/cmos.h" // CMOS_BIOS_SMP_COUNT +#include "romfile.h" // romfile_loadint #include "stacks.h" // yield #include "x86.h" // wrmsr diff --git a/src/hw/floppy.c b/src/hw/floppy.c index c051f54..c8ae756 100644 --- a/src/hw/floppy.c +++ b/src/hw/floppy.c @@ -16,6 +16,7 @@ #include "boot.h" // boot_add_floppy #include "pci.h" // pci_to_bdf #include "pci_ids.h" // PCI_CLASS_BRIDGE_ISA +#include "romfile.h" // romfile_loadint #include "stacks.h" // yield #include "string.h" // memset diff --git a/src/hw/pci.c b/src/hw/pci.c index 295a26d..f171d10 100644 --- a/src/hw/pci.c +++ b/src/hw/pci.c @@ -12,6 +12,7 @@ #include "farptr.h" // MAKE_FLATPTR #include "pci_regs.h" // PCI_VENDOR_ID #include "pci_ids.h" // PCI_CLASS_DISPLAY_VGA +#include "romfile.h" // romfile_loadint #include "stacks.h" // call32 #include "string.h" // memset #include "x86.h" // readl diff --git a/src/hw/ps2port.c b/src/hw/ps2port.c index 6fd0c3a..6da297f 100644 --- a/src/hw/ps2port.c +++ b/src/hw/ps2port.c @@ -10,6 +10,7 @@ #include "biosvar.h" // GET_LOW #include "ps2port.h" // ps2_kbd_command #include "pic.h" // pic_eoi1 +#include "romfile.h" // romfile_loadint #include "stacks.h" // yield diff --git a/src/hw/ramdisk.c b/src/hw/ramdisk.c index cd517e7..3eadd74 100644 --- a/src/hw/ramdisk.c +++ b/src/hw/ramdisk.c @@ -10,6 +10,7 @@ #include "biosvar.h" // GET_GLOBAL #include "bregs.h" // struct bregs #include "boot.h" // boot_add_floppy +#include "romfile.h" // romfile_findprefix #include "stacks.h" // call16_int #include "string.h" // memset diff --git a/src/optionroms.c b/src/optionroms.c index cc6083b..5c79121 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -14,6 +14,7 @@ #include "hw/pci_ids.h" // PCI_CLASS_DISPLAY_VGA #include "boot.h" // IPL #include "optionr
[SeaBIOS] [PATCH 03/23] Rename util.c to string.c and introduce string.h.
Signed-off-by: Kevin O'Connor --- Makefile | 8 src/block.c | 1 + src/bmp.c| 5 +++-- src/boot.c | 1 + src/bootsplash.c | 1 + src/cdrom.c | 3 ++- src/clock.c | 1 + src/disk.c | 1 + src/fw/acpi.c| 3 ++- src/fw/biostables.c | 1 + src/fw/coreboot.c| 1 + src/fw/csm.c | 2 +- src/fw/mptable.c | 1 + src/fw/paravirt.c| 1 + src/fw/pciinit.c | 1 + src/fw/pirtable.c| 3 ++- src/fw/shadow.c | 3 ++- src/fw/smbios.c | 1 + src/fw/smm.c | 1 + src/fw/xen.c | 1 + 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/pci.c | 1 + src/hw/ramdisk.c | 1 + src/hw/usb-ehci.c| 1 + src/hw/usb-hub.c | 1 + src/hw/usb-msc.c | 1 + src/hw/usb-ohci.c| 1 + src/hw/usb-uas.c | 1 + src/hw/usb-uhci.c| 1 + src/hw/usb.c | 1 + src/hw/virtio-blk.c | 1 + src/hw/virtio-pci.c | 1 + src/hw/virtio-scsi.c | 1 + src/jpeg.c | 1 + src/kbd.c| 1 + src/memmap.c | 1 + src/misc.c | 1 + src/optionroms.c | 1 + src/output.c | 1 + src/pcibios.c| 1 + src/pmm.c| 3 ++- src/pnpbios.c| 3 ++- src/post.c | 3 ++- src/resume.c | 1 + src/romfile.c| 1 + src/{util.c => string.c} | 10 +- src/string.h | 30 ++ src/system.c | 3 ++- src/util.h | 29 + src/vgahooks.c | 1 + vgasrc/clext.c | 1 + vgasrc/geodevga.c| 2 +- vgasrc/stdvga.c | 2 +- vgasrc/stdvgamodes.c | 3 ++- vgasrc/vbe.c | 1 + vgasrc/vgabios.c | 3 ++- vgasrc/vgafb.c | 3 ++- 63 files changed, 112 insertions(+), 53 deletions(-) rename src/{util.c => string.c} (96%) create mode 100644 src/string.h diff --git a/Makefile b/Makefile index 46df1c6..3a88f45 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ OUT=out/ # Source files -SRCBOTH=misc.c stacks.c output.c util.c x86.c block.c cdrom.c mouse.c kbd.c \ +SRCBOTH=misc.c stacks.c output.c string.c x86.c block.c cdrom.c mouse.c kbd.c \ serial.c clock.c resume.c pnpbios.c vgahooks.c pcibios.c apm.c \ fw/smp.c \ hw/pci.c hw/timer.c hw/pic.c hw/ps2port.c \ @@ -24,7 +24,7 @@ SRC32FLAT=$(SRCBOTH) post.c memmap.c pmm.c romfile.c optionroms.c \ fw/coreboot.c fw/lzmadecode.c fw/csm.c fw/biostables.c \ fw/paravirt.c fw/shadow.c fw/pciinit.c fw/smm.c fw/mtrr.c fw/xen.c \ fw/acpi.c fw/mptable.c fw/pirtable.c fw/smbios.c -SRC32SEG=util.c output.c pcibios.c apm.c stacks.c hw/pci.c +SRC32SEG=string.c output.c pcibios.c apm.c stacks.c hw/pci.c DIRS=src src/hw src/fw vgasrc # Default compiler flags @@ -180,14 +180,14 @@ $(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/hw/pci.c \ +SRCVGA=src/output.c src/string.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 CFLAGS16VGA = $(CFLAGS16INC) -Isrc -$(OUT)vgaccode16.raw.s: $(OUT)autoconf.h ; $(call whole-compile, $(CFLAGS16VGA) -S, $(SRCVGA),$@) +$(OUT)vgaccode16.raw.s: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRCVGA)) ; $(call whole-compile, $(CFLAGS16VGA) -S, $(SRCVGA),$@) $(OUT)vgaccode16.o: $(OUT)vgaccode16.raw.s scripts/vgafixup.py @echo " Fixup VGA rom assembler" diff --git a/src/block.c b/src/block.c index 74c6497..c6e4167 100644 --- a/src/block.c +++ b/src/block.c @@ -13,6 +13,7 @@ #include "hw/ahci.h" // process_ahci_op #include "hw/virtio-blk.h" // process_virtio_blk_op #include "hw/blockcmd.h" // cdb_* +#include "string.h" // checksum u8 FloppyCount VARFSEG; u8 CDCount; diff --git a/src/bmp.c b/src/bmp.c index 0d54efd..81be306 100644 --- a/src/bmp.c +++ b/src/bmp.c @@ -6,8 +6,9 @@ * * This work is licensed under the terms of the GNU LGPLv3. */ -#include "util.h" -#include "bmp.h" +#include "util.h" // malloc_tmphigh +#include "bmp.h" // struct bmp_decdata +#include "string.h" // memcpy #define bmp_load4byte(addr) (*(u32 *)(addr)) #define bmp_load2byte(addr) (*(u16 *)(addr)) diff --git a/src/boot.c b/src/boot.c index 3542283..68a20d9 100644 --- a/src/boot.c +++ b/src/boot.c @@ -16,6 +16,7 @@ #include "hw/usb.h" // struct usbdevice_s #include "fw/csm.h" // csm_bootprio_* #includ
[SeaBIOS] [PATCH 00/23] Include file cleanups
This patch series attempts to cleanup some of the include files within SeaBIOS. There are three main goals: split out the complex users of util.h into their own header files, introduce a new directory std/ for header files that just define standard bios interfaces, and make sure no header files (with the exception of util.h) have declarations for more than one c file. At the end of this series util.h, only contains simple function and variable prototypes (ie, no macros, inline code, or struct definitions). This series is also available at: https://github.com/KevinOConnor/seabios/tree/testing -Kevin Kevin O'Connor (23): Split x86 specific functions out of util.c/h to new files x86.c/h. Move keyboard calling code from util.c to boot.c. Rename util.c to string.c and introduce string.h. Move stacks.c definitions from util.h to new file stacks.h. Move stacks.c definitions from util.h to new file stacks.h. Move romfile definitions from util.h to new file romfile.h. Move malloc code from pmm.c to new files malloc.c and malloc.h. Move function definitions for output.c from util.h to new file output.h. Move definition of struct segoff_s from farptr.h to types.h. build: Fix import of gcc dependency files. Move pirtable definitions from hw/pci.h to std/pirtable.h and util.h. Move optionroms.h to std/optionrom.h and util.h. Move vbe.h to std/vbe.h. Move fw/LegacyBios.h to std/LegacyBios.h and remove csm.h. Move fw/smbios.h to std/smbios.h. Move fw/mptable.h to std/mptable.h. Move fw/acpi.h to std/acpi.h. Move pnpbios definition to new file std/pnpbios.h. Move pmm definitions to new file std/pmm.h. Split disk.h into block.h and std/disk.h. Move standard bda type info from biosvar.h to std/bda.h. Merge bmp.h, boot.h, jpeg.h, and post.h into util.h. Sort the sections of util.h. Makefile | 12 +- src/apm.c | 9 +- src/biosvar.h | 161 +- src/block.c | 44 ++- src/block.h | 129 src/bmp.c | 18 +- src/bmp.h | 25 -- src/boot.c| 59 +++- src/boot.h| 26 -- src/bootsplash.c | 14 +- src/bregs.h | 21 +- src/byteorder.h | 2 + src/cdrom.c | 25 +- src/clock.c | 9 +- src/disk.c| 38 +-- src/disk.h| 292 - src/farptr.h | 10 - src/fw/acpi.c | 15 +- src/fw/biostables.c | 13 +- src/fw/coreboot.c | 16 +- src/fw/csm.c | 29 +- src/fw/csm.h | 18 -- src/fw/mptable.c | 9 +- src/fw/mtrr.c | 4 +- src/fw/paravirt.c | 18 +- src/fw/pciinit.c | 12 +- src/fw/pirtable.c | 5 +- src/fw/shadow.c | 10 +- src/fw/smbios.c | 9 +- src/fw/smm.c | 11 +- src/fw/smp.c | 6 +- src/fw/xen.c | 10 +- src/hw/ahci.c | 18 +- src/hw/ahci.h | 3 + src/hw/ata.c | 21 +- src/hw/ata.h | 4 +- src/hw/blockcmd.c | 20 +- src/hw/esp-scsi.c | 17 +- src/hw/floppy.c | 18 +- src/hw/lsi-scsi.c | 17 +- src/hw/megasas.c | 16 +- src/hw/pci.c | 14 +- src/hw/pci.h | 40 --- src/hw/pic.c | 6 +- src/hw/pic.h | 1 - src/hw/ps2port.c | 9 +- src/hw/ramdisk.c | 13 +- src/hw/timer.c| 11 +- src/hw/usb-ehci.c | 14 +- src/hw/usb-hid.c | 9 +- src/hw/usb-hub.c | 6 +- src/hw/usb-msc.c | 15 +- src/hw/usb-ohci.c | 12 +- src/hw/usb-uas.c | 13 +- src/hw/usb-uhci.c | 11 +- src/hw/usb.c | 18 +- src/hw/usb.h | 2 +- src/hw/virtio-blk.c | 13 +- src/hw/virtio-pci.c | 8 +- src/hw/virtio-ring.c | 4 +- src/hw/virtio-scsi.c | 15 +- src/jpeg.c| 3 +- src/jpeg.h| 11 - src/kbd.c | 7 +- src/malloc.c | 529 +
[SeaBIOS] [PATCH 01/23] Split x86 specific functions out of util.c/h to new files x86.c/h.
Signed-off-by: Kevin O'Connor --- Makefile | 2 +- src/bregs.h | 22 +-- src/fw/acpi.c | 1 + src/fw/mptable.c | 1 + src/fw/mtrr.c | 1 + src/fw/paravirt.c | 1 + src/fw/shadow.c | 1 + src/fw/smbios.c | 1 + src/fw/smm.c | 3 +- src/fw/smp.c | 1 + src/fw/xen.c | 1 + src/hw/pci.c | 1 + src/hw/timer.c| 1 + src/hw/usb-ehci.c | 1 + src/hw/usb-ohci.c | 1 + src/hw/usb.c | 1 + src/pmm.c | 1 + src/romlayout.S | 2 +- src/util.c| 16 -- src/util.h| 141 - src/x86.c | 23 src/x86.h | 168 ++ 22 files changed, 212 insertions(+), 179 deletions(-) create mode 100644 src/x86.c create mode 100644 src/x86.h diff --git a/Makefile b/Makefile index 9b7ed33..46df1c6 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ OUT=out/ # Source files -SRCBOTH=misc.c stacks.c output.c util.c block.c cdrom.c mouse.c kbd.c \ +SRCBOTH=misc.c stacks.c output.c util.c x86.c block.c cdrom.c mouse.c kbd.c \ serial.c clock.c resume.c pnpbios.c vgahooks.c pcibios.c apm.c \ fw/smp.c \ hw/pci.c hw/timer.c hw/pic.c hw/ps2port.c \ diff --git a/src/bregs.h b/src/bregs.h index 577effc..009db99 100644 --- a/src/bregs.h +++ b/src/bregs.h @@ -7,29 +7,15 @@ #ifndef __BREGS_H #define __BREGS_H -// CPU flag bitdefs -#define F_CF (1<<0) -#define F_ZF (1<<6) -#define F_IF (1<<9) -#define F_ID (1<<21) - -// CR0 flags -#define CR0_PG (1<<31) // Paging -#define CR0_CD (1<<30) // Cache disable -#define CR0_NW (1<<29) // Not Write-through -#define CR0_PE (1<<0) // Protection enable - - -#ifndef __ASSEMBLY__ - +#include "types.h" // u16 #include "farptr.h" // struct segoff_s +#include "x86.h" // F_CF + / * Registers saved/restored in romlayout.S / -#include "types.h" // u16 - #define UREG(ER, R, RH, RL) union { u32 ER; struct { u16 R; u16 R ## _hi; }; struct { u8 RL; u8 RH; u8 R ## _hilo; u8 R ## _hihi; }; } // Layout of registers passed in to irq handlers. Note that this @@ -92,6 +78,4 @@ set_code_invalid_silent(struct bregs *regs, u8 code) set_cf(regs, 1); } -#endif // !__ASSEMBLY__ - #endif // bregs.h diff --git a/src/fw/acpi.c b/src/fw/acpi.c index 9fd1c05..fcf11ea 100644 --- a/src/fw/acpi.c +++ b/src/fw/acpi.c @@ -15,6 +15,7 @@ #include "config.h" // CONFIG_* #include "paravirt.h" // RamSize #include "dev-q35.h" +#include "x86.h" // readl #include "src/fw/acpi-dsdt.hex" diff --git a/src/fw/mptable.c b/src/fw/mptable.c index 2d12865..47fe53d 100644 --- a/src/fw/mptable.c +++ b/src/fw/mptable.c @@ -10,6 +10,7 @@ #include "mptable.h" // MPTABLE_SIGNATURE #include "hw/pci.h" #include "hw/pci_regs.h" +#include "x86.h" // cpuid void mptable_setup(void) diff --git a/src/fw/mtrr.c b/src/fw/mtrr.c index 001e275..855457a 100644 --- a/src/fw/mtrr.c +++ b/src/fw/mtrr.c @@ -8,6 +8,7 @@ #include "config.h" // CONFIG_* #include "hw/pci.h" // pcimem_start #include "paravirt.h" // RamSize +#include "x86.h" // cpuid #define MSR_MTRRcap0x00fe #define MSR_MTRRfix64K_0 0x0250 diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c index b1dd8b0..a68e3a1 100644 --- a/src/fw/paravirt.c +++ b/src/fw/paravirt.c @@ -20,6 +20,7 @@ #include "mptable.h" // mptable_setup #include "hw/pci.h" // create_pirtable #include "xen.h" // xen_biostable_setup +#include "x86.h" // cpuid // Amount of continuous ram under 4Gig u32 RamSize; diff --git a/src/fw/shadow.c b/src/fw/shadow.c index 67e943f..767c6ea 100644 --- a/src/fw/shadow.c +++ b/src/fw/shadow.c @@ -12,6 +12,7 @@ #include "hw/pci_regs.h" // PCI_VENDOR_ID #include "paravirt.h" // runningOnXen #include "dev-q35.h" // PCI_VENDOR_ID_INTEL +#include "x86.h" // wbinvd // On the emulators, the bios at 0xf is also at 0x #define BIOS_SRC_OFFSET 0xfff0 diff --git a/src/fw/smbios.c b/src/fw/smbios.c index fd63afb..93fb57f 100644 --- a/src/fw/smbios.c +++ b/src/fw/smbios.c @@ -9,6 +9,7 @@ #include "config.h" // CONFIG_* #include "paravirt.h" // RamSize #include "smbios.h" // struct smbios_entry_point +#include "x86.h" // cpuid struct smbios_entry_point *SMBiosAddr; diff --git a/src/fw/smm.c b/src/fw/smm.c index 3f01207..3a1a799 100644 --- a/src/fw/smm.c +++ b/src/fw/smm.c @@ -7,11 +7,12 @@ #include "hw/pci.h" // pci_config_writel #include "hw/pci_regs.h" // PCI_DEVICE_ID -#include "util.h" // wbinvd +#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 "x86.h" // wbinvd extern u8 smm_relocation_start, smm_relocation_end; ASM32FLAT( diff --git a/src/fw/smp.c b/src/fw/smp.c index 6379d36..a8504ab 10064
[SeaBIOS] [PATCH 02/23] Move keyboard calling code from util.c to boot.c.
Signed-off-by: Kevin O'Connor --- src/boot.c | 44 +++- src/util.c | 41 - src/util.h | 1 - 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/boot.c b/src/boot.c index bbe9155..3542283 100644 --- a/src/boot.c +++ b/src/boot.c @@ -1,6 +1,6 @@ // Code to load disk image and start system boot. // -// Copyright (C) 2008-2010 Kevin O'Connor +// Copyright (C) 2008-2013 Kevin O'Connor // Copyright (C) 2002 MandrakeSoft S.A. // // This file may be distributed under the terms of the GNU LGPLv3 license. @@ -396,6 +396,48 @@ boot_add_cbfs(void *data, const char *desc, int prio) / + * Keyboard calls + / + +// See if a keystroke is pending in the keyboard buffer. +static int +check_for_keystroke(void) +{ +struct bregs br; +memset(&br, 0, sizeof(br)); +br.flags = F_IF|F_ZF; +br.ah = 1; +call16_int(0x16, &br); +return !(br.flags & F_ZF); +} + +// Return a keystroke - waiting forever if necessary. +static int +get_raw_keystroke(void) +{ +struct bregs br; +memset(&br, 0, sizeof(br)); +br.flags = F_IF; +call16_int(0x16, &br); +return br.ah; +} + +// Read a keystroke - waiting up to 'msec' milliseconds. +static int +get_keystroke(int msec) +{ +u32 end = irqtimer_calc(msec); +for (;;) { +if (check_for_keystroke()) +return get_raw_keystroke(); +if (irqtimer_check(end)) +return -1; +yield_toirq(); +} +} + + +/ * Boot menu and BCV execution / diff --git a/src/util.c b/src/util.c index dd7afdf..ee59b13 100644 --- a/src/util.c +++ b/src/util.c @@ -233,44 +233,3 @@ nullTrailingSpace(char *buf) while (end >= buf && *end <= ' ') *(end--) = '\0'; } - -/ - * Keyboard calls - / - -// See if a keystroke is pending in the keyboard buffer. -static int -check_for_keystroke(void) -{ -struct bregs br; -memset(&br, 0, sizeof(br)); -br.flags = F_IF|F_ZF; -br.ah = 1; -call16_int(0x16, &br); -return !(br.flags & F_ZF); -} - -// Return a keystroke - waiting forever if necessary. -static int -get_raw_keystroke(void) -{ -struct bregs br; -memset(&br, 0, sizeof(br)); -br.flags = F_IF; -call16_int(0x16, &br); -return br.ah; -} - -// Read a keystroke - waiting up to 'msec' milliseconds. -int -get_keystroke(int msec) -{ -u32 end = irqtimer_calc(msec); -for (;;) { -if (check_for_keystroke()) -return get_raw_keystroke(); -if (irqtimer_check(end)) -return -1; -yield_toirq(); -} -} diff --git a/src/util.h b/src/util.h index 70114a6..4fa0939 100644 --- a/src/util.h +++ b/src/util.h @@ -30,7 +30,6 @@ void *memmove(void *d, const void *s, size_t len); char *strtcpy(char *dest, const char *src, size_t len); char *strchr(const char *s, int c); void nullTrailingSpace(char *buf); -int get_keystroke(int msec); // stacks.c extern u8 ExtraStack[], *StackPos; -- 1.8.3.1 ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH 2/2] vgabios: Limit the range of the VBE number of "pages" parameter.
On Sat, Sep 14, 2013 at 09:11:02AM +0200, Paul Menzel wrote: > Am Freitag, den 13.09.2013, 16:24 -0400 schrieb Kevin O'Connor: > > Looking at the output of other VGA BIOS implementations, it appears > > that the number of available video pages reported is always between 1 > > and 127. > > That is including 1 and 127, right? > > > Signed-off-by: Kevin O'Connor > > --- > > vgasrc/vbe.c | 4 > > 1 file changed, 4 insertions(+) > > > > diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c > > index d962333..2c08736 100644 > > --- a/vgasrc/vbe.c > > +++ b/vgasrc/vbe.c > > @@ -144,6 +144,10 @@ vbe_104f01(struct bregs *regs) > > mode_attr |= VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE; > > break; > > } > > +if (pages > 128) > > +pages = 128; > > As 1 gets subtracted (below in diff), in this case 127 is included. > > > +if (pages < 2) > > +pages++; > > Can pages be 0? If yes, it would be 0 again after substracting 1. Should > it be `pages = 1` instead of `pages++`? The goal was to report 0 if there isn't enough memory for even a single image. Ideally that would not happen in practice as it shouldn't even be presented as a valid video mode if there isn't enough memory for it. Otherwise, the goal is to report between 1-127 (inclusive) for the number of pages. So, if there is only enough ram for 1 image, then the code would report 1 (which means 2 images). If there is enough ram for more than 128 images, then the code would report 127 (which means 128). This is what the AMD VGABIOS appears to be doing. -Kevin ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH 2/2] vgabios: Limit the range of the VBE number of "pages" parameter.
Paul Menzel wrote: > > +if (pages < 2) > > +pages++; > > Can pages be 0? If yes, it would be 0 again after substracting 1. Should > it be `pages = 1` instead of `pages++`? pages=2; //Peter ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH 2/2] vgabios: Limit the range of the VBE number of "pages" parameter.
Am Freitag, den 13.09.2013, 16:24 -0400 schrieb Kevin O'Connor: > Looking at the output of other VGA BIOS implementations, it appears > that the number of available video pages reported is always between 1 > and 127. That is including 1 and 127, right? > Signed-off-by: Kevin O'Connor > --- > vgasrc/vbe.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c > index d962333..2c08736 100644 > --- a/vgasrc/vbe.c > +++ b/vgasrc/vbe.c > @@ -144,6 +144,10 @@ vbe_104f01(struct bregs *regs) > mode_attr |= VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE; > break; > } > +if (pages > 128) > +pages = 128; As 1 gets subtracted (below in diff), in this case 127 is included. > +if (pages < 2) > +pages++; Can pages be 0? If yes, it would be 0 again after substracting 1. Should it be `pages = 1` instead of `pages++`? > SET_FARVAR(seg, info->mode_attributes, mode_attr); > SET_FARVAR(seg, info->planes, planes); > SET_FARVAR(seg, info->pages, pages - 1); Thanks, Paul signature.asc Description: This is a digitally signed message part ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios