1: /*	hp.old.c	7.1	86/06/05	*/
   2: 
   3: /*
   4:  * RP??/RM?? disk driver
   5:  */
   6: #include "../machine/pte.h"
   7: 
   8: #include "../h/param.h"
   9: #include "../h/inode.h"
  10: #include "../h/fs.h"
  11: 
  12: #include "../vaxmba/hpreg.h"
  13: #include "../vaxmba/mbareg.h"
  14: 
  15: #include "saio.h"
  16: #include "savax.h"
  17: 
  18: #define SECTSIZ 512
  19: #define MASKREG(reg)    ((reg)&0xffff)
  20: 
  21: extern  short hptypes[];
  22: 
  23: char    hp_type[MAXNMBA*8];
  24: extern  struct st hpst[];
  25: 
  26: hpopen(io)
  27:     register struct iob *io;
  28: {
  29:     register unit = io->i_unit;
  30:     struct hpdevice *hpaddr = (struct hpdevice *)mbadrv(unit);
  31:     register struct st *st;
  32:     register i, type = hpaddr->hpdt & MBDT_TYPE;
  33: 
  34:     mbainit(UNITTOMBA(io->i_unit));
  35:     for (i = 0; hptypes[i]; i++)
  36:         if (hptypes[i] == type)
  37:             goto found;
  38:     _stop("unknown drive type");
  39: found:
  40:     hpaddr->hpcs1 = HP_DCLR|HP_GO;      /* init drive */
  41:     hpaddr->hpcs1 = HP_PRESET|HP_GO;
  42:     hpaddr->hpof = HPOF_FMT22;
  43:     hp_type[unit] = hpmaptype(hpaddr, i, unit);
  44:     st = &hpst[hp_type[unit]];
  45:     if (io->i_boff < 0 || io->i_boff > 7 ||
  46:         st->off[io->i_boff]== -1)
  47:         _stop("hp bad minor");
  48:     io->i_boff = st->off[io->i_boff] * st->nspc;
  49: }
  50: 
  51: hpstrategy(io, func)
  52:     register struct iob *io;
  53: {
  54:     int unit = io->i_unit;
  55:     daddr_t bn = io->i_bn;
  56:     struct hpdevice *hpaddr = (struct hpdevice *)mbadrv(unit);
  57:     struct st *st = &hpst[hp_type[unit]];
  58:     int cn, tn, sn;
  59: 
  60:     if ((hpaddr->hpds & HPDS_VV) == 0) {
  61:         hpaddr->hpcs1 = HP_DCLR|HP_GO;
  62:         hpaddr->hpcs1 = HP_PRESET|HP_GO;
  63:         hpaddr->hpof = HPOF_FMT22;
  64:     }
  65:     cn = bn/st->nspc;
  66:     sn = bn%st->nspc;
  67:     tn = sn/st->nsect;
  68:     sn = sn%st->nsect;
  69:     hpaddr->hpdc = cn;
  70:     hpaddr->hpda = (tn << 8) + sn;
  71:     mbastart(io, func);
  72:     while ((hpaddr->hpds & HPDS_DRY) == 0)
  73:         ;
  74:     if (hpaddr->hpds&HPDS_ERR) {
  75:         printf("hp error: sn [%d-%d) ds=%b er1=%b\n",
  76:             bn, bn + io->i_cc/SECTSIZ, MASKREG(hpaddr->hpds), HPDS_BITS,
  77:             MASKREG(hpaddr->hper1), HPER1_BITS);
  78:         return (-1);
  79:     }
  80:     return (io->i_cc);
  81: }
  82: 
  83: /*ARGSUSED*/
  84: hpioctl(io, cmd, arg)
  85:     struct iob *io;
  86:     int cmd;
  87:     caddr_t arg;
  88: {
  89: 
  90:     return (ECMD);
  91: }

Defined functions

hpioctl defined in line 84; used 6 times
hpopen defined in line 26; used 6 times
hpstrategy defined in line 51; used 6 times

Defined variables

hp_type defined in line 23; used 3 times

Defined macros

MASKREG defined in line 19; used 2 times
SECTSIZ defined in line 18; used 1 times
  • in line 76
Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1035
Valid CSS Valid XHTML 1.0 Strict