diff options
author | 2008-06-25 15:32:18 +0000 | |
---|---|---|
committer | 2008-06-25 15:32:18 +0000 | |
commit | 31235824b46d70bd71d66fac4979888cf79dde46 (patch) | |
tree | dbde4f384de7ef872a58f5f5066116044f27075d | |
parent | auglx(4) is an audio(4) driver for the AC'97 audio codec found on (diff) | |
download | wireguard-openbsd-31235824b46d70bd71d66fac4979888cf79dde46.tar.xz wireguard-openbsd-31235824b46d70bd71d66fac4979888cf79dde46.zip |
this diff changes the bootloader to skip the CHS sanity check if LBA
(EDD) is found and OK. it will also fix chainloading into OpenBSD from
grub in a few scenarios where grub doesn't report the CHS correctly
but the LBA. and we don't need CHS if there is LBA.
this has been in the snapshots for a while.
with input from weingart@
ok deraadt@
-rw-r--r-- | sys/arch/amd64/stand/libsa/biosdev.c | 25 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/biosdev.c | 25 |
2 files changed, 30 insertions, 20 deletions
diff --git a/sys/arch/amd64/stand/libsa/biosdev.c b/sys/arch/amd64/stand/libsa/biosdev.c index 0e4439c8296..7358eab09f6 100644 --- a/sys/arch/amd64/stand/libsa/biosdev.c +++ b/sys/arch/amd64/stand/libsa/biosdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdev.c,v 1.5 2008/06/25 15:26:44 reyk Exp $ */ +/* $OpenBSD: biosdev.c,v 1.6 2008/06/25 15:32:18 reyk Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -124,14 +124,6 @@ bios_getdiskinfo(int dev, bios_diskinfo_t *pdi) pdi->bios_cylinders &= 0x3ff; pdi->bios_cylinders++; - /* Sanity check */ - if (!pdi->bios_cylinders || !pdi->bios_heads || !pdi->bios_sectors) - return(1); - - /* CD-ROMs sometimes return heads == 1 */ - if (pdi->bios_heads < 2) - return(1); - /* NOTE: * This currently hangs/reboots some machines * The IBM ThinkPad 750ED for one. @@ -173,6 +165,18 @@ bios_getdiskinfo(int dev, bios_diskinfo_t *pdi) } else pdi->bios_edd = -1; + /* Skip sanity check for CHS options in EDD mode. */ + if (pdi->bios_edd != -1) + return 0; + + /* Sanity check */ + if (!pdi->bios_cylinders || !pdi->bios_heads || !pdi->bios_sectors) + return(1); + + /* CD-ROMs sometimes return heads == 1 */ + if (pdi->bios_heads < 2) + return(1); + return(0); } @@ -410,7 +414,8 @@ bios_getdisklabel(bios_diskinfo_t *bd, struct disklabel *label) int n = 8; /* Sanity check */ - if(bd->bios_heads == 0 || bd->bios_sectors == 0) + if (bd->bios_edd == -1 && + (bd->bios_heads == 0 || bd->bios_sectors == 0)) return("failed to read disklabel"); /* MBR is a harddisk thing */ diff --git a/sys/arch/i386/stand/libsa/biosdev.c b/sys/arch/i386/stand/libsa/biosdev.c index 9603fcb8ddd..2b8220225ac 100644 --- a/sys/arch/i386/stand/libsa/biosdev.c +++ b/sys/arch/i386/stand/libsa/biosdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdev.c,v 1.73 2008/06/25 15:26:44 reyk Exp $ */ +/* $OpenBSD: biosdev.c,v 1.74 2008/06/25 15:32:18 reyk Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -127,14 +127,6 @@ bios_getdiskinfo(int dev, bios_diskinfo_t *pdi) pdi->bios_cylinders &= 0x3ff; pdi->bios_cylinders++; - /* Sanity check */ - if (!pdi->bios_cylinders || !pdi->bios_heads || !pdi->bios_sectors) - return 1; - - /* CD-ROMs sometimes return heads == 1 */ - if (pdi->bios_heads < 2) - return 1; - /* NOTE: * This currently hangs/reboots some machines * The IBM ThinkPad 750ED for one. @@ -176,6 +168,18 @@ bios_getdiskinfo(int dev, bios_diskinfo_t *pdi) } else pdi->bios_edd = -1; + /* Skip sanity check for CHS options in EDD mode. */ + if (pdi->bios_edd != -1) + return 0; + + /* Sanity check */ + if (!pdi->bios_cylinders || !pdi->bios_heads || !pdi->bios_sectors) + return 1; + + /* CD-ROMs sometimes return heads == 1 */ + if (pdi->bios_heads < 2) + return 1; + return 0; } @@ -413,7 +417,8 @@ bios_getdisklabel(bios_diskinfo_t *bd, struct disklabel *label) int n = 8; /* Sanity check */ - if (bd->bios_heads == 0 || bd->bios_sectors == 0) + if (bd->bios_edd == -1 && + (bd->bios_heads == 0 || bd->bios_sectors == 0)) return "failed to read disklabel"; /* MBR is a harddisk thing */ |