MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page   0
Table of contents

    (3)      115        INIT_SCDRP_STACK - Initialize the internal SCDRP stack
    (3)      116        SUBPUSH		- Push an item on the SCDRP stack
    (3)      117        SUBPOP		- Pop an item from the SCDRP stack
    (3)      118        SUBSAVE		- Save a return address on the SCDRP stack
    (3)      119        SUBRETURN	- Return to the address saved on the SCDRP stack
    (4)      176        DO_MODE_PAGE
    (5)      468        DO_A_PAGE
    (6)      824        DO_MODE_SENSE
    (7)     1078        MODE_SELECT_HDR_SETUP
    (8)     1181        MODE_SELECT_DATA_SETUP
    (9)     1294        DO_MODE_SELECT
    (10)    1417        EXTRACT_FIELD
    (11)    1582        COMPARE_FIELD
    (12)    1643        TEST_CHANGEABLE
    (13)    1706        MAXIMIZE_ERROR
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page   1
X-1                                                                      12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (1)

                                     0000     1 
                                     0000     2 	.TITLE	MODE_SENSE_COMMON - Class driver common routines
                                     0000     3 	.IDENT	'X-1'
                                     0000     4 
                                     0000     5 ;****************************************************************************
                                     0000     6 ; 
                                     0000     7 ; Copyright © Digital Equipment Corporation, 1995 All Rights Reserved.
                                     0000     8 ; Unpublished rights reserved under the copyright laws of the United States.
                                     0000     9 ; 
                                     0000    10 ; The software contained on this media is proprietary to and embodies the
                                     0000    11 ; confidential technology of Digital Equipment Corporation.  Possession, use,
                                     0000    12 ; duplication or dissemination of the software and media is authorized only
                                     0000    13 ; pursuant to a valid written license from Digital Equipment Corporation.
                                     0000    14 ; 
                                     0000    15 ; RESTRICTED RIGHTS LEGEND   Use, duplication, or disclosure by the U.S.
                                     0000    16 ; Government is subject to restrictions as set forth in Subparagraph
                                     0000    17 ; (c)(1)(ii) of DFARS 252.227-7013, or in FAR 52.227-19, as applicable.
                                     0000    18 ; 
                                     0000    19 ;****************************************************************************
                                     0000    20 ;
                                     0000    21 ;          
                                     0000    22 ; FACILITY: DRIVER
                                     0000    23 ;                          
                                     0000    24 ; ABSTRACT:
                                     0000    25 ;
                                     0000    26 ;	This module contains MODE SENSE subroutines available to any 
                                     0000    27 ;	SCSI class driver.
                                     0000    28 ;
                                     0000    29 ; AUTHORS:
                                     0000    30 ;
                                     0000    31 ;	Tom Goodwin				CREATION DATE: 28-JUN-1994
                                     0000    32 ;
                                     0000    33 ;	Based on the design by Rick Lord
                                     0000    34 ;	Based on the OpenVMS AXP implementation by Sue Sommer
                                     0000    35 ;
                                     0000    36 ; REVISION HISTORY:
                                     0000    37 ;
                                     0000    38 ;	X-1	TGG0106		Tom Goodwin			16-Feb-1995
                                     0000    39 ;		Replace MPA_ARGS flag with SCDRP$V_TENBYTE to indicate
                                     0000    40 ;		support for 10 byte commands.  If a 10-byte command fails
                                     0000    41 ;		with a CHECK_CONDITION, back off to the 6-byte command
                                     0000    42 ;		unconditionally.
                                     0000    43 ;		TGG		Tom Goodwin			3-Nov-1994
                                     0000    44 ;		Initial version of Mode Sense routines, based on Rick Lord's 
                                     0000    45 ; 		algorithms and Sue Sommer's C code implemetation for
                                     0000    46 ;		OpenVMS Alpha. (Alpha version X-6 dated 8-May-1995).
                                     0000    47 ;	        X-6     SCS             Sue Sommer		8-May-1995
                                     0000    48 ;	                For tapes, return success in the case of CHECK 
                                     0000    49 ;	                CONDITIONs with sense key RECOVERED ERROR.  Since the 
                                     0000    50 ;	                operation succeeded after retries, there is no reason 
                                     0000    51 ;			to return failure.
                                     0000    52 ;	        X-5     JFD816          James F. Dunham		23-MAR-1995
                                     0000    53 ;	                Fix coding bug of unsigned compare to less than zero. 
                                     0000    54 ;	                The "C" compiler optimzed out the code regarding an 
                                     0000    55 ;	                code path for mode page descriptors that are in the 
                                     0000    56 ;			mode page header.
                                     0000    57 ;	        X-4     SCS             Sue Sommer              27-Jan-1995
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page   2
X-1                                                                      12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (1)

                                     0000    58 ;	                If SS$_CANCEL is returned by the class driver's 
                                     0000    59 ;	                SEND_COMMAND routine, propagate it back to the caller
                                     0000    60 ;	                rather than overwriting it.
                                     0000    61 ;	                If a 10-byte command fails with a CHECK CONDITION, 
                                     0000    62 ;	                back off to the 6-byte command unconditionally.
                                     0000    63 ;	        X-3     SCS             Sue Sommer              7-Nov-1994
                                     0000    64 ;	                Replace mpa_args flag with scdrp$v_flag_tenbyte to 
                                     0000    65 ;	                indicate support for 10-byte commands.
                                     0000    66 ;	        X-2     SCS             Sue Sommer              13-Oct-1994
                                     0000    67 ;	                Reduce mode page buffer size from 1024 to 256.
                                     0000    68 ;	        X-1     JFD0660         James F. Dunham         28-SEP-1994
                                     0000    69 ;	                SCSI-2 Checkin
                                     0000    70 ;
                                     0000    71 ;
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page   3
X-1                                                                      12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (2)

                                     0000    73 ; Define system data structure types and constants
                                     0000    74 ;
                                     0000    75 	$DEVDEF			; Device Characteristics
                                     0000    76 	$DYNDEF			; Data structure types
                                     0000    77 	$MODEDEF		; Mode descriptor types 
                                     0000    78 	$SCDRPDEF		; SCDRP definitions
                                     0000    79 	$SCSIDEF		; SCSI definitions
                                     0000    80 	$SPDTDEF		; SCSI Port definitions
                                     0000    81 	$SSDEF			; System service status codes
                                     0000    82 	$STSDEF			; Status value fields
                                     0000    83 	$UCBDEF			; Unit control block
                                     0000    84 
                                     0000    85 ;
                                     0000    86 ;/* Local include file */
                           00000001  0000    87 	TRUE = 1		; Local definition for TRUE
                           00000000  0000    88 	FALSE = 0		; Local definition for FALSE
                                     0000    89 
                           00000040  0000    90 	MAX_DESCRIPTORS = 64	; Maximum number of page code descriptors
                           00000020  0000    91 	MAX_BITS = 32		; Maximum number of bits testable by a
                                     0000    92 				; single descriptors
                           00000100  0000    93 	BUFFER_SIZE = 256	; Maximum buffer size
                           00000008  0000    94 	BITS_PER_BYTE = 8	; Bits to byte conversion factor
                                     0000    95 
                           00000001  0000    96 	DATA_MATCH = 1		; Compare field return status - success
                           00000000  0000    97 	DATA_MISMATCH = 0	; Compare field return status - failure
                                     0000    98 ;
                                     0000    99 ;
                                     0000   100 ; External references
                                     0000   101 
                                     0000   102 	.EXTERNAL	CLEANUP_CMD
                                     0000   103 	.EXTERNAL	CMD_MODE_SENSE_10
                                     0000   104 	.EXTERNAL	CMD_MODE_SENSE
                                     0000   105 	.EXTERNAL	CMD_MODE_SELECT_10
                                     0000   106 	.EXTERNAL	CMD_MODE_SELECT
                                     0000   107 	.EXTERNAL	SEND_COMMAND
                                     0000   108 	.EXTERNAL	SETUP_CMD
                                     0000   109 
                                     0000   110 	.WEAK	CMD_MODE_SELECT_10
                                     0000   111 	.WEAK	CMD_MODE_SENSE_10
                                     0000   112 
                                     0000   113 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page   4
X-1                             INIT_SCDRP_STACK - Initialize the intern 12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (3)

                                     0000   115 	.SBTTL	INIT_SCDRP_STACK - Initialize the internal SCDRP stack
                                     0000   116 	.SBTTL	SUBPUSH		- Push an item on the SCDRP stack
                                     0000   117 	.SBTTL	SUBPOP		- Pop an item from the SCDRP stack
                                     0000   118 	.SBTTL	SUBSAVE		- Save a return address on the SCDRP stack
                                     0000   119 	.SBTTL	SUBRETURN	- Return to the address saved on the SCDRP stack
                                     0000   120 ;+
                                     0000   121 ; SUBPUSH
                                     0000   122 ; SUBPOP
                                     0000   123 ; SUBSAVE
                                     0000   124 ; SUBRETURN
                                     0000   125 ;
                                     0000   126 ; These macros manipulate the SCDRP internal stack which is used to save 
                                     0000   127 ; routine return address and temporary variables.
                                     0000   128 ;-
                                     0000   129 	.MACRO	SUBPUSH,ARG,SCDRP=R5,?l1,?l2	
                                     0000   130 
                                     0000   131 	.if defined scsi_stack_checking
                                     0000   132 	.nlist	meb
                                     0000   133 	pushal	scdrp$l_class_stack+<scdrp$s_class_stack*4>(scdrp)
                                     0000   134 	cmpl	(sp)+,scdrp$l_class_stack_ptr(scdrp)
                                     0000   135 	bgtru	l2
                                     0000   136 l1:	BUG_CHECK INCONSTATE,FATAL		; SCSI stack overflow
                                     0000   137 l2:	.list	meb
                                     0000   138 	.endc
                                     0000   139 
                                     0000   140 	ADDL	#4,SCDRP$L_CLASS_STACK_PTR(SCDRP)
                                     0000   141 	MOVL	ARG,@SCDRP$L_CLASS_STACK_PTR(SCDRP)
                                     0000   142 
                                     0000   143 	.ENDM	SUBPUSH
                                     0000   144 
                                     0000   145 	.MACRO	SUBPOP,ARG,SCDRP=R5,?l1,?l2	
                                     0000   146 
                                     0000   147 	.if defined scsi_stack_checking
                                     0000   148 	.nlist	meb
                                     0000   149 	pushal	scdrp$l_class_stack-4(scdrp)
                                     0000   150 	cmpl	(sp)+,scdrp$l_class_stack_ptr(scdrp)
                                     0000   151 	blssu	l2
                                     0000   152 l1:	BUG_CHECK INCONSTATE,FATAL		; SCSI stack underflow
                                     0000   153 l2:	.list	meb
                                     0000   154 	.endc
                                     0000   155 
                                     0000   156 	MOVL	@SCDRP$L_CLASS_STACK_PTR(SCDRP),ARG
                                     0000   157 	SUBL	#4,SCDRP$L_CLASS_STACK_PTR(SCDRP)
                                     0000   158 
                                     0000   159 	.ENDM	SUBPOP
                                     0000   160 
                                     0000   161 	.MACRO	SUBSAVE,SCDRP=R5,?l1,?l2	
                                     0000   162 
                                     0000   163 	SUBPUSH	(SP)+,SCDRP
                                     0000   164 
                                     0000   165 	.ENDM	SUBSAVE
                                     0000   166 
                                     0000   167 	.MACRO	SUBRETURN,SCDRP=R5,?l1,?l2	
                                     0000   168 
                                     0000   169 	SUBPOP	-(SP),SCDRP
                                     0000   170 	RSB
                                     0000   171 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page   5
X-1                             SUBRETURN - Return to the address saved  12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (3)

                                     0000   172 	.ENDM	SUBRETURN
                                     0000   173 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page   6
X-1                             SUBRETURN - Return to the address saved  12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (4)

                                 00000000   175 	.PSECT		$$$112_COMMON_CODE
                                     0000   176 	.SBTTL		DO_MODE_PAGE
                                     0000   177 ;-----------------------------------------------------------------------------
                                     0000   178 ;
                                     0000   179 ; Routine: DO_MODE_PAGE
                                     0000   180 ;
                                     0000   181 ; Description:
                                     0000   182 ;
                                     0000   183 ;	This routine is called by a class driver to do whatever has to be done
                                     0000   184 ;	to make sure that selected Mode Parameter fields on the specified 
                                     0000   185 ;	page are in the states the caller wants them in.
                                     0000   186 ;
                                     0000   187 ;	This routine doesn't take any action based on the returned fields -
                                     0000   188 ;	for instance, it would be up to the caller to decide that a particular
                                     0000   189 ;	field has an unsatisfactory value and mark a device off-line or 
                                     0000   190 ;	bugcheck.
                                     0000   191 ;
                                     0000   192 ; Inputs
                                     0000   193 ;
                                     0000   194 ;	R5 = scdrp_ptr			= Pointer to an SCDRP
                                     0000   195 ;
                                     0000   196 ;    	R0 = page_code 			= SCSI Page Code.  Page control
                                     0000   197 ;					  bits will be cleared by this
                                     0000   198 ;					  routine before processing. 
                                     0000   199 ;
                                     0000   200 ;	R1 = field_desc_ptr    		= Pointer to array of longword 
                                     0000   201 ;					  field descriptors
                                     0000   202 ;
                                     0000   203 ;   Field descriptor format:
                                     0000   204 ;
                                     0000   205 ;		 +---------+---------+---------+---------+
                                     0000   206 ;   Boff 	 |           Field BOFF F_B   		 | 
                                     0000   207 ;		 +---------+---------+---------+---------+
                                     0000   208 ;   Bit_offset   |         Field bit offset F_V          | 
                                     0000   209 ;		 +---------+---------+---------+---------+
                                     0000   210 ;   Bit_size     |        Field size in bits F_S         | 
                                     0000   211 ;		 +---------+---------+---------+---------+
                                     0000   212 ;   Flags        |                 flags                 | 
                                     0000   213 ;		 +---------+---------+---------+---------+
                                     0000   214 ;   Desired      |     Desired Value or pointer to it    | 
                                     0000   215 ;                +                                       +
                                     0000   216 ;                |                                       | 
                                     0000   217 ;		 +---------+---------+---------+---------+
                                     0000   218 ;   Actual       |    Actual Value or pointer to buffer  | 
                                     0000   219 ;                +                                       +
                                     0000   220 ;                |                                       | 
                                     0000   221 ;		 +---------+---------+---------+---------+
                                     0000   222 ;   Reason       |      Difference reason / Results      | 
                                     0000   223 ;		 +---------+---------+---------+---------+
                                     0000   224 ;   Reserved	 |             Sequence Step             | 
                                     0000   225 ;		 +---------+---------+---------+---------+
                                     0000   226 ;
                                     0000   227 ; Boff:	The field's byte offset is relative to the start of the page
                                     0000   228 ;		as described in the SCSI spec, so the page code and page size
                                     0000   229 ;		bytes are included in this offset.  Since the page size is
                                     0000   230 ;		included and addressable by this scheme, this gives the caller 
                                     0000   231 ;		the option of including a descriptor to check the size of a 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page   7
