Annotation of coherent/f/etc/conf/streams/src/x86io.c, revision 1.1.1.1

1.1       root        1: #define        _DDI_DKI        1
                      2: #define        _SYSV4          1
                      3: 
                      4: /*
                      5:  * This file exists to provide external-linkage versions of the normally
                      6:  * inline definitions for the 80x86 I/O functions, and to provide manual-page
                      7:  * skeletons for them as well.
                      8:  *
                      9:  * Note that on systems which already provide these functions or where they
                     10:  * cannot be provided in an inline form (such as Coherent, where they must be
                     11:  * implemented in assembly language) this module should be excluded from the
                     12:  * library builds, but should be kept for documentation extraction.
                     13:  */
                     14: 
                     15: /*
                     16:  *-IMPORTS:
                     17:  *     <common/ccompat.h>
                     18:  *             __USE_PROTO__
                     19:  *             __ARGS ()
                     20:  *     <sys/types.h>
                     21:  *             uchar_t
                     22:  *             ushort_t
                     23:  *             ulong_t
                     24:  */
                     25: 
                     26: #include <common/ccompat.h>
                     27: #include <sys/types.h>
                     28: 
                     29: #include <kernel/x86io.h>
                     30: 
                     31: #if    ! defined (repinsb) || ! defined (repinsd) || ! defined (repinsw) \
                     32:                || ! defined (repoutsb) || ! defined (repoutsd) || ! defined (repoutsw) \
                     33:                || ! defined (inb) || ! defined (inl) || ! defined (inw) \
                     34:                || ! defined (outb) || ! defined (outl) || ! defined (outw)
                     35: #error This module expects preprocessor definitions for the I/O functions
                     36: #endif
                     37: 
                     38: /*
                     39:  *-STATUS:
                     40:  *     DDI/DKI
                     41:  *
                     42:  *-NAME:
                     43:  *     inb             Read a byte from an 8-bit I/O port
                     44:  *
                     45:  *-ARGUMENTS:
                     46:  *     port            A valid 8-bit I/O port
                     47:  *
                     48:  *-DESCRIPTION:
                     49:  *     This function provides a C-language interface to the machine
                     50:  *     instruction that reads a byte from an 8-bit I/O port using the I/O
                     51:  *     address space instead of the memory address space.
                     52:  *
                     53:  *-RETURN VALUE:
                     54:  *     Returns the value of the byte read from the I/O port.
                     55:  *
                     56:  *-LEVEL:
                     57:  *     Base or Interrupt.
                     58:  *
                     59:  *-NOTES:
                     60:  *     Does not sleep.
                     61:  *
                     62:  *     Driver-defined basic locks, read/write locks, and sleep locks may be
                     63:  *     held across calls to this function.
                     64:  *
                     65:  *     This function may not be meaningful on all implementations because
                     66:  *     some implementations may not support I/O-mapped I/O.
                     67:  */
                     68: 
                     69: #if    __USE_PROTO__
                     70: uchar_t (inb) (int port)
                     71: #else
                     72: uchar_t
                     73: inb __ARGS ((port))
                     74: int            port;
                     75: #endif
                     76: {
                     77:        return inb (port);
                     78: }
                     79: 
                     80: 
                     81: 
                     82: /*
                     83:  *-STATUS:
                     84:  *     DDI/DKI
                     85:  *
                     86:  *-NAME:
                     87:  *     inl             Read a 32-bit long word from a 32-bit I/O port
                     88:  *
                     89:  *-ARGUMENTS:
                     90:  *     port            A valid 32-bit I/O port
                     91:  *
                     92:  *-DESCRIPTION:
                     93:  *     This function provides a C-language interface to the machine
                     94:  *     instruction that reads a 32-bit long word from a 32-bit I/O port using
                     95:  *     the I/O address space instead of the memory address space.
                     96:  *
                     97:  *-RETURN VALUE:
                     98:  *     Returns the value of the 32-bit word read from the I/O port.
                     99:  *
                    100:  *-LEVEL:
                    101:  *     Base or Interrupt.
                    102:  *
                    103:  *-NOTES:
                    104:  *     Does not sleep.
                    105:  *
                    106:  *     Driver-defined basic locks, read/write locks, and sleep locks may be
                    107:  *     held across calls to this function.
                    108:  *
                    109:  *     This function may not be meaningful on all implementations because
                    110:  *     some implementations may not support I/O-mapped I/O.
                    111:  */
                    112: 
                    113: #if    __USE_PROTO__
                    114: ulong_t (inl) (int port)
                    115: #else
                    116: ulong_t
                    117: inl __ARGS ((port))
                    118: int            port;
                    119: #endif
                    120: {
                    121:        return inl (port);
                    122: }
                    123: 
                    124: 
                    125: /*
                    126:  *-STATUS:
                    127:  *     DDI/DKI
                    128:  *
                    129:  *-NAME:
                    130:  *     inw             Read a 16-bit short word from a 16-bit I/O port
                    131:  *
                    132:  *-ARGUMENTS:
                    133:  *     port            A valid 16-bit I/O port
                    134:  *
                    135:  *-DESCRIPTION:
                    136:  *     This function provides a C-language interface to the machine
                    137:  *     instruction that reads a 16-bit short word from a 16-bit I/O port
                    138:  *     using the I/O address space instead of the memory address space.
                    139:  *
                    140:  *-RETURN VALUE:
                    141:  *     Returns the value of the 16-bit short word read from the I/O port.
                    142:  *
                    143:  *-LEVEL:
                    144:  *     Base or Interrupt.
                    145:  *
                    146:  *-NOTES:
                    147:  *     Does not sleep.
                    148:  *
                    149:  *     Driver-defined basic locks, read/write locks, and sleep locks may be
                    150:  *     held across calls to this function.
                    151:  *
                    152:  *     This function may not be meaningful on all implementations because
                    153:  *     some implementations may not support I/O-mapped I/O.
                    154:  */
                    155: 
                    156: #if    __USE_PROTO__
                    157: ushort_t (inw) (int port)
                    158: #else
                    159: ushort_t
                    160: inw __ARGS ((port))
                    161: int            port;
                    162: #endif
                    163: {
                    164:        return inw (port);
                    165: }
                    166: 
                    167: 
                    168: 
                    169: /*
                    170:  *-STATUS:
                    171:  *     DDI/DKI
                    172:  *
                    173:  *-NAME:
                    174:  *     outb            Write a byte to an 8-bit I/O port.
                    175:  *
                    176:  *-ARGUMENTS:
                    177:  *     port            A valid 8-bit I/O port.
                    178:  *     data            The 8-bit value to the written to the port.
                    179:  *
                    180:  *-DESCRIPTION:
                    181:  *     This function provides a C-language interface to the machine
                    182:  *     instruction that writes a byte to an 8-bit I/O port using the I/O
                    183:  *     address space instead of the memory address space.
                    184:  *
                    185:  *-RETURN VALUE:
                    186:  *     None.
                    187:  *
                    188:  *-LEVEL:
                    189:  *     Base or Interrupt.
                    190:  *
                    191:  *-NOTES:
                    192:  *     Does not sleep.
                    193:  *
                    194:  *     Driver-defined basic locks, read/write locks, and sleep locks may be
                    195:  *     held across calls to this function.
                    196:  *
                    197:  *     This function may not be meaningful on all implementations because
                    198:  *     some implementations may not support I/O-mapped I/O.
                    199:  */
                    200: 
                    201: #if    __USE_PROTO__
                    202: void (outb) (int port, uchar_t data)
                    203: #else
                    204: void
                    205: outb __ARGS ((port, data))
                    206: int            port;
                    207: uchar_t                data;
                    208: #endif
                    209: {
                    210:        outb (port, data);
                    211: }
                    212: 
                    213: 
                    214: 
                    215: /*
                    216:  *-STATUS:
                    217:  *     DDI/DKI
                    218:  *
                    219:  *-NAME:
                    220:  *     outl            Write a 32-bit long word to a 32-bit I/O port.
                    221:  *
                    222:  *-ARGUMENTS:
                    223:  *     port            A valid 32-bit I/O port.
                    224:  *     data            The 32-bit value to the written to the port.
                    225:  *
                    226:  *-DESCRIPTION:
                    227:  *     This function provides a C-language interface to the machine
                    228:  *     instruction that writes a 32-bit long word to a 32-bit I/O port using
                    229:  *     the I/O address space instead of the memory address space.
                    230:  *
                    231:  *-RETURN VALUE:
                    232:  *     None.
                    233:  *
                    234:  *-LEVEL:
                    235:  *     Base or Interrupt.
                    236:  *
                    237:  *-NOTES:
                    238:  *     Does not sleep.
                    239:  *
                    240:  *     Driver-defined basic locks, read/write locks, and sleep locks may be
                    241:  *     held across calls to this function.
                    242:  *
                    243:  *     This function may not be meaningful on all implementations because
                    244:  *     some implementations may not support I/O-mapped I/O.
                    245:  */
                    246: 
                    247: #if    __USE_PROTO__
                    248: void (outl) (int port, ulong_t value)
                    249: #else
                    250: void
                    251: outl __ARGS ((port, value))
                    252: int            port;
                    253: ulong_t                value;
                    254: #endif
                    255: {
                    256:        outl (port, value);
                    257: }
                    258: 
                    259: 
                    260: 
                    261: /*
                    262:  *-STATUS:
                    263:  *     DDI/DKI
                    264:  *
                    265:  *-NAME:
                    266:  *     outw            Write a 16-bit short word to a 16-bit I/O port.
                    267:  *
                    268:  *-ARGUMENTS:
                    269:  *     port            A valid 16-bit I/O port.
                    270:  *     data            The 16-bit value to the written to the port.
                    271:  *
                    272:  *-DESCRIPTION:
                    273:  *     This function provides a C-language interface to the machine
                    274:  *     instruction that writes a 16-bit short word to a 16-bit I/O port using
                    275:  *     the I/O address space instead of the memory address space.
                    276:  *
                    277:  *-RETURN VALUE:
                    278:  *     None.
                    279:  *
                    280:  *-LEVEL:
                    281:  *     Base or Interrupt.
                    282:  *
                    283:  *-NOTES:
                    284:  *     Does not sleep.
                    285:  *
                    286:  *     Driver-defined basic locks, read/write locks, and sleep locks may be
                    287:  *     held across calls to this function.
                    288:  *
                    289:  *     This function may not be meaningful on all implementations because
                    290:  *     some implementations may not support I/O-mapped I/O.
                    291:  */
                    292: 
                    293: #if    __USE_PROTO__
                    294: void (outw) (int port, ushort_t value)
                    295: #else
                    296: void
                    297: outw __ARGS ((port, value))
                    298: int            port;
                    299: ushort_t       value;
                    300: #endif
                    301: {
                    302:        outw (port, value);
                    303: }
                    304: 
                    305: 
                    306: /*
                    307:  *-STATUS:
                    308:  *     DDI/DKI
                    309:  *
                    310:  *-NAME:
                    311:  *     repinsb         Read bytes from an I/O port to a buffer.
                    312:  *
                    313:  *-ARGUMENTS:
                    314:  *     port            A valid 8-bit I/O port.
                    315:  *     addr            The address of the buffer where data is stored after
                    316:  *                     "cnt" reads of the I/O port.
                    317:  *     cnt             The number of bytes to be read from the I/O port.
                    318:  *
                    319:  *-DESCRIPTION:
                    320:  *     This function provides a C-language interface to the machine
                    321:  *     instructions that read a string of bytes from an 8-bit I/O port using
                    322:  *     the I/O address space instead of the memory address space. The data
                    323:  *     from "cnt" reads of the I/O port is stored in the data buffer pointed
                    324:  *     to by "addr". The data buffer should be at least "cnt" bytes in
                    325:  *     length.
                    326:  *
                    327:  *-RETURN VALUE:
                    328:  *     None.
                    329:  *
                    330:  *-LEVEL:
                    331:  *     Base or Interrupt.
                    332:  *
                    333:  *-NOTES:
                    334:  *     Does not sleep.
                    335:  *
                    336:  *     Driver-defined basic locks, read/write locks and sleep locks may be
                    337:  *     held across calls to this function.
                    338:  *
                    339:  *     This function may not be meaningful on all implementations because
                    340:  *     some implementations may not support I/O-mapped I/O.
                    341:  */
                    342: 
                    343: #if    __USE_PROTO__
                    344: void (repinsb) (int port, uchar_t * addr, int cnt)
                    345: #else
                    346: void
                    347: repinsb __ARGS ((port, addr, cnt))
                    348: int            port;
                    349: uchar_t              * addr;
                    350: int            cnt;
                    351: #endif
                    352: {
                    353:        repinsb (port, addr, cnt);
                    354: }
                    355: 
                    356: 
                    357: /*
                    358:  *-STATUS:
                    359:  *     DDI/DKI
                    360:  *
                    361:  *-NAME:
                    362:  *     repinsd         Read 32-bit long words from an I/O port to a buffer.
                    363:  *
                    364:  *-ARGUMENTS:
                    365:  *     port            A valid 32-bit I/O port.
                    366:  *     addr            The address of the buffer where data is stored after
                    367:  *                     "cnt" reads of the I/O port.
                    368:  *     cnt             The number of 32-bit long words to be read from the
                    369:  *                     I/O port.
                    370:  *
                    371:  *-DESCRIPTION:
                    372:  *     This function provides a C-language interface to the machine
                    373:  *     instructions that read a string of 32-bit long words from a 32-bit I/O
                    374:  *     port using the I/O address space instead of the memory address space.
                    375:  *     The data from "cnt" reads of the I/O port is stored in the data buffer
                    376:  *     pointed to by "addr". The data buffer should be at least "cnt" 32-bit
                    377:  *     long words in length.
                    378:  *
                    379:  *-RETURN VALUE:
                    380:  *     None.
                    381:  *
                    382:  *-LEVEL:
                    383:  *     Base or Interrupt.
                    384:  *
                    385:  *-NOTES:
                    386:  *     Does not sleep.
                    387:  *
                    388:  *     Driver-defined basic locks, read/write locks and sleep locks may be
                    389:  *     held across calls to this function.
                    390:  *
                    391:  *     This function may not be meaningful on all implementations because
                    392:  *     some implementations may not support I/O-mapped I/O.
                    393:  */
                    394: 
                    395: #if    __USE_PROTO__
                    396: void (repinsd) (int port, ulong_t * addr, int cnt)
                    397: #else
                    398: void
                    399: repinsd __ARGS ((port, addr, cnt))
                    400: int            port;
                    401: ulong_t              * addr;
                    402: int            cnt;
                    403: #endif
                    404: {
                    405:        repinsd (port, addr, cnt);
                    406: }
                    407: 
                    408: 
                    409: /*
                    410:  *-STATUS:
                    411:  *     DDI/DKI
                    412:  *
                    413:  *-NAME:
                    414:  *     repinsw         Read 16-bit short words from an I/O port to a buffer.
                    415:  *
                    416:  *-ARGUMENTS:
                    417:  *     port            A valid 16-bit I/O port.
                    418:  *     addr            The address of the buffer where data is stored after
                    419:  *                     "cnt" reads of the I/O port.
                    420:  *     cnt             The number of 16-bit short words to be read from the
                    421:  *                     I/O port.
                    422:  *
                    423:  *-DESCRIPTION:
                    424:  *     This function provides a C-language interface to the machine
                    425:  *     instructions that read a string of 16-bit short words from a 16-bit
                    426:  *     I/O port using the I/O address space instead of the memory address
                    427:  *     space. The data from "cnt" reads of the I/O port is stored in the data
                    428:  *     buffer pointed to by "addr". The data buffer should be at least "cnt"
                    429:  *     16-bit short words in length.
                    430:  *
                    431:  *-RETURN VALUE:
                    432:  *     None.
                    433:  *
                    434:  *-LEVEL:
                    435:  *     Base or Interrupt.
                    436:  *
                    437:  *-NOTES:
                    438:  *     Does not sleep.
                    439:  *
                    440:  *     Driver-defined basic locks, read/write locks and sleep locks may be
                    441:  *     held across calls to this function.
                    442:  *
                    443:  *     This function may not be meaningful on all implementations because
                    444:  *     some implementations may not support I/O-mapped I/O.
                    445:  */
                    446: 
                    447: #if    __USE_PROTO__
                    448: void (repinsw) (int port, ushort_t * addr, int cnt)
                    449: #else
                    450: void
                    451: repinsw __ARGS ((port, addr, cnt))
                    452: int            port;
                    453: ushort_t      *        addr;
                    454: int            cnt;
                    455: #endif
                    456: {
                    457:        repinsw (port, addr, cnt);
                    458: }
                    459: 
                    460: 
                    461: /*
                    462:  *-STATUS:
                    463:  *     DDI/DKI
                    464:  *
                    465:  *-NAME:
                    466:  *     repoutsb        Write bytes from a buffer to an I/O port.
                    467:  *
                    468:  *-ARGUMENTS:
                    469:  *     port            A valid 8-bit I/O port.
                    470:  *     addr            The address of the buffer from which "cnt" bytes are
                    471:  *                     written to the I/O port.
                    472:  *     cnt             The number of bytes to be written to the I/O port.
                    473:  *
                    474:  *-DESCRIPTION:
                    475:  *     This function provides a C-language interface to the machine
                    476:  *     instructions that write a string of bytes to an 8-bit I/O port using
                    477:  *     the I/O address space instead of the memory address space. "cnt"
                    478:  *     bytes starting at the address pointed to by "addr" are written to the
                    479:  *     I/O port in "cnt" write operations. The buffer should be at least
                    480:  *     "cnt" bytes in length.
                    481:  *
                    482:  *-RETURN VALUE:
                    483:  *     None.
                    484:  *
                    485:  *-LEVEL:
                    486:  *     Base or Interrupt.
                    487:  *
                    488:  *-NOTES:
                    489:  *     Does not sleep.
                    490:  *
                    491:  *     Driver-defined basic locks, read/write locks and sleep locks may be
                    492:  *     held across calls to this function.
                    493:  *
                    494:  *     This function may not be meaningful on all implementations because
                    495:  *     some implementations may not support I/O-mapped I/O.
                    496:  */
                    497: 
                    498: #if    __USE_PROTO__
                    499: void (repoutsb) (int port, uchar_t * addr, int cnt)
                    500: #else
                    501: void
                    502: repoutsb __ARGS ((port, addr, cnt))
                    503: int            port;
                    504: uchar_t              * addr;
                    505: int            cnt;
                    506: #endif
                    507: {
                    508:        repoutsb (port, addr, cnt);
                    509: }
                    510: 
                    511: 
                    512: /*
                    513:  *-STATUS:
                    514:  *     DDI/DKI
                    515:  *
                    516:  *-NAME:
                    517:  *     repoutsd        Write 32-bit long words from a buffer to an I/O port.
                    518:  *
                    519:  *-ARGUMENTS:
                    520:  *     port            A valid 32-bit I/O port.
                    521:  *     addr            The address of the buffer from which "cnt" 32-bit long
                    522:  *                     words are written to the I/O port.
                    523:  *     cnt             The number of 32-bit long words to be written to the
                    524:  *                     I/O port.
                    525:  *
                    526:  *-DESCRIPTION:
                    527:  *     This function provides a C-language interface to the machine
                    528:  *     instructions that write a string of 32-bit long words to a 32-bit I/O
                    529:  *     port using the I/O address space instead of the memory address space.
                    530:  *     "cnt" 32-bit long words starting at the address pointed to by "addr"
                    531:  *     are written to the I/O port in "cnt" write operations. The buffer
                    532:  *     should be at least "cnt" 32-bit long words in length.
                    533:  *
                    534:  *-RETURN VALUE:
                    535:  *     None.
                    536:  *
                    537:  *-LEVEL:
                    538:  *     Base or Interrupt.
                    539:  *
                    540:  *-NOTES:
                    541:  *     Does not sleep.
                    542:  *
                    543:  *     Driver-defined basic locks, read/write locks and sleep locks may be
                    544:  *     held across calls to this function.
                    545:  *
                    546:  *     This function may not be meaningful on all implementations because
                    547:  *     some implementations may not support I/O-mapped I/O.
                    548:  */
                    549: 
                    550: #if    __USE_PROTO__
                    551: void (repoutsd) (int port, ulong_t * addr, int cnt)
                    552: #else
                    553: void
                    554: repoutsd __ARGS ((port, addr, cnt))
                    555: int            port;
                    556: ulong_t              * addr;
                    557: int            cnt;
                    558: #endif
                    559: {
                    560:        repoutsd (port, addr, cnt);
                    561: }
                    562: 
                    563: 
                    564: /*
                    565:  *-STATUS:
                    566:  *     DDI/DKI
                    567:  *
                    568:  *-NAME:
                    569:  *     repoutsw        Write 16-bit short words from a buffer to an I/O port.
                    570:  *
                    571:  *-ARGUMENTS:
                    572:  *     port            A valid 32-bit I/O port.
                    573:  *     addr            The address of the buffer from which "cnt" 16-bit
                    574:                        short words are written to the I/O port.
                    575:  *     cnt             The number of 16-bit short words to be written to the
                    576:  *                     I/O port.
                    577:  *
                    578:  *-DESCRIPTION:
                    579:  *     This function provides a C-language interface to the machine
                    580:  *     instructions that write a string of 16-bit short words to a 16-bit I/O
                    581:  *     port using the I/O address space instead of the memory address space.
                    582:  *     "cnt" 16-bit short words starting at the address pointed to by "addr"
                    583:  *     are written to the I/O port in "cnt" write operations. The buffer
                    584:  *     should be at least "cnt" 16-bit short words in length.
                    585:  *
                    586:  *-RETURN VALUE:
                    587:  *     None.
                    588:  *
                    589:  *-LEVEL:
                    590:  *     Base or Interrupt.
                    591:  *
                    592:  *-NOTES:
                    593:  *     Does not sleep.
                    594:  *
                    595:  *     Driver-defined basic locks, read/write locks and sleep locks may be
                    596:  *     held across calls to this function.
                    597:  *
                    598:  *     This function may not be meaningful on all implementations because
                    599:  *     some implementations may not support I/O-mapped I/O.
                    600:  */
                    601: 
                    602: #if    __USE_PROTO__
                    603: void (repoutsw) (int port, ushort_t * addr, int cnt)
                    604: #else
                    605: void
                    606: repoutsw __ARGS ((port, addr, cnt))
                    607: int            port;
                    608: ushort_t      *        addr;
                    609: int            cnt;
                    610: #endif
                    611: {
                    612:        repoutsw (port, addr, cnt);
                    613: }

unix.superglobalmegacorp.com

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