diff options
author | phk <phk@FreeBSD.org> | 1995-05-08 02:02:56 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1995-05-08 02:02:56 +0000 |
commit | b2a9651ad8912e10ed56deb485129ad3d59e3ebe (patch) | |
tree | a796b8b56ad69c580aa922a0e16a95b91f15a713 | |
parent | 3aa0d024e865f17a08c5a46b95e339d986c5aa5c (diff) | |
download | FreeBSD-src-b2a9651ad8912e10ed56deb485129ad3d59e3ebe.zip FreeBSD-src-b2a9651ad8912e10ed56deb485129ad3d59e3ebe.tar.gz |
Make disk.c smart enough to handle disk with "OnTrack Disk manager".
Make it complain if people try to boot from a partition which extends
past 1024 cylinders. This is better than a random reset...
-rw-r--r-- | sys/i386/boot/biosboot/disk.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/sys/i386/boot/biosboot/disk.c b/sys/i386/boot/biosboot/disk.c index 0c7974c..f7c0fd5 100644 --- a/sys/i386/boot/biosboot/disk.c +++ b/sys/i386/boot/biosboot/disk.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:35:49 rpd - * $Id: disk.c,v 1.8 1995/02/16 15:06:09 bde Exp $ + * $Id: disk.c,v 1.9 1995/04/14 21:26:50 joerg Exp $ */ /* @@ -85,7 +85,8 @@ devopen(void) struct dos_partition *dptr; struct disklabel *dl; int dosdev = inode.i_dev; - int i, sector, di; + int i, sector = 0, di; + u_long bend; di = get_diskinfo(dosdev); spc = (spt = SPT(di)) * HEADS(di); @@ -101,15 +102,14 @@ devopen(void) #else EMBEDDED_DISKLABEL Bread(dosdev, 0); dptr = (struct dos_partition *)(((char *)0)+DOSPARTOFF); - sector = LABELSECTOR; slice = WHOLE_DISK_SLICE; for (i = 0; i < NDOSPART; i++, dptr++) if (dptr->dp_typ == DOSPTYP_386BSD) { slice = BASE_SLICE + i; - sector = dptr->dp_start + LABELSECTOR; + sector = dptr->dp_start; break; } - Bread(dosdev, sector++); + Bread(dosdev, sector + LABELSECTOR); dl=((struct disklabel *)0); disklabel = *dl; /* structure copy (maybe useful later)*/ #endif EMBEDDED_DISKLABEL @@ -128,9 +128,19 @@ devopen(void) maj = 0; /* must be ESDI/IDE */ } } - boff = dl->d_partitions[part].p_offset; -#ifdef DO_BAD144 + /* This little trick is for OnTrack DiskManager disks */ + boff = dl->d_partitions[part].p_offset - + dl->d_partitions[2].p_offset + sector; + + /* This is a good idea for all disks */ bsize = dl->d_partitions[part].p_size; + bend = boff + bsize - 1 ; + if (bend / spt > 1024) { + printf("partition is out of reach from the bios\n"); + return 1; + } + +#ifdef DO_BAD144 do_bad144 = 0; if (dl->d_flags & D_BADSECT) { /* this disk uses bad144 */ |