On Sat, Feb 20, 2016 at 03:20:15PM +0100, Gerd Hoffmann wrote:
Use case: cf cards behind sata-ide bridge, which might not support the default transfer mode.
Based on a patch by Werner Zeh werner.zeh@siemens.com, with some minor tweaks applied.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com
src/hw/ahci.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/hw/ata.h | 5 +++++ 2 files changed, 63 insertions(+)
diff --git a/src/hw/ahci.c b/src/hw/ahci.c index 9310850..ea862f2 100644 --- a/src/hw/ahci.c +++ b/src/hw/ahci.c @@ -515,6 +515,64 @@ static int ahci_port_setup(struct ahci_port_s *port) , ata_extract_version(buffer) , (u32)adjsize, adjprefix); port->prio = bootprio_find_ata_device(ctrl->pci_tmp, pnr, 0);
s8 multi_dma = -1;
s8 pio_mode = -1;
s8 udma_mode = -1;
// If bit 2 in word 53 is set, udma information is valid in word 88.
if (buffer[53] & 0x04) {
udma_mode = 6;
while ((udma_mode >= 0) &&
!((buffer[88] & 0x7f) & ( 1 << udma_mode ))) {
udma_mode--;
}
}
// If bit 1 in word 53 is set, multiword-dma and advanced pio modes
// are available in words 63 and 64.
if (buffer[53] & 0x02) {
pio_mode = 4;
multi_dma = 3;
while ((multi_dma >= 0) &&
!((buffer[63] & 0x7) & ( 1 << multi_dma ))) {
multi_dma--;
}
This indentation should be fixed.
Otherwise, looks good to me. -Kevin