FreeBSD/Linux Kernel Cross Reference
sys/dev/exca/excavar.h
1 /* $FreeBSD: releng/9.0/sys/dev/exca/excavar.h 139749 2005-01-06 01:43:34Z imp $ */
2
3 /*-
4 * Copyright (c) 2002 M Warner Losh. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * This software may be derived from NetBSD i82365.c and other files with
27 * the following copyright:
28 *
29 * Copyright (c) 1997 Marc Horowitz. All rights reserved.
30 *
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
33 * are met:
34 * 1. Redistributions of source code must retain the above copyright
35 * notice, this list of conditions and the following disclaimer.
36 * 2. Redistributions in binary form must reproduce the above copyright
37 * notice, this list of conditions and the following disclaimer in the
38 * documentation and/or other materials provided with the distribution.
39 * 3. All advertising materials mentioning features or use of this software
40 * must display the following acknowledgement:
41 * This product includes software developed by Marc Horowitz.
42 * 4. The name of the author may not be used to endorse or promote products
43 * derived from this software without specific prior written permission.
44 *
45 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
46 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
47 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
48 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
49 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 */
56
57 #ifndef _SYS_DEV_EXCA_EXCAVAR_H
58 #define _SYS_DEV_EXCA_EXCAVAR_H
59
60 /*
61 * Structure to manage the ExCA part of the chip.
62 */
63 struct exca_softc;
64 typedef uint8_t (exca_getb_fn)(struct exca_softc *, int);
65 typedef void (exca_putb_fn)(struct exca_softc *, int, uint8_t);
66
67 struct exca_softc
68 {
69 device_t dev;
70 int memalloc;
71 struct pccard_mem_handle mem[EXCA_MEM_WINS];
72 int ioalloc;
73 struct pccard_io_handle io[EXCA_IO_WINS];
74 bus_space_tag_t bst;
75 bus_space_handle_t bsh;
76 uint32_t flags;
77 #define EXCA_SOCKET_PRESENT 0x00000001
78 #define EXCA_HAS_MEMREG_WIN 0x00000002
79 #define EXCA_CARD_OK 0x00000004
80 #define EXCA_EVENT 0x80000000
81 uint32_t offset;
82 int chipset;
83 #define EXCA_CARDBUS 0
84 #define EXCA_I82365 1 /* Intel i82365SL-A/B or clone */
85 #define EXCA_I82365SL_DF 2 /* Intel i82365sl-DF step */
86 #define EXCA_VLSI 3 /* VLSI chip */
87 #define EXCA_PD6710 4 /* Cirrus logic PD6710 */
88 #define EXCA_PD6722 5 /* Cirrus logic PD6722 */
89 #define EXCA_PD6729 6 /* Cirrus Logic PD6729 */
90 #define EXCA_VG365 7 /* Vadem 365 */
91 #define EXCA_VG465 8 /* Vadem 465 */
92 #define EXCA_VG468 9 /* Vadem 468 */
93 #define EXCA_VG469 10 /* Vadem 469 */
94 #define EXCA_RF5C296 11 /* Ricoh RF5C296 */
95 #define EXCA_RF5C396 12 /* Ricoh RF5C396 */
96 #define EXCA_IBM 13 /* IBM clone */
97 #define EXCA_IBM_KING 14 /* IBM KING PCMCIA Controller */
98 #define EXCA_BOGUS -1 /* Invalid/not present/etc */
99 exca_getb_fn *getb;
100 exca_putb_fn *putb;
101 device_t pccarddev;
102 uint32_t status; /* status, hw dependent */
103 };
104
105 void exca_init(struct exca_softc *sc, device_t dev,
106 bus_space_tag_t, bus_space_handle_t, uint32_t);
107 void exca_insert(struct exca_softc *sc);
108 int exca_io_map(struct exca_softc *sc, int width, struct resource *r);
109 int exca_io_unmap_res(struct exca_softc *sc, struct resource *res);
110 int exca_is_pcic(struct exca_softc *sc);
111 int exca_mem_map(struct exca_softc *sc, int kind, struct resource *res);
112 int exca_mem_set_flags(struct exca_softc *sc, struct resource *res,
113 uint32_t flags);
114 int exca_mem_set_offset(struct exca_softc *sc, struct resource *res,
115 uint32_t cardaddr, uint32_t *deltap);
116 int exca_mem_unmap_res(struct exca_softc *sc, struct resource *res);
117 int exca_probe_slots(device_t dev, struct exca_softc *exca,
118 bus_space_tag_t iot, bus_space_handle_t ioh);
119 void exca_removal(struct exca_softc *);
120 void exca_reset(struct exca_softc *, device_t child);
121
122 /* bus/device interfaces */
123 int exca_activate_resource(struct exca_softc *exca, device_t child, int type,
124 int rid, struct resource *res);
125 int exca_deactivate_resource(struct exca_softc *exca, device_t child, int type,
126 int rid, struct resource *res);
127
128 static __inline uint8_t
129 exca_getb(struct exca_softc *sc, int reg)
130 {
131 return (sc->getb(sc, reg));
132 }
133
134 static __inline void
135 exca_putb(struct exca_softc *sc, int reg, uint8_t val)
136 {
137 sc->putb(sc, reg, val);
138 }
139
140 static __inline void
141 exca_setb(struct exca_softc *sc, int reg, uint8_t mask)
142 {
143 exca_putb(sc, reg, exca_getb(sc, reg) | mask);
144 }
145
146 static __inline void
147 exca_clrb(struct exca_softc *sc, int reg, uint8_t mask)
148 {
149 exca_putb(sc, reg, exca_getb(sc, reg) & ~mask);
150 }
151
152 #endif /* !_SYS_DEV_EXCA_EXCAVAR_H */
Cache object: a75e7a1b5416ec6350eb65284dc7f887
|