Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mwl/if_mwl_pci.c
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | struct mwl_pci_softc { | ||||
struct resource *sc_sr1; /* BAR1 memory resource */ | struct resource *sc_sr1; /* BAR1 memory resource */ | ||||
struct resource *sc_irq; /* irq resource */ | struct resource *sc_irq; /* irq resource */ | ||||
void *sc_ih; /* interrupt handler */ | void *sc_ih; /* interrupt handler */ | ||||
}; | }; | ||||
#define BS_BAR0 0x10 | #define BS_BAR0 0x10 | ||||
#define BS_BAR1 0x14 | #define BS_BAR1 0x14 | ||||
struct mwl_pci_ident { | struct pci_device_table mwl_devs[] = { | ||||
uint16_t vendor; | {PCI_DEV(0x11ab, 0x2a02), | ||||
uint16_t device; | PCI_DESCR("Marvell 88W8363")}, | ||||
const char *name; | {PCI_DEV(0x11ab, 0x2a03), | ||||
PCI_DESCR("Marvell 88W8363")}, | |||||
{PCI_DEV(0x11ab, 0x2a0a), | |||||
PCI_DESCR("Marvell 88W8363")}, | |||||
{PCI_DEV(0x11ab, 0x2a0b), | |||||
PCI_DESCR("Marvell 88W8363")}, | |||||
{PCI_DEV(0x11ab, 0x2a0c), | |||||
PCI_DESCR("Marvell 88W8363")}, | |||||
{PCI_DEV(0x11ab, 0x2a21), | |||||
PCI_DESCR("Marvell 88W8363")}, | |||||
{PCI_DEV(0x11ab, 0x2a24), | |||||
PCI_DESCR("Marvell 88W8363")} | |||||
}; | }; | ||||
static const struct mwl_pci_ident mwl_pci_ids[] = { | |||||
{ 0x11ab, 0x2a02, "Marvell 88W8363" }, | |||||
{ 0x11ab, 0x2a03, "Marvell 88W8363" }, | |||||
{ 0x11ab, 0x2a0a, "Marvell 88W8363" }, | |||||
{ 0x11ab, 0x2a0b, "Marvell 88W8363" }, | |||||
{ 0x11ab, 0x2a0c, "Marvell 88W8363" }, | |||||
{ 0x11ab, 0x2a21, "Marvell 88W8363" }, | |||||
{ 0x11ab, 0x2a24, "Marvell 88W8363" }, | |||||
{ 0, 0, NULL } | |||||
}; | |||||
const static struct mwl_pci_ident * | |||||
mwl_pci_lookup(int vendor, int device) | |||||
{ | |||||
const struct mwl_pci_ident *ident; | |||||
for (ident = mwl_pci_ids; ident->name != NULL; ident++) | |||||
if (vendor == ident->vendor && device == ident->device) | |||||
return ident; | |||||
return NULL; | |||||
} | |||||
static int | static int | ||||
mwl_pci_probe(device_t dev) | mwl_pci_probe(device_t dev) | ||||
{ | { | ||||
const struct mwl_pci_ident *ident; | const struct pci_device_table *mwld; | ||||
ident = mwl_pci_lookup(pci_get_vendor(dev), pci_get_device(dev)); | mwld = PCI_MATCH(dev, mwl_devs); | ||||
if (ident != NULL) { | if (mwld == NULL) | ||||
device_set_desc(dev, ident->name); | return (ENXIO); | ||||
return BUS_PROBE_DEFAULT; | device_set_desc(dev, mwld->descr); | ||||
return (BUS_PROBE_DEFAULT); | |||||
} | } | ||||
return ENXIO; | |||||
} | |||||
static int | static int | ||||
mwl_pci_attach(device_t dev) | mwl_pci_attach(device_t dev) | ||||
{ | { | ||||
struct mwl_pci_softc *psc = device_get_softc(dev); | struct mwl_pci_softc *psc = device_get_softc(dev); | ||||
struct mwl_softc *sc = &psc->sc_sc; | struct mwl_softc *sc = &psc->sc_sc; | ||||
int rid, error = ENXIO; | int rid, error = ENXIO; | ||||
▲ Show 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
static driver_t mwl_pci_driver = { | static driver_t mwl_pci_driver = { | ||||
"mwl", | "mwl", | ||||
mwl_pci_methods, | mwl_pci_methods, | ||||
sizeof (struct mwl_pci_softc) | sizeof (struct mwl_pci_softc) | ||||
}; | }; | ||||
static devclass_t mwl_devclass; | static devclass_t mwl_devclass; | ||||
DRIVER_MODULE(mwl, pci, mwl_pci_driver, mwl_devclass, 0, 0); | DRIVER_MODULE(mwl, pci, mwl_pci_driver, mwl_devclass, 0, 0); | ||||
PCI_PNP_INFO(mwl_devs); | |||||
MODULE_VERSION(mwl, 1); | MODULE_VERSION(mwl, 1); | ||||
MODULE_DEPEND(mwl, wlan, 1, 1, 1); /* 802.11 media layer */ | MODULE_DEPEND(mwl, wlan, 1, 1, 1); /* 802.11 media layer */ | ||||
MODULE_DEPEND(mwl, firmware, 1, 1, 1); | MODULE_DEPEND(mwl, firmware, 1, 1, 1); |