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
mv pcs750.bin to /usr/src/etc/vax
[unix-history]
/
usr
/
src
/
sys
/
vax
/
stand
/
rl.c
diff --git
a/usr/src/sys/vax/stand/rl.c
b/usr/src/sys/vax/stand/rl.c
index
68ffa3b
..
3e59f7d
100644
(file)
--- a/
usr/src/sys/vax/stand/rl.c
+++ b/
usr/src/sys/vax/stand/rl.c
@@
-1,27
+1,29
@@
/*
/*
- * 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.
*
- * @(#)rl.c 7.
3
(Berkeley) %G%
+ * @(#)rl.c 7.
6
(Berkeley) %G%
*/
/*
* Standalone RL02 disk driver
*/
*/
/*
* Standalone RL02 disk driver
*/
-#include "../machine/pte.h"
#include "param.h"
#include "inode.h"
#include "fs.h"
#include "param.h"
#include "inode.h"
#include "fs.h"
+#include "../vax/pte.h"
#include "../vaxuba/rlreg.h"
#include "../vaxuba/ubareg.h"
#include "saio.h"
#include "savax.h"
#include "../vaxuba/rlreg.h"
#include "../vaxuba/ubareg.h"
#include "saio.h"
#include "savax.h"
-u_short rlstd[] = { 0774400 };
+#define MAXPART 8
+#define MAXCTLR 1 /* all addresses must be specified */
+u_short rlstd[MAXCTLR] = { 0774400 };
short rl_off[] = { 0, 361, 0, -1, -1, -1, -1, -1 };
/* struct to keep state info about the controller */
short rl_off[] = { 0, 361, 0, -1, -1, -1, -1, -1 };
/* struct to keep state info about the controller */
@@
-30,24
+32,24
@@
struct rl_stat {
short rl_cylnhd; /* cylinder and head */
u_short rl_bleft; /* bytes left to transfer */
u_short rl_bpart; /* bytes transferred */
short rl_cylnhd; /* cylinder and head */
u_short rl_bleft; /* bytes left to transfer */
u_short rl_bpart; /* bytes transferred */
-} rl_stat[
] = { -1, 0, 0, 0
};
+} rl_stat[
MAXCTLR] = { -1, 0, 0, 0
};
rlopen(io)
register struct iob *io;
{
rlopen(io)
register struct iob *io;
{
- register struct rldevice *rladdr =
- (struct rldevice *)ubamem(io->i_unit, rlstd[0]);
- register struct rl_stat *st = &rl_stat[0];
+ register struct rldevice *rladdr;
+ register struct rl_stat *st;
register int ctr = 0;
register int ctr = 0;
- if (badaddr((char *)rladdr, sizeof(short))) {
- printf("nonexistent device\n");
+ if ((u_int)io->i_adapt >= nuba)
+ return (EADAPT);
+ if ((u_int)io->i_ctlr >= MAXCTLR)
+ return (ECTLR);
+ rladdr = (struct rldevice *)ubamem(io->i_adapt, rlstd[io->i_ctlr]);
+ if (badaddr((char *)rladdr, sizeof(short)))
return (ENXIO);
return (ENXIO);
- }
- if ((unsigned)io->i_boff > 7 || rl_off[io->i_boff] == -1) {
- printf("rl bad unit\n");
- return (EUNIT);
- }
+ if ((u_int)io->i_part >= MAXPART || rl_off[io->i_part] == -1)
+ return (EPART);
/*
* DEC reports that:
/*
* DEC reports that:
@@
-68,13
+70,13
@@
rlopen(io)
} while ((rladdr->rlmp.getstat&RLMP_STATUS) != RLMP_STATOK && ++ctr<8);
if ((rladdr->rlcs & RL_DE) || (ctr >= 8)) {
} while ((rladdr->rlmp.getstat&RLMP_STATUS) != RLMP_STATOK && ++ctr<8);
if ((rladdr->rlcs & RL_DE) || (ctr >= 8)) {
- printf("rl unit does not respond\n");
+ printf("rl
:
unit does not respond\n");
return (EUNIT);
}
if ((rladdr->rlmp.getstat & RLMP_DT) == 0) { /* NO RL01'S */
printf("rl01 unit not supported\n");
return (EUNIT);
}
if ((rladdr->rlmp.getstat & RLMP_DT) == 0) { /* NO RL01'S */
printf("rl01 unit not supported\n");
- return (E
UNIT
);
+ return (E
NXIO
);
}
/* Determine disk posistion */
}
/* Determine disk posistion */
@@
-82,25
+84,27
@@
rlopen(io)
rlwait(rladdr);
/* save disk drive posistion */
rlwait(rladdr);
/* save disk drive posistion */
+ st = &rl_stat[io->i_ctlr];
st->rl_cylnhd = (rladdr->rlmp.readhdr & 0177700) >> 6;
st->rl_dn = io->i_unit;
/* byte offset for cylinder desired */
st->rl_cylnhd = (rladdr->rlmp.readhdr & 0177700) >> 6;
st->rl_dn = io->i_unit;
/* byte offset for cylinder desired */
- io->i_boff = rl_off[io->i_
boff
] * NRLBPSC * NRLTRKS * NRLSECT;
+ io->i_boff = rl_off[io->i_
part
] * NRLBPSC * NRLTRKS * NRLSECT;
return (0);
}
rlstrategy(io, func)
register struct iob *io;
{
return (0);
}
rlstrategy(io, func)
register struct iob *io;
{
- register struct rldevice *rladdr =
- (struct rldevice *)ubamem(io->i_unit, rlstd[0]);
- register struct rl_stat *st = &rl_stat[0];
+ register struct rldevice *rladdr;
+ register struct rl_stat *st;
int com;
daddr_t bn;
short cn, sn, head;
int com;
daddr_t bn;
short cn, sn, head;
- int diff, ubinfo, ubaddr, errcnt = 0;
+ int diff, ubinfo, uba
a
ddr, errcnt = 0;
+ rladdr = (struct rldevice *)ubamem(io->i_adapt, rlstd[io->i_ctlr]);
+ st = &rl_stat[io->i_ctlr];
retry:
ubinfo = ubasetup(io, 1);
bn = io->i_bn; /* block number */
retry:
ubinfo = ubasetup(io, 1);
bn = io->i_bn; /* block number */
@@
-108,18
+112,18
@@
retry:
sn = (bn % 20) << 1;
head = (bn / 20) & 1;
st->rl_bleft = io->i_cc; /* total number of bytes to trans */
sn = (bn % 20) << 1;
head = (bn / 20) & 1;
st->rl_bleft = io->i_cc; /* total number of bytes to trans */
- ubaddr = ubinfo;
+ uba
a
ddr = ubinfo;
stupid_rl:
/* find out how many cylinders to seek */
diff = (st->rl_cylnhd >> 1) - cn;
stupid_rl:
/* find out how many cylinders to seek */
diff = (st->rl_cylnhd >> 1) - cn;
- if (
diff == 0 && (st->rl_cylnhd & 1) == head
)
+ if (
diff == 0 && (st->rl_cylnhd & 1) == head
)
goto noseek;
/* first time or we switched drives */
st->rl_dn = io->i_unit; /* drive number */
goto noseek;
/* first time or we switched drives */
st->rl_dn = io->i_unit; /* drive number */
- if (
diff < 0
)
+ if (
diff < 0
)
rladdr->rlda.seek = -diff<<7 | RLDA_HGH | head << 4;
else
rladdr->rlda.seek = diff<<7 | RLDA_LOW | head << 4;
rladdr->rlda.seek = -diff<<7 | RLDA_HGH | head << 4;
else
rladdr->rlda.seek = diff<<7 | RLDA_LOW | head << 4;
@@
-135,14
+139,14
@@
noseek:
/* calculate the max number of bytes we can trans */
st->rl_bpart = NRLSECT * NRLBPSC - (sn * NRLBPSC);
/* calculate the max number of bytes we can trans */
st->rl_bpart = NRLSECT * NRLBPSC - (sn * NRLBPSC);
- if (
st->rl_bleft < st->rl_bpart
)
+ if (
st->rl_bleft < st->rl_bpart
)
st->rl_bpart = st->rl_bleft;
rladdr->rlda.rw = (st->rl_cylnhd << 6) | sn;
rladdr->rlmp.rw = -(st->rl_bpart >> 1);
st->rl_bpart = st->rl_bleft;
rladdr->rlda.rw = (st->rl_cylnhd << 6) | sn;
rladdr->rlmp.rw = -(st->rl_bpart >> 1);
- rladdr->rlba = ubaddr;
+ rladdr->rlba = uba
a
ddr;
- com = (st->rl_dn << 8) | ((ubaddr>>12)&RL_BAE);
+ com = (st->rl_dn << 8) | ((uba
a
ddr>>12)&RL_BAE);
if (func == READ)
com |= RL_READ;
if (func == READ)
com |= RL_READ;
@@
-157,7
+161,7
@@
noseek:
if (rladdr->rlcs & RL_ERR) {
int status;
if (rladdr->rlcs & RL_ERR) {
int status;
- if (
rladdr->rlcs & RL_DE
) {
+ if (
rladdr->rlcs & RL_DE
) {
rladdr->rlda.getstat = RL_GSTAT;
rladdr->rlcs = (st->rl_dn << 8) | RL_GETSTAT;
rlwait(rladdr);
rladdr->rlda.getstat = RL_GSTAT;
rladdr->rlcs = (st->rl_dn << 8) | RL_GETSTAT;
rlwait(rladdr);
@@
-177,18
+181,17
@@
noseek:
/* save disk drive posistion */
st->rl_cylnhd = (rladdr->rlmp.readhdr & 0177700) >> 6;
/* save disk drive posistion */
st->rl_cylnhd = (rladdr->rlmp.readhdr & 0177700) >> 6;
- if (errcnt == 10) {
+ if (errcnt
++
== 10) {
printf("rl: unrecovered error\n");
return (-1);
}
printf("rl: unrecovered error\n");
return (-1);
}
- errcnt++;
goto retry;
}
/* do we have to finish off the rest of the transfer? */
goto retry;
}
/* do we have to finish off the rest of the transfer? */
- if (
(st->rl_bleft -= st->rl_bpart) > 0
) {
+ if (
(st->rl_bleft -= st->rl_bpart) > 0
) {
/* increment head and/or cylinder */
/* increment head and/or cylinder */
- if (
++head > 1
) {
+ if (
++head > 1
) {
cn++; /* want next cyl, head 0 sector 0 */
head = 0;
}
cn++; /* want next cyl, head 0 sector 0 */
head = 0;
}
@@
-202,7
+205,7
@@
noseek:
*/
ubafree(io, ubinfo);
*/
ubafree(io, ubinfo);
- ubaddr = ubinfo + io->i_cc - st->rl_bleft;
+ uba
a
ddr = ubinfo + io->i_cc - st->rl_bleft;
goto stupid_rl;
}
goto stupid_rl;
}
@@
-214,19
+217,9
@@
noseek:
return (io->i_cc);
}
return (io->i_cc);
}
+static
rlwait(rladdr)
register struct rldevice *rladdr;
{
rlwait(rladdr)
register struct rldevice *rladdr;
{
-
- while ((rladdr->rlcs & RL_CRDY) == 0)
- continue;
-}
-
-rlioctl(io, cmd, arg)
- struct iob *io;
- int cmd;
- caddr_t arg;
-{
-
- return (ECMD);
+ while ((rladdr->rlcs & RL_CRDY) == 0);
}
}