1: /*	up.old.c	7.1	86/06/05	*/
   2: 
   3: #include "../machine/pte.h"
   4: 
   5: #include "../h/param.h"
   6: #include "../h/inode.h"
   7: #include "../h/fs.h"
   8: 
   9: #include "../vaxuba/upreg.h"
  10: #include "../vaxuba/ubareg.h"
  11: 
  12: #include "saio.h"
  13: #include "savax.h"
  14: 
  15: u_short ubastd[] = { 0776700 };
  16: char    up_gottype[MAXNUBA*8];
  17: char    up_type[MAXNUBA*8];
  18: extern  struct st upst[];
  19: 
  20: upopen(io)
  21:     register struct iob *io;
  22: {
  23:     register struct updevice *upaddr =
  24:         (struct updevice *)ubamem(io->i_unit, ubastd[0]);
  25:     register struct st *st;
  26: 
  27:     while ((upaddr->upcs1 & UP_DVA) == 0)
  28:         ;
  29:     if (up_gottype[io->i_unit] == 0) {
  30:         up_type[io->i_unit] = upmaptype(io->i_unit, upaddr);
  31:         if (up_type[io->i_unit] < 0)
  32:             _stop("unknown drive type");
  33:         up_gottype[io->i_unit] = 1;
  34:     }
  35:     st = &upst[up_type[io->i_unit]];
  36:     if (io->i_boff < 0 || io->i_boff > 7 || st->off[io->i_boff] == -1)
  37:         _stop("up bad unit");
  38:     io->i_boff = st->off[io->i_boff] * st->nspc;
  39: }
  40: 
  41: upstrategy(io, func)
  42:     register struct iob *io;
  43: {
  44:     int unit, nspc, ns, cn, tn, sn;
  45:     daddr_t bn;
  46:     int info;
  47:     register struct updevice *upaddr =
  48:         (struct updevice *)ubamem(io->i_unit, ubastd[0]);
  49:     register struct st *st = &upst[up_type[io->i_unit]];
  50: 
  51:     unit = io->i_unit;
  52:     bn = io->i_bn;
  53:     cn = bn/st->nspc;
  54:     sn = bn%st->nspc;
  55:     tn = sn/st->nsect;
  56:     sn = sn%st->nsect;
  57:     upaddr->upcs2 = unit % 8;
  58:     if ((upaddr->upds & UPDS_VV) == 0) {
  59:         upaddr->upcs1 = UP_DCLR|UP_GO;
  60:         upaddr->upcs1 = UP_PRESET|UP_GO;
  61:         upaddr->upof = UPOF_FMT22;
  62:     }
  63:     if ((upaddr->upds & UPDS_DREADY) != UPDS_DREADY)
  64:         _stop("up not ready");
  65:     info = ubasetup(io, 1);
  66:     upaddr->updc = cn;
  67:     upaddr->upda = (tn << 8) + sn;
  68:     upaddr->upba = info;
  69:     upaddr->upwc = -io->i_cc / sizeof (short);
  70:     if (func == READ)
  71:         upaddr->upcs1 = UP_RCOM|UP_GO;
  72:     else
  73:         upaddr->upcs1 = UP_WCOM|UP_GO;
  74:     do {
  75:         DELAY(25);
  76:     } while ((upaddr->upcs1 & UP_RDY) == 0);
  77:     if (upaddr->upds & UPDS_ERR) {
  78:         printf("up error: (cyl,trk,sec)=(%d,%d,%d) cs2=%b er1=%b er2=%b\n",
  79:             cn, tn, sn,
  80:             upaddr->upcs2, UPCS2_BITS, upaddr->uper1, UPER1_BITS,
  81:             upaddr->uper2, UPER2_BITS);
  82:         return (-1);
  83:     }
  84:     ubafree(io, info);
  85:     return (io->i_cc + (upaddr->upwc * sizeof (short)));
  86: }
  87: 
  88: /*ARGSUSED*/
  89: upioctl(io, cmd, arg)
  90:     struct iob *io;
  91:     int cmd;
  92:     caddr_t arg;
  93: {
  94: 
  95:     return (ECMD);
  96: }

Defined functions

upioctl defined in line 89; used 6 times
upopen defined in line 20; used 6 times
upstrategy defined in line 41; used 6 times

Defined variables

ubastd defined in line 15; used 2 times
up_gottype defined in line 16; used 2 times
up_type defined in line 17; used 4 times
Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 948
Valid CSS Valid XHTML 1.0 Strict