|
|
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: ! 11: #include "../h/types.h" ! 12: #include "../mon/sunromvec.h" ! 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: /* ! 47: * request codes. Must be the same as F_XXX above ! 48: */ ! 49: #define READ F_READ ! 50: #define WRITE F_WRITE ! 51: ! 52: /* ! 53: * how many files can be open at once. ! 54: */ ! 55: #define NFILES 3 ! 56: ! 57: /* ! 58: * Ethernet interface descriptor ! 59: */ ! 60: struct saif { ! 61: int (*sif_xmit)(); /* transmit packet */ ! 62: int (*sif_poll)(); /* check for and receive packet */ ! 63: int (*sif_reset)(); /* reset interface */ ! 64: }; ! 65: ! 66: /* ! 67: * Types of resources that can be allocated by resalloc(). ! 68: */ ! 69: enum RESOURCES { ! 70: RES_MAINMEM, /* Main memory, accessible to CPU */ ! 71: RES_RAWVIRT, /* Raw addr space that can be mapped */ ! 72: RES_DMAMEM, /* Memory acc. by CPU and by all DMA I/O */ ! 73: RES_DMAVIRT, /* Raw addr space accessible by DMA I/O */ ! 74: }; ! 75: char *resalloc(), *devalloc(); ! 76: ! 77: ! 78: /* ! 79: * Delay units are in microseconds. ! 80: */ ! 81: #define DELAY(n) \ ! 82: { \ ! 83: extern int cpudelay; \ ! 84: register int N = (((n)<<4) >> cpudelay); \ ! 85: \ ! 86: while (--N > 0) ; \ ! 87: } ! 88: ! 89: #define CDELAY(c, n) \ ! 90: { \ ! 91: extern int cpudelay; \ ! 92: register int N = (((n)<<3) >> cpudelay); \ ! 93: \ ! 94: while (--N > 0) \ ! 95: if (c) \ ! 96: break; \ ! 97: } ! 98: ! 99: /* ! 100: * Translate our virtual address (in DMA-able memory) into a physical DMA ! 101: * address, as it would appear to a Multibus device. (In VMEbus systems, ! 102: * this assumes a MB/VME adapter.) ! 103: */ ! 104: #define MB_DMA_ADDR(x) (((int)(x))&0x000FFFFF)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.