Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PNP info to PCI attachment of alc, amdsmb, bfe, bge, ce, ciss, cp, dc, dpt drivers #4

Merged
merged 9 commits into from
Jul 8, 2018
2 changes: 2 additions & 0 deletions sys/dev/alc/if_alc.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ static driver_t alc_driver = {
static devclass_t alc_devclass;

DRIVER_MODULE(alc, pci, alc_driver, alc_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device", pci, alc, alc_ident_table,
sizeof(alc_ident_table[0]), nitems(alc_ident_table) - 1);
DRIVER_MODULE(miibus, alc, miibus_driver, miibus_devclass, 0, 0);

static struct resource_spec alc_res_spec_mem[] = {
Expand Down
26 changes: 12 additions & 14 deletions sys/dev/amdsmb/amdsmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,21 @@ 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);

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);
tbl = PCI_MATCH(dev, amdsmb_devs);
if (tbl == NULL)
return (ENXIO);
device_set_desc(dev, tbl->descr);
return (BUS_PROBE_DEFAULT);
}

static int
Expand Down Expand Up @@ -578,6 +575,7 @@ static driver_t amdsmb_driver = {
};

DRIVER_MODULE(amdsmb, pci, amdsmb_driver, amdsmb_devclass, 0, 0);
PCI_PNP_INFO(amdsmb_devs);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like it's missing the other amdsmb changes needed. there's no amdsmb_devs here yet.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it now. Thought the other part was already in the base.

DRIVER_MODULE(smbus, amdsmb, smbus_driver, smbus_devclass, 0, 0);

MODULE_DEPEND(amdsmb, pci, 1, 1, 1);
Expand Down
2 changes: 2 additions & 0 deletions sys/dev/bfe/if_bfe.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ static driver_t bfe_driver = {
static devclass_t bfe_devclass;

DRIVER_MODULE(bfe, pci, bfe_driver, bfe_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, bfe, bfe_devs,
sizeof(bfe_devs[0]), nitems(bfe_devs) - 1);
DRIVER_MODULE(miibus, bfe, miibus_driver, miibus_devclass, 0, 0);

/*
Expand Down
2 changes: 2 additions & 0 deletions sys/dev/bge/if_bge.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,8 @@ static driver_t bge_driver = {
static devclass_t bge_devclass;

DRIVER_MODULE(bge, pci, bge_driver, bge_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device", pci, bge, bge_devs,
sizeof(bge_devs), nitems(bge_devs) - 1);
DRIVER_MODULE(miibus, bge, miibus_driver, miibus_devclass, 0, 0);

static int bge_allow_asf = 1;
Expand Down
29 changes: 16 additions & 13 deletions sys/dev/ce/if_ce.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ static device_method_t ce_methods[] = {
DEVMETHOD_END
};

struct pci_device_table ce_devs[] = {
{PCI_DEV(TAU32_PCI_VENDOR_ID, TAU32_PCI_DEVICE_ID),
PCI_DESCR("Cronyx-Tau32-PCI serial adapter")}
};

typedef struct _ce_dma_mem_t {
unsigned long phys;
void *virt;
Expand Down Expand Up @@ -313,12 +318,13 @@ static struct mbuf *makembuf (void *buf, unsigned len)

static int ce_probe (device_t dev)
{
if ((pci_get_vendor (dev) == TAU32_PCI_VENDOR_ID) &&
(pci_get_device (dev) == TAU32_PCI_DEVICE_ID)) {
device_set_desc (dev, "Cronyx-Tau32-PCI serial adapter");
return BUS_PROBE_DEFAULT;
}
return ENXIO;
const struct pci_device_table *ced;

ced = PCI_MATCH(dev, ce_devs);
if (ced == NULL)
return ENXIO;
device_set_desc(dev, ced->description);
return BUS_PROBE_DEFAULT;
}

static void ce_timeout (void *arg)
Expand Down Expand Up @@ -2630,14 +2636,11 @@ MODULE_DEPEND (ce, sppp, 1, 1, 1);
#endif
#ifdef KLD_MODULE
DRIVER_MODULE (cemod, pci, ce_driver, ce_devclass, ce_modevent, NULL);
MODULE_PNP_INFO("U16:vendor; U16:device;D:#", pci, cemod, ce_devs,
sizeof(ce_devs[0]), nitems(ce_devs));
#else
DRIVER_MODULE (ce, pci, ce_driver, ce_devclass, ce_modevent, NULL);
MODULE_PNP_INFO("U16:vendor; U16:device;D:#", pci, ce, ce_devs,
sizeof(ce_devs[0]), nitems(ce_devs));
#endif
#else /* if __FreeBSD_version < 500000*/
#ifdef NETGRAPH
DRIVER_MODULE (ce, pci, ce_driver, ce_devclass, ng_mod_event, &typestruct);
#else
DRIVER_MODULE (ce, pci, ce_driver, ce_devclass, ce_modevent, NULL);
#endif
#endif /* __FreeBSD_version < 500000 */
#endif /* NPCI */
13 changes: 8 additions & 5 deletions sys/dev/ciss/ciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,6 @@ static driver_t ciss_pci_driver = {
sizeof(struct ciss_softc)
};

static devclass_t ciss_devclass;
DRIVER_MODULE(ciss, pci, ciss_pci_driver, ciss_devclass, 0, 0);
MODULE_DEPEND(ciss, cam, 1, 1, 1);
MODULE_DEPEND(ciss, pci, 1, 1, 1);

/*
* Control device interface.
*/
Expand Down Expand Up @@ -271,6 +266,7 @@ TUNABLE_INT("hw.ciss.force_transport", &ciss_force_transport);
static int ciss_force_interrupt = 0;
TUNABLE_INT("hw.ciss.force_interrupt", &ciss_force_interrupt);


/************************************************************************
* CISS adapters amazingly don't have a defined programming interface
* value. (One could say some very despairing things about PCI and
Expand Down Expand Up @@ -366,6 +362,13 @@ static struct
{ 0, 0, 0, NULL }
};

static devclass_t ciss_devclass;
DRIVER_MODULE(ciss, pci, ciss_pci_driver, ciss_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, ciss, ciss_vendor_data,
sizeof(ciss_vendor_data[0]), nitems(ciss_vendor_data) - 1);
MODULE_DEPEND(ciss, cam, 1, 1, 1);
MODULE_DEPEND(ciss, pci, 1, 1, 1);

/************************************************************************
* Find a match for the device in our list of known adapters.
*/
Expand Down
19 changes: 13 additions & 6 deletions sys/dev/cp/if_cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ static int cp_probe __P((device_t));
static int cp_attach __P((device_t));
static int cp_detach __P((device_t));

struct pci_device_table cp_devs[] = {
{PCI_DEV(cp_vendor_id, cp_device_id),
PCI_DESCR("Cronyx-Tau-PCI serial adapter")},
};

static device_method_t cp_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, cp_probe),
Expand Down Expand Up @@ -201,12 +206,13 @@ static struct mbuf *makembuf (void *buf, unsigned len)

