Annotation of researchv9/sys/boot/stand/saio.h, revision 1.1.1.2

1.1       root        1: /*     @(#)saio.h 1.1 86/02/03 SMI     */
                      2: 
                      3: /*
                      4:  * Copyright (c) 1985 by Sun Microsystems, Inc.
                      5:  */
                      6: 
                      7: /*
                      8:  * header file for standalone I/O package
                      9:  */
                     10: 
1.1.1.2 ! root       11: #include <sys/types.h>
        !            12: #include <machine/sunromvec.h>
1.1       root       13: 
                     14: /*
                     15:  * io block: the structure passed to or from the device drivers.
                     16:  * 
                     17:  * Includes pointers to the device
                     18:  * in use, a pointer to device-specific data (iopb's or device
                     19:  * state information, typically), cells for the use of seek, etc.
                     20:  * NOTE: expand at end to preserve compatibility with PROMs
                     21:  */
                     22: struct saioreq {
                     23:        char    si_flgs;
                     24:        struct boottab *si_boottab;     /* Points to boottab entry if any */
                     25:        char    *si_devdata;            /* Device-specific data pointer */
                     26:        int     si_ctlr;                /* Controller number or address */
                     27:        int     si_unit;                /* Unit number within controller */
                     28:        daddr_t si_boff;                /* Partition number within unit */
                     29:        daddr_t si_cyloff;
                     30:        off_t   si_offset;
                     31:        daddr_t si_bn;                  /* Block number to R/W */
                     32:        char    *si_ma;                 /* Memory address to R/W */
                     33:        int     si_cc;                  /* Character count to R/W */
                     34:        struct  saif *si_sif;           /* interface pointer */
                     35:        char    *si_devaddr;            /* Points to mapped in device */
                     36:        char    *si_dmaaddr;            /* Points to allocated DMA space */
                     37: };
                     38: 
                     39: 
                     40: #define F_READ 01
                     41: #define F_WRITE        02
                     42: #define F_ALLOC        04
                     43: #define F_FILE 010
                     44: #define        F_EOF   020     /* EOF on device */
                     45: 
                     46: /*
1.1.1.2 ! root       47:  * io block: includes an
        !            48:  * inode, cells for the use of seek, etc,
        !            49:  * and a buffer.
        !            50:  */
        !            51: #undef i_buf   /* curse you clever folk from inode.h */
        !            52: struct iob {
        !            53:        struct saioreq  i_si;           /* I/O request block for this file */
        !            54:        struct inode    i_ino;          /* Inode for this file */
        !            55:        char            i_buf[BUFSIZE];/* Buffer for reading inodes & dirs */
        !            56: };
        !            57: #define i_flgs         i_si.si_flgs
        !            58: #define i_boottab      i_si.si_boottab
        !            59: #define i_devdata      i_si.si_devdata
        !            60: #define i_ctlr         i_si.si_ctlr
        !            61: #define i_unit         i_si.si_unit
        !            62: #define i_boff         i_si.si_boff
        !            63: #define i_cyloff       i_si.si_cyloff
        !            64: #define i_offset       i_si.si_offset
        !            65: #define i_bn           i_si.si_bn
        !            66: #define i_ma           i_si.si_ma
        !            67: #define i_cc           i_si.si_cc
        !            68: 
        !            69: /*
1.1       root       70:  * request codes. Must be the same as F_XXX above
                     71:  */
                     72: #define        READ    F_READ
                     73: #define        WRITE   F_WRITE
                     74: 
1.1.1.2 ! root       75: #define        NBUFS   4
        !            76: 
        !            77: char   b[NBUFS][BUFSIZE];
        !            78: daddr_t        blknos[NBUFS];
        !            79: 
        !            80: #define NFILES 4
        !            81: struct iob iob[NFILES];
1.1       root       82: 
                     83: /*
                     84:  * Ethernet interface descriptor
                     85:  */
                     86: struct saif {
                     87:        int     (*sif_xmit)();          /* transmit packet */
                     88:        int     (*sif_poll)();          /* check for and receive packet */
                     89:        int     (*sif_reset)();         /* reset interface */
                     90: };
                     91: 
                     92: /*
                     93:  * Types of resources that can be allocated by resalloc().
                     94:  */
                     95: enum RESOURCES { 
                     96:        RES_MAINMEM,            /* Main memory, accessible to CPU */
                     97:        RES_RAWVIRT,            /* Raw addr space that can be mapped */
                     98:        RES_DMAMEM,             /* Memory acc. by CPU and by all DMA I/O */
                     99:        RES_DMAVIRT,            /* Raw addr space accessible by DMA I/O */
                    100: };
                    101: char *resalloc(), *devalloc();
                    102: 
                    103: 
                    104: /*
                    105:  * Delay units are in microseconds.
                    106:  */
                    107: #define        DELAY(n)        \
                    108: { \
                    109:        extern int cpudelay; \
                    110:        register int N = (((n)<<4) >> cpudelay); \
                    111:  \
                    112:        while (--N > 0) ; \
                    113: }
                    114: 
                    115: #define        CDELAY(c, n)    \
                    116: { \
                    117:        extern int cpudelay; \
                    118:        register int N = (((n)<<3) >> cpudelay); \
                    119:  \
                    120:        while (--N > 0) \
                    121:                if (c) \
                    122:                        break; \
                    123: }
                    124: 
                    125: /*
                    126:  * Translate our virtual address (in DMA-able memory) into a physical DMA
                    127:  * address, as it would appear to a Multibus device.  (In VMEbus systems,
                    128:  * this assumes a MB/VME adapter.)
                    129:  */
                    130: #define        MB_DMA_ADDR(x)  (((int)(x))&0x000FFFFF)

unix.superglobalmegacorp.com

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