From owner-svn-src-head@freebsd.org Thu Oct 1 16:55:01 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E657542D8DB; Thu, 1 Oct 2020 16:55:01 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C2K455phyz4PRV; Thu, 1 Oct 2020 16:55:01 +0000 (UTC) (envelope-from manu@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC16913D74; Thu, 1 Oct 2020 16:55:01 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 091Gt1he043295; Thu, 1 Oct 2020 16:55:01 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 091Gt1cR043294; Thu, 1 Oct 2020 16:55:01 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202010011655.091Gt1cR043294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 1 Oct 2020 16:55:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366330 - head/sys/dev/ichsmb X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/ichsmb X-SVN-Commit-Revision: 366330 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2020 16:55:02 -0000 Author: manu Date: Thu Oct 1 16:55:01 2020 New Revision: 366330 URL: https://svnweb.freebsd.org/changeset/base/366330 Log: ichsmb_pci: convert to pci_device_table / add PCI_PNP_INFO Submitted by: Greg V Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D25260 Modified: head/sys/dev/ichsmb/ichsmb_pci.c Modified: head/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- head/sys/dev/ichsmb/ichsmb_pci.c Thu Oct 1 16:53:16 2020 (r366329) +++ head/sys/dev/ichsmb/ichsmb_pci.c Thu Oct 1 16:55:01 2020 (r366330) @@ -106,51 +106,87 @@ __FBSDID("$FreeBSD$"); #define ID_KABYLAKE 0xa2a3 #define ID_CANNONLAKE 0xa323 -static const struct ichsmb_device { - uint16_t id; - const char *name; -} ichsmb_devices[] = { - { ID_82801AA, "Intel 82801AA (ICH) SMBus controller" }, - { ID_82801AB, "Intel 82801AB (ICH0) SMBus controller" }, - { ID_82801BA, "Intel 82801BA (ICH2) SMBus controller" }, - { ID_82801CA, "Intel 82801CA (ICH3) SMBus controller" }, - { ID_82801DC, "Intel 82801DC (ICH4) SMBus controller" }, - { ID_82801EB, "Intel 82801EB (ICH5) SMBus controller" }, - { ID_82801FB, "Intel 82801FB (ICH6) SMBus controller" }, - { ID_82801GB, "Intel 82801GB (ICH7) SMBus controller" }, - { ID_82801H, "Intel 82801H (ICH8) SMBus controller" }, - { ID_82801I, "Intel 82801I (ICH9) SMBus controller" }, - { ID_82801GB, "Intel 82801GB (ICH7) SMBus controller" }, - { ID_82801H, "Intel 82801H (ICH8) SMBus controller" }, - { ID_82801I, "Intel 82801I (ICH9) SMBus controller" }, - { ID_EP80579, "Intel EP80579 SMBus controller" }, - { ID_82801JI, "Intel 82801JI (ICH10) SMBus controller" }, - { ID_82801JD, "Intel 82801JD (ICH10) SMBus controller" }, - { ID_PCH, "Intel PCH SMBus controller" }, - { ID_6300ESB, "Intel 6300ESB (ICH) SMBus controller" }, - { ID_631xESB, "Intel 631xESB/6321ESB (ESB2) SMBus controller" }, - { ID_DH89XXCC, "Intel DH89xxCC SMBus controller" }, - { ID_PATSBURG, "Intel Patsburg SMBus controller" }, - { ID_CPT, "Intel Cougar Point SMBus controller" }, - { ID_PPT, "Intel Panther Point SMBus controller" }, - { ID_AVOTON, "Intel Avoton SMBus controller" }, - { ID_LPT, "Intel Lynx Point SMBus controller" }, - { ID_LPTLP, "Intel Lynx Point-LP SMBus controller" }, - { ID_WCPT, "Intel Wildcat Point SMBus controller" }, - { ID_WCPTLP, "Intel Wildcat Point-LP SMBus controller" }, - { ID_BAYTRAIL, "Intel Baytrail SMBus controller" }, - { ID_BRASWELL, "Intel Braswell SMBus controller" }, - { ID_COLETOCRK, "Intel Coleto Creek SMBus controller" }, - { ID_WELLSBURG, "Intel Wellsburg SMBus controller" }, - { ID_SRPT, "Intel Sunrise Point-H SMBus controller" }, - { ID_SRPTLP, "Intel Sunrise Point-LP SMBus controller" }, - { ID_DENVERTON, "Intel Denverton SMBus controller" }, - { ID_BROXTON, "Intel Broxton SMBus controller" }, - { ID_LEWISBURG, "Intel Lewisburg SMBus controller" }, - { ID_LEWISBURG2,"Intel Lewisburg SMBus controller" }, - { ID_KABYLAKE, "Intel Kaby Lake SMBus controller" }, - { ID_CANNONLAKE,"Intel Cannon Lake SMBus controller" }, - { 0, NULL }, +static const struct pci_device_table ichsmb_devices[] = { + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801AA), + PCI_DESCR("Intel 82801AA (ICH) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801AB), + PCI_DESCR("Intel 82801AB (ICH0) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801BA), + PCI_DESCR("Intel 82801BA (ICH2) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801CA), + PCI_DESCR("Intel 82801CA (ICH3) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801DC), + PCI_DESCR("Intel 82801DC (ICH4) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801EB), + PCI_DESCR("Intel 82801EB (ICH5) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801FB), + PCI_DESCR("Intel 82801FB (ICH6) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801GB), + PCI_DESCR("Intel 82801GB (ICH7) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801H), + PCI_DESCR("Intel 82801H (ICH8) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801I), + PCI_DESCR("Intel 82801I (ICH9) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801GB), + PCI_DESCR("Intel 82801GB (ICH7) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801H), + PCI_DESCR("Intel 82801H (ICH8) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801I), + PCI_DESCR("Intel 82801I (ICH9) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_EP80579), + PCI_DESCR("Intel EP80579 SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801JI), + PCI_DESCR("Intel 82801JI (ICH10) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_82801JD), + PCI_DESCR("Intel 82801JD (ICH10) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_PCH), + PCI_DESCR("Intel PCH SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_6300ESB), + PCI_DESCR("Intel 6300ESB (ICH) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_631xESB), + PCI_DESCR("Intel 631xESB/6321ESB (ESB2) SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_DH89XXCC), + PCI_DESCR("Intel DH89xxCC SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_PATSBURG), + PCI_DESCR("Intel Patsburg SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_CPT), + PCI_DESCR("Intel Cougar Point SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_PPT), + PCI_DESCR("Intel Panther Point SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_AVOTON), + PCI_DESCR("Intel Avoton SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_LPT), + PCI_DESCR("Intel Lynx Point SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_LPTLP), + PCI_DESCR("Intel Lynx Point-LP SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_WCPT), + PCI_DESCR("Intel Wildcat Point SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_WCPTLP), + PCI_DESCR("Intel Wildcat Point-LP SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_BAYTRAIL), + PCI_DESCR("Intel Baytrail SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_BRASWELL), + PCI_DESCR("Intel Braswell SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_COLETOCRK), + PCI_DESCR("Intel Coleto Creek SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_WELLSBURG), + PCI_DESCR("Intel Wellsburg SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_SRPT), + PCI_DESCR("Intel Sunrise Point-H SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_SRPTLP), + PCI_DESCR("Intel Sunrise Point-LP SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_DENVERTON), + PCI_DESCR("Intel Denverton SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_BROXTON), + PCI_DESCR("Intel Broxton SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_LEWISBURG), + PCI_DESCR("Intel Lewisburg SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_LEWISBURG2), + PCI_DESCR("Intel Lewisburg SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_KABYLAKE), + PCI_DESCR("Intel Kaby Lake SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_CANNONLAKE), + PCI_DESCR("Intel Cannon Lake SMBus controller") }, }; /* Internal functions */ @@ -197,19 +233,14 @@ DRIVER_MODULE(ichsmb, pci, ichsmb_pci_driver, ichsmb_p static int ichsmb_pci_probe(device_t dev) { - const struct ichsmb_device *device; + const struct pci_device_table *tbl; - if (pci_get_vendor(dev) != PCI_VENDOR_INTEL) + tbl = PCI_MATCH(dev, ichsmb_devices); + if (tbl == NULL) return (ENXIO); - for (device = ichsmb_devices; device->name != NULL; device++) { - if (pci_get_device(dev) == device->id) { - device_set_desc(dev, device->name); - return (ichsmb_probe(dev)); - } - } - - return (ENXIO); + device_set_desc(dev, tbl->descr); + return (ichsmb_probe(dev)); } static int @@ -265,3 +296,4 @@ fail: MODULE_DEPEND(ichsmb, pci, 1, 1, 1); MODULE_DEPEND(ichsmb, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER); MODULE_VERSION(ichsmb, 1); +PCI_PNP_INFO(ichsmb_devices);