From patchwork Thu Jun 2 15:12:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 98417 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 79667B6FBE for ; Fri, 3 Jun 2011 01:23:46 +1000 (EST) Received: from localhost ([::1]:55693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS9kM-0006Ph-Km for incoming@patchwork.ozlabs.org; Thu, 02 Jun 2011 11:23:43 -0400 Received: from eggs.gnu.org ([140.186.70.92]:55112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS9a9-0004VT-68 for qemu-devel@nongnu.org; Thu, 02 Jun 2011 11:13:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QS9a2-0005KO-QH for qemu-devel@nongnu.org; Thu, 02 Jun 2011 11:13:08 -0400 Received: from ozlabs.org ([203.10.76.45]:32792) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS9a1-0005JQ-Gu for qemu-devel@nongnu.org; Thu, 02 Jun 2011 11:13:02 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id B8D84B6FAB; Fri, 3 Jun 2011 01:12:55 +1000 (EST) From: David Gibson To: qemu-devel@nongnu.org, eduard.munteanu@linux360.ro, rth@twiddle.net Date: Fri, 3 Jun 2011 01:12:38 +1000 Message-Id: <1307027562-3460-11-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1307027562-3460-1-git-send-email-david@gibson.dropbear.id.au> References: <1307027562-3460-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 203.10.76.45 Subject: [Qemu-devel] [PATCH 10/14] lsi53c895a: use the DMA memory access interface X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This allows the device to work properly with an emulated IOMMU. Signed-off-by: Eduard - Gabriel Munteanu --- hw/lsi53c895a.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index 83084b6..0b8a213 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -395,7 +395,7 @@ static inline uint32_t read_dword(LSIState *s, uint32_t addr) if ((addr & 0xffffe000) == s->script_ram_base) { return s->script_ram[(addr & 0x1fff) >> 2]; } - cpu_physical_memory_read(addr, (uint8_t *)&buf, 4); + dma_memory_read(&s->dev.qdev, addr, (uint8_t *)&buf, 4); return cpu_to_le32(buf); } @@ -573,9 +573,9 @@ static void lsi_do_dma(LSIState *s, int out) } /* ??? Set SFBR to first data byte. */ if (out) { - cpu_physical_memory_read(addr, s->current->dma_buf, count); + dma_memory_read(&s->dev.qdev, addr, s->current->dma_buf, count); } else { - cpu_physical_memory_write(addr, s->current->dma_buf, count); + dma_memory_write(&s->dev.qdev, addr, s->current->dma_buf, count); } s->current->dma_len -= count; if (s->current->dma_len == 0) { @@ -775,7 +775,7 @@ static void lsi_do_command(LSIState *s) DPRINTF("Send command len=%d\n", s->dbc); if (s->dbc > 16) s->dbc = 16; - cpu_physical_memory_read(s->dnad, buf, s->dbc); + dma_memory_read(&s->dev.qdev, s->dnad, buf, s->dbc); s->sfbr = buf[0]; s->command_complete = 0; @@ -825,7 +825,7 @@ static void lsi_do_status(LSIState *s) s->dbc = 1; status = s->status; s->sfbr = status; - cpu_physical_memory_write(s->dnad, &status, 1); + dma_memory_write(&s->dev.qdev, s->dnad, &status, 1); lsi_set_phase(s, PHASE_MI); s->msg_action = 1; lsi_add_msg_byte(s, 0); /* COMMAND COMPLETE */ @@ -839,7 +839,7 @@ static void lsi_do_msgin(LSIState *s) len = s->msg_len; if (len > s->dbc) len = s->dbc; - cpu_physical_memory_write(s->dnad, s->msg, len); + dma_memory_write(&s->dev.qdev, s->dnad, s->msg, len); /* Linux drivers rely on the last byte being in the SIDL. */ s->sidl = s->msg[len - 1]; s->msg_len -= len; @@ -871,7 +871,7 @@ static void lsi_do_msgin(LSIState *s) static uint8_t lsi_get_msgbyte(LSIState *s) { uint8_t data; - cpu_physical_memory_read(s->dnad, &data, 1); + dma_memory_read(&s->dev.qdev, s->dnad, &data, 1); s->dnad++; s->dbc--; return data; @@ -1028,8 +1028,8 @@ static void lsi_memcpy(LSIState *s, uint32_t dest, uint32_t src, int count) DPRINTF("memcpy dest 0x%08x src 0x%08x count %d\n", dest, src, count); while (count) { n = (count > LSI_BUF_SIZE) ? LSI_BUF_SIZE : count; - cpu_physical_memory_read(src, buf, n); - cpu_physical_memory_write(dest, buf, n); + dma_memory_read(&s->dev.qdev, src, buf, n); + dma_memory_write(&s->dev.qdev, dest, buf, n); src += n; dest += n; count -= n; @@ -1097,7 +1097,7 @@ again: /* 32-bit Table indirect */ offset = sxt24(addr); - cpu_physical_memory_read(s->dsa + offset, (uint8_t *)buf, 8); + dma_memory_read(&s->dev.qdev, s->dsa + offset, (uint8_t *)buf, 8); /* byte count is stored in bits 0:23 only */ s->dbc = cpu_to_le32(buf[0]) & 0xffffff; s->rbc = s->dbc; @@ -1456,7 +1456,7 @@ again: n = (insn & 7); reg = (insn >> 16) & 0xff; if (insn & (1 << 24)) { - cpu_physical_memory_read(addr, data, n); + dma_memory_read(&s->dev.qdev, addr, data, n); DPRINTF("Load reg 0x%x size %d addr 0x%08x = %08x\n", reg, n, addr, *(int *)data); for (i = 0; i < n; i++) { @@ -1467,7 +1467,7 @@ again: for (i = 0; i < n; i++) { data[i] = lsi_reg_readb(s, reg + i); } - cpu_physical_memory_write(addr, data, n); + dma_memory_write(&s->dev.qdev, addr, data, n); } } }