Home | History | Annotate | Line # | Download | only in pcmcia
pcmciachip.h revision 1.1.2.6
      1 #ifndef _PCMCIA_PCMCIACHIP_H_
      2 #define _PCMCIA_PCMCIACHIP_H_
      3 
      4 #include <machine/bus.h>
      5 
      6 struct pcmcia_function;
      7 struct pcmcia_mem_handle;
      8 struct pcmcia_io_handle;
      9 
     10 /* interfaces for pcmcia to call the chipset */
     11 
     12 typedef struct pcmcia_chip_functions *pcmcia_chipset_tag_t;
     13 typedef void *pcmcia_chipset_handle_t;
     14 typedef int pcmcia_mem_handle_t;
     15 
     16 #define PCMCIA_MEM_ATTR		1
     17 #define PCMCIA_MEM_COMMON	2
     18 
     19 #define PCMCIA_WIDTH_IO8	1
     20 #define PCMCIA_WIDTH_IO16	2
     21 
     22 struct pcmcia_chip_functions {
     23     /* memory space allocation */
     24     int (*mem_alloc) __P((pcmcia_chipset_handle_t, bus_size_t,
     25 			  struct pcmcia_mem_handle *));
     26     void (*mem_free) __P((pcmcia_chipset_handle_t,
     27 			  struct pcmcia_mem_handle *));
     28 
     29     /* memory space window mapping */
     30     int (*mem_map) __P((pcmcia_chipset_handle_t, int, bus_addr_t,
     31 			bus_size_t, struct pcmcia_mem_handle *,
     32 			bus_addr_t *, int *));
     33     void (*mem_unmap) __P((pcmcia_chipset_handle_t, int));
     34 
     35     /* I/O space allocation */
     36     int (*io_alloc) __P((pcmcia_chipset_handle_t, bus_addr_t, bus_size_t,
     37 			 struct pcmcia_io_handle *));
     38     void (*io_free) __P((pcmcia_chipset_handle_t,
     39 			 struct pcmcia_io_handle *));
     40 
     41     /* I/O space window mapping */
     42     int (*io_map) __P((pcmcia_chipset_handle_t, int, bus_addr_t,
     43 		       bus_size_t, struct pcmcia_io_handle *, int *));
     44     void (*io_unmap) __P((pcmcia_chipset_handle_t, int));
     45 
     46     /* interrupt glue */
     47     void *(*intr_establish) __P((pcmcia_chipset_handle_t,
     48     				 struct pcmcia_function *, int,
     49 				 int (*)(void *), void *));
     50     void (*intr_disestablish) __P((pcmcia_chipset_handle_t, void *));
     51 
     52     /* card enable/disable */
     53     void (*socket_enable) __P((pcmcia_chipset_handle_t));
     54     void (*socket_disable) __P((pcmcia_chipset_handle_t));
     55 };
     56 
     57 #define pcmcia_chip_mem_alloc(tag, handle, size, pcmhp) \
     58 	((*(tag)->mem_alloc)((handle), (size), (pcmhp)))
     59 #define pcmcia_chip_mem_free(tag, handle, pcmhp) \
     60 	((*(tag)->mem_free)((handle), (pcmhp)))
     61 #define pcmcia_chip_mem_map(tag, handle, kind, card_addr, size, pcmhp, \
     62 			    offsetp, windowp) \
     63 	((*(tag)->mem_map)((handle), (kind), (card_addr), (size), (pcmhp), \
     64 			   (offsetp), (windowp)))
     65 #define pcmcia_chip_mem_unmap(tag, handle, window) \
     66 	((*(tag)->mem_unmap)((handle), (window)))
     67 
     68 #define pcmcia_chip_io_alloc(tag, handle, start, size, pcihp) \
     69 	((*(tag)->io_alloc)((handle), (start), (size), (pcihp)))
     70 #define pcmcia_chip_io_free(tag, handle, pcihp) \
     71 	((*(tag)->io_free)((handle), (pcihp)))
     72 #define pcmcia_chip_io_map(tag, handle, width, card_addr, size, pcihp, \
     73 			   windowp) \
     74 	((*(tag)->io_map)((handle), (width), (card_addr), (size), (pcihp), \
     75 			  (windowp)))
     76 #define pcmcia_chip_io_unmap(tag, handle, window) \
     77 	((*(tag)->io_unmap)((handle), (window)))
     78 
     79 #define pcmcia_chip_intr_establish(tag, handle, pf, ipl, fct, arg) \
     80 	((*(tag)->intr_establish)((handle), (pf), (ipl), (fct), (arg)))
     81 #define pcmcia_chip_intr_disestablish(tag, handle, ih) \
     82 	((*(tag)->intr_disestablish)((handle), (ih)))
     83 
     84 #define	pcmcia_chip_socket_enable(tag, handle) \
     85 	((*(tag)->socket_enable)((handle)))
     86 #define	pcmcia_chip_socket_disable(tag, handle) \
     87 	((*(tag)->socket_disable)((handle)))
     88 
     89 struct pcmciabus_attach_args {
     90     pcmcia_chipset_tag_t pct;
     91     pcmcia_chipset_handle_t pch;
     92 };
     93 
     94 /* interfaces for the chipset to call pcmcia */
     95 
     96 int pcmcia_attach_card __P((struct device *, int *));
     97 void pcmcia_detach_card __P((struct device *));
     98 
     99 #endif /* _PCMCIA_PCMCIACHIP_H_ */
    100