Subject: Problem solved (Was: UBC breaks my IDE disk!?!)
To: Chuck Silvers <chuq@chuq.com>
From: Urban Boquist <urban@boquist.net>
List: current-users
Date: 02/22/2001 19:33:15
Hi again Chuq and Manuel,

two weeks ago I wrote about some weird pciide/memory corruption
problems I saw on my i386 laptop when running -current, although
NetBSD-1.5 ran rock solid on the same hardware.

I found the problem, and it turned out to have nothing to do with
neither UBC nor pciide. The problem was instead with the BIOS memory
map segments that are loaded in i386/machdep.c. Exactly the same
problem that Araki Ken reported in:

	http://mail-index.netbsd.org/current-users/2001/02/07/0000.html

Basically, one of the memory segments reported by my Toshiba BIOS
seems bogus and must not be used. With the patch below a -current
kernel seems to work just fine for me (userland is still 1.5, but I
don't think that should matter). Without the patch and a -current
kernel I get all sorts of weird lossage within minutes.

A big thanks to Araki Ken for finding this!

Now, the interesting question is if there is any sane way to get a
patch like the one below into the standard NetBSD sources (and enabled
by default)? Could there ever be a valid memory segment at 0xe8000 on
a PC?

Regards and thanks for your help,

        -- Urban

Index: machdep.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.429
diff -u -r1.429 machdep.c
--- machdep.c	2001/02/11 19:03:50	1.429
+++ machdep.c	2001/02/22 17:21:24
@@ -1894,6 +1894,17 @@
 					continue;
 			}
 
+#ifdef TOSHIBA_BROKEN_BIOS_MEMORY_MAP
+			/*
+			 * Some Toshiba Portege BIOSes report a bogus
+			 * memory segment that must not be used.
+			 */
+			if (seg_start == 0xe8000) {
+				printf("WARNING: skipping bogus 0xe8000"
+				       " memory segment.\n");
+				continue;
+			}
+#endif			   
 			/*
 			 * Allocate the physical addresses used by RAM
 			 * from the iomem extent map.  This is done before