X-1                             DO_MODE_PAGE                             12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (4)

                                     0000   232 ;		page (by creating a descriptor to describe the size field
                                     0000   233 ;		itself).
                                     0000   234 ;
                                     0000   235 ; Bit_offset:   The field's bit offset is relative to the start of the byte 
                                     0000   236 ;		specified in the byte offset field;  this value must be between
                                     0000   237 ;		0 and 7 and will be used as a sanity check to validate the 
                                     0000   238 ;		descriptor. 
                                     0000   239 ;
                                     0000   240 ; Bit_size:    The field's size must be between 1 and MAX_BITS, and this too
                                     0000   241 ;		will be used to provide a sanity check of the descriptor's 
                                     0000   242 ;		validity.  MAX_BITS will be set to 32 unless some larger field
                                     0000   243 ;		we may be interested in reading or modifying is identified in
                                     0000   244 ;		the SCSI standard.
                                     0000   245 ;
                                     0000   246 ; Flags:		Flag bit written by caller:
                                     0000   247 ;
                                     0000   248 ;			Priority:
                                     0000   249 ;
                                     0000   250 ;		  		- Preferred (mode_desc$v_preferred)
                                     0000   251 ;		  		- Required (mode_desc$v_required)
                                     0000   252 ;
                                     0000   253 ;		  	Error Reporting:
                                     0000   254 ;
                                     0000   255 ;                 		- Missing (mode_desc$v_ifmissing)
                                     0000   256 ;		  		- Mismatch (mode_desc$v_ifmismatch)
                                     0000   257 ;
                                     0000   258 ;		  	Flag:
                                     0000   259 ;
                                     0000   260 ;		  		- Desired_Pointer (mode_desc$v_desptr)
                                     0000   261 ;		  		- Actual_Pointer (mode_desc$v_actptr)
                                     0000   262 ;		  		- Last_Entry (mode_desc$v_last)
                                     0000   263 ;
                                     0000   264 ;		  There are really only three priorities for a field, because
                                     0000   265 ;		  if both the Preferred and Required bits are set the Required
                                     0000   266 ;		  is honored and the Preferred is ignored.
                                     0000   267 ;		  
                                     0000   268 ;		  1) Read Only: Required and Preferred bits are both clear.
                                     0000   269 ;
                                     0000   270 ;		  2) Preferred: Preferred bit is set, meaning that the caller
                                     0000   271 ;		     has a desired value for this field and this routine should
                                     0000   272 ;		     go as far as it can in setting that field to the desired
                                     0000   273 ;		     state.
                                     0000   274 ;
                                     0000   275 ;		  3) Required: Required bit is set, meaning that this is a 
                                     0000   276 ;		     field the caller must have in the desired state, or else
                                     0000   277 ;		     something catastrophic is going to happen, such as 
                                     0000   278 ;		     setting the device offline or issuing a bugcheck.
                                     0000   279 ;
                                     0000   280 ;		Error Reporting flags:
                                     0000   281 ;
                                     0000   282 ;		  1) Missing: Report an error if this field is not contained
                                     0000   283 ;		     in the returned mode sense data.
                                     0000   284 ;
                                     0000   285 ;		  2) Mismatch: Report an error if this field value does not match
                                     0000   286 ;		     the desired value and cannot be changed to the desired value.
                                     0000   287 ;
                                     0000   288 ;		Other flags:
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page   8
X-1                             DO_MODE_PAGE                             12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (4)

                                     0000   289 ;
                                     0000   290 ;		  1) Desired_pointer: if set, the desired field contains a pointer
                                     0000   291 ;		     to the data, not the data itself.
                                     0000   292 ;
                                     0000   293 ;		  2) Actual_pointer: if set, the actual field contains a pointer
                                     0000   294 ;		     to where the data should be stored, not the storage area itself.
                                     0000   295 ;
                                     0000   296 ;		  3) Last: When set, this indicates that this descriptor is the last
                                     0000   297 ;		     one applicable for the given page.
                                     0000   298 ;
                                     0000   299 ; Reason:  	  Difference reason Codes (value, not masks) :
                                     0000   300 ;
                                     0000   301 ;			- Match (MODE_DESC$C_MATCH)
                                     0000   302 ;			- Not Changeable (MODE_DESC$C_FIXED)
                                     0000   303 ;			- Mismatch (MODE_DESC$C_MISMATCH)
                                     0000   304 ;			- Missing (MODE_DESC$C_MISSING)
                                     0000   305 ;			- Bad descriptor (MODE_DESC$C_BADDSC)
                                     0000   306 ;			- Incomplete (MODE_DESC$C_INCOMPLETE)
                                     0000   307 ;
                                     0000   308 ; Reserved:	  Reserved Field bits, to aid debugging:
                                     0000   309 ;
                                     0000   310 ;		  	- Set while processing current data 
                                     0000   311 ;						(mode_desc$v_current_phase)
                                     0000   312 ;		  	- Set while processing changeable data 
                                     0000   313 ;						(mode_desc$v_change_phase)
                                     0000   314 ;                 	- Set while setting up select data 
                                     0000   315 ;						(mode_desc$v_select_phase)
                                     0000   316 ;                 	- Set while processing verify data 
                                     0000   317 ;						(mode_desc$v_verify_phase)
                                     0000   318 ;
                                     0000   319 ;			In fact, this entire field is reserved for use as a
                                     0000   320 ;			bit-specific scratch area, so other bits may also be
                                     0000   321 ;			set on routine exit in addition to those defined above.
                                     0000   322 ;
                                     0000   323 ; Outputs
                                     0000   324 ;
                                     0000   325 ;	R0 = Status
                                     0000   326 ;
                                     0000   327 ;		SS$_BADPARAM - SCSI page code is either out of legal range
                                     0000   328 ;			     or is unsupported by the target. 
                                     0000   329 ;
                                     0000   330 ;		SS$_BADATTRIB - Real or apparent bad descriptor, one or more of
                                     0000   331 ;			     the fields do not make sense.
                                     0000   332 ;
                                     0000   333 ;		SS$_TOOMUCHDATA - Too many descriptors, i.e., this routine
                                     0000   334 ;			     scanned the array without finding a LAST bit set
                                     0000   335 ;			     within MAX_DESCRIPTORS descriptors. Because some
                                     0000   336 ;			     fields of the descriptor are written by do_a_page,
                                     0000   337 ;			     this routine must be able to find the end of the
                                     0000   338 ;			     array to avoid corrupting memory which is not part
                                     0000   339 ;			     of the array.
                                     0000   340 ;
                                     0000   341 ;		Other codes can be propagated from ALLOC_POOL,DO_A_PAGE,
                                     0000   342 ;		DO_MODE_SENSE and from SEND_COMMAND (within DO_MODE_SENSE
                                     0000   343 ;		and DO_MODE_SELECT)
                                     0000   344 ;
                                     0000   345 ;	All other registers preserved
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page   9
X-1                             DO_MODE_PAGE                             12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (4)

                                     0000   346 ;
                                     0000   347 ;-----------------------------------------------------------------------------
                                     0000   348 DO_MODE_PAGE::
                                     0000   349 	SUBSAVE				; Save return address
                                     000A   350 	SUBPUSH	R1			; Save register
                                     0014   351 	SUBPUSH	R2			; Save register
                                     001E   352 	SUBPUSH	R3			; Save register
                                     0028   353 	SUBPUSH	R4			; Save register
         54   50   FFFFFF40 8F   CB  0032   354 	BICL3	#^XFFFFFF40,R0,R4	; Strip control bits from page code
                       54   1F   D1  003A   355 	CMPL	#^X1F,R4		; Test page code for valid range 0-1F
                            06   18  003D   356 	BGEQ	5$			; Branch if valid
                       50   14   D0  003F   357 	MOVL	#SS$_BADPARAM,R0	; Load error status
                          00E6   31  0042   358 	BRW	95$			; Exit with error status
                                     0045   359 
                                     0045   360 ; Allocate buffer space from pool.  The size must include sufficient bytes
                                     0045   361 ; to hold both the returned current parameters buffer and the changeable
                                     0045   362 ; parameters buffer.  Each buffer is BUFFER_SIZE (typically 256 bytes each).
                                     0045   363 
                            51   DD  0045   364 5$:	PUSHL	R1			; Save descriptor pointer
                    53   1C A5   D0  0047   365 	MOVL	SCDRP$L_UCB(R5),R3	; Setup UCB pointer for ALLOC_POOL
              51   00000200 8F   D0  004B   366 	MOVL	#<2*BUFFER_SIZE>,R1	; Setup size for allocation
                          FFAB'  30  0052   367 	BSBW	ALLOC_POOL		; Get buffer space for current and
                                     0055   368 					; changeable parameters
                         06 50   E8  0055   369 	BLBS	R0,10$			; Branch on successful allocation
                            51 8ED0  0058   370 	POPL	R1			; Restore descriptor pointer
                          00CD   31  005B   371 	BRW	95$			; Return with error status
                            52   DD  005E   372 10$:	PUSHL	R2			; Save buffer_space
                       51   3F   D0  0060   373 	MOVL	#MPA_ARGS$S_SCSI_MPA,R1	; Setup size for SCSI_MPA_ARGS
                          FF9A'  30  0063   374 	BSBW	ALLOC_POOL		; Get SCSI_MPA_ARGS buffer
                         09 50   E8  0066   375 	BLBS	R0,12$			; Branch on successful allocation
                            52 8ED0  0069   376 	POPL	R2			; Restore buffer space address
                            51 8ED0  006C   377 	POPL	R1			; Restore descriptor pointer
                          00AE   31  006F   378 	BRW	92$			; Return with error status
                                     0072   379 12$:
                       53   52   D0  0072   380 	MOVL	R2,R3			; Get the address of mode page
                                     0075   381 					; arguments and store it
                  00EC C5   53   D0  0075   382 	MOVL	R3,SCDRP$L_MODE_ARGS(R5) ; in the SCDRP
                            52 8ED0  007A   383 	POPL	R2			; Restore buffer space address
                            51 8ED0  007D   384 	POPL	R1			; Restore descriptor pointer
                    3C A3   54   90  0080   385 	MOVB	R4,-			; Enter page code
                                     0084   386 		MPA_ARGS$B_PAGE_CODE(R3);
                         3E A3   94  0084   387 	CLRB	MPA_ARGS$B_REQ_BITS_PRESENT(R3)
                                     0087   388 					; Set REQ_BITS_PRESENT flag to false
                       63   51   D0  0087   389 	MOVL	R1,-			; Load field descriptor pointer
                                     008A   390 		MPA_ARGS$L_FIELD_DESC(R3)
                            54   D4  008A   391 	CLRL	R4			; Initialize loop index
              54   00000040 8F   D1  008C   392 20$:	CMPL	#MAX_DESCRIPTORS,R4	; Test for maximum descriptors
                            0A   14  0093   393 	BGTR	30$			; Branch if not exceeded
              50   0000029C 8F   D0  0095   394 	MOVL	#SS$_TOOMUCHDATA,R0	; Load error status
                          0076   31  009C   395 	BRW	90$			; Exit with error status
                            02   D3  009F   396 30$:	BITL	#MODE_DESC$M_REQUIRED,-	; Test if field is required
                         0C A1       00A1   397 		MODE_DESC$R_FLAGS(R1)	;
                            04   13  00A3   398 	BEQL	35$			; Branch if not required
                            01   90  00A5   399 	MOVB	#TRUE,-			; Set indicator flag
                         3E A3       00A7   400 		MPA_ARGS$B_REQ_BITS_PRESENT(R3)
                            07   D1  00A9   401 35$:	CMPL	#7,-			; Test bit offset
                         04 A1       00AB   402 		MODE_DESC$L_BIT_OFFSET(R1)
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  10
X-1                             DO_MODE_PAGE                             12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (4)

                            29   19  00AD   403 	BLSS	50$			; Branch if too large
                         08 A1   D5  00AF   404 	TSTL	MODE_DESC$L_BIT_SIZE(R1); Test for zero bit size
                            24   13  00B2   405 	BEQL	50$			; Branch if zero
                            20   D1  00B4   406 	CMPL	#MAX_BITS,-		; Test bit size
                         08 A1       00B6   407 		MODE_DESC$L_BIT_SIZE(R1);
                            1E   19  00B8   408 	BLSS	50$			; Branch if too large
                            08   D1  00BA   409 	CMPL	#8,-			; Test bit size
                         08 A1       00BC   410 		MODE_DESC$L_BIT_SIZE(R1);
                            06   14  00BE   411 	BGTR	40$			; Branch if less than 8
                            07   D3  00C0   412 	BITL	#7,-			; Test for a multiple of 8
                         08 A1       00C2   413 		MODE_DESC$L_BIT_SIZE(R1);
                            12   12  00C4   414 	BNEQ	50$
                   00000040 8F   D3  00C6   415 40$:	BITL	#MODE_DESC$M_LAST,-	; Test for last valid field
                         0C A1       00CC   416 		MODE_DESC$R_FLAGS(R1)	; descriptor
                            12   12  00CE   417 	BNEQ	60$			; Branch if last descriptor
                            28   C0  00D0   418 	ADDL2	#MODE_DESC$S_FIELD_DESCRIPTOR,-
                            51       00D2   419 		R1			; Increment to next field
                                     00D3   420 					; descriptor
                            54   D6  00D3   421 	INCL	R4			; Increment to next index
                          FFB4   31  00D5   422 	BRW	20$			; Continue looping
                                     00D8   423 
                            04   D0  00D8   424 50$:	MOVL	#MODE_DESC$C_BADDSC,-	; Set reason field in field
                         20 A1       00DA   425 		MODE_DESC$L_REASON(R1)	; descriptor
                       50   34   D0  00DC   426 	MOVL	#SS$_BADATTRIB,R0	; Set error status
                          0033   31  00DF   427 	BRW	90$			; Exit with error status
                                     00E2   428 
               04 A3   54   01   C1  00E2   429 60$:	ADDL3	#1,R4,-			; Add one to get descriptor
                                     00E7   430 		MPA_ARGS$L_DESCRIPTOR_COUNT(R3) ; count and store
                                     00E7   431 					; count in MPA args
                   00000100 8F   D0  00E7   432 	MOVL	#BUFFER_SIZE,-		; Store buffer size in MPA args
                         10 A3       00ED   433 		MPA_ARGS$L_BUFFER_SIZE(R3)
                    0C A3   52   D0  00EF   434 	MOVL	R2,-			; Store buffer pointer into
                                     00F3   435 		MPA_ARGS$L_BUFFER_PTR(R3) ; MPA args
                            3E   BB  00F3   436 	PUSHR	#^M<R1,R2,R3,R4,R5>	; Save registers
                  00   6E   00   2C  00F5   437 	MOVC5	#0,(SP),#0,-		; Clear buffer space
                  62   0200 8F       00F9   438 		#<2*BUFFER_SIZE>,(R2)	;
                            3E   BA  00FD   439 	POPR	#^M<R1,R2,R3,R4,R5>	; Restore registers
                   00000800 8F   C8  00FF   440 	BISL2	#SCDRP$M_CL_PRIVATE_BUFF,-
                         64 A5       0105   441 		SCDRP$L_SCSI_FLAGS(R5)	; Set private buffer flag
                         3D A3   94  0107   442 	CLRB	MPA_ARGS$B_VERIFY_IN_PROGRESS(R3)
                                     010A   443 					; Clear verify in progress field
                          0051   30  010A   444 	BSBW	DO_A_PAGE		; Execute DO_A_PAGE(SCDRP_PTR=R5)
                                     010D   445 					; Returning status = R0
                   00000800 8F   CA  010D   446 	BICL2	#SCDRP$M_CL_PRIVATE_BUFF,-
                         64 A5       0113   447 		SCDRP$L_SCSI_FLAGS(R5)	; Clear private buffer flag
                                     0115   448 
                            50   DD  0115   449 90$:	PUSHL	R0			; Save return status
                       50   53   D0  0117   450 	MOVL	R3,R0			; Move address of SCSI_MPA_ARGS
                                     011A   451 					; into R0
                          FEE3'  30  011A   452 	BSBW	DEALLOC_POOL		; Deallocate buffer
                            50 8ED0  011D   453 	POPL	R0			; Restore return status
                                     0120   454 
                            50   DD  0120   455 92$:	PUSHL	R0			; Save return status
                       50   52   D0  0122   456 	MOVL	R2,R0			; Move address of buffer space
                                     0125   457 					; into R0
                          FED8'  30  0125   458 	BSBW	DEALLOC_POOL		; Deallocate buffer
                            50 8ED0  0128   459 	POPL	R0			; Restore return status
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  11
X-1                             DO_MODE_PAGE                             12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (4)

                                     012B   460 95$:
                                     012B   461 	SUBPOP	R4			; Restore register
                                     0135   462 	SUBPOP	R3			; Restore register
                                     013F   463 	SUBPOP	R2			; Restore register
                                     0149   464 	SUBPOP	R1			; Restore register
                                     0153   465 	SUBRETURN			; Exit
                                     015E   466 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  12
