Commit 4ed2ff17 authored by Jeffrey Lee's avatar Jeffrey Lee Committed by ROOL
Browse files

Fix USE_SCSI_OP version of CD_SCSIUserOp

A fix from André Timmermans:

-------------
CD_SCSIUserOp is not working because of a bug in the SWI dispatch code.

In this code R11 is converted from a SWI offset nr into a softloadable
driver opcode but when later the code checks if the driver implements
the opcode or if it must call a local default implementation it compares
R11 against SWI offset numbers (minus 1) instead of the driver opcodes.
Per chance the number matches for the other opcodes but not for
SCSIUserOp and so the softloadable driver is always called in this case
even when there is no implementation for the opcode (like in
CDFSSoftSCSI). Here is a patch to fix this.
-------------

Tested on BB-xM, fixes CD_SCSIUserOp not working with CDFSSoftSCSI.

Fixes https://www.riscosopen.org/tracker/tickets/491

Version 2.42. Tagged as 'CDFSDriver-2_42'
parent 82ed5a16
;
; This file is automatically maintained by srccommit, do not edit manually.
; Last processed by srccommit version: 1.1.
;
GBLS Module_MajorVersion
GBLA Module_Version
......@@ -10,14 +9,12 @@
GBLS Module_ApplicationDate
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "2.41"
Module_Version SETA 241
Module_MajorVersion SETS "2.42"
Module_Version SETA 242
Module_MinorVersion SETS ""
Module_Date SETS "24 May 2012"
Module_ApplicationDate SETS "24-May-12"
Module_Date SETS "22 Jun 2020"
Module_ApplicationDate SETS "22-Jun-20"
Module_ComponentName SETS "CDFSDriver"
Module_ComponentPath SETS "castle/RiscOS/Sources/HWSupport/CD/CDFSDriver"
Module_FullVersion SETS "2.41"
Module_HelpVersion SETS "2.41 (24 May 2012)"
Module_FullVersion SETS "2.42"
Module_HelpVersion SETS "2.42 (22 Jun 2020)"
END
/* (2.41)
/* (2.42)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.41
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 24 May 2012
#define Module_MajorVersion_CMHG 2.42
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 22 Jun 2020
#define Module_MajorVersion "2.41"
#define Module_Version 241
#define Module_MajorVersion "2.42"
#define Module_Version 242
#define Module_MinorVersion ""
#define Module_Date "24 May 2012"
#define Module_Date "22 Jun 2020"
#define Module_ApplicationDate "24-May-12"
#define Module_ApplicationDate "22-Jun-20"
#define Module_ComponentName "CDFSDriver"
#define Module_ComponentPath "castle/RiscOS/Sources/HWSupport/CD/CDFSDriver"
#define Module_FullVersion "2.41"
#define Module_HelpVersion "2.41 (24 May 2012)"
#define Module_LibraryVersionInfo "2:41"
#define Module_FullVersion "2.42"
#define Module_HelpVersion "2.42 (22 Jun 2020)"
#define Module_LibraryVersionInfo "2:42"
......@@ -58,6 +58,7 @@ DRIVER__ReadUserData # 1 ; 32
DRIVER__SeekUserData # 1 ; 33
DRIVER__GetAudioParms # 1 ; 34
DRIVER__SetAudioParms # 1 ; 35
DRIVER__SCSIUserOp # 1 ; 36
;***************************************************************************
......
......@@ -152,7 +152,7 @@ cd_identify ROUT
; Build a return address including PC flags (if in 26-bit mode)
; Actually doesn't matter if you preserve flags, since CMP will splat them all
;------------------------------------------
MOV r11, #30
MOV r11, #DRIVER__Identify
MOV r14, pc
ADD pc, r5, #4
......
......@@ -127,7 +127,7 @@ SWIentry_after_wp
Push "r0-r11, r14"
BIC r11, r11, #3:SHL:30
BIC r11, r11, #3:SHL:30 ; Mask out the retry count from change_of_disc
;---------------------------
; Turn irqs on
......@@ -163,6 +163,8 @@ SWIentry_after_wp
;----------------------------------------------------------
; CD_Register, CD_Unregister, CD_LastError or CD_ByteCopy ?
; Handle SWIs not covered by soft loadable drivers directly
; or convert r11 from SWI nr to soft loadable driver opcode
;----------------------------------------------------------
TEQ r11, #(XCD_Register - XCD_BaseNumber) - 1
BEQ cd_register
......@@ -255,55 +257,55 @@ SWIentry_after_wp
EOR r8, r8, #USE_SCSI_READ + USE_SCSI_SEEK + USE_SCSI_INQUIRY + USE_SCSI_CAPACITY + USE_SCSI_READY + USE_SCSI_STOPOPEN + USE_SCSI_CHECK + USE_SCSI_STATUS
EOR r8, r8, #USE_SCSI_CONTROL + USE_SCSI_PREFETCH + USE_SCSI_RESET + USE_PROPRIETARY_RUD + USE_PROPRIETARY_SUD + USE_SCSI_OP
TEQ r11, #(XCD_ReadData - XCD_BaseNumber) - 1
TEQ r11, #DRIVER__ReadData
TSTEQ r8, #USE_SCSI_READ
BEQ cd_readdata
TEQ r11, #(XCD_SeekTo - XCD_BaseNumber) - 1
TEQ r11, #DRIVER__SeekTo
TSTEQ r8, #USE_SCSI_SEEK
BEQ cd_seekto
TEQ r11, #(XCD_Inquiry - XCD_BaseNumber) - 1
TEQ r11, #DRIVER__Inquiry
TSTEQ r8, #USE_SCSI_INQUIRY
BEQ cd_inquiry
TEQ r11, #(XCD_DiscUsed - XCD_BaseNumber) - 1
TEQ r11, #DRIVER__DiscUsed
TSTEQ r8, #USE_SCSI_CAPACITY
BEQ cd_discused
TEQ r11, #(XCD_DriveReady - XCD_BaseNumber) - 1
TEQ r11, #DRIVER__DriveReady
TSTEQ r8, #USE_SCSI_READY
BEQ cd_driveready
TEQ r11, #(XCD_StopDisc - XCD_BaseNumber) - 1
TEQ r11, #DRIVER__StopDisc
TSTEQ r8, #USE_SCSI_STOPOPEN
BEQ cd_stopdisc
TEQ r11, #(XCD_OpenDrawer - XCD_BaseNumber) - 1
TEQ r11, #DRIVER__OpenDrawer
TSTEQ r8, #USE_SCSI_STOPOPEN
BEQ cd_opendrawer
TEQ r11, #(XCD_DriveStatus - XCD_BaseNumber) - 1
TEQ r11, #DRIVER__DriveStatus
TSTEQ r8, #USE_SCSI_STATUS
BEQ cd_drivestatus
TEQ r11, #(XCD_Control - XCD_BaseNumber) - 1
TEQ r11, #DRIVER__Control
TSTEQ r8, #USE_SCSI_CONTROL
BEQ cd_control
TEQ r11, #(XCD_Prefetch - XCD_BaseNumber) - 1
TEQ r11, #DRIVER__Prefetch
TSTEQ r8, #USE_SCSI_PREFETCH
BEQ cd_prefetch
TEQ r11, #(XCD_Reset - XCD_BaseNumber) - 1
TEQ r11, #DRIVER__Reset
TSTEQ r8, #USE_SCSI_RESET
BEQ cd_reset
TEQ r11, #(XCD_CheckDrive - XCD_BaseNumber) - 1
TEQ r11, #DRIVER__CheckDrive
TSTEQ r8, #USE_SCSI_CHECK
BEQ cd_checkdrive
TEQ r11, #(XCD_SCSIUserOp - XCD_BaseNumber) - 1
TEQ r11, #DRIVER__SCSIUserOp
TSTEQ r8, #USE_SCSI_OP
BEQ cd_scsiuserop
......
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