Update AMDSMB to use PCI_MATCH

Differential Review: https://reviews.freebsd.org/D16172
This commit is contained in:
Warner Losh 2018-07-07 15:55:52 +00:00
parent 4d711ae269
commit 69c173e23f
2 changed files with 19 additions and 13 deletions

View File

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

View File

@ -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 <bsd.kmod.mk>