diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2008-05-18 00:14:13 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2008-05-18 00:14:13 -0400 |
commit | 88c00ee5799bd5aca5b8ae900e645d121896581c (patch) | |
tree | 27e24ab7b39ee6ecece0af79909adab7bc63f033 | |
parent | 9dd0dd1e4e2401bc2931f2e1e3417c8ef5dc42b5 (diff) | |
download | seabios-hppa-88c00ee5799bd5aca5b8ae900e645d121896581c.zip seabios-hppa-88c00ee5799bd5aca5b8ae900e645d121896581c.tar.gz seabios-hppa-88c00ee5799bd5aca5b8ae900e645d121896581c.tar.bz2 |
Auto-detect equipment byte info - don't require nvram.
Detect the number of floppies present and add to equipment byte info field.
-rw-r--r-- | src/floppy.c | 27 | ||||
-rw-r--r-- | src/post.c | 4 |
2 files changed, 19 insertions, 12 deletions
diff --git a/src/floppy.c b/src/floppy.c index 7862748..233aff7 100644 --- a/src/floppy.c +++ b/src/floppy.c @@ -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) { @@ -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 |