[comp.bugs.2bsd] Problems with Spectralogic "Spectra 25-Plus" disk/tape controller

casey@CS.UCLA.EDU (09/29/88)

  Mike King (mike@cvs.rochester.edu) of Rochester is having problems
getting autoconfig to recognize the TS portion of his Spectralogic
"Spectra 25-Plus".  tsauto.c is returning ACP_NXDEV which is causing
autoconfig to refuse to attach the TS emulator.  tsauto tries to read
memory location

	((struct tmdevice *)addr)->tmba

to determine whether there's a TS around.  Returning ACP_EXISTS (success)
if trying to grab the word generates an error, and ACP_NXDEV (failure) if
it doesn't generate an error.

  The problem is that the TS and the TM share the same CSR address
(0172520), but the *standard* TS CSR is only two words long:

	/*
	 * TS11 controller registers
	 */
	struct tsdevice {
		u_short	tsdb;		/* data buffer */
		u_short	tssr;		/* status register */
	};

and the TM CSR is seven words long:

	/*
	 * TM11 controller registers
	 */
	struct tmdevice {
		u_short	tmer;		/* error register, per drive */
		u_short	tmcs;		/* control-status register */
		short	tmbc;		/* byte/frame count */
		caddr_t	tmba;		/* address */
		short	tmdb;		/* data buffer */
		short	tmrd;		/* read lines */
		short	tmmr;		/* maintenance register */
	};

 As one can see, tmba is beyond the last legal address in a TS CSR, so
testing for its existence should a perfectly reasonable way to determine
what kind of tape controller we really have.  But, apparently the
Spectralogic has status registers up there.  Can someone tell me where
the Spectralogic's status registers end?  This is especially important
because we now have an integrated primary tape boot strap that has a TS,
TM, and HT driver in it and it uses this same technique to determine what
kind of tape controller is really out there (though it uses tmmr instead
of tmba).

  If you have any information on this, please send it as soon as you
can.  Thanks for your help!

Casey

casey@admin.cognet.ucla.edu (Casey Leedom) (09/30/88)

> From: Carl Lowenstein <cdl@mplvax.nosc.mil>
> 
> The problem is more general than just SpectraLogic.  What if one has (as
> I do) two or more TS11 drives at consecutive bus addresses.  Then testing
> at address tmba = tmer+6 (0177526) gets instead tssr of the second TS11.
> tssr0 + 4 = 0177526.  More so if you have 3 drives etc.
> 
> I have meant to look in the RT11 sources to see how DEC software
> distinguishes a TM11 from a TS11, since they seem to do it successfully.  
> 
> Thanks to networked computers, I got hold of my RT11 sources without
> having to leave this chair.  DEC tells the difference between TS11 and
> TM11 with the following PDP11 assembly language (paraphrased):  (this is
> DEC-flavor not unix-flavor assembly language)
> 
> 	MOV	#MTCSR, R0		; point to control-status
> 	MOV	#1000, 2(R0)		; try to select unit 2
> 	BIT	#1000, 2(R0)		;  did it work?
> 	BNE	GOOD			; yes, it is a TM11
> 
> Note that selecting unit 2 is a benign thing to do even if you have only
> one TM11 drive.  The controller can select up to 8 drives even if they
> are not present.  Of course, the non-existent drive doesn't report that
> it is ready.

  Thank you much Carl!!!  Here's my stab at modifying pdpuba/tsauto.c to
do what you suggest.  If everyone who can would test it I'd appreciate
it.  If it works correctly, I'll work it into my new mtboot.s primary
tape bootstrap for pdpstand and get that tested.  Please send responses
as soon as possible as we're really (for sure this time (cross my heart
and hope to die)) getting ready to cut our second release.

Casey

-----
/*
 * Copyright (c) 1986 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)tsauto.c	1.1 (2.10BSD Berkeley) 12/1/86
 */

#include "param.h"
#include "../machine/autoconfig.h"
#include "../machine/machparam.h"

#include "tmreg.h"

tsprobe(addr)
	struct tsdevice *addr;
{
	extern int errno;

	/*
	 * Unfortunately the TS and TM CSRs overlap.  So simply testing for
	 * presence of a TS register isn't good enough.  So we try to do a
	 * TM select of drive 2.  If we get a bus fault or if the select
	 * works, we don't have a TS.
	 */
	errno = 0;
	stuff(01000, &(((struct tmdevice *)addr)->tmcs));
	if (errno || (grab(&(((struct tmdevice *)addr)->tmcs)) & 01000))
		return(ACP_NXDEV);
	return(ACP_EXISTS);
}