Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 May 2016 12:25:20 GMT
From:      iateaca@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r303011 - soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve
Message-ID:  <201605151225.u4FCPKfP023243@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: iateaca
Date: Sun May 15 12:25:20 2016
New Revision: 303011
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=303011

Log:
  change the prototype of the set_reg_handler: add the offset parameter
  design the layout of the callbacks for the stream description registers
  add a callback for the SDCTL stream register
  implement a function to get the stream index from the offset register
  
  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	Sun May 15 08:36:12 2016	(r303010)
+++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c	Sun May 15 12:25:20 2016	(r303011)
@@ -105,7 +105,7 @@
 
 struct hda_softc;
 
-typedef void (*hda_set_reg_handler)(struct hda_softc *sc, uint32_t old);
+typedef void (*hda_set_reg_handler)(struct hda_softc *sc, uint32_t offset, uint32_t old);
 
 struct hda_softc {
 	uint32_t regs[HDA_LAST_OFFSET];
@@ -128,6 +128,12 @@
 static int
 hda_write(struct hda_softc *sc, uint32_t offset, uint32_t value);
 
+static inline uint8_t
+hda_get_stream_by_offsets(uint32_t offset, uint8_t reg_offset);
+
+static void
+hda_set_sdctl(struct hda_softc *sc, uint32_t offset, uint32_t old);
+
 /*
  * PCI HDA function declarations
  */
@@ -144,6 +150,22 @@
  */
 
 static const hda_set_reg_handler hda_set_reg_table[] = {
+#define HDAC_ISTREAM(n, iss, oss)				\
+	[_HDAC_ISDCTL(n, iss, oss)] = hda_set_sdctl,		\
+
+#define HDAC_OSTREAM(n, iss, oss)				\
+	[_HDAC_OSDCTL(n, iss, oss)] = hda_set_sdctl,		\
+
+	HDAC_ISTREAM(0, HDA_ISS_NO, HDA_OSS_NO)
+	HDAC_ISTREAM(1, HDA_ISS_NO, HDA_OSS_NO)
+	HDAC_ISTREAM(2, HDA_ISS_NO, HDA_OSS_NO)
+	HDAC_ISTREAM(3, HDA_ISS_NO, HDA_OSS_NO)
+
+	HDAC_OSTREAM(0, HDA_ISS_NO, HDA_OSS_NO)
+	HDAC_OSTREAM(1, HDA_ISS_NO, HDA_OSS_NO)
+	HDAC_OSTREAM(2, HDA_ISS_NO, HDA_OSS_NO)
+	HDAC_OSTREAM(3, HDA_ISS_NO, HDA_OSS_NO)
+
 	[HDA_LAST_OFFSET] = NULL,
 };
 
@@ -236,11 +258,27 @@
 	hda_set_reg_by_offset(sc, offset, value);
 
 	if (set_reg_handler)
-		set_reg_handler(sc, old);
+		set_reg_handler(sc, offset, old);
 
 	return 0;
 }
 
+static inline uint8_t
+hda_get_stream_by_offsets(uint32_t offset, uint8_t reg_offset)
+{
+	return (offset - reg_offset - 0x80) / 0x20;
+}
+
+static void
+hda_set_sdctl(struct hda_softc *sc, uint32_t offset, uint32_t old)
+{
+	uint8_t stream_ind = hda_get_stream_by_offsets(offset, 0x00);
+
+	DPRINTF("stream_ind: 0x%x old: 0x%x\n", stream_ind, old);
+
+	return;
+}
+
 /*
  * PCI HDA function definitions
  */



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