mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
ide: Add 8-bit data mode
CompactFlash uses features 0x01 and 0x81 to enable/disable 8-bit data path. Implement them. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Message-Id: <20221130120238.706717-1-lkundrak@v3.sk> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
9b063b7ea6
commit
1ea17d228e
2 changed files with 34 additions and 10 deletions
|
@ -1648,6 +1648,13 @@ static bool cmd_set_features(IDEState *s, uint8_t cmd)
|
||||||
|
|
||||||
/* XXX: valid for CDROM ? */
|
/* XXX: valid for CDROM ? */
|
||||||
switch (s->feature) {
|
switch (s->feature) {
|
||||||
|
case 0x01: /* 8-bit I/O enable (CompactFlash) */
|
||||||
|
case 0x81: /* 8-bit I/O disable (CompactFlash) */
|
||||||
|
if (s->drive_kind != IDE_CFATA) {
|
||||||
|
goto abort_cmd;
|
||||||
|
}
|
||||||
|
s->io8 = !(s->feature & 0x80);
|
||||||
|
return true;
|
||||||
case 0x02: /* write cache enable */
|
case 0x02: /* write cache enable */
|
||||||
blk_set_enable_write_cache(s->blk, true);
|
blk_set_enable_write_cache(s->blk, true);
|
||||||
identify_data = (uint16_t *)s->identify_data;
|
identify_data = (uint16_t *)s->identify_data;
|
||||||
|
@ -2374,12 +2381,20 @@ void ide_data_writew(void *opaque, uint32_t addr, uint32_t val)
|
||||||
}
|
}
|
||||||
|
|
||||||
p = s->data_ptr;
|
p = s->data_ptr;
|
||||||
if (p + 2 > s->data_end) {
|
if (s->io8) {
|
||||||
return;
|
if (p + 1 > s->data_end) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
*(uint16_t *)p = le16_to_cpu(val);
|
*p++ = val;
|
||||||
p += 2;
|
} else {
|
||||||
|
if (p + 2 > s->data_end) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
*(uint16_t *)p = le16_to_cpu(val);
|
||||||
|
p += 2;
|
||||||
|
}
|
||||||
s->data_ptr = p;
|
s->data_ptr = p;
|
||||||
if (p >= s->data_end) {
|
if (p >= s->data_end) {
|
||||||
s->status &= ~DRQ_STAT;
|
s->status &= ~DRQ_STAT;
|
||||||
|
@ -2401,12 +2416,20 @@ uint32_t ide_data_readw(void *opaque, uint32_t addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
p = s->data_ptr;
|
p = s->data_ptr;
|
||||||
if (p + 2 > s->data_end) {
|
if (s->io8) {
|
||||||
return 0;
|
if (p + 1 > s->data_end) {
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ret = cpu_to_le16(*(uint16_t *)p);
|
ret = *p++;
|
||||||
p += 2;
|
} else {
|
||||||
|
if (p + 2 > s->data_end) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = cpu_to_le16(*(uint16_t *)p);
|
||||||
|
p += 2;
|
||||||
|
}
|
||||||
s->data_ptr = p;
|
s->data_ptr = p;
|
||||||
if (p >= s->data_end) {
|
if (p >= s->data_end) {
|
||||||
s->status &= ~DRQ_STAT;
|
s->status &= ~DRQ_STAT;
|
||||||
|
|
|
@ -402,6 +402,7 @@ struct IDEState {
|
||||||
uint8_t select;
|
uint8_t select;
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
|
|
||||||
|
bool io8;
|
||||||
bool reset_reverts;
|
bool reset_reverts;
|
||||||
|
|
||||||
/* set for lba48 access */
|
/* set for lba48 access */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue