aic_pcmcia.c revision 1.1.2.7 1 1.1.2.1 marc #include <sys/param.h>
2 1.1.2.1 marc #include <sys/systm.h>
3 1.1.2.1 marc #include <sys/select.h>
4 1.1.2.1 marc #include <sys/device.h>
5 1.1.2.1 marc
6 1.1.2.1 marc #include <machine/cpu.h>
7 1.1.2.1 marc #include <machine/bus.h>
8 1.1.2.1 marc #include <machine/intr.h>
9 1.1.2.1 marc
10 1.1.2.1 marc #include <dev/pcmcia/pcmciareg.h>
11 1.1.2.1 marc #include <dev/pcmcia/pcmciavar.h>
12 1.1.2.1 marc
13 1.1.2.1 marc #define PCMCIA_MANUFACTURER_ADAPTEC 0x12F
14 1.1.2.1 marc #define PCMCIA_PRODUCT_ADAPTEC_APA1460 0x1
15 1.1.2.1 marc
16 1.1.2.6 marc struct aic_pcmcia_softc {
17 1.1.2.4 thorpej struct device sc_dev;
18 1.1.2.1 marc
19 1.1.2.4 thorpej struct pcmcia_io_handle sc_pcioh;
20 1.1.2.4 thorpej #define sc_iot sc_pcioh.iot
21 1.1.2.4 thorpej #define sc_ioh sc_pcioh.ioh
22 1.1.2.5 thorpej struct pcmcia_function *sc_pf;
23 1.1.2.1 marc };
24 1.1.2.1 marc
25 1.1.2.1 marc #ifdef __BROKEN_INDIRECT_CONFIG
26 1.1.2.1 marc int aic_pcmcia_match __P((struct device *, void *, void *));
27 1.1.2.1 marc #else
28 1.1.2.1 marc int aic_pcmcia_match __P((struct device *, struct cfdata *, void *));
29 1.1.2.1 marc #endif
30 1.1.2.1 marc void aic_pcmcia_attach __P((struct device *, struct device *, void *));
31 1.1.2.1 marc
32 1.1.2.1 marc struct cfattach aic_pcmcia_ca = {
33 1.1.2.6 marc sizeof(struct aic_pcmcia_softc), aic_pcmcia_match, aic_pcmcia_attach
34 1.1.2.1 marc };
35 1.1.2.1 marc
36 1.1.2.1 marc struct cfdriver aicx_cd = {
37 1.1.2.1 marc NULL, "aicx", DV_DULL
38 1.1.2.1 marc };
39 1.1.2.1 marc
40 1.1.2.1 marc int
41 1.1.2.1 marc aic_pcmcia_match(parent, match, aux)
42 1.1.2.1 marc struct device *parent;
43 1.1.2.1 marc #ifdef __BROKEN_INDIRECT_CONFIG
44 1.1.2.1 marc void *match;
45 1.1.2.1 marc #else
46 1.1.2.1 marc struct cfdata *cf;
47 1.1.2.1 marc #endif
48 1.1.2.1 marc void *aux;
49 1.1.2.1 marc {
50 1.1.2.7 enami struct pcmcia_attach_args *pa = aux;
51 1.1.2.1 marc
52 1.1.2.1 marc if ((pa->manufacturer == PCMCIA_MANUFACTURER_ADAPTEC) &&
53 1.1.2.1 marc (pa->product == PCMCIA_PRODUCT_ADAPTEC_APA1460) &&
54 1.1.2.1 marc (pa->pf->number == 0))
55 1.1.2.1 marc return(1);
56 1.1.2.1 marc
57 1.1.2.1 marc return(0);
58 1.1.2.1 marc }
59 1.1.2.1 marc
60 1.1.2.1 marc void
61 1.1.2.1 marc aic_pcmcia_attach(parent, self, aux)
62 1.1.2.1 marc struct device *parent, *self;
63 1.1.2.1 marc void *aux;
64 1.1.2.1 marc {
65 1.1.2.5 thorpej struct aic_pcmcia_softc *sc = (void *) self;
66 1.1.2.1 marc struct pcmcia_attach_args *pa = aux;
67 1.1.2.1 marc struct pcmcia_config_entry *cfe;
68 1.1.2.6 marc struct pcmcia_function *pf = pa->pf;
69 1.1.2.1 marc
70 1.1.2.5 thorpej sc->sc_pf = pf;
71 1.1.2.5 thorpej cfe = pf->cfe_head.sqh_first;
72 1.1.2.1 marc
73 1.1.2.1 marc /* Enable the card. */
74 1.1.2.5 thorpej pcmcia_function_init(pf, cfe);
75 1.1.2.5 thorpej if (pcmcia_function_enable(pf)) {
76 1.1.2.1 marc printf(": function enable failed\n");
77 1.1.2.1 marc return;
78 1.1.2.1 marc }
79 1.1.2.1 marc
80 1.1.2.1 marc if (cfe->num_memspace != 0) {
81 1.1.2.1 marc printf(": unexpected number of memory spaces %d should be 0\n",
82 1.1.2.1 marc cfe->num_memspace);
83 1.1.2.1 marc return;
84 1.1.2.1 marc }
85 1.1.2.1 marc
86 1.1.2.1 marc if (cfe->num_iospace != 1) {
87 1.1.2.1 marc printf(": unexpected number of I/O spaces %d should be 1\n",
88 1.1.2.1 marc cfe->num_iospace);
89 1.1.2.1 marc return;
90 1.1.2.1 marc }
91 1.1.2.1 marc
92 1.1.2.1 marc printf(": APA-1460 SCSI Host Adapter (not really attached)\n");
93 1.1.2.1 marc
94 1.1.2.1 marc return;
95 1.1.2.1 marc }
96