* [Qemu-devel] [PATCH] qtest/ide-test: ppc64be correction for ATAPI tests
@ 2015-09-28 17:38 John Snow
2015-10-01 16:42 ` John Snow
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: John Snow @ 2015-09-28 17:38 UTC (permalink / raw)
To: qemu-block; +Cc: peter.maydell, John Snow, qemu-devel
the 16bit ide data register is LE by definition.
Signed-off-by: John Snow <jsnow@redhat.com>
---
tests/ide-test.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/ide-test.c b/tests/ide-test.c
index 5594738..b6e9e1a 100644
--- a/tests/ide-test.c
+++ b/tests/ide-test.c
@@ -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);
}
--
2.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] qtest/ide-test: ppc64be correction for ATAPI tests
2015-09-28 17:38 [Qemu-devel] [PATCH] qtest/ide-test: ppc64be correction for ATAPI tests John Snow
@ 2015-10-01 16:42 ` John Snow
2015-10-02 10:55 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2015-10-02 16:59 ` Kevin Wolf
2 siblings, 0 replies; 5+ messages in thread
From: John Snow @ 2015-10-01 16:42 UTC (permalink / raw)
To: qemu-block; +Cc: peter.maydell, qemu-devel
On 09/28/2015 01:38 PM, John Snow wrote:
> the 16bit ide data register is LE by definition.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> tests/ide-test.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/ide-test.c b/tests/ide-test.c
> index 5594738..b6e9e1a 100644
> --- a/tests/ide-test.c
> +++ b/tests/ide-test.c
> @@ -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);
> }
>
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [Qemu-block] [PATCH] qtest/ide-test: ppc64be correction for ATAPI tests
2015-09-28 17:38 [Qemu-devel] [PATCH] qtest/ide-test: ppc64be correction for ATAPI tests John Snow
2015-10-01 16:42 ` John Snow
@ 2015-10-02 10:55 ` Kevin Wolf
2015-10-02 16:39 ` John Snow
2015-10-02 16:59 ` Kevin Wolf
2 siblings, 1 reply; 5+ messages in thread
From: Kevin Wolf @ 2015-10-02 10:55 UTC (permalink / raw)
To: John Snow; +Cc: peter.maydell, qemu-devel, qemu-block
Am 28.09.2015 um 19:38 hat John Snow geschrieben:
> the 16bit ide data register is LE by definition.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> tests/ide-test.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/ide-test.c b/tests/ide-test.c
> index 5594738..b6e9e1a 100644
> --- a/tests/ide-test.c
> +++ b/tests/ide-test.c
> @@ -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);
> }
Why doesn't the access in test_identify() need a fix?
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [Qemu-block] [PATCH] qtest/ide-test: ppc64be correction for ATAPI tests
2015-10-02 10:55 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
@ 2015-10-02 16:39 ` John Snow
0 siblings, 0 replies; 5+ messages in thread
From: John Snow @ 2015-10-02 16:39 UTC (permalink / raw)
To: Kevin Wolf; +Cc: peter.maydell, qemu-devel, qemu-block
On 10/02/2015 06:55 AM, Kevin Wolf wrote:
> Am 28.09.2015 um 19:38 hat John Snow geschrieben:
>> the 16bit ide data register is LE by definition.
>>
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> ---
>> tests/ide-test.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/ide-test.c b/tests/ide-test.c
>> index 5594738..b6e9e1a 100644
>> --- a/tests/ide-test.c
>> +++ b/tests/ide-test.c
>> @@ -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);
>> }
>
> Why doesn't the access in test_identify() need a fix?
>
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [Qemu-block] [PATCH] qtest/ide-test: ppc64be correction for ATAPI tests
2015-09-28 17:38 [Qemu-devel] [PATCH] qtest/ide-test: ppc64be correction for ATAPI tests John Snow
2015-10-01 16:42 ` John Snow
2015-10-02 10:55 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
@ 2015-10-02 16:59 ` Kevin Wolf
2 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2015-10-02 16:59 UTC (permalink / raw)
To: John Snow; +Cc: peter.maydell, qemu-devel, qemu-block
Am 28.09.2015 um 19:38 hat John Snow geschrieben:
> the 16bit ide data register is LE by definition.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-10-02 16:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-28 17:38 [Qemu-devel] [PATCH] qtest/ide-test: ppc64be correction for ATAPI tests John Snow
2015-10-01 16:42 ` John Snow
2015-10-02 10:55 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2015-10-02 16:39 ` John Snow
2015-10-02 16:59 ` Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).