Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/iwi/if_iwi.c
Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
struct iwi_ident { | struct iwi_ident { | ||||
uint16_t vendor; | uint16_t vendor; | ||||
uint16_t device; | uint16_t device; | ||||
const char *name; | const char *name; | ||||
}; | }; | ||||
static const struct iwi_ident iwi_ident_table[] = { | struct pci_device_table iwi_devs[] = { | ||||
{ 0x8086, 0x4220, "Intel(R) PRO/Wireless 2200BG" }, | {PCI_DEV(0x8086, 0x4220), | ||||
{ 0x8086, 0x4221, "Intel(R) PRO/Wireless 2225BG" }, | PCI_DESCR("Intel(R) PRO/Wireless 2200BG")}, | ||||
{ 0x8086, 0x4223, "Intel(R) PRO/Wireless 2915ABG" }, | {PCI_DEV(0x8086, 0x4221), | ||||
{ 0x8086, 0x4224, "Intel(R) PRO/Wireless 2915ABG" }, | PCI_DESCR("Intel(R) PRO/Wireless 2225BG")}, | ||||
{PCI_DEV(0x8086, 0x4223), | |||||
{ 0, 0, NULL } | PCI_DESCR("Intel(R) PRO/Wireless 2915ABG")}, | ||||
{PCI_DEV(0x8086, 0x4224), | |||||
PCI_DESCR("Intel(R) PRO/Wireless 2915ABG")} | |||||
}; | }; | ||||
static const uint8_t def_chan_2ghz[] = | static const uint8_t def_chan_2ghz[] = | ||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; | { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; | ||||
static const uint8_t def_chan_5ghz_band1[] = | static const uint8_t def_chan_5ghz_band1[] = | ||||
{ 36, 40, 44, 48, 52, 56, 60, 64 }; | { 36, 40, 44, 48, 52, 56, 60, 64 }; | ||||
static const uint8_t def_chan_5ghz_band2[] = | static const uint8_t def_chan_5ghz_band2[] = | ||||
{ 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 }; | { 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 }; | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | static driver_t iwi_driver = { | ||||
"iwi", | "iwi", | ||||
iwi_methods, | iwi_methods, | ||||
sizeof (struct iwi_softc) | sizeof (struct iwi_softc) | ||||
}; | }; | ||||
static devclass_t iwi_devclass; | static devclass_t iwi_devclass; | ||||
DRIVER_MODULE(iwi, pci, iwi_driver, iwi_devclass, NULL, NULL); | DRIVER_MODULE(iwi, pci, iwi_driver, iwi_devclass, NULL, NULL); | ||||
PCI_PNP_INFO(iwi_devs); | |||||
MODULE_VERSION(iwi, 1); | MODULE_VERSION(iwi, 1); | ||||
static __inline uint8_t | static __inline uint8_t | ||||
MEM_READ_1(struct iwi_softc *sc, uint32_t addr) | MEM_READ_1(struct iwi_softc *sc, uint32_t addr) | ||||
{ | { | ||||
CSR_WRITE_4(sc, IWI_CSR_INDIRECT_ADDR, addr); | CSR_WRITE_4(sc, IWI_CSR_INDIRECT_ADDR, addr); | ||||
return CSR_READ_1(sc, IWI_CSR_INDIRECT_DATA); | return CSR_READ_1(sc, IWI_CSR_INDIRECT_DATA); | ||||
} | } | ||||
static __inline uint32_t | static __inline uint32_t | ||||
MEM_READ_4(struct iwi_softc *sc, uint32_t addr) | MEM_READ_4(struct iwi_softc *sc, uint32_t addr) | ||||
{ | { | ||||
CSR_WRITE_4(sc, IWI_CSR_INDIRECT_ADDR, addr); | CSR_WRITE_4(sc, IWI_CSR_INDIRECT_ADDR, addr); | ||||
return CSR_READ_4(sc, IWI_CSR_INDIRECT_DATA); | return CSR_READ_4(sc, IWI_CSR_INDIRECT_DATA); | ||||
} | } | ||||
static int | static int | ||||
iwi_probe(device_t dev) | iwi_probe(device_t dev) | ||||
{ | { | ||||
const struct iwi_ident *ident; | const struct pci_device_table *iwid; | ||||
for (ident = iwi_ident_table; ident->name != NULL; ident++) { | iwid = PCI_MATCH(dev, iwi_devs); | ||||
if (pci_get_vendor(dev) == ident->vendor && | if (iwid == NULL) | ||||
pci_get_device(dev) == ident->device) { | return (ENXIO); | ||||
device_set_desc(dev, ident->name); | device_set_desc(dev, iwid->descr); | ||||
return (BUS_PROBE_DEFAULT); | return (BUS_PROBE_DEFAULT); | ||||
} | |||||
} | |||||
return ENXIO; | |||||
} | } | ||||
static int | static int | ||||
iwi_attach(device_t dev) | iwi_attach(device_t dev) | ||||
{ | { | ||||
struct iwi_softc *sc = device_get_softc(dev); | struct iwi_softc *sc = device_get_softc(dev); | ||||
struct ieee80211com *ic = &sc->sc_ic; | struct ieee80211com *ic = &sc->sc_ic; | ||||
uint16_t val; | uint16_t val; | ||||
▲ Show 20 Lines • Show All 3,333 Lines • Show Last 20 Lines |