blob: 9557581b159d4ffa9b044d554f4c55f501ff13df [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
46extern u8 CDRom_locks[];
47extern struct cdemu_s CDEmu;
48extern struct drive_s *cdemu_drive_gf;
49struct disk_op_s;
50int process_cdemu_op(struct disk_op_s *op);
51void cdrom_prepboot(void);
52void cdemu_134b(struct bregs *regs);
53int cdrom_boot(struct drive_s *drive_g);
54
Kevin O'Connorbdce35f2008-02-26 21:33:14 -050055// clock.c
Kevin O'Connorc6e8c072013-07-20 10:51:58 -040056void clock_setup(void);
57void handle_1583(struct bregs *regs);
Kevin O'Connor9fcd1992013-09-15 01:50:00 -040058u32 irqtimer_calc_ticks(u32 count);
59u32 irqtimer_calc(u32 msecs);
60int irqtimer_check(u32 end);
Kevin O'Connorc6e8c072013-07-20 10:51:58 -040061void handle_1586(struct bregs *regs);
Kevin O'Connorc6e8c072013-07-20 10:51:58 -040062
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040063// fw/acpi.c
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040064void acpi_setup(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040065
66// fw/biostable.c
Kevin O'Connor3bd2dc62014-04-07 16:35:18 -040067void copy_pir(void *pos);
68void copy_mptable(void *pos);
Kevin O'Connor19646a42014-04-07 15:55:23 -040069extern struct pir_header *PirAddr;
Kevin O'Connor3bd2dc62014-04-07 16:35:18 -040070void copy_acpi_rsdp(void *pos);
Kevin O'Connor836b4d82014-04-07 15:42:04 -040071extern struct rsdp_descriptor *RsdpAddr;
72extern u32 acpi_pm1a_cnt;
73void *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;
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040078void copy_smbios(void *pos);
Kevin O'Connord18c9f02014-04-07 15:48:12 -040079void display_uuid(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040080void copy_table(void *pos);
Gabriel L. Somlod85c22e2014-04-23 15:04:49 -040081void smbios_setup(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040082
83// fw/coreboot.c
84extern const char *CBvendor, *CBpart;
85struct cbfs_file;
Kevin O'Connor4cd522e2013-11-29 12:14:34 -050086void coreboot_debug_putc(char c);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040087void cbfs_run_payload(struct cbfs_file *file);
88void coreboot_platform_setup(void);
89void cbfs_payload_setup(void);
90void coreboot_preinit(void);
91void coreboot_cbfs_init(void);
Kevin O'Connor5ab18be2014-02-11 15:33:42 -050092struct cb_header;
93void *find_cb_subtable(struct cb_header *cbh, u32 tag);
94struct cb_header *find_cb_table(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -040095
96// fw/csm.c
97int csm_bootprio_fdc(struct pci_device *pci, int port, int fdid);
98int csm_bootprio_ata(struct pci_device *pci, int chanid, int slave);
99int csm_bootprio_pci(struct pci_device *pci);
100
101// fw/mptable.c
102void mptable_setup(void);
103
104// fw/mtrr.c
105void mtrr_setup(void);
106
107// fw/pciinit.c
108extern const u8 pci_irqs[4];
109void pci_setup(void);
Marcel Apfelbaum40d020f2014-01-15 14:20:06 +0200110void pci_resume(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400111
112// fw/pirtable.c
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400113void pirtable_setup(void);
114
115// fw/shadow.c
116void make_bios_writable(void);
117void make_bios_readonly(void);
118void qemu_prep_reset(void);
119
120// fw/smbios.c
Gabriel L. Somlod85c22e2014-04-23 15:04:49 -0400121void smbios_legacy_setup(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400122
123// fw/smm.c
124void smm_device_setup(void);
125void smm_setup(void);
126
127// fw/smp.c
128extern u32 CountCPUs;
129extern u32 MaxCountCPUs;
130void wrmsr_smp(u32 index, u64 val);
131void smp_setup(void);
132int apic_id_is_present(u8 apic_id);
133
Kevin O'Connor7b9f2972013-09-18 21:04:03 -0400134// hw/dma.c
135int dma_floppy(u32 addr, int count, int isWrite);
136void dma_setup(void);
137
Kevin O'Connor135f3f62013-09-14 23:57:26 -0400138// hw/floppy.c
139extern struct floppy_ext_dbt_s diskette_param_table2;
140void floppy_setup(void);
141struct drive_s *init_floppy(int floppyid, int ftype);
142int find_floppy_type(u32 size);
143int process_floppy_op(struct disk_op_s *op);
144void floppy_tick(void);
145
146// hw/ramdisk.c
147void ramdisk_setup(void);
148int process_ramdisk_op(struct disk_op_s *op);
149
Kevin O'Connor5d369d82013-09-02 20:48:46 -0400150// hw/timer.c
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500151void timer_setup(void);
Kevin O'Connor018bdd72013-07-20 18:22:57 -0400152void pmtimer_setup(u16 ioport);
153u32 timer_calc(u32 msecs);
154u32 timer_calc_usec(u32 usecs);
155int timer_check(u32 end);
Kevin O'Connorbc2aecd2008-11-28 16:40:06 -0500156void ndelay(u32 count);
157void udelay(u32 count);
158void mdelay(u32 count);
Kevin O'Connor10ad7992009-10-24 11:06:08 -0400159void nsleep(u32 count);
160void usleep(u32 count);
161void msleep(u32 count);
Kevin O'Connor018bdd72013-07-20 18:22:57 -0400162u32 ticks_to_ms(u32 ticks);
163u32 ticks_from_ms(u32 ms);
Kevin O'Connor9fcd1992013-09-15 01:50:00 -0400164void pit_setup(void);
Kevin O'Connorbdce35f2008-02-26 21:33:14 -0500165
Kevin O'Connor07cf73b2013-09-15 00:31:17 -0400166// jpeg.c
167struct jpeg_decdata *jpeg_alloc(void);
168int jpeg_decode(struct jpeg_decdata *jpeg, unsigned char *buf);
169void jpeg_get_size(struct jpeg_decdata *jpeg, int *width, int *height);
170int jpeg_show(struct jpeg_decdata *jpeg, unsigned char *pic, int width
171 , int height, int depth, int bytes_per_line_dest);
172
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400173// kbd.c
174void kbd_init(void);
175void handle_15c2(struct bregs *regs);
176void process_key(u8 key);
177
178// misc.c
179extern struct bios_config_table_s BIOS_CONFIG_TABLE __aligned(1);
180extern u8 BiosChecksum;
181void mathcp_setup(void);
182
183// mouse.c
184void mouse_init(void);
185void process_mouse(u8 data);
186
Kevin O'Connor8fb3a5e2013-09-14 22:27:14 -0400187// optionroms.c
188struct rom_header;
189void callrom(struct rom_header *rom, u16 bdf);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400190void call_bcv(u16 seg, u16 ip);
191int is_pci_vga(struct pci_device *pci);
192void optionrom_setup(void);
193void vgarom_setup(void);
194void s3_resume_vga(void);
195extern int ScreenAndDebug;
Kevin O'Connor8fb3a5e2013-09-14 22:27:14 -0400196
Kevin O'Connora0dc2962008-03-16 14:29:32 -0400197// pcibios.c
198void handle_1ab1(struct bregs *regs);
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500199void bios32_init(void);
Kevin O'Connora0dc2962008-03-16 14:29:32 -0400200
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400201// pmm.c
202void pmm_init(void);
203void pmm_prepboot(void);
204
205// pnpbios.c
206u16 get_pnp_offset(void);
207void pnp_init(void);
208
Kevin O'Connor07cf73b2013-09-15 00:31:17 -0400209// post.c
210void interface_init(void);
211void device_hardware_setup(void);
212void prepareboot(void);
213void startBoot(void);
214void reloc_preinit(void *f, void *arg);
215
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400216// resume.c
217extern int HaveRunPost;
Kevin O'Connor5a7545c2013-09-14 22:54:44 -0400218
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400219// romlayout.S
220void reset_vector(void) __noreturn;
Kevin O'Connorf6d700d2013-09-14 22:38:00 -0400221
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400222// serial.c
223void serial_setup(void);
224void lpt_setup(void);
Ian Campbell1442c312011-06-01 11:00:28 +0100225
Kevin O'Connorcbffa8e2008-08-17 11:11:07 -0400226// vgahooks.c
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500227void handle_155f(struct bregs *regs);
Jonathan A. Kollasche9a3e122013-10-20 12:48:56 -0500228void handle_157f(struct bregs *regs);
Kevin O'Connorc1de91b2011-07-02 13:50:21 -0400229void vgahook_setup(struct pci_device *pci);
Kevin O'Connorcbffa8e2008-08-17 11:11:07 -0400230
Kevin O'Connor30853762009-01-17 18:49:20 -0500231
Kevin O'Connorc95d2ce2009-07-29 20:41:39 -0400232// version (auto generated file out/version.c)
233extern const char VERSION[];
234
Kevin O'Connor786502d2008-02-27 10:41:41 -0500235#endif // util.h