Deleted Added
full compact
excavar.h (89948) excavar.h (100703)
1/* $FreeBSD: head/sys/dev/exca/excavar.h 89948 2002-01-29 06:48:38Z imp $ */
1/* $FreeBSD: head/sys/dev/exca/excavar.h 100703 2002-07-26 08:01:08Z 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

--- 39 unchanged lines hidden (view full) ---

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
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

--- 39 unchanged lines hidden (view full) ---

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
57/*
58 * Structure to manage the ExCA part of the chip.
59 */
60struct exca_softc;
60/*
61 * Structure to manage the ExCA part of the chip.
62 */
63struct exca_softc;
61typedef uint8_t (exca_read_t)(struct exca_softc *, int);
62typedef void (exca_write_t)(struct exca_softc *, int, uint8_t);
63
64struct exca_softc
65{
66 device_t dev;
64
65struct exca_softc
66{
67 device_t dev;
67 exca_read_t *read_exca;
68 exca_write_t *write_exca;
69 int memalloc;
70 struct pccard_mem_handle mem[EXCA_MEM_WINS];
71 int ioalloc;
72 struct pccard_io_handle io[EXCA_IO_WINS];
73 bus_space_tag_t bst;
74 bus_space_handle_t bsh;
75 uint32_t flags;
76#define EXCA_SOCKET_PRESENT 0x00000001
68 int memalloc;
69 struct pccard_mem_handle mem[EXCA_MEM_WINS];
70 int ioalloc;
71 struct pccard_io_handle io[EXCA_IO_WINS];
72 bus_space_tag_t bst;
73 bus_space_handle_t bsh;
74 uint32_t flags;
75#define EXCA_SOCKET_PRESENT 0x00000001
76#define EXCA_HAS_MEMREG_WIN 0x00000002
77 uint32_t offset;
78};
79
77 uint32_t offset;
78};
79
80void exca_init(struct exca_softc *sc, device_t dev, exca_write_t *wrfn,
81 exca_read_t *rdfn, bus_space_tag_t, bus_space_handle_t, uint32_t);
80void exca_init(struct exca_softc *sc, device_t dev,
81 bus_space_tag_t, bus_space_handle_t, uint32_t);
82int exca_io_map(struct exca_softc *sc, int width, struct resource *r);
83int exca_io_unmap_res(struct exca_softc *sc, struct resource *res);
84int exca_is_pcic(struct exca_softc *sc);
85int exca_mem_map(struct exca_softc *sc, int kind, struct resource *res);
86int exca_mem_set_flags(struct exca_softc *sc, struct resource *res,
87 uint32_t flags);
88int exca_mem_set_offset(struct exca_softc *sc, struct resource *res,
89 uint32_t cardaddr, uint32_t *deltap);
90int exca_mem_unmap_res(struct exca_softc *sc, struct resource *res);
82int exca_io_map(struct exca_softc *sc, int width, struct resource *r);
83int exca_io_unmap_res(struct exca_softc *sc, struct resource *res);
84int exca_is_pcic(struct exca_softc *sc);
85int exca_mem_map(struct exca_softc *sc, int kind, struct resource *res);
86int exca_mem_set_flags(struct exca_softc *sc, struct resource *res,
87 uint32_t flags);
88int exca_mem_set_offset(struct exca_softc *sc, struct resource *res,
89 uint32_t cardaddr, uint32_t *deltap);
90int exca_mem_unmap_res(struct exca_softc *sc, struct resource *res);
91int exca_probe_slots(device_t dev, struct exca_softc *, exca_write_t *,
92 exca_read_t *);
91int exca_probe_slots(device_t dev, struct exca_softc *);
93void exca_reset(struct exca_softc *, device_t child);
94
95static __inline uint8_t
96exca_read(struct exca_softc *sc, int reg)
97{
92void exca_reset(struct exca_softc *, device_t child);
93
94static __inline uint8_t
95exca_read(struct exca_softc *sc, int reg)
96{
98 return (sc->read_exca(sc, reg));
97 return (bus_space_read_1(sc->bst, sc->bsh, sc->offset + reg));
99}
100
101static __inline void
102exca_write(struct exca_softc *sc, int reg, uint8_t val)
103{
98}
99
100static __inline void
101exca_write(struct exca_softc *sc, int reg, uint8_t val)
102{
104 sc->write_exca(sc, reg, val);
103 return (bus_space_write_1(sc->bst, sc->bsh, sc->offset + reg, val));
105}
106
107static __inline void
108exca_setb(struct exca_softc *sc, int reg, uint8_t mask)
109{
110 exca_write(sc, reg, exca_read(sc, reg) | mask);
111}
112
113static __inline void
114exca_clrb(struct exca_softc *sc, int reg, uint8_t mask)
115{
116 exca_write(sc, reg, exca_read(sc, reg) & ~mask);
117}
104}
105
106static __inline void
107exca_setb(struct exca_softc *sc, int reg, uint8_t mask)
108{
109 exca_write(sc, reg, exca_read(sc, reg) | mask);
110}
111
112static __inline void
113exca_clrb(struct exca_softc *sc, int reg, uint8_t mask)
114{
115 exca_write(sc, reg, exca_read(sc, reg) & ~mask);
116}
117
118#endif /* !_SYS_DEV_EXCA_EXCAVAR_H */