qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [5147] ETRAX-FS: Add support for DMA channel resets, needed for recent linux kernels.
Date: Wed, 03 Sep 2008 14:40:17 +0000	[thread overview]
Message-ID: <E1KatWr-0007nZ-MM@cvs.savannah.gnu.org> (raw)

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);

                 reply	other threads:[~2008-09-03 14:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1KatWr-0007nZ-MM@cvs.savannah.gnu.org \
    --to=edgar.iglesias@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).