socsvn commit: r304168 - soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve

iateaca at FreeBSD.org iateaca at FreeBSD.org
Sun May 29 18:40:21 UTC 2016


Author: iateaca
Date: Sun May 29 18:40:19 2016
New Revision: 304168
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304168

Log:
  run corb mechanism in loop while rp != wp
  increment corp rp pointer and turn to 0 when rp = corb->size
  
  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 29 17:35:38 2016	(r304167)
+++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c	Sun May 29 18:40:19 2016	(r304168)
@@ -432,6 +432,24 @@
 static int
 hda_corb_run(struct hda_softc *sc)
 {
+	struct hda_codec_cmd_ctl *corb = &sc->corb;
+	uint32_t verb = 0;
+	int err;
+
+	corb->wp = hda_get_reg_by_offset(sc, HDAC_CORBWP);
+
+	while (corb->rp != corb->wp && corb->run) {
+		corb->rp++;
+		corb->rp %= corb->size;
+
+		verb = hda_dma_ld_dword(corb->dma_vaddr + HDA_CORB_ENTRY_LEN * corb->rp);
+
+		err = hda_send_command(sc, verb);
+		assert(!err);
+	}
+
+	hda_set_reg_by_offset(sc, HDAC_CORBRP, corb->rp);
+
 	return 0;
 }
 
@@ -521,25 +539,7 @@
 static void
 hda_set_corbwp(struct hda_softc *sc, uint32_t offset, uint32_t old)
 {
-	struct hda_codec_cmd_ctl *corb = &sc->corb;
-	uint32_t value = sc->regs[offset];
-	uint32_t verb = 0;
-	int err;
-
-	corb->wp = value;
-
-	/*
-	 * TODO do it in loop
-	 */
-	if (corb->wp != corb->rp && corb->run) {
-		corb->rp++;
-		verb = hda_dma_ld_dword(corb->dma_vaddr + HDA_CORB_ENTRY_LEN * corb->rp);
-
-		err = hda_send_command(sc, verb);
-		assert(!err);
-	}
-
-	hda_set_reg_by_offset(sc, HDAC_CORBRP, corb->rp);
+	hda_corb_run(sc);
 
 	return;
 }


More information about the svn-soc-all mailing list