diff options
author | Michael Brown <mcb30@etherboot.org> | 2005-04-08 15:01:17 +0000 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2005-04-08 15:01:17 +0000 |
commit | 0ff80b477dcff0726ebdbed95e8a93971e59e82b (patch) | |
tree | 860b7150212a07c24a9529ea072f3fb12700974c /src/include | |
parent | de5d935135bd536666b5fd03445b04d2ea82f1b4 (diff) | |
download | ipxe-0ff80b477dcff0726ebdbed95e8a93971e59e82b.tar.gz |
Merged mcb30-realmode-redesign back to HEAD
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/btext.h | 16 | ||||
-rw-r--r-- | src/include/compiler.h | 41 | ||||
-rw-r--r-- | src/include/console.h | 28 | ||||
-rw-r--r-- | src/include/etherboot.h | 64 | ||||
-rw-r--r-- | src/include/init.h | 58 | ||||
-rw-r--r-- | src/include/main.h | 6 | ||||
-rw-r--r-- | src/include/osdep.h | 1 | ||||
-rw-r--r-- | src/include/stddef.h | 13 | ||||
-rw-r--r-- | src/include/timer.h | 1 |
9 files changed, 148 insertions, 80 deletions
diff --git a/src/include/btext.h b/src/include/btext.h index 15241cd39..1d3f9e59b 100644 --- a/src/include/btext.h +++ b/src/include/btext.h @@ -32,7 +32,7 @@ typedef struct boot_infos /* Some infos about the current MacOS display */ u32 dispDeviceRect[4]; /* left,top,right,bottom */ u32 dispDeviceDepth; /* (8, 16 or 32) */ - u8* dispDeviceBase; /* base address (physical) */ + u32 dispDeviceBase; /* base address (physical) */ u32 dispDeviceRowBytes; /* rowbytes (in bytes) */ u32 dispDeviceColorsOffset; /* Colormap (8 bits only) or 0 (*) */ @@ -56,21 +56,7 @@ typedef struct boot_infos * Benjamin Herrenschmidt <benh@kernel.crashing.org> */ -extern void btext_clearscreen(void); - extern boot_infos_t disp_bi; extern u32 boot_text_mapped; -void btext_setup_display(u32 width, u32 height, u32 depth, u32 pitch, - unsigned long address); -void map_boot_text(void); - -void btext_drawchar(char c); -void btext_drawstring(const char *str); -void btext_drawhex(u32 v); - -void btext_putc(int c); - -void btext_init(void); - #endif /* _BTEXT_H */ diff --git a/src/include/compiler.h b/src/include/compiler.h new file mode 100644 index 000000000..401d4e458 --- /dev/null +++ b/src/include/compiler.h @@ -0,0 +1,41 @@ +#ifndef COMPILER_H +#define COMPILER_H + +/* We export the symbol obj_OBJECT (OBJECT is defined on command-line) + * as a global symbol, so that the linker can drag in selected object + * files from the library using -u obj_OBJECT. + * + * Not quite sure why cpp requires two levels of macro call in order + * to actually expand OBJECT... + */ +#undef _H1 +#define _H1( x, y ) x ## y +#undef _H2 +#define _H2( x, y ) _H1 ( x, y ) +#define OBJECT_SYMBOL _H2 ( obj_, OBJECT ) +#undef _STR +#define _STR(s) #s +#undef _XSTR +#define _XSTR(s) _STR(s) +#define OBJECT_SYMBOL_STR _XSTR ( OBJECT_SYMBOL ) + +#ifdef ASSEMBLY + + .globl OBJECT_SYMBOL + .equ OBJECT_SYMBOL, 0 + +#else /* ASSEMBLY */ + +__asm__ ( ".globl\t" OBJECT_SYMBOL_STR ); +__asm__ ( ".equ\t" OBJECT_SYMBOL_STR ", 0" ); + +#define REQUIRE_OBJECT(object) \ + __asm__ ( ".equ\tneed_" #object ", obj_" #object ); + +#define PACKED __attribute__((packed)) +#define __unused __attribute__((unused)) +#define __used __attribute__((used)) + +#endif /* ASSEMBLY */ + +#endif /* COMPILER_H */ diff --git a/src/include/console.h b/src/include/console.h new file mode 100644 index 000000000..ce2e53926 --- /dev/null +++ b/src/include/console.h @@ -0,0 +1,28 @@ +#ifndef CONSOLE_H +#define CONSOLE_H + +#include "stdint.h" + +/* + * Consoles that cannot be used before their INIT_FN() has completed + * should set disabled = 1 initially. This allows other console + * devices to still be used to print out early debugging messages. + */ + +struct console_driver { + int disabled; + void ( *putchar ) ( int character ); + int ( *getchar ) ( void ); + int ( *iskey ) ( void ); +}; + +#define __console_driver \ + __attribute__ (( used, __section__ ( ".drivers.console" ) )) + +/* Function prototypes */ + +extern void putchar ( int character ); +extern int getchar ( void ); +extern int iskey ( void ); + +#endif /* CONSOLE_H */ diff --git a/src/include/etherboot.h b/src/include/etherboot.h index 44ada5389..f4a4f1265 100644 --- a/src/include/etherboot.h +++ b/src/include/etherboot.h @@ -49,28 +49,6 @@ #define DEFAULT_BOOTFILE PXENFSROOTPATH "/boot/pxeboot" #endif -/* Clean up console settings... mainly CONSOLE_FIRMWARE and CONSOLE_SERIAL are used - * in the sources (except start.S and serial.S which cannot include - * etherboot.h). At least one of the CONSOLE_xxx has to be set, and - * CONSOLE_DUAL sets both CONSOLE_CRT and CONSOLE_SERIAL. If none is set, - * CONSOLE_CRT is assumed. */ -#ifdef CONSOLE_CRT -#define CONSOLE_FIRMWARE -#endif -#ifdef CONSOLE_DUAL -#undef CONSOLE_FIRMWARE -#define CONSOLE_FIRMWARE -#undef CONSOLE_SERIAL -#define CONSOLE_SERIAL -#endif -#if defined(CONSOLE_FIRMWARE) && defined(CONSOLE_SERIAL) -#undef CONSOLE_DUAL -#define CONSOLE_DUAL -#endif -#if !defined(CONSOLE_FIRMWARE) && !defined(CONSOLE_SERIAL) -#define CONSOLE_FIRMWARE -#endif - #if !defined(DOWNLOAD_PROTO_TFTP) && !defined(DOWNLOAD_PROTO_NFS) && !defined(DOWNLOAD_PROTO_SLAM) && !defined(DOWNLOAD_PROTO_TFTM) && !defined(DOWNLOAD_PROTO_DISK) && !defined(DOWNLOAD_PROTO_HTTP) #error No download protocol defined! #endif @@ -204,7 +182,7 @@ External prototypes struct Elf_Bhdr; extern int in_call(in_call_data_t *data, uint32_t opcode, va_list params); extern void console_init(void); -extern int main(in_call_data_t *data, va_list params); +extern int main(); extern int loadkernel P((const char *fname)); extern char as_main_program; /* nic.c */ @@ -287,26 +265,6 @@ extern unsigned long strtoul P((const char *p, const char **, int base)); extern void printf P((const char *, ...)); extern int sprintf P((char *, const char *, ...)); extern int inet_aton P((const char *p, in_addr *i)); -#ifdef PCBIOS -extern void gateA20_set P((void)); -#define gateA20_unset() -#else -#define gateA20_set() -#define gateA20_unset() -#endif -extern void putchar P((int)); -extern int getchar P((void)); -extern int iskey P((void)); - -/* pcbios.S */ -extern int console_getc P((void)); -extern void console_putc P((int)); -extern int console_ischar P((void)); -extern int getshift P((void)); -extern int int15 P((int)); -#ifdef POWERSAVE -extern void cpu_nap P((void)); -#endif /* POWERSAVE */ /* basemem.c */ extern uint32_t get_free_base_memory ( void ); @@ -318,26 +276,6 @@ extern void free_unused_base_memory ( void ); extern void forget_prefix_base_memory ( void ); extern void forget_runtime_base_memory ( uint32_t old_addr ); -struct e820entry { - uint64_t addr; - uint64_t size; - uint32_t type; -#define E820_RAM 1 -#define E820_RESERVED 2 -#define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ -#define E820_NVS 4 -} PACKED; -#define E820ENTRY_SIZE 20 -#define E820MAX 32 -struct meminfo { - uint16_t basememsize; - uint16_t pad; - uint32_t memsize; - uint32_t map_count; - struct e820entry map[E820MAX]; -} PACKED; -extern struct meminfo meminfo; -extern void get_memsizes(void); extern unsigned long get_boot_order(unsigned long order, unsigned *index); #ifndef NORELOCATE extern void relocate(void); diff --git a/src/include/init.h b/src/include/init.h new file mode 100644 index 000000000..9ec9dedcd --- /dev/null +++ b/src/include/init.h @@ -0,0 +1,58 @@ +#ifndef INIT_H +#define INIT_H + +/* + * In order to avoid having objects dragged in just because main() + * calls their initialisation function, we allow each object to + * specify that it has a function that must be called to initialise + * that object. The function call_init_fns() will call all the + * included objects' initialisation functions. + * + * Objects that require initialisation should include init.h and + * register the initialisation function using INIT_FN(). + * + * Objects may register up to three functions: init, reset and exit. + * init gets called only once, at the point that Etherboot is + * initialised (before the call to main()). reset gets called between + * each boot attempt. exit gets called only once, just before the + * loaded OS starts up (or just before Etherboot exits, if it exits, + * or when the PXE NBP calls UNDI_SHUTDOWN, if it's a PXE NBP). + * + * The syntax is: + * INIT_FN ( init_order, init_function, reset_function, exit_function ); + * where init_order is an ordering taken from the list below. Any + * function may be left as NULL. + */ + +/* An entry in the initialisation function table */ + +struct init_fn { + void ( *init ) ( void ); + void ( *reset ) ( void ); + void ( *exit ) ( void ); +}; + +/* Use double digits to avoid problems with "10" < "9" on alphabetic sort */ +#define INIT_CONSOLE "00" +#define INIT_CPU "01" +#define INIT_TIMERS "02" +#define INIT_PCMCIA "03" +#define INIT_MEMSIZES "04" +#define INIT_HEAP "05" + +/* Macro for creating an initialisation function table entry */ +#define INIT_FN( init_order, init_func, reset_func, exit_func ) \ + static struct init_fn init_ ## init_func ## _ ## exit_func \ + __attribute__ ((used,__section__(".init_fns." init_order))) = { \ + .init = init_func, \ + .reset = reset_func, \ + .exit = exit_func, \ + }; + +/* Function prototypes */ + +void call_init_fns ( void ); +void call_reset_fns ( void ); +void call_exit_fns ( void ); + +#endif /* INIT_H */ diff --git a/src/include/main.h b/src/include/main.h new file mode 100644 index 000000000..2b2a96c00 --- /dev/null +++ b/src/include/main.h @@ -0,0 +1,6 @@ +#ifndef MAIN_H +#define MAIN_H + +extern int main ( void ); + +#endif /* MAIN_H */ diff --git a/src/include/osdep.h b/src/include/osdep.h index 1b03e5671..d7e1af477 100644 --- a/src/include/osdep.h +++ b/src/include/osdep.h @@ -18,7 +18,6 @@ #include "setjmp.h" #include "latch.h" #include "callbacks.h" -#include "hooks.h" /* within 1MB of 4GB is too close. * MAX_ADDR is the maximum address we can easily do DMA to. diff --git a/src/include/stddef.h b/src/include/stddef.h new file mode 100644 index 000000000..ee1f15410 --- /dev/null +++ b/src/include/stddef.h @@ -0,0 +1,13 @@ +#ifndef STDDEF_H +#define STDDEF_H + +/* for size_t */ +#include "stdint.h" + +#undef NULL +#define NULL ((void *)0) + +#undef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + +#endif /* STDDEF_H */ diff --git a/src/include/timer.h b/src/include/timer.h index 6b68f5f38..0044d0c07 100644 --- a/src/include/timer.h +++ b/src/include/timer.h @@ -53,7 +53,6 @@ extern void load_timer2(unsigned int ticks); extern inline int timer2_running(void); extern void waiton_timer2(unsigned int ticks); -extern void setup_timers(void); extern void ndelay(unsigned int nsecs); extern void udelay(unsigned int usecs); extern void mdelay(unsigned int msecs); |