diff options
author | John Snow <jsnow@redhat.com> | 2015-07-06 15:17:09 -0400 |
---|---|---|
committer | John Snow <jsnow@redhat.com> | 2015-07-08 11:46:16 -0400 |
commit | 9ab9993f71b7eac6788deae2fbb7ec659ceb4a1e (patch) | |
tree | 79902673448f00b65c2bf570ff2f60bbe3c5801f /tests/libqos/ahci.c | |
parent | c8232b39bb18a91cde39b8e0b60e731a4ce782b1 (diff) | |
download | qemu-9ab9993f71b7eac6788deae2fbb7ec659ceb4a1e.zip qemu-9ab9993f71b7eac6788deae2fbb7ec659ceb4a1e.tar.gz qemu-9ab9993f71b7eac6788deae2fbb7ec659ceb4a1e.tar.bz2 |
libqos/ahci: fix ahci_write_fis for ncq on ppc64
Don't try to correct the endianness of NCQ commands, which do not
use any fields wider than a single byte.
This corrects the /x86_64/ahci/io/ncq/simple test (and others)
for ppc64 BE hosts.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: John Snow <jsnow@redhat.com>
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1436210229-4118-2-git-send-email-jsnow@redhat.com
Diffstat (limited to 'tests/libqos/ahci.c')
-rw-r--r-- | tests/libqos/ahci.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c index 33ecd2a..cf66b3e 100644 --- a/tests/libqos/ahci.c +++ b/tests/libqos/ahci.c @@ -545,16 +545,18 @@ void ahci_destroy_command(AHCIQState *ahci, uint8_t port, uint8_t slot) ahci->port[port].prdtl[slot] = 0; } -void ahci_write_fis(AHCIQState *ahci, RegH2DFIS *fis, uint64_t addr) +void ahci_write_fis(AHCIQState *ahci, AHCICommand *cmd) { - RegH2DFIS tmp = *fis; + RegH2DFIS tmp = cmd->fis; + uint64_t addr = cmd->header.ctba; - /* The auxiliary FIS fields are defined per-command and are not - * currently implemented in libqos/ahci.o, but may or may not need - * to be flipped. */ - - /* All other FIS fields are 8 bit and do not need to be flipped. */ - tmp.count = cpu_to_le16(tmp.count); + /* NCQ commands use exclusively 8 bit fields and needs no adjustment. + * Only the count field needs to be adjusted for non-NCQ commands. + * The auxiliary FIS fields are defined per-command and are not currently + * implemented in libqos/ahci.o, but may or may not need to be flipped. */ + if (!cmd->props->ncq) { + tmp.count = cpu_to_le16(tmp.count); + } memwrite(addr, &tmp, sizeof(tmp)); } @@ -877,7 +879,7 @@ void ahci_command_commit(AHCIQState *ahci, AHCICommand *cmd, uint8_t port) /* Commit the command header and command FIS */ ahci_set_command_header(ahci, port, cmd->slot, &(cmd->header)); - ahci_write_fis(ahci, &(cmd->fis), table_ptr); + ahci_write_fis(ahci, cmd); /* Construct and write the PRDs to the command table */ g_assert_cmphex(prdtl, ==, cmd->header.prdtl); |