Skip to content

Commit

Permalink
Add PNP info to PCI attachments of LE driver
Browse files Browse the repository at this point in the history
Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Pull Request: bsdimp#11
Url: https://reviews.freebsd.org/D16363
  • Loading branch information
lakhanshiva committed Jul 20, 2018
1 parent 95221a7 commit 02589c1
Showing 1 changed file with 13 additions and 14 deletions.
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

0 comments on commit 02589c1

Please sign in to comment.