Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jul 2016 15:33:49 GMT
From:      iateaca@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r305906 - soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve
Message-ID:  <201607091533.u69FXneJ015719@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: iateaca
Date: Sat Jul  9 15:33:48 2016
New Revision: 305906
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305906

Log:
  implement the statests interrupts
  
  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 Jul  9 14:59:16 2016	(r305905)
+++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c	Sat Jul  9 15:33:48 2016	(r305906)
@@ -30,6 +30,7 @@
 #define HDAC_SDSTS_FIFORDY	(1 << 5)
 
 #define HDA_RIRBSTS_IRQ_MASK	(HDAC_RIRBSTS_RINTFL | HDAC_RIRBSTS_RIRBOIS)
+#define HDA_STATESTS_IRQ_MASK	((1 << HDA_CODEC_MAX) - 1)
 #define HDA_SDSTS_IRQ_MASK	(HDAC_SDSTS_DESE | HDAC_SDSTS_FIFOE | HDAC_SDSTS_BCIS)
 
 /*
@@ -157,6 +158,8 @@
 static void
 hda_set_gctl(struct hda_softc *sc, uint32_t offset, uint32_t old);
 static void
+hda_set_statests(struct hda_softc *sc, uint32_t offset, uint32_t old);
+static void
 hda_set_corbwp(struct hda_softc *sc, uint32_t offset, uint32_t old);
 static void
 hda_set_corbctl(struct hda_softc *sc, uint32_t offset, uint32_t old);
@@ -197,6 +200,7 @@
 
 static const hda_set_reg_handler hda_set_reg_table[] = {
 	[HDAC_GCTL] = hda_set_gctl,
+	[HDAC_STATESTS] = hda_set_statests,
 	[HDAC_CORBWP] = hda_set_corbwp,
 	[HDAC_CORBCTL] = hda_set_corbctl,
 	[HDAC_RIRBCTL] = hda_set_rirbctl,
@@ -334,15 +338,21 @@
 	uint32_t intsts = 0;
 	uint32_t sdsts = 0;
 	uint32_t rirbsts = 0;
+	uint32_t wakeen = 0;
+	uint32_t statests = 0;
 	uint32_t off = 0;
 	int i;
 
-	/* TODO update the CIS bits */
-
+	/* update the CIS bits */
 	rirbsts = hda_get_reg_by_offset(sc, HDAC_RIRBSTS);
 	if (rirbsts & (HDAC_RIRBSTS_RINTFL | HDAC_RIRBSTS_RIRBOIS))
 		intsts |= HDAC_INTSTS_CIS;
 
+	wakeen = hda_get_reg_by_offset(sc, HDAC_WAKEEN);
+	statests = hda_get_reg_by_offset(sc, HDAC_STATESTS);
+	if (statests & wakeen)
+		intsts |= HDAC_INTSTS_CIS;
+
 	/* update the SIS bits */
 	for (i = 0; i < HDA_IOSS_NO; i++) {
 		off = hda_get_offset_stream(i);
@@ -847,6 +857,21 @@
 }
 
 static void
+hda_set_statests(struct hda_softc *sc, uint32_t offset, uint32_t old)
+{
+	uint32_t value = hda_get_reg_by_offset(sc, offset);
+
+	hda_set_reg_by_offset(sc, offset, old);
+
+	/* clear the corresponding bits written by the software (guest) */
+	hda_set_field_by_offset(sc, offset, value & HDA_STATESTS_IRQ_MASK, 0);
+
+	hda_update_intr(sc);
+
+	return;
+}
+
+static void
 hda_set_corbwp(struct hda_softc *sc, uint32_t offset, uint32_t old)
 {
 	hda_corb_run(sc);
@@ -971,6 +996,7 @@
 	sdiwake = 1 << hci->cad;
 
 	hda_set_field_by_offset(sc, HDAC_STATESTS, sdiwake, sdiwake);
+	hda_update_intr(sc);
 
 	return 0;
 }



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