1/*-
2 * Copyright (c) 1998 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 9 unchanged lines hidden (view full) ---
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: isavar.h,v 1.2 1998/11/15 18:25:17 dfr Exp $
27 */
28
29#define ISA_NPORT_IVARS 2
30#define ISA_NMEM_IVARS 2
31#define ISA_NIRQ_IVARS 2
32#define ISA_NDRQ_IVARS 2
33
34enum isa_device_ivars {
--- 23 unchanged lines hidden (view full) ---
58
59/*
60 * Simplified accessors for isa devices
61 */
62#define ISA_ACCESSOR(A, B, T) \
63 \
64static __inline T isa_get_ ## A(device_t dev) \
65{ \
66 uintptr_t v; \
67 BUS_READ_IVAR(device_get_parent(dev), dev, ISA_IVAR_ ## B, &v); \
68 return (T) v; \
69} \
70 \
71static __inline void isa_set_ ## A(device_t dev, T t) \
72{ \
73 u_long v = (u_long) t; \
74 BUS_WRITE_IVAR(device_get_parent(dev), dev, ISA_IVAR_ ## B, v); \
75}
76
77ISA_ACCESSOR(port, PORT, int)
78ISA_ACCESSOR(portsize, PORTSIZE, int)
79ISA_ACCESSOR(flags, FLAGS, int)
80ISA_ACCESSOR(irq, IRQ, int)
81ISA_ACCESSOR(drq, DRQ, int)
82ISA_ACCESSOR(maddr, MADDR, int)
83ISA_ACCESSOR(msize, MSIZE, int)
84
2 * Copyright (c) 1998 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 9 unchanged lines hidden (view full) ---
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: isavar.h,v 1.2 1998/11/15 18:25:17 dfr Exp $
27 */
28
29#define ISA_NPORT_IVARS 2
30#define ISA_NMEM_IVARS 2
31#define ISA_NIRQ_IVARS 2
32#define ISA_NDRQ_IVARS 2
33
34enum isa_device_ivars {
--- 23 unchanged lines hidden (view full) ---
58
59/*
60 * Simplified accessors for isa devices
61 */
62#define ISA_ACCESSOR(A, B, T) \
63 \
64static __inline T isa_get_ ## A(device_t dev) \
65{ \
66 uintptr_t v; \
67 BUS_READ_IVAR(device_get_parent(dev), dev, ISA_IVAR_ ## B, &v); \
68 return (T) v; \
69} \
70 \
71static __inline void isa_set_ ## A(device_t dev, T t) \
72{ \
73 u_long v = (u_long) t; \
74 BUS_WRITE_IVAR(device_get_parent(dev), dev, ISA_IVAR_ ## B, v); \
75}
76
77ISA_ACCESSOR(port, PORT, int)
78ISA_ACCESSOR(portsize, PORTSIZE, int)
79ISA_ACCESSOR(flags, FLAGS, int)
80ISA_ACCESSOR(irq, IRQ, int)
81ISA_ACCESSOR(drq, DRQ, int)
82ISA_ACCESSOR(maddr, MADDR, int)
83ISA_ACCESSOR(msize, MSIZE, int)
84