attached. I need an ack, we have discussed these already. ron
Add a banner function and modify die() to be more JTAG-friendly.
Add a void * parameter to the LAR run functions; needed for some cases, in particular CAR. Signed-off-by: Ronald G. Minnich <[EMAIL PROTECTED]> Index: lib/console.c =================================================================== --- lib/console.c (revision 542) +++ lib/console.c (working copy) @@ -46,6 +46,18 @@ return i; } +/** + * Print a nice banner so we know what step we died on. + * + * @param level The printk level (e.g. BIOS_EMERG) + * @param s String to put in the middle of the banner + */ + +void banner(int level, char *s) +{ + printk(level, "===========================%s===========================\n", s); +} + void console_init(void) { static const char console_test[] = @@ -59,9 +71,31 @@ printk(BIOS_INFO, console_test); } +/** + * Halt and loop due to a fatal error. + * There have been several iterations of this function. + * The first simply did a hlt(). Doing a hlt() can make jtag debugging + * very difficult as one can not break into a hlt instruction on some CPUs. + * Second was to do a console_tx_byte of a NULL character. + * A number of concerns were raised about doing this idea. + * Third idea was to do an inb from port 0x80, the POST port. That design + * makes us very CPU-specific. + * The fourth idea was just POSTING the same + * code over and over. That would erase the most recent POST code, + * hindering diagnosis. + * + * For now, for lack of a good alternative, + * we will continue to call console_tx_byte. We call with a NULL since + * it will clear any FIFOs in the path and won't clutter up the output, + * since NULL doesn't print a visible character on most terminal + * emulators. + * + * @param str A string to print for the error + * + */ void die(const char *str) { printk(BIOS_EMERG, str); while (1) - hlt(); + console_tx_byte(0, (void *)0); } Index: lib/lar.c =================================================================== --- lib/lar.c (revision 542) +++ lib/lar.c (working copy) @@ -32,17 +32,19 @@ #endif /** - * run_address is passed the address of a function taking no parameters and - * jumps to it, returning the result. - * @param v the address to call as a function. + * run_address is passed the address of a function taking a single void * parameter + * jumps to it, returning the result. Note that there is no requirement that the called + * function ever return. + * @param f The function to call + * @param parameter An opaque parameter, passed as a void *, usually NULL * returns value returned by the function. */ -int run_address(void *f) +int run_address(void *f, void *parameter) { - int (*v) (void); + int (*v) (void *); v = f; - return v(); + return v(parameter); } /** @@ -123,7 +125,7 @@ result->entry = (void *)ntohl((u32)header->entry); result->loadaddress = (void *)ntohl((u32)header->loadaddress); printk(BIOS_SPEW, - "start %p len %d reallen %d compression %x entry %p loadaddress %p\n", + "FOUND: start %p len %d reallen %d compression %x entry %p loadaddress %p\n", result->start, result->len, result->reallen, result->compression, result->entry, result->loadaddress); return 0; @@ -263,9 +265,10 @@ * Given a file name in the LAR , search for it, and execute it in place. * @param archive A descriptor for current archive. * @param filename filename to find + * @param parameter An opaque parameter, passed as a void *, usually NULL * returns 0 on success, -1 otherwise */ -int execute_in_place(const struct mem_file *archive, const char *filename) +int execute_in_place(const struct mem_file *archive, const char *filename, void *parameter) { struct mem_file result; int ret; @@ -283,7 +286,7 @@ } where = result.start + (u32)result.entry; printk(BIOS_SPEW, "Entry point is %p\n", where); - ret = run_address(where); + ret = run_address(where, parameter); printk(BIOS_SPEW, "run_file returns with %d\n", ret); return ret; }
-- linuxbios mailing list linuxbios@linuxbios.org http://www.linuxbios.org/mailman/listinfo/linuxbios