pcmciachip.h revision 1.1.2.1 1 #ifndef _PCMCIA_PCMCIACHIP_H_
2 #define _PCMCIA_PCMCIACHIP_H_
3
4 #include <machine/bus.h>
5
6 /* interfaces for pcmcia to call the chipset */
7
8 typedef struct pcmcia_chip_functions *pcmcia_chipset_tag_t;
9 typedef void *pcmcia_chipset_handle_t;
10 typedef int pcmcia_mem_handle_t;
11
12 #define PCMCIA_MEM_ATTR 1
13 #define PCMCIA_MEM_COMMON 2
14
15 #define PCMCIA_WIDTH_IO8 1
16 #define PCMCIA_WIDTH_IO16 2
17
18 struct pcmcia_chip_functions {
19 /* XXX alloc/free should probably be somewhere more generic than the
20 pcmcia driver */
21 int (*mem_alloc) __P((pcmcia_chipset_handle_t, bus_size_t,
22 bus_space_tag_t *, bus_space_handle_t *,
23 pcmcia_mem_handle_t *, bus_size_t *));
24 void (*mem_free) __P((pcmcia_chipset_handle_t, bus_size_t,
25 bus_space_tag_t, bus_space_handle_t,
26 pcmcia_mem_handle_t));
27 int (*mem_map) __P((pcmcia_chipset_handle_t, int,
28 bus_size_t, bus_space_tag_t, bus_space_handle_t,
29 u_long, u_long *, int *));
30 void (*mem_unmap) __P((pcmcia_chipset_handle_t, int));
31
32 int (*io_alloc) __P((pcmcia_chipset_handle_t, bus_addr_t, bus_size_t,
33 bus_space_tag_t *, bus_space_handle_t *));
34 void (*io_free) __P((pcmcia_chipset_handle_t, bus_size_t,
35 bus_space_tag_t, bus_space_handle_t));
36 int (*io_map) __P((pcmcia_chipset_handle_t, int, bus_size_t,
37 bus_space_tag_t, bus_space_handle_t, int *));
38 void (*io_unmap) __P((pcmcia_chipset_handle_t, int));
39
40 void *(*intr_establish) __P((pcmcia_chipset_handle_t, int,
41 int (*)(void *), void *));
42 void (*intr_disestablish) __P((pcmcia_chipset_handle_t, void *));
43 };
44
45 #define pcmcia_chip_mem_alloc(tag, handle, size, memtp, memhp, mhandle, \
46 realsize) \
47 ((*(tag)->mem_alloc)((handle), (size), (memtp), (memhp), (mhandle), \
48 (realsize)))
49 #define pcmcia_chip_mem_free(tag, handle, size, memt, memh, mhandle) \
50 ((*(tag)->mem_free)((handle), (size), (memt), (memh), (mhandle)))
51 #define pcmcia_chip_mem_map(tag, handle, kind, size, memt, memh, \
52 card_addr, offsetp, windowp) \
53 ((*(tag)->mem_map)((handle), (kind), (size), (memt), (memh), \
54 (card_addr), (offsetp), (windowp)))
55 #define pcmcia_chip_mem_unmap(tag, handle, window) \
56 ((*(tag)->mem_unmap)((handle), (window)))
57
58 #define pcmcia_chip_io_alloc(tag, handle, start, size, iotp, iohp) \
59 ((*(tag)->io_alloc)((handle), (start), (size), (iotp), (iohp)))
60 #define pcmcia_chip_io_free(tag, handle, size, iot, ioh) \
61 ((*(tag)->io_free)((handle), (size), (iot), (ioh)))
62 #define pcmcia_chip_io_map(tag, handle, width, size, iot, ioh, windowp) \
63 ((*(tag)->io_map)((handle), (width), (size), (iot), (ioh), (windowp)))
64 #define pcmcia_chip_io_unmap(tag, handle, window) \
65 ((*(tag)->io_unmap)((handle), (window)))
66
67 #define pcmcia_chip_intr_establish(tag, handle, ipl, fct, arg) \
68 ((*(tag)->intr_establish)((handle), (ipl), (fct), (arg)))
69 #define pcmcia_chip_intr_disestablish(tag, handle, ih) \
70 ((*(tag)->intr_disestablish)((handle), (ih)))
71
72 struct pcmciabus_attach_args {
73 pcmcia_chipset_tag_t pct;
74 pcmcia_chipset_handle_t pch;
75 };
76
77 /* interfaces for the chipset to call pcmcia */
78
79 int pcmcia_attach_card __P((struct device *, int *));
80 void pcmcia_detach_card __P((struct device *));
81
82 #endif /* _PCMCIA_PCMCIACHIP_H_ */
83