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