Commit 7bcccf3d authored by Ben Avison's avatar Ben Avison
Browse files

Various fixes to bugs both new and old.

Detail:
  * Byte sex swap fix applied to the code to set the drive speed
  * SCSI-3 spec says that ATAPI packets have to be padded with 0 bytes;
    routines changed accordingly (though this does mean we now have to do
    a tedious copy onto the stack for every operation)
  * All disc errors returned from ADFS_ATAPIOp were accidentally ignored!
  * Internal disc number wasn't being shifted left by 15 bits before being
    used to do a REQUEST SENSE command packet, resulting in it doing a
    reset of any slave devices instead of sending a PACKET command
  * TARGETERROR error numbers weren't being correctly constructed in
    ATAPI_Op (it was using the error pointer instead of the sense key)
  * Worked round another assumption of flag preservation in CD_ SWIs
  * Fixed pathname of messages file to include $
Admin:
  Tested on Tungsten.

Version 1.30. Tagged as 'ATAPI-1_30'
parent 13dfbf90
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.29"
Module_Version SETA 129
Module_MajorVersion SETS "1.30"
Module_Version SETA 130
Module_MinorVersion SETS ""
Module_Date SETS "22 Nov 2002"
Module_ApplicationDate SETS "22-Nov-02"
Module_ComponentName SETS "ATAPI"
Module_ComponentPath SETS "RiscOS/Sources/HWSupport/CD/ATAPI"
Module_FullVersion SETS "1.29"
Module_HelpVersion SETS "1.29 (22 Nov 2002)"
Module_FullVersion SETS "1.30"
Module_HelpVersion SETS "1.30 (22 Nov 2002)"
END
/* (1.29)
/* (1.30)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.68.
*
*/
#define Module_MajorVersion_CMHG 1.29
#define Module_MajorVersion_CMHG 1.30
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 22 Nov 2002
#define Module_MajorVersion "1.29"
#define Module_Version 129
#define Module_MajorVersion "1.30"
#define Module_Version 130
#define Module_MinorVersion ""
#define Module_Date "22 Nov 2002"
......@@ -18,6 +18,6 @@
#define Module_ComponentName "ATAPI"
#define Module_ComponentPath "RiscOS/Sources/HWSupport/CD/ATAPI"
#define Module_FullVersion "1.29"
#define Module_HelpVersion "1.29 (22 Nov 2002)"
#define Module_LibraryVersionInfo "1:29"
#define Module_FullVersion "1.30"
#define Module_HelpVersion "1.30 (22 Nov 2002)"
#define Module_LibraryVersionInfo "1:30"
......@@ -205,7 +205,7 @@ ATAPI_Op ROUT
CMP r14,#&40
BCS %FT10 ; not a SCSI sense error block
AND r1,r1,#3:SHL:5 ; extract EOM and ILI bits
MOV r14,r0,LSL #ZERRORFLAGS__SENSEKEY_SHIFT
MOV r14,r14,LSL #ZERRORFLAGS__SENSEKEY_SHIFT
ORR r0,r14,r1,LSR #5
TEQ r14,#TARGETERROR__UNIT_ATTENTION
......@@ -303,11 +303,23 @@ ATAPI_Reset ROUT
;------------------------------------------------------------------------------
ATAPI_RawOp ROUT
STASH "r0-r1,r14"
STASH "r0-r2,r14"
MOV r0,#0
MOV r14,#0
STASH "r0,r14"
STASH "r0,r14" ; create zeroed 16-byte block on stack
ADD r14,r2,r1
ADD r2,sp,r1
01 LDRB r0,[r14,#-1]!
STRB r0,[r2,#-1]! ; copy control block to stack
CMP r2,sp
BHI %BT01
BL Extras_ConvertControlBlockToDrive ; sets up r0
MOVVS r0,#DRIVERERROR__SELECTION_TIMEOUT ; different error required
ADDVS sp,sp,#8
ADDVS sp,sp,#16+12
GRAB "pc",VS
ADR r14,DriveRecognisedStatus
......@@ -315,16 +327,17 @@ ATAPI_RawOp ROUT
CMP r1,r14
MOVLO r1,r14 ; ensure we transfer at least that much
LDR r14,[sp]
LDR r14,[sp,#16+0]
ORR r0,r14,r0,LSL #15 ; add device/controller bits into original r0
SWI XADFS_ATAPIOp
ADD sp,sp,#16
BVS %FT90
TEQ r0,#0 ; not a disc error?
GRAB "r0-r1,pc" ; exit with V clear
GRAB "r0-r2,pc", EQ ; exit with V clear
; A disc error occurred - convert into appropriate internal error number
; or SCSI error register set
ADD sp,sp,#8
ADD sp,sp,#12
SETV
TEQ r0,#WinIDEErrCmdBusy
TEQNE r0,#WinIDEErrCmdNotRdy
......@@ -344,12 +357,15 @@ ATAPI_RawOp ROUT
TEQ r0,#WinIDEErrPacket
ADREQ r6,%FT70
BL Extras_ConvertControlBlockToDrive ; can't return error this time
MOV r0,r0,LSL #15
ORR r0,r0,#1:SHL:24 ; read operation
MOV r14,#0 ; padding bytes must be 0
MOV r5,#0
MOV r4,#8:SHL:16 ; alloc length = 8, reserved = Flag = Link = 0
MOV r3,#3:SHL:16 ; operation = REQUEST SENSE, LUN = reserved = 0
MOV r2,#0
MOV r1,#0
STASH "r1-r4" ; command block at sp+10,
STASH "r1-r5,r14" ; command block at sp+10,
; result block at sp+1
MOV r1,#12 ; actually a 6-byte comand, but padded
ADD r2,sp,#10
......@@ -403,7 +419,7 @@ ATAPI_RawOp ROUT
ADRL r14,scsi_sense_0_error
ADD r0,r14,r0,LSL #2 ; r0 -> error block, not yet looked up
40 ADD sp,sp,#16
40 ADD sp,sp,#24
SETV
GRAB "r3-r6,pc"
......@@ -442,7 +458,7 @@ ATAPI_RawOp ROUT
MOVEQ r0,#DRIVERERROR__SELECTION_TIMEOUT
; Otherwise (eg "Driver in use", "Bad address") pass error pointer back
ADD sp,sp,#4
GRAB "r1,pc"
GRAB "r1-r2,pc"
; ============= Non-HAL case ==================================================
|
......
......@@ -1029,6 +1029,8 @@ SetParameters ROUT
ORREQ r1, r1, # 255:SHL:8 ; r1 = &ffff
MOVNE r14, # 176
MULNE r1, r14, r1 ; r1 = r1 * 176
MOV r14,r1,LSR #8 ; sort out byte order
ORR r1,r14,r1,LSL #8
MOV r1, r1, LSL # 16
ORR r1, r1, # ATAPI__SET_CDROM_SPEED
]
......@@ -1405,13 +1407,15 @@ EnquireAddress ROUT
;---------------------------------------
TEQ r4, #MSFFormat
BNE %FT10
MOVEQ r0, #LBAFormat
MOV r0, #LBAFormat
SWIEQ XCD_ConvertToMSF
SWI XCD_ConvertToMSF
BVS error_handler
ADDEQ r1, r1, #2 * 256
ADD r1, r1, #2 * 256
10
;---------------------------------------
; If caller wants return in PB format
......
......@@ -38,7 +38,7 @@ message_filename
DCB "adfs::4.$.!Boot.Choices.Resources.UK.Messages",0
|
message_filename
DCB "Resources:Resources.CDFSDriver.ATAPI.Messages",0
DCB "Resources:$.Resources.CDFSDriver.ATAPI.Messages",0
]
ALIGN
......
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