X-1                             DO_A_PAGE                                12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (5)

                                     015E   468 	.SBTTL		DO_A_PAGE
                                     015E   469 ;
                                     015E   470 ;---------------------------------------------------------------------------
                                     015E   471 ;
                                     015E   472 ; Routine: DO_A_PAGE
                                     015E   473 ;
                                     015E   474 ; Description:
                                     015E   475 ;
                                     015E   476 ;	This routine gets the mode sense data for the given page and determines
                                     015E   477 ;	if any preferred or required fields have a different value than the
                                     015E   478 ;	desired setting.  If a value needs to be changed, the changeable mask
                                     015E   479 ;	is retrived by another mode sense command and if the field is changeable
                                     015E   480 ;	a mode select command is issued with the desired settings.
                                     015E   481 ;
                                     015E   482 ; Inputs:
                                     015E   483 ;
                                     015E   484 ;	R5 = scdrp_ptr	  			- Pointer to working SCDRP 
                                     015E   485 ;
                                     015E   486 ;	    Fields pointed to by scdrp$ps_mode_args:
                                     015E   487 ;	    mpa_args$b_page_code		- SCSI page code 
                                     015E   488 ;	    mpa_args$ps_field_desc		- Pointer to descriptor array 
                                     015E   489 ;	    mpa_args$l_descriptor_count		- Number of valid descriptors 
                                     015E   490 ;	    mpa_args$ps_buffer_ptr	  	- Addr of working buffer space
                                     015E   491 ;	    mpa_args$l_buffer_size		- Size of buffer 
                                     015E   492 ;	    mpa_args$b_verify_in_progress	- This is a verify pass
                                     015E   493 ;
                                     015E   494 ; Outputs:
                                     015E   495 ;
                                     015E   496 ;	The routine status is partly dependent on the state of some of
                                     015E   497 ;	the flag bits.  Since it's possible for multiple errors to occur,
                                     015E   498 ;	not all of which can be flagged in single return status, all we
                                     015E   499 ;	can guarantee is that if one of the errors the caller wanted
                                     015E   500 ;	reported occurs, or if any error on a Required field occurs,
                                     015E   501 ;	some error status code will be returned, and they will then
                                     015E   502 ;	have to scan the descriptors for more detailed information.
                                     015E   503 ;
                                     015E   504 ;	R0 = Status - in decreasing order of severity:
                                     015E   505 ;
                                     015E   506 ;		 SS$_DRVERR
                                     015E   507 ;
                                     015E   508 ;			At least one required field is not in desired state or
                                     015E   509 ;			is missing in either the current or changeable data.
                                     015E   510 ;			This status is to call attention to a required bit
                                     015E   511 ;			error.
                                     015E   512 ;
                                     015E   513 ;	    	SS$_PROTOCOL
                                     015E   514 ;
                                     015E   515 ;			An incomplete field has been detected - this is treated
                                     015E   516 ;			as a page format error, since a device should never
                                     015E   517 ;			return an incomplete field.
                                     015E   518 ;
                                     015E   519 ;		SS$_NOSUCHSEC
                                     015E   520 ;
                                     015E   521 ;			A read-only field is missing.
                                     015E   522 ;
                                     015E   523 ;		SS$_WASSET
                                     015E   524 ;
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  13
X-1                             DO_A_PAGE                                12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (5)

                                     015E   525 ;	      		At least one preferred field is not in the desired
                                     015E   526 ;			state or is missing in either the current or changeable
                                     015E   527 ;			data.  This status is to call attention to a preferred
                                     015E   528 ;			field error.
                                     015E   529 ;
                                     015E   530 ;		SS$_NORMAL
                                     015E   531 ;
                                     015E   532 ;			Success, everything's in the desired state.
                                     015E   533 ;
                                     015E   534 ;		 Other codes may be returned from do_mode_sense or 
                                     015E   535 ;		 do_mode_select.
                                     015E   536 ;
                                     015E   537 ;-----------------------------------------------------------------------------
                                     015E   538 DO_A_PAGE:
                                     015E   539 	SUBSAVE				; Save return address
                                     0168   540 	SUBPUSH	R1			; Save register
                                     0172   541 	SUBPUSH	R2			; Save register
                                     017C   542 	SUBPUSH	R3			; Save register
                                     0186   543 	SUBPUSH	R4			; Save register
                  53   00EC C5   D0  0190   544 	MOVL	SCDRP$L_MODE_ARGS(R5),R3 ; Setup Arg_ptr in R3
                            01   D0  0195   545 	MOVL	#SS$_NORMAL,-		; Assume success status
                         30 A3       0197   546 		MPA_ARGS$L_ERROR(R3)	;
                          02A9   30  0199   547 	BSBW	DO_MODE_SENSE		; Call DO_MODE_SENSE(R5=scdrp_ptr)
                         03 50   E8  019C   548 	BLBS	R0,10$			; Test for success status
                          0270   31  019F   549 	BRW	200$			; Return(R0=status)
                         2C A3   D4  01A2   550 10$:	CLRL	MPA_ARGS$L_VALUE_BUFFER_PTR(R3)
                                     01A5   551 					; Set optional buffer ptr to NULL
                            63   D0  01A5   552 	MOVL	MPA_ARGS$L_FIELD_DESC(R3),-
                            54       01A7   553 		R4			; Set R4 to field desc ptr
                            51   D4  01A8   554 	CLRL	R1			; Set proceed flag to false
                            57   DD  01AA   555 	PUSHL	R7			; Save original R7
                            57   D4  01AC   556 	CLRL	R7			; Set index to 0
                    04 A3   57   D1  01AE   557 20$:	CMPL	R7,-			; Compare index to descriptor count
                                     01B2   558 		MPA_ARGS$L_DESCRIPTOR_COUNT(R3)
                            03   19  01B2   559 	BLSS	21$
                          00A6   31  01B4   560 	BRW	60$
                                     01B7   561 
                                     01B7   562 21$:	ASSUME	FALSE EQ 0		; Assumption for low bit clear
                                     01B7   563 	ASSUME	TRUE EQ 1		; Assumption for low bit set
                         3D A3   E8  01B7   564 	BLBS	MPA_ARGS$B_VERIFY_IN_PROGRESS(R3),-
                            06       01BA   565 		22$			; Branch if verify pass
                            01   C8  01BB   566 	BISL	#MODE_DESC$M_CURRENT_PHASE,-
                         24 A4       01BD   567 		MODE_DESC$R_RESERVED(R4) ; Set phase to current
                            04   11  01BF   568 	BRB	25$			; Continue
                            08   C8  01C1   569 22$:	BISL	#MODE_DESC$M_VERIFY_PHASE,-
                         24 A4       01C3   570 		MODE_DESC$R_RESERVED(R4) ; Set phase to verify
                    08 A3   54   D0  01C5   571 25$:	MOVL	R4,-			; Load field desc ptr into
                                     01C9   572 		MPA_ARGS$L_CURR_DESC_PTR(R3) ; mpa args
                          072C   30  01C9   573 	BSBW	EXTRACT_FIELD		; Call extract_field(R5=scdrp_ptr)
              50   000002D4 8F   D1  01CC   574 	CMPL	#SS$_OPINCOMPL,R0	; Test for incomplete operation
                            0F   12  01D3   575 	BNEQ	30$			; Branch if operation completed
                            05   D0  01D5   576 	MOVL	#MODE_DESC$C_INCOMPLETE,- ; Set failure reason
                         20 A4       01D7   577 		MODE_DESC$L_REASON(R4)	;
                   00002074 8F   D0  01D9   578 	MOVL	#SS$_PROTOCOL,-		; Set error status
                         30 A3       01DF   579 		MPA_ARGS$L_ERROR(R3)	;
                          0071   31  01E1   580 	BRW	50$			; Continue
                            01   E1  01E4   581 30$:	BBC	#MODE_DESC$V_REQUIRED,- ; Test for required field
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  14
X-1                             DO_A_PAGE                                12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (5)

                         0C A4       01E6   582 		MODE_DESC$R_FLAGS(R4),-;
                            0C       01E8   583 		32$			; Branch if not required
                                     01E9   584 	ASSUME	FALSE EQ 0		; Assumption for clear instruction
                            52   D4  01E9   585 	CLRL	R2			; Set read only flag to false
                   0000008C 8F   D0  01EB   586 	MOVL	#SS$_DRVERR,-		; Failure to write is fatal
                         34 A3       01F1   587 		MPA_ARGS$L_FIELD_ERROR(R3) ;
                            18   11  01F3   588 	BRB	35$
                            00   E1  01F5   589 32$:	BBC	#MODE_DESC$V_PREFERRED,-; Test for preferred field
                         0C A4       01F7   590 		MODE_DESC$R_FLAGS(R4),-;
                            08       01F9   591 		34$			; Branch if not preferred
                                     01FA   592 	ASSUME	FALSE EQ 0		; Assumption for clear instruction
                            52   D4  01FA   593 	CLRL	R2			; Set read only flag to false
                            09   D0  01FC   594 	MOVL	#SS$_WASSET,-		; Failure to write is 
                         34 A3       01FE   595 		MPA_ARGS$L_FIELD_ERROR(R3) ; qualified success
                            0B   11  0200   596 	BRB	35$
                                     0202   597 
                       52   01   D0  0202   598 34$:	MOVL	#TRUE,R2		; Set read only flag to true
                   00000978 8F   D0  0205   599 	MOVL	#SS$_NOSUCHSEC,-	; Failure to read is an error
                         34 A3       020B   600 		MPA_ARGS$L_FIELD_ERROR(R3) ;
              50   000021EC 8F   D1  020D   601 35$:	CMPL	#SS$_NOSUCHID,R0	; Test for missing field
                            13   12  0214   602 	BNEQ	37$			; Branch if not missing
                            03   D0  0216   603 	MOVL	#MODE_DESC$C_MISSING,-	; Set difference reason
                         20 A4       0218   604 		MODE_DESC$L_REASON(R4)	; in the descriptor
                            02   E1  021A   605 	BBC	#MODE_DESC$V_IFMISSING,- ; Test if missing field
                         0C A4       021C   606 		MODE_DESC$R_FLAGS(R4),- ; is an error
                            36       021E   607 		50$			; Branch if it is not an error
                          0864   30  021F   608 	BSBW	MAXIMIZE_ERROR		; Call maximize_error(R5=scdrp_ptr)
                    30 A3   50   D0  0222   609 	MOVL	R0,MPA_ARGS$L_ERROR(R3)	; Load returned error status into
                                     0226   610 					; error field
                          002C   31  0226   611 	BRW	50$			; Continue
                          07DA   30  0229   612 37$:	BSBW	COMPARE_FIELD		; Call compare_field(R5=scdrp_ptr)
                       50   00   D1  022C   613 	CMPL	#DATA_MISMATCH,R0	; Test return status
                            07   13  022F   614 	BEQL	40$			; Branch on mismatch
                            00   D0  0231   615 	MOVL	#MODE_DESC$C_MATCH,-	; Set difference reason to MATCH
                         20 A4       0233   616 		MODE_DESC$L_REASON(R4)	;
                          001D   31  0235   617 	BRW	50$			; Continue
                            02   D0  0238   618 40$:	MOVL	#MODE_DESC$C_MISMATCH,-	; Set difference reason to MISMATCH
                         20 A4       023A   619 		MODE_DESC$L_REASON(R4)	;
                                     023C   620 	ASSUME	TRUE EQ 1		; Assumption for low bit set
                         16 52   E8  023C   621 	BLBS	R2,50$			; Branch if read only
                         3D A3   E8  023F   622 	BLBS	MPA_ARGS$B_VERIFY_IN_PROGRESS(R3),-
                            06       0242   623 		45$			; Branch if verify pass
                       51   01   D0  0243   624 	MOVL	#TRUE,R1		; Set proceed flag to TRUE
                          000C   31  0246   625 	BRW	50$			; Continue
                            03   E1  0249   626 45$:	BBC	#MODE_DESC$V_IFMISMATCH,- ; Test if mismatch field
                         0C A4       024B   627 		MODE_DESC$R_FLAGS(R4),- ; is an error
                            07       024D   628 		50$			; Branch if it is not an error
                          0835   30  024E   629 	BSBW	MAXIMIZE_ERROR		; Call maximize_error(R5=scdrp_ptr)
                    30 A3   50   D0  0251   630 	MOVL	R0,MPA_ARGS$L_ERROR(R3)	; Load returned error status into
                                     0255   631 					; error field
                            28   C0  0255   632 50$:	ADDL2	#MODE_DESC$S_FIELD_DESCRIPTOR,-
                            54       0257   633 		R4			; Increment to next field descriptor
                            57   D6  0258   634 	INCL	R7			; Increment index
                          FF51   31  025A   635 	BRW	20$			; Continue looping through descriptors
                            57 8ED0  025D   636 60$:	POPL	R7			; Restore original R7
                         07 51   E8  0260   637 	BLBS	R1,62$			; Branch if proceed is true
                    50   30 A3   D0  0263   638 	MOVL	MPA_ARGS$L_ERROR(R3),R0	; Set return status in R0
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  15
X-1                             DO_A_PAGE                                12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (5)

                          01A8   31  0267   639 	BRW	200$			; Return(arg_ptr->mpa_args$l_error)
                         3C A3   95  026A   640 62$:	TSTB	MPA_ARGS$B_PAGE_CODE(R3); Test page code = 0 (vendor unique page)
                            08   12  026D   641 	BNEQ	65$			; Branch if not page code 0
                         0C A3   D0  026F   642 	MOVL	MPA_ARGS$L_BUFFER_PTR(R3),-	; Set select buffer to
                         1C A3       0272   643 		MPA_ARGS$L_SELECT_BUFF_PTR(R3)	; current buffer
                          0110   31  0274   644 	BRW	88$			; Page code 0 doesn't support
                                     0277   645 					; changable parameters
                                     0277   646 
                                     0277   647 ; At this point we are going to save the pointer to the current
                                     0277   648 ; mode sense data along with the size of the data on the SCDRP stack.
                                     0277   649 ; This will allow us to use MPA_ARGS$L_BUFFER_PTR and MPA_ARGS$L_BUFFER_SIZE
                                     0277   650 ; to request the changeable data mask through the DO_MODE_SENSE routine.
                                     0277   651 65$:
                                     0277   652 	SUBPUSH	MPA_ARGS$L_BUFFER_PTR(R3) ; Save current ptr
                                     0282   653 	SUBPUSH	MPA_ARGS$L_BUFFER_SIZE(R3) ; Save current buffer size
                                     028D   654 
                         3C A3   9A  028D   655 	MOVZBL	MPA_ARGS$B_PAGE_CODE(R3),- ; Save page code in R2
                            52       0290   656 		R2
                         40 8F   88  0291   657 	BISB2	#SCSI$PGCD$M_CHANGEABLE,- ; Modify page code for
                         3C A3       0294   658 		MPA_ARGS$B_PAGE_CODE(R3) ; changeable parameters
                         10 A3   C0  0296   659 	ADDL2	MPA_ARGS$L_BUFFER_SIZE(R3),- ; Set buffer to 
                         0C A3       0299   660 		MPA_ARGS$L_BUFFER_PTR(R3) ; change ptr
                   00000100 8F   D0  029B   661 	MOVL	#BUFFER_SIZE,-		; Set size of changeable data
                         10 A3       02A1   662 		MPA_ARGS$L_BUFFER_SIZE(R3)
                          019F   30  02A3   663 	BSBW	DO_MODE_SENSE		; Call do_mode_sense(R5=scdrp_ptr)
                         19 50   E8  02A6   664 	BLBS	R0,67$			; Branch on success
                                     02A9   665 
                                     02A9   666 ; This is the error return path.  The current mode sense data buffer pointer
                                     02A9   667 ; and size need to be restored before exiting with the error status in R0.
                                     02A9   668 	SUBPOP	MPA_ARGS$L_BUFFER_SIZE(R3) ; Restore current buffer size
                                     02B4   669 	SUBPOP	MPA_ARGS$L_BUFFER_PTR(R3) ; Restore current ptr
                          0150   31  02BF   670 	BRW	200$			; return(R0=status)
                                     02C2   671 
                                     02C2   672 ; The is the path for a successful request of the mode sense changeable mask.
                    3C A3   52   90  02C2   673 67$:	MOVB	R2,-			; Restore original page code
                                     02C6   674 		MPA_ARGS$B_PAGE_CODE(R3)
                                     02C6   675 	ASSUME	FALSE EQ 0		; Assumption for clear instruction
                            51   D4  02C6   676 	CLRL	R1			; Set proceed flag to false
                            63   D0  02C8   677 	MOVL	MPA_ARGS$L_FIELD_DESC(R3),-
                            54       02CA   678 		R4			; Set R4 to field desc ptr
                            57   DD  02CB   679 	PUSHL	R7			; Save original R7
                            57   D4  02CD   680 	CLRL	R7			; Set index to 0
                    04 A3   57   D1  02CF   681 70$:	CMPL	R7,-			; Compare index to descriptor count
                                     02D3   682 		MPA_ARGS$L_DESCRIPTOR_COUNT(R3)
                            03   19  02D3   683 	BLSS	71$
                          0086   31  02D5   684 	BRW	87$			; Looping complete
                            02   D1  02D8   685 71$:	CMPL	#MODE_DESC$C_MISMATCH,-	; Test for mismatch
                         20 A4       02DA   686 		MODE_DESC$L_REASON(R4)	;
                            03   13  02DC   687 	BEQL	72$			; Branch on mismatch
                          0075   31  02DE   688 	BRW	85$			; Continue looping
                            64   D5  02E1   689 72$:	TSTL	MODE_DESC$L_BOFF(R4)	; Test for header field (neg #)
                            06   18  02E3   690 	BGEQ	75$			; Branch if not a header field
                       51   01   D0  02E5   691 	MOVL	#TRUE,R1		; Set proceed flag to true
                          006B   31  02E8   692 	BRW	85$			; Continue looping
                            01   E1  02EB   693 75$:	BBC	#MODE_DESC$V_REQUIRED,-	; Test for required field
                         0C A4       02ED   694 		MODE_DESC$R_FLAGS(R4),-
                            0A       02EF   695 		77$			; Branch if not required
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  16
X-1                             DO_A_PAGE                                12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (5)

                   0000008C 8F   D0  02F0   696 	MOVL	#SS$_DRVERR,-		; Failure to write is fatal
                         34 A3       02F6   697 		MPA_ARGS$L_FIELD_ERROR(R3)
                            0E   11  02F8   698 	BRB	80$			; Proceed to test changeable
                            00   E1  02FA   699 77$:	BBC	#MODE_DESC$V_PREFERRED,- ; Test for preferred field
                         0C A4       02FC   700 		MODE_DESC$R_FLAGS(R4),-
                            06       02FE   701 		79$			; Branch if not preferred
                            09   D0  02FF   702 	MOVL	#SS$_WASSET,-		; Failure to write is
                         34 A3       0301   703 		MPA_ARGS$L_FIELD_ERROR(R3) ; qualified success
                            03   11  0303   704 	BRB	80$			; Proceed to test changeable
                          004E   31  0305   705 79$:	BRW	85$			; Continue looping
                            02   C8  0308   706 80$:	BISL	#MODE_DESC$M_CHANGE_PHASE,-
                         24 A4       030A   707 		MODE_DESC$R_RESERVED(R4) ; Set phase to change
                    08 A3   54   D0  030C   708 	MOVL	R4,-			; Load descriptor pointer
                                     0310   709 		MPA_ARGS$L_CURR_DESC_PTR(R3)
                          0733   30  0310   710 	BSBW	TEST_CHANGEABLE		; Call test_changeable(R5=scdrp_ptr)
                         2A 50   E8  0313   711 	BLBS	R0,83$			; Branch on success
              50   000002D4 8F   D1  0316   712 	CMPL	#SS$_OPINCOMPL,R0	; Test for incomplete field
                            0F   12  031D   713 	BNEQ	82$			; Branch if operation completed
                            05   D0  031F   714 	MOVL	#MODE_DESC$C_INCOMPLETE,- ; Set failure reason
                         20 A4       0321   715 		MODE_DESC$L_REASON(R4)	;
                   00002074 8F   D0  0323   716 	MOVL	#SS$_PROTOCOL,-		; Set error status
                         30 A3       0329   717 		MPA_ARGS$L_ERROR(R3)	;
                          0028   31  032B   718 	BRW	85$			; Continue looping
              50   000021EC 8F   D1  032E   719 82$:	CMPL	#SS$_NOSUCHID,R0	; Test for field missing
                            0F   13  0335   720 	BEQL	84$			; Branch if field missing
              50   0000025C 8F   D1  0337   721 	CMPL	#SS$_WRITLCK,R0		; Test for field not changeable
                            06   13  033E   722 	BEQL	84$			; Branch if field not changeable
                       51   01   D0  0340   723 83$:	MOVL	#TRUE,R1		; Set proceed flag to true
                          0010   31  0343   724 	BRW	85$			; Continue looping
                            01   D0  0346   725 84$:	MOVL	#MODE_DESC$C_FIXED,-	; Set difference reason
                         20 A4       0348   726 		MODE_DESC$L_REASON(R4)  ; as not changeable
                            03   E1  034A   727 	BBC	#MODE_DESC$V_IFMISMATCH,- ; If error on mismatch
                      07 0C A4       034C   728 		MODE_DESC$R_FLAGS(R4),85$ ; is not set branch
                          0734   30  034F   729 	BSBW	MAXIMIZE_ERROR		; Call maximize_error(R5=scdrp_ptr)
                    30 A3   50   D0  0352   730 	MOVL	R0,MPA_ARGS$L_ERROR(R3)	; Store error status in mpa args
                            28   C0  0356   731 85$:	ADDL2	#MODE_DESC$S_FIELD_DESCRIPTOR,-
                            54       0358   732 		R4			; Increment to next field descriptor
                            57   D6  0359   733 	INCL	R7			; Increment index
                          FF71   31  035B   734 	BRW	70$			; Continue looping through descriptors
                                     035E   735 
                                     035E   736 ; This is the exit path for the loop which tests the necessary fields in the
                                     035E   737 ; mode sense changeable mask.  The current mode sense data size is returned
                                     035E   738 ; to MPA_ARGS$L_BUFFER_SIZE and the current mode sense data buffer pointer is
                                     035E   739 ; now loaded into MPA_ARGS$L_SELECT_BUFF_PTR in preparation for the call to
                                     035E   740 ; DO_MODE_SELECT.
                            57 8ED0  035E   741 87$:	POPL	R7			; Restore original R7
                                     0361   742 	SUBPOP	MPA_ARGS$L_BUFFER_SIZE(R3)	; Restore current buffer size
                                     036C   743 	SUBPOP	MPA_ARGS$L_SELECT_BUFF_PTR(R3)	; Restore current ptr
                    50   30 A3   D0  0377   744 	MOVL	MPA_ARGS$L_ERROR(R3),R0	; Load return status into R0
                                     037B   745 	ASSUME	TRUE EQ 1		; Assumption for low bit set
                         03 51   E8  037B   746 	BLBS	R1,871$			; Branch if proceed is true
                          0091   31  037E   747 	BRW	200$			; Branch if proceed is false
                         03 50   E8  0381   748 871$:	BLBS	R0,88$			; Branch if status is successful
                          008B   31  0384   749 	BRW	200$			; Branch if status is not successful
                         0C A3   C3  0387   750 88$:	SUBL3	MPA_ARGS$L_BUFFER_PTR(R3),-	; Calculate data offset
                         14 A3       038A   751 		MPA_ARGS$L_PAGE_DATA_PTR(R3),-	;
                         24 A3       038C   752 		MPA_ARGS$L_SELECT_DATA_PTR(R3)	;
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  17
X-1                             DO_A_PAGE                                12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (5)

                         1C A3   C0  038E   753 	ADDL2	MPA_ARGS$L_SELECT_BUFF_PTR(R3),- ; Add to the select buffer
                         24 A3       0391   754 		MPA_ARGS$L_SELECT_DATA_PTR(R3)	; address to get data ptr
                         3C A3   95  0393   755 	TSTB	MPA_ARGS$B_PAGE_CODE(R3)	; Test for page code 0
                            05   13  0396   756 	BEQL	89$			; Branch if page code 0
                                     0398   757 
                                     0398   758 	; Since the page code is non-zero we need to make sure that the upper 2 bits
                                     0398   759 	; of the page code byte are zero so that we have a valid page code for the
                                     0398   760 	; mode select message. (i.e. clear any changeable setting left over from
                                     0398   761 	; mode sense)
                         C0 8F   8A  0398   762 	BICB	#^XC0,-			; Isolate the page code
                         24 B3       039B   763 		@MPA_ARGS$L_SELECT_DATA_PTR(R3)	;
                          02A0   30  039D   764 89$:	BSBW	MODE_SELECT_HDR_SETUP	; Call mode_select_hdr_setup(R5=scdrp_ptr)
                            63   D0  03A0   765 	MOVL	MPA_ARGS$L_FIELD_DESC(R3),-
                            54       03A2   766 		R4			; Set R4 to field desc ptr
                            57   DD  03A3   767 	PUSHL	R7			; Save original R7
                            57   D4  03A5   768 	CLRL	R7			; Set index to 0
                    04 A3   57   D1  03A7   769 90$:	CMPL	R7,-			; Compare index to descriptor count
                                     03AB   770 		MPA_ARGS$L_DESCRIPTOR_COUNT(R3)
                            03   19  03AB   771 	BLSS	91$
                          0026   31  03AD   772 	BRW	97$			; Looping complete
                            04   C8  03B0   773 91$:	BISL	#MODE_DESC$M_SELECT_PHASE,-
                         24 A4       03B2   774 		MODE_DESC$R_RESERVED(R4) ; Set phase to select
                            00   E0  03B4   775 	BBS	#MODE_DESC$V_PREFERRED,- ; Test for preferred setting
                         0C A4       03B6   776 		MODE_DESC$R_FLAGS(R4),- ; 
                            08       03B8   777 		93$			; Branch if preferred set
                            01   E0  03B9   778 	BBS	#MODE_DESC$V_REQUIRED,-	; Test for required setting
                         0C A4       03BB   779 		MODE_DESC$R_FLAGS(R4),- ; 
                            03       03BD   780 		93$			; Branch if required set
                          000D   31  03BE   781 	BRW	95$			; Continue looping
                            02   D1  03C1   782 93$:	CMPL	#MODE_DESC$C_MISMATCH,-	; Is this field mismatched
                         20 A4       03C3   783 		MODE_DESC$L_REASON(R4)	;
                            07   12  03C5   784 	BNEQ	95$			; Branch if not mismatch
                    08 A3   54   D0  03C7   785 	MOVL	R4,-			; Load current field descriptor
                                     03CB   786 		MPA_ARGS$L_CURR_DESC_PTR(R3) ; for setup routine
                          032E   30  03CB   787 	BSBW	MODE_SELECT_DATA_SETUP	; Call mode_select_data_setup(R5=scdrp_ptr)
                            28   C0  03CE   788 95$:	ADDL2	#MODE_DESC$S_FIELD_DESCRIPTOR,-
                            54       03D0   789 		R4			; Increment to next field descriptor
                            57   D6  03D1   790 	INCL	R7			; Increment index
                          FFD1   31  03D3   791 	BRW	90$			; Continue looping through descriptors
                            57 8ED0  03D6   792 97$:	POPL	R7			; Restore original R7
                            09   EF  03D9   793 	EXTZV	#SCDRP$V_MODE_SENSE,-	; Extract the mode sense flags
                            02       03DB   794 		#SCDRP$S_MODE_SENSE,-
                    50   64 A5       03DC   795 		SCDRP$L_SCSI_FLAGS(R5),R0
                       50   01   D1  03DF   796 	CMPL	#SCSI$C_ANSI_SCSI_1,R0	; Test for SCSI-1 device
                            2B   12  03E2   797 	BNEQ	110$			; Branch if not SCSI-1
                         3C A3   95  03E4   798 	TSTB	MPA_ARGS$B_PAGE_CODE(R3) ; Test for page code 0
                            26   13  03E7   799 	BEQL	110$			; Branch if page code 0
                         24 A3   D0  03E9   800 	MOVL	MPA_ARGS$L_SELECT_DATA_PTR(R3),-
                            51       03EC   801 		R1			; Get current data ptr
                       51   02   C0  03ED   802 	ADDL2	#2,R1			; Point to start of select data
                         14 A3   D0  03F0   803 	MOVL	MPA_ARGS$L_PAGE_DATA_PTR(R3),-
                            52       03F3   804 		R2			; Get changeable data ptr
                       52   02   C0  03F4   805 	ADDL2	#2,R2			; Point to start of changeable data
                       54   02   D0  03F7   806 	MOVL	#2,R4			; Set index to 2
                    18 A3   54   D1  03FA   807 100$:	CMPL	R4,MPA_ARGS$L_PAGE_SIZE(R3) ; Test for end of loop
                            0F   18  03FE   808 	BGEQ	110$			; Exit if equal (or greater)
                  50   61   62   8B  0400   809 	BICB3	(R2),(R1),R0		; Apply changeable mask
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  18
X-1                             DO_A_PAGE                                12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (5)

                       61   50   8C  0404   810 	XORB2	R0,(R1)			; to current data
                            54   D6  0407   811 	INCL	R4			; Increment index
                            51   D6  0409   812 	INCL	R1			; Increment current data ptr
                            52   D6  040B   813 	INCL	R2			; Increment mask ptr
                            EB   11  040D   814 	BRB	100$			; Continue looping
                          03C3   30  040F   815 110$:	BSBW	DO_MODE_SELECT		; Call do_mode_select(R5=scdrp_ptr)
                                     0412   816 
                                     0412   817 200$:	SUBPOP	R4			; Restore register
                                     041C   818 	SUBPOP	R3			; Restore register
                                     0426   819 	SUBPOP	R2			; Restore register
                                     0430   820 	SUBPOP	R1			; Restore register
                                     043A   821 	SUBRETURN			; Subroutine return
                                     0445   822 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  19
X-1                             DO_MODE_SENSE                            12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (6)

                                     0445   824 	.SBTTL		DO_MODE_SENSE
                                     0445   825 ;
                                     0445   826 ;----------------------------------------------------------------------------
                                     0445   827 ;
                                     0445   828 ; Routine: DO_MODE_SENSE
                                     0445   829 ;
                                     0445   830 ; Description:
                                     0445   831 ;
                                     0445   832 ;	This routine does a Mode Sense command. It does not perform any page-
                                     0445   833 ;	specific checking, it just does whatever it has to do to get the Mode
                                     0445   834 ;	Sense data page requested by the caller and validate the format of the
                                     0445   835 ;	returned data. It will log errors as needed to identify page or data
                                     0445   836 ;	format errors, such as a truncated page, but semantic errors are up to
                                     0445   837 ;	the caller to detect and report.
                                     0445   838 ;
                                     0445   839 ;
                                     0445   840 ; Inputs:
                                     0445   841 ;
                                     0445   842 ;
                                     0445   843 ;	R5 = scdrp_ptr			= Pointer to an SCDRP
                                     0445   844 ;
                                     0445   845 ;	    Fields pointed to by scdrp$ps_mode_args:
                                     0445   846 ;	    mpa_args$b_page_code = SCSI page code, including pg ctrl bits. 
                                     0445   847 ;
                                     0445   848 ;	    mpa_args$ps_buffer_ptr = addr of buffer in which to return mode 
                                     0445   849 ;		    page data. The start of this buffer is the start of the 
                                     0445   850 ; 		    Mode Header, not the start of the requested page.
                                     0445   851 ;
                                     0445   852 ;	    mpa_args$l_buffer_size = Longword containing size of the buffer.
                                     0445   853 ;		    The longword pointed to by this field is r/w;  it's
                                     0445   854 ;		    read after the mode data is returned to make sure that 
                                     0445   855 ;		    what we got was not truncated, and it's written to return
                                     0445   856 ;		    the size required to hold the entire returned mode page +
                                     0445   857 ;		    header + block descriptors + the page itself. The size 
                                     0445   858 ;		    returned in this field will have been adjusted to account
                                     0445   859 ;		    for the size of the size field itself in the mode header.
                                     0445   860 ;
                                     0445   861 ;	    mpa_args$ps_page_data_ptr = Optional, address in which this rtn
                                     0445   862 ;		    will return the address of the first byte on the 1st 
                                     0445   863 ;		    requested page; this way the caller doesn't have to check 
                                     0445   864 ;		    and see if a 6 byte or 10 byte command was performed so it 
                                     0445   865 ;		    knows whether to treat the size in the header as a byte or 
                                     0445   866 ;		    a word. 
                                     0445   867 ;
                                     0445   868 ;	    mpa_args$l_page_size = Optional longword to receive
                                     0445   869 ;		    the size of the page, with the page code and page 
                                     0445   870 ;		    size bytes added in; the unadjusted value is easily 
                                     0445   871 ;		    available from the page itself, so there's no point in 
                                     0445   872 ;		    just returning that.  Not available for Page 0.
                                     0445   873 ;		   
                                     0445   874 ; Outputs:
                                     0445   875 ;
                                     0445   876 ;	R0 = status
                                     0445   877 ;
                                     0445   878 ;		SS$_BUFFEROVF
                                     0445   879 ;
                                     0445   880 ;			Buffer size specified was too small for the
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  20
X-1                             DO_MODE_SENSE                            12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (6)

                                     0445   881 ;		        amount of data which was returned, but as 
                                     0445   882 ;			much data as possible is in the buffer.
                                     0445   883 ;
                                     0445   884 ;		SS$_NODATA
                                     0445   885 ;
                                     0445   886 ;			No data was returned by the MODE SENSE
                                     0445   887 ;			command;  a bad SCSI status was returned.
                                     0445   888 ;
                                     0445   889 ;		SS$_NOSUCHSEC
                                     0445   890 ;;			Illegal page, and no required bits requested.
                                     0445   891 ;
                                     0445   892 ;		SS$_TOOMUCHDATA
                                     0445   893 ;
                                     0445   894 ;			Too many descriptors were specified (>MAX_DESCRIPTORS).
                                     0445   895 ;
                                     0445   896 ;		SS$_NORMAL
                                     0445   897 ;
                                     0445   898 ;			Success.
                                     0445   899 ;
                                     0445   900 ;		Other codes may be passed back from the port driver.
                                     0445   901 ;
                                     0445   902 ;	All other registers are preserved.
                                     0445   903 ;
                                     0445   904 ;-----------------------------------------------------------------------------
                                     0445   905 DO_MODE_SENSE:
                                     0445   906 	SUBSAVE				; Save return address
                                     044F   907 	SUBPUSH	R1			; Save register
                                     0459   908 	SUBPUSH	R2			; Save register
                                     0463   909 	SUBPUSH	R3			; Save register
                                     046D   910 	SUBPUSH	R4			; Save register
                            0C   E1  0477   911 	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      47 64 A5       0479   912 		SCDRP$L_SCSI_FLAGS(R5),20$	; Branch for 6 byte cmd
                  52   00EC C5   D0  047C   913 	MOVL	SCDRP$L_MODE_ARGS(R5),R2	; Setup mode arg ptr
                         0C A2   D0  0481   914 	MOVL	MPA_ARGS$L_BUFFER_PTR(R2),-	; Save starting buffer
                         50 A5       0484   915 		SCDRP$L_SVA_USER(R5)		; address
                         10 A2   D0  0486   916 	MOVL	MPA_ARGS$L_BUFFER_SIZE(R2),-	; Save buffer size
                         2C A5       0489   917 		SCDRP$L_BCNT(R5)		;
              52   00000000'EF   DE  048B   918 	MOVAL	CMD_MODE_SENSE_10,R2		; Setup pointer to command
                    53   1C A5   D0  0492   919 	MOVL	SCDRP$L_UCB(R5),R3		; Get UCB address
                  54   0098 C3   D0  0496   920 	MOVL	UCB$L_PDT(R3),R4		; Get SPDT address
                          FB62'  30  049B   921 	BSBW	SETUP_CMD			; Setup for 10 byte mode
                                     049E   922 						; sense command
                    51   5C A5   D0  049E   923 	MOVL	SCDRP$L_CMD_PTR(R5),R1		; Get pointer to command buffer
                  52   00EC C5   D0  04A2   924 	MOVL	SCDRP$L_MODE_ARGS(R5),R2	; Setup mode arg ptr
                 06 A1   3C A2   90  04A7   925 	MOVB	MPA_ARGS$B_PAGE_CODE(R2),6(R1)	; Load page code value
                          FB51'  30  04AC   926 	BSBW	SEND_COMMAND			; Send 10 byte command
                            02   91  04AF   927 	CMPB	#SCSI$C_CHECK_CONDITION,-	; Test for check condition
                         60 B5       04B1   928 		@SCDRP$L_STS_PTR(R5)		;
                            03   13  04B3   929 	BEQL	10$				; Branch if check condition
                          008A   31  04B5   930 	BRW	50$				; Branch if not check condition
                          FB45'  30  04B8   931 10$:	BSBW	CLEANUP_CMD			; Cleanup 10 byte command before
                                     04BB   932 						; doing 6 byte command
                   00001000 8F   CA  04BB   933 	BICL2	#SCDRP$M_TENBYTE,-		; Do 6-byte command
                         64 A5       04C1   934                 SCDRP$L_SCSI_FLAGS(R5)
                                     04C3   935 
                                     04C3   936 20$:						; Send a 6 byte command
                  52   00EC C5   D0  04C3   937 	MOVL	SCDRP$L_MODE_ARGS(R5),R2	; Setup mode arg ptr
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  21
X-1                             DO_MODE_SENSE                            12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (6)

                         0C A2   D0  04C8   938 	MOVL	MPA_ARGS$L_BUFFER_PTR(R2),-	; Save starting buffer
                         50 A5       04CB   939 		SCDRP$L_SVA_USER(R5)		; address
                         10 A2   D0  04CD   940 	MOVL	MPA_ARGS$L_BUFFER_SIZE(R2),-	; Save buffer size
                         2C A5       04D0   941 		SCDRP$L_BCNT(R5)		;
              52   00000000'EF   DE  04D2   942 	MOVAL	CMD_MODE_SENSE,R2		; Setup pointer to command
                    53   1C A5   D0  04D9   943 	MOVL	SCDRP$L_UCB(R5),R3		; Get UCB address
                  54   0098 C3   D0  04DD   944 	MOVL	UCB$L_PDT(R3),R4		; Get SPDT address
                          FB1B'  30  04E2   945 	BSBW	SETUP_CMD			; Setup for 6 byte mode
                                     04E5   946 						; sense command
                    51   5C A5   D0  04E5   947 	MOVL	SCDRP$L_CMD_PTR(R5),R1		; Get pointer to command buffer
                  52   00EC C5   D0  04E9   948 	MOVL	SCDRP$L_MODE_ARGS(R5),R2	; Setup mode arg ptr
                 06 A1   3C A2   90  04EE   949 	MOVB	MPA_ARGS$B_PAGE_CODE(R2),6(R1)	; Load page code value
                          FB0A'  30  04F3   950 	BSBW	SEND_COMMAND			; Send mode sense 6 byte command
                            02   91  04F6   951 	CMPB	#SCSI$C_CHECK_CONDITION,-	; Test for check condition
                         60 B5       04F8   952 		@SCDRP$L_STS_PTR(R5)		;
                            46   12  04FA   953 	BNEQ	50$				; Branch if not check condition
                            05   91  04FC   954 	CMPB	#SCSI$C_ILLEGAL_REQUEST,-	; Test for illegal request
                       0304 C5       04FE   955 		SCDRP$B_SENSE_KEY(R5)		;
                            3F   12  0501   956 	BNEQ	50$				; Branch if not illegal request
              52   FFFFFFF8'E3   9E  0503   957 	MOVAB	UCB$B_ADDL_SENSE_INFO-8(R3),R2	; Setup pointer to additional
                                     050A   958 						; sense data area in UCB
                                     050A   959 						; NOTE: Only bytes 8 thru 17 are
                                     050A   960 						; stored in UCB$B_ADDL_SENSE_INFO, so that 
                                     050A   961 						; the pointer must be set to 8 bytes 
                                     050A   962 						; before the field for the data structure 
                                     050A   963 						; label to match up with the data.
                            24   91  050A   964 	CMPB	#SCSI$C_INVALID_FIELD_IN_CDB,-	; Test for add. sense code = 0x24
                         0C A2       050C   965 		SCSI$SNS$B_ADD_SENSE_CODE(R2)	;
                            06   13  050E   966 	BEQL	30$				; Branch if equal
                            20   91  0510   967 	CMPB	#SCSI$C_INVALID_COMMAND_OP,-	; Test for add. sense code = 0x20
                         0C A2       0512   968 		SCSI$SNS$B_ADD_SENSE_CODE(R2)	;
                            2C   12  0514   969 	BNEQ	50$				; Branch if not equal
                         0D A2   95  0516   970 30$:	TSTB	SCSI$SNS$B_ADD_SENSE_QUAL(R2)	; Test for add. sense qual = 0
                            27   12  0519   971 	BNEQ	50$				; Branch if not equal
                  53   00EC C5   D0  051B   972 	MOVL	SCDRP$L_MODE_ARGS(R5),R3	; Setup mode arg ptr
                                     0520   973 	ASSUME	TRUE EQ 1			; Assumption for branch on low bit set
                         3E A3   E8  0520   974 	BLBS	MPA_ARGS$B_REQ_BITS_PRESENT(R3),- ; Branch if required bits are
                            1E       0523   975 		50$				; present
                            07   E0  0524   976 	BBS	#SCSI$SNS$V_SKSV,-		; Test the Sense Key Specific
                         0F A2       0526   977 		SCSI$SNS$R_SENSE_KEY_SPECIFIC(R2),- ; Valid bit
                            0A       0528   978 		40$				; Branch if valid is set
              50   00000978 8F   D0  0529   979 	MOVL	#SS$_NOSUCHSEC,R0		; Set return status to NOSUCHSEC
                          000F   31  0530   980 	BRW	50$				; Continue
                       0200 8F   B1  0533   981 40$:	CMPW	#^X200,-			; Test if invalid byte was page
                         10 A2       0537   982 		SCSI$SNS$W_FIELD_POINTER(R2)	; code field (byte 2)
                                     0539   983 						; NOTE: hex 0200 = 0002(byte swapped)
                            07   12  0539   984 	BNEQ	50$				; Branch if not equal
              50   00000978 8F   D0  053B   985 	MOVL	#SS$_NOSUCHSEC,R0		; Set return status to NOSUCHSEC
                                     0542   986 
                                     0542   987 50$:	;NOTE   This section from 50$ to 65$ has been reimplemented and
                                     0542   988 	;	now differs from the Alpha C code implementation.  This was
                                     0542   989 	;	done to remove references to the UCB for layering reasons.
                            00   91  0542   990 	CMPB	#SCSI$C_GOOD,-			; Test SCSI return status
                         60 B5       0544   991 		@SCDRP$L_STS_PTR(R5)		;
                            1D   13  0546   992 	BEQL	62$				; Branch if status good
              50   00000978 8F   D1  0548   993 	CMPL	#SS$_NOSUCHSEC,R0		; Test command return status
                            14   13  054F   994 	BEQL	62$				; Branch if SS$_NOSUCHSEC
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  22
X-1                             DO_MODE_SENSE                            12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (6)

                            02   91  0551   995 	CMPB	#SCSI$C_CHECK_CONDITION,-	; Test SCSI return status
                         60 B5       0553   996 		@SCDRP$L_STS_PTR(R5)		;
                            07   12  0555   997 	BNEQ	60$				; Branch if status not check
                                     0557   998 						; condition
                            01   91  0557   999 	CMPB	#SCSI$C_RECOVERED_ERROR,-	; Test SCSI sense key
                       0304 C5       0559  1000 		SCDRP$B_SENSE_KEY(R5)		; 
                            07   13  055C  1001 	BEQL	62$				; Branch if sense key is
                                     055E  1002 						; recovered error
                                     055E  1003 60$:
              50   000001AC 8F   D0  055E  1004 	MOVL	#SS$_NODATA,R0			; Set return status to NODATA
                                     0565  1005 62$:
                          FA98'  30  0565  1006 	BSBW	CLEANUP_CMD			; Cleanup command before exiting
                         03 50   E8  0568  1007 	BLBS	R0,65$				; If status is success to
                                     056B  1008 						; continue
                          009F   31  056B  1009 	BRW	95$				; If status is not success, 
                                     056E  1010 						; then return
                  53   00EC C5   D0  056E  1011 65$:	MOVL	SCDRP$L_MODE_ARGS(R5),R3	; Setup mode arg ptr
                    52   0C A3   D0  0573  1012 	MOVL	MPA_ARGS$L_BUFFER_PTR(R3),R2	; Get mode page header ptr
                            0C   E1  0577  1013 	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      25 64 A5       0579  1014 		SCDRP$L_SCSI_FLAGS(R5),70$	; Branch for 6 byte cmd
                       51   62   9A  057C  1015 	MOVZBL	SCSI$MPH10$W_DATA_LENGTH(R2),R1 ; Get MSB of size
                  51   51   08   78  057F  1016 	ASHL	#8,R1,R1			; Shift left one byte
                         01 A2   80  0583  1017 	ADDB2	SCSI$MPH10$W_DATA_LENGTH+1(R2),-; Add LSB to size
                            51       0586  1018 		R1				;  
                       51   02   C0  0587  1019 	ADDL2	#2,R1				; Size includes the size field
                    50   06 A2   9A  058A  1020 	MOVZBL	SCSI$MPH10$W_BLOCK_LENGTH(R2),R0 ; Get MSB of block length
                  50   50   08   78  058E  1021 	ASHL	#8,R0,R0			; Shift left one byte
                         07 A2   80  0592  1022 	ADDB2	SCSI$MPH10$W_BLOCK_LENGTH+1(R2),-; Add LSB to block length
                            50       0595  1023 		R0				;
                       50   08   C0  0596  1024 	ADDL2	#8,R0				; Add size of mode10 header
               14 A3   52   50   C1  0599  1025 	ADDL3	R0,R2,-				; Set data ptr past mode10
                                     059E  1026 		MPA_ARGS$L_PAGE_DATA_PTR(R3)	; header and block descriptor
                          0011   31  059E  1027 	BRW	80$				; Continue
                       51   62   9A  05A1  1028 70$:	MOVZBL	SCSI$MPH6$B_DATA_LENGTH(R2),R1	; Get returned size
                            51   D6  05A4  1029 	INCL	R1				; Size includes 1 byte size
                                     05A6  1030 						; field
                    50   03 A2   9A  05A6  1031 	MOVZBL	SCSI$MPH6$B_BLOCK_LENGTH(R2),R0	; Length of block descriptors
                       50   04   C0  05AA  1032 	ADDL2	#4,R0				; Add size of mode6 header
               14 A3   52   50   C1  05AD  1033 	ADDL3	R0,R2,-				; Set data ptr past mode6
                                     05B2  1034 		MPA_ARGS$L_PAGE_DATA_PTR(R3)	; header and block descriptor
                    50   10 A3   D0  05B2  1035 80$:	MOVL	MPA_ARGS$L_BUFFER_SIZE(R3),R0	; Save requested size
                    10 A3   51   D0  05B6  1036 	MOVL	R1,MPA_ARGS$L_BUFFER_SIZE(R3)	; Load returned size
                       50   51   D1  05BA  1037 	CMPL	R1,R0				; Compare requested and 
                                     05BD  1038 						; returned sizes
                            0A   15  05BD  1039 	BLEQ	85$				; Branch if no overflow
              50   00000601 8F   D0  05BF  1040 	MOVL	#SS$_BUFFEROVF,R0		; Set return status to overflow
                          0044   31  05C6  1041 	BRW	95$				; Return
                         C0 8F   8B  05C9  1042 85$:	BICB3	#^C<SCSI$CMP$M_PAGE_CODE>,-	; Clear all non page code bits
                    52   3C A3       05CC  1043 		MPA_ARGS$B_PAGE_CODE(R3),R2	;
                            39   13  05CF  1044 	BEQL	94$				; Branch to successful return
                    54   14 A3   D0  05D1  1045 	MOVL	MPA_ARGS$L_PAGE_DATA_PTR(R3),R4 ; Load page data ptr
                         C0 8F   8B  05D5  1046 	BICB3   #^C<SCSI$CMP$M_PAGE_CODE>,-     ; Clear all non page code bits
                       51   64       05D8  1047                 (R4),R1				; in page data byte 0
                       51   52   91  05DA  1048 	CMPB	R2,R1				; Test that returned page is
                                     05DD  1049 						; requested page
                            0A   13  05DD  1050 	BEQL	90$				; Branch if equal
              50   0000029C 8F   D0  05DF  1051 	MOVL	#SS$_TOOMUCHDATA,R0		; Load error status
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  23
X-1                             DO_MODE_SENSE                            12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (6)

                          0024   31  05E6  1052 	BRW	95$				; Return with error
                                     05E9  1053 
                                     05E9  1054 90$:	; NOTE: Byte 1 of page code data is always the additional page code
                                     05E9  1055 	;	length. Therefore, the total page code length is this byte
                                     05E9  1056 	;	plus 2 bytes (for the page code and length bytes).
                    52   01 A4   9A  05E9  1057 	MOVZBL	1(R4),R2			; Read the mode page return size
                       52   02   C0  05ED  1058 	ADDL2	#2,R2				; Add 2 bytes to size for page
                                     05F0  1059 						; code and length
                    18 A3   52   D0  05F0  1060 	MOVL	R2,MPA_ARGS$L_PAGE_SIZE(R3)	; Store return size
                       52   54   C0  05F4  1061 	ADDL2	R4,R2				; Add page data ptr & page size
                    52   0C A3   C2  05F7  1062 	SUBL2	MPA_ARGS$L_BUFFER_PTR(R3),R2	; Subtract the buffer ptr to 
                                     05FB  1063 						; yield true returned size
                       50   52   D1  05FB  1064 	CMPL	R2,R0				; Compare returned size to
                                     05FE  1065 						; requested size
                            0A   15  05FE  1066 	BLEQ	94$				; Branch to success return
              50   00000601 8F   D0  0600  1067 	MOVL	#SS$_BUFFEROVF,R0		; Load error status
                          0003   31  0607  1068 	BRW	95$				; Return with error status
                       50   01   D0  060A  1069 94$:	MOVL	#SS$_NORMAL,R0			; Load success return status
                                     060D  1070 95$:
                                     060D  1071 	SUBPOP	R4			; Restore register
                                     0617  1072 	SUBPOP	R3			; Restore register
                                     0621  1073 	SUBPOP	R2			; Restore register
                                     062B  1074 	SUBPOP	R1			; Restore register
                                     0635  1075 	SUBRETURN			; Subroutine return
                                     0640  1076 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  24
X-1                             MODE_SELECT_HDR_SETUP                    12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (7)

                                     0640  1078 	.SBTTL		MODE_SELECT_HDR_SETUP
                                     0640  1079 ;
                                     0640  1080 ;+----------------------------------------------------------------------------
                                     0640  1081 ;
                                     0640  1082 ; Routine: MODE_SELECT_HDR_SETUP
                                     0640  1083 ;
                                     0640  1084 ; Description:
                                     0640  1085 ;
                                     0640  1086 ;    This routine prepares the mode page header and block descriptor(s)
                                     0640  1087 ;    in the mode select buffer prior to a Mode Select command.
                                     0640  1088 ;
                                     0640  1089 ; Inputs:
                                     0640  1090 ;
                                     0640  1091 ;	R5 = scdrp_ptr	= Pointer to an SCDRP
                                     0640  1092 ;
                                     0640  1093 ; Outputs 
                                     0640  1094 ;
                                     0640  1095 ;	R0 = status = SS$_NORMAL
                                     0640  1096 ;
                                     0640  1097 ;-----------------------------------------------------------------------------*/
                                     0640  1098 MODE_SELECT_HDR_SETUP:
                            1E   BB  0640  1099 	PUSHR	#^M<R1,R2,R3,R4>		; Save registers
                  53   00EC C5   D0  0642  1100 	MOVL	SCDRP$L_MODE_ARGS(R5),R3	; Setup arg ptr
                       54   63   D0  0647  1101 	MOVL	MPA_ARGS$L_FIELD_DESC(R3),R4	; Setup field desc ptr
                                     064A  1102 
                                     064A  1103 	ASSUME	FALSE EQ 0  ; Assumption for the following 2 CLRL instructions
                            50   D4  064A  1104 	CLRL	R0				; Initialize loop index
                            51   D4  064C  1105 	CLRL	R1				; Clear devpar flag
                            52   D4  064E  1106 	CLRL	R2				; Clear medtyp flag
                    04 A3   50   D1  0650  1107 10$:	CMPL	R0,-				; Test for loop end condition
                                     0654  1108 		MPA_ARGS$L_DESCRIPTOR_COUNT(R3)	;
                            37   18  0654  1109 	BGEQ	20$				; Branch is end of loop
                   FFFFFFFD 8F   D1  0656  1110 	CMPL	#MODE_DESC$C_DEVPAR_BOFF,-	; Test byte offset for
                            64       065C  1111 		MODE_DESC$L_BOFF(R4)		; device parameter value
                            10   12  065D  1112 	BNEQ	14$				; Branch if not device par
                            01   E0  065F  1113 	BBS	#MODE_DESC$V_REQUIRED,-		; Test if required bit is set
                      05 0C A4       0661  1114 		MODE_DESC$R_FLAGS(R4),12$	; and branch if set
                            00   E1  0664  1115 	BBC	#MODE_DESC$V_PREFERRED,-	; Test if preferred bit is set
                      06 0C A4       0666  1116 		MODE_DESC$R_FLAGS(R4),14$	; and branch if clear
                       51   01   D0  0669  1117 12$:	MOVL	#TRUE,R1				; Set devpar flag	
                          0016   31  066C  1118 	BRW	18$				; Continue
                   FFFFFFFE 8F   D1  066F  1119 14$:	CMPL	#MODE_DESC$C_MEDTYP_BOFF,-	; Test byte offset for
                            64       0675  1120 		MODE_DESC$L_BOFF(R4)		; medium type value
                            0D   12  0676  1121 	BNEQ	18$				; Branch if not medium type
                            01   E0  0678  1122 	BBS	#MODE_DESC$V_REQUIRED,-		; Test if required bit is set
                      05 0C A4       067A  1123 		MODE_DESC$R_FLAGS(R4),16$	; and branch if set
                            00   E1  067D  1124 	BBC	#MODE_DESC$V_PREFERRED,-	; Test if preferred bit is set
                      03 0C A4       067F  1125 		MODE_DESC$R_FLAGS(R4),18$	; and branch if clear
                       52   01   D0  0682  1126 16$:	MOVL	#TRUE,R2				; Set medtyp flag	
                            50   D6  0685  1127 18$:	INCL	R0				; Increment index
                            28   C0  0687  1128 	ADDL2	#MODE_DESC$S_FIELD_DESCRIPTOR,-
                            54       0689  1129 		R4				; Increment field desc ptr
                          FFC3   31  068A  1130 	BRW	10$				; Continue looping
                         1C A3   D0  068D  1131 20$:	MOVL	MPA_ARGS$L_SELECT_BUFF_PTR(R3),- ; Load mode param header
                            54       0690  1132 		R4				; pointer
                            0C   E1  0691  1133 	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      2C 64 A5       0693  1134 		SCDRP$L_SCSI_FLAGS(R5),30$	; Branch for 6 byte cmd
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  25
X-1                             MODE_SELECT_HDR_SETUP                    12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (7)

                            64   B4  0696  1135 	CLRW	SCSI$MPH10$W_DATA_LENGTH(R4)	; Clear data length word
                                     0698  1136 	ASSUME	TRUE EQ 1	; Assumption for branch low bit set instruction
                         03 52   E8  0698  1137 	BLBS	R2,22$				; Test medtyp flag
                         02 A4   94  069B  1138 	CLRB	SCSI$MPH10$B_MEDIUM_TYPE(R4)	; Clear medium type field
                                     069E  1139 22$:	ASSUME	TRUE EQ 1	; Assumption for branch low bit set instruction
                         03 51   E8  069E  1140 	BLBS	R1,24$				; Test devpar flag
                         03 A4   94  06A1  1141 	CLRB	SCSI$MPH10$B_DEVICE_PARAM(R4)	; Clear device param field
                                     06A4  1142 
                                     06A4  1143 24$:	ASSUME	SCSI$MPH10$B_RESERVED2 EQ SCSI$MPH10$B_RESERVED1+1
                         04 A4   B4  06A4  1144 	CLRW	SCSI$MPH10$B_RESERVED1(R4)	; Clear two reserved bytes
                    51   06 A4   9A  06A7  1145 	MOVZBL	SCSI$MPH10$W_BLOCK_LENGTH(R4),R1; Move MSB to R1
                  51   51   08   78  06AB  1146 	ASHL	#8,R1,R1			; Shift to upper byte
                    51   07 A4   90  06AF  1147 	MOVB	SCSI$MPH10$W_BLOCK_LENGTH+1(R4),R1 ; Move LSB to R1
               51   51   FD 8F   78  06B3  1148 	ASHL	#-3,R1,R1			; # of descriptors equals
                                     06B8  1149 						; descriptor size / 8
                    52   1C A3   D0  06B8  1150 	MOVL	MPA_ARGS$L_SELECT_BUFF_PTR(R3),R2 ; Load select buffer ptr
                       52   08   C0  06BC  1151 	ADDL2	#8,R2				; Add 8 to get block desc ptr
                          001E   31  06BF  1152 	BRW	40$				; Branch to common path
                            64   94  06C2  1153 30$:	CLRB    SCSI$MPH6$B_DATA_LENGTH(R4)	; Clear data length byte
                                     06C4  1154 	ASSUME	TRUE EQ 1	; Assumption for branch low bit set instruction
                         03 52   E8  06C4  1155 	BLBS    R2,32$                          ; Test medtyp flag
                         01 A4   94  06C7  1156 	CLRB    SCSI$MPH6$B_MEDIUM_TYPE(R4)	; Clear medium type field
                                     06CA  1157 32$:	ASSUME	TRUE EQ 1	; Assumption for branch low bit set instruction
                         03 51   E8  06CA  1158 	BLBS    R1,34$                          ; Test devpar flag
                         02 A4   94  06CD  1159 	CLRB    SCSI$MPH6$B_DEVICE_PARAM(R4)	; Clear device param field
                    51   03 A4   9A  06D0  1160 34$:	MOVZBL  SCSI$MPH6$B_BLOCK_LENGTH(R4),R1	; Move block length to R1
               51   51   FD 8F   78  06D4  1161         ASHL    #-3,R1,R1                       ; # of descriptors equals
                                     06D9  1162                                                 ; descriptor size / 8
                    52   1C A3   D0  06D9  1163         MOVL    MPA_ARGS$L_SELECT_BUFF_PTR(R3),R2 ; Load select buffer ptr
                       52   04   C0  06DD  1164         ADDL2   #4,R2                           ; Add 4 to get block desc ptr
                            51   D5  06E0  1165 40$:	TSTL	R1				; Test number of descriptors
                            12   13  06E2  1166 	BEQL	90$				; Branch if zero
                            50   D4  06E4  1167 	CLRL	R0				; Initialize index
                       51   50   D1  06E6  1168 50$:	CMPL	R0,R1				; Test for end loop condition
                            0B   18  06E9  1169 	BGEQ	90$				; Branch if index >= # of desc
                                     06EB  1170 	
                         01 A2   D4  06EB  1171 	CLRL	SCSI$MPBD$B_BLOCK(R2)		; Clear 4 bytes at once
                            50   D6  06EE  1172 	INCL	R0				; Increment to next block
                       52   08   C0  06F0  1173 	ADDL2	#SCSI$MPBD$S_MODE_PARAMETER,R2	; Move ptr to next block
                          FFF0   31  06F3  1174 	BRW	50$				; Continue looping
                       50   01   D0  06F6  1175 90$:	MOVL	#SS$_NORMAL,R0			; Load success status
                            1E   BA  06F9  1176 	POPR	#^M<R1,R2,R3,R4>		; Restore registers
                                 05  06FB  1177 	RSB					; Return
                                     06FC  1178 
                                     06FC  1179 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  26
X-1                             MODE_SELECT_DATA_SETUP                   12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (8)

                                     06FC  1181 	.SBTTL		MODE_SELECT_DATA_SETUP
                                     06FC  1182 ;/*
                                     06FC  1183 ;---------------------------------------------------------------------------
                                     06FC  1184 ;
                                     06FC  1185 ; Routine: MODE_SELECT_DATA_SETUP
                                     06FC  1186 ;
                                     06FC  1187 ; Description:
                                     06FC  1188 ;
                                     06FC  1189 ;	Set a single field into the select buffer.
                                     06FC  1190 ;
                                     06FC  1191 ; Inputs:
                                     06FC  1192 ;	R5 = scdrp_ptr			 = Pointer to an SCDRP
                                     06FC  1193 ;
                                     06FC  1194 ;	    Fields pointed to by scdrp$ps_mode_args:
                                     06FC  1195 ;	    mpa_args$ps_curr_desc_ptr    = Pointer to current field descriptor.
                                     06FC  1196 ;	    mpa_args$ps_select_data_ptr  = Pointer to start of data area within
                                     06FC  1197 ;					   the select buffer.
                                     06FC  1198 ;
                                     06FC  1199 ; Outputs:
                                     06FC  1200 ;	R0 = status =	SS$_NORMAL
                                     06FC  1201 ;---------------------------------------------------------------------------*/
                                     06FC  1202 MODE_SELECT_DATA_SETUP:
                            1E   BB  06FC  1203 	PUSHR	#^M<R1,R2,R3,R4>		; Save registers
                  53   00EC C5   D0  06FE  1204 	MOVL	SCDRP$L_MODE_ARGS(R5),R3	; Setup arg ptr
                    54   08 A3   D0  0703  1205 	MOVL	MPA_ARGS$L_CURR_DESC_PTR(R3),R4 ; Setup current desc ptr
                    51   10 A4   DE  0707  1206 	MOVAL	MODE_DESC$L_DESIRED(R4),R1      ; Load address of desired field
                            04   E1  070B  1207 	BBC	#MODE_DESC$V_DESPTR,-		; Test desired ptr flag
                03 0000000C'EF       070D  1208 		MODE_DESC$R_FLAGS,10$		; Branch if flag clear
                       51   61   D0  0713  1209 	MOVL	(R1),R1				; Load address from desired
                                     0716  1210 						; field
                       50   64   D0  0716  1211 10$:	MOVL	MODE_DESC$L_BOFF(R4),R0		; Get starting byte offset
                            28   19  0719  1212 	BLSS	20$				; Branch if offset is negative
                         24 A3   D0  071B  1213 	MOVL	MPA_ARGS$L_SELECT_DATA_PTR(R3),- ; Load select data ptr
                            52       071E  1214 		R2				;
                       52   50   C0  071F  1215 	ADDL2	R0,R2				; Add byte offset to get
                                     0722  1216 						; starting byte pointer
                    08 A4   08   D1  0722  1217 	CMPL	#8,MODE_DESC$L_BIT_SIZE(R4)	; Test size of field
                            0A   15  0726  1218 	BLEQ	15$				; Branch if size is >= 8
                    04 A4   61   F0  0728  1219 	INSV	(R1),MODE_DESC$L_BIT_OFFSET(R4),- ; Insert desired value into
                    62   08 A4       072C  1220 		MODE_DESC$L_BIT_SIZE(R4),(R2)	; select buffer
                          009D   31  072F  1221 	BRW	90$				; Return with success
            50   08 A4   FD 8F   78  0732  1222 15$:	ASHL	#-3,MODE_DESC$L_BIT_SIZE(R4),R0	; Load byte size into R0
                            3F   BB  0738  1223 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>		; Save registers
                  62   61   50   28  073A  1224 	MOVC3	R0,(R1),(R2)			; Move R0 bytes from R1 to R2
                            3F   BA  073E  1225 	POPR	#^M<R0,R1,R2,R3,R4,R5>		; Restore registers
                                     0740  1226 
                          008C   31  0740  1227 	BRW	90$				; Return with success
                                     0743  1228 
                         1C A3   D0  0743  1229 20$:	MOVL	MPA_ARGS$L_SELECT_BUFF_PTR(R3),- ; Load select buffer ptr
                            52       0746  1230 		R2				;
                                     0747  1231 	DISPATCH R0,TYPE=B,<-			; Dispatch according to boff
                                     0747  1232 		<MODE_DESC$C_LENGTH_BOFF,	22$>,-
                                     0747  1233 		<MODE_DESC$C_MEDTYP_BOFF,	30$>,-
                                     0747  1234 		<MODE_DESC$C_DEVPAR_BOFF,	40$>,-
                                     0747  1235 		<MODE_DESC$C_BDLEN_BOFF,	50$>,-
                                     0747  1236 		<MODE_DESC$C_DENS_BOFF,		60$>,-
                                     0747  1237 		<MODE_DESC$C_BLKLEN_BOFF,	70$>>
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  27
X-1                             MODE_SELECT_DATA_SETUP                   12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (8)

                          0074   31  0758  1238 	BRW	90$				; Unmatched entry, just exit
                                     075B  1239 
                            0C   E1  075B  1240 22$:	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      06 64 A5       075D  1241 		SCDRP$L_SCSI_FLAGS(R5),25$	; Branch for 6 byte cmd
                       62   61   B0  0760  1242 	MOVW	(R1),SCSI$MPH10$W_DATA_LENGTH(R2) ; Load field from desired ptr
                          0069   31  0763  1243 	BRW	90$				; Return
                       62   61   90  0766  1244 25$:	MOVB	(R1),SCSI$MPH6$B_DATA_LENGTH(R2) ; Load field from desired ptr
                          0063   31  0769  1245 	BRW	90$				; Return
                                     076C  1246 
                            0C   E1  076C  1247 30$:	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      07 64 A5       076E  1248 		SCDRP$L_SCSI_FLAGS(R5),35$	; Branch for 6 byte cmd
                    02 A2   61   90  0771  1249 	MOVB	(R1),SCSI$MPH10$B_MEDIUM_TYPE(R2) ; Load field from desired ptr
                          0057   31  0775  1250 	BRW	90$				; Return
                    01 A2   61   90  0778  1251 35$:	MOVB	(R1),SCSI$MPH6$B_MEDIUM_TYPE(R2) ; Load field from desired ptr
                          0050   31  077C  1252 	BRW	90$				; Return
                                     077F  1253 
                            0C   E1  077F  1254 40$:	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      07 64 A5       0781  1255 		SCDRP$L_SCSI_FLAGS(R5),45$	; Branch for 6 byte cmd
                    03 A2   61   90  0784  1256 	MOVB	(R1),SCSI$MPH10$B_DEVICE_PARAM(R2) ; Load field from desired ptr
                          0044   31  0788  1257 	BRW	90$				; Return
                    02 A2   61   90  078B  1258 45$:	MOVB	(R1),SCSI$MPH6$B_DEVICE_PARAM(R2) ; Load field from desired ptr
                          003D   31  078F  1259 	BRW	90$				; Return
                                     0792  1260 
                            0C   E1  0792  1261 50$:	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      07 64 A5       0794  1262 		SCDRP$L_SCSI_FLAGS(R5),55$	; Branch for 6 byte cmd
                    06 A2   61   B0  0797  1263 	MOVW	(R1),SCSI$MPH10$W_BLOCK_LENGTH(R2) ; Load field from desired ptr
                          0031   31  079B  1264 	BRW	90$				; Return
                    03 A2   61   90  079E  1265 55$:	MOVB	(R1),SCSI$MPH6$B_BLOCK_LENGTH(R2) ; Load field from desired ptr
                          002A   31  07A2  1266 	BRW	90$				; Return
                                     07A5  1267 
                            0C   E1  07A5  1268 60$:	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      06 64 A5       07A7  1269 		SCDRP$L_SCSI_FLAGS(R5),65$	; Branch for 6 byte cmd
                       52   08   C0  07AA  1270 	ADDL2	#SCSI$MPH10$S_MODE_PARAM_HDR_10,R2 ; Offset passed header
                          0003   31  07AD  1271 	BRW	66$				; Continue
                       52   04   C0  07B0  1272 65$:	ADDL2	#SCSI$MPH6$S_MODE_PARAM_HDR_6,R2 ; Offset passed header
                       62   61   90  07B3  1273 66$:	MOVB	(R1),(R2)			; Load field from desired ptr
                          0016   31  07B6  1274 	BRW	90$				; Return
                                     07B9  1275 
                            0C   E1  07B9  1276 70$:	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      05 64 A5       07BB  1277 		SCDRP$L_SCSI_FLAGS(R5),75$	; Branch for 6 byte cmd
                       52   08   C0  07BE  1278 	ADDL2	#SCSI$MPH10$S_MODE_PARAM_HDR_10,R2 ; Offset passed header
                            03   11  07C1  1279 	BRB	76$				; Continue
                       52   04   C0  07C3  1280 75$:	ADDL2	#SCSI$MPH6$S_MODE_PARAM_HDR_6,R2 ; Offset passed header
                                     07C6  1281 
                                     07C6  1282 76$:	;NOTE:	The mode parameter block descriptor block length
                                     07C6  1283 	;	field is always three bytes long and begins at
                                     07C6  1284 	;	the fifth byte in the descriptor.
                            3F   BB  07C6  1285 	PUSHR	#^M<R0,R1,R2,R3,R4,R5>		; Save registers
               05 A2   61   03   28  07C8  1286 	MOVC3	#3,(R1),5(R2)			; Load field from desired ptr
                            3F   BA  07CD  1287 	POPR	#^M<R0,R1,R2,R3,R4,R5>		; Restore registers
                                     07CF  1288 
                       50   01   D0  07CF  1289 90$:	MOVL	#SS$_NORMAL,R0			; Load success status
                            1E   BA  07D2  1290 95$:	POPR	#^M<R1,R2,R3,R4>		; Restore registers
                                 05  07D4  1291 	RSB					; Return
                                     07D5  1292 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  28
X-1                             DO_MODE_SELECT                           12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (9)

                                     07D5  1294 	.SBTTL		DO_MODE_SELECT
                                     07D5  1295 ;/*
                                     07D5  1296 ;---------------------------------------------------------------------------
                                     07D5  1297 ;
                                     07D5  1298 ; Routine: DO_MODE_SELECT
                                     07D5  1299 ;
                                     07D5  1300 ; Description:
                                     07D5  1301 ;
                                     07D5  1302 ; Send a MODE SELECT command to the target.
                                     07D5  1303 ;
                                     07D5  1304 ; Inputs:
                                     07D5  1305 ;
                                     07D5  1306 ;	R5 = scdrp_ptr			    = Pointer to an SCDRP
                                     07D5  1307 ;
                                     07D5  1308 ;	    Fields pointed to by scdrp$ps_mode_args:
                                     07D5  1309 ;	    mpa_args$b_page_code 	    = SCSI Page Code, with clear page
                                     07D5  1310 ;						control bits
                                     07D5  1311 ;	    mpa_args$ps_select_buff_ptr     = Pointer to start of header area
                                     07D5  1312 ;						within the select buffer.
                                     07D5  1313 ;
                                     07D5  1314 ; Outputs:
                                     07D5  1315 ;
                                     07D5  1316 ;	R0 = status =	SS$_NORMAL
                                     07D5  1317 ;			SS$_NODATA if bad SCSI status 
                                     07D5  1318 ;			or status propagated from SEND_COMMAND
                                     07D5  1319 ;
                                     07D5  1320 ;---------------------------------------------------------------------------*/
                                     07D5  1321 DO_MODE_SELECT:
                                     07D5  1322 	SUBSAVE					; Save return address
                                     07DF  1323 	SUBPUSH	R1				; Save register
                                     07E9  1324 	SUBPUSH	R2				; Save register
                                     07F3  1325 	SUBPUSH	R3				; Save register
                                     07FD  1326 	SUBPUSH	R4				; Save register
                  53   00EC C5   D0  0807  1327 	MOVL	SCDRP$L_MODE_ARGS(R5),R3	; Load mpa args ptr
                         1C A3   D0  080C  1328 	MOVL	MPA_ARGS$L_SELECT_BUFF_PTR(R3),- ; Save starting buffer
                         50 A5       080F  1329 		SCDRP$L_SVA_USER(R5)		; address
                         10 A3   D0  0811  1330 	MOVL	MPA_ARGS$L_BUFFER_SIZE(R3),-	; Set buffer size to return
                         20 A3       0814  1331 		MPA_ARGS$L_SELECT_BUFF_SIZE(R3)	; size of last mode sense
                            0C   E1  0816  1332 	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      2E 64 A5       0818  1333 		SCDRP$L_SCSI_FLAGS(R5),20$	; Branch for 6 byte cmd
              52   00000000'EF   DE  081B  1334 	MOVAL	CMD_MODE_SELECT_10,R2		; Setup pointer to command
                    53   1C A5   D0  0822  1335 	MOVL	SCDRP$L_UCB(R5),R3		; Get UCB address
                  54   0098 C3   D0  0826  1336 	MOVL	UCB$L_PDT(R3),R4		; Get SPDT address
                          F7D2'  30  082B  1337 	BSBW	SETUP_CMD			; Setup for 10 byte mode
                                     082E  1338 						; sense command
                    51   5C A5   D0  082E  1339 	MOVL	SCDRP$L_CMD_PTR(R5),R1		; Get pointer to command buffer
                  53   00EC C5   D0  0832  1340 	MOVL	SCDRP$L_MODE_ARGS(R5),R3	; Load mpa args ptr
                         10 A3   D0  0837  1341 	MOVL	MPA_ARGS$L_BUFFER_SIZE(R3),-	; Setup byte count
                         2C A5       083A  1342 		SCDRP$L_BCNT(R5)		;
                                     083C  1343 
                                     083C  1344 	;NOTE:	For the 10 byte mode select the buffer size is loaded
                                     083C  1345 	;	into bytes 7 and 8 (byte swapped) of the command.  Because
                                     083C  1346 	;	the actual command doesn't start until the 4th byte this
                                     083C  1347 	;	results in an offset of 12 and 11 for these move byte
                                     083C  1348 	;	instructions.
                         20 A3   90  083C  1349 	MOVB	MPA_ARGS$L_SELECT_BUFF_SIZE(R3),- ; Load LSB of byte count
                         0C A1       083F  1350 		12(R1)				; 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  29
X-1                             DO_MODE_SELECT                           12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (9)

                         21 A3   90  0841  1351 	MOVB	MPA_ARGS$L_SELECT_BUFF_SIZE+1(R3),- ; Load MSB of byte count
                         0B A1       0844  1352 		11(R1)				; 
                          0026   31  0846  1353 	BRW	30$				; Continue with common code
              52   00000000'EF   DE  0849  1354 20$:	MOVAL	CMD_MODE_SELECT,R2		; Setup pointer to command
                    53   1C A5   D0  0850  1355 	MOVL	SCDRP$L_UCB(R5),R3		; Get UCB address
                  54   0098 C3   D0  0854  1356 	MOVL	UCB$L_PDT(R3),R4		; Get SPDT address
                          F7A4'  30  0859  1357 	BSBW	SETUP_CMD			; Setup for 6 byte mode
                                     085C  1358 						; sense command
                    51   5C A5   D0  085C  1359 	MOVL	SCDRP$L_CMD_PTR(R5),R1		; Get pointer to command buffer
                  53   00EC C5   D0  0860  1360 	MOVL	SCDRP$L_MODE_ARGS(R5),R3	; Load mpa args ptr
                         10 A3   D0  0865  1361 	MOVL	MPA_ARGS$L_BUFFER_SIZE(R3),-	; Setup byte count
                         2C A5       0868  1362 		SCDRP$L_BCNT(R5)		;
                                     086A  1363 
                                     086A  1364 	;NOTE:	For the 6 byte mode select the buffer size is loaded
                                     086A  1365 	;	into byte 4 of the command.  Because the actual command
                                     086A  1366 	;	doesn't start until the 4th byte this results in an offset
                                     086A  1367 	;	of 8 for this move byte instruction.
                         20 A3   90  086A  1368 	MOVB	MPA_ARGS$L_SELECT_BUFF_SIZE(R3),- ; Load byte count
                         08 A1       086D  1369 		8(R1)				; 
                                     086F  1370 
                                     086F  1371 30$:	;NOTE:	The PF bit is bit 4 (mask of 10hex) of byte 1 in both the
                                     086F  1372 	;	6 byte and 10 byte mode select commands. Because the actual
                                     086F  1373 	;	command doesn't start until the 4th byte this results in a byte
                                     086F  1374 	;	offset of 5 for the following BISB instructions.
                         3C A3   95  086F  1375 	TSTB	MPA_ARGS$B_PAGE_CODE(R3)	; Test for page code 0
                            07   12  0872  1376 	BNEQ	40$				; Branch if not 0
                    05 A1   10   8A  0874  1377 	BICB2	#^X10,5(R1)			; Clear PF bit for page code 0
                          0004   31  0878  1378 	BRW	50$				; Continue
                    05 A1   10   88  087B  1379 40$:	BISB2	#^X10,5(R1)			; Set PF bit for non-zero page 
                                     087F  1380 						; code
                    53   1C A5   D0  087F  1381 50$:	MOVL	SCDRP$L_UCB(R5),R3		; Get UCB address
                          F77A'  30  0883  1382 	BSBW	SEND_COMMAND			; Send mode select command
                            00   91  0886  1383 	CMPB	#SCSI$C_GOOD,-			; Test for good status
                         60 B5       0888  1384 		@SCDRP$L_STS_PTR(R5)		;
                            07   13  088A  1385 	BEQL	60$				; Branch if status good
              50   000001AC 8F   D0  088C  1386 	MOVL	#SS$_NODATA,R0			; Load error return status
                                     0893  1387 60$:
                            02   91  0893  1388 	CMPB	#SCSI$C_CHECK_CONDITION,-	; Test SCSI return status
                         60 B5       0895  1389 		@SCDRP$L_STS_PTR(R5)		;
                            14   12  0897  1390 	BNEQ	62$				; Branch if status not check
                                     0899  1391 						; condition
                            01   91  0899  1392 	CMPB	#SCSI$C_RECOVERED_ERROR,-	; Test SCSI sense key
                       0304 C5       089B  1393 		SCDRP$B_SENSE_KEY(R5)		; 
                            0D   12  089E  1394 	BNEQ	62$				; Branch if sense key is not
                                     08A0  1395 						; recovered error
                    52   1C A5   D0  08A0  1396 	MOVL	SCDRP$L_UCB(R5),R2		; Get UCB base address
                            20   D3  08A4  1397 	BITL	#DEV$M_SQD,-			; If this is a sequential
                         3C A2       08A6  1398 		UCB$L_DEVCHAR(R2)		; device, return success
                            03   12  08A8  1399 	BNEQ	62$				; Branch if not sequential
                       50   01   D0  08AA  1400 	MOVL	#SS$_NORMAL,R0			; Load success status
                                     08AD  1401 62$:
                          F750'  30  08AD  1402 	BSBW	CLEANUP_CMD			; Cleanup command before exiting
                         12 50   E9  08B0  1403 	BLBC	R0,95$				; If status is not success,
                                     08B3  1404 						; then return
                  53   00EC C5   D0  08B3  1405 	MOVL	SCDRP$L_MODE_ARGS(R5),R3	; Load mpa args ptr
                            01   D0  08B8  1406 	MOVL	#TRUE,-				; Mark as a verify pass
                         3D A3       08BA  1407 		MPA_ARGS$B_VERIFY_IN_PROGRESS(R3) ;
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  30
X-1                             DO_MODE_SELECT                           12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1           (9)

                          F89F   30  08BC  1408 	BSBW	DO_A_PAGE			; Execute verify pass
                         03 50   E8  08BF  1409 	BLBS	R0,95$				; Exit if successful
                          F899   30  08C2  1410 	BSBW	DO_A_PAGE			; Execute verify pass
                                     08C5  1411 95$:	SUBPOP	R4				; Restore register
                                     08CF  1412 	SUBPOP	R3				; Restore register
                                     08D9  1413 	SUBPOP	R2				; Restore register
                                     08E3  1414 	SUBPOP	R1				; Restore register
                                     08ED  1415 	SUBRETURN				; Restore address and return
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  31
X-1                             EXTRACT_FIELD                            12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1          (10)

                                     08F8  1417 	.SBTTL		EXTRACT_FIELD
                                     08F8  1418 ;
                                     08F8  1419 ;---------------------------------------------------------------------------
                                     08F8  1420 ;
                                     08F8  1421 ; Routine: EXTRACT_FIELD
                                     08F8  1422 ;
                                     08F8  1423 ; Description:
                                     08F8  1424 ;
                                     08F8  1425 ;	Extracts a single field from the mode sense current buffer (or mode 
                                     08F8  1426 ;      sense changeable buffer) and stores it in one of three possible 
                                     08F8  1427 ;	destinations as requested by the caller:
                                     08F8  1428 ;
                                     08F8  1429 ;	1)  A value buffer passed to the routine by the caller
                                     08F8  1430 ;	    (typically used in mode sense changeable extractions).
                                     08F8  1431 ;	2) The mode_desc$l_actual field in the descriptor.
                                     08F8  1432 ;	3) The buffer that mode_desc$l_actual points to.
                                     08F8  1433 ; 
                                     08F8  1434 ;	In any case, the routine returns a status indicating whether
                                     08F8  1435 ;	the field is available, missing or incomplete.  For fields of size
                                     08F8  1436 ;	less than 8 bits, EXTZV is used to do the extraction;  otherwise
                                     08F8  1437 ;	the field is assumed to be a byte-aligned byte multiple, and 
                                     08F8  1438 ;	MOVC3 is used.
                                     08F8  1439 ;
                                     08F8  1440 ;
                                     08F8  1441 ; Inputs:
                                     08F8  1442 ;
                                     08F8  1443 ;	R5 = scdrp_ptr			 - Pointer to an SCDRP
                                     08F8  1444 ;
                                     08F8  1445 ;	    Fields pointed to by scdrp$ps_mode_args:
                                     08F8  1446 ; 	    mpa_args$ps_buffer_ptr	 - Pointer to top of mode sense data 
                                     08F8  1447 ;								(header)
                                     08F8  1448 ;	    mpa_args$ps_curr_desc_ptr    - Pointer to current field 
                                     08F8  1449 ;	    mpa_args$ps_page_data_ptr    - Pointer to page
                                     08F8  1450 ;	    mpa_args$l_page_size    	 - Size of page
                                     08F8  1451 ;	    mpa_args$ps_value_buffer_ptr - Optional, pointer to a buffer to 
                                     08F8  1452 ;					   receive the extracted
                                     08F8  1453 ;					   value in Case (1) above.
                                     08F8  1454 ;
                                     08F8  1455 ; Outputs:
                                     08F8  1456 ;
                                     08F8  1457 ;	R0 = status =	SS$_NORMAL	  - Field extracted successfully
                                     08F8  1458 ;			SS$_OPINCOMPL	  - Field is incomplete
                                     08F8  1459 ;			SS$_NOSUCHID      - Field is missing
                                     08F8  1460 ;			SS$_BADPARAM	  - Target address is invalid
                                     08F8  1461 ;
                                     08F8  1462 ;---------------------------------------------------------------------------
                                     08F8  1463 EXTRACT_FIELD:
                            3E   BB  08F8  1464 	PUSHR	#^M<R1,R2,R3,R4,R5>		; Save registers
                       00EC C5   D0  08FA  1465 	MOVL	SCDRP$L_MODE_ARGS(R5),-		; Get pointer to mpa_args
                            54       08FE  1466 		R4				; data structure
                    53   08 A4   D0  08FF  1467 	MOVL	MPA_ARGS$L_CURR_DESC_PTR(R4),R3 ; Set pointer to address of 
                                     0903  1468 						 ; desciptor field
                         2C A4   D0  0903  1469 	MOVL	MPA_ARGS$L_VALUE_BUFFER_PTR(R4),- ; Set actual pointer
                            52       0906  1470 		R2				; to value buffer pointer
                            0C   12  0907  1471 	BNEQ	10$				; If pointer is non-zero, branch
                    52   18 A3   DE  0909  1472 	MOVAL	MODE_DESC$L_ACTUAL(R3),R2	; Set pointer to address of
                                     090D  1473 						; actual field
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  32
X-1                             EXTRACT_FIELD                            12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1          (10)

                            05   E1  090D  1474 	BBC	#MODE_DESC$V_ACTPTR,-		; Test actptr bit, branch if
                         0C A3       090F  1475 		MODE_DESC$R_FLAGS(R3),-		; clear
                            03       0911  1476 		10$				;
                       52   62   D0  0912  1477 	MOVL	(R2),R2				; Set actual ptr to address in
                                     0915  1478 						; actual field
                       51   63   D0  0915  1479 10$:	MOVL	MODE_DESC$L_BOFF(R3),R1		; Get first byte's offset
                            5A   19  0918  1480 	BLSS	20$				; Branch on negative offset
                                     091A  1481 						; (field is in hdr of blk desc)
                         3C A4   95  091A  1482 	TSTB	MPA_ARGS$B_PAGE_CODE(R4)	; Test for mode page = 0
                            33   13  091D  1483 	BEQL	15$				; Branch on 0 mode page
                    50   04 A3   D0  091F  1484 	MOVL	MODE_DESC$L_BIT_OFFSET(R3),R0	; Load starting bit offset
                    50   08 A3   C0  0923  1485 	ADDL	MODE_DESC$L_BIT_SIZE(R3),R0	; Add bit size of field
                                     0927  1486 
                       50   07   C0  0927  1487 	ADDL	#7,R0				; Round up to the next byte
               50   50   FD 8F   78  092A  1488 	ASHL	#-3,R0,R0			; boundary
                                     092F  1489 
                       50   51   C0  092F  1490 	ADDL	R1,R0				; Add first byte's offset to
                                     0932  1491 						; get last byte offset
                                     0932  1492 
                    50   18 A4   D1  0932  1493 	CMPL	MPA_ARGS$L_PAGE_SIZE(R4),R0	; Check that the last byte is
                                     0936  1494 						; still within the page size
                            1A   14  0936  1495 	BGTR	15$				; Branch if within page size
                    51   18 A4   D1  0938  1496 	CMPL	MPA_ARGS$L_PAGE_SIZE(R4),R1	; Check that the first byte is
                                     093C  1497 						; within the page size
                            0A   14  093C  1498 	BGTR	12$				; Branch if within page size
              50   000021EC 8F   D0  093E  1499 	MOVL	#SS$_NOSUCHID,R0		; Set return status to NOSUCHID
                          00BB   31  0945  1500 	BRW	95$				; Exit
              50   000002D4 8F   D0  0948  1501 12$:	MOVL    #SS$_OPINCOMPL,R0		; Set return status to OPINCOMPL
                          00B1   31  094F  1502         BRW     95$				; Exit
                         14 A4   C1  0952  1503 15$:	ADDL3	MPA_ARGS$L_PAGE_DATA_PTR(R4),-	; Calculate base pointer
                       50   51       0955  1504 		R1,R0				;
                    08 A3   08   D1  0957  1505 	CMPL	#8,MODE_DESC$L_BIT_SIZE(R3)	; Check field size for less than
                            0A   15  095B  1506 	BLEQ	17$				; 1 byte, branch if larger
                         04 A3   EF  095D  1507 	EXTZV	MODE_DESC$L_BIT_OFFSET(R3),-	; Extract bit field into
                         08 A3       0960  1508 		MODE_DESC$L_BIT_SIZE(R3),-	; location pointed to by
                       62   60       0962  1509 		(R0),(R2)			; actual pointer
                          0099   31  0964  1510 	BRW	90$				; exit
                                     0967  1511 
            51   08 A3   FD 8F   78  0967  1512 17$:	ASHL	#-3,MODE_DESC$L_BIT_SIZE(R3),R1	; Translate to byte count
                  62   60   51   28  096D  1513 	MOVC3	R1,(R0),(R2)			; Move the number of bytes from
                          008C   31  0971  1514 	BRW	90$				; base pointer to actual pointer
                                     0974  1515 						; and exit
                    53   0C A4   D0  0974  1516 20$:	MOVL	MPA_ARGS$L_BUFFER_PTR(R4),R3	; Get buffer pointer
                                     0978  1517 	DISPATCH R1,TYPE=B,<-			; Dispatch according to boff
                                     0978  1518 		<MODE_DESC$C_LENGTH_BOFF,	22$>,-
                                     0978  1519 		<MODE_DESC$C_MEDTYP_BOFF,	30$>,-
                                     0978  1520 		<MODE_DESC$C_DEVPAR_BOFF,	40$>,-
                                     0978  1521 		<MODE_DESC$C_BDLEN_BOFF,	50$>,-
                                     0978  1522 		<MODE_DESC$C_DENS_BOFF,		60$>,-
                                     0978  1523 		<MODE_DESC$C_BLKLEN_BOFF,	70$>>
                       50   14   D0  0989  1524 	MOVL	#SS$_BADPARAM,R0		; Set return to bad parameter value
                          0074   31  098C  1525 	BRW	95$				; exit
                                     098F  1526 
                            0C   E1  098F  1527 22$:	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      06 64 A5       0991  1528 		SCDRP$L_SCSI_FLAGS(R5),25$	; Branch for 6 byte cmd
                            63   3C  0994  1529 	MOVZWL	SCSI$MPH10$W_DATA_LENGTH(R3),-	; Move field to location pointed
                            62       0996  1530 		(R2)				; to by actual pointer
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  33
X-1                             EXTRACT_FIELD                            12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1          (10)

                          0066   31  0997  1531 	BRW	90$				; exit
                            63   9A  099A  1532 25$:	MOVZBL	SCSI$MPH6$B_DATA_LENGTH(R3),-	; Move field to location pointed
                            62       099C  1533 		(R2)				; to by actual pointer
                          0060   31  099D  1534 	BRW	90$				; exit
                            0C   E1  09A0  1535 30$:	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      07 64 A5       09A2  1536 		SCDRP$L_SCSI_FLAGS(R5),35$	; Branch for 6 byte cmd
                         02 A3   9A  09A5  1537 	MOVZBL	SCSI$MPH10$B_MEDIUM_TYPE(R3),-	; Move field to location pointed
                            62       09A8  1538 		(R2)				; to by actual pointer
                          0054   31  09A9  1539 	BRW	90$				; exit
                         01 A3   9A  09AC  1540 35$:	MOVZBL	SCSI$MPH6$B_MEDIUM_TYPE(R3),-	; Move field to location pointed
                            62       09AF  1541 		(R2)				; to by actual pointer
                          004D   31  09B0  1542 	BRW	90$				; exit
                            0C   E1  09B3  1543 40$:	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      07 64 A5       09B5  1544 		SCDRP$L_SCSI_FLAGS(R5),45$	; Branch for 6 byte cmd
                         03 A3   9A  09B8  1545 	MOVZBL	SCSI$MPH10$B_DEVICE_PARAM(R3),-	; Move field to location pointed
                            62       09BB  1546 		(R2)				; to by actual pointer
                          0041   31  09BC  1547 	BRW	90$				; exit
                         02 A3   9A  09BF  1548 45$:	MOVZBL	SCSI$MPH6$B_DEVICE_PARAM(R3),-	; Move field to location pointed
                            62       09C2  1549 		(R2)				; to by actual pointer
                          003A   31  09C3  1550 	BRW	90$				; exit
                            0C   E1  09C6  1551 50$:	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      07 64 A5       09C8  1552 		SCDRP$L_SCSI_FLAGS(R5),55$	; Branch for 6 byte cmd
                         06 A3   3C  09CB  1553 	MOVZWL	SCSI$MPH10$W_BLOCK_LENGTH(R3),-	; Move field to location pointed
                            62       09CE  1554 		(R2)				; to by actual pointer
                          002E   31  09CF  1555 	BRW	90$				; exit
                         03 A3   9A  09D2  1556 55$:	MOVZBL	SCSI$MPH6$B_BLOCK_LENGTH(R3),-	; Move field to location pointed
                            62       09D5  1557 		(R2)				; to by actual pointer
                          0027   31  09D6  1558 	BRW	90$				; exit
                            0C   E1  09D9  1559 60$:	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      07 64 A5       09DB  1560 		SCDRP$L_SCSI_FLAGS(R5),65$	; Branch for 6 byte cmd
                         08 A3   9A  09DE  1561 	MOVZBL	SCSI$MPH10$S_MODE_PARAM_HDR_10(R3),-
                            62       09E1  1562 		(R2)				; Copy density byte to location
                                     09E2  1563 						; pointer to by actual pointer
                          001B   31  09E2  1564 	BRW	90$				; exit
                         04 A3   9A  09E5  1565 65$:	MOVZBL	SCSI$MPH6$S_MODE_PARAM_HDR_6(R3),-
                            62       09E8  1566 		(R2)				; Copy density byte to location
                                     09E9  1567 						; pointer to by actual pointer
                          0014   31  09E9  1568 	BRW	90$				; exit
                            0C   E1  09EC  1569 70$:	BBC	#SCDRP$V_TENBYTE,-		; Test for ten byte cmd
                      07 64 A5       09EE  1570 		SCDRP$L_SCSI_FLAGS(R5),75$	; Branch for 6 byte cmd
                         0D A3   DE  09F1  1571 	MOVAL	SCSI$MPH10$S_MODE_PARAM_HDR_10+5(R3),-
                            53       09F4  1572 		R3				; Calculate starting source address
                          0004   31  09F5  1573 	BRW	76$				; Continue
                         09 A3   DE  09F8  1574 75$:	MOVAL	SCSI$MPH6$S_MODE_PARAM_HDR_6+5(R3),-
                            53       09FB  1575 		R3				; Calculate starting source address
                  62   63   03   28  09FC  1576 76$:	MOVC3	#3,(R3),(R2)			; Move field to location pointed
                                     0A00  1577                                                 ; to by actual pointer
                       50   01   D0  0A00  1578 90$:	MOVL	#SS$_NORMAL,R0			; Set return to success status
                            3E   BA  0A03  1579 95$:	POPR	#^M<R1,R2,R3,R4,R5>		; Restore registers
                                 05  0A05  1580 	RSB					; Return
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  34
X-1                             COMPARE_FIELD                            12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1          (11)

                                     0A06  1582 	.SBTTL		COMPARE_FIELD
                                     0A06  1583 ;
                                     0A06  1584 ;---------------------------------------------------------------------------
                                     0A06  1585 ;
                                     0A06  1586 ; Routine: COMPARE_FIELD
                                     0A06  1587 ;
                                     0A06  1588 ; Description:
                                     0A06  1589 ;
                                     0A06  1590 ;	Compare the actual and desired values of a single field.
                                     0A06  1591 ;       Round up the size to the nearest byte multiple and do a 
                                     0A06  1592 ;       string comparison.  Trailing irrelevant bits within a byte
                                     0A06  1593 ;       must have been initialized to zero to not affect the compare.
                                     0A06  1594 ;
                                     0A06  1595 ; Inputs:
                                     0A06  1596 ;
                                     0A06  1597 ;	R5 = scdrp_ptr			= Pointer to an SCDRP
                                     0A06  1598 ;
                                     0A06  1599 ;	    Fields pointed to by scdrp$ps_mode_args:
                                     0A06  1600 ;	    mpa_args$ps_curr_desc_ptr   = Pointer to current field descriptor.
                                     0A06  1601 ;
                                     0A06  1602 ; Outputs:
                                     0A06  1603 ;
                                     0A06  1604 ;	R0 = status = DATA_MATCH - fields match
                                     0A06  1605 ;		      DATA_MISMATCH - fields do not match
                                     0A06  1606 ;
                                     0A06  1607 ;---------------------------------------------------------------------------
                                     0A06  1608 COMPARE_FIELD:
                                     0A06  1609 
                            1E   BB  0A06  1610 	PUSHR	#^M<R1,R2,R3,R4>		; Save registers
                       00EC C5   D0  0A08  1611 	MOVL	SCDRP$L_MODE_ARGS(R5),-		; Get pointer to mpa_args
                            54       0A0C  1612 		R4				; data structure
                         08 A4   D0  0A0D  1613 	MOVL	MPA_ARGS$L_CURR_DESC_PTR(R4),-	; Get pointer to current
                            53       0A10  1614 		R3				; descriptor
                    52   10 A3   DE  0A11  1615 	MOVAL	MODE_DESC$L_DESIRED(R3),R2	; Set pointer to value in
                                     0A15  1616 						; descriptor
                            04   E1  0A15  1617 	BBC	#MODE_DESC$V_DESPTR,-		; Branch if value, not pointer
                      03 0C A3       0A17  1618 		MODE_DESC$R_FLAGS(R3),10$	
                       52   62   D0  0A1A  1619 	MOVL	(R2),R2				; Redirect pointer
                                     0A1D  1620 
                    51   18 A3   DE  0A1D  1621 10$:	MOVAL	MODE_DESC$L_ACTUAL(R3),R1	; Set pointer to value in
                                     0A21  1622 						; descriptor
                            05   E1  0A21  1623 	BBC	#MODE_DESC$V_ACTPTR,-		; Branch if value, not pointer
                      03 0C A3       0A23  1624 		MODE_DESC$R_FLAGS(R3),20$
                       51   61   D0  0A26  1625 	MOVL	(R1),R1				; Redirect pointer
                                     0A29  1626 
               50   08 A3   07   C1  0A29  1627 20$:	ADDL3	#7,MODE_DESC$L_BIT_SIZE(R3),R0	; Load bit size plus byte
                                     0A2E  1628 						; alignment
               50   50   FD 8F   78  0A2E  1629 	ASHL	#-3,R0,R0			; Calculate number of bytes
                                     0A33  1630 
                       81   82   91  0A33  1631 30$:	CMPB	(R2)+,(R1)+			; Compare desired to actual
                            08   12  0A36  1632 	BNEQ	90$				; Branch on mismatch
                         F8 50   F5  0A38  1633 	SOBGTR	R0,30$				; Decrement byte count, and
                                     0A3B  1634 						; branch if not finished
                       50   01   D0  0A3B  1635 	MOVL	#DATA_MATCH,R0			; Set success status
                            03   11  0A3E  1636 	BRB	95$				; Exit
                                     0A40  1637 
                       50   00   D0  0A40  1638 90$:	MOVL	#DATA_MISMATCH,R0		; Set error status
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  35
X-1                             COMPARE_FIELD                            12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1          (11)

                            1E   BA  0A43  1639 95$:	POPR	#^M<R1,R2,R3,R4>		; Save registers
                                 05  0A45  1640 	RSB					; Return
                                     0A46  1641 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  36
