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