#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_*
}
-/****************************************************************
- * 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
****************************************************************/
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
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
/****************************************************************
- * 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)
{
__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)
}
}
+// 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
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