aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-04-13 17:07:33 -0400
committerKevin O'Connor <kevin@koconnor.net>2008-04-13 17:07:33 -0400
commit3bbcc14d946b9d77d6fe77a6d970da9ff6b37dc5 (patch)
tree5e1028664a4eb44c03971a80a4ca966eab050dbf
parent109432efbb357fcea3727a054be421fd92506609 (diff)
downloadseabios-hppa-3bbcc14d946b9d77d6fe77a6d970da9ff6b37dc5.zip
seabios-hppa-3bbcc14d946b9d77d6fe77a6d970da9ff6b37dc5.tar.gz
seabios-hppa-3bbcc14d946b9d77d6fe77a6d970da9ff6b37dc5.tar.bz2
Move floppy setup code from post.c to floppy.c.
-rw-r--r--Makefile4
-rw-r--r--src/disk.h1
-rw-r--r--src/floppy.c13
-rw-r--r--src/post.c24
4 files changed, 22 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index d0b5c09..5e66ab9 100644
--- a/Makefile
+++ b/Makefile
@@ -8,8 +8,8 @@
OUT=out/
# Source files
-SRCBOTH=output.c util.c ata.c kbd.c pci.c boot.c
-SRC16=$(SRCBOTH) floppy.c disk.c system.c clock.c serial.c mouse.c \
+SRCBOTH=output.c util.c floppy.c ata.c kbd.c pci.c boot.c
+SRC16=$(SRCBOTH) disk.c system.c clock.c serial.c mouse.c \
cdrom.c apm.c pcibios.c
SRC32=$(SRCBOTH) post.c rombios32.c post_menu.c
TABLESRC=font.c cbt.c floppy_dbt.c
diff --git a/src/disk.h b/src/disk.h
index a42cb97..30ef0bb 100644
--- a/src/disk.h
+++ b/src/disk.h
@@ -101,6 +101,7 @@ void __disk_ret(const char *fname, struct bregs *regs, u8 code);
// floppy.c
extern struct floppy_ext_dbt_s diskette_param_table2;
+void floppy_drive_setup();
void floppy_13(struct bregs *regs, u8 drive);
void floppy_tick();
diff --git a/src/floppy.c b/src/floppy.c
index c27ee87..fc5e43f 100644
--- a/src/floppy.c
+++ b/src/floppy.c
@@ -40,6 +40,19 @@ struct floppy_ext_dbt_s diskette_param_table2 VISIBLE16 = {
.drive_type = 4, // drive type in cmos
};
+void
+floppy_drive_setup()
+{
+ u8 type = inb_cmos(CMOS_FLOPPY_DRIVE_TYPE);
+ u8 out = 0;
+ if (type & 0xf0)
+ out |= 0x07;
+ if (type & 0x0f)
+ out |= 0x70;
+ SET_BDA(floppy_harddisk_info, out);
+ outb(0x02, PORT_DMA1_MASK_REG);
+}
+
// Oddities:
// Return codes vary greatly - AL not cleared consistenlty, BDA return
// status not set consistently, sometimes panics.
diff --git a/src/post.c b/src/post.c
index bb69ed1..f8a3de9 100644
--- a/src/post.c
+++ b/src/post.c
@@ -11,8 +11,9 @@
#include "cmos.h" // CMOS_*
#include "util.h" // memset
#include "biosvar.h" // struct bios_data_area_s
-#include "ata.h"
-#include "kbd.h"
+#include "ata.h" // ata_detect
+#include "kbd.h" // kbd_setup
+#include "disk.h" // floppy_drive_setup
#define bda ((struct bios_data_area_s *)MAKE_FARPTR(SEG_BDA, 0))
#define ebda ((struct extended_bios_data_area_s *)MAKE_FARPTR(SEG_EBDA, 0))
@@ -62,6 +63,8 @@ init_handlers()
SET_BDA(ivecs[0x74].offset, OFFSET_entry_74);
SET_BDA(ivecs[0x75].offset, OFFSET_entry_75);
SET_BDA(ivecs[0x10].offset, OFFSET_entry_10);
+
+ SET_BDA(ivecs[0x1E].offset, OFFSET_diskette_param_table2);
}
static void
@@ -181,21 +184,6 @@ pic_setup()
}
static void
-floppy_drive_post()
-{
- u8 type = inb_cmos(CMOS_FLOPPY_DRIVE_TYPE);
- u8 out = 0;
- if (type & 0xf0)
- out |= 0x07;
- if (type & 0x0f)
- out |= 0x70;
- SET_BDA(floppy_harddisk_info, out);
- outb(0x02, PORT_DMA1_MASK_REG);
-
- SET_BDA(ivecs[0x1E].offset, OFFSET_diskette_param_table2);
-}
-
-static void
ata_init()
{
// hdidmap and cdidmap init.
@@ -373,7 +361,7 @@ post()
rombios32_init();
- floppy_drive_post();
+ floppy_drive_setup();
hard_drive_post();
if (CONFIG_ATA) {
ata_init();