diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-06-25 15:32:19 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-06-25 15:32:19 +0000 |
commit | b2d60e4a17364cd0d4fa6cad7fa7ff4415ab4e69 (patch) | |
tree | 08c67b44f9857c901547755faef6aa232d3f160c /sys | |
parent | 8d69526fe7791272551699d11bc09492ba95ef3e (diff) |
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@
Diffstat (limited to 'sys')
-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 */ |