diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2014-05-10 15:51:40 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2014-06-04 11:06:58 -0400 |
commit | c029a912d39f82cefc305800b49c933f1789faee (patch) | |
tree | 10811cc7eca9e7e0e34405960ecab74030d780f7 | |
parent | 02f7676421af87f59e0b8e039fb7f13aaecd0b2b (diff) | |
download | seabios-c029a912d39f82cefc305800b49c933f1789faee.tar.gz |
Move cdemu call interface and disk_ret helper code to disk.c.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | src/block.c | 31 | ||||
-rw-r--r-- | src/block.h | 10 | ||||
-rw-r--r-- | src/cdrom.c | 17 | ||||
-rw-r--r-- | src/disk.c | 53 | ||||
-rw-r--r-- | src/util.h | 1 |
5 files changed, 52 insertions, 60 deletions
diff --git a/src/block.c b/src/block.c index aff263c9..7892be5d 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 945e6fe1..aa01ed7f 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 f0d8a1ae..86e3f0cd 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 @@ -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 @@ -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 |