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