Signed-off-by: Kevin O'Connor <kevin(a)koconnor.net>
---
src/block.c | 31 -------------------------------
src/block.h | 10 ----------
src/cdrom.c | 17 -----------------
src/disk.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
src/util.h | 1 -
5 files changed, 52 insertions(+), 60 deletions(-)
diff --git a/src/block.c b/src/block.c
index aff263c..7892be5 100644
--- a/src/block.c
+++ b/src/block.c
@@ -7,7 +7,6 @@
#include "biosvar.h" // GET_GLOBAL
#include "block.h" // process_op
-#include "bregs.h" // struct bregs
#include "hw/ata.h" // process_ata_op
#include "hw/ahci.h" // process_ahci_op
#include "hw/blockcmd.h" // cdb_*
@@ -280,36 +279,6 @@ map_floppy_drive(struct drive_s *drive)
/****************************************************************
- * Return status functions
- ****************************************************************/
-
-void
-__disk_ret(struct bregs *regs, u32 linecode, const char *fname)
-{
- u8 code = linecode;
- if (regs->dl < EXTSTART_HD)
- SET_BDA(floppy_last_status, code);
- else
- SET_BDA(disk_last_status, code);
- if (code)
- __set_code_invalid(regs, linecode, fname);
- else
- set_code_success(regs);
-}
-
-void
-__disk_ret_unimplemented(struct bregs *regs, u32 linecode, const char *fname)
-{
- u8 code = linecode;
- if (regs->dl < EXTSTART_HD)
- SET_BDA(floppy_last_status, code);
- else
- SET_BDA(disk_last_status, code);
- __set_code_unimplemented(regs, linecode, fname);
-}
-
-
-/****************************************************************
* Extended Disk Drive (EDD) get drive parameters
****************************************************************/
diff --git a/src/block.h b/src/block.h
index 945e6fe..aa01ed7 100644
--- a/src/block.h
+++ b/src/block.h
@@ -99,20 +99,10 @@ int getDriveId(u8 exttype, struct drive_s *drive);
void map_floppy_drive(struct drive_s *drive);
void map_hd_drive(struct drive_s *drive);
void map_cd_drive(struct drive_s *drive);
-struct bregs;
-void __disk_ret(struct bregs *regs, u32 linecode, const char *fname);
-void __disk_ret_unimplemented(struct bregs *regs, u32 linecode
- , const char *fname);
struct int13dpt_s;
int fill_edd(u16 seg, struct int13dpt_s *param_far, struct drive_s *drive_gf);
int process_op(struct disk_op_s *op);
int send_disk_op(struct disk_op_s *op);
int create_bounce_buf(void);
-// Helper function for setting up a return code.
-#define disk_ret(regs, code) \
- __disk_ret((regs), (code) | (__LINE__ << 8), __func__)
-#define disk_ret_unimplemented(regs, code) \
- __disk_ret_unimplemented((regs), (code) | (__LINE__ << 8), __func__)
-
#endif // block.h
diff --git a/src/cdrom.c b/src/cdrom.c
index f0d8a1a..86e3f0c 100644
--- a/src/cdrom.c
+++ b/src/cdrom.c
@@ -132,23 +132,6 @@ cdrom_prepboot(void)
drive->sectors = (u64)-1;
}
-// ElTorito - Terminate disk emu
-void
-cdemu_134b(struct bregs *regs)
-{
- memcpy_far(regs->ds, (void*)(regs->si+0), SEG_LOW, &CDEmu, sizeof(CDEmu));
-
- // If we have to terminate emulation
- if (regs->al == 0x00) {
- // FIXME ElTorito Various. Should be handled accordingly to spec
- SET_LOW(CDEmu.media, 0x00); // bye bye
-
- // XXX - update floppy/hd count.
- }
-
- disk_ret(regs, DISK_RET_SUCCESS);
-}
-
/****************************************************************
* CD booting
diff --git a/src/disk.c b/src/disk.c
index 635d7b9..2aadd8a 100644
--- a/src/disk.c
+++ b/src/disk.c
@@ -18,19 +18,53 @@
/****************************************************************
- * Helper functions
+ * Return status functions
****************************************************************/
static void
+__disk_ret(struct bregs *regs, u32 linecode, const char *fname)
+{
+ u8 code = linecode;
+ if (regs->dl < EXTSTART_HD)
+ SET_BDA(floppy_last_status, code);
+ else
+ SET_BDA(disk_last_status, code);
+ if (code)
+ __set_code_invalid(regs, linecode, fname);
+ else
+ set_code_success(regs);
+}
+
+static void
+__disk_ret_unimplemented(struct bregs *regs, u32 linecode, const char *fname)
+{
+ u8 code = linecode;
+ if (regs->dl < EXTSTART_HD)
+ SET_BDA(floppy_last_status, code);
+ else
+ SET_BDA(disk_last_status, code);
+ __set_code_unimplemented(regs, linecode, fname);
+}
+
+static void
__disk_stub(struct bregs *regs, int lineno, const char *fname)
{
__warn_unimplemented(regs, lineno, fname);
__disk_ret(regs, DISK_RET_SUCCESS | (lineno << 8), fname);
}
+#define disk_ret(regs, code) \
+ __disk_ret((regs), (code) | (__LINE__ << 8), __func__)
+#define disk_ret_unimplemented(regs, code) \
+ __disk_ret_unimplemented((regs), (code) | (__LINE__ << 8), __func__)
#define DISK_STUB(regs) \
__disk_stub((regs), __LINE__, __func__)
+
+/****************************************************************
+ * Helper functions
+ ****************************************************************/
+
// Get the cylinders/heads/sectors for the given drive.
static struct chs_s
getLCHS(struct drive_s *drive_gf)
@@ -608,6 +642,23 @@ floppy_13(struct bregs *regs, struct drive_s *drive_gf)
}
}
+// ElTorito - Terminate disk emu
+static void
+cdemu_134b(struct bregs *regs)
+{
+ memcpy_far(regs->ds, (void*)(regs->si+0), SEG_LOW, &CDEmu, sizeof(CDEmu));
+
+ // If we have to terminate emulation
+ if (regs->al == 0x00) {
+ // FIXME ElTorito Various. Should be handled accordingly to spec
+ SET_LOW(CDEmu.media, 0x00); // bye bye
+
+ // XXX - update floppy/hd count.
+ }
+
+ disk_ret(regs, DISK_RET_SUCCESS);
+}
+
/****************************************************************
* Entry points
diff --git a/src/util.h b/src/util.h
index 74b58f4..493d01d 100644
--- a/src/util.h
+++ b/src/util.h
@@ -49,7 +49,6 @@ extern struct drive_s *cdemu_drive_gf;
struct disk_op_s;
int process_cdemu_op(struct disk_op_s *op);
void cdrom_prepboot(void);
-void cdemu_134b(struct bregs *regs);
int cdrom_boot(struct drive_s *drive_g);
// clock.c
--
1.9.3