aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-04-05 21:08:57 -0400
committerKevin O'Connor <kevin@koconnor.net>2008-04-05 21:08:57 -0400
commitdfabfe00d995e9b03da35896d99cf50b3d73624d (patch)
treed36aed17585e95574b8ec67899bbb458c10a18ff
parent98123b53ef37009e556039f3a7b7a4b69be022ec (diff)
downloadseabios-hppa-rel-0.2.1.zip
seabios-hppa-rel-0.2.1.tar.gz
seabios-hppa-rel-0.2.1.tar.bz2
Fix bug causing write corruption on large disks.rel-0.2.1
Writes past 1<<28 sectors were not correct - corruption occurs.
-rw-r--r--src/ata.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ata.c b/src/ata.c
index f7f4a57..73f3cd7 100644
--- a/src/ata.c
+++ b/src/ata.c
@@ -320,13 +320,14 @@ ata_cmd_data(int driveid, u16 command, u32 lba, u16 count, void *far_buffer)
struct ata_pio_command cmd;
memset(&cmd, 0, sizeof(cmd));
+ cmd.command = command;
if (count >= (1<<8) || lba + count >= (1<<28)) {
cmd.sector_count2 = count >> 8;
cmd.lba_low2 = lba >> 24;
cmd.lba_mid2 = 0;
cmd.lba_high2 = 0;
- command |= 0x04;
+ cmd.command |= 0x04;
lba &= 0xffffff;
}
@@ -337,7 +338,6 @@ ata_cmd_data(int driveid, u16 command, u32 lba, u16 count, void *far_buffer)
cmd.lba_high = lba >> 16;
cmd.device = ((slave ? ATA_CB_DH_DEV1 : ATA_CB_DH_DEV0)
| ((lba >> 24) & 0xf) | ATA_CB_DH_LBA);
- cmd.command = command;
int ret = send_cmd(driveid, &cmd);
if (ret)
@@ -623,7 +623,7 @@ init_drive_ata(int driveid)
case ATA_TRANSLATION_LARGE:
if (translation == ATA_TRANSLATION_LARGE)
BX_INFO("large");
- while(cylinders > 1024) {
+ while (cylinders > 1024) {
cylinders >>= 1;
heads <<= 1;