*BSD News Article 3876


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!mips!mips!darwin.sura.net!Sirius.dfn.de!math.fu-berlin.de!news.th-darmstadt.de!news.uni-mainz.de!wilbur!grefen
From: grefen@wilbur.uni-mainz.de (Stefan Grefen)
Subject: Re: SCSI driver bug when accessing DOS partition
Message-ID: <8675IUH@minnie.zdv.uni-mainz.de>
Sender: grefen@wilbur (Stefan Grefen)
Nntp-Posting-Host: wilbur
Organization: Johannes Gutenberg Universitaet Mainz
References:  <1992Aug19.020535.2080@noose.ecn.purdue.edu>
Date: Wed, 19 Aug 1992 07:54:47 GMT
Lines: 150

In article <1992Aug19.020535.2080@noose.ecn.purdue.edu>, tgt@neon.ecn.purdue.edu (Conan the Librarian) writes:
|> I ran across the following Adaptec driver bug when attempting to configure
|> mtools to read an 80 Mb DOS partition d:, which is on a SCSI disk.  The
|> problem: the SCSI driver routine asstart (in the file /sys/i386/isa/as.c)
|> fails with the message "out of range, cannot happen?" (due to
|> nscatter==NSCATTER, which means nothing to me!!).  This subsequently
|> causes the disk_read() routine of mtools (in the file buf_read()) to fail,
|> printing the message "disk_read: read: Device not configured"
|> 
[stuff deleted]
|> Thanks very much.
|> 
|> -tom
I may have a patch for this I hacked as.c to do Scatter/Gather only if needed.
Diffs to as.c follows (usual disclaimer...if it breaks you are lost).
 Hope this helps.
Good Luck
  Stefan
-----------------------------------------------------------------
*** as.c.org	Thu Aug  6 05:23:58 1992
--- as.c	Thu Aug  6 08:10:24 1992
***************
*** 782,788 ****
  {
  	struct buf *bp;
  	int blknum;
! 	unsigned int physaddr;
  	struct ccb *ccb;
  	unsigned char *cdb;
  	int target;
--- 782,788 ----
  {
  	struct buf *bp;
  	int blknum;
! 	unsigned int physaddr,nphysaddr,ophysaddr;
  	struct ccb *ccb;
  	unsigned char *cdb;
  	int target;
***************
*** 790,796 ****
  	int n;
  	char *sp;
  	int nscatter;
! 	int thistime;
  	int nbytes;
  	struct partition *part;
  	int blkno;
--- 790,796 ----
  	int n;
  	char *sp;
  	int nscatter;
! 	int thistime,thistotal;
  	int nbytes;
  	struct partition *part;
  	int blkno;
***************
*** 870,876 ****
  			nblocks = 255;
  		total = nblocks * bs;
  if(asverbose)
! printf("total %d nblocks %d ", total, nblocks);
  		/*bp->b_bcount = total;	/* XXX partial tape block read - wrong */
  	} else {
  #ifdef nomore
--- 870,876 ----
  			nblocks = 255;
  		total = nblocks * bs;
  if(asverbose)
! 	printf("total %d nblocks %d ", total, nblocks);
  		/*bp->b_bcount = total;	/* XXX partial tape block read - wrong */
  	} else {
  #ifdef nomore
***************
*** 890,895 ****
--- 890,897 ----
  	n = 0;
  	sp = as->scatter_list;
  	nscatter = 0;
+ 	ophysaddr=nphysaddr=vtophys (p);
+ 	thistotal=0;
  	while (n < total && nscatter < NSCATTER) {
  		thistime = page_size - ((vm_offset_t)p - trunc_page (p));
  
***************
*** 899,918 ****
  		physaddr = vtophys (p);
  		
  		if (asverbose)
! 			printf ("%d bytes to %x (%x)\n",
! 				thistime, p, physaddr);
! 		sp[0] = thistime >> 16;
! 		sp[1] = thistime >> 8;
! 		sp[2] = thistime;
! 		sp[3] = physaddr >> 16;
! 		sp[4] = physaddr >> 8;
! 		sp[5] = physaddr;
! 		
  		p += thistime;
  		n += thistime;
! 		sp += 6;
! 		nscatter++;
  	}
  	
  	if (nscatter == NSCATTER) {
  		printf("out of range, cannot happen?");
--- 901,938 ----
  		physaddr = vtophys (p);
  		
  		if (asverbose)
! 			printf ("%d(%d) bytes to %x (%x,%x)\n",
! 				thistime,thistotal, p, physaddr,nphysaddr);
! 		if(physaddr!=nphysaddr) {
! 		  sp[0] = thistotal >> 16;
! 		  sp[1] = thistotal >> 8;
! 		  sp[2] = thistotal;
! 		  sp[3] = ophysaddr >> 16;
! 		  sp[4] = ophysaddr >> 8;
! 		  sp[5] = ophysaddr;
! 
! 	          thistotal=thistime;
! 		  ophysaddr=physaddr;
! 
! 		  nscatter++;
! 		  sp += 6;
! 		} else {
! 	          thistotal+=thistime;
! 		}
  		p += thistime;
  		n += thistime;
! 		nphysaddr=physaddr+thistime;
  	}
+ 	if(thistotal) {
+ 	  sp[0] = thistotal >> 16;
+ 	  sp[1] = thistotal >> 8;
+ 	  sp[2] = thistotal;
+ 	  sp[3] = ophysaddr >> 16;
+ 	  sp[4] = ophysaddr >> 8;
+ 	  sp[5] = ophysaddr;
+ 	  nscatter++;
+ 	  sp += 6;
+ 	 }
  	
  	if (nscatter == NSCATTER) {
  		printf("out of range, cannot happen?");


-- 
Stefan Grefen   ---   Johannes Gutenberg University Mainz   ---    Germany
Email: grefen@goofy.zdv.uni-mainz.de       ---        Phone:  06131/392415