X-1                             TEST_CHANGEABLE                          12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1          (12)

                                     0A46  1643 	.SBTTL		TEST_CHANGEABLE
                                     0A46  1644 ;
                                     0A46  1645 ;---------------------------------------------------------------------------
                                     0A46  1646 ;
                                     0A46  1647 ; Routine: TEST_CHANGEABLE
                                     0A46  1648 ;
                                     0A46  1649 ; Description:
                                     0A46  1650 ;
                                     0A46  1651 ;	Determines whether a single field is changeable by testing the data
                                     0A46  1652 ;	extracted from changeable Mode Sense data.
                                     0A46  1653 ;
                                     0A46  1654 ; Inputs:
                                     0A46  1655 ;
                                     0A46  1656 ;	R5 = scdrp_ptr			= Pointer to an SCDRP
                                     0A46  1657 ;
                                     0A46  1658 ;	    Fields pointed to by scdrp$ps_mode_args:
                                     0A46  1659 ;	    mpa_args$ps_curr_desc_ptr   = Pointer to current field descriptor.
                                     0A46  1660 ;	    mpa_args$ps_page_data_ptr 	= Pointer the page of changeable data
                                     0A46  1661 ;           mpa_args$l_page_size 	= Size of data in the page including
                                     0A46  1662 ;					  length
                                     0A46  1663 ;
                                     0A46  1664 ; Outputs:
                                     0A46  1665 ;
                                     0A46  1666 ;	R0 = status =	SS$_NORMAL	  - Field is changeable
                                     0A46  1667 ;			SS$_NOSUCHID 	  - Field is missing
                                     0A46  1668 ;			SS$_OPINCOMPL	  - Field is incomplete
                                     0A46  1669 ;			SS$_WRITLCK	  - Field is not changeable
                                     0A46  1670 ;
                                     0A46  1671 ;---------------------------------------------------------------------------
                                     0A46  1672 TEST_CHANGEABLE:
                                     0A46  1673 
                            1E   BB  0A46  1674 	PUSHR	#^M<R1,R2,R3,R4>		; Save registers
                       00EC C5   D0  0A48  1675 	MOVL	SCDRP$L_MODE_ARGS(R5),-		; Get pointer to mpa_args
                            54       0A4C  1676 		R4				; data structure
                         08 A4   D0  0A4D  1677 	MOVL	MPA_ARGS$L_CURR_DESC_PTR(R4),-	; Get pointer to current
                            53       0A50  1678 		R3				; descriptor
                            20   D1  0A51  1679 	CMPL	#MAX_BITS,-			; Test for large field
                         08 A3       0A53  1680 		MODE_DESC$L_BIT_SIZE(R3)
                            25   1F  0A55  1681 	BLSSU	90$				; Assume big fields are
                                     0A57  1682 						; read-only
                         38 A4   DE  0A57  1683 	MOVAL	MPA_ARGS$L_CHANGEABLE_DATA(R4),-
                         2C A4       0A5A  1684 		MPA_ARGS$L_VALUE_BUFFER_PTR(R4)	; Initialize pointer to changeable
                          FE99   30  0A5C  1685 	BSBW	EXTRACT_FIELD			; Extract change data for this
                                     0A5F  1686 						; field from the mode_sense
                                     0A5F  1687 						; changeable buffer
                         21 50   E9  0A5F  1688 	BLBC	R0,95$				; On error, exit
                    51   38 A4   D0  0A62  1689 	MOVL	MPA_ARGS$L_CHANGEABLE_DATA(R4),R1
                                     0A66  1690 						; Load changeable field data
                            52   D4  0A66  1691 	CLRL	R2				; Clear mask register
              00   FFFFFFFF 8F   F0  0A68  1692 	INSV	#-1,#0,-			; Create mask of ones equal to
                    52   08 A3       0A6F  1693 		MODE_DESC$L_BIT_SIZE(R3),R2	; field size
                       52   51   D1  0A72  1694 	CMPL	R1,R2				; Compare mask to extracted
                                     0A75  1695 						; field
                            05   12  0A75  1696 	BNEQ	90$				; Branch if not changeable
                       50   01   D0  0A77  1697 	MOVL	#SS$_NORMAL,R0			; Field is changeable
                            07   11  0A7A  1698 	BRB	95$				; Exit
                                     0A7C  1699 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  37
