aboutsummaryrefslogtreecommitdiffstats
path: root/src/cdrom.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-12-31 00:31:03 -0500
committerKevin O'Connor <kevin@koconnor.net>2008-12-31 00:31:03 -0500
commit4524bf778adc70d7af0f74982110454f5d447b70 (patch)
tree8570fb3839a968102898272e1dac3da89f1fa9bf /src/cdrom.c
parent4a16ef64acb83df452576560ba327a8b09213280 (diff)
downloadseabios-4524bf778adc70d7af0f74982110454f5d447b70.tar.gz
Use new 'struct disk_op_s' to issue ata requests.
Using the struct at all callers reduces the parameter assignments. Replace ata_op_s with new disk_op_s and update all users. Unify basic/extended_access methods to use new send_disk_op() func. Remove cdrom_read_emu -- integrate logic into callers. Remove ata.h -- move all defs to disk.h
Diffstat (limited to 'src/cdrom.c')
-rw-r--r--src/cdrom.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/cdrom.c b/src/cdrom.c
index 00ecc717..dbf43795 100644
--- a/src/cdrom.c
+++ b/src/cdrom.c
@@ -7,9 +7,9 @@
#include "disk.h" // cdrom_13
#include "util.h" // memset
-#include "ata.h" // ATA_CMD_READ_SECTORS
#include "bregs.h" // struct bregs
#include "biosvar.h" // GET_EBDA
+#include "atabits.h" // ATA_TYPE_ATAPI
/****************************************************************
@@ -180,15 +180,6 @@ cdrom_13(struct bregs *regs, u8 device)
* CD emulation
****************************************************************/
-// Read a series of 512 byte sectors from the cdrom starting at the
-// image offset.
-__always_inline int
-cdrom_read_emu(u16 biosid, u32 vlba, u32 count, void *far_buffer)
-{
- u32 ilba = GET_EBDA(cdemu.ilba);
- return cdrom_read_512(biosid, ilba * 4 + vlba, count, far_buffer);
-}
-
// read disk drive parameters
static void
cdemu_1308(struct bregs *regs, u8 device)
@@ -443,8 +434,12 @@ cdrom_boot()
// Read the Boot Record Volume Descriptor
u8 buffer[2048];
- ret = cdrom_read(device, 0x11, 1
- , MAKE_FARPTR(GET_SEG(SS), (u32)buffer));
+ struct disk_op_s dop;
+ dop.driveid = device;
+ dop.lba = 0x11;
+ dop.count = 1;
+ dop.far_buffer = MAKE_FARPTR(GET_SEG(SS), (u32)buffer);
+ ret = cdrom_read(&dop);
if (ret)
return 3;
@@ -458,8 +453,8 @@ cdrom_boot()
u32 lba = *(u32*)&buffer[0x47];
// And we read the Boot Catalog
- ret = cdrom_read(device, lba, 1
- , MAKE_FARPTR(GET_SEG(SS), (u32)buffer));
+ dop.lba = lba;
+ ret = cdrom_read(&dop);
if (ret)
return 7;
@@ -497,7 +492,10 @@ cdrom_boot()
SET_EBDA2(ebda_seg, cdemu.ilba, lba);
// And we read the image in memory
- ret = cdrom_read_emu(device, 0, nbsectors, MAKE_FARPTR(boot_segment, 0));
+ dop.lba = lba * 4;
+ dop.count = nbsectors;
+ dop.far_buffer = MAKE_FARPTR(boot_segment, 0);
+ ret = cdrom_read_512(&dop);
if (ret)
return 12;