The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/kernel/system/do_devio.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* The kernel call implemented in this file:
    2  *   m_type:    SYS_DEVIO
    3  *
    4  * The parameters for this kernel call are:
    5  *   m2_i3:     DIO_REQUEST     (request input or output)       
    6  *   m2_i1:     DIO_TYPE        (flag indicating byte, word, or long)
    7  *   m2_l1:     DIO_PORT        (port to read/ write)   
    8  *   m2_l2:     DIO_VALUE       (value to write/ return value read)     
    9  */
   10 
   11 #include "../system.h"
   12 #include <minix/devio.h>
   13 
   14 #if USE_DEVIO
   15 
   16 /*===========================================================================*
   17  *                              do_devio                                     *
   18  *===========================================================================*/
   19 PUBLIC int do_devio(m_ptr)
   20 register message *m_ptr;        /* pointer to request message */
   21 {
   22 /* Process a single I/O request for byte, word, and long values. */
   23     if (m_ptr->DIO_REQUEST == DIO_INPUT) { 
   24       switch (m_ptr->DIO_TYPE) {
   25         case DIO_BYTE: m_ptr->DIO_VALUE = inb(m_ptr->DIO_PORT); break; 
   26         case DIO_WORD: m_ptr->DIO_VALUE = inw(m_ptr->DIO_PORT); break; 
   27         case DIO_LONG: m_ptr->DIO_VALUE = inl(m_ptr->DIO_PORT); break; 
   28         default: return(EINVAL);
   29       } 
   30     } else { 
   31       switch (m_ptr->DIO_TYPE) {
   32         case DIO_BYTE: outb(m_ptr->DIO_PORT, m_ptr->DIO_VALUE); break;  
   33         case DIO_WORD: outw(m_ptr->DIO_PORT, m_ptr->DIO_VALUE); break;  
   34         case DIO_LONG: outl(m_ptr->DIO_PORT, m_ptr->DIO_VALUE); break;  
   35         default: return(EINVAL);
   36       } 
   37     }
   38     return(OK);
   39 }
   40 
   41 #endif /* USE_DEVIO */

Cache object: cf53db0f36dd052da686c84414b74fc2


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.