Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/sis/if_sis.c
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | |||||
#define CSR_READ_2(sc, reg) bus_read_2(sc->sis_res[0], reg) | #define CSR_READ_2(sc, reg) bus_read_2(sc->sis_res[0], reg) | ||||
#define CSR_BARRIER(sc, reg, length, flags) \ | #define CSR_BARRIER(sc, reg, length, flags) \ | ||||
bus_barrier(sc->sis_res[0], reg, length, flags) | bus_barrier(sc->sis_res[0], reg, length, flags) | ||||
/* | /* | ||||
* Various supported device vendors/types and their names. | * Various supported device vendors/types and their names. | ||||
*/ | */ | ||||
static const struct sis_type sis_devs[] = { | struct pci_device_table sis_devs[] = { | ||||
{ SIS_VENDORID, SIS_DEVICEID_900, "SiS 900 10/100BaseTX" }, | {PCI_DEV(SIS_VENDORID, SIS_DEVICEID_900), | ||||
{ SIS_VENDORID, SIS_DEVICEID_7016, "SiS 7016 10/100BaseTX" }, | PCI_DESCR("SiS 900 10/100BaseTX")}, | ||||
{ NS_VENDORID, NS_DEVICEID_DP83815, "NatSemi DP8381[56] 10/100BaseTX" }, | {PCI_DEV(SIS_VENDORID, SIS_DEVICEID_7016), | ||||
{ 0, 0, NULL } | PCI_DESCR("SiS 7016 10/100BaseTX")}, | ||||
{PCI_DEV(NS_VENDORID, NS_DEVICEID_DP83815), | |||||
PCI_DESCR("NatSemi DP8381[56] 10/100BaseTX")} | |||||
}; | }; | ||||
static int sis_detach(device_t); | static int sis_detach(device_t); | ||||
static __inline void sis_discard_rxbuf(struct sis_rxdesc *); | static __inline void sis_discard_rxbuf(struct sis_rxdesc *); | ||||
static int sis_dma_alloc(struct sis_softc *); | static int sis_dma_alloc(struct sis_softc *); | ||||
static void sis_dma_free(struct sis_softc *); | static void sis_dma_free(struct sis_softc *); | ||||
static int sis_dma_ring_alloc(struct sis_softc *, bus_size_t, bus_size_t, | static int sis_dma_ring_alloc(struct sis_softc *, bus_size_t, bus_size_t, | ||||
bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *); | bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *); | ||||
▲ Show 20 Lines • Show All 716 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Probe for an SiS chip. Check the PCI vendor and device | * Probe for an SiS chip. Check the PCI vendor and device | ||||
* IDs against our list and return a device name if we find a match. | * IDs against our list and return a device name if we find a match. | ||||
*/ | */ | ||||
static int | static int | ||||
sis_probe(device_t dev) | sis_probe(device_t dev) | ||||
{ | { | ||||
const struct sis_type *t; | const struct pci_device_table *sisd; | ||||
t = sis_devs; | sisd = PCI_MATCH(dev, sis_devs); | ||||
if (sisd == NULL) | |||||
while (t->sis_name != NULL) { | return (ENXIO); | ||||
if ((pci_get_vendor(dev) == t->sis_vid) && | device_set_desc(dev, sisd->descr); | ||||
(pci_get_device(dev) == t->sis_did)) { | |||||
device_set_desc(dev, t->sis_name); | |||||
return (BUS_PROBE_DEFAULT); | return (BUS_PROBE_DEFAULT); | ||||
} | } | ||||
t++; | |||||
} | |||||
return (ENXIO); | |||||
} | |||||
/* | /* | ||||
* Attach the interface. Allocate softc structures, do ifmedia | * Attach the interface. Allocate softc structures, do ifmedia | ||||
* setup and ethernet/BPF attach. | * setup and ethernet/BPF attach. | ||||
*/ | */ | ||||
static int | static int | ||||
sis_attach(device_t dev) | sis_attach(device_t dev) | ||||
{ | { | ||||
u_char eaddr[ETHER_ADDR_LEN]; | u_char eaddr[ETHER_ADDR_LEN]; | ||||
▲ Show 20 Lines • Show All 1,510 Lines • ▼ Show 20 Lines | static driver_t sis_driver = { | ||||
"sis", | "sis", | ||||
sis_methods, | sis_methods, | ||||
sizeof(struct sis_softc) | sizeof(struct sis_softc) | ||||
}; | }; | ||||
static devclass_t sis_devclass; | static devclass_t sis_devclass; | ||||
DRIVER_MODULE(sis, pci, sis_driver, sis_devclass, 0, 0); | DRIVER_MODULE(sis, pci, sis_driver, sis_devclass, 0, 0); | ||||
PCI_PNP_INFO(sis_devs); | |||||
DRIVER_MODULE(miibus, sis, miibus_driver, miibus_devclass, 0, 0); | DRIVER_MODULE(miibus, sis, miibus_driver, miibus_devclass, 0, 0); |