This source file includes following definitions.
- cy_isa_probe
- cy_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
33
34
35
36
37
38
39
40 #include <sys/param.h>
41 #include <sys/systm.h>
42 #include <sys/device.h>
43
44 #include <machine/bus.h>
45
46 #include <dev/isa/isavar.h>
47 #include <dev/isa/isareg.h>
48
49 #include <dev/ic/cd1400reg.h>
50 #include <dev/ic/cyreg.h>
51
52 static int cy_isa_probe(struct device *, void *, void *);
53 void cy_isa_attach(struct device *, struct device *, void *);
54
55 struct cfattach cy_isa_ca = {
56 sizeof(struct cy_softc), cy_isa_probe, cy_isa_attach
57 };
58
59 int
60 cy_isa_probe(parent, match, aux)
61 struct device *parent;
62 void *match, *aux;
63 {
64 int card = ((struct device *)match)->dv_unit;
65 struct isa_attach_args *ia = aux;
66 bus_space_tag_t memt;
67 bus_space_handle_t memh;
68 int ret;
69
70 if (ia->ia_irq == IRQUNK) {
71 printf("cy%d error: interrupt not defined\n", card);
72 return (0);
73 }
74
75 memt = ia->ia_memt;
76 if (bus_space_map(memt, ia->ia_maddr, 0x2000, 0, &memh) != 0)
77 return (0);
78
79 ret = cy_probe_common(memt, memh, CY_BUSTYPE_ISA);
80 bus_space_unmap(memt, memh, 0x2000);
81 if (ret == 0)
82 return (0);
83
84 ia->ia_iosize = 0;
85 ia->ia_msize = 0x2000;
86 return (1);
87 }
88
89 void
90 cy_isa_attach(parent, self, aux)
91 struct device *parent, *self;
92 void *aux;
93 {
94 struct cy_softc *sc = (struct cy_softc *)self;
95 struct isa_attach_args *ia = aux;
96
97 sc->sc_bustype = CY_BUSTYPE_ISA;
98 sc->sc_memt = ia->ia_memt;
99
100 if (bus_space_map(ia->ia_memt, ia->ia_maddr, 0x2000, 0,
101 &sc->sc_memh) != 0)
102 return;
103
104 sc->sc_nr_cd1400s = cy_probe_common(sc->sc_memt, sc->sc_memh,
105 CY_BUSTYPE_ISA);
106
107 cy_attach(parent, self);
108
109 sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq,
110 IST_EDGE, IPL_TTY, cy_intr, sc, sc->sc_dev.dv_xname);
111
112 if (sc->sc_ih == NULL)
113 panic("cy: couldn't establish interrupt");
114 }