Module Name: src Committed By: jym Date: Mon Mar 1 01:15:24 UTC 2010
Modified Files: src/sys/arch/i386/i386: machdep.c rbus_machdep.c src/sys/arch/i386/include: rbus_machdep.h Log Message: Change rbus_min_start_hint() semantic for i386. "ram" is now psize_t (instead of size_t) to avoid possible overflow when system may have more than 4GB of memory (like PAE). The behavior of rbus_min_start_hint() remains the same. While here, fix printf's format strings (paddr_t => PRIxPADDR). Use ctob() and cast physmem to psize_t to avoid losing bits above 4GB. Comes from PAE patch from Jeremy Morse; adaptation by me. Compile tested for GENERIC only. No regression expected. To generate a diff of this commit: cvs rdiff -u -r1.682 -r1.683 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.24 -r1.25 src/sys/arch/i386/i386/rbus_machdep.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/include/rbus_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/i386/i386/machdep.c diff -u src/sys/arch/i386/i386/machdep.c:1.682 src/sys/arch/i386/i386/machdep.c:1.683 --- src/sys/arch/i386/i386/machdep.c:1.682 Mon Feb 8 19:02:29 2010 +++ src/sys/arch/i386/i386/machdep.c Mon Mar 1 01:15:23 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.682 2010/02/08 19:02:29 joerg Exp $ */ +/* $NetBSD: machdep.c,v 1.683 2010/03/01 01:15:23 jym Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009 @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.682 2010/02/08 19:02:29 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.683 2010/03/01 01:15:23 jym Exp $"); #include "opt_beep.h" #include "opt_compat_ibcs2.h" @@ -481,7 +481,7 @@ #if NCARDBUS > 0 /* Tell RBUS how much RAM we have, so it can use heuristics. */ - rbus_min_start_hint(ptoa(physmem)); + rbus_min_start_hint(ctob((psize_t)physmem)); #endif minaddr = 0; Index: src/sys/arch/i386/i386/rbus_machdep.c diff -u src/sys/arch/i386/i386/rbus_machdep.c:1.24 src/sys/arch/i386/i386/rbus_machdep.c:1.25 --- src/sys/arch/i386/i386/rbus_machdep.c:1.24 Tue Dec 15 22:17:12 2009 +++ src/sys/arch/i386/i386/rbus_machdep.c Mon Mar 1 01:15:24 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: rbus_machdep.c,v 1.24 2009/12/15 22:17:12 snj Exp $ */ +/* $NetBSD: rbus_machdep.c,v 1.25 2010/03/01 01:15:24 jym Exp $ */ /* * Copyright (c) 1999 @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.24 2009/12/15 22:17:12 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.25 2010/03/01 01:15:24 jym Exp $"); #include "opt_pcibios.h" #include "opt_pcifixup.h" @@ -82,10 +82,10 @@ * or 2046 vs 2048. */ void -rbus_min_start_hint(size_t ram) +rbus_min_start_hint(psize_t ram) { #ifdef RBUS_MIN_START_FORCED - aprint_debug("rbus: rbus_min_start from config at 0x%0lx\n", + aprint_debug("rbus: rbus_min_start from config at %#0" PRIxPADDR "\n", rbus_min_start); #else if (ram <= 192*1024*1024UL) { @@ -113,7 +113,7 @@ rbus_min_start = 3 * 1024 * 1024 * 1024UL; } - aprint_debug("rbus: rbus_min_start set to 0x%0lx\n", + aprint_debug("rbus: rbus_min_start set to %#0" PRIxPADDR "\n", rbus_min_start); #endif } Index: src/sys/arch/i386/include/rbus_machdep.h diff -u src/sys/arch/i386/include/rbus_machdep.h:1.8 src/sys/arch/i386/include/rbus_machdep.h:1.9 --- src/sys/arch/i386/include/rbus_machdep.h:1.8 Tue Dec 15 22:17:12 2009 +++ src/sys/arch/i386/include/rbus_machdep.h Mon Mar 1 01:15:24 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: rbus_machdep.h,v 1.8 2009/12/15 22:17:12 snj Exp $ */ +/* $NetBSD: rbus_machdep.h,v 1.9 2010/03/01 01:15:24 jym Exp $ */ /* * Copyright (c) 1999 @@ -40,6 +40,6 @@ rbus_tag_t rbus_pccbb_parent_io(struct pci_attach_args *); rbus_tag_t rbus_pccbb_parent_mem(struct pci_attach_args *); -void rbus_min_start_hint(size_t); +void rbus_min_start_hint(psize_t); #endif /* _ARCH_I386_I386_RBUS_MACHDEP_H_ */