diff options
author | jhb <jhb@FreeBSD.org> | 2010-05-21 16:58:52 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2010-05-21 16:58:52 +0000 |
commit | ec26a9488b14e8d1ed236fc5c08772c155ea9ce8 (patch) | |
tree | 0d072b2510eb1506c2b6039d157f2c8e511c6bef /sys/boot/i386/zfsboot | |
parent | 17a33e9b1b4a2bb86c353eaf21c57bb425f64dba (diff) | |
download | FreeBSD-src-ec26a9488b14e8d1ed236fc5c08772c155ea9ce8.zip FreeBSD-src-ec26a9488b14e8d1ed236fc5c08772c155ea9ce8.tar.gz |
- 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.
MFC after: 1 month
Diffstat (limited to 'sys/boot/i386/zfsboot')
-rw-r--r-- | sys/boot/i386/zfsboot/zfsboot.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/boot/i386/zfsboot/zfsboot.c b/sys/boot/i386/zfsboot/zfsboot.c index d312b2a..b6e5f0c 100644 --- a/sys/boot/i386/zfsboot/zfsboot.c +++ b/sys/boot/i386/zfsboot/zfsboot.c @@ -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(); |