Auto-detect equipment byte info - don't require nvram.
authorKevin O'Connor <kevin@koconnor.net>
Sun, 18 May 2008 04:14:13 +0000 (00:14 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 18 May 2008 04:14:13 +0000 (00:14 -0400)
Detect the number of floppies present and add to equipment byte info field.

src/floppy.c
src/post.c

index 78627482311a4835615d8d95668610899fff74f0..233aff73581faad03a736b5d89f8e7b34a586d52 100644 (file)
@@ -45,22 +45,29 @@ floppy_drive_setup()
 {
     u8 type = inb_cmos(CMOS_FLOPPY_DRIVE_TYPE);
     u8 out = 0;
-    if (type & 0xf0)
+    u8 num_floppies = 0;
+
+    if (type & 0xf0) {
         out |= 0x07;
-    if (type & 0x0f)
+        num_floppies++;
+    }
+    if (type & 0x0f) {
         out |= 0x70;
+        num_floppies++;
+    }
     SET_BDA(floppy_harddisk_info, out);
+
+    // Update equipment word bits for floppy
+    if (num_floppies == 1)
+        // 1 drive, ready for boot
+        SETBITS_BDA(equipment_list_flags, 0x01);
+    else if (num_floppies == 2)
+        // 2 drives, ready for boot
+        SETBITS_BDA(equipment_list_flags, 0x41);
+
     outb(0x02, PORT_DMA1_MASK_REG);
 }
 
-// Oddities:
-//   Return codes vary greatly - AL not cleared consistenlty, BDA return
-//      status not set consistently, sometimes panics.
-//   Extra outb(0x000a, 0x02) in read?
-//   Does not disable interrupts on failure paths.
-//   numfloppies used before set in int_1308
-//   int_1305 verifies track but doesn't use it?
-
 static inline void
 set_diskette_current_cyl(u8 drive, u8 cyl)
 {
index da65559bd36375efd4dfbe07b6f761749e0050bc..573dfc8697e27d19ae0b55da61d8a4779cd82786 100644 (file)
@@ -31,8 +31,8 @@ init_bda()
 
     SET_BDA(mem_size_kb, BASE_MEM_IN_K);
 
-    // mov CMOS Equipment Byte to BDA Equipment Word
-    SET_BDA(equipment_list_flags, inb_cmos(CMOS_EQUIPMENT_INFO));
+    // Set BDA Equipment Word - 0x06 = FPU enable, mouse installed
+    SET_BDA(equipment_list_flags, 0x06);
 
     // set vector 0x79 to zero
     // this is used by 'gardian angel' protection system