Subject: TS device fails to autoconfigure
Index:	sys/autoconfig/tsauto.c 2.11BSD

Description:
	/etc/autoconfig sometimes fails to successfully probe for a
	TS tape controller even though the device is present in the
	system.

Repeat-By:
	Difficult.  Sometimes the probe for the device would succeed
	while other times the probe would fail.

Fix:
	Apply the following update to tsauto.c then rebuild and install
	/etc/autoconfig.  Note that the XXauto.c routines have been relocated
	from pdpuba/ and pdp/ to the autoconfig/ directory.

	The logic used is borrowed from the "universal" tape boot block
	and relies on the NeedBufferAddress bit behaviour of the TS device.
	This has proven to be much more reliable in distinguishing between
	TS and TM devices than the earlier method.
-----------------------------------------------------------------------------
*** /sys/autoconfig/tsauto.c.old	Fri Sep 30 05:35:33 1988
--- /sys/autoconfig/tsauto.c	Tue Dec 10 09:27:56 1991
***************
*** 3,9 ****
   * 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"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)tsauto.c	2.0 (2.11BSD) 12/9/91
   */
  
  #include "param.h"
***************
*** 10,31 ****
  #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);
  }
--- 10,35 ----
  #include "../machine/autoconfig.h"
  #include "../machine/machparam.h"
  
! #include "tsreg.h"
  
  tsprobe(addr)
! 	register 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.  We borrow from
! 	 * the "universal" tape boot block by poking the controller and
! 	 * looking for the "need buffer address" bit from a TS.  If that
! 	 * bit fails to come on the device is not a TS.
  	 */
  	errno = 0;
! 	stuff(0, &addr->tssr);		/* poke the controller */
! 	if (errno)			/* paranoia */
  		return(ACP_NXDEV);
! 	DELAY(100L);			/* give TS time for diagnostics */
! 	if (grab(&addr->tssr) & TS_NBA)	/* need buffer address bit on? */
! 		return(ACP_EXISTS);	/* yes = return existence */
! 	return(ACP_NXDEV);		/* not a TS */
  }
