zmore: Fix incorrect test
[dragonfly.git] / sys / bus / eisa / eisaconf.h
blob6f58197475da3bec1c608d00333584a602b3b8d7
1 /*
2 * EISA bus device definitions
4 * Copyright (c) 1995, 1996 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice immediately at the beginning of the file, without modification,
12 * this list of conditions, and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
31 * $FreeBSD: src/sys/dev/eisa/eisaconf.h,v 1.20 1999/08/28 00:43:39 peter Exp $
32 * $DragonFly: src/sys/bus/eisa/eisaconf.h,v 1.4 2006/10/23 21:50:31 dillon Exp $
35 #ifndef _BUS_EISA_EISACONF_H_
36 #define _BUS_EISA_EISACONF_H_
38 #define EISA_SLOT_SIZE 0x1000
40 #define EISA_MFCTR_CHAR0(ID) (char)(((ID>>26) & 0x1F) | '@') /* Bits 26-30 */
41 #define EISA_MFCTR_CHAR1(ID) (char)(((ID>>21) & 0x1F) | '@') /* Bits 21-25 */
42 #define EISA_MFCTR_CHAR2(ID) (char)(((ID>>16) & 0x1F) | '@') /* Bits 16-20 */
43 #define EISA_MFCTR_ID(ID) (short)((ID>>16) & 0xFF) /* Bits 16-31 */
44 #define EISA_PRODUCT_ID(ID) (short)((ID>>4) & 0xFFF) /* Bits 4-15 */
45 #define EISA_REVISION_ID(ID) (u_char)(ID & 0x0F) /* Bits 0-3 */
47 extern int num_eisa_slots;
49 typedef u_int32_t eisa_id_t;
51 enum eisa_device_ivars {
52 EISA_IVAR_SLOT,
53 EISA_IVAR_ID,
54 EISA_IVAR_IRQ
57 #define EISA_TRIGGER_EDGE 0x0
58 #define EISA_TRIGGER_LEVEL 0x1
61 * Simplified accessors for isa devices
63 #define EISA_ACCESSOR(A, B, T) \
65 static __inline T eisa_get_ ## A(device_t dev) \
66 { \
67 uintptr_t v; \
68 BUS_READ_IVAR(device_get_parent(dev), dev, EISA_IVAR_ ## B, &v); \
69 return (T) v; \
70 } \
72 static __inline void eisa_set_ ## A(device_t dev, T t) \
73 { \
74 u_long v = (u_long) t; \
75 BUS_WRITE_IVAR(device_get_parent(dev), dev, EISA_IVAR_ ## B, v); \
78 EISA_ACCESSOR(slot, SLOT, int)
79 EISA_ACCESSOR(id, ID, eisa_id_t)
80 EISA_ACCESSOR(irq, IRQ, eisa_id_t)
82 int eisa_add_intr (device_t, int, int);
84 #define RESVADDR_NONE 0x00
85 #define RESVADDR_BITMASK 0x01 /* size is a mask of reserved
86 * bits at addr
88 #define RESVADDR_RELOCATABLE 0x02
89 int eisa_add_iospace (device_t, u_long, u_long, int);
90 int eisa_add_mspace (device_t, u_long, u_long, int);
92 #endif /* _BUS_EISA_EISACONF_H_ */