Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Dec 2016 07:37:26 +0000 (UTC)
From:      Michal Meloun <mmel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r310674 - head/sys/dev/sound/pci/hda
Message-ID:  <201612280737.uBS7bQQJ065391@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmel
Date: Wed Dec 28 07:37:26 2016
New Revision: 310674
URL: https://svnweb.freebsd.org/changeset/base/310674

Log:
  Limit number of stripes supported by HDA codec to maximum number
  announced by HDA controller.
  Incorrectly implermented HDA codec may report support for more stripes
  that HDA controller already have. Due to this, always limit number of
  enabled stripes by global controller maximum.
  
  Reviewed by:	mav
  MFC after:	1 month
  Differential Revision: https://reviews.freebsd.org/D8922

Modified:
  head/sys/dev/sound/pci/hda/hdaa.c
  head/sys/dev/sound/pci/hda/hdac.c
  head/sys/dev/sound/pci/hda/hdac.h

Modified: head/sys/dev/sound/pci/hda/hdaa.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdaa.c	Wed Dec 28 06:16:55 2016	(r310673)
+++ head/sys/dev/sound/pci/hda/hdaa.c	Wed Dec 28 07:37:26 2016	(r310674)
@@ -2130,7 +2130,8 @@ hdaa_channel_start(struct hdaa_chan *ch)
 	uint32_t fmt;
 
 	fmt = hdaa_stream_format(ch);
-	ch->stripectl = fls(ch->stripecap & hdaa_allowed_stripes(fmt)) - 1;
+	ch->stripectl = fls(ch->stripecap & hdaa_allowed_stripes(fmt) &
+	    hda_get_stripes_mask(devinfo->dev)) - 1;
 	ch->sid = HDAC_STREAM_ALLOC(device_get_parent(devinfo->dev), devinfo->dev,
 	    ch->dir == PCMDIR_PLAY ? 1 : 0, fmt, ch->stripectl, &ch->dmapos);
 	if (ch->sid <= 0)

Modified: head/sys/dev/sound/pci/hda/hdac.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdac.c	Wed Dec 28 06:16:55 2016	(r310673)
+++ head/sys/dev/sound/pci/hda/hdac.c	Wed Dec 28 07:37:26 2016	(r310674)
@@ -1767,6 +1767,9 @@ hdac_read_ivar(device_t dev, device_t ch
 	case HDA_IVAR_DMA_NOCACHE:
 		*result = (sc->flags & HDAC_F_DMA_NOCACHE) != 0;
 		break;
+	case HDA_IVAR_STRIPES_MASK:
+		*result = (1 << (1 << sc->num_sdo)) - 1;
+		break;
 	default:
 		return (ENOENT);
 	}

Modified: head/sys/dev/sound/pci/hda/hdac.h
==============================================================================
--- head/sys/dev/sound/pci/hda/hdac.h	Wed Dec 28 06:16:55 2016	(r310673)
+++ head/sys/dev/sound/pci/hda/hdac.h	Wed Dec 28 07:37:26 2016	(r310674)
@@ -707,6 +707,7 @@ enum hdac_device_ivars {
     HDA_IVAR_SUBSYSTEM_ID,
     HDA_IVAR_NODE_TYPE,
     HDA_IVAR_DMA_NOCACHE,
+    HDA_IVAR_STRIPES_MASK,
 };
 
 #define HDA_ACCESSOR(var, ivar, type)					\
@@ -723,6 +724,7 @@ HDA_ACCESSOR(subdevice_id,	SUBDEVICE_ID,
 HDA_ACCESSOR(subsystem_id,	SUBSYSTEM_ID,	uint32_t);
 HDA_ACCESSOR(node_type,		NODE_TYPE,	uint8_t);
 HDA_ACCESSOR(dma_nocache,	DMA_NOCACHE,	uint8_t);
+HDA_ACCESSOR(stripes_mask,	STRIPES_MASK,	uint8_t);
 
 #define PCIS_MULTIMEDIA_HDA    0x03
 



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