Annotation of kernel/machdep/i386/io_inline.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /*
                     26:  * Copyright (c) 1992 NeXT Computer, Inc.
                     27:  *
                     28:  * Inlines for io space access.
                     29:  *
                     30:  * HISTORY
                     31:  *
                     32:  * 20 May 1992 ? at NeXT
                     33:  *     Created.
                     34:  */
                     35:  
                     36: #import <architecture/i386/io.h>
                     37: 
                     38: #if    !defined(DEFINE_INLINE_FUNCTIONS)
                     39: static
                     40: #endif
                     41: inline
                     42: unsigned char
                     43: inb(
                     44:     io_addr_t          port
                     45: )
                     46: {
                     47:     unsigned char      data;
                     48:     
                     49:     asm volatile(
                     50:        "inb %1,%0"
                     51:        
                     52:        : "=a" (data)
                     53:        : "d" (port));
                     54:        
                     55:     return (data);
                     56: }
                     57:  
                     58: #if    !defined(DEFINE_INLINE_FUNCTIONS)
                     59: static
                     60: #endif
                     61: inline
                     62: unsigned short
                     63: inw(
                     64:     io_addr_t          port
                     65: )
                     66: {
                     67:     unsigned short     data;
                     68:     
                     69:     asm volatile(
                     70:        "inw %1,%0"
                     71:        
                     72:        : "=a" (data)
                     73:        : "d" (port));
                     74:        
                     75:     return (data);
                     76: }
                     77: 
                     78: #if    !defined(DEFINE_INLINE_FUNCTIONS)
                     79: static
                     80: #endif
                     81: inline
                     82: unsigned short
                     83: inl(
                     84:     io_addr_t          port
                     85: )
                     86: {
                     87:     unsigned short     data;
                     88:     
                     89:     asm volatile(
                     90:        "inl %1,%0"
                     91:        
                     92:        : "=a" (data)
                     93:        : "d" (port));
                     94:        
                     95:     return (data);
                     96: }
                     97: 
                     98: #if    !defined(DEFINE_INLINE_FUNCTIONS)
                     99: static
                    100: #endif
                    101: inline
                    102: void
                    103: outb(
                    104:     io_addr_t          port,
                    105:     unsigned char      data
                    106: )
                    107: {
                    108:     static int         xxx;
                    109: 
                    110:     asm volatile(
                    111:        "outb %2,%1; lock; incl %0"
                    112:        
                    113:        : "=m" (xxx)
                    114:        : "d" (port), "a" (data), "0" (xxx)
                    115:        : "cc");
                    116: }
                    117: 
                    118: #if    !defined(DEFINE_INLINE_FUNCTIONS)
                    119: static
                    120: #endif
                    121: inline
                    122: void
                    123: outw(
                    124:     io_addr_t          port,
                    125:     unsigned short     data
                    126: )
                    127: {
                    128:     static int         xxx;
                    129: 
                    130:     asm volatile(
                    131:        "outw %2,%1; lock; incl %0"
                    132:        
                    133:        : "=m" (xxx)
                    134:        : "d" (port), "a" (data), "0" (xxx)
                    135:        : "cc");
                    136: }
                    137: 
                    138: #if    !defined(DEFINE_INLINE_FUNCTIONS)
                    139: static
                    140: #endif
                    141: inline
                    142: void
                    143: outl(
                    144:     io_addr_t          port,
                    145:     unsigned short     data
                    146: )
                    147: {
                    148:     static int         xxx;
                    149: 
                    150:     asm volatile(
                    151:        "outl %2,%1; lock; incl %0"
                    152:        
                    153:        : "=m" (xxx)
                    154:        : "d" (port), "a" (data), "0" (xxx)
                    155:        : "cc");
                    156: }
                    157: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.