/boot,/mdec,[T]MSCP (Part 8 of 22)
Steven M. Schultz
sms at wlv.imsd.contel.com
Sat May 18 16:34:20 AEST 1991
Subject: Part 8 of 22 /boot,/mdec,[T]MSCP updates
Index: /sys/<many>, /usr/src/etc/<several> 2.11BSD
Description:
Repeat-By:
Fix:
See part 0 (the README) for the Description, the Reason and
the instructions on how update your system.
This is part 8 of 22
Changes were made to the MSCP driver to use an externally mapped
packet arena. This saves slightly more than 1kb of kernel D space
per controller.
Closer attention is paid to the fact a drive went offline (changing
floppies, etc).
The size returned in the online packet is NOT adjusted (reduced)! The
RCT area is already taken into account by the controller. This
results in extra space being available on the disc. It is safe to
make this patch to an existing/running system - but, to use the
extra space you will have to dump the filesystem, do a 'newfs' and
reload.
*** /usr/src/sys/pdpuba/ra.c.old Sun Jul 1 22:17:02 1990
--- /usr/src/sys/pdpuba/ra.c Fri May 10 20:40:03 1991
***************
*** 3,36 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)ra.c 1.1 (2.10BSD Berkeley) 12/1/86
*/
/***********************************************************************
- * *
* Copyright (c) 1983 by *
* Digital Equipment Corporation, Maynard, MA *
* All rights reserved. *
- * *
***********************************************************************/
/*
! * uda.c - UDA50A Driver
*
! * Date: Jan 30 1984
*
! * This thing has been beaten beyound belief. It still has two main problems:
*
! * When this device is on the same unibus as another DMA device
! * like a versatec or a rk07, the Udstrat routine complains that it still
! * has a buffered data path that it shouldn't. I don't know why.
! *
* decvax!rich.
- *
*/
/*
! * RA MSCP disk device driver
*
* Should work with the following (at least!):
* RUX1 (RX50, RX33)
--- 3,42 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)ra.c 2.0 (2.11BSD Berkeley) 3/16/91
*/
/***********************************************************************
* Copyright (c) 1983 by *
* Digital Equipment Corporation, Maynard, MA *
* All rights reserved. *
***********************************************************************/
/*
! * ra.c - MSCP Driver
*
! * Date: Mar 16 1991
! * The command packets were moved to an external heap which is dynamically
! * allocated in a manner similar to m_ioget in the networking code.
! * MSCP controllers used too much valuable kernel D space. For UNIBUS
! * machines sufficient UMRs were allocated to map the heap, removing the
! * need to allocate a UMR per controller at open time. This has the side
! * effect of greatly simplifying the physical (Q22) or virtual (UMR) address
! * calculation of the command packets. It also eliminates the need for
! * 'struct buf racomphys', saving 24 bytes of D space.
*
! * The error message output was rearranged saving another 82 bytes of
! * kernel D space. Also, there was an extraneous buffer header allocated,
! * it was removed, saving a further 24 bytes of D space.
! * sms at wlv.imsd.contel.com
*
! * Date: Jan 30 1984
! * This thing has been beaten beyound belief.
* decvax!rich.
*/
/*
! * MSCP disk device driver
*
* Should work with the following (at least!):
* RUX1 (RX50, RX33)
***************
*** 52,65 ****
#include "buf.h"
#include "conf.h"
#include "map.h"
#include "uba.h"
#include "rareg.h"
#include "dk.h"
#include "errno.h"
- #ifndef KDSA0
- #define KDSA0 ((u_short *)0172360)
- #endif
#define RACON(x) ((minor(x) >> 6) & 03)
#define RAUNIT(x) ((minor(x) >> 3) & 07)
--- 58,69 ----
#include "buf.h"
#include "conf.h"
#include "map.h"
+ #include "syslog.h"
#include "uba.h"
#include "rareg.h"
#include "dk.h"
#include "errno.h"
#define RACON(x) ((minor(x) >> 6) & 03)
#define RAUNIT(x) ((minor(x) >> 3) & 07)
***************
*** 131,141 ****
-1, 0, /* H=blk 0 thru end */
};
- #define RC_RCT 102 /* rc25 rct area */
- #define RD_RCT 32 /* # of sectors in remap area (don't touch) */
- #define RA_RCT 1000 /* Big ra disk rct area */
- /*------------------------------------------------------------------------*/
-
#define NRSPL2 3 /* log2 number of response packets */
#define NCMDL2 3 /* log2 number of command packets */
#define NRSP (1<<NRSPL2)
--- 135,140 ----
***************
*** 168,174 ****
struct raca ra_ca; /* communications area */
struct mscp ra_rsp[NRSP]; /* response packets */
struct mscp ra_cmd[NCMD]; /* command packets */
! } ra_comT;
typedef struct ra_info {
struct rasizes *ra_size; /* Partion tables for drive */
--- 167,173 ----
struct raca ra_ca; /* communications area */
struct mscp ra_rsp[NRSP]; /* response packets */
struct mscp ra_cmd[NCMD]; /* command packets */
! } ra_comT; /* 1096 bytes per controller */
typedef struct ra_info {
struct rasizes *ra_size; /* Partion tables for drive */
***************
*** 194,204 ****
} ra_softcT;
ra_softcT ra_sc[NRAC]; /* Controller table */
! ra_comT ra_com[NRAC]; /* Communications area table */
ra_infoT ra_disks[NRAD]; /* Disk table */
- static struct buf racomphys; /* Communications area phys map */
- struct buf ratab; /* Interface queue (for bio) */
#ifdef UCB_METER
static int ra_dkn = -1; /* number for iostat */
#endif
--- 193,203 ----
} ra_softcT;
ra_softcT ra_sc[NRAC]; /* Controller table */
! memaddr ra_com[NRAC]; /* Communications area table */
ra_infoT ra_disks[NRAD]; /* Disk table */
+ #define MAPSEGDESC (((btoc(sizeof (ra_comT))-1)<<8)|RW)
+
#ifdef UCB_METER
static int ra_dkn = -1; /* number for iostat */
#endif
***************
*** 225,233 ****
#define PRINTB(x)
#endif
! int raattach(), raintr();
! int wakeup();
! long raphys();
struct mscp *ragetcp();
#define b_qsize b_resid /* queue size per drive, in rqdtab */
--- 224,231 ----
#define PRINTB(x)
#endif
! int raattach(), raintr(), wakeup();
! extern ubadr_t _iomap();
struct mscp *ragetcp();
#define b_qsize b_resid /* queue size per drive, in rqdtab */
***************
*** 244,253 ****
* Attach controller for autoconfig system.
*/
raattach(addr, unit)
! radeviceT *addr;
! int unit;
{
! register ra_softcT *sc = &ra_sc[unit];
#ifdef UCB_METER
if (ra_dkn < 0)
--- 242,251 ----
* Attach controller for autoconfig system.
*/
raattach(addr, unit)
! register radeviceT *addr;
! register int unit;
{
! register ra_softcT *sc = &ra_sc[unit];
#ifdef UCB_METER
if (ra_dkn < 0)
***************
*** 258,264 ****
if (sc->RAADDR == NULL && addr != NULL) {
sc->RAADDR = addr;
sc->sc_unit = unit;
! sc->sc_com = &ra_com[unit];
return(1);
}
--- 256,263 ----
if (sc->RAADDR == NULL && addr != NULL) {
sc->RAADDR = addr;
sc->sc_unit = unit;
! sc->sc_com = (ra_comT *)SEG5;
! ra_com[unit] = (memaddr)_ioget(sizeof (ra_comT));
return(1);
}
***************
*** 288,306 ****
* Open a RA. Initialize the device and set the unit online.
*/
raopen(dev, flag)
! dev_t dev;
! int flag;
{
! register ra_infoT *disk;
! register struct mscp *mp;
! register ra_softcT *sc = &ra_sc[RACON(dev)];
! int unit = RAUNIT(dev);
! int s, i;
PRINTD(("raopen: dev=%x, flags=%d\n", dev, flag));
/* Check that controller exists */
! if (sc->RAADDR == NULL)
return(ENXIO);
/* Open device */
--- 287,305 ----
* Open a RA. Initialize the device and set the unit online.
*/
raopen(dev, flag)
! dev_t dev;
! int flag;
{
! register ra_infoT *disk;
! register struct mscp *mp;
! register ra_softcT *sc = &ra_sc[RACON(dev)];
! int unit = RAUNIT(dev);
! int s, i;
PRINTD(("raopen: dev=%x, flags=%d\n", dev, flag));
/* Check that controller exists */
! if (RACON(dev) >= NRAC || sc->RAADDR == NULL)
return(ENXIO);
/* Open device */
***************
*** 332,342 ****
if ((disk = sc->sc_drives[unit]) == NULL) {
PRINTD(("raopen: opening new disk %d\n", unit));
s = splbio();
- while ((mp = ragetcp(sc)) == 0) {
- ++sc->sc_cp_wait;
- sleep(&sc->sc_cp_wait, PSWP+1);
- --sc->sc_cp_wait;
- }
/* Allocate disk table entry for disk */
if ((disk = ragetdd()) != NULL) {
sc->sc_drives[unit] = disk;
--- 331,336 ----
***************
*** 347,361 ****
splx(s);
return(ENXIO);
}
!
! /* Try to online disk unit */
mp->m_opcode = M_O_ONLIN;
mp->m_unit = unit;
mp->m_cmdref = (unsigned)&disk->ra_dsize;
((Trl *)mp->m_dscptr)->hsh |= RA_OWN|RA_INT;
i = sc->RAADDR->raip;
! timeout(wakeup, (caddr_t)mp->m_cmdref, 10 * LINEHZ);
! sleep((caddr_t)mp->m_cmdref, PSWP+1);
splx(s);
}
--- 341,364 ----
splx(s);
return(ENXIO);
}
! }
! /* Try to online disk unit, it might have gone offline */
! if (disk->ra_dsize == -1L) {
! /* In high kernel, don't saveseg5, just use normalseg5 later on. */
! while ((mp = ragetcp(sc)) == 0) {
! ++sc->sc_cp_wait;
! sleep(&sc->sc_cp_wait, PSWP+1);
! --sc->sc_cp_wait;
! }
! mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
mp->m_opcode = M_O_ONLIN;
mp->m_unit = unit;
mp->m_cmdref = (unsigned)&disk->ra_dsize;
((Trl *)mp->m_dscptr)->hsh |= RA_OWN|RA_INT;
+ normalseg5();
i = sc->RAADDR->raip;
! timeout(wakeup, (caddr_t)&disk->ra_dsize, 10 * LINEHZ);
! sleep((caddr_t)&disk->ra_dsize, PSWP+1);
splx(s);
}
***************
*** 369,386 ****
return(ENXIO);
}
PRINTD(("raopen: disk online\n"));
-
return(0);
}
/*
! * Initialize a RA. Initialize data structures, and start hardware
* initialization sequence.
*/
rainit(sc)
! register ra_softcT *sc;
{
! long racomaddr;
/*
* Cold init of controller
--- 372,388 ----
return(ENXIO);
}
PRINTD(("raopen: disk online\n"));
return(0);
}
/*
! * Initialize controller, data structures, and start hardware
* initialization sequence.
*/
rainit(sc)
! register ra_softcT *sc;
{
! long adr;
/*
* Cold init of controller
***************
*** 392,419 ****
/*
* Get physical address of RINGBASE
*/
- if (racomphys.b_flags == 0) {
- long rap = raphys((u_int)ra_com);
- racomphys.b_un.b_addr = (caddr_t)loint(rap);
- racomphys.b_xmem = hiint(rap);
- racomphys.b_bcount = sizeof(ra_com);
- racomphys.b_flags = B_PHYS;
- #ifdef UNIBUS_MAP
- mapalloc(&racomphys);
- #endif
- PRINTD(("rainit: racomphys b_addr=%o, b_xmem=%o\n",
- racomphys.b_un.b_addr, racomphys.b_xmem));
- }
- racomaddr =
- ((u_int)racomphys.b_un.b_addr | ((long)racomphys.b_xmem << 16))
- + sizeof(ra_comT) * sc->sc_unit
- + (u_int)RINGBASE;
/*
* Get individual controller RINGBASE physical address
*/
! sc->sc_ctab.b_un.b_addr = (caddr_t)loint(racomaddr);
! sc->sc_ctab.b_xmem = hiint(racomaddr);
PRINTD(("rainit: com area addr low=0%o, high=0%o\n",
sc->sc_ctab.b_un.b_addr, sc->sc_ctab.b_xmem));
--- 394,407 ----
/*
* Get physical address of RINGBASE
*/
+ adr = _iomap(ra_com[sc->sc_unit]) + RINGBASE;
+
/*
* Get individual controller RINGBASE physical address
*/
! sc->sc_ctab.b_un.b_addr = (caddr_t)loint(adr);
! sc->sc_ctab.b_xmem = hiint(adr);
PRINTD(("rainit: com area addr low=0%o, high=0%o\n",
sc->sc_ctab.b_un.b_addr, sc->sc_ctab.b_xmem));
***************
*** 435,464 ****
return(0);
}
- /*
- * Return the physical address corresponding to a virtual data space address.
- * On a separate I&D CPU this is a noop, but it's only called when the first
- * controller is initialized and on a dump.
- */
- long
- raphys(vaddr)
- register unsigned vaddr;
- {
- register unsigned click;
-
- click = (sep_id ? KDSA0 : KISA0)[(vaddr >> 13) & 07];
- return(((long)click << 6) + (vaddr & 017777));
- }
-
rastrategy(bp)
! register struct buf *bp;
{
! register ra_infoT *disk;
! register struct buf *dp;
! ra_softcT *sc = &ra_sc[RACON(bp->b_dev)];
! int part = minor(bp->b_dev) & 07;
! daddr_t sz, maxsz;
! int s;
/* Is disk online */
if ((disk = sc->sc_drives[dkunit(bp)]) == NULL || disk->ra_dsize <= 0L)
--- 423,437 ----
return(0);
}
rastrategy(bp)
! register struct buf *bp;
{
! register ra_infoT *disk;
! register struct buf *dp;
! ra_softcT *sc = &ra_sc[RACON(bp->b_dev)];
! int part = minor(bp->b_dev) & 07;
! daddr_t sz, maxsz;
! int s;
/* Is disk online */
if ((disk = sc->sc_drives[dkunit(bp)]) == NULL || disk->ra_dsize <= 0L)
***************
*** 508,517 ****
if (sc->sc_ctab.b_active == 0) {
rastart(sc);
}
-
splx(s);
return;
-
bad:
bp->b_flags |= B_ERROR;
iodone(bp);
--- 481,488 ----
***************
*** 518,576 ****
return;
}
! ra_infoT *
! rarawcheck(dev)
! register dev_t dev;
{
! register ra_softcT *sc;
! register ra_infoT *disk;
! /* Check controller and disk unit */
! if (RACON(dev) >= NRAC || (sc = &ra_sc[RACON(dev)])->RAADDR == NULL
! || (disk = sc->sc_drives[RAUNIT(dev)]) == NULL
! || disk->ra_dsize <= 0L)
! return(NULL);
!
! return(disk);
}
raread(dev, uio)
! dev_t dev;
struct uio *uio;
{
! register ra_infoT *disk;
!
! /* Check controller and disk unit */
! if ((disk = rarawcheck(dev)) == NULL)
! return(ENXIO);
!
! return(physio(rastrategy, &disk->ra_rtab, dev, B_READ, WORD, uio));
}
rawrite(dev, uio)
! dev_t dev;
struct uio *uio;
{
! register ra_infoT *disk;
!
! /* Check controller and disk unit */
! if ((disk = rarawcheck(dev)) == NULL)
! return(ENXIO);
!
! return(physio(rastrategy, &disk->ra_rtab, dev, B_WRITE, WORD, uio));
}
/* Start i/o, must be called at level splbio */
rastart(sc)
! register ra_softcT *sc;
{
! register struct mscp *mp;
! register struct buf *bp;
! struct buf *dp;
! ra_infoT *disk;
! int i;
! long temp;
loop:
/*
* Anything left to do on this controller?
--- 489,530 ----
return;
}
! struct buf *
! rartab(dev)
! register dev_t dev;
{
! register ra_softcT *sc = &ra_sc[RACON(dev)];
! return(&sc->sc_drives[RAUNIT(dev)]->ra_rtab);
}
raread(dev, uio)
! register dev_t dev;
struct uio *uio;
{
! return(physio(rastrategy, rartab(dev), dev, B_READ, WORD, uio));
}
rawrite(dev, uio)
! register dev_t dev;
struct uio *uio;
{
! return(physio(rastrategy, rartab(dev), dev, B_WRITE, WORD, uio));
}
/* Start i/o, must be called at level splbio */
rastart(sc)
! register ra_softcT *sc;
{
! register struct mscp *mp;
! register struct buf *bp;
! struct buf *dp;
! ra_infoT *disk;
! int i;
! long temp;
! segm seg5;
+ saveseg5(seg5); /* save it just once */
loop:
/*
* Anything left to do on this controller?
***************
*** 582,588 ****
--- 536,544 ----
* Check for response ring transitions lost in race
* condition
*/
+ mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
rarspring(sc);
+ restorseg5(seg5);
return(0);
}
***************
*** 601,616 ****
++sc->sc_ctab.b_active;
if (sc->RAADDR->rasa & RA_ERR || sc->sc_state != S_RUN) {
harderr(bp, "ra");
! printf("rasa %o, state %d\n", sc->RAADDR->rasa,
sc->sc_state);
/* Should requeue outstanding requests somehow */
rainit(sc);
return(0);
}
/* Issue command */
if ((mp = ragetcp(sc)) == NULL)
! return(0);
mp->m_cmdref = (unsigned)bp; /* pointer to get back */
mp->m_opcode = bp->b_flags & B_READ ? M_O_READ : M_O_WRITE;
mp->m_unit = dkunit(bp);
--- 557,575 ----
++sc->sc_ctab.b_active;
if (sc->RAADDR->rasa & RA_ERR || sc->sc_state != S_RUN) {
harderr(bp, "ra");
! log(LOG_INFO, "rasa %o, state %d\n", sc->RAADDR->rasa,
sc->sc_state);
/* Should requeue outstanding requests somehow */
rainit(sc);
+ out:
+ restorseg5(seg5);
return(0);
}
/* Issue command */
+ mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
if ((mp = ragetcp(sc)) == NULL)
! goto out;
mp->m_cmdref = (unsigned)bp; /* pointer to get back */
mp->m_opcode = bp->b_flags & B_READ ? M_O_READ : M_O_WRITE;
mp->m_unit = dkunit(bp);
***************
*** 669,682 ****
raintr(unit)
int unit;
{
! register ra_softcT *sc = &ra_sc[unit];
! register struct mscp *mp;
! register struct buf *bp;
! u_int i;
PRINTD(("raintr%d: state %d, rasa %o\n", unit, sc->sc_state,
sc->RAADDR->rasa));
switch (sc->sc_state) {
case S_STEP1:
#define STEP1MASK 0174377
--- 628,644 ----
raintr(unit)
int unit;
{
! register ra_softcT *sc = &ra_sc[unit];
! register struct mscp *mp;
! register struct buf *bp;
! u_int i;
! segm seg5;
PRINTD(("raintr%d: state %d, rasa %o\n", unit, sc->sc_state,
sc->RAADDR->rasa));
+ saveseg5(seg5); /* save it just once */
+
switch (sc->sc_state) {
case S_STEP1:
#define STEP1MASK 0174377
***************
*** 722,727 ****
--- 684,690 ----
/*
* Initialize the data structures.
*/
+ mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
ramsginit(sc, sc->sc_com->ra_ca.ca_rsp, sc->sc_com->ra_rsp,
0, NRSP, RA_INT | RA_OWN);
ramsginit(sc, sc->sc_com->ra_ca.ca_cmd, sc->sc_com->ra_cmd,
***************
*** 736,741 ****
--- 699,705 ----
mp->m_cntflgs = M_C_ATTN | M_C_MISC | M_C_THIS;
((Trl *)mp->m_dscptr)->hsh |= RA_OWN|RA_INT;
i = sc->RAADDR->raip;
+ restorseg5(seg5);
return;
case S_SCHAR:
***************
*** 758,763 ****
--- 722,729 ----
wakeup((caddr_t)&sc->sc_ctab);
}
+ mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
+
/*
* Check for buffer purge request
*/
***************
*** 782,793 ****
sc->sc_com->ra_ca.ca_cmdint = 0;
}
! /*
! * Waiting for command?
! */
if (sc->sc_cp_wait)
wakeup((caddr_t)&sc->sc_cp_wait);
-
rastart(sc);
}
--- 748,758 ----
sc->sc_com->ra_ca.ca_cmdint = 0;
}
! restorseg5(seg5);
!
! /* Waiting for command? */
if (sc->sc_cp_wait)
wakeup((caddr_t)&sc->sc_cp_wait);
rastart(sc);
}
***************
*** 795,815 ****
* Init mscp communications area
*/
ramsginit(sc, com, msgs, offset, length, flags)
! register ra_softcT *sc;
! register Trl *com;
! register struct mscp *msgs;
! int offset;
! int length;
! int flags;
{
! long vaddr;
/*
! * Figure out virtual address of message
* skip comm area and mscp messages header and previous messages
*/
! vaddr = (u_int)racomphys.b_un.b_addr | ((long)racomphys.b_xmem << 16);
! vaddr += (u_int)sc->sc_com - (u_int)ra_com; /* unit offset */
vaddr += sizeof(struct raca) /* skip comm area */
+sizeof(struct mscp_header); /* m_cmdref disp */
vaddr += offset * sizeof(struct mscp); /* skip previous */
--- 760,777 ----
* Init mscp communications area
*/
ramsginit(sc, com, msgs, offset, length, flags)
! register ra_softcT *sc;
! register Trl *com;
! register struct mscp *msgs;
! int offset, length, flags;
{
! long vaddr;
/*
! * Figure out Unibus or physical(Q22) address of message
* skip comm area and mscp messages header and previous messages
*/
! vaddr = _iomap(ra_com[sc->sc_unit]); /* base adr in heap */
vaddr += sizeof(struct raca) /* skip comm area */
+sizeof(struct mscp_header); /* m_cmdref disp */
vaddr += offset * sizeof(struct mscp); /* skip previous */
***************
*** 829,839 ****
ragetcp(sc)
register ra_softcT *sc;
{
! register struct mscp *mp;
! register int i;
! int s;
s = splbio();
i = sc->sc_lastcmd;
if ((sc->sc_com->ra_ca.ca_cmd[i].hsh & (RA_OWN|RA_INT)) == RA_INT
&& sc->sc_credits >= 2) {
--- 791,804 ----
ragetcp(sc)
register ra_softcT *sc;
{
! register struct mscp *mp = NULL;
! register int i;
! int s;
! segm seg5;
s = splbio();
+ saveseg5(seg5);
+ mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
i = sc->sc_lastcmd;
if ((sc->sc_com->ra_ca.ca_cmd[i].hsh & (RA_OWN|RA_INT)) == RA_INT
&& sc->sc_credits >= 2) {
***************
*** 842,858 ****
mp = &sc->sc_com->ra_cmd[i];
ramsgclear(mp);
sc->sc_lastcmd = (i + 1) % NCMD;
- splx(s);
- return(mp);
}
!
splx(s);
! return(NULL);
}
/* Clear a mscp command packet */
ramsgclear(mp)
! register struct mscp *mp;
{
mp->m_unit = mp->m_modifier = mp->m_flags =
mp->m_bytecnt = mp->m_buf_l = mp->m_buf_h =
--- 807,821 ----
mp = &sc->sc_com->ra_cmd[i];
ramsgclear(mp);
sc->sc_lastcmd = (i + 1) % NCMD;
}
! restorseg5(seg5);
splx(s);
! return(mp);
}
/* Clear a mscp command packet */
ramsgclear(mp)
! register struct mscp *mp;
{
mp->m_unit = mp->m_modifier = mp->m_flags =
mp->m_bytecnt = mp->m_buf_l = mp->m_buf_h =
***************
*** 862,870 ****
/* Scan for response messages */
rarspring(sc)
! register ra_softcT *sc;
{
! register int i;
sc->sc_com->ra_ca.ca_rspint = 0;
i = sc->sc_lastrsp;
--- 825,833 ----
/* Scan for response messages */
rarspring(sc)
! register ra_softcT *sc;
{
! register int i;
sc->sc_com->ra_ca.ca_rspint = 0;
i = sc->sc_lastrsp;
***************
*** 883,895 ****
* Process a response packet
*/
rarsp(mp, sc)
! register struct mscp *mp;
! register ra_softcT *sc;
{
! register struct buf *dp;
! struct buf *bp;
! ra_infoT *disk;
! int st;
/*
* Reset packet length and check controller credits
--- 846,858 ----
* Process a response packet
*/
rarsp(mp, sc)
! register struct mscp *mp;
! register ra_softcT *sc;
{
! register struct buf *dp;
! struct buf *bp;
! ra_infoT *disk;
! int st;
/*
* Reset packet length and check controller credits
***************
*** 912,918 ****
* The controller interrupts as drive ZERO so check for it first.
*/
st = mp->m_status & M_S_MASK;
! if ((mp->m_opcode & 0xff) == (M_O_STCON|M_O_END)) {
if (st == M_S_SUCC)
sc->sc_state = S_RUN;
else
--- 875,881 ----
* The controller interrupts as drive ZERO so check for it first.
*/
st = mp->m_status & M_S_MASK;
! if (mp->m_opcode == (M_O_STCON|M_O_END)) {
if (st == M_S_SUCC)
sc->sc_state = S_RUN;
else
***************
*** 925,931 ****
/*
* Check drive and then decode response and take action.
*/
! switch (mp->m_opcode & 0xff) {
case M_O_ONLIN|M_O_END:
if ((disk = sc->sc_drives[mp->m_unit]) == NULL) {
printf("ra: couldn't ONLINE disk!\n");
--- 888,894 ----
/*
* Check drive and then decode response and take action.
*/
! switch (mp->m_opcode) {
case M_O_ONLIN|M_O_END:
if ((disk = sc->sc_drives[mp->m_unit]) == NULL) {
printf("ra: couldn't ONLINE disk!\n");
***************
*** 963,969 ****
/* it went offline and we didn't notice */
PRINTD(("ra%d: unit %d attention\n", sc->sc_unit, mp->m_unit));
if ((disk = sc->sc_drives[mp->m_unit]) != NULL)
! disk->ra_dsize = 0;
break;
case M_O_END:
--- 926,932 ----
/* it went offline and we didn't notice */
PRINTD(("ra%d: unit %d attention\n", sc->sc_unit, mp->m_unit));
if ((disk = sc->sc_drives[mp->m_unit]) != NULL)
! disk->ra_dsize = -1L;
break;
case M_O_END:
***************
*** 996,1016 ****
}
#endif
if (st == M_S_OFFLN || st == M_S_AVLBL) {
! /*
! * mark unit offline
! */
disk->ra_dsize = -1L;
! /*
! * Link the buffer onto the front of the drive queue
! */
if ((bp->av_forw = dp->b_actf) == 0)
dp->b_actl = bp;
dp->b_actf = bp;
! /*
! * Link the drive onto the controller queue
! */
if (dp->b_active == 0) {
dp->b_forw = NULL;
if (sc->sc_ctab.b_actf == NULL)
--- 959,973 ----
}
#endif
if (st == M_S_OFFLN || st == M_S_AVLBL) {
! /* mark unit offline */
disk->ra_dsize = -1L;
! /* Link the buffer onto the front of the drive queue */
if ((bp->av_forw = dp->b_actf) == 0)
dp->b_actl = bp;
dp->b_actf = bp;
! /* Link the drive onto the controller queue */
if (dp->b_active == 0) {
dp->b_forw = NULL;
if (sc->sc_ctab.b_actf == NULL)
***************
*** 1024,1030 ****
}
if (st != M_S_SUCC) {
harderr(bp, "ra");
! printf("status %o\n", mp->m_status);
bp->b_flags |= B_ERROR;
}
bp->b_resid = bp->b_bcount - mp->m_bytecnt;
--- 981,987 ----
}
if (st != M_S_SUCC) {
harderr(bp, "ra");
! log(LOG_INFO, "status %o\n", mp->m_status);
bp->b_flags |= B_ERROR;
}
bp->b_resid = bp->b_bcount - mp->m_bytecnt;
***************
*** 1035,1041 ****
break;
default:
! printf("ra: unknown packet opcode=0%o\n", mp->m_opcode & 0xff);
ra_error((caddr_t)mp);
}
}
--- 992,998 ----
break;
default:
! log(LOG_INFO,"ra: unknown opcode=0%o\n", mp->m_opcode);
ra_error((caddr_t)mp);
}
}
***************
*** 1061,1067 ****
switch (hiint(mp->m_mediaid) & 0xff) {
case 25:/* RC25 removable */
disk->ra_size = ra25_sizes;
- disk->ra_dsize -= RC_RCT;
break;
case 33:/* RX33 Floppy disk */
case 50:/* RX50 Floppy disk */
--- 1018,1023 ----
***************
*** 1071,1101 ****
case 52:/* RD Hard disks */
case 53:
disk->ra_size = rd52_sizes;
- disk->ra_dsize -= RD_RCT;
break;
case 54:
disk->ra_size = rd54_sizes;
- disk->ra_dsize -= RD_RCT;
break;
! case 60:/* RA Hard disks */
disk->ra_size = ra60_sizes;
- disk->ra_dsize -= RA_RCT;
break;
case 80:
disk->ra_size = ra80_sizes;
- disk->ra_dsize -= RA_RCT;
break;
case 81:
disk->ra_size = ra81_sizes;
- disk->ra_dsize -= RA_RCT;
break;
case 82:
disk->ra_size = ra82_sizes;
- disk->ra_dsize -= RA_RCT;
break;
default:
printf("ra: disk type %d unknown\n",
! hiint(mp->m_mediaid) & 0xff);
}
}
--- 1027,1051 ----
case 52:/* RD Hard disks */
case 53:
disk->ra_size = rd52_sizes;
break;
case 54:
disk->ra_size = rd54_sizes;
break;
! case 60:
disk->ra_size = ra60_sizes;
break;
case 80:
disk->ra_size = ra80_sizes;
break;
case 81:
disk->ra_size = ra81_sizes;
break;
case 82:
disk->ra_size = ra82_sizes;
break;
default:
printf("ra: disk type %d unknown\n",
! hiint(mp->m_mediaid) & 0xff);
}
}
***************
*** 1104,1110 ****
*
* For now, just log the error on the console. Only minimal decoding is done,
* only "useful" information is printed. Eventually should send message to
! * an error logger.
*/
ra_error(mp)
register struct mslg *mp;
--- 1054,1061 ----
*
* For now, just log the error on the console. Only minimal decoding is done,
* only "useful" information is printed. Eventually should send message to
! * an error logger. At least 90 bytes of D space were saved without losing
! * functionality.
*/
ra_error(mp)
register struct mslg *mp;
***************
*** 1114,1147 ****
switch (mp->me_format) {
case M_F_CNTERR:
! printf("controller error, event 0%o\n", mp->me_event);
break;
-
case M_F_BUSADDR:
! printf("host memory access error, event 0%o, addr 0%o\n",
! mp->me_event, mp->me_busaddr);
break;
-
case M_F_DISKTRN:
! printf("disk transfer error, unit %d, grp 0x%x, hdr 0x%x\n",
mp->me_unit, mp->me_group, mp->me_hdr);
break;
-
case M_F_SDI:
! printf("SDI error, unit %d, event 0%o, hdr 0x%x\n",
! mp->me_unit, mp->me_event, mp->me_hdr);
break;
-
case M_F_SMLDSK:
! printf("small disk error, unit %d, event 0%o, cyl %d\n",
! mp->me_unit, mp->me_event, mp->me_sdecyl);
break;
-
default:
! printf("unknown error, unit %d, format 0%o, event 0%o\n",
! mp->me_unit, mp->me_format, mp->me_event);
}
#ifdef RADEBUG
/* If error debug on, do hex dump */
{
--- 1065,1092 ----
switch (mp->me_format) {
case M_F_CNTERR:
! printf("controller");
break;
case M_F_BUSADDR:
! printf("host memory access addr 0%o", mp->me_busaddr);
break;
case M_F_DISKTRN:
! printf("disk transfer, unit %d grp 0x%x hdr 0x%x",
mp->me_unit, mp->me_group, mp->me_hdr);
break;
case M_F_SDI:
! printf("SDI, unit %d hdr 0x%x", mp->me_unit, mp->me_hdr);
break;
case M_F_SMLDSK:
! printf("small disk, unit %d cyl %d",
! mp->me_unit, mp->me_sdecyl);
break;
default:
! printf("unknown, unit %d format 0%o",mp->me_unit,mp->me_format);
}
+ printf(", event 0%o\n", mp->me_event);
+
#ifdef RADEBUG
/* If error debug on, do hex dump */
{
***************
*** 1165,1181 ****
radump(dev)
dev_t dev;
{
! register ra_softcT *sc;
! register ra_infoT *disk;
! register struct mscp *mp;
! struct mscp *racmd();
! daddr_t bn, dumpsize;
! long paddr, maddr;
! int count;
#ifdef UNIBUS_MAP
! struct ubmap *ubp;
#endif
! int unit, partition;
/* paranoia, space hack */
disk = ra_disks;
--- 1110,1127 ----
radump(dev)
dev_t dev;
{
! register ra_softcT *sc;
! register ra_infoT *disk;
! register struct mscp *mp;
! struct mscp *racmd();
! daddr_t bn, dumpsize;
! long paddr, maddr;
! int count;
#ifdef UNIBUS_MAP
! struct ubmap *ubp;
#endif
! int unit, partition;
! segm seg5;
/* paranoia, space hack */
disk = ra_disks;
***************
*** 1186,1208 ****
return(EINVAL);
/* Init RA controller */
! paddr = raphys((u_int)ra_com);
! racomphys.b_un.b_addr = (caddr_t)loint(paddr);
! racomphys.b_xmem = hiint(paddr);
#ifdef UNIBUS_MAP
if (ubmap) {
ubp = UBMAP;
! ubp->ub_lo = loint(racomphys.b_un.b_addr);
! ubp->ub_hi = hiint(racomphys.b_xmem);
! racomphys.b_un.b_addr = racomphys.b_xmem = 0;
}
#endif
/* Get communications area and clear out packets */
! paddr = (u_int)racomphys.b_un.b_addr
! + ((long)racomphys.b_xmem << 16)
! + (u_int)RINGBASE;
! sc->sc_com = ra_com;
mp = sc->sc_com->ra_rsp;
sc->sc_com->ra_ca.ca_cmdint = sc->sc_com->ra_ca.ca_rspint = 0;
bzero((caddr_t)mp, 2 * sizeof(*mp));
--- 1132,1150 ----
return(EINVAL);
/* Init RA controller */
! paddr = _iomap(ra_com[sc->sc_unit]);
#ifdef UNIBUS_MAP
if (ubmap) {
ubp = UBMAP;
! ubp->ub_lo = loint(paddr);
! ubp->ub_hi = hiint(paddr);
}
#endif
/* Get communications area and clear out packets */
! paddr += RINGBASE;
! saveseg5(seg5);
! mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
mp = sc->sc_com->ra_rsp;
sc->sc_com->ra_ca.ca_cmdint = sc->sc_com->ra_ca.ca_rspint = 0;
bzero((caddr_t)mp, 2 * sizeof(*mp));
***************
*** 1221,1230 ****
while ((sc->RAADDR->rasa & RA_STEP4) == 0)
/*void*/;
sc->RAADDR->rasa = RA_GO;
- sc->sc_unit = 0;
ramsginit(sc, sc->sc_com->ra_ca.ca_rsp, mp, 0, 2, 0);
if (!racmd(M_O_STCON, unit, sc)) {
! PRINTB(("radump: failed to stat controller\n"));
return(EFAULT);
}
PRINTB(("radump: controller up ok\n"));
--- 1163,1171 ----
while ((sc->RAADDR->rasa & RA_STEP4) == 0)
/*void*/;
sc->RAADDR->rasa = RA_GO;
ramsginit(sc, sc->sc_com->ra_ca.ca_rsp, mp, 0, 2, 0);
if (!racmd(M_O_STCON, unit, sc)) {
! PRINTB(("radump: failed to start controller\n"));
return(EFAULT);
}
PRINTB(("radump: controller up ok\n"));
***************
*** 1278,1301 ****
paddr += (DBSIZE << PGSHIFT);
}
!
return(0);
}
struct mscp *
racmd(op, unit, sc)
! int op, unit;
! register ra_softcT *sc;
{
! register struct mscp *cmp, *rmp;
! Trl *rlp;
! int i;
cmp = &sc->sc_com->ra_rsp[1];
rmp = &sc->sc_com->ra_rsp[0];
rlp = &sc->sc_com->ra_ca.ca_rsp[0];
cmp->m_opcode = op;
! cmp->m_unit = unit & 7;
cmp->m_header.ra_msglen = rmp->m_header.ra_msglen = sizeof(struct mscp);
rlp[0].hsh &= ~RA_INT;
rlp[1].hsh &= ~RA_INT;
--- 1219,1242 ----
paddr += (DBSIZE << PGSHIFT);
}
! restorseg5(seg5);
return(0);
}
struct mscp *
racmd(op, unit, sc)
! int op, unit;
! register ra_softcT *sc;
{
! register struct mscp *cmp, *rmp;
! Trl *rlp;
! int i;
cmp = &sc->sc_com->ra_rsp[1];
rmp = &sc->sc_com->ra_rsp[0];
rlp = &sc->sc_com->ra_ca.ca_rsp[0];
cmp->m_opcode = op;
! cmp->m_unit = unit;
cmp->m_header.ra_msglen = rmp->m_header.ra_msglen = sizeof(struct mscp);
rlp[0].hsh &= ~RA_INT;
rlp[1].hsh &= ~RA_INT;
***************
*** 1310,1316 ****
/*void*/;
sc->sc_com->ra_ca.ca_rspint = 0;
sc->sc_com->ra_ca.ca_cmdint = 0;
! if ((rmp->m_opcode & 0xff) != (op | M_O_END)
|| (rmp->m_status & M_S_MASK) != M_S_SUCC) {
ra_error(unit, rmp);
return(0);
--- 1251,1257 ----
/*void*/;
sc->sc_com->ra_ca.ca_rspint = 0;
sc->sc_com->ra_ca.ca_cmdint = 0;
! if (rmp->m_opcode != (op | M_O_END)
|| (rmp->m_status & M_S_MASK) != M_S_SUCC) {
ra_error(unit, rmp);
return(0);
More information about the Comp.bugs.2bsd
mailing list