static int cp_probe (device_t dev)
{
if ((pci_get_vendor (dev) == cp_vendor_id) &&
(pci_get_device (dev) == cp_device_id)) {
device_set_desc (dev, "Cronyx-Tau-PCI serial adapter");
return BUS_PROBE_DEFAULT;
}
return ENXIO;
const struct pci_device_table *cpd;

cpd = PCI_MATCH(dev, cp_devs);
if (cpd == NULL)
return ENXIO;
device_set_desc(dev, cpd->description);
return BUS_PROBE_DEFAULT;
}

static void cp_timeout (void *arg)
Expand Down Expand Up @@ -2266,4 +2272,5 @@ MODULE_DEPEND (ng_cp, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION);
MODULE_DEPEND (cp, sppp, 1, 1, 1);
#endif
DRIVER_MODULE (cp, pci, cp_driver, cp_devclass, cp_modevent, NULL);
PCI_PNP_INFO(cp_devs);
MODULE_VERSION (cp, 1);
2 changes: 2 additions & 0 deletions sys/dev/dc/if_dc.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ static devclass_t dc_devclass;

DRIVER_MODULE_ORDERED(dc, pci, dc_driver, dc_devclass, NULL, NULL,
SI_ORDER_ANY);
MODULE_PNP_INFO("W32:vendor/device;U8:revision;D:#", pci, dc, dc_devs,
sizeof(dc_devs[0]), nitems(dc_devs) - 1);
DRIVER_MODULE(miibus, dc, miibus_driver, miibus_devclass, NULL, NULL);

#define DC_SETBIT(sc, reg, x) \
Expand Down
19 changes: 13 additions & 6 deletions sys/dev/dpt/dpt_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,21 @@ __FBSDID("$FreeBSD$");
static int dpt_pci_probe (device_t);
static int dpt_pci_attach (device_t);

struct pci_device_table dpt_devs[] = {
{PCI_DEV(DPT_VENDOR_ID, DPT_DEVICE_ID),
PCI_DESCR("DPT Caching SCSI RAID Controller")},
};

static int
dpt_pci_probe (device_t dev)
{
if ((pci_get_vendor(dev) == DPT_VENDOR_ID) &&
(pci_get_device(dev) == DPT_DEVICE_ID)) {
device_set_desc(dev, "DPT Caching SCSI RAID Controller");
return (BUS_PROBE_DEFAULT);
}
return (ENXIO);
const struct pci_device_table *dpd;

dpd = PCI_MATCH(dev, dpt_devs);
if (dpd == NULL)
return (ENXIO);
device_set_desc(dev, dpd->description);
return (BUS_PROBE_DEFAULT);
}

static int
Expand Down Expand Up @@ -185,5 +191,6 @@ static driver_t dpt_pci_driver = {
};

DRIVER_MODULE(dpt, pci, dpt_pci_driver, dpt_devclass, 0, 0);
PCI_PNP_INFO(dpt_devs);
MODULE_DEPEND(dpt, pci, 1, 1, 1);
MODULE_DEPEND(dpt, cam, 1, 1, 1);