From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KuYwy-0000hr-5M for qemu-devel@nongnu.org; Mon, 27 Oct 2008 16:44:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KuYwx-0000h8-K1 for qemu-devel@nongnu.org; Mon, 27 Oct 2008 16:44:31 -0400 Received: from [199.232.76.173] (port=52504 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KuYwx-0000h4-BM for qemu-devel@nongnu.org; Mon, 27 Oct 2008 16:44:31 -0400 Received: from savannah.gnu.org ([199.232.41.3]:55984 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KuYww-00007f-FN for qemu-devel@nongnu.org; Mon, 27 Oct 2008 16:44:31 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KuYwt-0008BJ-Gl for qemu-devel@nongnu.org; Mon, 27 Oct 2008 20:44:27 +0000 Received: from edgar_igl by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KuYwt-0008BF-BB for qemu-devel@nongnu.org; Mon, 27 Oct 2008 20:44:27 +0000 MIME-Version: 1.0 Errors-To: edgar_igl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: "Edgar E. Iglesias" Message-Id: Date: Mon, 27 Oct 2008 20:44:27 +0000 Subject: [Qemu-devel] [5553] ETRAX-FS: Process outgoing DMA channels until EOL. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5553 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5553 Author: edgar_igl Date: 2008-10-27 20:44:27 +0000 (Mon, 27 Oct 2008) Log Message: ----------- ETRAX-FS: Process outgoing DMA channels until EOL. For outgoing DMA channels, keep processing descriptors until hitting end of list. Signed-off-by: Edgar E. Iglesias Modified Paths: -------------- trunk/hw/etraxfs_dma.c Modified: trunk/hw/etraxfs_dma.c =================================================================== --- trunk/hw/etraxfs_dma.c 2008-10-27 20:24:59 UTC (rev 5552) +++ trunk/hw/etraxfs_dma.c 2008-10-27 20:44:27 UTC (rev 5553) @@ -393,72 +393,74 @@ uint32_t saved_data_buf; unsigned char buf[2 * 1024]; - if (ctrl->channels[c].eol == 1) - return; + while (ctrl->channels[c].eol != 1) { + saved_data_buf = channel_reg(ctrl, c, RW_SAVED_DATA_BUF); - saved_data_buf = channel_reg(ctrl, c, RW_SAVED_DATA_BUF); + D(printf("ch=%d buf=%x after=%x saved_data_buf=%x\n", + c, + (uint32_t)ctrl->channels[c].current_d.buf, + (uint32_t)ctrl->channels[c].current_d.after, + saved_data_buf)); - D(printf("ch=%d buf=%x after=%x saved_data_buf=%x\n", - c, - (uint32_t)ctrl->channels[c].current_d.buf, - (uint32_t)ctrl->channels[c].current_d.after, - saved_data_buf)); + len = (uint32_t)ctrl->channels[c].current_d.after; + len -= saved_data_buf; - len = (uint32_t)(unsigned long) ctrl->channels[c].current_d.after; - len -= saved_data_buf; + if (len > sizeof buf) + len = sizeof buf; + cpu_physical_memory_read (saved_data_buf, buf, len); - if (len > sizeof buf) - len = sizeof buf; - cpu_physical_memory_read (saved_data_buf, buf, len); + D(printf("channel %d pushes %x %u bytes\n", c, + saved_data_buf, len)); - D(printf("channel %d pushes %x %u bytes\n", c, - saved_data_buf, len)); + if (ctrl->channels[c].client->client.push) + ctrl->channels[c].client->client.push( + ctrl->channels[c].client->client.opaque, + buf, len); + else + printf("WARNING: DMA ch%d dataloss," + " no attached client.\n", c); - if (ctrl->channels[c].client->client.push) - ctrl->channels[c].client->client.push( - ctrl->channels[c].client->client.opaque, buf, len); - else - printf("WARNING: DMA ch%d dataloss, no attached client.\n", c); + saved_data_buf += len; - saved_data_buf += len; + if (saved_data_buf == + (uint32_t)ctrl->channels[c].current_d.after) { + /* Done. Step to next. */ + if (ctrl->channels[c].current_d.out_eop) { + /* TODO: signal eop to the client. */ + D(printf("signal eop\n")); + } + if (ctrl->channels[c].current_d.intr) { + /* TODO: signal eop to the client. */ + /* data intr. */ + D(printf("signal intr\n")); + ctrl->channels[c].regs[R_INTR] |= (1 << 2); + channel_update_irq(ctrl, c); + } + if (ctrl->channels[c].current_d.eol) { + D(printf("channel %d EOL\n", c)); + ctrl->channels[c].eol = 1; - if (saved_data_buf == - (uint32_t)(unsigned long)ctrl->channels[c].current_d.after) { - /* Done. Step to next. */ - if (ctrl->channels[c].current_d.out_eop) { - /* TODO: signal eop to the client. */ - D(printf("signal eop\n")); - } - if (ctrl->channels[c].current_d.intr) { - /* TODO: signal eop to the client. */ - /* data intr. */ - D(printf("signal intr\n")); - ctrl->channels[c].regs[R_INTR] |= (1 << 2); - channel_update_irq(ctrl, c); - } - if (ctrl->channels[c].current_d.eol) { - D(printf("channel %d EOL\n", c)); - ctrl->channels[c].eol = 1; + /* Mark the context as disabled. */ + ctrl->channels[c].current_c.dis = 1; + channel_store_c(ctrl, c); - /* Mark the context as disabled. */ - ctrl->channels[c].current_c.dis = 1; - channel_store_c(ctrl, c); + channel_stop(ctrl, c); + } else { + ctrl->channels[c].regs[RW_SAVED_DATA] = + (uint32_t)ctrl->channels[c].current_d.next; + /* Load new descriptor. */ + channel_load_d(ctrl, c); + saved_data_buf = (uint32_t)(unsigned long) + ctrl->channels[c].current_d.buf; + } - channel_stop(ctrl, c); - } else { - ctrl->channels[c].regs[RW_SAVED_DATA] = - (uint32_t)(unsigned long) ctrl->channels[c].current_d.next; - /* Load new descriptor. */ - channel_load_d(ctrl, c); - saved_data_buf = (uint32_t)(unsigned long) - ctrl->channels[c].current_d.buf; + channel_store_d(ctrl, c); + ctrl->channels[c].regs[RW_SAVED_DATA_BUF] = + saved_data_buf; + D(dump_d(c, &ctrl->channels[c].current_d)); } - - channel_store_d(ctrl, c); ctrl->channels[c].regs[RW_SAVED_DATA_BUF] = saved_data_buf; - D(dump_d(c, &ctrl->channels[c].current_d)); } - ctrl->channels[c].regs[RW_SAVED_DATA_BUF] = saved_data_buf; } static int channel_in_process(struct fs_dma_ctrl *ctrl, int c, @@ -471,7 +473,7 @@ return 0; saved_data_buf = channel_reg(ctrl, c, RW_SAVED_DATA_BUF); - len = (uint32_t)(unsigned long) ctrl->channels[c].current_d.after; + len = (uint32_t)ctrl->channels[c].current_d.after; len -= saved_data_buf; if (len > buflen) @@ -481,7 +483,7 @@ saved_data_buf += len; if (saved_data_buf == - (uint32_t)(unsigned long)ctrl->channels[c].current_d.after + (uint32_t)ctrl->channels[c].current_d.after || eop) { uint32_t r_intr = ctrl->channels[c].regs[R_INTR]; @@ -518,10 +520,10 @@ channel_stop(ctrl, c); } else { ctrl->channels[c].regs[RW_SAVED_DATA] = - (uint32_t)(unsigned long) ctrl->channels[c].current_d.next; + (uint32_t)ctrl->channels[c].current_d.next; /* Load new descriptor. */ channel_load_d(ctrl, c); - saved_data_buf = (uint32_t)(unsigned long) + saved_data_buf = (uint32_t) ctrl->channels[c].current_d.buf; } }