[BACK]Return to dioreg.h CVS log [TXT][DIR] Up to [local] / sys / arch / hp300 / dev

Annotation of sys/arch/hp300/dev/dioreg.h, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: dioreg.h,v 1.4 2007/01/07 15:12:19 miod Exp $ */
        !             2: /*     $NetBSD: dioreg.h,v 1.3 1997/01/30 09:18:40 thorpej Exp $       */
        !             3:
        !             4: /*-
        !             5:  * Copyright (c) 1996 The NetBSD Foundation, Inc.
        !             6:  * All rights reserved.
        !             7:  *
        !             8:  * This code is derived from software contributed to The NetBSD Foundation
        !             9:  * by Jason R. Thorpe.
        !            10:  *
        !            11:  * Portions of this file are derived from software contributed to Berkeley
        !            12:  * by the Systems Programming Group of the University of Utah Computer
        !            13:  * Science Department.
        !            14:  *
        !            15:  * Redistribution and use in source and binary forms, with or without
        !            16:  * modification, are permitted provided that the following conditions
        !            17:  * are met:
        !            18:  * 1. Redistributions of source code must retain the above copyright
        !            19:  *    notice, this list of conditions and the following disclaimer.
        !            20:  * 2. Redistributions in binary form must reproduce the above copyright
        !            21:  *    notice, this list of conditions and the following disclaimer in the
        !            22:  *    documentation and/or other materials provided with the distribution.
        !            23:  * 3. All advertising materials mentioning features or use of this software
        !            24:  *    must display the following acknowledgement:
        !            25:  *        This product includes software developed by the NetBSD
        !            26:  *        Foundation, Inc. and its contributors.
        !            27:  * 4. Neither the name of The NetBSD Foundation nor the names of its
        !            28:  *    contributors may be used to endorse or promote products derived
        !            29:  *    from this software without specific prior written permission.
        !            30:  *
        !            31:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
        !            32:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
        !            33:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
        !            34:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
        !            35:  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
        !            36:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
        !            37:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
        !            38:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
        !            39:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        !            40:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
        !            41:  * POSSIBILITY OF SUCH DAMAGE.
        !            42:  */
        !            43:
        !            44: /*
        !            45:  * Register definitions for the DIO and DIO-II bus.
        !            46:  */
        !            47:
        !            48: /*
        !            49:  * DIO/DIO-II device registers, offsets from base of device.  All
        !            50:  * registers are 8-bit.
        !            51:  */
        !            52: #define        DIO_IDOFF               0x01    /* primary device id */
        !            53: #define        DIO_IPLOFF              0x03    /* interrupt level */
        !            54: #define DIO_SECIDOFF           0x15    /* secondary device id */
        !            55: #define        DIOII_SIZEOFF           0x101   /* device size */
        !            56:
        !            57: /*
        !            58:  * System physical addresses of some `special' DIO devices.
        !            59:  */
        !            60: #define        DIO_IHPIBADDR           0x478000 /* internal HP-IB; select code 7 */
        !            61:
        !            62: /*
        !            63:  * DIO ranges from select codes 0-63 at physical addresses given by:
        !            64:  *     0x600000 + (sc - 32) * 0x10000
        !            65:  * DIO cards are addressed in the range 0-31 [0x600000-0x800000) for
        !            66:  * their control space and the remaining areas, [0x200000-0x400000) and
        !            67:  * [0x800000-0x1000000), are for additional space required by a card;
        !            68:  * e.g. a display framebuffer.
        !            69:  *
        !            70:  * DIO-II ranges from select codes 132-255 at physical addresses given by:
        !            71:  *     0x1000000 + (sc - 132) * 0x400000
        !            72:  * The address range of DIO-II space is thus [0x1000000-0x20000000).
        !            73:  *
        !            74:  * DIO/DIO-II space is too large to map in its entirety, instead devices
        !            75:  * are mapped into kernel virtual address space allocated from a range
        !            76:  * of EIOMAPSIZE pages (vmparam.h) starting at ``extiobase''.
        !            77:  */
        !            78: #define        DIO_BASE                0x600000        /* start of DIO space */
        !            79: #define        DIO_END                 0x1000000       /* end of DIO space */
        !            80: #define        DIO_DEVSIZE             0x10000         /* size of a DIO device */
        !            81:
        !            82: #define        DIOII_BASE              0x01000000      /* start of DIO-II space */
        !            83: #define        DIOII_END               0x20000000      /* end of DIO-II space */
        !            84: #define        DIOII_DEVSIZE           0x00400000      /* size of a DIO-II device */
        !            85:
        !            86: /*
        !            87:  * Find the highest select code for a given machine; HP320 doesn't
        !            88:  * have DIO-II.
        !            89:  */
        !            90: #if defined(HP320)
        !            91: #define        DIO_SCMAX(machineid)    ((machineid) == HP_320 ? 32 : 256)
        !            92: #else
        !            93: #define        DIO_SCMAX(machineid)    256
        !            94: #endif
        !            95:
        !            96: /*
        !            97:  * Base of DIO-II select codes.
        !            98:  */
        !            99: #define        DIOII_SCBASE            132
        !           100:
        !           101: /*
        !           102:  * Macro that returns true if a select code lies within
        !           103:  * the select code `hole'.
        !           104:  */
        !           105: #define        DIO_INHOLE(scode)       ((scode) >= 32 && (scode) < DIOII_SCBASE)
        !           106:
        !           107: /*
        !           108:  * Macros to determine if device is DIO or DIO-II.
        !           109:  */
        !           110: #define        DIO_ISDIO(scode)        ((scode) >= 0 && (scode) < 32)
        !           111: #define        DIO_ISDIOII(scode)      ((scode) >= DIOII_SCBASE && (scode) < 256)
        !           112:
        !           113: /*
        !           114:  * Macro to determine if device is a framebuffer, given the
        !           115:  * primary id of the device.  We key off this to determine if
        !           116:  * we should look at secondary id and ignore interrupt level.
        !           117:  */
        !           118: #define        DIO_ISFRAMEBUFFER(id)           \
        !           119:        ((id) == DIO_DEVICE_ID_FRAMEBUFFER)
        !           120:
        !           121: /*
        !           122:  * Macro to extract primary and decondary device ids, given
        !           123:  * the base address of the device.
        !           124:  */
        !           125: #define        DIO_ID(base)                    \
        !           126:        (*((u_int8_t *)((u_long)(base) + DIO_IDOFF)))
        !           127: #define        DIO_SECID(base)                 \
        !           128:        (*((u_int8_t *)((u_long)(base) + DIO_SECIDOFF)))
        !           129:
        !           130: /*
        !           131:  * Macro to extract the interrupt level, given the
        !           132:  * base address of the device.
        !           133:  */
        !           134: #define        DIO_IPL(base)                   \
        !           135:        ((((*((u_int8_t *)((u_long)(base) + DIO_IPLOFF))) >> 4) & 0x03) + 3)
        !           136:
        !           137: /*
        !           138:  * Macro to compute the size of a DIO-II device's address
        !           139:  * space, given the base address of the device.
        !           140:  */
        !           141: #define DIOII_SIZE(base)               \
        !           142:        ((int)((*((u_int8_t *)((u_long)(base) + DIOII_SIZEOFF)) + 1)    \
        !           143:            * 0x100000))
        !           144:
        !           145: /*
        !           146:  * Given a select code and device base address, compute
        !           147:  * the size of the DIO/DIO-II device.
        !           148:  */
        !           149: #define        DIO_SIZE(scode, base)           \
        !           150:        (DIO_ISDIOII((scode)) ? DIOII_SIZE((base)) : DIO_DEVSIZE)

CVSweb