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