From owner-svn-src-head@freebsd.org Sat Jul 7 15:55:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A706A102E861; Sat, 7 Jul 2018 15:55:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C35A7DCFE; Sat, 7 Jul 2018 15:55:53 +0000 (UTC) (envelope-from imp@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 3D2B5197B0; Sat, 7 Jul 2018 15:55:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w67Ftr3h004958; Sat, 7 Jul 2018 15:55:53 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w67FtqrL004956; Sat, 7 Jul 2018 15:55:52 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807071555.w67FtqrL004956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 7 Jul 2018 15:55:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336068 - in head/sys: dev/amdsmb modules/amdsmb X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: dev/amdsmb modules/amdsmb X-SVN-Commit-Revision: 336068 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.27 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: Sat, 07 Jul 2018 15:55:53 -0000 Author: imp Date: Sat Jul 7 15:55:52 2018 New Revision: 336068 URL: https://svnweb.freebsd.org/changeset/base/336068 Log: Update AMDSMB to use PCI_MATCH Differential Review: https://reviews.freebsd.org/D16172 Added: head/sys/modules/amdsmb/ head/sys/modules/amdsmb/Makefile (contents, props changed) Modified: head/sys/dev/amdsmb/amdsmb.c Modified: head/sys/dev/amdsmb/amdsmb.c ============================================================================== --- head/sys/dev/amdsmb/amdsmb.c Sat Jul 7 15:25:16 2018 (r336067) +++ head/sys/dev/amdsmb/amdsmb.c Sat Jul 7 15:55:52 2018 (r336068) @@ -125,24 +125,22 @@ struct amdsmb_softc { static int amdsmb_detach(device_t dev); +struct pci_device_table amdsmb_devs[] = { + { PCI_DEV(AMDSMB_VENDORID_AMD, AMDSMB_DEVICEID_AMD8111_SMB2), + PCI_DESCR("AMD-8111 SMBus 2.0 Controller") } +}; + static int amdsmb_probe(device_t dev) { - u_int16_t vid; - u_int16_t did; + const struct pci_device_table *tbl; - vid = pci_get_vendor(dev); - did = pci_get_device(dev); + tbl = PCI_MATCH(dev, amdsmb_devs); + if (tbl == NULL) + return (ENXIO); + device_set_desc(dev, tbl->descr); - if (vid == AMDSMB_VENDORID_AMD) { - switch(did) { - case AMDSMB_DEVICEID_AMD8111_SMB2: - device_set_desc(dev, "AMD-8111 SMBus 2.0 Controller"); - return (BUS_PROBE_DEFAULT); - } - } - - return (ENXIO); + return (BUS_PROBE_DEFAULT); } static int Added: head/sys/modules/amdsmb/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/amdsmb/Makefile Sat Jul 7 15:55:52 2018 (r336068) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/amdsmb + +KMOD= amdsmb +SRCS= amdsmb.c bus_if.h device_if.h pci_if.h smbus_if.h + +.include