8.0-BETA2 not getting my 4Gigs of ram
Jung-uk Kim
jkim at FreeBSD.org
Fri Aug 14 17:00:23 UTC 2009
On Friday 14 August 2009 12:34 pm, Jung-uk Kim wrote:
> On Friday 14 August 2009 11:01 am, Jung-uk Kim wrote:
> > On Friday 14 August 2009 05:31 am, Kostik Belousov wrote:
> > > I do agree that the printout is very confusing, and I suspect
> > > that our smbios parser has a bug. Contact jkim@, who is the
> > > author of r190599, that introduced this behaviour.
> >
> > So far I got few similar reports but all issues were BIOS bugs,
> > not my code. Except for one ancient board, there were BIOS
> > updates to fix the problem.
>
> Please try the attached patch. I added minimal sanity check. If
> it is less than realmem, we just fall back to the old way for
> *i386*. FYI, amd64 and i386 used to display different numbers
> before r190599. Since this type of BIOS bug is rare, it should be
> reasonable compromise, IMHO.
Bah, I attached a wrong patch. :-( Please use this one.
Sorry,
Jung-uk Kim
-------------- next part --------------
--- sys/amd64/amd64/machdep.c
+++ sys/amd64/amd64/machdep.c
@@ -235,19 +235,21 @@ cpu_startup(dummy)
#ifdef PERFMON
perfmon_init();
#endif
+ realmem = Maxmem;
+
+ /*
+ * Display physical memory if SMBIOS reports reasonable amount.
+ */
+ memsize = 0;
sysenv = getenv("smbios.memory.enabled");
if (sysenv != NULL) {
- memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10);
+ memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 10;
freeenv(sysenv);
- } else
- memsize = 0;
- if (memsize > 0)
- printf("real memory = %ju (%ju MB)\n", memsize << 10,
- memsize >> 10);
- else
- printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)Maxmem),
- ptoa((uintmax_t)Maxmem) / 1048576);
- realmem = Maxmem;
+ }
+ if (memsize < ptoa((uintmax_t)cnt.v_free_count))
+ memsize = ptoa((uintmax_t)Maxmem);
+ printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20);
+
/*
* Display any holes after the first chunk of extended memory.
*/
--- sys/i386/i386/machdep.c
+++ sys/i386/i386/machdep.c
@@ -279,19 +279,21 @@ cpu_startup(dummy)
#ifdef PERFMON
perfmon_init();
#endif
+ realmem = Maxmem;
+
+ /*
+ * Display physical memory if SMBIOS reports reasonable amount.
+ */
+ memsize = 0;
sysenv = getenv("smbios.memory.enabled");
if (sysenv != NULL) {
- memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10);
+ memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 10;
freeenv(sysenv);
- } else
- memsize = 0;
- if (memsize > 0)
- printf("real memory = %ju (%ju MB)\n", memsize << 10,
- memsize >> 10);
- else
- printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)Maxmem),
- ptoa((uintmax_t)Maxmem) / 1048576);
- realmem = Maxmem;
+ }
+ if (memsize < ptoa((uintmax_t)cnt.v_free_count))
+ memsize = ptoa((uintmax_t)Maxmem);
+ printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20);
+
/*
* Display any holes after the first chunk of extended memory.
*/
More information about the freebsd-amd64
mailing list