Home | History | Annotate | Line # | Download | only in pcmcia
aic_pcmcia.c revision 1.1.2.2
      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     printf("aic_pcmcia_match: %x %x %d\n", pa->manufacturer,
     52 	    pa->product, pa->pf->number);
     53 
     54     if ((pa->manufacturer == PCMCIA_MANUFACTURER_ADAPTEC) &&
     55 	(pa->product == PCMCIA_PRODUCT_ADAPTEC_APA1460) &&
     56 	(pa->pf->number == 0))
     57 	return(1);
     58 
     59     return(0);
     60 }
     61 
     62 void
     63 aic_pcmcia_attach(parent, self, aux)
     64      struct device *parent, *self;
     65      void *aux;
     66 {
     67 /*     struct aic_softc *sc = (void *) self; */
     68     struct pcmcia_attach_args *pa = aux;
     69     struct pcmcia_config_entry *cfe;
     70 
     71     cfe = pa->pf->cfe_head.sqh_first;
     72 
     73     /* Enable the card. */
     74     if (pcmcia_enable_function(pa->pf, parent, cfe)) {
     75 	printf(": function enable failed\n");
     76 	return;
     77     }
     78 
     79     if (cfe->num_memspace != 0) {
     80 	printf(": unexpected number of memory spaces %d should be 0\n",
     81 	       cfe->num_memspace);
     82 	return;
     83     }
     84 
     85     if (cfe->num_iospace != 1) {
     86 	printf(": unexpected number of I/O spaces %d should be 1\n",
     87 	       cfe->num_iospace);
     88 	return;
     89     }
     90 
     91     printf(": APA-1460 SCSI Host Adapter (not really attached)\n");
     92 
     93     return;
     94 }
     95