1: /*
   2:  * User-level probe routines to make devices interrupt.
   3:  * One per device; entered through uprobe table.
   4:  * Return values:
   5:  *	ACP_NXDEV	device doesn't exist
   6:  *	ACP_IFINTR	OK if device has interrupted by now
   7:  *	ACP_EXISTS	OK, not checking interrupt
   8:  *
   9:  * NOTES:
  10:  *	Reads and writes to kmem (done by grab, stuff)
  11:  *	are currently done a byte at a time in the kernel.
  12:  *	Beware!
  13:  *
  14:  *	The hs, rp, hk and dvhp probes have not been tested.
  15:  */
  16: 
  17: #include    "uprobe.h"
  18: #include    <sys/param.h>
  19: #include    <sys/autoconfig.h>
  20: 
  21: #include    <sys/hkreg.h>
  22: #include    <sys/hpreg.h>
  23: #include    <sys/hsreg.h>
  24: #include    <sys/rkreg.h>
  25: #include    <sys/rlreg.h>
  26: #include    <sys/rpreg.h>
  27: 
  28: #include    <sys/htreg.h>
  29: #undef  b_repcnt
  30: #include    <sys/tmreg.h>
  31: #undef  b_repcnt
  32: #include    <sys/tsreg.h>
  33: 
  34: int xpprobe(), hkprobe(), hsprobe(), rlprobe(), rkprobe(), rpprobe();
  35: int htprobe(), tmprobe(), tsprobe();
  36: int dnprobe(), klprobe(), dzprobe(), dhprobe(), dmprobe();
  37: int lpprobe(), vpprobe();
  38: #ifdef  VIRUS
  39: int caryprobe();
  40: #endif
  41: extern  int errno;
  42: 
  43: struct uprobe uprobe[] = {
  44:     /*
  45: 	 *	Disks
  46: 	 */
  47:     "xp",   xpprobe,
  48:     "rm",   xpprobe,
  49:     "hp",   xpprobe,
  50:     "hk",   hkprobe,
  51:     "hs",   hsprobe,
  52:     "rl",   rlprobe,
  53:     "rk",   rkprobe,
  54:     "rp",   rpprobe,
  55: 
  56:     /*
  57: 	 *	Tapes
  58: 	 */
  59:     "ht",   htprobe,
  60:     "tm",   tmprobe,
  61:     "ts",   tsprobe,
  62: 
  63:     /*
  64: 	 *	Communication interfaces
  65: 	 */
  66:     "dn",   dnprobe,
  67:     "kl",   klprobe,
  68:     "dz",   dzprobe,
  69:     "dh",   dhprobe,
  70:     "dm",   dmprobe,
  71: 
  72:     /*
  73: 	 *	Printers
  74: 	 */
  75:     "lp",   lpprobe,
  76:     "vp",   vpprobe,
  77: #ifdef  VIRUS
  78:     /*
  79: 	 *	Don't ask
  80: 	 */
  81:     "cary", caryprobe,
  82: #endif
  83:     0,  0
  84: };
  85: 
  86: xpprobe(addr)
  87: struct hpdevice *addr;
  88: {
  89:     stuff(HP_IE | HP_RDY, &(addr->hpcs1.w));
  90:     DELAY(10);
  91:     stuff(0, &(addr->hpcs1.w));
  92:     return(ACP_IFINTR);
  93: }
  94: 
  95: hkprobe(addr)
  96: struct hkdevice *addr;
  97: {
  98:     stuff(HK_CDT | HK_IE | HK_CRDY, (&(addr->hkcs1)));
  99:     DELAY(10);
 100:     stuff(HK_CDT, (&(addr->hkcs1)));
 101:     return(ACP_IFINTR);
 102: }
 103: 
 104: hsprobe(addr)
 105: struct hsdevice *addr;
 106: {
 107:     stuff(HS_IE | HS_DCLR | HS_GO, (&(addr->hscs1)));
 108:     DELAY(10);
 109:     stuff(0, (&(addr->hscs1)));
 110:     return(ACP_IFINTR);
 111: }
 112: 
 113: rlprobe(addr)
 114: struct rldevice *addr;
 115: {
 116:     stuff(RL_GETSTATUS | RL_IE, (&(addr->rlcs)));
 117:     DELAY(100);
 118:     stuff(RL_CRDY, (&(addr->rlcs)));
 119:     return(ACP_IFINTR);
 120: }
 121: 
 122: rkprobe(addr)
 123: struct rkdevice *addr;
 124: {
 125:     stuff(RKCS_IDE | RKCS_DRESET | RKCS_GO, (&(addr->rkcs)));
 126:     DELAY(10);
 127:     stuff(0, (&(addr->rkcs)));
 128:     return(ACP_IFINTR);
 129: }
 130: 
 131: 
 132: rpprobe(addr)
 133: struct rpdevice *addr;
 134: {
 135:     stuff(RP_IDE | RP_IDLE | RP_GO, (&(addr->rkcs.w)));
 136:     DELAY(10);
 137:     stuff(0, (&(addr->rpcs.w)));
 138:     return(ACP_IFINTR);
 139: }
 140: 
 141: htprobe(addr)
 142: struct htdevice *addr;
 143: {
 144:     stuff(HT_SENSE | HT_IE | HT_GO, (&(addr->htcs1)));
 145:     DELAY(10);
 146:     stuff(0, (&(addr->htcs1)));
 147:     return(ACP_IFINTR);
 148: }
 149: 
 150: /*
 151:  * TM-11 probe routine.
 152:  * Also check one of the more distant registers
 153:  * to make sure this isn't a TS-11.
 154:  */
 155: tmprobe(addr)
 156: struct tmdevice *addr;
 157: {
 158:     stuff(TM_IE, &(addr->tmcs));
 159:     errno = 0;
 160:     grab(&(addr->tmba));
 161:     if (errno != 0)
 162:         return(ACP_NXDEV);
 163:     return(ACP_IFINTR);
 164: }
 165: 
 166: /*
 167:  * TS-11 probe.
 168:  * Assume that the device exists if there's no TM-11 there.
 169:  */
 170: tsprobe(addr)
 171: struct tsdevice *addr;
 172: {
 173:     errno = 0;
 174:     grab(&((struct tmdevice *)addr->tmba));
 175:     if (errno == 0)
 176:         return(ACP_NXDEV);
 177:     return(ACP_EXISTS);
 178: }

Defined functions

hkprobe defined in line 95; used 2 times
hsprobe defined in line 104; used 2 times
htprobe defined in line 141; used 2 times
rkprobe defined in line 122; used 2 times
rlprobe defined in line 113; used 2 times
rpprobe defined in line 132; used 2 times
tmprobe defined in line 155; used 2 times
tsprobe defined in line 170; used 2 times
xpprobe defined in line 86; used 4 times

Defined variables

uprobe defined in line 43; never used
Last modified: 1983-10-16
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 919
Valid CSS Valid XHTML 1.0 Strict