From: ejh@slustl.uucp (Eric J. Haug)
Subject: Mods to pace's Adaptec driver for Archive 2150
Organization: St. Louis Univ.
Date: Wed, 8 Apr 1992 17:26:06 GMT

Enclosed please find diffs to pace's aha15XX driver.
these diffs allow it to work with an archive 2150.
they disable the variable block size feature pace uses
with the Exabyte.
It is preliminary, as some of the comments mention
I just got enough working to backup my system.
Thought some others would like it.
UGH_DOS is a start at kernel changes for dos partitioning.

*** as.c	Wed Apr  8 12:23:49 1992
--- as.c.pace	Wed Apr  8 11:54:08 1992
***************
*** 5,11 ****
   *
-  * Pace's driver modified per info from James da Silva's minix driver
-  * by Eric Haug       hauge@slufxa.slu.edu April 1, 1992 
-  * you might get more information from Adaptec BBS 1-408-945-7727
-  * and NCR SCSI BBS 1-316-636-8700
-  *
   * Placed in the public domain with NO WARRANTIES, not even the
--- 5,6 ----
***************
*** 23,25 ****
   * Also, don't forget to update sys/i386/conf/files.i386.
-  * Older 386BSD config may not update bdevsw and cdevsw in ../i386/conf.c
   *
--- 18,19 ----
***************
*** 30,32 ****
   *   SONY CDU-541 cdrom
-  *   Archive 2150 with ejh's mods
   *
--- 24,25 ----
***************
*** 85,90 ****
  extern char *readdisklabel ();
- #ifdef	UGH_DOS
- #include <dospart.h>
- extern char *readdoslabel();
- #endif
  int asstrategy ();
--- 78,79 ----
***************
*** 117,122 ****
  	struct disklabel label;
- #ifdef	UGH_DOS
- 	dospartition dospart[4];
- 	int have_dos_label;
- #endif
  	int have_label;
--- 106,107 ----
***************
*** 172,175 ****
  		return (1);
- 	if (val & AS_STATUS_DIAGF)	/* ejh */
- 		printf("as: Controller failed selftest\n");
  	return (0);
--- 157,158 ----
***************
*** 258,260 ****
  
- 	/* this contains quite a bit of stuff that should be in asattach - ejh */
  asopen (dev, flag)
--- 241,242 ----
***************
*** 377,422 ****
  
! 	if (as->tape == 0) {
! 		/* do mode select to set the logical block size */
! 		as->scsi_cdb_len = 6;
! 		cdb = as->scsi_cdb;
! 		bzero (cdb, 6);
! 		cdb[0] = 0x15; /* MODE SELECT */
! 		cdb[4] = 12; /* parameter list length */
  
! 		p = bp->b_un.b_addr;
! 		bzero (p, 12);
! 		p[3] = 8; /* block descriptor length */
! 		n = DEV_BSIZE;
! 		/* n = as->tape ? 0 : DEV_BSIZE; /* */
! 		p[9] = n >> 16;
! 		p[10] = n >> 8;
! 		p[11] = n;
  
! 		if (error = ascmd (as, bp, B_WRITE, 12, 2))
! 			goto done;
  
! #ifdef	UGH_DOS
! 		/* read dos disk label to find 386BSD partition */
! 		bzero ((caddr_t)&as->dospart[0], sizeof as->dospart);
! 		
! 		/* read label using "c" partition */
! 		if ((p = readdoslabel (makeasdev (major (dev),
! 				   dev_target (dev), 2),
! 				asstrategy, &as->dospart[0])) == NULL)
! 		{
! 			as->have_dos_label = 1;
! 		} else {
! 			if (asverbose || dev_part (dev) != 2)
! 				printf ("error reading dos label: %s\n", p);
! 			if (dev_part (dev) != 2) {
! 				error = EINVAL;
! 				goto done;
! 			}
! 		}
! 			/* use the 0x38 partition to establish
! 			 * new limits for the operation of this device
! 			 */
! 		if ( as->have_dos_label ) {
! 		}
! #endif
  		/* read disk label */
--- 359,379 ----
  
! 	/* do mode select to set the logical block size */
! 	as->scsi_cdb_len = 6;
! 	cdb = as->scsi_cdb;
! 	bzero (cdb, 6);
! 	cdb[0] = 0x15; /* MODE SELECT */
! 	cdb[4] = 12; /* parameter list length */
  
! 	p = bp->b_un.b_addr;
! 	bzero (p, 12);
! 	p[3] = 8; /* block descriptor length */
! 	n = as->tape ? 0 : DEV_BSIZE;
! 	p[9] = n >> 16;
! 	p[10] = n >> 8;
! 	p[11] = n;
  
! 	if (error = ascmd (as, bp, B_WRITE, 12, 2))
! 		goto done;
  
! 	if (as->tape == 0) {
  		/* read disk label */
***************
*** 440,457 ****
  		}
- 	} else {
- 			/* tape specific cmds  ejh */
- 		bzero(cdb, 6);
- 		cdb[0] = 0x1A;	/* SCSI_MDSENSE */
- 		cdb[4] = 255;
- 		if (error = ascmd (as, bp, B_WRITE, 12, 2))
- 			goto done;
- 		printf("as: ctp%d data len %d medium %d speed/bufmode 0x%x desc len %d\n",
- 			as->dev, p[0], p[1], p[2], p[3]);
- 		bzero(cdb, 6);
- 		cdb[0] = 0x00;	/* SCSI_UNITRDY */
- 		if (error = ascmd (as, bp, B_WRITE, 12, 2)) {
- 			printf("as%d: drive not online\n");
- 			goto done;
- 		}
- 
  	}
--- 397,398 ----
***************
*** 796,799 ****
  		total = bp->b_bcount;
- 		blkno = bp->b_blkno;
- 		nblocks = bp->b_bcount / DEV_BSIZE;
  	}
--- 737,738 ----
***************
*** 875,881 ****
  		cdb[0] = (bp->b_flags & B_READ) ? 8 : 0xa;
- #ifdef	HASPROBLEMS
- 		/* should have a special device type or flag for variable
- 		 * block size devices,  add the SCSI get device commands
- 		 * to determine this
- 		 */
  		cdb[1] = 0; /* logical unit 0, variable block size */
--- 814,815 ----
***************
*** 885,892 ****
  		cdb[4] = bp->b_bcount;
- #else
- 		cdb[1] = 1;
- 		cdb[2] = nblocks >> 16;
- 		cdb[3] = nblocks >> 8;
- 		cdb[4] = nblocks;
- #endif
  		cdb[5] = 0; /* control byte (used in linking) */
--- 819,820 ----