"dev/usb/git@gitlab.riscosopen.org:cgranville/USBDriver.git" did not exist on "68f485b5e6d3a0427f5e6025b9843a057430cfed"
Source
...
Target
Commits (3)
  • Robert Sprowson's avatar
    Clear out a few unused defines · 0ca30d30
    Robert Sprowson authored
    Not tagged.
    0ca30d30
  • Robert Sprowson's avatar
    Go straight to READ(12) rather than using READ CD emulation on new ATAPI drives · c5fb0382
    Robert Sprowson authored
    In the central data transfer step (DriverCode.s around line 450) there are up to 3 goes at doing the transfer, attempting to work around some problems in <unspecified model> Sony drive and Panasonic CD-571B. Others may be affected similarly.
    However, the very latest combined DVD/CD reader, eg. SATA attached SH-224DB/BEBE, have given up entirely with READ CD. In particular, they do not error it, nor are any bytes transferred to the buffer. This falls foul of CDFSSoftATAPI's 3 step approach, because the absence of an error is taken as success and the (junk RMA) block passed up to CDFS.
    Unfortunately because the model of Sony reader is not mentioned in the sources nor CVS history we can't do a string match on the model name.
    Instead, we now look at the reply to IDENTIFY and look for any declaring ATAPI-5 or later. ATAPI-5 was released in 2000, which definitely post dates the workaround by 4 or 5 years.
    hdr/IDEdefs: declare offset for IDENTIFY to the version fields.
    Module.s: hook out the version (being careful that pre ATAPI-4 don't have this field). Make a note in the DriveFlag if READ(12) is suspect vintage.
    Variables.s: reintroduce the DriveFlag in the HAL case
    DriverCode.s: free up a register to load DriveFlag into, look at the DriveFlag, skip straight to READ(12) on ATAPI-5 or later.
    
    Tested on Titanium.
    Fixes bogus "CDFS does not support that type of disc" with a simple ISO9660 formatted DVD, due to an untouched RMA block being parsed by CDFS.
    
    Version 1.43. Tagged as 'ATAPI-1_43'
    c5fb0382
  • Jeffrey Lee's avatar
    Fix drive lock status reporting for empty drives · efd12171
    Jeffrey Lee authored
    Detail:
      s/DriverCode - Change IsDrawerLocked handler to read the lock status from the drive via mode page &2A, rather than doing a completely unrelated TEST UNIT READY command. On the offchance that &2A isn't implemented, just fall back on our softcopy of the lock state, which is effectively what TEST UNIT READY was doing in the first place.
    Admin:
      Tested on Iyonix
      CD_IsDrawerLocked now returns a sensible value for empty drives, instead of a drive empty error
      Fixes issue reported on forums where CDFS iconbar menu doesn't allow empty drives to be ejected (for ATAPI, at least):
      https://www.riscosopen.org/forum/forums/4/topics/3652
    
    
    Version 1.44. Tagged as 'ATAPI-1_44'
    efd12171
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.42"
Module_Version SETA 142
Module_MajorVersion SETS "1.44"
Module_Version SETA 144
Module_MinorVersion SETS ""
Module_Date SETS "22 May 2016"
Module_ApplicationDate SETS "22-May-16"
Module_Date SETS "10 Feb 2018"
Module_ApplicationDate SETS "10-Feb-18"
Module_ComponentName SETS "ATAPI"
Module_ComponentPath SETS "castle/RiscOS/Sources/HWSupport/CD/ATAPI"
Module_FullVersion SETS "1.42"
Module_HelpVersion SETS "1.42 (22 May 2016)"
Module_FullVersion SETS "1.44"
Module_HelpVersion SETS "1.44 (10 Feb 2018)"
END
/* (1.42)
/* (1.44)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.42
#define Module_MajorVersion_CMHG 1.44
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 22 May 2016
#define Module_Date_CMHG 10 Feb 2018
#define Module_MajorVersion "1.42"
#define Module_Version 142
#define Module_MajorVersion "1.44"
#define Module_Version 144
#define Module_MinorVersion ""
#define Module_Date "22 May 2016"
#define Module_Date "10 Feb 2018"
#define Module_ApplicationDate "22-May-16"
#define Module_ApplicationDate "10-Feb-18"
#define Module_ComponentName "ATAPI"
#define Module_ComponentPath "castle/RiscOS/Sources/HWSupport/CD/ATAPI"
#define Module_FullVersion "1.42"
#define Module_HelpVersion "1.42 (22 May 2016)"
#define Module_LibraryVersionInfo "1:42"
#define Module_FullVersion "1.44"
#define Module_HelpVersion "1.44 (10 Feb 2018)"
#define Module_LibraryVersionInfo "1:44"
......@@ -159,7 +159,7 @@ ATAPI__PAUSE_RESUME * &4B
ATAPI__MODE_SELECT * &55
ATAPI__MODE_SENSE * &5A
ATAPI__PLAY_AUDIO_12 * &A5
ATAPI__READ_DATA * &A8
ATAPI__READ_DATA_12 * &A8
ATAPI__PLAY_TRACK_RELATIVE_12 * &A9
ATAPI__READ_CD_MSF * &B9
ATAPI__SET_CDROM_SPEED * &BB
......@@ -282,6 +282,8 @@ ATAPIOP__DONT_RETRY * 1:SHL:28
ATAPIID__GENERAL_CONFIGURATION * (2* 0)
ATAPIID__MODEL_NUMBER * (2* 27)
ATAPIID__MAJOR_VERSION * (2* 80)
ATAPIID__MINOR_VERSION * (2* 81)
ATAPIID__STRUCTURE_SIZE * (2*256)
......
......@@ -405,30 +405,6 @@ XCD_SCSIUserOp # 1 ; 43
;***************************************************************************
; Define registers for RCM's block copy routine
;***************************************************************************
mbsrc1 RN 0
mbsrcptr RN 1
mbdstptr RN 2
mbcnt RN 3
mbsrc2 RN 14
mbsrc3 RN 4
mbsrc4 RN 5
mbsrc5 RN 6
mbsrc6 RN 7
mbsrc7 RN 8
mbsrc8 RN 9
mbsrc9 RN 10
mbshftL RN 11
mbshftR RN 12
lr RN 14
pc RN 15
;***************************************************************************
OAK * 1
ACORN * 0
ON * 1
OFF * 0
......@@ -461,8 +437,6 @@ PBFormat * 2
mode1datasize * 2048
;mode2datasize * 2336
mode2datasize * 2340
mode1datasizeHBLB * &00080000 ; high/byte low/byte of above
mode2datasizeHBLB * &24090000 ;
SYNC_SIZE * 12
......@@ -584,10 +558,6 @@ DefaultInternalRetryCount * 1600
;***************************** Values for SCSI_Op ************************
Overflow_Flag * 1:ROL:28
Carry_Flag * 1:ROL:29
Zero_Flag * 1:ROL:30
OK * 1
BUSY * 2
NOTREADY * 4
......
......@@ -335,15 +335,21 @@ ReadData ROUT
RD_MultiSessionSorted
MOV r8, r2
; Find out what the current drive mode is
BL Extras_ConvertControlBlockToDrive
BVS error_handler
ADR r14, DriveFlags
LDRB r2, [ r0, r14 ]
ADR r14, DriveMode
LDRB r0, [ r0, r14 ]
; r0 = disc mode (1, 2 or 3)
; r0 = drive mode (1, 2 or 3)
; r2 = drive flags
; r8 = number of blocks
[ cdebug2
CDebug_StrReg8 ", mode ",r0
......@@ -351,14 +357,13 @@ RD_MultiSessionSorted
; If only want one block, then load it into my buffer and copy it out later
MOV r8, r2
TEQ r2, # 1
TEQ r8, # 1
BNE RD_HowManyBlocks
TEQ r0, # 1
TEQNE r0, # 3
MOVEQ r4, # 2048
ASSERT mode1datasize = USERDATA__MODE2FORM1
LDREQ r4, = mode1datasize
LDRNE r4, = mode2datasize
ADR r3, buffer + 16
......@@ -377,21 +382,23 @@ RD_HowManyBlocks
ORR r6, r6, r14, ROR #24
; Only 3 bytes available for transfer length
MOV r2, r2, LSL # 8
AND r1, r5, r2, ROR #8
AND r14, r5, r2
MOV r14, r8, LSL # 8
AND r1, r5, r14, ROR #8
AND r14, r5, r14
ORR r5, r1, r14, ROR #24
|
MOV r2, r2, LSL #8
MOV r14, r8, LSL #8
REV r6, r1
REV r5, r2
REV r5, r14
]
; r0 = mode we think this is
; r2 = drive flags
; r3 -> data buffer
; r4 = byte count
; r5 = reversed transfer length
; r6 = reversed LBA
; r8 = transfer length
;
; mode 1, 3 (mode 2 form 1) => user data only
; mode 2 => all headers + user data, + EDC & ECC
......@@ -410,10 +417,16 @@ RD_HowManyBlocks
; internal mode 3 anyway.
; However, other drives are very literal about READ CD and can only read
; data from CDs and not DVDs with this command, so having worked round the
; above problem with Panasonic drives we may end up rejecting perfectly good
; DVDs instead, as a last attempt use READ(12) to read the data. Note that
; READ(10) only has a 2 byte block count, which would be retrograde having
; allowed 3 byte block counts for READ CD.
; above problem with Panasonic/Sony drives we may end up rejecting perfectly
; good DVDs instead, as a last attempt use READ(12) to read the data. Note
; that READ(10) only has a 2 byte block count, which would be retrograde
; having allowed 3 byte block counts for READ CD.
;
; Could match on model string "Matsushita CD-ROM CR-571B", but not sure
; what the Sony model numbers were?
; Look at the IDENTIFY PACKET DEVICE response and only apply the above
; emulation logic for pre ATAPI-5 drives, since ATAPI-5 came out in 2000
; that covers all the affected models.
; First: trap access to mode 0 discs and treat them as 1/3 i.e. the same as
; READ(10) would do. If the disc is not mode 0, the read will succeed.
......@@ -428,7 +441,8 @@ RD_HowManyBlocks
; retry 1: READ CD mode 2 form 1, else
; retry 0: READ(12), else error
ORR r0,r0,#1<<31
TST r2,#DriveFlag_Read12Unreliable ; skip straight to READ(12) if possible
ORRNE r0,r0,#1<<31 ; retries 2/1/0 to be attempted
Push "r0,r8"
10
; r0 = expected mode 1,2,3
......@@ -447,10 +461,10 @@ RD_HowManyBlocks
ORREQ r14,r5,#2_01111000 << 24 ; flags = all headers/user/EDC/ECC
MOVEQ r2,#2_000 << (24 + 2) ; any type of sector
MOV r1,r0,LSR #30 ; retry
MOV r1,r0,LSR #30 ; look which retry this is
CMP r1,#1
ORRCS r2,r2,#ATAPI__READ_CD << 16 ; opcode
ORRCC r2,r2,#ATAPI__READ_DATA << 16
ORRCC r2,r2,#ATAPI__READ_DATA_12 << 16
BICCC r2,r2,#2_1111 << (24 + 1) ; DPO=0 FUA=0
MOVCC r14,r14,LSL #8 ; knock out flags, make transfer length MSB=0
......@@ -2633,23 +2647,40 @@ IsDrawerLocked ROUT
;
;-----------------------------------------------------------------------------------------------
;-----------------------------
; Test Unit Ready Command
;-----------------------------
MOV r0, # nodata + ATAPIOP__COMMAND_PACKET
;----------------------------------
; Get all of the Mode pages
;----------------------------------
MOV r0, # readdata + ATAPIOP__COMMAND_PACKET
MOV r1, # 12
ADR r2, DS_CDBTestUnitReady
MOV r3, # 0
MOV r4, # 0
ADRL r2, GP_CurrentModeSense
ADR r3, buffer
LDR r4, = BUFFER_SIZE
MOV r8, # ATAPICONTROL__SEND_COMMAND
BL ATAPI_Control
BLVC Extras_ConvertControlBlockToDrive
BVS error_handler
;-----------------------------------------------------
; Find page &2a containing lock status
;-----------------------------------------------------
MOV r1, # &2a
ADR r2, buffer
BL GP_FindModePage
TEQ r2, # 0
BEQ %FT90
; Check lock status
LDRB r1, [ r2, # 1 ]
CMP r1, #28
BLO %FT90
LDRB r1, [ r2, # 6 ]
MOV r1, r1, LSR #1
AND r1, r1, #1
BL Extras_SetDrawerStatus
90
; Fall back to the cached status if we couldn't get real value from drive
BL Extras_GetDrawerStatus
;-----------------------------
......@@ -2657,11 +2688,6 @@ IsDrawerLocked ROUT
CLRV
MACRO__EXIT_DRIVER_WITH_R0
DS_CDBTestUnitReady
DCD 0
DCD 0
DCD 0
;-----------------------------------------------------------------------------------------------
;AudioControl ROUT
;
......
......@@ -333,6 +333,22 @@ MIC_IDEDevInfo
; be achieved by the CD_SCSIUserOp caller specifying larger size
STRB r6, [r5, r4] ; flag this drive is present
; check it supports any recent ATAPI standard, emulate READ(12) otherwise
LDRB r9, [r3, #ATAPIID__MAJOR_VERSION + 1]
LDRB r14,[r3, #ATAPIID__MAJOR_VERSION]
ORR r9,r14,r9,LSL # 8
ADD r14, r9, #1
TEQ r14, #&10000 ; r9 == &FFFF, doesn't report version
MOVEQ r9, #2_10000 ; treat as ATAPI-4
TST r9, #2_1111:SHL:5 ; any of ATAPI-5 to ATAPI-8
ADR r6, DriveFlags ; r6 -> drive flags
MOV r14, #0
ORREQ r14, r14, #DriveFlag_Read12Unreliable
STRB r14, [r6, r4]
; remember that I found one
ORR r8,r8,#1:SHL:16 ; doesn't affect bottom byte
......@@ -431,6 +447,16 @@ MIC_IdentifyLoop
TEQ r5,#5
BNE MIC_DoneCheckForATAPI
; check it supports any recent ATAPI standard, emulate READ(12) otherwise
LDRB r14,buffer + ATAPIID__MAJOR_VERSION
LDRB r8,buffer + ATAPIID__MAJOR_VERSION + 1
ORR r8,r14,r8,LSL # 8
ADD r14,r8,#1
TEQ r14,#&FFFF+1
MOVEQ r8,#0 ; equate &FFFF and &0000 as not reporting version
; check the CMD DRQ type and save a flag to indicate which it is
; note: this assumes that a "microprocessor DRQ" drive can be treated like
; an "accelerated DRQ" - I've not seen one
......@@ -440,16 +466,11 @@ MIC_IdentifyLoop
TEQS r6,#2_00100000 ; interrupt DRQ
MOVEQ r6,#DriveFlag_InterruptDRQ
MOVNE r6,#0 ; treat others as accelerated DRQ
TST r8, #2_1111:SHL:5 ; any of ATAPI-5 to ATAPI-8
ORREQ r6,r6,#DriveFlag_Read12Unreliable
ADR r5,DriveFlags ; r5 -> drive flags
STRB r6,[r5,r0]
[ cdebug
BNE %F01
CDebug_WriteS "This is an interrupt DRQ drive"
B %F02
01
CDebug_WriteS "This is an accelerated DRQ drive"
02
]
STRB r2,[ r1, r0 ] ; flag this drive is present
; remember that I found one
......@@ -646,7 +667,7 @@ SWI__ATAPI_GetDrives
MACRO__EXIT_DRIVER_WITH_R0 , noexit
CMP pc, pc
MOVEQ pc, r14
BICS pc, r14, # Overflow_Flag
BICS pc, r14, # V_bit
swi_error_lookup ; based on error_handler_lookup, but has to be different because of the
......@@ -683,7 +704,7 @@ swi_error_lookup ; based on error_handler_lookup, but has to be different becaus
TEQ pc, pc
MSREQ CPSR_f, #Z_bit :OR: V_bit
MOVEQ pc, r14
ORRS pc, r14, #Overflow_Flag
ORRS pc, r14, #V_bit
;******************************************************************************
;
......
......@@ -65,11 +65,9 @@ DriveRecognisedStatus # MAX_NUMBER_OF_ATAPI_DRIVES ; ATAPI drive co
; ]
DriveMode # MAX_NUMBER_OF_ATAPI_DRIVES ; For SetParameters (1, 2 or 3)
DriveCtlPrtDev # 4*MAX_NUMBER_OF_ATAPI_DRIVES ; For ADFS_ATAPIOp bits 12-23
[ :LNOT: HAL
DriveFlags # MAX_NUMBER_OF_ATAPI_DRIVES ; bits defined below
DriveFlag_InterruptDRQ * 1 << 0 ; CMD DRQ mode
]
DriveFlag_Read12Unreliable * 1 << 1 ; Try READ CD first, then READ 12
; These need to be word aligned - MEW
AlignSpace 4,0
......