Commit f8d49c17 authored by Neil Turton's avatar Neil Turton
Browse files

Import from cleaned 370 CD

parent c8719624
......@@ -4,7 +4,7 @@
GBLS VString
GBLS Date
Version SETA 123
VString SETS "1.23"
Date SETS "31 Mar 1995"
Version SETA 125
VString SETS "1.25"
Date SETS "09 Aug 1995"
END
......@@ -28,6 +28,17 @@
; 12-Mar-95 11:16 cpartington (Cambridge Systems Design)
; * Added ATAPI__READ_DATA_10, used in s.DriverCode.
;
; 12-Jun-95 11:29 cpartington (Cambridge Systems Design)
; * Added TIMEOUT__COMMAND_COMPLETE and added alternative values for other
; timeouts dependent on test_long_timeouts.
;
; 16-Jun-95 15:06 cpartington (Cambridge Systems Design)
; * Added new timeout values for faster_startup.
; * Added TIMEOUT__RESET_RECOVERY.
;
; 06-Jul-95 10:57 cpartington (Cambridge Systems Design)
; * Added ATAPICONTROL_CheckForDrive, ATAPI_Signature and IDE__IDENTIFY.
;
;*end of change record*
......@@ -122,6 +133,15 @@ ZERRORFLAGS__SENSEKEY_MASK * 2_1111:SHL:ZERRORFLAGS__SENSEKEY_SHIFT
IDE__ATAPI_PACKET_COMMAND * &A0
IDE__ATAPI_IDENTIFY_DEVICE * &A1
IDE__ATAPI_SOFT_RESET * &08
[ full_drive_detection
IDE__IDENTIFY * &EC
]
[ full_drive_detection
; Signature provided in cylinder registers
ATAPI_Signature * &EB14
]
; ATAPI commands sent within the IDE packet command
......@@ -165,10 +185,25 @@ DRIVERERROR__SELECTION_TIMEOUT * (&A + DRIVERERROR__BASE):SHL:ZERRORFLAGS__SE
DRIVERERROR__OTHER_TIMEOUT * (&B + DRIVERERROR__BASE):SHL:ZERRORFLAGS__SENSEKEY_SHIFT
TIMEOUT__SELECTION_PHASE * 5*100
TIMEOUT__OTHER * 1*100
[ long_command_timeout
TIMEOUT__COMMAND_COMPLETE * 10*100
]
[ test_long_timeouts
TIMEOUT__SELECTION_PHASE * 16*100
TIMEOUT__OTHER * 16*100
|
[ faster_startup
TIMEOUT__SELECTION_PHASE * 5 ; centiseconds
TIMEOUT__OTHER * 5 ; centiseconds to wait for DRQ for CDB
|
TIMEOUT__SELECTION_PHASE * 5*100
TIMEOUT__OTHER * 1*100
]
]
[ Version >= 124
TIMEOUT__RESET_RECOVERY * 10*100 ; centiseconds
]
LARGEST_DATA_CHUNK_PLUS_ONE * 2800 ; The reason for this small size is Sony (again)
; - see ReadUserData
......@@ -178,6 +213,9 @@ LARGEST_DATA_CHUNK_PLUS_ONE * 2800 ; The reason for this small size is Son
; *********************************************************************************************
ATAPICONTROL__SEND_COMMAND * 0
ATAPICONTROL__SOFT_RESET * 1
[ full_drive_detection
ATAPICONTROL__CheckForDrive * 2
]
; *********************************************************************************************
; ** CDFS Driver errors **
......
......@@ -45,6 +45,23 @@
; * Added flags fix_cr571b10e_maybe, fix_slow_when_no_drives,
; check_mode_sense_length, extra_delay_after_irq.
;
; 31-Mar-95 12:34 cpartington (Cambridge Systems Design)
; * Added flag fix_speed_select.
;
; 12-Jun-95 11:27 cpartington (Cambridge Systems Design)
; * Added flags long_command_timeout and test_long_timeouts.
;
; 13-Jun-95 16:06 cpartington (Cambridge Systems Design)
; * Added flag bodge_sony_selection.
;
; 16-Jun-95 15:04 cpartington (Cambridge Systems Design)
; * Added flag faster_startup.
; Added CMOSDRIVEBITS.
;
; 06-Jul-95 10:55 cpartington (Cambridge Systems Design)
; * Added flags bodge_50e_sole_drive and full_drive_detection.
; Sorted out flags so values dependent on version number.
;
;*end of change record*
......@@ -52,30 +69,161 @@
; of the SONY CDU50E with incorrect IDENTIFY data and cope with it.
;
GBLL sony_50_id_bodge
sony_50_id_bodge SETL {TRUE}
[ sony_50_id_bodge
! 0,"Sony CDU50E 0.3n bodge included"
|
! 0,"Sony CDU50E 0.3n bodge NOT included"
]
; mode_select_dont_use_page_d disables the code to send page D when doing
; a mode select - SONY CDU50E 0.3n aborts this command
;
GBLL mode_select_dont_use_page_d
; mode_select_ignore_page_d_error causes any error returned from sending
; page D during MODE SELECT to be ignored.
GBLL mode_select_ignore_page_d_error
; reset_on_drive_error causes the driver to issue an ATAPI reset to a drive
; if it misbehaves. This is part of the spec but, more pragmatically, it
; cures a problem with the Panasonic CR571B where it occasionally fails to
; deassert BSY if the draw is opened during certain operations.
;
GBLL reset_on_drive_error
; fix_cr571b10e_maybe inserts extra read of alt_status register after
; reading byte count registers to try to work around Panasonic CR571B 1.0e
; cache problem.
;
GBLL fix_cr571b10e_maybe
; fix_slow_when_no_drives stops retries when no drives seem to be connected
;
GBLL fix_slow_when_no_drives
; check_mode_sense_length enables MEW's code that requires returned
; mode sense data to be a particular size.
;
GBLL check_mode_sense_length
; extra_delay_after_irq adds a delay after BSY is cleared after IRQ
;
GBLL extra_delay_after_irq
; fix_speed_select corrects the code to set drive speed
;
GBLL fix_speed_select
; long_command_timeout enables a longer timeout for command completion
;
GBLL long_command_timeout
; test_long_timeouts enables longer timeouts for drive accesses
;
GBLL test_long_timeouts
; bodge_sony_selection disables the poll for !BSY before selecting drive to
; try to cope with Sony master drive when no slave connected
;
GBLL bodge_sony_selection
; faster_startup reduces timeouts and only checks for required number of
; drives to make startup faster.
;
GBLL faster_startup
; bodge_50e_sole_drive enables code to attempt to drive the Sony CDU50E when
; it is the only drive on the bus.
;
GBLL bodge_50e_sole_drive
; full_drive_detection enables extra drive detection code to attempt to
; drive the Sony CDU50E when it is the only drive on the bus
;
GBLL full_drive_detection
[ Version = 122
sony_50_id_bodge SETL {TRUE}
mode_select_dont_use_page_d SETL {FALSE}
mode_select_ignore_page_d_error SETL {TRUE}
reset_on_drive_error SETL {TRUE}
fix_cr571b10e_maybe SETL {FALSE}
fix_slow_when_no_drives SETL {FALSE}
check_mode_sense_length SETL {TRUE}
extra_delay_after_irq SETL {FALSE}
fix_speed_select SETL {FALSE}
long_command_timeout SETL {FALSE}
test_long_timeouts SETL {FALSE}
bodge_sony_selection SETL {FALSE}
faster_startup SETL {FALSE}
bodge_50e_sole_drive SETL {FALSE}
full_drive_detection SETL {FALSE}
]
[ Version = 123
sony_50_id_bodge SETL {TRUE}
mode_select_dont_use_page_d SETL {FALSE}
mode_select_ignore_page_d_error SETL {TRUE}
reset_on_drive_error SETL {TRUE}
fix_cr571b10e_maybe SETL {TRUE}
fix_slow_when_no_drives SETL {TRUE}
check_mode_sense_length SETL {FALSE}
extra_delay_after_irq SETL {TRUE}
fix_speed_select SETL {FALSE}
long_command_timeout SETL {FALSE}
test_long_timeouts SETL {FALSE}
bodge_sony_selection SETL {FALSE}
faster_startup SETL {FALSE}
bodge_50e_sole_drive SETL {FALSE}
full_drive_detection SETL {FALSE}
]
[ Version = 124
sony_50_id_bodge SETL {TRUE}
mode_select_dont_use_page_d SETL {FALSE}
mode_select_ignore_page_d_error SETL {TRUE}
reset_on_drive_error SETL {TRUE}
fix_cr571b10e_maybe SETL {TRUE}
fix_slow_when_no_drives SETL {TRUE}
check_mode_sense_length SETL {FALSE}
extra_delay_after_irq SETL {TRUE}
fix_speed_select SETL {FALSE}
long_command_timeout SETL {TRUE}
test_long_timeouts SETL {FALSE}
bodge_sony_selection SETL {FALSE}
faster_startup SETL {FALSE}
bodge_50e_sole_drive SETL {FALSE}
full_drive_detection SETL {FALSE}
]
[ Version = 125
sony_50_id_bodge SETL {TRUE}
mode_select_dont_use_page_d SETL {FALSE}
mode_select_ignore_page_d_error SETL {TRUE}
reset_on_drive_error SETL {TRUE}
fix_cr571b10e_maybe SETL {TRUE}
fix_slow_when_no_drives SETL {TRUE}
check_mode_sense_length SETL {FALSE}
extra_delay_after_irq SETL {TRUE}
fix_speed_select SETL {FALSE}
long_command_timeout SETL {TRUE}
test_long_timeouts SETL {FALSE}
bodge_sony_selection SETL {TRUE}
faster_startup SETL {TRUE}
bodge_50e_sole_drive SETL {TRUE}
full_drive_detection SETL {TRUE}
]
[ (Version < 122) :LOR: (Version > 125)
! 1,"Assembly flags not defined for this version"
]
[ sony_50_id_bodge
! 0,"Sony CDU50E 0.3n bodge included"
|
! 0,"Sony CDU50E 0.3n bodge NOT included"
]
[ mode_select_dont_use_page_d
! 0,"MODE SELECT will NOT send page D"
|
! 0,"MODE SELECT will send page D"
]
; mode_select_ignore_page_d_error causes any error returned from sending
; page D during MODE SELECT to be ignored.
GBLL mode_select_ignore_page_d_error
mode_select_ignore_page_d_error SETL {TRUE}
[ :LNOT: mode_select_dont_use_page_d
[ mode_select_ignore_page_d_error
! 0,"Errors from MODE SELECT page D will be ignored"
......@@ -83,71 +231,66 @@ mode_select_ignore_page_d_error SETL {TRUE}
! 0,"Errors from MODE SELECT page D will NOT be ignored"
]
]
; reset_on_drive_error causes the driver to issue an ATAPI reset to a drive
; if it misbehaves. This is part of the spec but, more pragmatically, it
; cures a problem with the Panasonic CR571B where it occasionally fails to
; deassert BSY if the draw is opened during certain operations.
;
GBLL reset_on_drive_error
reset_on_drive_error SETL {TRUE}
[ reset_on_drive_error
! 0,"Drive will be reset on error"
|
! 0,"Drive will NOT be reset on error"
]
; fix_cr571b10e_maybe inserts extra read of alt_status register after
; reading byte count registers to try to work around Panasonic CR571B 1.0e
; cache problem.
; 1.22 => FALSE
;
GBLL fix_cr571b10e_maybe
fix_cr571b10e_maybe SETL {TRUE}
[ fix_cr571b10e_maybe
! 0,"Fix for CR571B 1.0e cache enabled"
|
! 0,"Fix for CR571B 1.0e cache disabled"
]
; fix_slow_when_no_drives stops retries when no drives seem to be connected
; 1.22 => FALSE
;
GBLL fix_slow_when_no_drives
fix_slow_when_no_drives SETL {TRUE}
[ fix_slow_when_no_drives
! 0,"Fix for when no drives enabled"
|
! 0,"Fix for when no drives disabled"
]
; check_mode_sense_length enables MEW's code that requires returned
; mode sense data to be a particular size.
; 1.22 => TRUE
;
GBLL check_mode_sense_length
check_mode_sense_length SETL {FALSE}
[ check_mode_sense_length
! 0,"MODE SENSE data must be specific size"
|
! 0,"MODE SENSE data can be any size"
]
; extra_delay_after_irq adds a delay after BSY is cleared after IRQ
; 1.22 => FALSE
;
GBLL extra_delay_after_irq
extra_delay_after_irq SETL {TRUE}
[ extra_delay_after_irq
! 0,"Extra delay after IRQ added"
|
! 0,"No extra delay after IRQ"
]
[ fix_speed_select
! 0,"Correct speed selection code assembled"
|
! 0,"Incorrect speed selection code assembled"
]
[ long_command_timeout
! 0,"Longer command timeout enabled"
|
! 0,"Longer command timeout disabled"
]
[ test_long_timeouts
! 0,"Longer test timeouts enabled"
|
! 0,"Normal test timeouts enabled"
]
[ bodge_sony_selection
! 0,"Sony selection bodge enabled"
|
! 0,"Sony selection bodge disabled"
]
[ faster_startup
! 0,"Faster startup enabled"
|
! 0,"Faster startup disabled"
]
[ bodge_50e_sole_drive
! 0,"Bodge for CDU50E sole drive enabled"
|
! 0,"Bodge for CDU50E sole drive disabled"
]
[ full_drive_detection
! 0,"Full drive detection code enabled"
|
! 0,"Full drive detection code disabled"
]
; CSD debug flags
......@@ -155,7 +298,7 @@ extra_delay_after_irq SETL {TRUE}
cdebug SETL {TRUE}
cdebug SETL {FALSE}
GBLL cdebug2
cdebug2 SETL cdebug :LAND: {FALSE}
cdebug2 SETL {FALSE}
GBLL cdebug_debugging_all_ops
cdebug_debugging_all_ops SETL {FALSE}
[ cdebug
......@@ -208,6 +351,9 @@ XATAPI_BaseNumber * ATAPI_BaseNumber:OR:X_bit
XATAPI_GetDrives # 1
XOS_Word * 7:OR:X_bit
[ faster_startup
XOS_Byte * 6:OR:X_bit
]
;*************** CD driver SWI numbers *******************
......@@ -610,5 +756,8 @@ SAP__VOLUME_LEVELS * 0
;----------------------------------------------------------------------------------------------
[ faster_startup
CMOSDRIVEBITS * 2_00011111
]
END
This diff is collapsed.
......@@ -69,6 +69,26 @@
; (amount of mode sense data is drive-specific) and stops Wearnes RUBY
; (CDD-120A) drive working (it returns &3C bytes).
;
; 31-Mar-95 12:03 cpartington (Cambridge Systems Design)
; * Change SetParameters to correct ordering of bytes sent to drive for
; speed selection and check expressly for double speed and send correct
; value for this speed (dependent on fix_speed_select).
;
; 06-Apr-95 17:45 cpartington (Cambridge Systems Design)
; * Added debugging code to print bytes not transferred by ReadData.
; * Added debugging code to SetParameters to issue REQUEST SENSE when
; SET CDROM SPEED fails.
;
; 12-Apr-95 10:08 cpartington (Cambridge Systems Design)
; * Added debugging routine do_request_sense with calls from SetParameters
; and ReadData.
;
; 21-Jun-95 15:21 cpartington (Cambridge Systems Design)
; * Added test code conditional on cdp_swi.
;
; 09-Aug-95 15:39 cpartington (Cambridge Systems Design)
; * Removed code conditional on cdp_swi (unused).
;
;*end of change record*
......@@ -208,7 +228,9 @@ ReadData ROUT
;-----------------------------------------------------------------------------------------------
[ cdebug
CDebug_StrReg8 "ReadBlock ",r1,cc
CDebug_StrReg8 "ReadData block ",r1,cc
CDebug_StrReg8 ", blocks ",r2,cc
CDebug_StrReg8 ", blksize ",r4
]
; Set
......@@ -240,7 +262,7 @@ ReadData ROUT
STRIM "l"
DisplayNewLine
[ cdebug
[ cdebug2
CDebug_WriteS "ReadTOC...",cc
]
......@@ -251,11 +273,23 @@ ReadData ROUT
ADR r2, RD_CDBReadTOC
ADR r3, buffer
MOV r4, # 12
[ cdebug
MOV r8,#0
STR r8,inbytes
]
MOV r8, # ATAPICONTROL__SEND_COMMAND
BL ATAPI_Control
[ cdebug
MOV r2,pc
LDR r1,inbytes
SUBS r1,r4,r1
BEQ %F00
CDebug_StrReg8 "ReadTOC=",r4,cc
CDebug_StrReg8 " not transferred=",r1
00
TEQP pc,r2
]
[ cdebug2
BVC %F01
CDebug_WriteS "FAILED"
B %F02
......@@ -301,7 +335,7 @@ RD_MultiSessionSorted
; r0 = disc mode (1, 2 or 3)
[ cdebug
[ cdebug2
CDebug_StrReg8 ", mode ",r0
]
......@@ -408,8 +442,27 @@ RD_HowManyBlocks
MOV r0,#readdata + ATAPIOP__COMMAND_PACKET
MOV r1,#12 ; r1 = CDB size
ADR r2,buffer + 2 ; r2 -> CDB
[ cdebug
MOV r8,#0
STR r8,inbytes
]
MOV r8,#ATAPICONTROL__SEND_COMMAND
BL ATAPI_Control
[ cdebug
STASH "r1-r3"
MOV r2,pc
LDR r1,inbytes
SUBS r1,r4,r1
BEQ %F00
LDR r3,buffer
CDebug_StrReg8 "Read(",r3,cc
CDebug_StrReg8 ")=",r4,cc
CDebug_StrReg8 " not transferred=",r1
00
TEQP pc,r2
GRAB "r1-r3"
BLVS do_request_sense
]
BVS %F20 ; branch if error
; sector read OK
......@@ -714,6 +767,20 @@ GetParameters ROUT
BL ATAPI_Control
BVS error_handler
[ cdebug2
STASH "r0-r2"
ADR r2,buffer
MOV r1,#64
CDebug_WriteS "mode sense data: ",cc
00
LDRB r0,[r2],#1
CDebug_StrReg2 " ",r0,cc
SUBS r1,r1,#1
BNE %B00
CDebug_NewLine
GRAB "r0-r2"
]
;-----------------------------------------------------
; Find page &0d containing inactivity time multiplier
;-----------------------------------------------------
......@@ -947,13 +1014,35 @@ SetParameters ROUT
TEQ r1, # 0
BEQ SP_DoneSpeed ; [ don't want to change ]
[ fix_speed_select
; if double speed, send &161 - the value the Panasonic CR571B and Sony
; CDU50E both return when set to double speed
; if maximum speed, send &FFFF (defined in standard)
; otherwise, send speed * 176 = KBytes/s
; *** WARNING: code below makes use of fact that speed is byte multiplied by 176
; so can't exceed 16 bits
TEQS r1,#255 ; maximum?
ORREQ r1,r1,#&FF00 ; ...send &FFFF
TEQS r1,#2 ; double speed?
MOVEQ r1,#&61 ; ...send &161
ORREQ r1,r1,#&100
MOVNE r14,#176 ; ...else speed * 176
MULNE r1,r14,r1
MOV r14,r1,LSR #8 ; sort out byte order
ORR r1,r14,r1,LSL #8
MOV r1,r1,LSL #16 ; move to high bits
ORR r1, r1, # ATAPI__SET_CDROM_SPEED ; or in opcode
|
TEQ r1, # 255 ; maximum speed
ORREQ r1, r1, # 255:SHL:8 ; r1 = &ffff
MOVNE r14, # 176
MULNE r1, r14, r1 ; r1 = r1 * 176
MOV r1, r1, LSL # 16
ORR r1, r1, # ATAPI__SET_CDROM_SPEED
]
ADR r2, buffer
MOV r3, # 0
......@@ -967,6 +1056,10 @@ SetParameters ROUT
MOV r8, # ATAPICONTROL__SEND_COMMAND
BL ATAPI_Control
[ cdebug
BLVS do_request_sense
]
BVS error_handler
SP_DoneSpeed
......@@ -1132,6 +1225,53 @@ SP_CurrentModeSense
DCB 0 ; 11 reserved
;-----------------------------------------------------------------------------------------------
[ cdebug
do_request_sense ROUT
;
; Issue request sense to the drive
; Only used for debugging
STASH "r0-r8,r14"
; error so issue REQUEST SENSE
ADRL r2,sense_buffer
MOV r1,#&03 ; opcode
MOV r3,#?sense_buffer - 12 ; allocation length
MOV r4,#0 ; reserved
STMIA r2,{r1,r3,r4} ; create CDB
MOV r0,#readdata + ATAPIOP__COMMAND_PACKET
MOV r1,#12 ; cdb size
MOV r4,r3 ; bytes to be returned
ADD r3,r2,r1 ; r3 -> where sense goes
MOV r8,#ATAPICONTROL__SEND_COMMAND
BL ATAPI_Control
BVS %F02
; got sense back
; r3 -> data
CDebug_WriteS "SENSE:",cc
LDRB r2,[r3,#7] ; get additional sense size
ADD r2,r2,#8
00
LDRB r0,[r3],#1
CDebug_StrReg2 " ",r0,cc
SUBS r2,r2,#1
BNE %B00
CDebug_NewLine
01
GRAB "r0-r8,pc",,^
;;;;;;;;;;;;;;;;;;
02
CDebug_StrReg8 "REQUEST SENSE ERROR ",r0
GRAB "r0-r8,pc",,^
]
;-----------------------------------------------------------------------------------------------
OpenDrawer ROUT
;
......@@ -1367,6 +1507,9 @@ EnquireDataMode ROUT
MOV r8, # ATAPICONTROL__SEND_COMMAND
BL ATAPI_Control
[ cdebug
BLVS do_request_sense