projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
BSD 4_4 release
[unix-history]
/
usr
/
src
/
sys
/
vax
/
stand
/
idc.c
diff --git
a/usr/src/sys/vax/stand/idc.c
b/usr/src/sys/vax/stand/idc.c
index
f9dc734
..
cce0039
100644
(file)
--- a/
usr/src/sys/vax/stand/idc.c
+++ b/
usr/src/sys/vax/stand/idc.c
@@
-1,31
+1,32
@@
/*
/*
- * Copyright (c) 1982, 1986 Regents of the University of California.
+ * Copyright (c) 1982, 1986
, 1988
Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)idc.c 7.
3 (Berkeley) %G%
+ * @(#)idc.c 7.
7 (Berkeley) 5/4/91
*/
/*
* IDC (RB730)
*/
*/
/*
* IDC (RB730)
*/
-#include "../machine/pte.h"
-#include "param.h"
-#include "inode.h"
-#include "fs.h"
+#include "sys/param.h"
-#include "../vaxuba/idcreg.h"
-#include "../vaxuba/ubareg.h"
+#include "../include/pte.h"
+#include "../uba/idcreg.h"
+#include "../uba/ubareg.h"
-#include "saio.h"
+#include "s
tand/s
aio.h"
#include "savax.h"
#include "savax.h"
-u_short idcstd[] = { 0175606 };
short rb02_off[] = { 0, 400, 0, -1, -1, -1, -1, -1 };
short rb80_off[] = { 0, 37, 0, -1, -1, -1, 115, 305 };
short rb02_off[] = { 0, 400, 0, -1, -1, -1, -1, -1 };
short rb80_off[] = { 0, 37, 0, -1, -1, -1, 115, 305 };
-int idc_type[4];
+#define MAXCTLR 1
+#define MAXUNIT 4
+#define MAXPART 8
+
+int idc_type[MAXUNIT];
idcopen(io)
register struct iob *io;
idcopen(io)
register struct iob *io;
@@
-33,11
+34,15
@@
idcopen(io)
register struct idcdevice *idcaddr;
register int i;
register struct idcdevice *idcaddr;
register int i;
- idcaddr = (struct idcdevice *)((caddr_t)ubauba(io->i_unit) + 0x200);
- if ((unsigned)io->i_boff > 7) {
- printf("idc bad unit");
+ if (io->i_adapt != 0)
+ return (EADAPT);
+ if ((u_int)io->i_ctlr >= MAXCTLR)
+ return (ECTLR);
+ if ((u_int)io->i_unit >= MAXUNIT)
return (EUNIT);
return (EUNIT);
- }
+ if ((u_int)io->i_part >= MAXPART)
+ return (EPART);
+ idcaddr = (struct idcdevice *)((caddr_t)ubauba(io->i_adapt) + 0x200);
idcaddr->idcmpr = IDCGS_GETSTAT;
idcaddr->idccsr = IDC_GETSTAT|(io->i_unit<<8);
idcwait(idcaddr);
idcaddr->idcmpr = IDCGS_GETSTAT;
idcaddr->idccsr = IDC_GETSTAT|(io->i_unit<<8);
idcwait(idcaddr);
@@
-54,14
+59,10
@@
idcopen(io)
i = idcaddr->idcmpr;
if (idcaddr->idccsr & IDC_R80) {
idc_type[io->i_unit] = 1;
i = idcaddr->idcmpr;
if (idcaddr->idccsr & IDC_R80) {
idc_type[io->i_unit] = 1;
- io->i_boff = rb80_off[io->i_
boff
] * NRB80SECT * NRB80TRK;
+ io->i_boff = rb80_off[io->i_
part
] * NRB80SECT * NRB80TRK;
} else {
idc_type[io->i_unit] = 0;
} else {
idc_type[io->i_unit] = 0;
- io->i_boff = rb02_off[io->i_boff] * NRB02SECT/2 * NRB02TRK;
- }
- if (io->i_boff < 0) {
- printf("idc%d: bad unit type", io->i_unit);
- return (EUNIT);
+ io->i_boff = rb02_off[io->i_part] * NRB02SECT/2 * NRB02TRK;
}
return (0);
}
}
return (0);
}
@@
-76,7
+77,7
@@
idcstrategy(io, func)
short ccleft, thiscc = 0;
int ubinfo, errcnt = 0;
short ccleft, thiscc = 0;
int ubinfo, errcnt = 0;
- idcaddr = (struct idcdevice *)((caddr_t)ubauba(io->i_
uni
t) + 0x200);
+ idcaddr = (struct idcdevice *)((caddr_t)ubauba(io->i_
adap
t) + 0x200);
ubinfo = ubasetup(io, 1);
bn = io->i_bn;
ccleft = io->i_cc;
ubinfo = ubasetup(io, 1);
bn = io->i_bn;
ccleft = io->i_cc;
@@
-101,7
+102,7
@@
retry:
idcwait(idcaddr);
idcaddr->idccsr &= ~IDC_ATTN;
com = dn<<8;
idcwait(idcaddr);
idcaddr->idccsr &= ~IDC_ATTN;
com = dn<<8;
- if (func == READ)
+ if (func ==
F_
READ)
com |= IDC_READ;
else
com |= IDC_WRITE;
com |= IDC_READ;
else
com |= IDC_WRITE;
@@
-114,12
+115,11
@@
retry:
if (idcaddr->idccsr & IDC_ERR) {
printf("idc%d error: (cyl,trk,sec)=(%d,%d,%d) csr=%b\n",
dn, cn, tn, sn, idcaddr->idccsr, IDCCSR_BITS);
if (idcaddr->idccsr & IDC_ERR) {
printf("idc%d error: (cyl,trk,sec)=(%d,%d,%d) csr=%b\n",
dn, cn, tn, sn, idcaddr->idccsr, IDCCSR_BITS);
- if (errcnt == 10) {
+ if (errcnt
++
== 10) {
printf("idc: unrecovered error\n");
ubafree(io, ubinfo);
return (-1);
}
printf("idc: unrecovered error\n");
ubafree(io, ubinfo);
return (-1);
}
- errcnt++;
goto retry;
}
if (errcnt)
goto retry;
}
if (errcnt)
@@
-133,22
+133,10
@@
retry:
return (io->i_cc);
}
return (io->i_cc);
}
+static
idcwait(idcaddr)
register struct idcdevice *idcaddr;
{
idcwait(idcaddr)
register struct idcdevice *idcaddr;
{
- register int i;
-
while ((idcaddr->idccsr & (IDC_CRDY|IDC_DRDY)) != (IDC_CRDY|IDC_DRDY))
while ((idcaddr->idccsr & (IDC_CRDY|IDC_DRDY)) != (IDC_CRDY|IDC_DRDY))
- for (i = 10; i; i--)
- ;
-}
-
-/*ARGSUSED*/
-idcioctl(io, cmd, arg)
- struct iob *io;
- int cmd;
- caddr_t arg;
-{
-
- return (ECMD);
+ DELAY(10);
}
}