aboutsummaryrefslogtreecommitdiff
path: root/sys/boot
diff options
context:
space:
mode:
authorRobert Nordier <rnordier@FreeBSD.org>1999-06-21 18:27:02 +0000
committerRobert Nordier <rnordier@FreeBSD.org>1999-06-21 18:27:02 +0000
commitf8414852781bd4cb139c42d9ecbee22bd0d5fdec (patch)
treec0d6673c57c7679deacf123ab4fa67da6f4cf210 /sys/boot
parent1e61f70124c399f043239e5225f2aa1d3b42e150 (diff)
Notes
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/i386/libi386/biosdisk.c31
-rw-r--r--sys/boot/i386/libi386/bootinfo.c7
-rw-r--r--sys/boot/i386/libi386/bootinfo32.c7
-rw-r--r--sys/boot/i386/libi386/bootinfo64.c7
-rw-r--r--sys/boot/i386/libi386/libi386.h3
5 files changed, 44 insertions, 11 deletions
diff --git a/sys/boot/i386/libi386/biosdisk.c b/sys/boot/i386/libi386/biosdisk.c
index 7f5abd1dd575..00c38eeb4a6b 100644
--- a/sys/boot/i386/libi386/biosdisk.c
+++ b/sys/boot/i386/libi386/biosdisk.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: biosdisk.c,v 1.22 1999/01/24 06:03:44 msmith Exp $
+ * $Id: biosdisk.c,v 1.23 1999/01/25 23:07:02 rnordier Exp $
*/
/*
@@ -747,6 +747,35 @@ bd_getgeom(struct open_disk *od)
}
/*
+ * Return the BIOS geometry of a given "fixed drive" in a format
+ * suitable for the legacy bootinfo structure. Since the kernel is
+ * expecting raw int 0x13/0x8 values for N_BIOS_GEOM drives, we
+ * prefer to get the information directly, rather than rely on being
+ * able to put it together from information already maintained for
+ * different purposes and for a probably different number of drives.
+ *
+ * For valid drives, the geometry is expected in the format (31..0)
+ * "000000cc cccccccc hhhhhhhh 00ssssss"; and invalid drives are
+ * indicated by returning the geometry of a "1.2M" PC-format floppy
+ * disk. And, incidentally, what is returned is not the geometry as
+ * such but the highest valid cylinder, head, and sector numbers.
+ */
+u_int32_t
+bd_getbigeom(int bunit)
+{
+
+ v86.ctl = V86_FLAGS;
+ v86.addr = 0x13;
+ v86.eax = 0x800;
+ v86.edx = 0x80 + bunit;
+ v86int();
+ if (v86.efl & 0x1)
+ return 0x4f010f;
+ return ((v86.ecx & 0xc0) << 18) | ((v86.ecx & 0xff00) << 8) |
+ (v86.edx & 0xff00) | (v86.ecx & 0x3f);
+}
+
+/*
* Return a suitable dev_t value for (dev).
*
* In the case where it looks like (dev) is a SCSI disk, we allow the number of
diff --git a/sys/boot/i386/libi386/bootinfo.c b/sys/boot/i386/libi386/bootinfo.c
index 045102a86ef3..20517c2a312e 100644
--- a/sys/boot/i386/libi386/bootinfo.c
+++ b/sys/boot/i386/libi386/bootinfo.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: bootinfo.c,v 1.18 1999/03/18 14:36:22 dcs Exp $
+ * $Id: bootinfo.c,v 1.19 1999/06/04 03:18:28 ghelmer Exp $
*/
#include <stand.h>
@@ -239,7 +239,7 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
struct i386_devdesc *rootdev;
vm_offset_t addr, bootinfo_addr;
char *rootdevname;
- int bootdevnr;
+ int bootdevnr, i;
u_int pad;
char *kernelname;
const char *kernelpath;
@@ -279,7 +279,8 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
bi.bi_kernelname = 0; /* XXX char * -> kernel name */
bi.bi_nfs_diskless = 0; /* struct nfs_diskless * */
bi.bi_n_bios_used = 0; /* XXX would have to hook biosdisk driver for these */
- /* bi.bi_bios_geom[] */
+ for (i = 0; i < N_BIOS_GEOM; i++)
+ bi.bi_bios_geom[i] = bd_getbigeom(i);
bi.bi_size = sizeof(bi);
bi.bi_memsizes_valid = 1;
bi.bi_basemem = getbasemem();
diff --git a/sys/boot/i386/libi386/bootinfo32.c b/sys/boot/i386/libi386/bootinfo32.c
index 045102a86ef3..20517c2a312e 100644
--- a/sys/boot/i386/libi386/bootinfo32.c
+++ b/sys/boot/i386/libi386/bootinfo32.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: bootinfo.c,v 1.18 1999/03/18 14:36:22 dcs Exp $
+ * $Id: bootinfo.c,v 1.19 1999/06/04 03:18:28 ghelmer Exp $
*/
#include <stand.h>
@@ -239,7 +239,7 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
struct i386_devdesc *rootdev;
vm_offset_t addr, bootinfo_addr;
char *rootdevname;
- int bootdevnr;
+ int bootdevnr, i;
u_int pad;
char *kernelname;
const char *kernelpath;
@@ -279,7 +279,8 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
bi.bi_kernelname = 0; /* XXX char * -> kernel name */
bi.bi_nfs_diskless = 0; /* struct nfs_diskless * */
bi.bi_n_bios_used = 0; /* XXX would have to hook biosdisk driver for these */
- /* bi.bi_bios_geom[] */
+ for (i = 0; i < N_BIOS_GEOM; i++)
+ bi.bi_bios_geom[i] = bd_getbigeom(i);
bi.bi_size = sizeof(bi);
bi.bi_memsizes_valid = 1;
bi.bi_basemem = getbasemem();
diff --git a/sys/boot/i386/libi386/bootinfo64.c b/sys/boot/i386/libi386/bootinfo64.c
index 045102a86ef3..20517c2a312e 100644
--- a/sys/boot/i386/libi386/bootinfo64.c
+++ b/sys/boot/i386/libi386/bootinfo64.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: bootinfo.c,v 1.18 1999/03/18 14:36:22 dcs Exp $
+ * $Id: bootinfo.c,v 1.19 1999/06/04 03:18:28 ghelmer Exp $
*/
#include <stand.h>
@@ -239,7 +239,7 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
struct i386_devdesc *rootdev;
vm_offset_t addr, bootinfo_addr;
char *rootdevname;
- int bootdevnr;
+ int bootdevnr, i;
u_int pad;
char *kernelname;
const char *kernelpath;
@@ -279,7 +279,8 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
bi.bi_kernelname = 0; /* XXX char * -> kernel name */
bi.bi_nfs_diskless = 0; /* struct nfs_diskless * */
bi.bi_n_bios_used = 0; /* XXX would have to hook biosdisk driver for these */
- /* bi.bi_bios_geom[] */
+ for (i = 0; i < N_BIOS_GEOM; i++)
+ bi.bi_bios_geom[i] = bd_getbigeom(i);
bi.bi_size = sizeof(bi);
bi.bi_memsizes_valid = 1;
bi.bi_basemem = getbasemem();
diff --git a/sys/boot/i386/libi386/libi386.h b/sys/boot/i386/libi386/libi386.h
index 39333239726d..a7be85148303 100644
--- a/sys/boot/i386/libi386/libi386.h
+++ b/sys/boot/i386/libi386/libi386.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: libi386.h,v 1.7 1998/10/02 16:32:45 msmith Exp $
+ * $Id: libi386.h,v 1.8 1998/10/02 20:53:17 msmith Exp $
*/
@@ -63,6 +63,7 @@ extern struct devdesc currdev; /* our current device */
/* exported devices XXX rename? */
extern struct devsw biosdisk;
+u_int32_t bd_getbigeom(int bunit); /* return geometry in bootinfo format */
extern int bd_bios2unit(int biosdev); /* xlate BIOS device -> biosdisk unit */
extern int bd_unit2bios(int unit); /* xlate biosdisk unit -> BIOS device */
extern int bd_getdev(struct i386_devdesc *dev); /* return dev_t for (dev) */