From owner-p4-projects@FreeBSD.ORG Mon Feb 18 04:35:00 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 53C4616A421; Mon, 18 Feb 2008 04:35:00 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18FDE16A419 for ; Mon, 18 Feb 2008 04:35:00 +0000 (UTC) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id F3CE713C43E for ; Mon, 18 Feb 2008 04:34:59 +0000 (UTC) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1I4Yxw4037336 for ; Mon, 18 Feb 2008 04:34:59 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1I4YxJD037333 for perforce@freebsd.org; Mon, 18 Feb 2008 04:34:59 GMT (envelope-from marcel@freebsd.org) Date: Mon, 18 Feb 2008 04:34:59 GMT Message-Id: <200802180434.m1I4YxJD037333@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Cc: Subject: PERFORCE change 135623 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2008 04:35:00 -0000 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))