From appli.appli.se!appli.se!owner-amiga-mach@appli.se Wed Oct 21 09:17:57 1992
Received: by bruce (5.57/1.34)
	id AA04846; Wed, 21 Oct 92 09:17:34 +1000
Received: from [192.71.220.11] by sol0. (5.61/SMI-3.2)
	id AA24503; Wed, 21 Oct 92 07:19:12 +1000
Received: by mail.swip.net (5.65c8/1.2)
	id AA18130; Tue, 20 Oct 1992 22:17:03 +0100
Received: by appli.appli.se (/\=-/\ Smail3.1.17.5 #17.26)
	id <m0mhPtm-0000TjC@appli.appli.se>; Tue, 20 Oct 92 22:09 MDT
Received: by appli.appli.se (/\=-/\ Smail3.1.17.5 #17.26)
	id <m0mhPti-0000RgC@appli.appli.se>; Tue, 20 Oct 92 22:09 MDT
Return-Path: <msu.oscs.montana.edu!osymh>
Received: by appli.appli.se (/\=-/\ Smail3.1.17.5 #17.26)
	id <m0mhPtP-0000TwC@appli.appli.se>; Tue, 20 Oct 92 22:09 MDT
Received: from trex.oscs.montana.edu by mail.swip.net (5.65c8/1.2)
	id AA17649; Tue, 20 Oct 1992 21:53:28 +0100
Received: by trex.oscs.montana.edu (MX V3.1C) id 10131; Tue, 20 Oct 1992
          14:53:10 MDT
Sender: osymh@trex.oscs.montana.edu
Date: Tue, 20 Oct 1992 14:53:03 MDT
From: "Michael L. Hitch" <osymh@trex.oscs.montana.edu>
Reply-To: osymh@trex.oscs.montana.edu
To: amiga-mach@appli.se
Message-Id: <0096260F.CEB17660.10131@trex.oscs.montana.edu>
Subject: Fix to SCSI sense command data structure for Amiga Mach kernel
Sender: owner-amiga-mach@appli.se
Status: OR

  Here's the diffs for my changes to fix the scsi sense data structure
definition and use.

*** scsi/rz_disk.c.orig	Thu Aug  6 21:30:51 1992
--- scsi/rz_disk.c	Sat Oct 17 20:52:15 1992
***************
*** 520,526 ****
  			ior->io_op = ior->io_temporary;
  
  			sns = (scsi_sense_data_t *)tgt->cmd_ptr;
! 			if (sns->addr_valid)
  				blockno = sns->u.xtended.info0 << 24 |
  					  sns->u.xtended.info1 << 16 |
  					  sns->u.xtended.info2 <<  8 |
--- 520,526 ----
  			ior->io_op = ior->io_temporary;
  
  			sns = (scsi_sense_data_t *)tgt->cmd_ptr;
! 			if (sns->u.xtended.addr_valid)
  				blockno = sns->u.xtended.info0 << 24 |
  					  sns->u.xtended.info1 << 16 |
  					  sns->u.xtended.info2 <<  8 |
***************
*** 555,561 ****
  			     * event, the queue of requests is effectively frozen.
  			     */
  			    if (ior->io_error && 
! 				((sns->error_class == SCSI_SNS_XTENDED_SENSE_DATA) &&
  				 ((sns->u.xtended.sense_key == SCSI_SNS_HW_ERR) ||
  				  (sns->u.xtended.sense_key == SCSI_SNS_MEDIUM_ERR))) &&
  			    	scdisk_bad_block_repl(tgt, blockno))
--- 555,561 ----
  			     * event, the queue of requests is effectively frozen.
  			     */
  			    if (ior->io_error && 
! 				((sns->u.xtended.error_class == SCSI_SNS_XTENDED_SENSE_DATA) &&
  				 ((sns->u.xtended.sense_key == SCSI_SNS_HW_ERR) ||
  				  (sns->u.xtended.sense_key == SCSI_SNS_MEDIUM_ERR))) &&
  			    	scdisk_bad_block_repl(tgt, blockno))
*** scsi/scsi_alldevs.c.orig	Thu Aug  6 21:31:00 1992
--- scsi/scsi_alldevs.c	Sat Oct 17 20:52:16 1992
***************
*** 305,313 ****
  {
  	unsigned char   code;
  
! 	if (sns->error_class != SCSI_SNS_XTENDED_SENSE_DATA) {
  		printf("Bad sense data, vuqe class x%x code x%x\n",
! 			sns->error_class, sns->error_code);
  		return FALSE;	/* and good luck */
  	} else {
  		code = sns->u.xtended.sense_key;
--- 305,313 ----
  {
  	unsigned char   code;
  
! 	if (sns->u.xtended.error_class != SCSI_SNS_XTENDED_SENSE_DATA) {
  		printf("Bad sense data, vuqe class x%x code x%x\n",
! 			sns->u.non_xtnded.error_class, sns->u.non_xtnded.error_code);
  		return FALSE;	/* and good luck */
  	} else {
  		code = sns->u.xtended.sense_key;
***************
*** 677,683 ****
  	if (sns->u.xtended.eom) printf(", EndOfMedium");
  	if (sns->u.xtended.fm) printf(", FileMark");
  
! 	if (sns->addr_valid) {
  		unsigned int info;
  		info =  (sns->u.xtended.info0 << 24) |
  			(sns->u.xtended.info1 << 16) |
--- 677,683 ----
  	if (sns->u.xtended.eom) printf(", EndOfMedium");
  	if (sns->u.xtended.fm) printf(", FileMark");
  
! 	if (sns->u.xtended.addr_valid) {
  		unsigned int info;
  		info =  (sns->u.xtended.info0 << 24) |
  			(sns->u.xtended.info1 << 16) |
*** scsi/scsi.h.orig	Thu Jun 20 17:49:40 1991
--- scsi/scsi.h	Sat Oct 17 20:45:40 1992
***************
*** 502,514 ****
  #define	SCSI_SNS_RESERVED	0xf
  
  typedef struct {
- 	BITFIELD_3( unsigned char,
- 		error_code : 4,
- 		error_class : 3,
- 		addr_valid : 1);
- #	define	SCSI_SNS_XTENDED_SENSE_DATA	0x7	/* e.g. error_class=7 */
  	union {
  	    struct {
  		BITFIELD_2(unsigned char,
  			lba_msb : 5,
  			vuqe : 3);
--- 502,514 ----
  #define	SCSI_SNS_RESERVED	0xf
  
  typedef struct {
  	union {
  	    struct {
+ 		BITFIELD_3( unsigned char,
+ 		    error_code : 4,
+ 		    error_class : 3,
+ 		    addr_valid : 1);
+ #	define	SCSI_SNS_XTENDED_SENSE_DATA	0x7	/* e.g. error_class=7 */
  		BITFIELD_2(unsigned char,
  			lba_msb : 5,
  			vuqe : 3);
***************
*** 516,521 ****
--- 516,525 ----
  		unsigned char	lba_lsb;
  	    } non_xtnded;
  	    struct {
+ 		BITFIELD_3( unsigned char,
+ 		    error_code : 4,
+ 		    error_class : 3,
+ 		    addr_valid : 1);
  		unsigned char	segment_number;
  		BITFIELD_5(unsigned char,
  			sense_key : 4,
---
Michael L. Hitch                        osymh@msu.oscs.montana.edu 
Computer Consultant                     OSYMH@MTSUNIX1.BITNET
Office of Systems and Computing Services
Montana State University
Bozeman, MT     USA

