qtest/ide-test: ppc64be correction for ATAPI tests
PATCH 1/1 qtest/ide-test: ppc64be correction for ATAPI tests
the 16bit ide data register is LE by definition.
--- tests/ide-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/ide-test.c +2 -2
@@ -633,7 +633,7 @@ static void send_scsi_cdb_read10(uint64_t lba, int nblocks)/* Send Packet */ for (i =0 ; i <sizeof (Read10CDB)/2 ; i++) { -outw (IDE_BASE + reg_data, ((uint16_t *)&pkt)[i]); +outw (IDE_BASE + reg_data,cpu_to_le16 (((uint16_t *)&pkt)[i])); } }
@@ -733,7 +733,7 @@ static void cdrom_pio_impl(int nblocks)size_t offset = i * (limit /2 );size_t rem = (rxsize /2 ) - offset;for (j =0 ; j <MIN ((limit /2 ), rem); j++) { - rx[offset + j] =inw (IDE_BASE + reg_data); + rx[offset + j] =le16_to_cpu (inw (IDE_BASE + reg_data)); }ide_wait_intr (IDE_PRIMARY_IRQ ); }
Signature · 1 line
2.4.3
Quoted 22 lines · John Snow
the 16bit ide data register is LE by definition.
Signed-off-by John Snow <[email protected]>--- tests/ide-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/ide-test.c +1
-1@@ -633,7 +633,7 @@ static void send_scsi_cdb_read10(uint64_t lba, int nblocks)/* Send Packet */ for (i =0 ; i <sizeof (Read10CDB)/2 ; i++) { -outw (IDE_BASE + reg_data, ((uint16_t *)&pkt)[i]); +outw (IDE_BASE + reg_data,cpu_to_le16 (((uint16_t *)&pkt)[i])); } }
tests/ide-test.c static void cdrom_pio_impl(int nblocks) · line 739
Quoted 8 lines
tests/ide-test.c +1
-1@@ -733,7 +733,7 @@ static void cdrom_pio_impl(int nblocks)size_t offset = i * (limit /2 );size_t rem = (rxsize /2 ) - offset;for (j =0 ; j <MIN ((limit /2 ), rem); j++) { - rx[offset + j] =inw (IDE_BASE + reg_data); + rx[offset + j] =le16_to_cpu (inw (IDE_BASE + reg_data)); }ide_wait_intr (IDE_PRIMARY_IRQ ); }
Tentatively staged. Barring objections, I will send a pull request for this tomorrow, thanks.
https://github.com/jnsnow/qemu/commits/ide
https://github.com/jnsnow/qemu.git
--js
Am 28.09.2015 um 19:38 hat John Snow geschrieben:
Quoted 21 lines
the 16bit ide data register is LE by definition.
Signed-off-by John Snow <[email protected]>--- tests/ide-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/ide-test.c +1
-1@@ -633,7 +633,7 @@ static void send_scsi_cdb_read10(uint64_t lba, int nblocks)/* Send Packet */ for (i =0 ; i <sizeof (Read10CDB)/2 ; i++) { -outw (IDE_BASE + reg_data, ((uint16_t *)&pkt)[i]); +outw (IDE_BASE + reg_data,cpu_to_le16 (((uint16_t *)&pkt)[i])); } }
tests/ide-test.c static void cdrom_pio_impl(int nblocks) · line 739
Quoted 8 lines
tests/ide-test.c +1
-1@@ -733,7 +733,7 @@ static void cdrom_pio_impl(int nblocks)size_t offset = i * (limit /2 );size_t rem = (rxsize /2 ) - offset;for (j =0 ; j <MIN ((limit /2 ), rem); j++) { - rx[offset + j] =inw (IDE_BASE + reg_data); + rx[offset + j] =le16_to_cpu (inw (IDE_BASE + reg_data)); }ide_wait_intr (IDE_PRIMARY_IRQ ); }
Why doesn't the access in test_identify() need a fix?
Kevin
Quoted 33 lines · Kevin Wolf
Am 28.09.2015 um 19:38 hat John Snow geschrieben:
Quoted 21 lines
the 16bit ide data register is LE by definition.
Signed-off-by John Snow <[email protected]>--- tests/ide-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/ide-test.c +1
-1@@ -633,7 +633,7 @@ static void send_scsi_cdb_read10(uint64_t lba, int nblocks)/* Send Packet */ for (i =0 ; i <sizeof (Read10CDB)/2 ; i++) { -outw (IDE_BASE + reg_data, ((uint16_t *)&pkt)[i]); +outw (IDE_BASE + reg_data,cpu_to_le16 (((uint16_t *)&pkt)[i])); } }tests/ide-test.c static void cdrom_pio_impl(int nblocks) · line 739
Quoted 8 lines
tests/ide-test.c +1
-1@@ -733,7 +733,7 @@ static void cdrom_pio_impl(int nblocks)size_t offset = i * (limit /2 );size_t rem = (rxsize /2 ) - offset;for (j =0 ; j <MIN ((limit /2 ), rem); j++) { - rx[offset + j] =inw (IDE_BASE + reg_data); + rx[offset + j] =le16_to_cpu (inw (IDE_BASE + reg_data)); }ide_wait_intr (IDE_PRIMARY_IRQ ); }Why doesn't the access in
test_identify()need a fix?
Quoted 2 lines
Kevin
The strings are stored as BE16 chunks but transmitted via an LE16 register, so if we want to decode the original string, we can apply *either* an LE16 or a BE16 swap to obtain the byte-ordered string.
Yes, that took me a minute to figure out.
We *could* apply a le16_to_cpu filter to re-obtain the raw original data, but then we'd just have to run it back through be16_to_cpu to get the string out anyway.
In this test, we just cheat and run be16_to_cpu, which works.
--js
Am 28.09.2015 um 19:38 hat John Snow geschrieben:
Quoted 3 lines
the 16bit ide data register is LE by definition.
Signed-off-by John Snow <[email protected]>