blob: 09bb8a9f3b6b4d8e6e7c2b0bc357f6c02bdc98d1 [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[];
Kevin O'Connor02f76762014-05-10 01:20:46 -040047extern struct eltorito_s CDEmu;
Kevin O'Connor135f3f62013-09-14 23:57:26 -040048extern struct drive_s *cdemu_drive_gf;
49struct disk_op_s;
50int process_cdemu_op(struct disk_op_s *op);
51void cdrom_prepboot(void);
Kevin O'Connor135f3f62013-09-14 23:57:26 -040052int cdrom_boot(struct drive_s *drive_g);
53
Kevin O'Connorbdce35f2008-02-26 21:33:14 -050054// clock.c
Kevin O'Connorc6e8c072013-07-20 10:51:58 -040055void clock_setup(void);
56void handle_1583(struct bregs *regs);
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;
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
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400128extern u32 MaxCountCPUs;
129void wrmsr_smp(u32 index, u64 val);
130void smp_setup(void);
131int apic_id_is_present(u8 apic_id);
132
Kevin O'Connor7b9f2972013-09-18 21:04:03 -0400133// hw/dma.c
134int dma_floppy(u32 addr, int count, int isWrite);
135void dma_setup(void);
136
Kevin O'Connor135f3f62013-09-14 23:57:26 -0400137// hw/floppy.c
138extern struct floppy_ext_dbt_s diskette_param_table2;
139void floppy_setup(void);
140struct drive_s *init_floppy(int floppyid, int ftype);
141int find_floppy_type(u32 size);
142int process_floppy_op(struct disk_op_s *op);
143void floppy_tick(void);
144
145// hw/ramdisk.c
146void ramdisk_setup(void);
147int process_ramdisk_op(struct disk_op_s *op);
148
Kevin O'Connor72691a52014-12-16 09:55:16 -0500149// hw/sdcard.c
150int process_sdcard_op(struct disk_op_s *op);
151void sdcard_setup(void);
152
Kevin O'Connor5d369d82013-09-02 20:48:46 -0400153// hw/timer.c
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500154void timer_setup(void);
Kevin O'Connor018bdd72013-07-20 18:22:57 -0400155void pmtimer_setup(u16 ioport);
156u32 timer_calc(u32 msecs);
157u32 timer_calc_usec(u32 usecs);
158int timer_check(u32 end);
Kevin O'Connorbc2aecd2008-11-28 16:40:06 -0500159void ndelay(u32 count);
160void udelay(u32 count);
161void mdelay(u32 count);
Kevin O'Connor10ad7992009-10-24 11:06:08 -0400162void nsleep(u32 count);
163void usleep(u32 count);
164void msleep(u32 count);
Kevin O'Connor018bdd72013-07-20 18:22:57 -0400165u32 ticks_to_ms(u32 ticks);
166u32 ticks_from_ms(u32 ms);
Kevin O'Connor9fcd1992013-09-15 01:50:00 -0400167void pit_setup(void);
Kevin O'Connorbdce35f2008-02-26 21:33:14 -0500168
Kevin O'Connor07cf73b2013-09-15 00:31:17 -0400169// jpeg.c
170struct jpeg_decdata *jpeg_alloc(void);
171int jpeg_decode(struct jpeg_decdata *jpeg, unsigned char *buf);
172void jpeg_get_size(struct jpeg_decdata *jpeg, int *width, int *height);
173int jpeg_show(struct jpeg_decdata *jpeg, unsigned char *pic, int width
174 , int height, int depth, int bytes_per_line_dest);
175
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400176// kbd.c
177void kbd_init(void);
178void handle_15c2(struct bregs *regs);
179void process_key(u8 key);
180
181// misc.c
182extern struct bios_config_table_s BIOS_CONFIG_TABLE __aligned(1);
Kevin O'Connorca34ce52014-05-24 10:40:35 -0400183extern struct floppy_dbt_s diskette_param_table __aligned(1);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400184extern u8 BiosChecksum;
Kevin O'Connor6c68e7a2014-04-19 12:22:22 -0400185int in_post(void);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400186void mathcp_setup(void);
187
188// mouse.c
189void mouse_init(void);
190void process_mouse(u8 data);
191
Kevin O'Connor8fb3a5e2013-09-14 22:27:14 -0400192// optionroms.c
193struct rom_header;
194void callrom(struct rom_header *rom, u16 bdf);
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400195void call_bcv(u16 seg, u16 ip);
196int is_pci_vga(struct pci_device *pci);
197void optionrom_setup(void);
198void vgarom_setup(void);
199void s3_resume_vga(void);
200extern int ScreenAndDebug;
Kevin O'Connor8fb3a5e2013-09-14 22:27:14 -0400201
Kevin O'Connora0dc2962008-03-16 14:29:32 -0400202// pcibios.c
203void handle_1ab1(struct bregs *regs);
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500204void bios32_init(void);
Kevin O'Connora0dc2962008-03-16 14:29:32 -0400205
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400206// pmm.c
207void pmm_init(void);
208void pmm_prepboot(void);
209
210// pnpbios.c
211u16 get_pnp_offset(void);
212void pnp_init(void);
213
Kevin O'Connor07cf73b2013-09-15 00:31:17 -0400214// post.c
215void interface_init(void);
216void device_hardware_setup(void);
217void prepareboot(void);
218void startBoot(void);
219void reloc_preinit(void *f, void *arg);
220
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400221// resume.c
222extern int HaveRunPost;
Kevin O'Connor5a7545c2013-09-14 22:54:44 -0400223
Kevin O'Connorb367e0a2013-09-15 00:43:51 -0400224// serial.c
225void serial_setup(void);
226void lpt_setup(void);
Ian Campbell1442c312011-06-01 11:00:28 +0100227
Kevin O'Connorcbffa8e2008-08-17 11:11:07 -0400228// vgahooks.c
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500229void handle_155f(struct bregs *regs);
Jonathan A. Kollasche9a3e122013-10-20 12:48:56 -0500230void handle_157f(struct bregs *regs);
Kevin O'Connorc1de91b2011-07-02 13:50:21 -0400231void vgahook_setup(struct pci_device *pci);
Kevin O'Connorcbffa8e2008-08-17 11:11:07 -0400232
Kevin O'Connor30853762009-01-17 18:49:20 -0500233
Kevin O'Connorc95d2ce2009-07-29 20:41:39 -0400234// version (auto generated file out/version.c)
235extern const char VERSION[];
236
Kevin O'Connor786502d2008-02-27 10:41:41 -0500237#endif // util.h