From patchwork Sat Jan 29 17:40:31 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: 516621 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0THfUGJ005923 for ; Sat, 29 Jan 2011 17:41:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754767Ab1A2RlX (ORCPT ); Sat, 29 Jan 2011 12:41:23 -0500 Received: from mail-fx0-f46.google.com ([209.85.161.46]:50369 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754684Ab1A2RlI (ORCPT ); Sat, 29 Jan 2011 12:41:08 -0500 Received: by mail-fx0-f46.google.com with SMTP id 20so4372013fxm.19 for ; Sat, 29 Jan 2011 09:41:08 -0800 (PST) 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:in-reply-to:references; bh=KnH7UYufk0PULUC/uJ/5iSRk5G0wbPR6xkRWDJdrpyQ=; b=VVZ+6MC15NsN4Kg7yo7bjEsGJv661M5nwUEtgcbljvkTDTeVazz914OMW97ZRWKcxw ZJvbEuqlvNsm+4MrJ3R7qXFnQrwbtuBwi9TRNFlBeOn4QhA/ZFjrzpgEjMRhGd469lPa zTO8kUXla7ntonbPWRv+ORmeGwnkq0yFZjslE= 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=kEW4pclyvlKXCSo3UjLpjaDvzPEU2eOBo9YUJ0XPIZ/OGdoA4ILWWG4D5722H20/EB 5aHPgSK1n6yqsF/+l+1V0OA/PfknMXqX6D8Qnw+sfPpGIjZarHLZjKZ+O0fK/jFyuILK Aj8iSiHG2VBlVfuQTgmdjckL4OWa7ZNelNdPU= Received: by 10.223.89.139 with SMTP id e11mr3883020fam.69.1296322867972; Sat, 29 Jan 2011 09:41:07 -0800 (PST) Received: from localhost.localdomain ([188.25.244.101]) by mx.google.com with ESMTPS id 21sm6822801fav.17.2011.01.29.09.41.06 (version=SSLv3 cipher=RC4-MD5); Sat, 29 Jan 2011 09:41:07 -0800 (PST) From: Eduard - Gabriel Munteanu To: joro@8bytes.org Cc: 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, Eduard - Gabriel Munteanu Subject: [PATCH 10/13] lsi53c895a: use the DMA memory access interface Date: Sat, 29 Jan 2011 19:40:31 +0200 Message-Id: <3db2d29c9087b87218e8818e3214a929f19a0fc2.1296321798.git.eduard.munteanu@linux360.ro> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: References: In-Reply-To: References: 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 (demeter1.kernel.org [140.211.167.41]); Sat, 29 Jan 2011 17:41:31 +0000 (UTC) diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index 0129ae3..76bd631 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); + dma_memory_read(&s->dev.dma, 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); + dma_memory_read(&s->dev.dma, addr, s->current->dma_buf, count); } else { - cpu_physical_memory_write(addr, s->current->dma_buf, count); + dma_memory_write(&s->dev.dma, 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); + dma_memory_read(&s->dev.dma, 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); + dma_memory_write(&s->dev.dma, 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); + dma_memory_write(&s->dev.dma, 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); + dma_memory_read(&s->dev.dma, s->dnad, &data, 1); s->dnad++; s->dbc--; return data; @@ -924,8 +924,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.dma, src, buf, n); + dma_memory_write(&s->dev.dma, dest, buf, n); src += n; dest += n; count -= n; @@ -993,7 +993,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.dma, 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; @@ -1352,7 +1352,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.dma, 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++) { @@ -1363,7 +1363,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.dma, addr, data, n); } } }