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 attachments of LE, LIO, MPR, MVS, MY, MLY, MPS, MSKC, MN, MRSAS, MXGE drivers #11

Merged
merged 12 commits into from
Aug 13, 2018
Merged
27 changes: 13 additions & 14 deletions sys/dev/le/if_le_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ static device_detach_t le_pci_detach;
static device_resume_t le_pci_resume;
static device_suspend_t le_pci_suspend;

struct pci_device_table le_devs[] = {
{PCI_DEV(AMD_VENDOR, AMD_PCNET_PCI),
PCI_DESCR("AMD PCnet-PCI")},
{PCI_DEV(AMD_VENDOR, AMD_PCNET_HOME),
PCI_DESCR("AMD PCnet-Home")}
};

static device_method_t le_pci_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, le_pci_probe),
Expand All @@ -137,6 +144,7 @@ static device_method_t le_pci_methods[] = {

DEFINE_CLASS_0(le, le_pci_driver, le_pci_methods, sizeof(struct le_pci_softc));
DRIVER_MODULE(le, pci, le_pci_driver, le_devclass, 0, 0);
PCI_PNP_INFO(le_devs);
MODULE_DEPEND(le, ether, 1, 1, 1);

static const int le_home_supmedia[] = {
Expand Down Expand Up @@ -276,22 +284,13 @@ le_pci_dma_callback(void *xsc, bus_dma_segment_t *segs, int nsegs, int error)
static int
le_pci_probe(device_t dev)
{
const struct pci_device_table *led;

if (pci_get_vendor(dev) != AMD_VENDOR)
return (ENXIO);

switch (pci_get_device(dev)) {
case AMD_PCNET_PCI:
device_set_desc(dev, "AMD PCnet-PCI");
/* Let pcn(4) win. */
return (BUS_PROBE_LOW_PRIORITY);
case AMD_PCNET_HOME:
device_set_desc(dev, "AMD PCnet-Home");
/* Let pcn(4) win. */
return (BUS_PROBE_LOW_PRIORITY);
default:
led = PCI_MATCH(dev, le_devs);
if (led == NULL)
return (ENXIO);
}
device_set_desc(dev, led->descr);
return (BUS_PROBE_LOW_PRIORITY);
}

static int
Expand Down
71 changes: 29 additions & 42 deletions sys/dev/liquidio/lio_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,28 +145,36 @@ struct lio_vendor_info {
uint8_t index;
};

static struct lio_vendor_info lio_pci_tbl[] = {
struct pci_device_table lio_pci_tbl[] = {
/* CN2350 10G */
{PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_PF_VID, LIO_CN2350_10G_SUBDEVICE,
0x02, 0},
{PCI_DEV(PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_PF_VID),
PCI_SUBDEVCE(LIO_CN2350_10G_SUBDEVICE),
PCI_REVID(0x02), .driver_data (0),
PCI_DESCR("LiquidIO 2350 10GbE Server Adapter")},

/* CN2350 10G */
{PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_PF_VID, LIO_CN2350_10G_SUBDEVICE1,
0x02, 0},
{PCI_DEV(PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_PF_VID),
PCI_SUBDEVICE(LIO_CN2350_10G_SUBDEVICE1),
PCI_REVID(0x02), .driver_data (0),
PCI_DESCR("LiquidIO 2350 10GbE Server Adapter")},

/* CN2360 10G */
{PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_PF_VID, LIO_CN2360_10G_SUBDEVICE,
0x02, 1},
{PCI_DEV(PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_PF_VID),
PCI_SUBDEVICE(LIO_CN2360_10G_SUBDEVICE),
PCI_REVID(0x02), .driver_data (1),
PCI_DESCR("LiquidIO 2360 10GbE Server Adapter")},

/* CN2350 25G */
{PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_PF_VID, LIO_CN2350_25G_SUBDEVICE,
0x02, 2},
{PCI_DEV(PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_PF_VID),
PCI_SUBDEVICE(LIO_CN2350_25G_SUBDEVICE),
PCI_REVID(0x02), .driver_data (2),
PCI_DESCR("LiquidIO 2350 25GbE Server Adapter")},

/* CN2360 25G */
{PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_PF_VID, LIO_CN2360_25G_SUBDEVICE,
0x02, 3},

{0, 0, 0, 0, 0}
{PCI_DEV(PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_PF_VID),
PCI_SUBDEVICE(LIO_CN2360_25G_SUBDEVICE),
PCI_REVID(0x02), .driver_data (3),
PCI_DESCR("LiquidIO 2360 25GbE Server Adapter")}
};

static char *lio_strings[] = {
Expand Down Expand Up @@ -195,38 +203,16 @@ struct lio_rx_ctl_context {
static int
lio_probe(device_t dev)
{
struct lio_vendor_info *tbl;

uint16_t vendor_id;
uint16_t device_id;
uint16_t subdevice_id;
uint8_t revision_id;
const struct pci_device_table *liod;
char device_ver[256];

vendor_id = pci_get_vendor(dev);
if (vendor_id != PCI_VENDOR_ID_CAVIUM)
liod = PCI_MATCH(dev, lio_pci_tbl);
if (liod == NULL)
return (ENXIO);

device_id = pci_get_device(dev);
subdevice_id = pci_get_subdevice(dev);
revision_id = pci_get_revid(dev);

tbl = lio_pci_tbl;
while (tbl->vendor_id) {
if ((vendor_id == tbl->vendor_id) &&
(device_id == tbl->device_id) &&
(subdevice_id == tbl->subdevice_id) &&
(revision_id == tbl->revision_id)) {
sprintf(device_ver, "%s, Version - %s",
lio_strings[tbl->index], LIO_VERSION);
device_set_desc_copy(dev, device_ver);
return (BUS_PROBE_DEFAULT);
}

tbl++;
}

return (ENXIO);
sprintf(device_ver, "%s, Version - %s",
lio_strings[liod->driver_data], LIO_VERSION);
device_set_desc_copy(dev, device_ver);
return (BUS_PROBE_DEFAULT);
}

static int
Expand Down Expand Up @@ -414,6 +400,7 @@ static driver_t lio_driver = {

devclass_t lio_devclass;
DRIVER_MODULE(lio, pci, lio_driver, lio_devclass, lio_event, 0);
PCI_PNP_INFO(lio_pci_tbl);

MODULE_DEPEND(lio, pci, 1, 1, 1);
MODULE_DEPEND(lio, ether, 1, 1, 1);
Expand Down
13 changes: 9 additions & 4 deletions sys/dev/mly/mly.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,6 @@ static driver_t mly_pci_driver = {
sizeof(struct mly_softc)
};

static devclass_t mly_devclass;
DRIVER_MODULE(mly, pci, mly_pci_driver, mly_devclass, 0, 0);
MODULE_DEPEND(mly, pci, 1, 1, 1);
MODULE_DEPEND(mly, cam, 1, 1, 1);

static struct cdevsw mly_cdevsw = {
.d_version = D_VERSION,
Expand Down Expand Up @@ -183,6 +179,15 @@ static struct mly_ident
{0, 0, 0, 0, 0, 0}
};


static devclass_t mly_devclass;
DRIVER_MODULE(mly, pci, mly_pci_driver, mly_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;U16:subvendor;U16:subdevice", pci, mly,
mly_identifiers, sizeof(mly_identifiers[0]), nitems(mly_identifiers) - 1);
MODULE_DEPEND(mly, pci, 1, 1, 1);
MODULE_DEPEND(mly, cam, 1, 1, 1);


/********************************************************************************
* Compare the provided PCI device with the list we support.
*/
Expand Down
17 changes: 13 additions & 4 deletions sys/dev/mn/if_mn.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ SYSCTL_INT(_debug, OID_AUTO, mn_maxlatency, CTLFLAG_RW,
#define NMN 4
#endif

#define SIEMENS_VENDOR_ID 0x110a

/* From: PEB 20321 data sheet, p187, table 22 */
struct m32xreg {
u_int32_t conf, cmd, stat, imask;
Expand Down Expand Up @@ -190,6 +192,11 @@ static ng_connect_t ngmn_connect;
static ng_rcvdata_t ngmn_rcvdata;
static ng_disconnect_t ngmn_disconnect;

struct pci_device_table mn_devs[] = {
{PCI_DEV(SIEMENS_VENDOR_ID, 0x2101),
PCI_DESCR("Munich32X E1/T1 HDLC Controller")}
};

static struct ng_type mntypestruct = {
.version = NG_ABI_VERSION,
.name = NG_MN_NODE_TYPE,
Expand Down Expand Up @@ -1262,7 +1269,7 @@ mn_intr(void *xsc)
static int
mn_probe (device_t self)
{
u_int id = pci_get_devid(self);
const struct pci_device_table *mnd;

if (sizeof (struct m32xreg) != 256) {
printf("MN: sizeof(struct m32xreg) = %zd, should have been 256\n", sizeof (struct m32xreg));
Expand All @@ -1277,10 +1284,10 @@ mn_probe (device_t self)
return (ENXIO);
}

if (id != 0x2101110a)
mnd = PCI_MATCH(self, mn_devs);
if (mnd == NULL)
return (ENXIO);

device_set_desc_copy(self, "Munich32X E1/T1 HDLC Controller");
device_set_desc_copy(self, mnd->descr);
return (BUS_PROBE_DEFAULT);
}

Expand Down Expand Up @@ -1431,3 +1438,5 @@ static driver_t mn_driver = {
static devclass_t mn_devclass;

DRIVER_MODULE(mn, pci, mn_driver, mn_devclass, 0, 0);
PCI_PNP_INFO(mn_devs);

11 changes: 8 additions & 3 deletions sys/dev/mpr/mpr_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ static driver_t mpr_pci_driver = {
sizeof(struct mpr_softc)
};

static devclass_t mpr_devclass;
DRIVER_MODULE(mpr, pci, mpr_pci_driver, mpr_devclass, 0, 0);
MODULE_DEPEND(mpr, cam, 1, 1, 1);

struct mpr_ident {
uint16_t vendor;
Expand Down Expand Up @@ -154,6 +151,14 @@ struct mpr_ident {
{ 0, 0, 0, 0, 0, NULL }
};


static devclass_t mpr_devclass;
DRIVER_MODULE(mpr, pci, mpr_pci_driver, mpr_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;U16:subvendor;U16:subdevice;D:#", pci, mpr,
mpr_identifiers, sizeof(mpr_identifiers[0]), nitems(mpr_identifiers) - 1);

MODULE_DEPEND(mpr, cam, 1, 1, 1);

static struct mpr_ident *
mpr_find_ident(device_t dev)
{
Expand Down
8 changes: 4 additions & 4 deletions sys/dev/mps/mps_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ static driver_t mps_pci_driver = {
sizeof(struct mps_softc)
};

static devclass_t mps_devclass;
DRIVER_MODULE(mps, pci, mps_pci_driver, mps_devclass, 0, 0);
MODULE_DEPEND(mps, cam, 1, 1, 1);

struct mps_ident {
uint16_t vendor;
uint16_t device;
Expand Down Expand Up @@ -147,6 +143,10 @@ struct mps_ident {
{ 0, 0, 0, 0, 0, NULL }
};

static devclass_t mps_devclass;
DRIVER_MODULE(mps, pci, mps_pci_driver, mps_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;U16:subvendor;U16:subdevice", pci, mps,
mps_identifiers, sizeof(mps_identifiers[0]), nitems(mps_identifiers) - 1);
static struct mps_ident *
mps_find_ident(device_t dev)
{
Expand Down
74 changes: 28 additions & 46 deletions sys/dev/mrsas/mrsas.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ static d_poll_t mrsas_poll;

static void mrsas_ich_startup(void *arg);
static struct mrsas_mgmt_info mrsas_mgmt_info;
static struct mrsas_ident *mrsas_find_ident(device_t);
static int mrsas_setup_msix(struct mrsas_softc *sc);
static int mrsas_allocate_msix(struct mrsas_softc *sc);
static void mrsas_shutdown_ctlr(struct mrsas_softc *sc, u_int32_t opcode);
Expand Down Expand Up @@ -174,23 +173,21 @@ SYSCTL_NODE(_hw, OID_AUTO, mrsas, CTLFLAG_RD, 0, "MRSAS Driver Parameters");
* PCI device struct and table
*
*/
typedef struct mrsas_ident {
uint16_t vendor;
uint16_t device;
uint16_t subvendor;
uint16_t subdevice;
const char *desc;
} MRSAS_CTLR_ID;

MRSAS_CTLR_ID device_table[] = {
{0x1000, MRSAS_TBOLT, 0xffff, 0xffff, "AVAGO Thunderbolt SAS Controller"},
{0x1000, MRSAS_INVADER, 0xffff, 0xffff, "AVAGO Invader SAS Controller"},
{0x1000, MRSAS_FURY, 0xffff, 0xffff, "AVAGO Fury SAS Controller"},
{0x1000, MRSAS_INTRUDER, 0xffff, 0xffff, "AVAGO Intruder SAS Controller"},
{0x1000, MRSAS_INTRUDER_24, 0xffff, 0xffff, "AVAGO Intruder_24 SAS Controller"},
{0x1000, MRSAS_CUTLASS_52, 0xffff, 0xffff, "AVAGO Cutlass_52 SAS Controller"},
{0x1000, MRSAS_CUTLASS_53, 0xffff, 0xffff, "AVAGO Cutlass_53 SAS Controller"},
{0, 0, 0, 0, NULL}
struct pci_device_table mrsas_devs[] = {
{PCI_DEV(0x1000, MRSAS_TBOLT), PCI_SUBDEV(0xffff, 0xffff),
PCI_DESCR("AVAGO Thunderbolt SAS Controller")},
{PCI_DEV(0x1000, MRSAS_INVADER), PCI_SUBDEV(0xffff, 0xffff),
PCI_DESCR("AVAGO Invader SAS Controller")},
{PCI_DEV(0x1000, MRSAS_FURY), PCI_SUBDEV(0xffff, 0xffff),
PCI_DESCR("AVAGO Fury SAS Controller")},
{PCI_DEV(0x1000, MRSAS_INTRUDER), PCI_SUBDEV(0xffff, 0xffff),
PCI_DESCR("AVAGO Intruder SAS Controller")},
{PCI_DEV(0x1000, MRSAS_INTRUDER_24), PCI_SUBDEV(0xffff, 0xffff),
PCI_DESCR("AVAGO Intruder_24 SAS Controller")},
{PCI_DEV(0x1000, MRSAS_CUTLASS_52), PCI_SUBDEV(0xffff, 0xffff),
PCI_DESCR("AVAGO Cutlass_52 SAS Controller")},
{PCI_DEV(0x1000, MRSAS_CUTLASS_53), PCI_SUBDEV(0xffff, 0xffff),
PCI_DESCR("AVAGO Cutlass_53 SAS Controller")}
};

/*
Expand Down Expand Up @@ -324,40 +321,24 @@ mrsas_clear_intr(struct mrsas_softc *sc)
* PCI Support Functions
*
*/
static struct mrsas_ident *
mrsas_find_ident(device_t dev)
{
struct mrsas_ident *pci_device;

for (pci_device = device_table; pci_device->vendor != 0; pci_device++) {
if ((pci_device->vendor == pci_get_vendor(dev)) &&
(pci_device->device == pci_get_device(dev)) &&
((pci_device->subvendor == pci_get_subvendor(dev)) ||
(pci_device->subvendor == 0xffff)) &&
((pci_device->subdevice == pci_get_subdevice(dev)) ||
(pci_device->subdevice == 0xffff)))
return (pci_device);
}
return (NULL);
}

static int
mrsas_probe(device_t dev)
{
static u_int8_t first_ctrl = 1;
struct mrsas_ident *id;
const struct pci_device_table *mrsd;

if ((id = mrsas_find_ident(dev)) != NULL) {
if (first_ctrl) {
printf("AVAGO MegaRAID SAS FreeBSD mrsas driver version: %s\n",
MRSAS_VERSION);
first_ctrl = 0;
}
device_set_desc(dev, id->desc);
/* between BUS_PROBE_DEFAULT and BUS_PROBE_LOW_PRIORITY */
return (-30);
}
return (ENXIO);
mrsd = PCI_MATCH(dev, mrsas_devs);
if (mrsd == NULL)
return (ENXIO);
if (first_ctrl) {
printf("AVAGO MegaRAID SAS FreeBSD mrsas driver version: %s\n",
MRSAS_VERSION);
first_ctrl = 0;
}
device_set_desc(dev, mrsd->descr);
/* between BUS_PROBE_DEFAULT and BUS_PROBE_LOW_PRIORITY */
return (-30);
}

/*
Expand Down Expand Up @@ -4598,4 +4579,5 @@ static driver_t mrsas_driver = {
static devclass_t mrsas_devclass;

DRIVER_MODULE(mrsas, pci, mrsas_driver, mrsas_devclass, 0, 0);
PCI_PNP_INFO(mrsas_devs);
MODULE_DEPEND(mrsas, cam, 1, 1, 1);
Loading