blob: 4fa0939565e0aaf562071a0b219a9cc27e0d2a87 [file] [log] [blame]
Kevin O'Connorf076a3e2008-02-25 22:25:15 -05001// Basic x86 asm functions and function defs.
2//
Kevin O'Connor244caf82010-09-15 21:48:16 -04003// Copyright (C) 2008-2010 Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connorf076a3e2008-02-25 22:25:15 -05004//
Kevin O'Connorb1b7c2a2009-01-15 20:52:58 -05005// This file may be distributed under the terms of the GNU LGPLv3 license.
Kevin O'Connor786502d2008-02-27 10:41:41 -05006#ifndef __UTIL_H
7#define __UTIL_H
Kevin O'Connorf076a3e2008-02-25 22:25:15 -05008
Kevin O'Connor9521e262008-07-04 13:04:29 -04009#include "types.h" // u32
Kevin O'Connorf076a3e2008-02-25 22:25:15 -050010
Kevin O'Connora83ff552009-01-01 21:00:59 -050011// util.c
Kevin O'Connor7cefbfa2009-12-10 21:35:49 -050012u8 checksum_far(u16 buf_seg, void *buf_far, u32 len);
13u8 checksum(void *buf, u32 len);
14size_t strlen(const char *s);
15int memcmp(const void *s1, const void *s2, size_t n);
16int strcmp(const char *s1, const char *s2);
17inline void memset_far(u16 d_seg, void *d_far, u8 c, size_t len);
18inline void memset16_far(u16 d_seg, void *d_far, u16 c, size_t len);
19void *memset(void *s, int c, size_t n);
Gerd Hoffmann0a806082010-11-29 09:42:11 +010020void memset_fl(void *ptr, u8 val, size_t size);
Kevin O'Connor7cefbfa2009-12-10 21:35:49 -050021inline void memcpy_far(u16 d_seg, void *d_far
22 , u16 s_seg, const void *s_far, size_t len);
Kevin O'Connor8f59aa32010-06-06 16:11:45 -040023void memcpy_fl(void *d_fl, const void *s_fl, size_t len);
Kevin O'Connor7cefbfa2009-12-10 21:35:49 -050024void *memcpy(void *d1, const void *s1, size_t len);
Kevin O'Connor52a300f2009-12-26 23:32:57 -050025#if MODESEGMENT == 0
Kevin O'Connor7cefbfa2009-12-10 21:35:49 -050026#define memcpy __builtin_memcpy
27#endif
28void iomemcpy(void *d, const void *s, u32 len);
29void *memmove(void *d, const void *s, size_t len);
30char *strtcpy(char *dest, const char *src, size_t len);
Kevin O'Connor2e109a62010-12-24 10:39:32 -050031char *strchr(const char *s, int c);
Kevin O'Connor9e881a32011-01-08 12:06:54 -050032void nullTrailingSpace(char *buf);
Kevin O'Connor38fcbfe2008-02-25 22:30:47 -050033
Kevin O'Connor7cefbfa2009-12-10 21:35:49 -050034// stacks.c
Kevin O'Connorbf2e8c22012-05-28 12:59:58 -040035extern u8 ExtraStack[], *StackPos;
Kevin O'Connorecdc6552012-05-28 14:25:15 -040036u32 stack_hop(u32 eax, u32 edx, void *func);
37u32 stack_hop_back(u32 eax, u32 edx, void *func);
Kevin O'Connore77c7052012-05-28 22:06:42 -040038u32 call32(void *func, u32 eax, u32 errret);
39struct bregs;
40inline void farcall16(struct bregs *callregs);
41inline void farcall16big(struct bregs *callregs);
42inline void __call16_int(struct bregs *callregs, u16 offset);
43#define call16_int(nr, callregs) do { \
44 extern void irq_trampoline_ ##nr (); \
45 __call16_int((callregs), (u32)&irq_trampoline_ ##nr ); \
46 } while (0)
Kevin O'Connor7cefbfa2009-12-10 21:35:49 -050047extern struct thread_info MainThread;
Kevin O'Connor1ca05b02010-01-03 17:43:37 -050048struct thread_info *getCurThread(void);
49void yield(void);
Kevin O'Connor94c749c2012-05-28 11:44:02 -040050void yield_toirq(void);
Kevin O'Connor7cefbfa2009-12-10 21:35:49 -050051void run_thread(void (*func)(void*), void *data);
Kevin O'Connor1ca05b02010-01-03 17:43:37 -050052void wait_threads(void);
Kevin O'Connore9086652010-02-27 13:49:47 -050053struct mutex_s { u32 isLocked; };
54void mutex_lock(struct mutex_s *mutex);
55void mutex_unlock(struct mutex_s *mutex);
Kevin O'Connor1ca05b02010-01-03 17:43:37 -050056void start_preempt(void);
57void finish_preempt(void);
Kevin O'Connord7eb27e2010-03-20 18:17:19 -040058int wait_preempt(void);
Kevin O'Connor1ca05b02010-01-03 17:43:37 -050059void check_preempt(void);
Kevin O'Connor7cefbfa2009-12-10 21:35:49 -050060
Kevin O'Connorf076a3e2008-02-25 22:25:15 -050061// output.c
Ian Campbell54f3b252012-06-28 11:08:32 +010062extern u16 DebugOutputPort;
Kevin O'Connord83c87b2013-01-21 01:14:12 -050063void debug_serial_preinit(void);
Kevin O'Connore07e18e2009-02-08 17:07:29 -050064void panic(const char *fmt, ...)
Kevin O'Connordad41d92010-01-01 03:04:19 -050065 __attribute__ ((format (printf, 1, 2))) __noreturn;
Kevin O'Connor567e4e32008-04-05 11:37:51 -040066void printf(const char *fmt, ...)
67 __attribute__ ((format (printf, 1, 2)));
Kevin O'Connor2be312c2009-11-24 09:37:53 -050068int snprintf(char *str, size_t size, const char *fmt, ...)
Kevin O'Connor9ed6b622009-10-07 21:41:08 -040069 __attribute__ ((format (printf, 3, 4)));
Kevin O'Connorca2bc1c2010-12-29 21:41:19 -050070char * znprintf(size_t size, const char *fmt, ...)
71 __attribute__ ((format (printf, 2, 3)));
Kevin O'Connorcfdc13f2010-02-14 13:07:54 -050072void __dprintf(const char *fmt, ...)
73 __attribute__ ((format (printf, 1, 2)));
74void __debug_enter(struct bregs *regs, const char *fname);
Kevin O'Connor1297e5d2012-06-02 20:30:58 -040075void __debug_isr(const char *fname);
Kevin O'Connorcfdc13f2010-02-14 13:07:54 -050076void __debug_stub(struct bregs *regs, int lineno, const char *fname);
77void __warn_invalid(struct bregs *regs, int lineno, const char *fname);
78void __warn_unimplemented(struct bregs *regs, int lineno, const char *fname);
Kevin O'Connor7fb8ba82010-02-26 08:45:00 -050079void __warn_internalerror(int lineno, const char *fname);
Kevin O'Connorcfdc13f2010-02-14 13:07:54 -050080void __warn_noalloc(int lineno, const char *fname);
81void __warn_timeout(int lineno, const char *fname);
82void __set_invalid(struct bregs *regs, int lineno, const char *fname);
83void __set_unimplemented(struct bregs *regs, int lineno, const char *fname);
84void __set_code_invalid(struct bregs *regs, u32 linecode, const char *fname);
85void __set_code_unimplemented(struct bregs *regs, u32 linecode
86 , const char *fname);
87void hexdump(const void *d, int len);
88
Kevin O'Connorac8df8c2008-05-24 23:46:33 -040089#define dprintf(lvl, fmt, args...) do { \
90 if (CONFIG_DEBUG_LEVEL && (lvl) <= CONFIG_DEBUG_LEVEL) \
91 __dprintf((fmt) , ##args ); \
92 } while (0)
Kevin O'Connor15c1f222008-06-12 22:59:43 -040093#define debug_enter(regs, lvl) do { \
94 if ((lvl) && (lvl) <= CONFIG_DEBUG_LEVEL) \
Kevin O'Connor05600342009-01-02 13:10:58 -050095 __debug_enter((regs), __func__); \
Kevin O'Connor15c1f222008-06-12 22:59:43 -040096 } while (0)
Kevin O'Connor1297e5d2012-06-02 20:30:58 -040097#define debug_isr(lvl) do { \
98 if ((lvl) && (lvl) <= CONFIG_DEBUG_LEVEL) \
99 __debug_isr(__func__); \
100 } while (0)
Kevin O'Connor05600342009-01-02 13:10:58 -0500101#define debug_stub(regs) \
102 __debug_stub((regs), __LINE__, __func__)
Kevin O'Connorcfdc13f2010-02-14 13:07:54 -0500103#define warn_invalid(regs) \
104 __warn_invalid((regs), __LINE__, __func__)
105#define warn_unimplemented(regs) \
106 __warn_unimplemented((regs), __LINE__, __func__)
Kevin O'Connor7fb8ba82010-02-26 08:45:00 -0500107#define warn_internalerror() \
108 __warn_internalerror(__LINE__, __func__)
Kevin O'Connorcfdc13f2010-02-14 13:07:54 -0500109#define warn_noalloc() \
110 __warn_noalloc(__LINE__, __func__)
111#define warn_timeout() \
112 __warn_timeout(__LINE__, __func__)
113#define set_invalid(regs) \
114 __set_invalid((regs), __LINE__, __func__)
115#define set_code_invalid(regs, code) \
116 __set_code_invalid((regs), (code) | (__LINE__ << 8), __func__)
117#define set_unimplemented(regs) \
118 __set_unimplemented((regs), __LINE__, __func__)
119#define set_code_unimplemented(regs, code) \
120 __set_code_unimplemented((regs), (code) | (__LINE__ << 8), __func__)
Kevin O'Connorf076a3e2008-02-25 22:25:15 -0500121
122// kbd.c
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500123void kbd_init(void);
Kevin O'Connorf076a3e2008-02-25 22:25:15 -0500124void handle_15c2(struct bregs *regs);
Kevin O'Connor114592f2009-09-28 21:32:08 -0400125void process_key(u8 key);
Kevin O'Connorbdce35f2008-02-26 21:33:14 -0500126
Kevin O'Connorf54c1502008-06-14 15:56:16 -0400127// mouse.c
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500128void mouse_init(void);
Kevin O'Connor57877482009-12-09 21:00:41 -0500129void process_mouse(u8 data);
Kevin O'Connorf54c1502008-06-14 15:56:16 -0400130
Kevin O'Connor913cc2e2008-04-13 17:31:45 -0400131// serial.c
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500132void serial_setup(void);
133void lpt_setup(void);
Kevin O'Connor913cc2e2008-04-13 17:31:45 -0400134
Kevin O'Connorbdce35f2008-02-26 21:33:14 -0500135// clock.c
Kevin O'Connorc6e8c072013-07-20 10:51:58 -0400136void clock_setup(void);
137void handle_1583(struct bregs *regs);
138void handle_1586(struct bregs *regs);
139void useRTC(void);
140void releaseRTC(void);
141
Kevin O'Connor5d369d82013-09-02 20:48:46 -0400142// hw/timer.c
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500143void timer_setup(void);
Kevin O'Connor018bdd72013-07-20 18:22:57 -0400144void pmtimer_setup(u16 ioport);
145u32 timer_calc(u32 msecs);
146u32 timer_calc_usec(u32 usecs);
147int timer_check(u32 end);
Kevin O'Connorbc2aecd2008-11-28 16:40:06 -0500148void ndelay(u32 count);
149void udelay(u32 count);
150void mdelay(u32 count);
Kevin O'Connor10ad7992009-10-24 11:06:08 -0400151void nsleep(u32 count);
152void usleep(u32 count);
153void msleep(u32 count);
Kevin O'Connor018bdd72013-07-20 18:22:57 -0400154u32 ticks_to_ms(u32 ticks);
155u32 ticks_from_ms(u32 ms);
Kevin O'Connor95ee3822013-07-20 18:07:50 -0400156u32 irqtimer_calc_ticks(u32 count);
157u32 irqtimer_calc(u32 msecs);
158int irqtimer_check(u32 end);
Kevin O'Connorbdce35f2008-02-26 21:33:14 -0500159
Kevin O'Connor95b2f782008-03-05 19:52:06 -0500160// apm.c
Kevin O'Connor244caf82010-09-15 21:48:16 -0400161void apm_shutdown(void);
Kevin O'Connorc0031482010-01-01 13:03:17 -0500162void handle_1553(struct bregs *regs);
Kevin O'Connor95b2f782008-03-05 19:52:06 -0500163
Kevin O'Connora0dc2962008-03-16 14:29:32 -0400164// pcibios.c
165void handle_1ab1(struct bregs *regs);
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500166void bios32_init(void);
Kevin O'Connora0dc2962008-03-16 14:29:32 -0400167
Kevin O'Connorccee6e82013-09-02 21:25:21 -0400168// fw/shadow.c
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500169void make_bios_writable(void);
170void make_bios_readonly(void);
Kevin O'Connor244caf82010-09-15 21:48:16 -0400171void qemu_prep_reset(void);
Kevin O'Connorda4a6482008-06-08 13:48:06 -0400172
Kevin O'Connorccee6e82013-09-02 21:25:21 -0400173// fw/pciinit.c
Kevin O'Connor0d6b8d52010-07-10 13:12:37 -0400174extern const u8 pci_irqs[4];
Kevin O'Connor40f5b5a2009-09-13 10:46:57 -0400175void pci_setup(void);
Kevin O'Connora4d35762008-03-08 15:43:03 -0500176
Kevin O'Connorccee6e82013-09-02 21:25:21 -0400177// fw/smm.c
Kevin O'Connorcdbac7f2013-03-08 19:33:39 -0500178void smm_device_setup(void);
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500179void smm_setup(void);
Kevin O'Connorf7ba6d72008-07-04 05:05:54 -0400180
Kevin O'Connorccee6e82013-09-02 21:25:21 -0400181// fw/smp.c
Kevin O'Connor603bfc32009-06-22 20:04:56 -0400182extern u32 CountCPUs;
Kevin O'Connor84705852009-10-08 22:13:15 -0400183extern u32 MaxCountCPUs;
Kevin O'Connore97ca7b2009-06-21 09:10:28 -0400184void wrmsr_smp(u32 index, u64 val);
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500185void smp_setup(void);
Eduardo Habkost008c1fc2012-07-25 15:45:30 -0300186int apic_id_is_present(u8 apic_id);
Kevin O'Connor84ad59a2008-07-04 05:47:26 -0400187
Kevin O'Connorccee6e82013-09-02 21:25:21 -0400188// fw/coreboot.c
Kevin O'Connorc1de91b2011-07-02 13:50:21 -0400189extern const char *CBvendor, *CBpart;
Kevin O'Connor1edc89d2009-04-30 21:50:35 -0400190struct cbfs_file;
Gerd Hoffmannebf03f72013-06-24 11:24:57 +0200191void debug_cbmem(char c);
Kevin O'Connor1f836252009-08-16 20:17:35 -0400192void cbfs_run_payload(struct cbfs_file *file);
Kevin O'Connora2a86e22013-02-13 19:35:12 -0500193void coreboot_platform_setup(void);
Kevin O'Connor89a1efd2011-01-08 12:24:39 -0500194void cbfs_payload_setup(void);
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500195void coreboot_preinit(void);
196void coreboot_cbfs_init(void);
Kevin O'Connorc7812932008-06-08 23:08:12 -0400197
Kevin O'Connorccee6e82013-09-02 21:25:21 -0400198// fw/biostable.c
David Woodhouse38b24db2013-01-25 19:33:58 -0600199void copy_smbios(void *pos);
Kevin O'Connor4d053eb2012-06-09 13:08:02 -0400200void copy_table(void *pos);
Ian Campbell1442c312011-06-01 11:00:28 +0100201
Kevin O'Connorcbffa8e2008-08-17 11:11:07 -0400202// vgahooks.c
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500203void handle_155f(struct bregs *regs);
Kevin O'Connorc1de91b2011-07-02 13:50:21 -0400204struct pci_device;
205void vgahook_setup(struct pci_device *pci);
Kevin O'Connorcbffa8e2008-08-17 11:11:07 -0400206
Kevin O'Connor714325c2008-11-01 20:32:27 -0400207// optionroms.c
Kevin O'Connor0a924122009-02-08 19:43:47 -0500208void call_bcv(u16 seg, u16 ip);
Alex Williamson7adfd712013-03-20 10:58:47 -0600209int is_pci_vga(struct pci_device *pci);
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500210void optionrom_setup(void);
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500211void vgarom_setup(void);
212void s3_resume_vga(void);
Kevin O'Connor422263d2011-07-05 20:56:07 -0400213extern int ScreenAndDebug;
Kevin O'Connor714325c2008-11-01 20:32:27 -0400214
Kevin O'Connorafbed1b2010-06-28 07:34:53 -0400215// bootsplash.c
216void enable_vga_console(void);
Kevin O'Connor9a01a9c2010-08-25 21:07:48 -0400217void enable_bootsplash(void);
Kevin O'Connorafbed1b2010-06-28 07:34:53 -0400218void disable_bootsplash(void);
219
Kevin O'Connor18e38b22008-12-10 20:40:13 -0500220// resume.c
Kevin O'Connor87b533b2011-07-10 22:35:07 -0400221extern int HaveRunPost;
Kevin O'Connor9e4d41c2013-01-21 12:14:29 -0500222void dma_setup(void);
Kevin O'Connor18e38b22008-12-10 20:40:13 -0500223
Kevin O'Connor0c3068d2008-12-21 17:51:36 -0500224// pnpbios.c
225#define PNP_SIGNATURE 0x506e5024 // $PnP
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500226u16 get_pnp_offset(void);
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500227void pnp_init(void);
Kevin O'Connor0c3068d2008-12-21 17:51:36 -0500228
Kevin O'Connore54ee382009-07-26 19:33:13 -0400229// pmm.c
Kevin O'Connor415d4292009-08-30 19:19:31 -0400230extern struct zone_s ZoneLow, ZoneHigh, ZoneFSeg, ZoneTmpLow, ZoneTmpHigh;
Kevin O'Connor3733f6f2013-02-17 12:44:23 -0500231u32 rom_get_max(void);
Kevin O'Connor5e019082012-05-20 21:11:43 -0400232u32 rom_get_last(void);
233struct rom_header *rom_reserve(u32 size);
234int rom_confirm(u32 size);
David Woodhouse118469a2013-01-25 19:46:25 -0600235void csm_malloc_preinit(u32 low_pmm, u32 low_pmm_size, u32 hi_pmm,
236 u32 hi_pmm_size);
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500237void malloc_preinit(void);
Kevin O'Connorf85e4bc2013-02-19 01:33:45 -0500238extern u32 LegacyRamSize;
Kevin O'Connor6afc6f82013-02-19 01:02:50 -0500239void malloc_init(void);
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500240void malloc_prepboot(void);
Kevin O'Connord948e2b2009-10-12 12:54:56 -0400241void *pmm_malloc(struct zone_s *zone, u32 handle, u32 size, u32 align);
242int pmm_free(void *data);
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500243void pmm_init(void);
244void pmm_prepboot(void);
Kevin O'Connord948e2b2009-10-12 12:54:56 -0400245#define PMM_DEFAULT_HANDLE 0xFFFFFFFF
Kevin O'Connor0bf92702009-08-01 11:45:37 -0400246// Minimum alignment of malloc'd memory
247#define MALLOC_MIN_ALIGN 16
Kevin O'Connor415d4292009-08-30 19:19:31 -0400248// Helper functions for memory allocation.
Kevin O'Connorf416fe92009-09-24 20:51:55 -0400249static inline void *malloc_low(u32 size) {
Kevin O'Connord948e2b2009-10-12 12:54:56 -0400250 return pmm_malloc(&ZoneLow, PMM_DEFAULT_HANDLE, size, MALLOC_MIN_ALIGN);
Kevin O'Connorf416fe92009-09-24 20:51:55 -0400251}
Kevin O'Connor415d4292009-08-30 19:19:31 -0400252static inline void *malloc_high(u32 size) {
Kevin O'Connord948e2b2009-10-12 12:54:56 -0400253 return pmm_malloc(&ZoneHigh, PMM_DEFAULT_HANDLE, size, MALLOC_MIN_ALIGN);
Kevin O'Connor415d4292009-08-30 19:19:31 -0400254}
255static inline void *malloc_fseg(u32 size) {
Kevin O'Connord948e2b2009-10-12 12:54:56 -0400256 return pmm_malloc(&ZoneFSeg, PMM_DEFAULT_HANDLE, size, MALLOC_MIN_ALIGN);
Kevin O'Connor415d4292009-08-30 19:19:31 -0400257}
Kevin O'Connora576c9c2010-07-26 22:43:18 -0400258static inline void *malloc_tmplow(u32 size) {
259 return pmm_malloc(&ZoneTmpLow, PMM_DEFAULT_HANDLE, size, MALLOC_MIN_ALIGN);
260}
Kevin O'Connor114592f2009-09-28 21:32:08 -0400261static inline void *malloc_tmphigh(u32 size) {
Kevin O'Connord948e2b2009-10-12 12:54:56 -0400262 return pmm_malloc(&ZoneTmpHigh, PMM_DEFAULT_HANDLE, size, MALLOC_MIN_ALIGN);
Kevin O'Connor114592f2009-09-28 21:32:08 -0400263}
Kevin O'Connor575ffc82010-02-21 23:20:10 -0500264static inline void *malloc_tmp(u32 size) {
265 void *ret = malloc_tmphigh(size);
266 if (ret)
267 return ret;
Kevin O'Connora576c9c2010-07-26 22:43:18 -0400268 return malloc_tmplow(size);
Kevin O'Connor575ffc82010-02-21 23:20:10 -0500269}
Kevin O'Connor9ed6b622009-10-07 21:41:08 -0400270static inline void *memalign_low(u32 align, u32 size) {
Kevin O'Connord948e2b2009-10-12 12:54:56 -0400271 return pmm_malloc(&ZoneLow, PMM_DEFAULT_HANDLE, size, align);
Kevin O'Connor415d4292009-08-30 19:19:31 -0400272}
273static inline void *memalign_high(u32 align, u32 size) {
Kevin O'Connord948e2b2009-10-12 12:54:56 -0400274 return pmm_malloc(&ZoneHigh, PMM_DEFAULT_HANDLE, size, align);
Kevin O'Connor415d4292009-08-30 19:19:31 -0400275}
Kevin O'Connor12fa24a2010-09-15 00:25:32 -0400276static inline void *memalign_tmplow(u32 align, u32 size) {
277 return pmm_malloc(&ZoneTmpLow, PMM_DEFAULT_HANDLE, size, align);
278}
Kevin O'Connor9ed6b622009-10-07 21:41:08 -0400279static inline void *memalign_tmphigh(u32 align, u32 size) {
Kevin O'Connord948e2b2009-10-12 12:54:56 -0400280 return pmm_malloc(&ZoneTmpHigh, PMM_DEFAULT_HANDLE, size, align);
281}
Kevin O'Connor12fa24a2010-09-15 00:25:32 -0400282static inline void *memalign_tmp(u32 align, u32 size) {
283 void *ret = memalign_tmphigh(align, size);
284 if (ret)
285 return ret;
286 return memalign_tmplow(align, size);
287}
Kevin O'Connord948e2b2009-10-12 12:54:56 -0400288static inline void free(void *data) {
289 pmm_free(data);
Kevin O'Connor9ed6b622009-10-07 21:41:08 -0400290}
Kevin O'Connore54ee382009-07-26 19:33:13 -0400291
Kevin O'Connorccee6e82013-09-02 21:25:21 -0400292// fw/mtrr.c
Kevin O'Connor7061eb62009-01-04 21:48:22 -0500293void mtrr_setup(void);
294
Kevin O'Connor59d6ca52012-05-31 00:20:55 -0400295// romfile.c
296struct romfile_s {
297 struct romfile_s *next;
298 char name[128];
299 u32 size;
300 int (*copy)(struct romfile_s *file, void *dest, u32 maxlen);
Kevin O'Connor59d6ca52012-05-31 00:20:55 -0400301};
302void romfile_add(struct romfile_s *file);
303struct romfile_s *romfile_findprefix(const char *prefix, struct romfile_s *prev);
304struct romfile_s *romfile_find(const char *name);
305void *romfile_loadfile(const char *name, int *psize);
306u64 romfile_loadint(const char *name, u64 defval);
307
Kevin O'Connor18e38b22008-12-10 20:40:13 -0500308// romlayout.S
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500309void reset_vector(void) __noreturn;
Kevin O'Connor18e38b22008-12-10 20:40:13 -0500310
Kevin O'Connor30853762009-01-17 18:49:20 -0500311// misc.c
Kevin O'Connor3a735ba2013-02-10 00:35:01 -0500312void mathcp_setup(void);
Kevin O'Connor30853762009-01-17 18:49:20 -0500313extern u8 BiosChecksum;
314
Kevin O'Connorc95d2ce2009-07-29 20:41:39 -0400315// version (auto generated file out/version.c)
316extern const char VERSION[];
317
Kevin O'Connor786502d2008-02-27 10:41:41 -0500318#endif // util.h