X-1                             TEST_CHANGEABLE                          12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1          (12)

              50   0000025C 8F   D0  0A7C  1700 90$:	MOVL	#SS$_WRITLCK,R0			; Field is not changeable
                                     0A83  1701 
                            1E   BA  0A83  1702 95$:	POPR	#^M<R1,R2,R3,R4>			; Restore registers
                                 05  0A85  1703 	RSB					; Return
                                     0A86  1704 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  38
X-1                             MAXIMIZE_ERROR                           12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1          (13)

                                     0A86  1706 	.SBTTL		MAXIMIZE_ERROR
                                     0A86  1707 ;-------------------------------------------------------------------------------
                                     0A86  1708 ;
                                     0A86  1709 ; Routine: MAXIMIZE_ERROR
                                     0A86  1710 ;
                                     0A86  1711 ; Description:
                                     0A86  1712 ;
                                     0A86  1713 ;	Called by DO_A_PAGE to determine which error to return.   There are
                                     0A86  1714 ;	3 basic levels of status: 
                                     0A86  1715 ;		- Severe (several possible status codes)
                                     0A86  1716 ;		- Special success (SS$_WASSET)
                                     0A86  1717 ;		- Success (SS$_NORMAL)
                                     0A86  1718 ;	Note that mpa_args$l_error contains the worst error that has actually
                                     0A86  1719 ;	occurred so far in the processing of all fields, and 
                                     0A86  1720 ;	mpa_args$l_field_error is the error that should be returned when this
                                     0A86  1721 ;	specific field cannot be set to the desired state.  If we have called
                                     0A86  1722 ;	this routine, it is because this specific field cannot be set to the
                                     0A86  1723 ;	desired state. We therefore wish to overwrite l_error (worst actual
                                     0A86  1724 ;	error so far in all processing) with l_field_error (error for this
                                     0A86  1725 ;	specific field) IF l_field_error is more severe than l_error.  If
                                     0A86  1726 ;	l_field_error and l_error are both  severe errors, then we will just
                                     0A86  1727 ;	keep the first-recorded one in l_error (i.e. l_field_error will not
                                     0A86  1728 ;	overwrite l_error).
                                     0A86  1729 ;
                                     0A86  1730 ; Inputs:
                                     0A86  1731 ;
                                     0A86  1732 ;	R5 = scdrp_ptr			= Pointer to an SCDRP
                                     0A86  1733 ;
                                     0A86  1734 ;	    Fields pointed to by scdrp$ps_mode_args:
                                     0A86  1735 ;	    mpa_args$l_error 	        = Most recent status returned by calls
                                     0A86  1736 ;					  out of DO_A_PAGE.
                                     0A86  1737 ;	    mpa_args$l_field_error      = Worst potential error that can be
                                     0A86  1738 ;					  returned after processing this field.
                                     0A86  1739 ; Outputs:
                                     0A86  1740 ;
                                     0A86  1741 ;	R0 = status = the most severe of the two inputs.
                                     0A86  1742 ;	All other registers preserved.
                                     0A86  1743 ;
                                     0A86  1744 ;-------------------------------------------------------------------------------
                                     0A86  1745 ;
                                     0A86  1746 ;int maximize_error (SCDRP *scdrp_ptr)
                                     0A86  1747 ;
                                     0A86  1748 ;
                                     0A86  1749 ;{ 
                                     0A86  1750 ;    SCSI_MPA *arg_ptr = scdrp_ptr->scdrp$ps_mode_args;
                                     0A86  1751 ;
                                     0A86  1752 ;    /* If a severe error has already occurred, continue to let it be the
                                     0A86  1753 ;	worst actual error so far */
                                     0A86  1754 ;    if (!($VMS_STATUS_SUCCESS(arg_ptr->mpa_args$l_error))) 		
                                     0A86  1755 ;        return (arg_ptr->mpa_args$l_error);  				
                                     0A86  1756 ;
                                     0A86  1757 ;    /* No actual severe errors yet.  If the worst possible error for this
                                     0A86  1758 ;	field is severe, return it as the worst actual error */
                                     0A86  1759 ;    else if (!($VMS_STATUS_SUCCESS(arg_ptr->mpa_args$l_field_error))) 	
                                     0A86  1760 ;        return (arg_ptr->mpa_args$l_field_error);			
                                     0A86  1761 ;
                                     0A86  1762 ;    /* Neither worst actual error so far, nor worst error for this field,
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  39
X-1                             MAXIMIZE_ERROR                           12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1          (13)

                                     0A86  1763 ;	is severe.  Check for WASSET */
                                     0A86  1764 ;    else if ((arg_ptr->mpa_args$l_error == SS$_WASSET) || 
                                     0A86  1765 ;	      (arg_ptr->mpa_args$l_field_error == SS$_WASSET))
                                     0A86  1766 ;        return(SS$_WASSET);
                                     0A86  1767 ;
                                     0A86  1768 ;    /* Both worst actual so far, and worst for this field, are SS$_NORMAL */
                                     0A86  1769 ;    else
                                     0A86  1770 ;	return(SS$_NORMAL);
                                     0A86  1771 ;}
                                     0A86  1772 MAXIMIZE_ERROR:
                                     0A86  1773 
                            54   DD  0A86  1774 	PUSHL	R4				; Save register
                       00EC C5   D0  0A88  1775 	MOVL	SCDRP$L_MODE_ARGS(R5),-		; Get pointer to mpa_args
                            54       0A8C  1776 		R4				; data structure
                      15 30 A4   E9  0A8D  1777 	BLBC	MPA_ARGS$L_ERROR(R4),80$	; If a severe error has already
                                     0A91  1778 						; occurred, continue to let it
                                     0A91  1779 						; be the worst actual error so
                                     0A91  1780 						; far
                      17 34 A4   E9  0A91  1781 	BLBC	MPA_ARGS$L_FIELD_ERROR(R4),90$	; If the worst possible error
                                     0A95  1782 						; for this field is severe,
                                     0A95  1783 						; return it as the worst actual
                                     0A95  1784 						; error
                            09   D1  0A95  1785 	CMPL	#SS$_WASSET,-			; If current status is
                         30 A4       0A97  1786 		MPA_ARGS$L_ERROR(R4)		; SS$_WASSET, return it as
                                     0A99  1787 						; maximized status
                            0B   13  0A99  1788 	BEQL	80$				; return SS$_WASSET
                            09   D1  0A9B  1789 	CMPL	#SS$_WASSET,-			; If new error status is
                         34 A4       0A9D  1790 		MPA_ARGS$L_FIELD_ERROR(R4)	; SS$_WASSET, return it as
                                     0A9F  1791 						; maximized status
                            0B   13  0A9F  1792 	BEQL	90$				; return SS$_WASSET
                       50   01   D0  0AA1  1793 	MOVL	#SS$_NORMAL,R0			; Both status fields are
                            0A   11  0AA4  1794 	BRB	95$				; SS$_NORMAL, so fall through
                                     0AA6  1795 						; and return one of them
                    50   30 A4   D0  0AA6  1796 80$:	MOVL	MPA_ARGS$L_ERROR(R4),R0		; Return current error status
                            04   11  0AAA  1797 	BRB	95$				; Branch to common exit
                    50   34 A4   D0  0AAC  1798 90$:	MOVL	MPA_ARGS$L_FIELD_ERROR(R4),R0	; Return new error status
                            54 8ED0  0AB0  1799 95$:	POPL	R4				; Restore registers
                                 05  0AB3  1800 	RSB					; Exit
                                     0AB4  1801 
                                     0AB4  1802 	.END
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  40
Symbol table                                                             12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1          (13)

