blob: ba9c420ea1a9dcf5b2e9ab466233c5f904c0ba00 [file] [log] [blame]
Kevin O'Connorfa9c66a2013-09-14 19:10:40 -04001// Misc function and variable declarations.
Kevin O'Connor786502d2008-02-27 10:41:41 -05002#ifndef __UTIL_H
3#define __UTIL_H
Kevin O'Connorf076a3e2008-02-25 22:25:15 -05004
Kevin O'Connor9521e262008-07-04 13:04:29 -04005#include "types.h" // u32
Kevin O'Connorf076a3e2008-02-25 22:25:15 -05006
Kevin O'Connorb367e0a2013-09-15 00:43:51 -04007// apm.c
8void apm_shutdown(void);
Kevin O'Connor2d2fa312013-09-14 21:55:26 -04009struct bregs;
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040010void handle_1553(struct bregs *regs);
Kevin O'Connorbdce35f2008-02-26 21:33:14 -050011
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040012// bmp.c
13struct bmp_decdata *bmp_alloc(void);
14int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size);
15void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height);
16int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width
17 , int height, int depth, int bytes_per_line_dest);
Kevin O'Connorf54c1502008-06-14 15:56:16 -040018
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040019// boot.c
20void boot_init(void);
21void boot_add_bev(u16 seg, u16 bev, u16 desc, int prio);
22void boot_add_bcv(u16 seg, u16 ip, u16 desc, int prio);
23struct drive_s;
24void boot_add_floppy(struct drive_s *drive_g, const char *desc, int prio);
25void boot_add_hd(struct drive_s *drive_g, const char *desc, int prio);
26void boot_add_cd(struct drive_s *drive_g, const char *desc, int prio);
27void boot_add_cbfs(void *data, const char *desc, int prio);
28void interactive_bootmenu(void);
29void bcv_prepboot(void);
30struct pci_device;
31int bootprio_find_pci_device(struct pci_device *pci);
32int bootprio_find_scsi_device(struct pci_device *pci, int target, int lun);
33int bootprio_find_ata_device(struct pci_device *pci, int chanid, int slave);
34int bootprio_find_fdc_device(struct pci_device *pci, int port, int fdid);
35int bootprio_find_pci_rom(struct pci_device *pci, int instance);
36int bootprio_find_named_rom(const char *name, int instance);
37struct usbdevice_s;
38int bootprio_find_usb(struct usbdevice_s *usbdev, int lun);
39
40// bootsplash.c
41void enable_vga_console(void);
42void enable_bootsplash(void);
43void disable_bootsplash(void);
Kevin O'Connor913cc2e2008-04-13 17:31:45 -040044
Kevin O'Connor135f3f62013-09-14 23:57:26 -040045// cdrom.c
Kevin O'Connor02f76762014-05-10 01:20:46 -040046extern struct eltorito_s CDEmu;
Kevin O'Connor135f3f62013-09-14 23:57:26 -040047extern struct drive_s *cdemu_drive_gf;
48struct disk_op_s;
Kevin O'Connor17856452015-07-07 14:56:20 -040049int cdemu_process_op(struct disk_op_s *op);
Kevin O'Connor135f3f62013-09-14 23:57:26 -040050void cdrom_prepboot(void);
Kevin O'Connor135f3f62013-09-14 23:57:26 -040051int cdrom_boot(struct drive_s *drive_g);
52
Kevin O'Connorbdce35f2008-02-26 21:33:14 -050053// clock.c
Kevin O'Connorc6e8c072013-07-20 10:51:58 -040054void clock_setup(void);
55void handle_1583(struct bregs *regs);
Kevin O'Connorbd5f6c72015-08-10 16:14:48 -040056void clock_poll_irq(void);
Kevin O'Connor9fcd1992013-09-15 01:50:00 -040057u32 irqtimer_calc_ticks(u32 count);
58u32 irqtimer_calc(u32 msecs);
59int irqtimer_check(u32 end);
Kevin O'Connorc6e8c072013-07-20 10:51:58 -040060void handle_1586(struct bregs *regs);
Kevin O'Connorc6e8c072013-07-20 10:51:58 -040061
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040062// fw/acpi.c
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040063void acpi_setup(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040064
65// fw/biostable.c
Kevin O'Connor3bd2dc62014-04-07 16:35:18 -040066void copy_pir(void *pos);
67void copy_mptable(void *pos);
Kevin O'Connor19646a42014-04-07 15:55:23 -040068extern struct pir_header *PirAddr;
Kevin O'Connor3bd2dc62014-04-07 16:35:18 -040069void copy_acpi_rsdp(void *pos);
Kevin O'Connor836b4d82014-04-07 15:42:04 -040070extern struct rsdp_descriptor *RsdpAddr;
71extern u32 acpi_pm1a_cnt;
Gerd Hoffmanna217de92014-05-13 14:01:22 +020072extern u16 acpi_pm_base;
Kevin O'Connor836b4d82014-04-07 15:42:04 -040073void *find_acpi_rsdp(void);
74u32 find_resume_vector(void);
75void acpi_reboot(void);
76void find_acpi_features(void);
Kevin O'Connord18c9f02014-04-07 15:48:12 -040077extern struct smbios_entry_point *SMBiosAddr;
Stefan Berger5aa2a752015-03-23 14:22:17 -040078struct smbios_entry_point *get_smbios_entry_point();
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040079void copy_smbios(void *pos);
Kevin O'Connord18c9f02014-04-07 15:48:12 -040080void display_uuid(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040081void copy_table(void *pos);
Gabriel L. Somlod85c22e2014-04-23 15:04:49 -040082void smbios_setup(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040083
84// fw/coreboot.c
85extern const char *CBvendor, *CBpart;
86struct cbfs_file;
Kevin O'Connor4cd522e2013-11-29 12:14:34 -050087void coreboot_debug_putc(char c);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040088void cbfs_run_payload(struct cbfs_file *file);
89void coreboot_platform_setup(void);
90void cbfs_payload_setup(void);
91void coreboot_preinit(void);
92void coreboot_cbfs_init(void);
Kevin O'Connor5ab18be2014-02-11 15:33:42 -050093struct cb_header;
94void *find_cb_subtable(struct cb_header *cbh, u32 tag);
95struct cb_header *find_cb_table(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040096
97// fw/csm.c
98int csm_bootprio_fdc(struct pci_device *pci, int port, int fdid);
99int csm_bootprio_ata(struct pci_device *pci, int chanid, int slave);
100int csm_bootprio_pci(struct pci_device *pci);
101
102// fw/mptable.c
103void mptable_setup(void);
104
105// fw/mtrr.c
106void mtrr_setup(void);
107
Vladimir Serbinenko1b911d72015-05-18 19:07:16 +0200108// fw/multiboot.c
109void multiboot_init(void);
110
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400111// fw/pciinit.c
112extern const u8 pci_irqs[4];
113void pci_setup(void);
Marcel Apfelbaum40d020f2014-01-15 14:20:06 +0200114void pci_resume(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400115
116// fw/pirtable.c
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400117void pirtable_setup(void);
118
119// fw/shadow.c
120void make_bios_writable(void);
121void make_bios_readonly(void);
122void qemu_prep_reset(void);
123
124// fw/smbios.c
Gabriel L. Somlod85c22e2014-04-23 15:04:49 -0400125void smbios_legacy_setup(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400126
127// fw/smm.c
128void smm_device_setup(void);
129void smm_setup(void);
130
131// fw/smp.c
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400132extern u32 MaxCountCPUs;
133void wrmsr_smp(u32 index, u64 val);
134void smp_setup(void);
Paolo Bonziniba57bed2016-07-07 16:00:40 +0200135void smp_resume(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400136int apic_id_is_present(u8 apic_id);
137
Kevin O'Connor7b9f2972013-09-18 21:04:03 -0400138// hw/dma.c
139int dma_floppy(u32 addr, int count, int isWrite);
140void dma_setup(void);
141
Kevin O'Connor135f3f62013-09-14 23:57:26 -0400142// hw/floppy.c
143extern struct floppy_ext_dbt_s diskette_param_table2;
144void floppy_setup(void);
145struct drive_s *init_floppy(int floppyid, int ftype);
146int find_floppy_type(u32 size);
Kevin O'Connor17856452015-07-07 14:56:20 -0400147int floppy_process_op(struct disk_op_s *op);
Kevin O'Connor135f3f62013-09-14 23:57:26 -0400148void floppy_tick(void);
149
150// hw/ramdisk.c
151void ramdisk_setup(void);
Kevin O'Connor17856452015-07-07 14:56:20 -0400152int ramdisk_process_op(struct disk_op_s *op);
Kevin O'Connor135f3f62013-09-14 23:57:26 -0400153
Kevin O'Connor72691a52014-12-16 09:55:16 -0500154// hw/sdcard.c
Kevin O'Connor17856452015-07-07 14:56:20 -0400155int sdcard_process_op(struct disk_op_s *op);
Kevin O'Connor72691a52014-12-16 09:55:16 -0500156void sdcard_setup(void);
157
Kevin O'Connor5d369d82013-09-02 20:48:46 -0400158// hw/timer.c
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500159void timer_setup(void);
Kevin O'Connor018bdd72013-07-20 18:22:57 -0400160void pmtimer_setup(u16 ioport);
161u32 timer_calc(u32 msecs);
162u32 timer_calc_usec(u32 usecs);
163int timer_check(u32 end);
Kevin O'Connorbc2aecd2008-11-28 16:40:06 -0500164void ndelay(u32 count);
165void udelay(u32 count);
166void mdelay(u32 count);
Kevin O'Connor10ad7992009-10-24 11:06:08 -0400167void nsleep(u32 count);
168void usleep(u32 count);
169void msleep(u32 count);
Kevin O'Connor018bdd72013-07-20 18:22:57 -0400170u32 ticks_to_ms(u32 ticks);
171u32 ticks_from_ms(u32 ms);
Kevin O'Connor9fcd1992013-09-15 01:50:00 -0400172void pit_setup(void);
Kevin O'Connorbdce35f2008-02-26 21:33:14 -0500173
Kevin O'Connor07cf73b2013-09-15 00:31:17 -0400174// jpeg.c
175struct jpeg_decdata *jpeg_alloc(void);
176int jpeg_decode(struct jpeg_decdata *jpeg, unsigned char *buf);
177void jpeg_get_size(struct jpeg_decdata *jpeg, int *width, int *height);
178int jpeg_show(struct jpeg_decdata *jpeg, unsigned char *pic, int width
179 , int height, int depth, int bytes_per_line_dest);
180
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400181// kbd.c
182void kbd_init(void);
183void handle_15c2(struct bregs *regs);
184void process_key(u8 key);
185
186// misc.c
187extern struct bios_config_table_s BIOS_CONFIG_TABLE __aligned(1);
Kevin O'Connorca34ce52014-05-24 10:40:35 -0400188extern struct floppy_dbt_s diskette_param_table __aligned(1);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400189extern u8 BiosChecksum;
Kevin O'Connor6c68e7a2014-04-19 12:22:22 -0400190int in_post(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400191void mathcp_setup(void);
192
193// mouse.c
194void mouse_init(void);
195void process_mouse(u8 data);
196
Kevin O'Connor8fb3a5e2013-09-14 22:27:14 -0400197// optionroms.c
198struct rom_header;
199void callrom(struct rom_header *rom, u16 bdf);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400200void call_bcv(u16 seg, u16 ip);
201int is_pci_vga(struct pci_device *pci);
202void optionrom_setup(void);
203void vgarom_setup(void);
204void s3_resume_vga(void);
205extern int ScreenAndDebug;
Kevin O'Connor8fb3a5e2013-09-14 22:27:14 -0400206
Kevin O'Connora0dc2962008-03-16 14:29:32 -0400207// pcibios.c
208void handle_1ab1(struct bregs *regs);
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500209void bios32_init(void);
Kevin O'Connora0dc2962008-03-16 14:29:32 -0400210
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400211// pmm.c
212void pmm_init(void);
213void pmm_prepboot(void);
214
215// pnpbios.c
216u16 get_pnp_offset(void);
217void pnp_init(void);
218
Kevin O'Connor07cf73b2013-09-15 00:31:17 -0400219// post.c
220void interface_init(void);
221void device_hardware_setup(void);
222void prepareboot(void);
223void startBoot(void);
224void reloc_preinit(void *f, void *arg);
225
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400226// resume.c
227extern int HaveRunPost;
Kevin O'Connor5a7545c2013-09-14 22:54:44 -0400228
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400229// serial.c
230void serial_setup(void);
231void lpt_setup(void);
Ian Campbell1442c312011-06-01 11:00:28 +0100232
Kevin O'Connorcbffa8e2008-08-17 11:11:07 -0400233// vgahooks.c
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500234void handle_155f(struct bregs *regs);
Jonathan A. Kollasche9a3e122013-10-20 12:48:56 -0500235void handle_157f(struct bregs *regs);
Kevin O'Connorc1de91b2011-07-02 13:50:21 -0400236void vgahook_setup(struct pci_device *pci);
Kevin O'Connorcbffa8e2008-08-17 11:11:07 -0400237
Kevin O'Connor30853762009-01-17 18:49:20 -0500238
Kevin O'Connorc95d2ce2009-07-29 20:41:39 -0400239// version (auto generated file out/version.c)
Kevin O'Connorefd70a52015-10-13 15:44:25 -0400240extern const char VERSION[], BUILDINFO[];
Kevin O'Connorc95d2ce2009-07-29 20:41:39 -0400241
Kevin O'Connor786502d2008-02-27 10:41:41 -0500242#endif // util.h