This source file includes following definitions.
- pdq_tc_match
- pdq_tc_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
35
36
37
38
39
40 #include <sys/param.h>
41 #include <sys/kernel.h>
42 #include <sys/mbuf.h>
43 #include <sys/protosw.h>
44 #include <sys/socket.h>
45 #include <sys/ioctl.h>
46 #include <sys/errno.h>
47 #include <sys/malloc.h>
48 #include <sys/device.h>
49
50 #include <net/if.h>
51 #include <net/if_types.h>
52
53 #ifdef INET
54 #include <netinet/in.h>
55 #include <netinet/if_ether.h>
56 #endif
57 #include <net/if_fddi.h>
58
59 #include <uvm/uvm_extern.h>
60
61 #include <dev/tc/tcvar.h>
62 #include <dev/ic/pdqvar.h>
63 #include <dev/ic/pdqreg.h>
64
65 int pdq_tc_match(struct device *, void *, void *);
66 void pdq_tc_attach(struct device *, struct device *, void *);
67
68 int
69 pdq_tc_match(parent, match, aux)
70 struct device *parent;
71 void *match;
72 void *aux;
73 {
74 struct tc_attach_args *ta = (struct tc_attach_args *) aux;
75
76 if (strncmp("PMAF-F", ta->ta_modname, 6) == 0)
77 return (1);
78 return (0);
79 }
80
81 void
82 pdq_tc_attach(parent, self, aux)
83 struct device *parent;
84 struct device *self;
85 void *aux;
86 {
87 pdq_softc_t * const sc = (pdq_softc_t *) self;
88 struct tc_attach_args * const ta = (struct tc_attach_args *) aux;
89
90
91
92
93
94 sc->sc_csrtag = ta->ta_memt;
95 bcopy(sc->sc_dev.dv_xname, sc->sc_if.if_xname, IFNAMSIZ);
96 sc->sc_if.if_flags = 0;
97 sc->sc_if.if_softc = sc;
98
99 if (bus_space_map(sc->sc_csrtag, ta->ta_addr + PDQ_TC_CSR_OFFSET,
100 PDQ_TC_CSR_SPACE, 0, &sc->sc_csrhandle)) {
101 printf("\n%s: can't map card memory!\n", sc->sc_dev.dv_xname);
102 return;
103 }
104
105 printf("\n");
106 sc->sc_pdq = pdq_initialize(sc->sc_csrtag, sc->sc_csrhandle,
107 sc->sc_if.if_xname, 0, (void *) sc, PDQ_DEFTA);
108 if (sc->sc_pdq == NULL) {
109 printf("%s: initialization failed\n", sc->sc_dev.dv_xname);
110 return;
111 }
112 bcopy((caddr_t) sc->sc_pdq->pdq_hwaddr.lanaddr_bytes,
113 sc->sc_arpcom.ac_enaddr, 6);
114 pdq_ifattach(sc, NULL);
115
116 tc_intr_establish(parent, ta->ta_cookie, TC_IPL_NET,
117 (int (*)(void *)) pdq_interrupt, sc->sc_pdq);
118
119 sc->sc_ats = shutdownhook_establish((void (*)(void *)) pdq_hwreset,
120 sc->sc_pdq);
121 if (sc->sc_ats == NULL)
122 printf("%s: warning: couldn't establish shutdown hook\n",
123 self->dv_xname);
124 }
125
126 struct cfattach fta_ca = {
127 sizeof(pdq_softc_t), pdq_tc_match, pdq_tc_attach
128 };
129
130 struct cfdriver fta_cd = {
131 0, "fta", DV_IFNET
132 };