Add PNP metadata to a few drivers

An eventual devd(8) or other component should be able to scan buses and
automatically load drivers that match device ids described in this metadata.

Reviewed by:	imp
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12364
This commit is contained in:
Conrad Meyer 2017-09-14 15:34:45 +00:00
parent 8df419f2df
commit a64bf59c49
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323586
5 changed files with 42 additions and 33 deletions

View File

@ -89,6 +89,8 @@ static driver_t amdsmn_driver = {
static devclass_t amdsmn_devclass;
DRIVER_MODULE(amdsmn, hostb, amdsmn_driver, amdsmn_devclass, NULL, NULL);
MODULE_VERSION(amdsmn, 1);
MODULE_PNP_INFO("W32:vendor/device", pci, amdsmn, amdsmn_ids,
sizeof(amdsmn_ids[0]), nitems(amdsmn_ids));
static bool
amdsmn_match(device_t parent)

View File

@ -100,7 +100,6 @@ static struct amdtemp_product {
{ VENDORID_AMD, DEVICEID_AMD_MISC16_M30H },
{ VENDORID_AMD, DEVICEID_AMD_MISC17 },
{ VENDORID_AMD, DEVICEID_AMD_HOSTB17H },
{ 0, 0 }
};
/*
@ -165,6 +164,8 @@ static devclass_t amdtemp_devclass;
DRIVER_MODULE(amdtemp, hostb, amdtemp_driver, amdtemp_devclass, NULL, NULL);
MODULE_VERSION(amdtemp, 1);
MODULE_DEPEND(amdtemp, amdsmn, 1, 1, 1);
MODULE_PNP_INFO("U16:vendor;U16:device", pci, amdtemp, amdtemp_products,
sizeof(amdtemp_products[0]), nitems(amdtemp_products));
static int
amdtemp_match(device_t dev)
@ -175,7 +176,7 @@ amdtemp_match(device_t dev)
vendor = pci_get_vendor(dev);
devid = pci_get_device(dev);
for (i = 0; amdtemp_products[i].amdtemp_vendorid != 0; i++) {
for (i = 0; i < nitems(amdtemp_products); i++) {
if (vendor == amdtemp_products[i].amdtemp_vendorid &&
devid == amdtemp_products[i].amdtemp_deviceid)
return (1);

View File

@ -88,34 +88,38 @@ static int intsmb_stop_poll(struct intsmb_softc *sc);
static int intsmb_free(struct intsmb_softc *sc);
static void intsmb_rawintr(void *arg);
const struct intsmb_device {
uint32_t devid;
const char *description;
} intsmb_products[] = {
{ 0x71138086, "Intel PIIX4 SMBUS Interface" },
{ 0x719b8086, "Intel PIIX4 SMBUS Interface" },
#if 0
/* Not a good idea yet, this stops isab0 functioning */
{ 0x02001166, "ServerWorks OSB4" },
#endif
{ 0x43721002, "ATI IXP400 SMBus Controller" },
{ AMDSB_SMBUS_DEVID, "AMD SB600/7xx/8xx/9xx SMBus Controller" },
{ AMDFCH_SMBUS_DEVID, "AMD FCH SMBus Controller" },
{ AMDCZ_SMBUS_DEVID, "AMD FCH SMBus Controller" },
};
static int
intsmb_probe(device_t dev)
{
const struct intsmb_device *isd;
uint32_t devid;
size_t i;
switch (pci_get_devid(dev)) {
case 0x71138086: /* Intel 82371AB */
case 0x719b8086: /* Intel 82443MX */
#if 0
/* Not a good idea yet, this stops isab0 functioning */
case 0x02001166: /* ServerWorks OSB4 */
#endif
device_set_desc(dev, "Intel PIIX4 SMBUS Interface");
break;
case 0x43721002:
device_set_desc(dev, "ATI IXP400 SMBus Controller");
break;
case AMDSB_SMBUS_DEVID:
device_set_desc(dev, "AMD SB600/7xx/8xx/9xx SMBus Controller");
break;
case AMDFCH_SMBUS_DEVID: /* AMD FCH */
case AMDCZ_SMBUS_DEVID: /* AMD Carizzo FCH */
device_set_desc(dev, "AMD FCH SMBus Controller");
break;
default:
return (ENXIO);
devid = pci_get_devid(dev);
for (i = 0; i < nitems(intsmb_products); i++) {
isd = &intsmb_products[i];
if (isd->devid == devid) {
device_set_desc(dev, isd->description);
return (BUS_PROBE_DEFAULT);
}
}
return (BUS_PROBE_DEFAULT);
return (ENXIO);
}
static uint8_t
@ -891,3 +895,5 @@ DRIVER_MODULE_ORDERED(intsmb, pci, intsmb_driver, intsmb_devclass, 0, 0,
DRIVER_MODULE(smbus, intsmb, smbus_driver, smbus_devclass, 0, 0);
MODULE_DEPEND(intsmb, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER);
MODULE_VERSION(intsmb, 1);
MODULE_PNP_INFO("W32:vendor/device;D:human", pci, intpm, intsmb_products,
sizeof(intsmb_products[0]), nitems(intsmb_products));

View File

@ -236,10 +236,11 @@ static struct _pcsid
{ 0x6f278086, "BDX IOAT Ch7" },
{ 0x6f2e8086, "BDX IOAT Ch0 (RAID)" },
{ 0x6f2f8086, "BDX IOAT Ch1 (RAID)" },
{ 0x00000000, NULL }
};
MODULE_PNP_INFO("W32:vendor/device;D:human", pci, ioat, pci_ids,
sizeof(pci_ids[0]), nitems(pci_ids));
/*
* OS <-> Driver linkage functions
*/
@ -250,7 +251,7 @@ ioat_probe(device_t device)
u_int32_t type;
type = pci_get_devid(device);
for (ep = pci_ids; ep->type; ep++) {
for (ep = pci_ids; ep < &pci_ids[nitems(pci_ids)]; ep++) {
if (ep->type == type) {
device_set_desc(device, ep->desc);
return (0);

View File

@ -495,8 +495,6 @@ static struct ntb_hw_info pci_ids[] = {
{ 0x6F0D8086, "BDX Xeon E5 V4 Non-Transparent Bridge B2B", NTB_XEON,
NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 |
NTB_SB01BASE_LOCKUP },
{ 0x00000000, NULL, NTB_ATOM, 0 }
};
static const struct ntb_reg atom_reg = {
@ -1390,12 +1388,11 @@ intel_ntb_get_msix_info(struct ntb_softc *ntb)
static struct ntb_hw_info *
intel_ntb_get_device_info(uint32_t device_id)
{
struct ntb_hw_info *ep = pci_ids;
struct ntb_hw_info *ep;
while (ep->device_id) {
for (ep = pci_ids; ep < &pci_ids[nitems(pci_ids)]; ep++) {
if (ep->device_id == device_id)
return (ep);
++ep;
}
return (NULL);
}
@ -3122,3 +3119,5 @@ static DEFINE_CLASS_0(ntb_hw, ntb_intel_driver, ntb_intel_methods,
DRIVER_MODULE(ntb_hw_intel, pci, ntb_intel_driver, ntb_hw_devclass, NULL, NULL);
MODULE_DEPEND(ntb_hw_intel, ntb, 1, 1, 1);
MODULE_VERSION(ntb_hw_intel, 1);
MODULE_PNP_INFO("W32:vendor/device;D:human", pci, ntb_hw_intel, pci_ids,
sizeof(pci_ids[0]), nitems(pci_ids));