Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Jun 2010 17:56:51 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r209475 - stable/7/sys/boot/i386/zfsboot
Message-ID:  <201006231756.o5NHupNh038374@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed Jun 23 17:56:51 2010
New Revision: 209475
URL: http://svn.freebsd.org/changeset/base/209475

Log:
  MFC 208388:
  - Set 'dmadat' earlier so that we properly setup the heap if we fail to
    locate a high memory area for the heap using the SMAP.
  - Read the number of hard drive devices from the BIOS instead of hardcoding
    a limit of 128.  Some BIOSes duplicate disk devices once you get beyond
    the maximum drive number.

Modified:
  stable/7/sys/boot/i386/zfsboot/zfsboot.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/boot/i386/zfsboot/zfsboot.c
==============================================================================
--- stable/7/sys/boot/i386/zfsboot/zfsboot.c	Wed Jun 23 17:56:20 2010	(r209474)
+++ stable/7/sys/boot/i386/zfsboot/zfsboot.c	Wed Jun 23 17:56:51 2010	(r209475)
@@ -94,6 +94,7 @@ __FBSDID("$FreeBSD$");
 #define V86_CY(x)	((x) & 1)
 #define V86_ZR(x)	((x) & 0x40)
 
+#define BIOS_NUMDRIVES		0x475
 #define DRV_HARD	0x80
 #define DRV_MASK	0x7f
 
@@ -467,6 +468,7 @@ getstr(void)
 static inline void
 putc(int c)
 {
+    v86.ctl = 0;
     v86.addr = 0x10;
     v86.eax = 0xe00 | (c & 0xff);
     v86.ebx = 0x7;
@@ -617,6 +619,8 @@ main(void)
     off_t off;
     struct dsk *dsk;
 
+    dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base);
+
     bios_getmem();
 
     if (high_heap_size > 0) {
@@ -627,9 +631,6 @@ main(void)
 	heap_end = (char *) PTOV(bios_basemem);
     }
 
-    dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base);
-    v86.ctl = V86_FLAGS;
-
     dsk = malloc(sizeof(struct dsk));
     dsk->drive = *(uint8_t *)PTOV(ARGS);
     dsk->type = dsk->drive & DRV_HARD ? TYPE_AD : TYPE_FD;
@@ -666,7 +667,7 @@ main(void)
      * will find any other available pools and it may fill in missing
      * vdevs for the boot pool.
      */
-    for (i = 0; i < 128; i++) {
+    for (i = 0; i < *(unsigned char *)PTOV(BIOS_NUMDRIVES); i++) {
 	if ((i | DRV_HARD) == *(uint8_t *)PTOV(ARGS))
 	    continue;
 
@@ -1157,6 +1158,7 @@ getc(int fn)
      * when no such key is pressed in reality. As far as I can tell,
      * this only happens shortly after a reboot.
      */
+    v86.ctl = V86_FLAGS;
     v86.addr = 0x16;
     v86.eax = fn << 8;
     v86int();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006231756.o5NHupNh038374>