aboutsummaryrefslogtreecommitdiff
path: root/src/disk.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-08-11 20:43:38 -0400
committerKevin O'Connor <kevin@koconnor.net>2009-08-11 20:43:38 -0400
commitb11443614f5ae7326aa5f238534a19660b2cf4a5 (patch)
tree7ede218b4c86d06ea6de513fb4d0cc271dbeff09 /src/disk.c
parent42337662b032eb539a40fe6e18b1e7bf64c3fa10 (diff)
downloadseabios-hppa-b11443614f5ae7326aa5f238534a19660b2cf4a5.zip
seabios-hppa-b11443614f5ae7326aa5f238534a19660b2cf4a5.tar.gz
seabios-hppa-b11443614f5ae7326aa5f238534a19660b2cf4a5.tar.bz2
Densely populate ATA.devices list.
Populate ATA.devices in order of drives found; the array index no longer correlates with the ATA.channels list. Add cntl_id to device struct for finding the channel info.
Diffstat (limited to 'src/disk.c')
-rw-r--r--src/disk.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/disk.c b/src/disk.c
index 4ace85c..609beaa 100644
--- a/src/disk.c
+++ b/src/disk.c
@@ -464,7 +464,14 @@ disk_1348(struct bregs *regs, u8 device)
, size, type, npc, nph, npspt, (u32)lba, blksize);
SET_INT13DPT(regs, size, 26);
- if (type == DTYPE_ATA) {
+ if (type == DTYPE_ATAPI) {
+ // 0x74 = removable, media change, lockable, max values
+ SET_INT13DPT(regs, infos, 0x74);
+ SET_INT13DPT(regs, cylinders, 0xffffffff);
+ SET_INT13DPT(regs, heads, 0xffffffff);
+ SET_INT13DPT(regs, spt, 0xffffffff);
+ SET_INT13DPT(regs, sector_count, (u64)-1);
+ } else {
if (lba > (u64)npspt*nph*0x3fff) {
SET_INT13DPT(regs, infos, 0x00); // geometry is invalid
SET_INT13DPT(regs, cylinders, 0x3fff);
@@ -475,18 +482,10 @@ disk_1348(struct bregs *regs, u8 device)
SET_INT13DPT(regs, heads, (u32)nph);
SET_INT13DPT(regs, spt, (u32)npspt);
SET_INT13DPT(regs, sector_count, lba);
- } else {
- // ATAPI
- // 0x74 = removable, media change, lockable, max values
- SET_INT13DPT(regs, infos, 0x74);
- SET_INT13DPT(regs, cylinders, 0xffffffff);
- SET_INT13DPT(regs, heads, 0xffffffff);
- SET_INT13DPT(regs, spt, 0xffffffff);
- SET_INT13DPT(regs, sector_count, (u64)-1);
}
SET_INT13DPT(regs, blksize, blksize);
- if (size < 30) {
+ if (size < 30 || (type != DTYPE_ATA && type != DTYPE_ATAPI)) {
disk_ret(regs, DISK_RET_SUCCESS);
return;
}
@@ -501,8 +500,9 @@ disk_1348(struct bregs *regs, u8 device)
, offsetof(struct extended_bios_data_area_s, dpte));
// Fill in dpte
- u8 channel = device / 2;
- u8 slave = device % 2;
+ u8 ataid = GET_GLOBAL(ATA.devices[device].cntl_id);
+ u8 channel = ataid / 2;
+ u8 slave = ataid % 2;
u16 iobase1 = GET_GLOBAL(ATA.channels[channel].iobase1);
u16 iobase2 = GET_GLOBAL(ATA.channels[channel].iobase2);
u8 irq = GET_GLOBAL(ATA.channels[channel].irq);