summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-01-02 16:41:21 +0200
committerHans Rosenfeld <hans.rosenfeld@joyent.com>2019-01-09 11:48:11 +0100
commit1fe853a05a457dfa95ddc2f2742c2421558a7c30 (patch)
tree988c4f4c9d9671ed1c3f922555714deb46af8fda
parentb6b206fc7fb36f7b13b01acf70ed6e676e405998 (diff)
downloadillumos-joyent-1fe853a05a457dfa95ddc2f2742c2421558a7c30.tar.gz
10171 biosdisk: use int13h ah=08 and ah=15 to count the floppy devices
Reviewed by: Gergő Mihály Doma <domag02@gmail.com> Approved by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
-rw-r--r--usr/src/boot/Makefile.version2
-rw-r--r--usr/src/boot/sys/boot/i386/libi386/biosdisk.c44
2 files changed, 42 insertions, 4 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version
index 4683eed3f4..0f8ec264e4 100644
--- a/usr/src/boot/Makefile.version
+++ b/usr/src/boot/Makefile.version
@@ -33,4 +33,4 @@ LOADER_VERSION = 1.1
# Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes.
# The version is processed from left to right, the version number can only
# be increased.
-BOOT_VERSION = $(LOADER_VERSION)-2018.12.18.1
+BOOT_VERSION = $(LOADER_VERSION)-2019.01.08.1
diff --git a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
index 12aa043ba5..608310f97d 100644
--- a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
+++ b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
@@ -135,6 +135,8 @@ static int bd_ioctl(struct open_file *f, u_long cmd, void *data);
static int bd_print(int verbose);
static int cd_print(int verbose);
static int fd_print(int verbose);
+static void bd_reset_disk(int);
+static int bd_get_diskinfo_std(struct bdinfo *);
struct devsw biosfd = {
.dv_name = "fd",
@@ -251,20 +253,52 @@ bd_unit2bios(struct i386_devdesc *dev)
}
/*
+ * Use INT13 AH=15 - Read Drive Type.
+ */
+static int
+fd_count(void)
+{
+ int drive;
+
+ bd_reset_disk(0);
+
+ for (drive = 0; drive < MAXBDDEV; drive++) {
+ v86.ctl = V86_FLAGS;
+ v86.addr = 0x13;
+ v86.eax = 0x1500;
+ v86.edx = drive;
+ v86int();
+
+ if (V86_CY(v86.efl))
+ break;
+
+ if ((v86.eax & 0x300) == 0)
+ break;
+ }
+
+ return (drive);
+}
+
+/*
* Quiz the BIOS for disk devices, save a little info about them.
*/
static int
fd_init(void)
{
- int unit;
+ int unit, numfd;
bdinfo_t *bd;
- for (unit = 0; unit < MAXBDDEV; unit++) {
+ numfd = fd_count();
+ for (unit = 0; unit < numfd; unit++) {
if ((bd = calloc(1, sizeof (*bd))) == NULL)
break;
+
+ bd->bd_sectorsize = BIOSDISK_SECSIZE;
bd->bd_flags = BD_FLOPPY;
bd->bd_unit = unit;
- if (!bd_int13probe(bd)) {
+
+ /* Use std diskinfo for floppy drive */
+ if (bd_get_diskinfo_std(bd) != 0) {
free(bd);
break;
}
@@ -381,6 +415,10 @@ bc_add(int biosdev)
static int
bd_check_extensions(int unit)
{
+ /* do not use ext calls for floppy devices */
+ if (unit < 0x80)
+ return (0);
+
/* Determine if we can use EDD with this device. */
v86.ctl = V86_FLAGS;
v86.addr = 0x13;