Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386 Change rbus_min_start_hint() semantic for i386...



details:   https://anonhg.NetBSD.org/src/rev/3b555e8faba2
branches:  trunk
changeset: 752542:3b555e8faba2
user:      jym <jym%NetBSD.org@localhost>
date:      Mon Mar 01 01:15:23 2010 +0000

description:
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.

diffstat:

 sys/arch/i386/i386/machdep.c         |   6 +++---
 sys/arch/i386/i386/rbus_machdep.c    |  10 +++++-----
 sys/arch/i386/include/rbus_machdep.h |   4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diffs (84 lines):

diff -r d6ef313a4836 -r 3b555e8faba2 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Mon Mar 01 01:14:58 2010 +0000
+++ b/sys/arch/i386/i386/machdep.c      Mon Mar 01 01:15:23 2010 +0000
@@ -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;
diff -r d6ef313a4836 -r 3b555e8faba2 sys/arch/i386/i386/rbus_machdep.c
--- a/sys/arch/i386/i386/rbus_machdep.c Mon Mar 01 01:14:58 2010 +0000
+++ b/sys/arch/i386/i386/rbus_machdep.c Mon Mar 01 01:15:23 2010 +0000
@@ -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
 }
diff -r d6ef313a4836 -r 3b555e8faba2 sys/arch/i386/include/rbus_machdep.h
--- a/sys/arch/i386/include/rbus_machdep.h      Mon Mar 01 01:14:58 2010 +0000
+++ b/sys/arch/i386/include/rbus_machdep.h      Mon Mar 01 01:15:23 2010 +0000
@@ -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_ */



Home | Main Index | Thread Index | Old Index