$$BASE                         = FFFFFFFA                 MODE_DESC$V_ACTPTR             = 00000005                 
$$DISPL                        = 00000000                 MODE_DESC$V_DESPTR             = 00000004                 
$$GENSW                        = 00000001                 MODE_DESC$V_IFMISMATCH         = 00000003                 
$$HIGH                         = FFFFFFFF                 MODE_DESC$V_IFMISSING          = 00000002                 
$$LIMIT                        = 00000005                 MODE_DESC$V_PREFERRED          = 00000000                 
$$LOW                          = FFFFFFFA                 MODE_DESC$V_REQUIRED           = 00000001                 
$$MNSW                         = 00000001                 MODE_SELECT_DATA_SETUP           000006FC R     02        
$$MXSW                         = 00000001                 MODE_SELECT_HDR_SETUP            00000640 R     02        
ALLOC_POOL                       ********   X   02        MPA_ARGS$B_PAGE_CODE           = 0000003C                 
BITS_PER_BYTE                  = 00000008                 MPA_ARGS$B_REQ_BITS_PRESENT    = 0000003E                 
BUFFER_SIZE                    = 00000100                 MPA_ARGS$B_VERIFY_IN_PROGRESS  = 0000003D                 
CLEANUP_CMD                      ********   X   00        MPA_ARGS$L_BUFFER_PTR          = 0000000C                 
CMD_MODE_SELECT                  ********   X   00        MPA_ARGS$L_BUFFER_SIZE         = 00000010                 
CMD_MODE_SELECT_10               ********W GX   00        MPA_ARGS$L_CHANGEABLE_DATA     = 00000038                 
CMD_MODE_SENSE                   ********   X   00        MPA_ARGS$L_CURR_DESC_PTR       = 00000008                 
CMD_MODE_SENSE_10                ********W GX   00        MPA_ARGS$L_DESCRIPTOR_COUNT    = 00000004                 
COMPARE_FIELD                    00000A06 R     02        MPA_ARGS$L_ERROR               = 00000030                 
DATA_MATCH                     = 00000001                 MPA_ARGS$L_FIELD_DESC          = 00000000                 
DATA_MISMATCH                  = 00000000                 MPA_ARGS$L_FIELD_ERROR         = 00000034                 
DEALLOC_POOL                     ********   X   02        MPA_ARGS$L_PAGE_DATA_PTR       = 00000014                 
DEV$M_SQD                      = 00000020                 MPA_ARGS$L_PAGE_SIZE           = 00000018                 
DO_A_PAGE                        0000015E R     02        MPA_ARGS$L_SELECT_BUFF_PTR     = 0000001C                 
DO_MODE_PAGE                     00000000 RG    02        MPA_ARGS$L_SELECT_BUFF_SIZE    = 00000020                 
DO_MODE_SELECT                   000007D5 R     02        MPA_ARGS$L_SELECT_DATA_PTR     = 00000024                 
DO_MODE_SENSE                    00000445 R     02        MPA_ARGS$L_VALUE_BUFFER_PTR    = 0000002C                 
EXTRACT_FIELD                    000008F8 R     02        MPA_ARGS$S_SCSI_MPA            = 0000003F                 
FALSE                          = 00000000                 SCDRP$B_SENSE_KEY              = 00000304                 
MAXIMIZE_ERROR                   00000A86 R     02        SCDRP$L_BCNT                   = 0000002C                 
MAX_BITS                       = 00000020                 SCDRP$L_CLASS_STACK_PTR        = 000001A8                 
MAX_DESCRIPTORS                = 00000040                 SCDRP$L_CMD_PTR                = 0000005C                 
MODE_DESC$C_BADDSC             = 00000004                 SCDRP$L_MODE_ARGS              = 000000EC                 
MODE_DESC$C_BDLEN_BOFF         = FFFFFFFC                 SCDRP$L_SCSI_FLAGS             = 00000064                 
MODE_DESC$C_BLKLEN_BOFF        = FFFFFFFA                 SCDRP$L_STS_PTR                = 00000060                 
MODE_DESC$C_DENS_BOFF          = FFFFFFFB                 SCDRP$L_SVA_USER               = 00000050                 
MODE_DESC$C_DEVPAR_BOFF        = FFFFFFFD                 SCDRP$L_UCB                    = 0000001C                 
MODE_DESC$C_FIXED              = 00000001                 SCDRP$M_CL_PRIVATE_BUFF        = 00000800                 
MODE_DESC$C_INCOMPLETE         = 00000005                 SCDRP$M_TENBYTE                = 00001000                 
MODE_DESC$C_LENGTH_BOFF        = FFFFFFFF                 SCDRP$S_MODE_SENSE             = 00000002                 
MODE_DESC$C_MATCH              = 00000000                 SCDRP$V_MODE_SENSE             = 00000009                 
MODE_DESC$C_MEDTYP_BOFF        = FFFFFFFE                 SCDRP$V_TENBYTE                = 0000000C                 
MODE_DESC$C_MISMATCH           = 00000002                 SCSI$CMP$M_PAGE_CODE           = 0000003F                 
MODE_DESC$C_MISSING            = 00000003                 SCSI$C_ANSI_SCSI_1             = 00000001                 
MODE_DESC$L_ACTUAL             = 00000018                 SCSI$C_CHECK_CONDITION         = 00000002                 
MODE_DESC$L_BIT_OFFSET         = 00000004                 SCSI$C_GOOD                    = 00000000                 
MODE_DESC$L_BIT_SIZE           = 00000008                 SCSI$C_ILLEGAL_REQUEST         = 00000005                 
MODE_DESC$L_BOFF               = 00000000                 SCSI$C_INVALID_COMMAND_OP      = 00000020                 
MODE_DESC$L_DESIRED            = 00000010                 SCSI$C_INVALID_FIELD_IN_CDB    = 00000024                 
MODE_DESC$L_REASON             = 00000020                 SCSI$C_RECOVERED_ERROR         = 00000001                 
MODE_DESC$M_CHANGE_PHASE       = 00000002                 SCSI$MPBD$B_BLOCK              = 00000001                 
MODE_DESC$M_CURRENT_PHASE      = 00000001                 SCSI$MPBD$S_MODE_PARAMETER     = 00000008                 
MODE_DESC$M_LAST               = 00000040                 SCSI$MPH10$B_DEVICE_PARAM      = 00000003                 
MODE_DESC$M_REQUIRED           = 00000002                 SCSI$MPH10$B_MEDIUM_TYPE       = 00000002                 
MODE_DESC$M_SELECT_PHASE       = 00000004                 SCSI$MPH10$B_RESERVED1         = 00000004                 
MODE_DESC$M_VERIFY_PHASE       = 00000008                 SCSI$MPH10$B_RESERVED2         = 00000005                 
MODE_DESC$R_FLAGS              = 0000000C                 SCSI$MPH10$S_MODE_PARAM_HDR_10 = 00000008                 
MODE_DESC$R_RESERVED           = 00000024                 SCSI$MPH10$W_BLOCK_LENGTH      = 00000006                 
MODE_DESC$S_FIELD_DESCRIPTOR   = 00000028                 SCSI$MPH10$W_DATA_LENGTH       = 00000000                 
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  41
Symbol table                                                             12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1          (13)

