This source file includes following definitions.
- rln_isa_probe
- rln_isa_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 #include "bpfilter.h"
33
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/socket.h>
37 #include <sys/device.h>
38 #include <sys/queue.h>
39
40 #include <net/if.h>
41
42 #ifdef INET
43 #include <netinet/in.h>
44 #include <netinet/if_ether.h>
45 #endif
46
47 #include <machine/cpu.h>
48 #include <machine/bus.h>
49 #include <machine/intr.h>
50
51 #include <dev/ic/rln.h>
52 #include <dev/ic/rlnvar.h>
53 #include <dev/ic/rlnreg.h>
54
55 #include <dev/isa/isavar.h>
56
57 static int rln_isa_probe(struct device *, void *, void *);
58 static void rln_isa_attach(struct device *, struct device *, void *);
59
60 struct cfattach rln_isa_ca = {
61 sizeof(struct rln_softc), rln_isa_probe, rln_isa_attach
62 };
63
64 static const int rln_irq[] = {
65 3, 4, 5, 7, 10, 11, 12, 15
66 };
67 #define NRLN_IRQ (sizeof(rln_irq) / sizeof(rln_irq[0]))
68
69 static int
70 rln_isa_probe(parent, match, aux)
71 struct device *parent;
72 void *match, *aux;
73 {
74 struct isa_attach_args *ia = aux;
75 struct rln_softc *sc = match;
76
77
78
79
80
81 if (ia->ia_iobase == IOBASEUNK)
82 return (0);
83
84
85 sc->sc_iot = ia->ia_iot;
86 sc->sc_width = 0;
87 if (bus_space_map(sc->sc_iot, ia->ia_iobase, RLN_NPORTS, 0,
88 &sc->sc_ioh))
89 return (0);
90
91 if (rln_reset(sc)) {
92 bus_space_unmap(sc->sc_iot, sc->sc_ioh, RLN_NPORTS);
93 return (0);
94 }
95
96 ia->ia_iosize = RLN_NPORTS;
97 return (1);
98 }
99
100 static void
101 rln_isa_attach(parent, self, aux)
102 struct device *parent, *self;
103 void *aux;
104 {
105 struct rln_softc *sc = (void *)self;
106 struct isa_attach_args *ia = aux;
107 int irq = ia->ia_irq;
108 int mask;
109 int i;
110
111 if (irq == IRQUNK) {
112
113 mask = 0;
114 for (i = 0; i < NRLN_IRQ; i++)
115 mask |= (1 << rln_irq[i]);
116 if (isa_intr_alloc(ia->ia_ic, mask, IST_EDGE, &irq))
117 panic("rln_isa_attach: can't allocate irq");
118 }
119 #ifdef DIAGNOSTIC
120 else {
121
122 for (i = 0; i < NRLN_IRQ; i++)
123 if (irq == rln_irq[i])
124 break;
125 if (i == NRLN_IRQ)
126 printf("rln_isa_probe: using invalid irq %d\n", irq);
127 }
128 #endif
129
130 printf(":");
131
132 sc->sc_ih = isa_intr_establish(ia->ia_ic, irq, IST_EDGE,
133 IPL_NET, rlnintr, sc, sc->sc_dev.dv_xname);
134 #ifdef DIAGNOSTIC
135 if (sc->sc_ih == NULL)
136 panic("rln_isa_attach: couldn't establish interrupt");
137 #endif
138
139
140 sc->sc_irq = irq;
141 sc->sc_width = 0;
142
143 printf("%s: RangeLAN2 7100", sc->sc_dev.dv_xname);
144 rlnconfig(sc);
145 printf("\n");
146 }