From owner-svn-src-all@FreeBSD.ORG Thu Jan 19 11:18:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 118E7106566C; Thu, 19 Jan 2012 11:18:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF0A98FC1A; Thu, 19 Jan 2012 11:18:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0JBILoY088278; Thu, 19 Jan 2012 11:18:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0JBILYA088275; Thu, 19 Jan 2012 11:18:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201191118.q0JBILYA088275@svn.freebsd.org> From: Alexander Motin Date: Thu, 19 Jan 2012 11:18:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230331 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 19 Jan 2012 11:18:22 -0000 Author: mav Date: Thu Jan 19 11:18:21 2012 New Revision: 230331 URL: http://svn.freebsd.org/changeset/base/230331 Log: Print controller/codec IDs for unknown chips instead of useless and frightening "unknown" word. In most cases we don't need to know chips to properly handle them, but having IDs in logs may simplify debugging. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/sound/pci/hda/hdacc.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Thu Jan 19 09:51:07 2012 (r230330) +++ head/sys/dev/sound/pci/hda/hdac.c Thu Jan 19 11:18:21 2012 (r230331) @@ -124,9 +124,9 @@ static const struct { { HDA_NVIDIA_MCP89_2, "NVIDIA MCP89", 0, 0 }, { HDA_NVIDIA_MCP89_3, "NVIDIA MCP89", 0, 0 }, { HDA_NVIDIA_MCP89_4, "NVIDIA MCP89", 0, 0 }, - { HDA_NVIDIA_0BE2, "NVIDIA 0x0be2", 0, HDAC_QUIRK_MSI }, - { HDA_NVIDIA_0BE3, "NVIDIA 0x0be3", 0, HDAC_QUIRK_MSI }, - { HDA_NVIDIA_0BE4, "NVIDIA 0x0be4", 0, HDAC_QUIRK_MSI }, + { HDA_NVIDIA_0BE2, "NVIDIA (0x0be2)", 0, HDAC_QUIRK_MSI }, + { HDA_NVIDIA_0BE3, "NVIDIA (0x0be3)", 0, HDAC_QUIRK_MSI }, + { HDA_NVIDIA_0BE4, "NVIDIA (0x0be4)", 0, HDAC_QUIRK_MSI }, { HDA_NVIDIA_GT100, "NVIDIA GT100", 0, HDAC_QUIRK_MSI }, { HDA_NVIDIA_GT104, "NVIDIA GT104", 0, HDAC_QUIRK_MSI }, { HDA_NVIDIA_GT106, "NVIDIA GT106", 0, HDAC_QUIRK_MSI }, @@ -154,12 +154,12 @@ static const struct { { HDA_SIS_966, "SiS 966", 0, 0 }, { HDA_ULI_M5461, "ULI M5461", 0, 0 }, /* Unknown */ - { HDA_INTEL_ALL, "Intel (Unknown)", 0, 0 }, - { HDA_NVIDIA_ALL, "NVIDIA (Unknown)", 0, 0 }, - { HDA_ATI_ALL, "ATI (Unknown)", 0, 0 }, - { HDA_VIA_ALL, "VIA (Unknown)", 0, 0 }, - { HDA_SIS_ALL, "SiS (Unknown)", 0, 0 }, - { HDA_ULI_ALL, "ULI (Unknown)", 0, 0 }, + { HDA_INTEL_ALL, "Intel", 0, 0 }, + { HDA_NVIDIA_ALL, "NVIDIA", 0, 0 }, + { HDA_ATI_ALL, "ATI", 0, 0 }, + { HDA_VIA_ALL, "VIA", 0, 0 }, + { HDA_SIS_ALL, "SiS", 0, 0 }, + { HDA_ULI_ALL, "ULI", 0, 0 }, }; #define HDAC_DEVICES_LEN (sizeof(hdac_devices) / sizeof(hdac_devices[0])) @@ -1017,26 +1017,27 @@ hdac_probe(device_t dev) result = ENXIO; for (i = 0; i < HDAC_DEVICES_LEN; i++) { if (hdac_devices[i].model == model) { - strlcpy(desc, hdac_devices[i].desc, sizeof(desc)); - result = BUS_PROBE_DEFAULT; + strlcpy(desc, hdac_devices[i].desc, sizeof(desc)); + result = BUS_PROBE_DEFAULT; break; } if (HDA_DEV_MATCH(hdac_devices[i].model, model) && class == PCIC_MULTIMEDIA && subclass == PCIS_MULTIMEDIA_HDA) { - strlcpy(desc, hdac_devices[i].desc, sizeof(desc)); - result = BUS_PROBE_GENERIC; + snprintf(desc, sizeof(desc), + "%s (0x%04x)", + hdac_devices[i].desc, pci_get_device(dev)); + result = BUS_PROBE_GENERIC; break; } } if (result == ENXIO && class == PCIC_MULTIMEDIA && subclass == PCIS_MULTIMEDIA_HDA) { - strlcpy(desc, "Generic", sizeof(desc)); - result = BUS_PROBE_GENERIC; + snprintf(desc, sizeof(desc), "Generic (0x%08x)", model); + result = BUS_PROBE_GENERIC; } if (result != ENXIO) { - strlcat(desc, " HDA Controller", - sizeof(desc)); + strlcat(desc, " HDA Controller", sizeof(desc)); device_set_desc_copy(dev, desc); } Modified: head/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdacc.c Thu Jan 19 09:51:07 2012 (r230330) +++ head/sys/dev/sound/pci/hda/hdacc.c Thu Jan 19 11:18:21 2012 (r230331) @@ -266,44 +266,22 @@ static const struct { { HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" }, { HDA_CODEC_SII1392, 0, "Silicon Image SiI1392" }, /* Unknown CODECs */ - { HDA_CODEC_ALCXXXX, 0, "Realtek (Unknown)" }, - { HDA_CODEC_ADXXXX, 0, "Analog Devices (Unknown)" }, - { HDA_CODEC_CSXXXX, 0, "Cirrus Logic (Unknown)" }, - { HDA_CODEC_CMIXXXX, 0, "CMedia (Unknown)" }, - { HDA_CODEC_STACXXXX, 0, "Sigmatel (Unknown)" }, - { HDA_CODEC_SIIXXXX, 0, "Silicon Image (Unknown)" }, - { HDA_CODEC_AGEREXXXX, 0, "Lucent/Agere Systems (Unknown)" }, - { HDA_CODEC_CXXXXX, 0, "Conexant (Unknown)" }, - { HDA_CODEC_VTXXXX, 0, "VIA (Unknown)" }, - { HDA_CODEC_ATIXXXX, 0, "ATI (Unknown)" }, - { HDA_CODEC_NVIDIAXXXX, 0, "NVIDIA (Unknown)" }, - { HDA_CODEC_INTELXXXX, 0, "Intel (Unknown)" }, - { HDA_CODEC_IDTXXXX, 0, "IDT (Unknown)" }, + { HDA_CODEC_ALCXXXX, 0, "Realtek" }, + { HDA_CODEC_ADXXXX, 0, "Analog Devices" }, + { HDA_CODEC_CSXXXX, 0, "Cirrus Logic" }, + { HDA_CODEC_CMIXXXX, 0, "CMedia" }, + { HDA_CODEC_STACXXXX, 0, "Sigmatel" }, + { HDA_CODEC_SIIXXXX, 0, "Silicon Image" }, + { HDA_CODEC_AGEREXXXX, 0, "Lucent/Agere Systems" }, + { HDA_CODEC_CXXXXX, 0, "Conexant" }, + { HDA_CODEC_VTXXXX, 0, "VIA" }, + { HDA_CODEC_ATIXXXX, 0, "ATI" }, + { HDA_CODEC_NVIDIAXXXX, 0, "NVIDIA" }, + { HDA_CODEC_INTELXXXX, 0, "Intel" }, + { HDA_CODEC_IDTXXXX, 0, "IDT" }, }; #define HDACC_CODECS_LEN (sizeof(hdacc_codecs) / sizeof(hdacc_codecs[0])) - -/**************************************************************************** - * Function prototypes - ****************************************************************************/ - -static char * -hdacc_codec_name(uint32_t id, uint16_t revid) -{ - int i; - - for (i = 0; i < HDACC_CODECS_LEN; i++) { - if (!HDA_DEV_MATCH(hdacc_codecs[i].id, id)) - continue; - if (hdacc_codecs[i].revid != 0 && - hdacc_codecs[i].revid != revid) - continue; - return (hdacc_codecs[i].name); - } - - return ((id == 0x00000000) ? "NULL CODEC" : "Unknown CODEC"); -} - static int hdacc_suspend(device_t dev) { @@ -337,10 +315,28 @@ hdacc_probe(device_t dev) { uint32_t id, revid; char buf[128]; + int i; id = ((uint32_t)hda_get_vendor_id(dev) << 16) + hda_get_device_id(dev); revid = ((uint32_t)hda_get_revision_id(dev) << 8) + hda_get_stepping_id(dev); - snprintf(buf, sizeof(buf), "%s HDA CODEC", hdacc_codec_name(id, revid)); + + for (i = 0; i < HDACC_CODECS_LEN; i++) { + if (!HDA_DEV_MATCH(hdacc_codecs[i].id, id)) + continue; + if (hdacc_codecs[i].revid != 0 && + hdacc_codecs[i].revid != revid) + continue; + break; + } + if (i < HDACC_CODECS_LEN) { + if ((hdacc_codecs[i].id & 0xffff) != 0xffff) + strlcpy(buf, hdacc_codecs[i].name, sizeof(buf)); + else + snprintf(buf, sizeof(buf), "%s (0x%04x)", + hdacc_codecs[i].name, hda_get_device_id(dev)); + } else + snprintf(buf, sizeof(buf), "Generic (0x%04x)", id); + strlcat(buf, " HDA CODEC", sizeof(buf)); device_set_desc_copy(dev, buf); return (BUS_PROBE_DEFAULT); }