svn commit: r214681 - in head/sys: i386/i386 x86/x86
John Baldwin
jhb at FreeBSD.org
Tue Nov 2 17:56:17 UTC 2010
Author: jhb
Date: Tue Nov 2 17:56:16 2010
New Revision: 214681
URL: http://svn.freebsd.org/changeset/base/214681
Log:
Further tweaks to the ram_attach() routine:
- Use > 2^32 - 1 instead of >= when checking for memory regions above 4G.
- Skip SMAP entries > 4G on i386 rather than breaking out of the loop
since SMAP entries are not guaranteed to be in order.
- Remove 'i' and loop over 'rid' directly in the dump_avail[] case.
- Only check for 4G regions in the dump_avail[] case on i386 if PAE is
enabled since vm_paddr_t is 32-bit in the !PAE case.
Submitted by: alc
Modified:
head/sys/i386/i386/machdep.c
head/sys/x86/x86/nexus.c
Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c Tue Nov 2 17:00:56 2010 (r214680)
+++ head/sys/i386/i386/machdep.c Tue Nov 2 17:56:16 2010 (r214681)
@@ -1970,7 +1970,7 @@ add_smap_entry(struct bios_smap *smap, v
return (1);
#ifndef PAE
- if (smap->base >= 0xffffffff) {
+ if (smap->base > 0xffffffff) {
printf("%uK of memory above 4GB ignored\n",
(u_int)(smap->length / 1024));
return (1);
Modified: head/sys/x86/x86/nexus.c
==============================================================================
--- head/sys/x86/x86/nexus.c Tue Nov 2 17:00:56 2010 (r214680)
+++ head/sys/x86/x86/nexus.c Tue Nov 2 17:56:16 2010 (r214681)
@@ -674,7 +674,7 @@ ram_attach(device_t dev)
vm_paddr_t *p;
caddr_t kmdp;
uint32_t smapsize;
- int error, i, rid;
+ int error, rid;
/* Retrieve the system memory map from the loader. */
kmdp = preload_search_by_type("elf kernel");
@@ -699,8 +699,8 @@ ram_attach(device_t dev)
* Resources use long's to track resources, so
* we can't include memory regions above 4GB.
*/
- if (smap->base >= ~0ul)
- break;
+ if (smap->base > ~0ul)
+ continue;
#endif
error = bus_set_resource(dev, SYS_RES_MEMORY, rid,
smap->base, smap->length);
@@ -727,24 +727,23 @@ ram_attach(device_t dev)
* instead of the start since the start address for the first
* segment is 0.
*/
- for (i = 0, p = dump_avail; p[1] != 0; i++, p += 2) {
- rid = i;
-#ifdef __i386__
+ for (rid = 0, p = dump_avail; p[1] != 0; rid++, p += 2) {
+#if defined(__i386__) && defined(PAE)
/*
* Resources use long's to track resources, so we can't
* include memory regions above 4GB.
*/
- if (p[0] >= ~0ul)
+ if (p[0] > ~0ul)
break;
#endif
error = bus_set_resource(dev, SYS_RES_MEMORY, rid, p[0],
p[1] - p[0]);
if (error)
- panic("ram_attach: resource %d failed set with %d", i,
+ panic("ram_attach: resource %d failed set with %d", rid,
error);
res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0);
if (res == NULL)
- panic("ram_attach: resource %d failed to attach", i);
+ panic("ram_attach: resource %d failed to attach", rid);
}
return (0);
}
More information about the svn-src-all
mailing list