[BACK]Return to isafcns_jensen.c CVS log [TXT][DIR] Up to [local] / sys / arch / alpha / isa

Annotation of sys/arch/alpha/isa/isafcns_jensen.c, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: isafcns_jensen.c,v 1.7 2002/06/25 21:33:21 miod Exp $ */
        !             2: /*     $NetBSD: isafcns_jensen.c,v 1.4 1996/10/13 02:59:54 christos Exp $      */
        !             3:
        !             4: /*
        !             5:  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
        !             6:  * All rights reserved.
        !             7:  *
        !             8:  * Author: Chris G. Demetriou
        !             9:  *
        !            10:  * Permission to use, copy, modify and distribute this software and
        !            11:  * its documentation is hereby granted, provided that both the copyright
        !            12:  * notice and this permission notice appear in all copies of the
        !            13:  * software, derivative works or modified versions, and any portions
        !            14:  * thereof, and that both notices appear in supporting documentation.
        !            15:  *
        !            16:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
        !            17:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
        !            18:  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
        !            19:  *
        !            20:  * Carnegie Mellon requests users of this software to return to
        !            21:  *
        !            22:  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
        !            23:  *  School of Computer Science
        !            24:  *  Carnegie Mellon University
        !            25:  *  Pittsburgh PA 15213-3890
        !            26:  *
        !            27:  * any improvements or extensions that they make and grant Carnegie the
        !            28:  * rights to redistribute these changes.
        !            29:  */
        !            30:
        !            31: #include <sys/types.h>
        !            32: #include <machine/pio.h>
        !            33: #include <machine/pte.h>
        !            34:
        !            35: static u_int8_t                jensen_inb(int port);
        !            36: /* static void         jensen_insb(int port, void *addr, int cnt); */
        !            37: static u_int16_t       jensen_inw(int port);
        !            38: /* static void         jensen_insw(int port, void *addr, int cnt); */
        !            39: u_int32_t              jensen_inl(int port);
        !            40: /* static void         jensen_insl(int port, void *addr, int cnt); */
        !            41:
        !            42: static void            jensen_outb(int port, u_int8_t datum);
        !            43: /* static void         jensen_outsb(int port, void *addr, int cnt); */
        !            44: static void            jensen_outw(int port, u_int16_t datum);
        !            45: /* static void         jensen_outsw(int port, void *addr, int cnt); */
        !            46: static void            jensen_outl(int port, u_int32_t datum);
        !            47: /* static void         jensen_outsl(int port, void *addr, int cnt); */
        !            48:
        !            49: struct alpha_isafcndesc jensen_isafcns = {
        !            50:        jensen_inb,     0 /* jensen_insb */,
        !            51:        jensen_inw,     0 /* jensen_insw */,
        !            52:        jensen_inl,     0 /* jensen_insl */,
        !            53:        jensen_outb,    0 /* jensen_outsb */,
        !            54:        jensen_outw,    0 /* jensen_outsw */,
        !            55:        jensen_outl,    0 /* jensen_outsl */,
        !            56: };
        !            57:
        !            58: u_int8_t
        !            59: jensen_inb(ioaddr)
        !            60:        int ioaddr;
        !            61: {
        !            62:        u_int32_t *port, val;
        !            63:        u_int8_t rval;
        !            64:        int offset;
        !            65:
        !            66:        offset = ioaddr & 3;
        !            67:        port = (int32_t *)phystok0seg(0x300000000L | 0 << 5 | ioaddr << 7);
        !            68:        val = *port;
        !            69:        rval = ((val) >> (8 * offset)) & 0xff;
        !            70:        rval = val & 0xff;
        !            71:
        !            72: printf("inb(0x%x) => 0x%x @ %p => 0x%x\n", ioaddr, val, port, rval);
        !            73:
        !            74:        return rval;
        !            75: }
        !            76:
        !            77: u_int16_t
        !            78: jensen_inw(ioaddr)
        !            79:        int ioaddr;
        !            80: {
        !            81:        u_int32_t *port, val;
        !            82:        u_int16_t rval;
        !            83:        int offset;
        !            84:
        !            85:        offset = ioaddr & 3;
        !            86:        port = (int32_t *)phystok0seg(0x300000000L | 1 << 5 | ioaddr << 7);
        !            87:        val = *port;
        !            88:        rval = ((val) >> (8 * offset)) & 0xffff;
        !            89:        rval = val & 0xffff;
        !            90:
        !            91: printf("inw(0x%x) => 0x%x @ %p => 0x%x", ioaddr, val, port, rval);
        !            92:
        !            93:        return rval;
        !            94: }
        !            95:
        !            96: u_int32_t
        !            97: jensen_inl(ioaddr)
        !            98:        int ioaddr;
        !            99: {
        !           100:        u_int32_t *port, val;
        !           101:        u_int32_t rval;
        !           102:        int offset;
        !           103:
        !           104:        offset = ioaddr & 3;
        !           105:        port = (int32_t *)phystok0seg(0x300000000L | 3 << 5 | ioaddr << 7);
        !           106:        val = *port;
        !           107:        rval = ((val) >> (8 * offset)) & 0xffffffff;
        !           108:        rval = val & 0xffffffff;
        !           109:
        !           110: printf("inl(0x%x) => 0x%x @ %p => 0x%x\n", ioaddr, val, port, rval);
        !           111:
        !           112:        return rval;
        !           113: }
        !           114:
        !           115: void
        !           116: jensen_outb(ioaddr, val)
        !           117:        int ioaddr;
        !           118:        u_int8_t val;
        !           119: {
        !           120:        u_int32_t *port, nval;
        !           121:        int offset;
        !           122:
        !           123:        offset = ioaddr & 3;
        !           124:        nval = val /*<< (8 * offset)*/;
        !           125:        port = (int32_t *)phystok0seg(0x300000000L | 0 << 5 | ioaddr << 7);
        !           126:
        !           127: printf("outb(0x%x, 0x%x) => 0x%x @ %p\n", ioaddr, val, nval, port);
        !           128:
        !           129:        *port = nval;
        !           130: }
        !           131:
        !           132: void
        !           133: jensen_outw(ioaddr, val)
        !           134:        int ioaddr;
        !           135:        u_int16_t val;
        !           136: {
        !           137:        u_int32_t *port, nval;
        !           138:        int offset;
        !           139:
        !           140:        offset = ioaddr & 3;
        !           141:        nval = val /*<< (8 * offset)*/;
        !           142:        port = (int32_t *)phystok0seg(0x300000000L | 1 << 5 | ioaddr << 7);
        !           143:
        !           144: printf("outb(0x%x, 0x%x) => 0x%x @ %p\n", ioaddr, val, nval, port);
        !           145:
        !           146:        *port = nval;
        !           147: }
        !           148:
        !           149: void
        !           150: jensen_outl(ioaddr, val)
        !           151:        int ioaddr;
        !           152:        u_int32_t val;
        !           153: {
        !           154:        u_int32_t *port, nval;
        !           155:        int offset;
        !           156:
        !           157:        offset = ioaddr & 3;
        !           158:        nval = val /*<< (8 * offset)*/;
        !           159:        port = (int32_t *)phystok0seg(0x300000000L | 3 << 5 | ioaddr << 7);
        !           160:
        !           161: printf("outb(0x%x, 0x%x) => 0x%x @ %p\n", ioaddr, val, nval, port);
        !           162:
        !           163:        *port = nval;
        !           164: }

CVSweb