SCSI$MPH6$B_BLOCK_LENGTH       = 00000003                 
SCSI$MPH6$B_DATA_LENGTH        = 00000000                 
SCSI$MPH6$B_DEVICE_PARAM       = 00000002                 
SCSI$MPH6$B_MEDIUM_TYPE        = 00000001                 
SCSI$MPH6$S_MODE_PARAM_HDR_6   = 00000004                 
SCSI$PGCD$M_CHANGEABLE         = 00000040                 
SCSI$SNS$B_ADD_SENSE_CODE      = 0000000C                 
SCSI$SNS$B_ADD_SENSE_QUAL      = 0000000D                 
SCSI$SNS$R_SENSE_KEY_SPECIFIC  = 0000000F                 
SCSI$SNS$V_SKSV                = 00000007                 
SCSI$SNS$W_FIELD_POINTER       = 00000010                 
SEND_COMMAND                     ********   X   00        
SETUP_CMD                        ********   X   00        
SS$_BADATTRIB                  = 00000034                 
SS$_BADPARAM                   = 00000014                 
SS$_BUFFEROVF                  = 00000601                 
SS$_DRVERR                     = 0000008C                 
SS$_NODATA                     = 000001AC                 
SS$_NORMAL                     = 00000001                 
SS$_NOSUCHID                   = 000021EC                 
SS$_NOSUCHSEC                  = 00000978                 
SS$_OPINCOMPL                  = 000002D4                 
SS$_PROTOCOL                   = 00002074                 
SS$_TOOMUCHDATA                = 0000029C                 
SS$_WASSET                     = 00000009                 
SS$_WRITLCK                    = 0000025C                 
TEST_CHANGEABLE                  00000A46 R     02        
TRUE                           = 00000001                 
UCB$B_ADDL_SENSE_INFO            ********   X   02        
UCB$L_DEVCHAR                  = 0000003C                 
UCB$L_PDT                      = 00000098                 

                                                +----------------+
                                                ! Psect synopsis !
                                                +----------------+

