Home | History | Annotate | Line # | Download | only in eisa
eisareg.h revision 1.2
      1  1.2  cgd /*	$NetBSD: eisareg.h,v 1.2 1996/02/27 00:21:02 cgd 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.2  cgd 
     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  * Max number of EISA slots in a machine.  64K I/O space total.
     46  1.2  cgd  */
     47  1.2  cgd #define	EISA_MAX_SLOT		16	/* number of slots.  0 -> 0xf */
     48  1.2  cgd 
     49  1.2  cgd /*
     50  1.2  cgd  * Slot I/O space size, and I/O address of a given slot.
     51  1.2  cgd  */
     52  1.2  cgd #define	EISA_SLOT_SIZE		0x1000
     53  1.2  cgd #define	EISA_SLOT_ADDR(s)	((s) * EISA_SLOT_SIZE)
     54  1.2  cgd 
     55  1.2  cgd /*
     56  1.2  cgd  * Slot offsets for important/standard registers.
     57  1.2  cgd  */
     58  1.2  cgd #define	EISA_SLOTOFF_VID	0xc80		/* offset of vendor id regs */
     59  1.2  cgd #define	EISA_NVIDREGS		2
     60  1.2  cgd #define	EISA_SLOTOFF_PID	0xc82		/* offset of product id regs */
     61  1.2  cgd #define	EISA_NPIDREGS		2
     62  1.2  cgd 
     63  1.2  cgd 
     64  1.2  cgd /*
     65  1.2  cgd  * EISA ID functions, used to manipulate and decode EISA ID registers.
     66  1.2  cgd  * ``Somebody was let out without adult supervision.''
     67  1.2  cgd  */
     68  1.2  cgd 
     69  1.2  cgd #define	EISA_IDSTRINGLEN	8	/* length of ID string, incl. NUL */
     70  1.2  cgd 
     71  1.2  cgd /*
     72  1.2  cgd  * Vendor ID: three characters, encoded in 16 bits.
     73  1.2  cgd  *
     74  1.2  cgd  * EISA_VENDID_NODEV returns true if there's no device in the slot.
     75  1.2  cgd  * EISA_VENDID_IDDELAY returns true if there's a device in the slot,
     76  1.2  cgd  *	but that device hasn't been configured by system firmware.
     77  1.2  cgd  * EISA_VENDID_n returns the "n"th character of the vendor ID.
     78  1.2  cgd  */
     79  1.2  cgd #define	EISA_VENDID_NODEV(vid)						\
     80  1.2  cgd 	    (((vid)[0] & 0x80) != 0)
     81  1.2  cgd #define	EISA_VENDID_IDDELAY(vid)					\
     82  1.2  cgd 	    (((vid)[0] & 0xf0) == 0x70)
     83  1.2  cgd #define	EISA_VENDID_0(vid)						\
     84  1.2  cgd 	    ((((vid)[0] & 0x7c) >> 2) + '@')
     85  1.2  cgd #define	EISA_VENDID_1(vid)						\
     86  1.2  cgd 	    (((((vid)[0] & 0x03) << 3) | (((vid)[1] & 0xe0) >> 5)) + '@')
     87  1.2  cgd #define	EISA_VENDID_2(vid)						\
     88  1.2  cgd 	    (((vid)[1] & 0x1f) + '@')
     89  1.2  cgd 
     90  1.2  cgd /*
     91  1.2  cgd  * Product ID: four hex digits, encoded in 16 bits (normal, sort of).
     92  1.2  cgd  *
     93  1.2  cgd  * EISA_PRIDID_n returns the "n"th hex digit of the product ID.
     94  1.2  cgd  */
     95  1.2  cgd #define	__EISA_HEX_MAP	"0123456789ABCDEF"
     96  1.2  cgd #define	EISA_PRODID_0(pid)						\
     97  1.2  cgd 	    (__EISA_HEX_MAP[(((pid)[0] >> 4) & 0xf)])
     98  1.2  cgd #define	EISA_PRODID_1(pid)						\
     99  1.2  cgd 	    (__EISA_HEX_MAP[(((pid)[0] >> 0) & 0xf)])
    100  1.2  cgd #define	EISA_PRODID_2(pid)						\
    101  1.2  cgd 	    (__EISA_HEX_MAP[(((pid)[1] >> 4) & 0xf)])
    102  1.2  cgd #define	EISA_PRODID_3(pid)						\
    103  1.2  cgd 	    (__EISA_HEX_MAP[(((pid)[1] >> 0) & 0xf)])
    104  1.2  cgd 
    105  1.2  cgd #endif /* !__DEV_EISA_EISAREG_H__ */
    106