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
This commit is contained in:
Michal Meloun 2016-12-28 07:37:26 +00:00
parent c5cf639fd9
commit 4642c8c5ea
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310674
3 changed files with 7 additions and 1 deletions

View File

@ -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)

View File

@ -1767,6 +1767,9 @@ hdac_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
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);
}

View File

@ -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, uint16_t);
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