Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Jun 2016 16:54:43 GMT
From:      iateaca@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r305335 - soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve
Message-ID:  <201606181654.u5IGshAd079800@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: iateaca
Date: Sat Jun 18 16:54:42 2016
New Revision: 305335
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305335

Log:
  fix the write to the SDCTL2 offset
  get strm tag from the SDCTL register and map it to the stream_ind stream
  
  
  M    bhyve/pci_hda.c

Modified:
  soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c

Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c
==============================================================================
--- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c	Sat Jun 18 15:21:08 2016	(r305334)
+++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c	Sat Jun 18 16:54:42 2016	(r305335)
@@ -138,6 +138,8 @@
 hda_set_rirbctl(struct hda_softc *sc, uint32_t offset, uint32_t old);
 static void
 hda_set_sdctl(struct hda_softc *sc, uint32_t offset, uint32_t old);
+static void
+hda_set_sdctl2(struct hda_softc *sc, uint32_t offset, uint32_t old);
 
 static int
 hda_signal_state_change(struct hda_codec_inst *hci);
@@ -167,9 +169,11 @@
 
 #define HDAC_ISTREAM(n, iss, oss)				\
 	[_HDAC_ISDCTL(n, iss, oss)] = hda_set_sdctl,		\
+	[_HDAC_ISDCTL(n, iss, oss) + 2] = hda_set_sdctl2,	\
 
 #define HDAC_OSTREAM(n, iss, oss)				\
 	[_HDAC_OSDCTL(n, iss, oss)] = hda_set_sdctl,		\
+	[_HDAC_OSDCTL(n, iss, oss) + 2] = hda_set_sdctl2,	\
 
 	HDAC_ISTREAM(0, HDA_ISS_NO, HDA_OSS_NO)
 	HDAC_ISTREAM(1, HDA_ISS_NO, HDA_OSS_NO)
@@ -246,7 +250,7 @@
 	reg_value = hda_get_reg_by_offset(sc, offset);
 
 	reg_value &= ~mask;
-	reg_value |= value;
+	reg_value |= (value & mask);
 
 	hda_set_reg_by_offset(sc, offset, reg_value);
 
@@ -429,6 +433,8 @@
 	uint64_t bdle_paddr = 0;
 	void *bdle_vaddr = NULL;
 	uint32_t off = hda_get_offset_stream(stream_ind);
+	uint32_t sdctl = 0;
+	uint8_t strm = 0;
 	int i;
 
 	assert(!st->run);
@@ -470,6 +476,13 @@
 		bdle_desc->ioc = bdle->ioc;
 	}
 
+	sdctl = hda_get_reg_by_offset(sc, off + HDAC_SDCTL0);
+	strm = (sdctl >> 20) & 0x0f;
+
+	DPRINTF("strm: 0x%x\n", strm);
+
+	sc->stream_map[strm] = stream_ind;
+
 	return 0;
 }
 
@@ -715,7 +728,9 @@
 	uint32_t value = hda_get_reg_by_offset(sc, offset);
 	int err;
 
-	DPRINTF("stream_ind: 0x%x old: 0x%x\n", stream_ind, old);
+	DPRINTF("stream_ind: 0x%x old: 0x%x value: 0x%x\n", stream_ind, old, value);
+
+	hda_set_field_by_offset(sc, offset, 0x00ffff00, old);
 
 	if (value & HDAC_SDCTL_SRST) {
 		hda_reset_stream(sc, stream_ind);
@@ -729,6 +744,16 @@
 	return;
 }
 
+static void
+hda_set_sdctl2(struct hda_softc *sc, uint32_t offset, uint32_t old)
+{
+	uint32_t value = hda_get_reg_by_offset(sc, offset);
+
+	hda_set_field_by_offset(sc, offset - 2, 0x00ff0000, value << 16);
+
+	return;
+}
+
 static int
 hda_signal_state_change(struct hda_codec_inst *hci)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606181654.u5IGshAd079800>