From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MiDnl-0001qG-3C for qemu-devel@nongnu.org; Mon, 31 Aug 2009 16:48:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MiDng-0001nB-Ij for qemu-devel@nongnu.org; Mon, 31 Aug 2009 16:48:32 -0400 Received: from [199.232.76.173] (port=51843 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiDng-0001mt-AL for qemu-devel@nongnu.org; Mon, 31 Aug 2009 16:48:28 -0400 Received: from mail-yw0-f195.google.com ([209.85.211.195]:54254) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MiDnf-0005ya-VZ for qemu-devel@nongnu.org; Mon, 31 Aug 2009 16:48:28 -0400 Received: by ywh33 with SMTP id 33so6414523ywh.18 for ; Mon, 31 Aug 2009 13:48:27 -0700 (PDT) MIME-Version: 1.0 From: Artyom Tarasenko Date: Mon, 31 Aug 2009 22:48:07 +0200 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Subject: [Qemu-devel] sparc esp dma endianness [patch-rfc] List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel , Blue Swirl Trying to find out what could be the mysterious scsi commands 60, 80, c0 and e0, I found out that OBP during dma exchange has problems with endianness. OBP sends commands like this: 12 20 00 00 05 00 or this 12 80 00 00 05 00, but esp.c expects that the second byte is the command and the first one is the target. The following patch solves the problem, but breaks OpenBIOS. The question is where do we have wrong endianness? It's not necessarily esp, it may be something on the way like dma or mmu. Any ideas? diff --git a/hw/esp.c b/hw/esp.c index aad547e..aceee48 100644 --- a/hw/esp.c +++ b/hw/esp.c @@ -169,11 +169,17 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf) { uint32_t dmalen; int target; - - target = s->wregs[ESP_WBUSID] & BUSID_DID; - if (s->dma) { - dmalen = s->rregs[ESP_TCLO] | (s->rregs[ESP_TCMID] << 8); - s->dma_memory_read(s->dma_opaque, buf, dmalen); + uint8_t tmp,i; + + target = s->wregs[ESP_WBUSID] & BUSID_DID; + if (s->dma) { + dmalen = s->rregs[ESP_TCLO] | (s->rregs[ESP_TCMID] << 8); + s->dma_memory_read(s->dma_opaque, buf, dmalen); + for(i=0;iti_size; memcpy(buf, s->ti_buf, dmalen); with the patch probing looks like this: ok probe-scsi Target 0 scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 0 Disk scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 1 Disk scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 2 Disk scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 3 Disk scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 4 Disk scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 5 Disk scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 6 Disk scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 7 Disk Target 2 scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 0 Removable Read Only device scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 1 Removable Read Only device scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 2 Removable Read Only device scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 3 Removable Read Only device scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 4 Removable Read Only device scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 5 Removable Read Only device scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 6 Removable Read Only device scsi-disk: Error: Inquiry (STANDARD) buffer size 5 is less than 36 (TODO: only 5 required) Unit 7 Removable Read Only device ok without patch it looks like this: ok probe-scsi Target 0 scsi-disk: Unsupported command length, command 60 scsi-disk: Unsupported command length, command 60 scsi-disk: Unsupported command length, command c0 scsi-disk: Unsupported command length, command c0 scsi-disk: Unsupported command length, command e0 scsi-disk: Unsupported command length, command e0 Target 2 scsi-disk: Unsupported command length, command 60 scsi-disk: Unsupported command length, command 60 scsi-disk: Unsupported command length, command c0 scsi-disk: Unsupported command length, command c0 scsi-disk: Unsupported command length, command e0 scsi-disk: Unsupported command length, command e0 ok