From owner-svn-src-all@freebsd.org Wed Dec 28 07:37:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45D1BC90214; Wed, 28 Dec 2016 07:37:28 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF09E179E; Wed, 28 Dec 2016 07:37:27 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBS7bR6I065394; Wed, 28 Dec 2016 07:37:27 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS7bQQJ065391; Wed, 28 Dec 2016 07:37:26 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201612280737.uBS7bQQJ065391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 28 Dec 2016 07:37:26 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 07:37:28 -0000 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