Date: Mon, 18 Feb 2008 04:34:59 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 135623 for review Message-ID: <200802180434.m1I4YxJD037333@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=135623 Change 135623 by marcel@marcel_xcllnt on 2008/02/18 04:34:45 Use uboot_address as the basis for where we start looking for the API signature. We search the 1MB of memory (aligned) in which uboot_address points. If uboot_address is 0, we search the last 1MB of memory, assuming 256MB of RAM. Affected files ... .. //depot/projects/e500/sys/boot/uboot/lib/glue.c#5 edit Differences ... ==== //depot/projects/e500/sys/boot/uboot/lib/glue.c#5 (text+ko) ==== @@ -71,6 +71,8 @@ extern int syscall(int, int *, ...); +/* Some random address used by U-Boot. */ +extern long uboot_address; /* crc32 stuff stolen from lib/libdisk/write_ia64_disk.c */ static uint32_t crc32_tab[] = { @@ -158,10 +160,6 @@ return 1; } -#define API_SEARCH_START (255*1024*1024) /* start at 1MB below the RAM top */ -//#define API_SEARCH_START 0 -#define API_SEARCH_END (256 * 1024 * 1024 - 1) /* ...and search to the end */ - /* * Searches for the U-Boot API signature * @@ -169,14 +167,17 @@ */ int api_search_sig(struct api_signature **sig) { - unsigned char *sp; + unsigned char *sp, *spend; if (sig == NULL) return 0; - sp = (unsigned char *)API_SEARCH_START; + if (uboot_address == 0) + uboot_address = 255 * 1024 * 1024; - while ((sp + (int)API_SIG_MAGLEN) < (unsigned char *)API_SEARCH_END) { + sp = (void *)(uboot_address & ~0x000fffff); + spend = sp + 0x00100000 - API_SIG_MAGLEN; + while (sp < spend) { if (!bcmp(sp, API_SIG_MAGIC, API_SIG_MAGLEN)) { *sig = (struct api_signature *)sp; if (valid_sig(*sig))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802180434.m1I4YxJD037333>