1*ddbadf8aSderaadt /* $OpenBSD: eisareg.h,v 1.4 1996/05/05 12:42:24 deraadt Exp $ */ 2d724e01aSderaadt /* $NetBSD: eisareg.h,v 1.3 1996/04/09 22:46:13 cgd Exp $ */ 3df930be7Sderaadt 4df930be7Sderaadt /* 58bd19141Sniklas * Copyright (c) 1995, 1996 Christopher G. Demetriou 6df930be7Sderaadt * All rights reserved. 7df930be7Sderaadt * 8df930be7Sderaadt * Redistribution and use in source and binary forms, with or without 9df930be7Sderaadt * modification, are permitted provided that the following conditions 10df930be7Sderaadt * are met: 11df930be7Sderaadt * 1. Redistributions of source code must retain the above copyright 12df930be7Sderaadt * notice, this list of conditions and the following disclaimer. 13df930be7Sderaadt * 2. Redistributions in binary form must reproduce the above copyright 14df930be7Sderaadt * notice, this list of conditions and the following disclaimer in the 15df930be7Sderaadt * documentation and/or other materials provided with the distribution. 16df930be7Sderaadt * 3. All advertising materials mentioning features or use of this software 17df930be7Sderaadt * must display the following acknowledgement: 18df930be7Sderaadt * This product includes software developed by Christopher G. Demetriou 19df930be7Sderaadt * for the NetBSD Project. 20df930be7Sderaadt * 4. The name of the author may not be used to endorse or promote products 21df930be7Sderaadt * derived from this software without specific prior written permission 22df930be7Sderaadt * 23df930be7Sderaadt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24df930be7Sderaadt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25df930be7Sderaadt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26df930be7Sderaadt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 27df930be7Sderaadt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28df930be7Sderaadt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29df930be7Sderaadt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30df930be7Sderaadt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31df930be7Sderaadt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32df930be7Sderaadt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33df930be7Sderaadt */ 34df930be7Sderaadt 358bd19141Sniklas #ifndef __DEV_EISA_EISAREG_H__ 368bd19141Sniklas #define __DEV_EISA_EISAREG_H__ 378bd19141Sniklas 38df930be7Sderaadt /* 398bd19141Sniklas * Register (etc.) descriptions for the EISA bus. 408bd19141Sniklas 418bd19141Sniklas * Mostly culled from EISA chipset descriptions in: 428bd19141Sniklas * Intel Peripheral Components Databook (1992) 43df930be7Sderaadt */ 448bd19141Sniklas 458bd19141Sniklas /* 468bd19141Sniklas * Slot I/O space size, and I/O address of a given slot. 478bd19141Sniklas */ 488bd19141Sniklas #define EISA_SLOT_SIZE 0x1000 498bd19141Sniklas #define EISA_SLOT_ADDR(s) ((s) * EISA_SLOT_SIZE) 508bd19141Sniklas 518bd19141Sniklas /* 528bd19141Sniklas * Slot offsets for important/standard registers. 538bd19141Sniklas */ 548bd19141Sniklas #define EISA_SLOTOFF_VID 0xc80 /* offset of vendor id regs */ 558bd19141Sniklas #define EISA_NVIDREGS 2 568bd19141Sniklas #define EISA_SLOTOFF_PID 0xc82 /* offset of product id regs */ 578bd19141Sniklas #define EISA_NPIDREGS 2 588bd19141Sniklas 59*ddbadf8aSderaadt #ifdef AHA284X_HACK 60*ddbadf8aSderaadt /* 61*ddbadf8aSderaadt * AHA-284x (VL bus) requires priming a register with the following values. 62*ddbadf8aSderaadt */ 63*ddbadf8aSderaadt #define EISA_SLOTOFF_PRIMING EISA_SLOTOFF_VID /* offset */ 64*ddbadf8aSderaadt #define EISA_PRIMING_VID(index) (0x80 + (index)) /* value for vendor */ 65*ddbadf8aSderaadt #define EISA_PRIMING_PID(index) (0x82 + (index)) /* value for product */ 66*ddbadf8aSderaadt #endif 678bd19141Sniklas 688bd19141Sniklas /* 698bd19141Sniklas * EISA ID functions, used to manipulate and decode EISA ID registers. 708bd19141Sniklas * ``Somebody was let out without adult supervision.'' 718bd19141Sniklas */ 728bd19141Sniklas 738bd19141Sniklas #define EISA_IDSTRINGLEN 8 /* length of ID string, incl. NUL */ 748bd19141Sniklas 758bd19141Sniklas /* 768bd19141Sniklas * Vendor ID: three characters, encoded in 16 bits. 778bd19141Sniklas * 788bd19141Sniklas * EISA_VENDID_NODEV returns true if there's no device in the slot. 798bd19141Sniklas * EISA_VENDID_IDDELAY returns true if there's a device in the slot, 808bd19141Sniklas * but that device hasn't been configured by system firmware. 818bd19141Sniklas * EISA_VENDID_n returns the "n"th character of the vendor ID. 828bd19141Sniklas */ 838bd19141Sniklas #define EISA_VENDID_NODEV(vid) \ 848bd19141Sniklas (((vid)[0] & 0x80) != 0) 858bd19141Sniklas #define EISA_VENDID_IDDELAY(vid) \ 868bd19141Sniklas (((vid)[0] & 0xf0) == 0x70) 878bd19141Sniklas #define EISA_VENDID_0(vid) \ 888bd19141Sniklas ((((vid)[0] & 0x7c) >> 2) + '@') 898bd19141Sniklas #define EISA_VENDID_1(vid) \ 908bd19141Sniklas (((((vid)[0] & 0x03) << 3) | (((vid)[1] & 0xe0) >> 5)) + '@') 918bd19141Sniklas #define EISA_VENDID_2(vid) \ 928bd19141Sniklas (((vid)[1] & 0x1f) + '@') 938bd19141Sniklas 948bd19141Sniklas /* 958bd19141Sniklas * Product ID: four hex digits, encoded in 16 bits (normal, sort of). 968bd19141Sniklas * 978bd19141Sniklas * EISA_PRIDID_n returns the "n"th hex digit of the product ID. 988bd19141Sniklas */ 998bd19141Sniklas #define __EISA_HEX_MAP "0123456789ABCDEF" 1008bd19141Sniklas #define EISA_PRODID_0(pid) \ 1018bd19141Sniklas (__EISA_HEX_MAP[(((pid)[0] >> 4) & 0xf)]) 1028bd19141Sniklas #define EISA_PRODID_1(pid) \ 1038bd19141Sniklas (__EISA_HEX_MAP[(((pid)[0] >> 0) & 0xf)]) 1048bd19141Sniklas #define EISA_PRODID_2(pid) \ 1058bd19141Sniklas (__EISA_HEX_MAP[(((pid)[1] >> 4) & 0xf)]) 1068bd19141Sniklas #define EISA_PRODID_3(pid) \ 1078bd19141Sniklas (__EISA_HEX_MAP[(((pid)[1] >> 0) & 0xf)]) 1088bd19141Sniklas 1098bd19141Sniklas #endif /* !__DEV_EISA_EISAREG_H__ */ 110