summaryrefslogtreecommitdiffstats
path: root/sys/i386/boot/biosboot/disk.c
diff options
context:
space:
mode:
authorroot <root@FreeBSD.org>1993-07-13 18:15:32 +0000
committerroot <root@FreeBSD.org>1993-07-13 18:15:32 +0000
commitae749d9344aaf2ad0739bf08ae8a0f0938de5082 (patch)
tree51306832be63742b44caad84a09067fb8b357a3a /sys/i386/boot/biosboot/disk.c
parent2cc7800d8398861914434a53bcf57a236c95e859 (diff)
downloadFreeBSD-src-ae749d9344aaf2ad0739bf08ae8a0f0938de5082.zip
FreeBSD-src-ae749d9344aaf2ad0739bf08ae8a0f0938de5082.tar.gz
New boot blocks, from Bruce Evans, and NetBSD fixes. Allows kernel to
be loaded above 1MB. Same boot code for floppies now. Speed improvements. etc etc etc. (I don't have much history on this, but then have been tested)
Diffstat (limited to 'sys/i386/boot/biosboot/disk.c')
-rw-r--r--sys/i386/boot/biosboot/disk.c50
1 files changed, 46 insertions, 4 deletions
diff --git a/sys/i386/boot/biosboot/disk.c b/sys/i386/boot/biosboot/disk.c
index 87b30b2..5be5723 100644
--- a/sys/i386/boot/biosboot/disk.c
+++ b/sys/i386/boot/biosboot/disk.c
@@ -28,7 +28,19 @@
/*
* HISTORY
- * $Log: disk.c,v $
+ * $Log: disk.c,v $
+ * Revision 1.3 1993/07/11 12:02:23 andrew
+ * Fixes from bde, including support for loading @ any MB boundary (e.g. a
+ * kernel linked for 0xfe100000 will load at the 1MB mark) and read-ahead
+ * buffering to speed booting from floppies. Also works with aha174x
+ * controllers in enhanced mode.
+ *
+ * Revision 1.2 1993/06/18 02:28:58 cgd
+ * make it *do* something when loading the kernel, a la sun twiddling-thing
+ *
+ * Revision 1.1 1993/03/21 18:08:36 cgd
+ * after 0.2.2 "stable" patches applied
+ *
* Revision 2.2 92/04/04 11:35:49 rpd
* Fabricated from 3.0 bootstrap and 2.5 boot disk.c:
* with support for scsi
@@ -174,14 +186,44 @@ devread()
}
}
+#define I_ADDR ((void *) 0) /* XXX where all reads go */
+
+/* Read ahead buffer large enough for one track on a 1440K floppy. For
+ * reading from floppies, the bootstrap has to be loaded on a 64K boundary
+ * to ensure that this buffer doesn't cross a 64K DMA boundary.
+ */
+#define RA_SECTORS 18
+static char ra_buf[RA_SECTORS * BPS];
+static int ra_end;
+static int ra_first;
+
Bread(dosdev,sector)
int dosdev,sector;
{
- int cyl = sector/spc, head = (sector%spc)/spt, secnum = sector%spt;
- while (biosread(dosdev, cyl,head,secnum))
+ if (sector < ra_first || sector >= ra_end)
{
- printf("Error: C:%d H:%d S:%d\n",cyl,head,secnum);
+ int cyl, head, sec, nsec;
+
+ cyl = sector/spc;
+ head = (sector % spc) / spt;
+ sec = sector % spt;
+ nsec = spt - sec;
+ if (nsec > RA_SECTORS)
+ nsec = RA_SECTORS;
+ twiddle();
+ if (biosread(dosdev, cyl, head, sec, nsec, ra_buf) != 0)
+ {
+ nsec = 1;
+ twiddle();
+ while (biosread(dosdev, cyl, head, sec, nsec, ra_buf) != 0) {
+ printf("Error: C:%d H:%d S:%d\n", cyl, head, sec);
+ twiddle();
+ }
+ }
+ ra_first = sector;
+ ra_end = sector + nsec;
}
+ bcopy(ra_buf + (sector - ra_first) * BPS, I_ADDR, BPS);
}
badsect(dosdev, sector)
OpenPOWER on IntegriCloud