From patchwork Wed Jun 1 01:38:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduard - Gabriel Munteanu X-Patchwork-Id: 834502 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p511dL5H005216 for ; Wed, 1 Jun 2011 01:39:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933095Ab1FABjP (ORCPT ); Tue, 31 May 2011 21:39:15 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:39474 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758600Ab1FABjL (ORCPT ); Tue, 31 May 2011 21:39:11 -0400 Received: by mail-bw0-f46.google.com with SMTP id 15so4139763bwz.19 for ; Tue, 31 May 2011 18:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references; bh=2X2KWve4Gr669sRuNi818mDaVI163jzZtCvOGi1WrNw=; b=UddCVTdz5Wlu/ZOSN0QYE70I7H58zeLAbc9JCVmCdW8haRf8Zx+AcmklMTfD6ezBKl +ofizcTnpbrPWcUC1FVZi/e5nzAdgIOn1S/m5cb2ACebE/pn2apzeOeZ8ZG93bPZG3DQ T+pRmX8ie+AxQyLw7kZZjCDsa8I3d3gBgyPIw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=buM4RUP+8ppY3vaptsojWLotv9ARwdgJg/Ri57r/3wt35GQqfMWdN9pIXCwSUtcn1U 7qzDkh7olVu8o9Rd2lBuaWci4RuOahTloThYcSK+ofG1QNEFKhQZe9+OYm+flOfHYzmH Dd4BFFiWLrUNMsM3QG5l+AH8K6HygzcBumc64= Received: by 10.204.154.147 with SMTP id o19mr6167520bkw.83.1306892351040; Tue, 31 May 2011 18:39:11 -0700 (PDT) Received: from localhost.localdomain ([188.25.93.127]) by mx.google.com with ESMTPS id ag6sm453451bkc.18.2011.05.31.18.39.08 (version=SSLv3 cipher=OTHER); Tue, 31 May 2011 18:39:10 -0700 (PDT) From: Eduard - Gabriel Munteanu To: mst@redhat.com Cc: seabios@seabios.org, kevin@koconnor.net, joro@8bytes.org, blauwirbel@gmail.com, paul@codesourcery.com, avi@redhat.com, anthony@codemonkey.ws, av1474@comtv.ru, yamahata@valinux.co.jp, kvm@vger.kernel.org, qemu-devel@nongnu.org, benh@kernel.crashing.org, aik@ozlabs.ru, agraf@suse.de, aliguori@us.ibm.com, dwg@au1.ibm.com, rth@twiddle.net, david@gibson.dropbear.id.au, Eduard - Gabriel Munteanu Subject: [RFC PATCH 10/13] lsi53c895a: use the DMA memory access interface Date: Wed, 1 Jun 2011 04:38:32 +0300 Message-Id: <1306892315-7306-11-git-send-email-eduard.munteanu@linux360.ro> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1306892315-7306-1-git-send-email-eduard.munteanu@linux360.ro> References: <1306892315-7306-1-git-send-email-eduard.munteanu@linux360.ro> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 01 Jun 2011 01:39:22 +0000 (UTC) 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 be4df58..7bfc604 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -394,7 +394,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); + pci_memory_read(&s->dev, addr, (uint8_t *)&buf, 4); return cpu_to_le32(buf); } @@ -574,9 +574,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); + pci_memory_read(&s->dev, addr, s->current->dma_buf, count); } else { - cpu_physical_memory_write(addr, s->current->dma_buf, count); + pci_memory_write(&s->dev, addr, s->current->dma_buf, count); } s->current->dma_len -= count; if (s->current->dma_len == 0) { @@ -741,7 +741,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); + pci_memory_read(&s->dev, s->dnad, buf, s->dbc); s->sfbr = buf[0]; s->command_complete = 0; @@ -790,7 +790,7 @@ static void lsi_do_status(LSIState *s) s->dbc = 1; sense = s->sense; s->sfbr = sense; - cpu_physical_memory_write(s->dnad, &sense, 1); + pci_memory_write(&s->dev, s->dnad, &sense, 1); lsi_set_phase(s, PHASE_MI); s->msg_action = 1; lsi_add_msg_byte(s, 0); /* COMMAND COMPLETE */ @@ -804,7 +804,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); + pci_memory_write(&s->dev, 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; @@ -836,7 +836,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); + pci_memory_read(&s->dev, s->dnad, &data, 1); s->dnad++; s->dbc--; return data; @@ -988,8 +988,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); + pci_memory_read(&s->dev, src, buf, n); + pci_memory_write(&s->dev, dest, buf, n); src += n; dest += n; count -= n; @@ -1057,7 +1057,7 @@ again: /* 32-bit Table indirect */ offset = sxt24(addr); - cpu_physical_memory_read(s->dsa + offset, (uint8_t *)buf, 8); + pci_memory_read(&s->dev, 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; @@ -1416,7 +1416,7 @@ again: n = (insn & 7); reg = (insn >> 16) & 0xff; if (insn & (1 << 24)) { - cpu_physical_memory_read(addr, data, n); + pci_memory_read(&s->dev, 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++) { @@ -1427,7 +1427,7 @@ again: for (i = 0; i < n; i++) { data[i] = lsi_reg_readb(s, reg + i); } - cpu_physical_memory_write(addr, data, n); + pci_memory_write(&s->dev, addr, data, n); } } }