From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KatWu-0005eb-UH for qemu-devel@nongnu.org; Wed, 03 Sep 2008 10:40:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KatWt-0005eA-Hx for qemu-devel@nongnu.org; Wed, 03 Sep 2008 10:40:19 -0400 Received: from [199.232.76.173] (port=48935 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KatWt-0005e2-8I for qemu-devel@nongnu.org; Wed, 03 Sep 2008 10:40:19 -0400 Received: from savannah.gnu.org ([199.232.41.3]:45476 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 1KatWt-0001IB-QF for qemu-devel@nongnu.org; Wed, 03 Sep 2008 10:40:19 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KatWr-0007ne-VS for qemu-devel@nongnu.org; Wed, 03 Sep 2008 14:40:18 +0000 Received: from edgar_igl by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KatWr-0007nZ-MM for qemu-devel@nongnu.org; Wed, 03 Sep 2008 14:40:17 +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: Wed, 03 Sep 2008 14:40:17 +0000 Subject: [Qemu-devel] [5147] ETRAX-FS: Add support for DMA channel resets, needed for recent linux kernels. 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: 5147 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5147 Author: edgar_igl Date: 2008-09-03 14:40:17 +0000 (Wed, 03 Sep 2008) Log Message: ----------- ETRAX-FS: Add support for DMA channel resets, needed for recent linux kernels. * Correct numeric value for the RST state. * Add emulation for reseting a DMA channel. * Add a few sanity checks. * Make it compile with debug enabled. Modified Paths: -------------- trunk/hw/etraxfs_dma.c Modified: trunk/hw/etraxfs_dma.c =================================================================== --- trunk/hw/etraxfs_dma.c 2008-09-03 14:31:11 UTC (rev 5146) +++ trunk/hw/etraxfs_dma.c 2008-09-03 14:40:17 UTC (rev 5147) @@ -156,7 +156,7 @@ enum dma_ch_state { - RST = 0, + RST = 1, STOPPED = 2, RUNNING = 4 }; @@ -398,7 +398,7 @@ saved_data_buf = channel_reg(ctrl, c, RW_SAVED_DATA_BUF); - D(fprintf(logfile, "ch=%d buf=%x after=%x saved_data_buf=%x\n", + 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, @@ -583,6 +583,17 @@ } static void +dma_update_state(struct fs_dma_ctrl *ctrl, int c) +{ + if ((ctrl->channels[c].regs[RW_CFG] & 1) != 3) { + if (ctrl->channels[c].regs[RW_CFG] & 2) + ctrl->channels[c].state = STOPPED; + if (!(ctrl->channels[c].regs[RW_CFG] & 1)) + ctrl->channels[c].state = RST; + } +} + +static void dma_writel (void *opaque, target_phys_addr_t addr, uint32_t value) { struct fs_dma_ctrl *ctrl = opaque; @@ -599,9 +610,13 @@ case RW_CFG: ctrl->channels[c].regs[addr] = value; + dma_update_state(ctrl, c); break; case RW_CMD: /* continue. */ + if (value & ~1) + printf("Invalid store to ch=%d RW_CMD %x\n", + c, value); ctrl->channels[c].regs[addr] = value; channel_continue(ctrl, c); break; @@ -622,6 +637,10 @@ break; case RW_STREAM_CMD: + if (value & ~1023) + printf("Invalid store to ch=%d " + "RW_STREAMCMD %x\n", + c, value); ctrl->channels[c].regs[addr] = value; D(printf("stream_cmd ch=%d\n", c)); channel_stream_cmd(ctrl, c, value);