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