This source file includes following definitions.
- ep_pci_match
- ep_pci_attach
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 #include "bpfilter.h"
35
36 #include <sys/param.h>
37 #include <sys/systm.h>
38 #include <sys/mbuf.h>
39 #include <sys/socket.h>
40 #include <sys/ioctl.h>
41 #include <sys/errno.h>
42 #include <sys/timeout.h>
43 #include <sys/syslog.h>
44 #include <sys/selinfo.h>
45 #include <sys/device.h>
46
47 #include <net/if.h>
48 #include <net/if_dl.h>
49 #include <net/if_types.h>
50 #include <net/if_media.h>
51
52 #ifdef INET
53 #include <netinet/in.h>
54 #include <netinet/in_systm.h>
55 #include <netinet/in_var.h>
56 #include <netinet/ip.h>
57 #include <netinet/if_ether.h>
58 #endif
59
60 #if NBPFILTER > 0
61 #include <net/bpf.h>
62 #endif
63
64 #include <machine/cpu.h>
65 #include <machine/bus.h>
66 #include <machine/intr.h>
67
68 #include <dev/mii/mii.h>
69 #include <dev/mii/miivar.h>
70
71 #include <dev/ic/elink3var.h>
72 #include <dev/ic/elink3reg.h>
73
74 #include <dev/pci/pcivar.h>
75 #include <dev/pci/pcireg.h>
76 #include <dev/pci/pcidevs.h>
77
78
79
80
81
82 #define PCI_CONN 0x48
83 #define PCI_CBIO 0x10
84
85 int ep_pci_match(struct device *, void *, void *);
86 void ep_pci_attach(struct device *, struct device *, void *);
87
88 struct cfattach ep_pci_ca = {
89 sizeof(struct ep_softc), ep_pci_match, ep_pci_attach
90 };
91
92 const struct pci_matchid ep_pci_devices[] = {
93 { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C590 },
94 { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C595MII },
95 { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C595T4 },
96 { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C595TX },
97 };
98
99 int
100 ep_pci_match(parent, match, aux)
101 struct device *parent;
102 void *match, *aux;
103 {
104 return (pci_matchbyid((struct pci_attach_args *)aux, ep_pci_devices,
105 sizeof(ep_pci_devices)/sizeof(ep_pci_devices[0])));
106 }
107
108 void
109 ep_pci_attach(parent, self, aux)
110 struct device *parent, *self;
111 void *aux;
112 {
113 struct ep_softc *sc = (void *)self;
114 struct pci_attach_args *pa = aux;
115 pci_chipset_tag_t pc = pa->pa_pc;
116 bus_size_t iosize;
117 pci_intr_handle_t ih;
118 pcireg_t i;
119 const char *intrstr = NULL;
120
121 if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0,
122 &sc->sc_iot, &sc->sc_ioh, NULL, &iosize, 0)) {
123 printf(": can't map i/o space\n");
124 return;
125 }
126
127 sc->bustype = EP_BUS_PCI;
128
129 i = pci_conf_read(pc, pa->pa_tag, PCI_CONN);
130
131 GO_WINDOW(0);
132
133 printf(":");
134
135 epconfig(sc, EP_CHIPSET_VORTEX, NULL);
136
137
138 if (pci_intr_map(pa, &ih)) {
139 printf(", couldn't map interrupt\n");
140 bus_space_unmap(sc->sc_iot, sc->sc_ioh, iosize);
141 return;
142 }
143 intrstr = pci_intr_string(pc, ih);
144 sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, epintr,
145 sc, sc->sc_dev.dv_xname);
146 if (sc->sc_ih == NULL) {
147 printf(": couldn't establish interrupt");
148 if (intrstr != NULL)
149 printf(" at %s", intrstr);
150 printf("\n");
151 bus_space_unmap(sc->sc_iot, sc->sc_ioh, iosize);
152 return;
153 }
154 printf(" %s\n", intrstr);
155 }