Annotation of sys/dev/eisa/eisareg.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: eisareg.h,v 1.4 1996/05/05 12:42:24 deraadt Exp $ */
2: /* $NetBSD: eisareg.h,v 1.3 1996/04/09 22:46:13 cgd Exp $ */
3:
4: /*
5: * Copyright (c) 1995, 1996 Christopher G. Demetriou
6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, 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. All advertising materials mentioning features or use of this software
17: * must display the following acknowledgement:
18: * This product includes software developed by Christopher G. Demetriou
19: * for the NetBSD Project.
20: * 4. The name of the author may not be used to endorse or promote products
21: * derived from this software without specific prior written permission
22: *
23: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33: */
34:
35: #ifndef __DEV_EISA_EISAREG_H__
36: #define __DEV_EISA_EISAREG_H__
37:
38: /*
39: * Register (etc.) descriptions for the EISA bus.
40:
41: * Mostly culled from EISA chipset descriptions in:
42: * Intel Peripheral Components Databook (1992)
43: */
44:
45: /*
46: * Slot I/O space size, and I/O address of a given slot.
47: */
48: #define EISA_SLOT_SIZE 0x1000
49: #define EISA_SLOT_ADDR(s) ((s) * EISA_SLOT_SIZE)
50:
51: /*
52: * Slot offsets for important/standard registers.
53: */
54: #define EISA_SLOTOFF_VID 0xc80 /* offset of vendor id regs */
55: #define EISA_NVIDREGS 2
56: #define EISA_SLOTOFF_PID 0xc82 /* offset of product id regs */
57: #define EISA_NPIDREGS 2
58:
59: #ifdef AHA284X_HACK
60: /*
61: * AHA-284x (VL bus) requires priming a register with the following values.
62: */
63: #define EISA_SLOTOFF_PRIMING EISA_SLOTOFF_VID /* offset */
64: #define EISA_PRIMING_VID(index) (0x80 + (index)) /* value for vendor */
65: #define EISA_PRIMING_PID(index) (0x82 + (index)) /* value for product */
66: #endif
67:
68: /*
69: * EISA ID functions, used to manipulate and decode EISA ID registers.
70: * ``Somebody was let out without adult supervision.''
71: */
72:
73: #define EISA_IDSTRINGLEN 8 /* length of ID string, incl. NUL */
74:
75: /*
76: * Vendor ID: three characters, encoded in 16 bits.
77: *
78: * EISA_VENDID_NODEV returns true if there's no device in the slot.
79: * EISA_VENDID_IDDELAY returns true if there's a device in the slot,
80: * but that device hasn't been configured by system firmware.
81: * EISA_VENDID_n returns the "n"th character of the vendor ID.
82: */
83: #define EISA_VENDID_NODEV(vid) \
84: (((vid)[0] & 0x80) != 0)
85: #define EISA_VENDID_IDDELAY(vid) \
86: (((vid)[0] & 0xf0) == 0x70)
87: #define EISA_VENDID_0(vid) \
88: ((((vid)[0] & 0x7c) >> 2) + '@')
89: #define EISA_VENDID_1(vid) \
90: (((((vid)[0] & 0x03) << 3) | (((vid)[1] & 0xe0) >> 5)) + '@')
91: #define EISA_VENDID_2(vid) \
92: (((vid)[1] & 0x1f) + '@')
93:
94: /*
95: * Product ID: four hex digits, encoded in 16 bits (normal, sort of).
96: *
97: * EISA_PRIDID_n returns the "n"th hex digit of the product ID.
98: */
99: #define __EISA_HEX_MAP "0123456789ABCDEF"
100: #define EISA_PRODID_0(pid) \
101: (__EISA_HEX_MAP[(((pid)[0] >> 4) & 0xf)])
102: #define EISA_PRODID_1(pid) \
103: (__EISA_HEX_MAP[(((pid)[0] >> 0) & 0xf)])
104: #define EISA_PRODID_2(pid) \
105: (__EISA_HEX_MAP[(((pid)[1] >> 4) & 0xf)])
106: #define EISA_PRODID_3(pid) \
107: (__EISA_HEX_MAP[(((pid)[1] >> 0) & 0xf)])
108:
109: #endif /* !__DEV_EISA_EISAREG_H__ */
CVSweb