PSECT name                      Allocation          PSECT No.  Attributes     
----------                      ----------          ---------  ----------     
.  ABS  .                       00000000  (    0.)  00 (  0.)  NOPIC   USR   CON   ABS   LCL NOSHR NOEXE NORD  NOWRT NOVEC BYTE  
$ABS$                           00000000  (    0.)  01 (  1.)  NOPIC   USR   CON   ABS   LCL NOSHR   EXE   RD    WRT NOVEC BYTE  
$$$112_COMMON_CODE              00000AB4  ( 2740.)  02 (  2.)  NOPIC   USR   CON   REL   LCL NOSHR   EXE   RD    WRT NOVEC BYTE  

                                             +------------------------+
                                             ! Performance indicators !
                                             +------------------------+

Phase                    Page faults    CPU Time       Elapsed Time   
-----                    -----------    --------       ------------   
Initialization                   31     00:00:00.00    00:00:00.01
Command processing              897     00:00:00.17    00:00:04.19
Pass 1                          777     00:00:01.17    00:00:09.38
Symbol table sort                 0     00:00:00.13    00:00:00.16
Pass 2                            0     00:00:00.33    00:00:04.01
Symbol table output               0     00:00:00.00    00:00:00.01
Psect synopsis output             0     00:00:00.00    00:00:00.00
Cross-reference output            0     00:00:00.00    00:00:00.00
Assembler run totals           1706     00:00:01.80    00:00:17.76
MODE_SENSE_COMMON               - Class driver common routines            1-FEB-1997 00:26:16  VAX MACRO V5.4-3            Page  42
VAX-11 Macro Run Statistics                                              12-MAR-1996 11:21:06  MODE_SENSE_COMMON.MAR;1          (13)


The working set limit was 4096 pages.
168740 bytes (330 pages) of virtual memory were used to buffer the intermediate code.
There were 180 pages of symbol table space allocated to hold 2756 non-local and 138 local symbols.
1802 source lines were read in Pass 1, producing 19 object records in Pass 2.
26 pages of virtual memory were used to define 24 macros.

                                            +--------------------------+
                                            ! Macro library statistics !
                                            +--------------------------+

Macro library name                           Macros defined      
------------------                           --------------      
_$22$DIA3000:[DRIVER.OBJ]SCSILIB.MLB;1                  2        
_$22$DIA3000:[SYS.OBJ]LIB.MLB;1                         5        
_$22$DIA3000:[SYSLIB]STARLET.MLB;2                      7        
TOTALS (all libraries)                                 14        

2863 GETS were required to define 14 macros.

There were no errors, warnings or information messages.

MACRO/LIS=LIS$:MODE_SENSE_COMMON/OBJ=OBJ$:MODE_SENSE_COMMON TMP$:MODE_SENSE_COMMON.MAR+EXECML$/LIB+LIB$:SCSILIB.MLB/LIB
