From: John Snow <jsnow@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] qtest/ide-test: ppc64be correction for ATAPI tests
Date: Fri, 2 Oct 2015 12:39:43 -0400 [thread overview]
Message-ID: <560EB34F.3020208@redhat.com> (raw)
In-Reply-To: <20151002105519.GB4373@noname.redhat.com>
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
next prev parent reply other threads:[~2015-10-02 16:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2015-10-02 16:59 ` Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=560EB34F.3020208@redhat.com \
--to=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.