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

iateaca at FreeBSD.org iateaca at FreeBSD.org
Sun Jul 31 20:30:49 UTC 2016


Author: iateaca
Date: Sun Jul 31 20:30:47 2016
New Revision: 307034
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307034

Log:
  use the direction of the stream (input / output) when map the stream with the stream tag
  Windows guest set the same stream tag for both input and output stream from the same codec
  
  M    bhyve/hda_codec.c
  M    bhyve/pci_hda.c

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

Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c
==============================================================================
--- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c	Sun Jul 31 19:02:19 2016	(r307033)
+++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c	Sun Jul 31 20:30:47 2016	(r307034)
@@ -314,7 +314,7 @@
 	assert(!err);
 
 	/* TODO Get the name of the sound device from the config string */
-	st->aud = audio_init("/dev/dsp", 1);
+	st->aud = audio_init("/dev/dsp0", 1);
 	if (!st->aud) {
 		DPRINTF("Fail to init the output audio player\n");
 		return -1;
@@ -329,7 +329,7 @@
 	assert(!err);
 
 	/* TODO Get the name of the sound device from the config string */
-	st->aud = audio_init("/dev/dsp", 0);
+	st->aud = audio_init("/dev/dsp1", 0);
 	if (!st->aud) {
 		DPRINTF("Fail to init the input audio player\n");
 		return -1;
@@ -460,11 +460,8 @@
 	sc = (struct hda_codec_softc *)hci->priv;
 	assert(sc);
 
-	for (i = 0; i < HDA_CODEC_STREAMS_COUNT; i++) {
-		st = &sc->streams[i];
-		if (st->stream == stream)
-			break;
-	}
+	i = dir ? HDA_CODEC_STREAM_OUTPUT : HDA_CODEC_STREAM_INPUT;
+	st = &sc->streams[i];
 
 	DPRINTF("run: %d, stream: 0x%x, st->stream: 0x%x dir: %d\n", run, stream, st->stream, dir);
 

Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c
==============================================================================
--- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c	Sun Jul 31 19:02:19 2016	(r307033)
+++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c	Sun Jul 31 20:30:47 2016	(r307034)
@@ -98,7 +98,8 @@
 	void *dma_pib_vaddr;
 
 	struct hda_stream_desc streams[HDA_IOSS_NO];
-	uint8_t stream_map[HDA_STREAM_TAGS_CNT];
+	/* 2 tables for output and input */
+	uint8_t stream_map[2][HDA_STREAM_TAGS_CNT];
 };
 
 /*
@@ -642,11 +643,11 @@
 
 	sdctl = hda_get_reg_by_offset(sc, off + HDAC_SDCTL0);
 	strm = (sdctl >> 20) & 0x0f;
-	dir = (sdctl >> 19) & 0x01;
+	dir = stream_ind >= HDA_ISS_NO;
 
 	DPRINTF("strm: 0x%x, dir: 0x%x\n", strm, dir);
 
-	sc->stream_map[strm] = stream_ind;
+	sc->stream_map[dir][strm] = stream_ind;
 	st->stream = strm;
 	st->dir = dir;
 	st->bp = 0;
@@ -1120,7 +1121,7 @@
 	sc = hci->hda;
 
 	assert(stream < HDA_STREAM_TAGS_CNT);
-	stream_ind = sc->stream_map[stream];
+	stream_ind = sc->stream_map[dir][stream];
 
 	if (!dir)
 		assert(stream_ind < HDA_ISS_NO);


More information about the svn-soc-all mailing list