Commit 8aaccfbf authored by Ben Avison's avatar Ben Avison
Browse files

Now responds to "Driver in use" errors returned from ADFS_ATAPIOp by retrying...

Now responds to "Driver in use" errors returned from ADFS_ATAPIOp by retrying up to the specified timeout (or 10 seconds for internally generated

SCSI_Ops). If the timeout is reached, the CD_SCSIUserOp entry point will
return a SCSI-compatible "ATAPI driver reservation error" error pointer;
other entry points pass "Driver in use" through unchanged.
Also added GPA generation capability, for what it's worth.

Version 1.32. Tagged as 'ATAPI-1_32'
parent 98d27f0d
| Copyright 2002 Tematic Ltd
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| See the License for the specific language governing permissions and
| limitations under the License.
Dir <Obey$Dir>
amu_machine gpa_debug THROWBACK=-throwback
......@@ -10,6 +10,7 @@ BadDisc:Compact disc is faulty
NotSupp:Drive does not support that
BadHandle:Bad handle
SCSIRE:ATAPI driver reservation error
SCSITS:Target status - Check condition
SCSITE0:Target error - No sense
SCSITE1:Target error - Recovered error
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.31"
Module_Version SETA 131
Module_MajorVersion SETS "1.32"
Module_Version SETA 132
Module_MinorVersion SETS ""
Module_Date SETS "26 Nov 2002"
Module_ApplicationDate SETS "26-Nov-02"
Module_Date SETS "17 Dec 2002"
Module_ApplicationDate SETS "17-Dec-02"
Module_ComponentName SETS "ATAPI"
Module_ComponentPath SETS "RiscOS/Sources/HWSupport/CD/ATAPI"
Module_FullVersion SETS "1.31"
Module_HelpVersion SETS "1.31 (26 Nov 2002)"
Module_FullVersion SETS "1.32"
Module_HelpVersion SETS "1.32 (17 Dec 2002)"
/* (1.31)
/* (1.32)
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.68.
#define Module_MajorVersion_CMHG 1.31
#define Module_MajorVersion_CMHG 1.32
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 26 Nov 2002
#define Module_Date_CMHG 17 Dec 2002
#define Module_MajorVersion "1.31"
#define Module_Version 131
#define Module_MajorVersion "1.32"
#define Module_Version 132
#define Module_MinorVersion ""
#define Module_Date "26 Nov 2002"
#define Module_Date "17 Dec 2002"
#define Module_ApplicationDate "26-Nov-02"
#define Module_ApplicationDate "17-Dec-02"
#define Module_ComponentName "ATAPI"
#define Module_ComponentPath "RiscOS/Sources/HWSupport/CD/ATAPI"
#define Module_FullVersion "1.31"
#define Module_HelpVersion "1.31 (26 Nov 2002)"
#define Module_LibraryVersionInfo "1:31"
#define Module_FullVersion "1.32"
#define Module_HelpVersion "1.32 (17 Dec 2002)"
#define Module_LibraryVersionInfo "1:32"
......@@ -322,16 +322,24 @@ ATAPI_RawOp ROUT
ADDVS sp,sp,#16+12
GRAB "pc",VS
STASH "r0" ; save drive number for "Driver in use" retries
SWI XOS_ReadMonotonicTime
TEQ r5,#0
ADDNE r0,r0,r5
ADDEQ r0,r0,#1000
STASH "r0" ; save timeout for "Driver in use" retries
LDR r0,[sp,#4] ; get drive number back in r0
ADR r14,DriveRecognisedStatus
LDRB r14,[r14,r0] ; get packet size for device
CMP r1,r14
MOVLO r1,r14 ; ensure we transfer at least that much
LDR r14,[sp,#16+0]
10 LDR r14,[sp,#8+16+0]
ORR r0,r14,r0,LSL #15 ; add device/controller bits into original r0
ADD sp,sp,#16
ADD sp,sp,#8+16
TEQ r0,#0 ; not a disc error?
GRAB "r0-r2,pc", EQ ; exit with V clear
......@@ -451,13 +459,32 @@ ATAPI_RawOp ROUT
; or "Target status - Check condition"
B %BT40
90 ; Error pointer returned from first SWI - is it "Bad drive"?
90 ; Error pointer returned from first SWI
; Is it "Bad drive" or "Driver in use"?
; These are selection timeouts (we need to timeout the latter)
STASH "r5"
LDR r14,[r0]
LDR r5,=ADFSBadDrive
TEQ r14,r5
; Otherwise (eg "Driver in use", "Bad address") pass error pointer back
ADD sp,sp,#4
ADD r5,r5,#ADFSDriverInUse-ADFSBadDrive
TEQ r14,r5
; For other errors (eg "Bad address") pass error pointer back
; Check whether we've waited long enough to give up on "Driver in use"
MOV r5,r0
SWI XOS_ReadMonotonicTime
LDR r14,[sp,#4+0]
CMP r14,r0
GRAB "r5", PL ; PL condition for clock arithmetic
LDRPL r0,[sp,#4]
MOV r0,r5 ; get back "Driver in use" error pointer
GRAB "r5"
ADD sp,sp,#8+16+4
GRAB "r1-r2,pc"
; ============= Non-HAL case ==================================================
......@@ -3566,7 +3566,14 @@ SCSIUserOp ROUT
CMP r0, #&1000
BCC error_handler
; Now we have an error pointer - if it's a SCSI sense error, it needs looking up in our messages file
; Now we have an error pointer
; If it's a "Driver in use" error, it needs converting to SCSI-like reservation error
LDR r14, [r0]
SUB r14, r14, #ADFSDriverInUse:AND:&FF000
CMP r14, #ADFSDriverInUse:AND:&00FF0
ADREQL r0, scsi_reservation_error
BEQ error_handler_lookup
; If it's a SCSI sense error, it needs looking up in our messages file
LDR r14, [r0]
SUB r14, r14, #SCSISenseNumber:AND:&FF000
SUB r14, r14, #SCSISenseNumber:AND:&00FF0
......@@ -67,6 +67,8 @@
DCD 0 ; start code
DCD Module_InitialisingCode - startofheader ; initialisation code
......@@ -103,6 +103,9 @@ scsi_timeout1_error DCD TimeoutSelection
scsi_timeout2_error DCD TimeoutOther
= "SCSITO", 0
scsi_reservation_error DCD ReservationError
= "SCSIRE", 0
scsi_cc_error DCD CheckCondition
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment