SCCS-vsn: sys/vax/uba/up.c 4.62
-/* up.c 4.61 82/11/26 */
-.f
+/* up.c 4.62 82/12/05 */
#include "up.h"
#if NSC > 0
#include "up.h"
#if NSC > 0
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/dk.h"
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/dk.h"
#include "../h/buf.h"
#include "../h/conf.h"
#include "../h/dir.h"
#include "../h/buf.h"
#include "../h/conf.h"
#include "../h/dir.h"
{ upprobe, upslave, upattach, updgo, upstd, "up", updinfo, "sc", upminfo };
struct buf uputab[NUP];
char upinit[NUP];
{ upprobe, upslave, upattach, updgo, upstd, "up", updinfo, "sc", upminfo };
struct buf uputab[NUP];
char upinit[NUP];
struct upst {
short nsect;
struct upst {
short nsect;
struct buf bupbuf[NUP];
struct dkbad upbad[NUP];
#endif
struct buf bupbuf[NUP];
struct dkbad upbad[NUP];
#endif
+#ifndef NOBADSECT
+struct buf bupbuf[NUP];
+struct dkbad upbad[NUP];
+#endif
upaddr->upcs2 = UPCS2_CLR;
}
upaddr->upcs2 = UPCS2_CLR;
}
+upopen(dev)
+ dev_t dev;
+{
+ register int unit = minor(dev) >> 3;
+ register struct uba_device *ui;
+
+ if (unit >= NUP || (ui = updinfo[unit]) == 0 || ui->ui_alive == 0)
+ return (ENXIO);
+ return (0);
+}
+
upstrategy(bp)
register struct buf *bp;
{
upstrategy(bp)
register struct buf *bp;
{
#endif
/* SHOULD WARN SYSTEM THAT THIS HAPPENED */
upinit[ui->ui_unit] = 1;
#endif
/* SHOULD WARN SYSTEM THAT THIS HAPPENED */
upinit[ui->ui_unit] = 1;
+ upinit[ui->ui_unit] = 1;
upaddr->upcs1 = UP_IE|UP_DCLR|UP_GO;
upaddr->upcs1 = UP_IE|UP_PRESET|UP_GO;
upaddr->upof = UPOF_FMT22;
didie = 1;
upaddr->upcs1 = UP_IE|UP_DCLR|UP_GO;
upaddr->upcs1 = UP_IE|UP_PRESET|UP_GO;
upaddr->upof = UPOF_FMT22;
didie = 1;
+#ifndef NOBADSECT
+ st = &upst[ui->ui_type];
+ bbp->b_flags = B_READ|B_BUSY;
+ bbp->b_dev = bp->b_dev;
+ bbp->b_bcount = 512;
+ bbp->b_un.b_addr = (caddr_t)&upbad[ui->ui_unit];
+ bbp->b_blkno = st->ncyl * st->nspc - st->nsect;
+ bbp->b_cylin = st->ncyl - 1;
+ dp->b_actf = bbp;
+ bbp->av_forw = bp;
+ bp = bbp;
+#endif
#ifndef NOBADSECT
st = &upst[ui->ui_type];
bbp->b_flags = B_READ|B_BUSY;
#ifndef NOBADSECT
st = &upst[ui->ui_type];
bbp->b_flags = B_READ|B_BUSY;
dk_busy &= ~(1 << ui->ui_dk);
if ((upaddr->upcs2&07) != ui->ui_slave)
upaddr->upcs2 = ui->ui_slave;
dk_busy &= ~(1 << ui->ui_dk);
if ((upaddr->upcs2&07) != ui->ui_slave)
upaddr->upcs2 = ui->ui_slave;
+#ifndef NOBADSECT
+ if (bp->b_flags&B_BAD) {
+ if (upecc(ui, CONT))
+ return;
+ }
+#endif
#ifndef NOBADSECT
if (bp->b_flags&B_BAD) {
if (upecc(ui, CONT))
#ifndef NOBADSECT
if (bp->b_flags&B_BAD) {
if (upecc(ui, CONT))
* After 28 retries (16 without offset, and
* 12 with offset positioning) give up.
*/
* After 28 retries (16 without offset, and
* 12 with offset positioning) give up.
*/
hard:
harderr(bp, "up");
printf("cn=%d tn=%d sn=%d cs2=%b er1=%b er2=%b\n",
hard:
harderr(bp, "up");
printf("cn=%d tn=%d sn=%d cs2=%b er1=%b er2=%b\n",
if (upecc(ui, BSE))
return;
else
if (upecc(ui, BSE))
return;
else
+#endif
+ goto hard;
+ } else if (upaddr->uper2 & UPER2_BSE) {
+#ifndef NOBADSECT
+ if (upecc(ui, BSE))
+ return;
+ else
#endif
goto hard;
} else {
#endif
goto hard;
} else {
upecc(ui, flag)
register struct uba_device *ui;
int flag;
upecc(ui, flag)
register struct uba_device *ui;
int flag;
{
register struct updevice *up = (struct updevice *)ui->ui_addr;
register struct buf *bp = uputab[ui->ui_unit].b_actf;
{
register struct updevice *up = (struct updevice *)ui->ui_addr;
register struct buf *bp = uputab[ui->ui_unit].b_actf;
cmd = (ubaddr >> 8) & 0x300;
cmd |= ((bp->b_flags&B_READ)?UP_RCOM:UP_WCOM)|UP_IE|UP_GO;
um->um_tab.b_errcnt = 0;
cmd = (ubaddr >> 8) & 0x300;
cmd |= ((bp->b_flags&B_READ)?UP_RCOM:UP_WCOM)|UP_IE|UP_GO;
um->um_tab.b_errcnt = 0;
- um->um_tab.b_active = 2; /* continuing transfer ... */
up->upcs1 = cmd;
#endif
return (1);
up->upcs1 = cmd;
#endif
return (1);