Kevin O'Connor | fa9c66a | 2013-09-14 19:10:40 -0400 | [diff] [blame] | 1 | // Misc function and variable declarations. |
Kevin O'Connor | 786502d | 2008-02-27 10:41:41 -0500 | [diff] [blame] | 2 | #ifndef __UTIL_H |
| 3 | #define __UTIL_H |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 4 | |
Kevin O'Connor | 9521e26 | 2008-07-04 13:04:29 -0400 | [diff] [blame] | 5 | #include "types.h" // u32 |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 6 | |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 7 | // apm.c |
| 8 | void apm_shutdown(void); |
Kevin O'Connor | 2d2fa31 | 2013-09-14 21:55:26 -0400 | [diff] [blame] | 9 | struct bregs; |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 10 | void handle_1553(struct bregs *regs); |
Kevin O'Connor | bdce35f | 2008-02-26 21:33:14 -0500 | [diff] [blame] | 11 | |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 12 | // bmp.c |
| 13 | struct bmp_decdata *bmp_alloc(void); |
| 14 | int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size); |
| 15 | void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height); |
| 16 | int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width |
| 17 | , int height, int depth, int bytes_per_line_dest); |
Kevin O'Connor | f54c150 | 2008-06-14 15:56:16 -0400 | [diff] [blame] | 18 | |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 19 | // boot.c |
| 20 | void boot_init(void); |
| 21 | void boot_add_bev(u16 seg, u16 bev, u16 desc, int prio); |
| 22 | void boot_add_bcv(u16 seg, u16 ip, u16 desc, int prio); |
| 23 | struct drive_s; |
| 24 | void boot_add_floppy(struct drive_s *drive_g, const char *desc, int prio); |
| 25 | void boot_add_hd(struct drive_s *drive_g, const char *desc, int prio); |
| 26 | void boot_add_cd(struct drive_s *drive_g, const char *desc, int prio); |
| 27 | void boot_add_cbfs(void *data, const char *desc, int prio); |
| 28 | void interactive_bootmenu(void); |
| 29 | void bcv_prepboot(void); |
| 30 | struct pci_device; |
| 31 | int bootprio_find_pci_device(struct pci_device *pci); |
| 32 | int bootprio_find_scsi_device(struct pci_device *pci, int target, int lun); |
| 33 | int bootprio_find_ata_device(struct pci_device *pci, int chanid, int slave); |
| 34 | int bootprio_find_fdc_device(struct pci_device *pci, int port, int fdid); |
| 35 | int bootprio_find_pci_rom(struct pci_device *pci, int instance); |
| 36 | int bootprio_find_named_rom(const char *name, int instance); |
| 37 | struct usbdevice_s; |
| 38 | int bootprio_find_usb(struct usbdevice_s *usbdev, int lun); |
Stefan Berger | 320df85 | 2015-11-30 11:14:19 -0500 | [diff] [blame] | 39 | int get_keystroke(int msec); |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 40 | |
| 41 | // bootsplash.c |
| 42 | void enable_vga_console(void); |
| 43 | void enable_bootsplash(void); |
| 44 | void disable_bootsplash(void); |
Kevin O'Connor | 913cc2e | 2008-04-13 17:31:45 -0400 | [diff] [blame] | 45 | |
Kevin O'Connor | 135f3f6 | 2013-09-14 23:57:26 -0400 | [diff] [blame] | 46 | // cdrom.c |
Kevin O'Connor | 02f7676 | 2014-05-10 01:20:46 -0400 | [diff] [blame] | 47 | extern struct eltorito_s CDEmu; |
Kevin O'Connor | 135f3f6 | 2013-09-14 23:57:26 -0400 | [diff] [blame] | 48 | extern struct drive_s *cdemu_drive_gf; |
| 49 | struct disk_op_s; |
Kevin O'Connor | 1785645 | 2015-07-07 14:56:20 -0400 | [diff] [blame] | 50 | int cdemu_process_op(struct disk_op_s *op); |
Kevin O'Connor | 135f3f6 | 2013-09-14 23:57:26 -0400 | [diff] [blame] | 51 | void cdrom_prepboot(void); |
Kevin O'Connor | 135f3f6 | 2013-09-14 23:57:26 -0400 | [diff] [blame] | 52 | int cdrom_boot(struct drive_s *drive_g); |
| 53 | |
Kevin O'Connor | bdce35f | 2008-02-26 21:33:14 -0500 | [diff] [blame] | 54 | // clock.c |
Kevin O'Connor | c6e8c07 | 2013-07-20 10:51:58 -0400 | [diff] [blame] | 55 | void clock_setup(void); |
| 56 | void handle_1583(struct bregs *regs); |
Kevin O'Connor | bd5f6c7 | 2015-08-10 16:14:48 -0400 | [diff] [blame] | 57 | void clock_poll_irq(void); |
Kevin O'Connor | 9fcd199 | 2013-09-15 01:50:00 -0400 | [diff] [blame] | 58 | u32 irqtimer_calc_ticks(u32 count); |
| 59 | u32 irqtimer_calc(u32 msecs); |
| 60 | int irqtimer_check(u32 end); |
Kevin O'Connor | c6e8c07 | 2013-07-20 10:51:58 -0400 | [diff] [blame] | 61 | void handle_1586(struct bregs *regs); |
Kevin O'Connor | c6e8c07 | 2013-07-20 10:51:58 -0400 | [diff] [blame] | 62 | |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 63 | // fw/acpi.c |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 64 | void acpi_setup(void); |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 65 | |
| 66 | // fw/biostable.c |
Kevin O'Connor | 3bd2dc6 | 2014-04-07 16:35:18 -0400 | [diff] [blame] | 67 | void copy_pir(void *pos); |
| 68 | void copy_mptable(void *pos); |
Kevin O'Connor | 19646a4 | 2014-04-07 15:55:23 -0400 | [diff] [blame] | 69 | extern struct pir_header *PirAddr; |
Kevin O'Connor | 3bd2dc6 | 2014-04-07 16:35:18 -0400 | [diff] [blame] | 70 | void copy_acpi_rsdp(void *pos); |
Kevin O'Connor | 836b4d8 | 2014-04-07 15:42:04 -0400 | [diff] [blame] | 71 | extern struct rsdp_descriptor *RsdpAddr; |
| 72 | extern u32 acpi_pm1a_cnt; |
Gerd Hoffmann | a217de9 | 2014-05-13 14:01:22 +0200 | [diff] [blame] | 73 | extern u16 acpi_pm_base; |
Kevin O'Connor | 836b4d8 | 2014-04-07 15:42:04 -0400 | [diff] [blame] | 74 | void *find_acpi_rsdp(void); |
| 75 | u32 find_resume_vector(void); |
| 76 | void acpi_reboot(void); |
| 77 | void find_acpi_features(void); |
Kevin O'Connor | d18c9f0 | 2014-04-07 15:48:12 -0400 | [diff] [blame] | 78 | extern struct smbios_entry_point *SMBiosAddr; |
Stefan Berger | 5aa2a75 | 2015-03-23 14:22:17 -0400 | [diff] [blame] | 79 | struct smbios_entry_point *get_smbios_entry_point(); |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 80 | void copy_smbios(void *pos); |
Kevin O'Connor | d18c9f0 | 2014-04-07 15:48:12 -0400 | [diff] [blame] | 81 | void display_uuid(void); |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 82 | void copy_table(void *pos); |
Gabriel L. Somlo | d85c22e | 2014-04-23 15:04:49 -0400 | [diff] [blame] | 83 | void smbios_setup(void); |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 84 | |
| 85 | // fw/coreboot.c |
| 86 | extern const char *CBvendor, *CBpart; |
| 87 | struct cbfs_file; |
Kevin O'Connor | 4cd522e | 2013-11-29 12:14:34 -0500 | [diff] [blame] | 88 | void coreboot_debug_putc(char c); |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 89 | void cbfs_run_payload(struct cbfs_file *file); |
| 90 | void coreboot_platform_setup(void); |
| 91 | void cbfs_payload_setup(void); |
| 92 | void coreboot_preinit(void); |
| 93 | void coreboot_cbfs_init(void); |
Kevin O'Connor | 5ab18be | 2014-02-11 15:33:42 -0500 | [diff] [blame] | 94 | struct cb_header; |
| 95 | void *find_cb_subtable(struct cb_header *cbh, u32 tag); |
| 96 | struct cb_header *find_cb_table(void); |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 97 | |
| 98 | // fw/csm.c |
| 99 | int csm_bootprio_fdc(struct pci_device *pci, int port, int fdid); |
| 100 | int csm_bootprio_ata(struct pci_device *pci, int chanid, int slave); |
| 101 | int csm_bootprio_pci(struct pci_device *pci); |
| 102 | |
| 103 | // fw/mptable.c |
| 104 | void mptable_setup(void); |
| 105 | |
| 106 | // fw/mtrr.c |
| 107 | void mtrr_setup(void); |
| 108 | |
Vladimir Serbinenko | 1b911d7 | 2015-05-18 19:07:16 +0200 | [diff] [blame] | 109 | // fw/multiboot.c |
| 110 | void multiboot_init(void); |
| 111 | |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 112 | // fw/pciinit.c |
| 113 | extern const u8 pci_irqs[4]; |
| 114 | void pci_setup(void); |
Marcel Apfelbaum | 40d020f | 2014-01-15 14:20:06 +0200 | [diff] [blame] | 115 | void pci_resume(void); |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 116 | |
| 117 | // fw/pirtable.c |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 118 | void pirtable_setup(void); |
| 119 | |
| 120 | // fw/shadow.c |
| 121 | void make_bios_writable(void); |
| 122 | void make_bios_readonly(void); |
| 123 | void qemu_prep_reset(void); |
| 124 | |
| 125 | // fw/smbios.c |
Gabriel L. Somlo | d85c22e | 2014-04-23 15:04:49 -0400 | [diff] [blame] | 126 | void smbios_legacy_setup(void); |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 127 | |
| 128 | // fw/smm.c |
| 129 | void smm_device_setup(void); |
| 130 | void smm_setup(void); |
| 131 | |
| 132 | // fw/smp.c |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 133 | extern u32 MaxCountCPUs; |
| 134 | void wrmsr_smp(u32 index, u64 val); |
| 135 | void smp_setup(void); |
| 136 | int apic_id_is_present(u8 apic_id); |
| 137 | |
Kevin O'Connor | 7b9f297 | 2013-09-18 21:04:03 -0400 | [diff] [blame] | 138 | // hw/dma.c |
| 139 | int dma_floppy(u32 addr, int count, int isWrite); |
| 140 | void dma_setup(void); |
| 141 | |
Kevin O'Connor | 135f3f6 | 2013-09-14 23:57:26 -0400 | [diff] [blame] | 142 | // hw/floppy.c |
| 143 | extern struct floppy_ext_dbt_s diskette_param_table2; |
| 144 | void floppy_setup(void); |
| 145 | struct drive_s *init_floppy(int floppyid, int ftype); |
| 146 | int find_floppy_type(u32 size); |
Kevin O'Connor | 1785645 | 2015-07-07 14:56:20 -0400 | [diff] [blame] | 147 | int floppy_process_op(struct disk_op_s *op); |
Kevin O'Connor | 135f3f6 | 2013-09-14 23:57:26 -0400 | [diff] [blame] | 148 | void floppy_tick(void); |
| 149 | |
| 150 | // hw/ramdisk.c |
| 151 | void ramdisk_setup(void); |
Kevin O'Connor | 1785645 | 2015-07-07 14:56:20 -0400 | [diff] [blame] | 152 | int ramdisk_process_op(struct disk_op_s *op); |
Kevin O'Connor | 135f3f6 | 2013-09-14 23:57:26 -0400 | [diff] [blame] | 153 | |
Kevin O'Connor | 72691a5 | 2014-12-16 09:55:16 -0500 | [diff] [blame] | 154 | // hw/sdcard.c |
Kevin O'Connor | 1785645 | 2015-07-07 14:56:20 -0400 | [diff] [blame] | 155 | int sdcard_process_op(struct disk_op_s *op); |
Kevin O'Connor | 72691a5 | 2014-12-16 09:55:16 -0500 | [diff] [blame] | 156 | void sdcard_setup(void); |
| 157 | |
Kevin O'Connor | 5d369d8 | 2013-09-02 20:48:46 -0400 | [diff] [blame] | 158 | // hw/timer.c |
Kevin O'Connor | 1ca05b0 | 2010-01-03 17:43:37 -0500 | [diff] [blame] | 159 | void timer_setup(void); |
Kevin O'Connor | 018bdd7 | 2013-07-20 18:22:57 -0400 | [diff] [blame] | 160 | void pmtimer_setup(u16 ioport); |
| 161 | u32 timer_calc(u32 msecs); |
| 162 | u32 timer_calc_usec(u32 usecs); |
| 163 | int timer_check(u32 end); |
Kevin O'Connor | bc2aecd | 2008-11-28 16:40:06 -0500 | [diff] [blame] | 164 | void ndelay(u32 count); |
| 165 | void udelay(u32 count); |
| 166 | void mdelay(u32 count); |
Kevin O'Connor | 10ad799 | 2009-10-24 11:06:08 -0400 | [diff] [blame] | 167 | void nsleep(u32 count); |
| 168 | void usleep(u32 count); |
| 169 | void msleep(u32 count); |
Kevin O'Connor | 018bdd7 | 2013-07-20 18:22:57 -0400 | [diff] [blame] | 170 | u32 ticks_to_ms(u32 ticks); |
| 171 | u32 ticks_from_ms(u32 ms); |
Kevin O'Connor | 9fcd199 | 2013-09-15 01:50:00 -0400 | [diff] [blame] | 172 | void pit_setup(void); |
Kevin O'Connor | bdce35f | 2008-02-26 21:33:14 -0500 | [diff] [blame] | 173 | |
Kevin O'Connor | 07cf73b | 2013-09-15 00:31:17 -0400 | [diff] [blame] | 174 | // jpeg.c |
| 175 | struct jpeg_decdata *jpeg_alloc(void); |
| 176 | int jpeg_decode(struct jpeg_decdata *jpeg, unsigned char *buf); |
| 177 | void jpeg_get_size(struct jpeg_decdata *jpeg, int *width, int *height); |
| 178 | int jpeg_show(struct jpeg_decdata *jpeg, unsigned char *pic, int width |
| 179 | , int height, int depth, int bytes_per_line_dest); |
| 180 | |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 181 | // kbd.c |
| 182 | void kbd_init(void); |
| 183 | void handle_15c2(struct bregs *regs); |
| 184 | void process_key(u8 key); |
| 185 | |
| 186 | // misc.c |
Kevin O'Connor | eb59924 | 2015-11-19 15:29:39 -0500 | [diff] [blame] | 187 | extern int HaveRunPost; |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 188 | extern struct bios_config_table_s BIOS_CONFIG_TABLE __aligned(1); |
Kevin O'Connor | ca34ce5 | 2014-05-24 10:40:35 -0400 | [diff] [blame] | 189 | extern struct floppy_dbt_s diskette_param_table __aligned(1); |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 190 | extern u8 BiosChecksum; |
Kevin O'Connor | 6c68e7a | 2014-04-19 12:22:22 -0400 | [diff] [blame] | 191 | int in_post(void); |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 192 | void mathcp_setup(void); |
| 193 | |
| 194 | // mouse.c |
| 195 | void mouse_init(void); |
| 196 | void process_mouse(u8 data); |
| 197 | |
Kevin O'Connor | 8fb3a5e | 2013-09-14 22:27:14 -0400 | [diff] [blame] | 198 | // optionroms.c |
| 199 | struct rom_header; |
| 200 | void callrom(struct rom_header *rom, u16 bdf); |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 201 | void call_bcv(u16 seg, u16 ip); |
| 202 | int is_pci_vga(struct pci_device *pci); |
| 203 | void optionrom_setup(void); |
| 204 | void vgarom_setup(void); |
| 205 | void s3_resume_vga(void); |
| 206 | extern int ScreenAndDebug; |
Kevin O'Connor | 8fb3a5e | 2013-09-14 22:27:14 -0400 | [diff] [blame] | 207 | |
Kevin O'Connor | a0dc296 | 2008-03-16 14:29:32 -0400 | [diff] [blame] | 208 | // pcibios.c |
| 209 | void handle_1ab1(struct bregs *regs); |
Kevin O'Connor | d83c87b | 2013-01-21 01:14:12 -0500 | [diff] [blame] | 210 | void bios32_init(void); |
Kevin O'Connor | a0dc296 | 2008-03-16 14:29:32 -0400 | [diff] [blame] | 211 | |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 212 | // pmm.c |
| 213 | void pmm_init(void); |
| 214 | void pmm_prepboot(void); |
| 215 | |
| 216 | // pnpbios.c |
| 217 | u16 get_pnp_offset(void); |
| 218 | void pnp_init(void); |
| 219 | |
Kevin O'Connor | 07cf73b | 2013-09-15 00:31:17 -0400 | [diff] [blame] | 220 | // post.c |
| 221 | void interface_init(void); |
| 222 | void device_hardware_setup(void); |
| 223 | void prepareboot(void); |
| 224 | void startBoot(void); |
| 225 | void reloc_preinit(void *f, void *arg); |
| 226 | |
Kevin O'Connor | b367e0a | 2013-09-15 00:43:51 -0400 | [diff] [blame] | 227 | // serial.c |
| 228 | void serial_setup(void); |
| 229 | void lpt_setup(void); |
Ian Campbell | 1442c31 | 2011-06-01 11:00:28 +0100 | [diff] [blame] | 230 | |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 231 | // vgahooks.c |
Kevin O'Connor | 1ca05b0 | 2010-01-03 17:43:37 -0500 | [diff] [blame] | 232 | void handle_155f(struct bregs *regs); |
Jonathan A. Kollasch | e9a3e12 | 2013-10-20 12:48:56 -0500 | [diff] [blame] | 233 | void handle_157f(struct bregs *regs); |
Kevin O'Connor | c1de91b | 2011-07-02 13:50:21 -0400 | [diff] [blame] | 234 | void vgahook_setup(struct pci_device *pci); |
Kevin O'Connor | cbffa8e | 2008-08-17 11:11:07 -0400 | [diff] [blame] | 235 | |
Kevin O'Connor | 3085376 | 2009-01-17 18:49:20 -0500 | [diff] [blame] | 236 | |
Kevin O'Connor | c95d2ce | 2009-07-29 20:41:39 -0400 | [diff] [blame] | 237 | // version (auto generated file out/version.c) |
Kevin O'Connor | efd70a5 | 2015-10-13 15:44:25 -0400 | [diff] [blame] | 238 | extern const char VERSION[], BUILDINFO[]; |
Kevin O'Connor | c95d2ce | 2009-07-29 20:41:39 -0400 | [diff] [blame] | 239 | |
Kevin O'Connor | 786502d | 2008-02-27 10:41:41 -0500 | [diff] [blame] | 240 | #endif // util.h |