diff options
author | orion <orion@FreeBSD.org> | 2002-08-19 16:03:56 +0000 |
---|---|---|
committer | orion <orion@FreeBSD.org> | 2002-08-19 16:03:56 +0000 |
commit | e3be6c41413320a88bd5bc89e54d07f12094f010 (patch) | |
tree | 92db2afdd3f9f4243028ba8ee83115d939094e16 /sys/dev/sound | |
parent | c601d7b7846e4b3171511e985295ce98644798db (diff) | |
download | FreeBSD-src-e3be6c41413320a88bd5bc89e54d07f12094f010.zip FreeBSD-src-e3be6c41413320a88bd5bc89e54d07f12094f010.tar.gz |
Cater for ich4 quirks.
Reported by: Jacob Rhoden
Tested by: Jacob Rhoden, mp
Diffstat (limited to 'sys/dev/sound')
-rw-r--r-- | sys/dev/sound/pci/ich.c | 35 | ||||
-rw-r--r-- | sys/dev/sound/pci/ich.h | 3 |
2 files changed, 29 insertions, 9 deletions
diff --git a/sys/dev/sound/pci/ich.c b/sys/dev/sound/pci/ich.c index 3cc7053..3056d44 100644 --- a/sys/dev/sound/pci/ich.c +++ b/sys/dev/sound/pci/ich.c @@ -42,6 +42,7 @@ SND_DECLARE_FILE("$FreeBSD$"); #define ICH_MAX_BUFSZ 65536 #define SIS7012ID 0x70121039 /* SiS 7012 needs special handling */ +#define ICH4ID 0x24c58086 /* ICH4 needs special handling too */ /* buffer descriptor */ struct ich_desc { @@ -565,8 +566,12 @@ ich_init(struct sc_info *sc) DELAY(600000); stat = ich_rd(sc, ICH_REG_GLOB_STA, 4); - if ((stat & ICH_GLOB_STA_PCR) == 0) - return ENXIO; + if ((stat & ICH_GLOB_STA_PCR) == 0) { + /* ICH4 may fail when busmastering is enabled. Continue */ + if (pci_get_devid(sc->dev) != ICH4ID) { + return ENXIO; + } + } ich_wr(sc, ICH_REG_GLOB_CNT, ICH_GLOB_CTL_COLD | ICH_GLOB_CTL_PRES, 4); @@ -611,8 +616,8 @@ ich_pci_probe(device_t dev) device_set_desc(dev, "Intel 82801CA (ICH3)"); return 0; - case 0x24c58086: - device_set_desc(dev, "Intel 82801DC (ICH4)"); + case ICH4ID: + device_set_desc(dev, "Intel 82801DB (ICH4)"); return 0; case SIS7012ID: @@ -631,7 +636,6 @@ ich_pci_probe(device_t dev) static int ich_pci_attach(device_t dev) { - u_int32_t data; u_int16_t extcaps; struct sc_info *sc; char status[SND_STATUSLEN]; @@ -656,10 +660,23 @@ ich_pci_attach(device_t dev) sc->sample_size = 2; } - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + /* + * By default, ich4 has NAMBAR and NABMBAR i/o spaces as + * read-only. Need to enable "legacy support", by poking into + * pci config space. The driver should use MMBAR and MBBAR, + * but doing so will mess things up here. ich4 has enough new + * features it warrants it's own driver. + */ + if (pci_get_devid(dev) == ICH4ID) { + pci_write_config(dev, PCIR_ICH_LEGACY, ICH_LEGACY_ENABLE, 1); + } + + pci_enable_io(dev, SYS_RES_IOPORT); + /* + * Enable bus master. On ich4 this may prevent the detection of + * the primary codec becoming ready in ich_init(). + */ + pci_enable_busmaster(dev); sc->nambarid = PCIR_NAMBAR; sc->nabmbarid = PCIR_NABMBAR; diff --git a/sys/dev/sound/pci/ich.h b/sys/dev/sound/pci/ich.h index 78ecd8b..4f3ac9d 100644 --- a/sys/dev/sound/pci/ich.h +++ b/sys/dev/sound/pci/ich.h @@ -30,6 +30,9 @@ #define PCIR_NAMBAR 0x10 #define PCIR_NABMBAR 0x14 +#define PCIR_ICH_LEGACY 0x41 +#define ICH_LEGACY_ENABLE 0x01 + /* Native Audio Bus Master Control Registers */ #define ICH_REG_X_BDBAR 0x00 #define ICH_REG_X_CIV 0x04 |