Commit 606d918f authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Use HAL device for PATA IDE controller, and a few minor fixes

ADFS 3 is currently both a filing system and a hardware poker, so have it own the PATA device for now as a stepping stone to a PATADriver module; export the header.
No longer call HAL entries, look for the HAL device, activate, and call that instead. At API 0.00 it just has the exact same 3 functions as the previous HAL entries only refactored to pass a device pointer in R0.

Makefile/IDEDevice.hdr/ADFS.s/Adfs00.s:
  Export, include, and reserve workspace.
Adfs12.s/IDEDetect.s:
  Refactor function calls.
Messages:
  Unrelated correction to pluralisation of 'Sectors'.
Adfs50.s:
  Hunt for the IDE controller device.
  Fix oflaofla error if run on a non HAL machine - OS_Hardware errors but the ErrXFree code label expects the error pointer in R9 not R0.

Tested in an IOMD build.

Version 3.50. Tagged as 'ADFS-3_50'
parent c57300a1
......@@ -29,6 +29,7 @@ COMPONENT = ADFS
CHEADER1 = ${COMPONENT}
HEADER1 = ${COMPONENT}
HEADER2 = ADFSErr
HEADER3 = IDEDevice
ASMCHEADER1 = ADFSErr
EXPORTS = hdr.ADFSErr ${C_EXP_HDR}.ADFSErr
......
No preview for this file type
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "3.49"
Module_Version SETA 349
Module_MajorVersion SETS "3.50"
Module_Version SETA 350
Module_MinorVersion SETS ""
Module_Date SETS "28 Oct 2015"
Module_ApplicationDate SETS "28-Oct-15"
Module_Date SETS "05 Jan 2016"
Module_ApplicationDate SETS "05-Jan-16"
Module_ComponentName SETS "ADFS"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/ADFS/ADFS"
Module_FullVersion SETS "3.49"
Module_HelpVersion SETS "3.49 (28 Oct 2015)"
Module_FullVersion SETS "3.50"
Module_HelpVersion SETS "3.50 (05 Jan 2016)"
END
/* (3.49)
/* (3.50)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 3.49
#define Module_MajorVersion_CMHG 3.50
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 28 Oct 2015
#define Module_Date_CMHG 05 Jan 2016
#define Module_MajorVersion "3.49"
#define Module_Version 349
#define Module_MajorVersion "3.50"
#define Module_Version 350
#define Module_MinorVersion ""
#define Module_Date "28 Oct 2015"
#define Module_Date "05 Jan 2016"
#define Module_ApplicationDate "28-Oct-15"
#define Module_ApplicationDate "05-Jan-16"
#define Module_ComponentName "ADFS"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/ADFS/ADFS"
#define Module_FullVersion "3.49"
#define Module_HelpVersion "3.49 (28 Oct 2015)"
#define Module_LibraryVersionInfo "3:49"
#define Module_FullVersion "3.50"
#define Module_HelpVersion "3.50 (05 Jan 2016)"
#define Module_LibraryVersionInfo "3:50"
;
; Copyright (c) 2015, RISC OS Open Ltd
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of RISC OS Open Ltd nor the names of its contributors
; may be used to endorse or promote products derived from this software
; without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
; POSSIBILITY OF SUCH DAMAGE.
;
SUBT IDE controller HAL device constants
OldOpt SETA {OPT}
OPT OptNoList+OptNoP1List
; Layout of device
^ HALDeviceSize
HALDevice_IDECableID # 4
HALDevice_IDEControllerInfo # 4
HALDevice_IDESetModes # 4
HALDevice_IDESize * :INDEX: @
OPT OldOpt
END
......@@ -62,6 +62,7 @@ StrongARM SETL {TRUE}
GET Hdr:Podule
GET Hdr:DMA
GET Hdr:DMADevice
GET Hdr:IDEDevice
GET Hdr:OSRSI6
GET VersionASM
......
......@@ -476,6 +476,7 @@ HAL_IRQStatus_routine a4 8
HAL_CounterDelay_routine a4 8
HAL_FIQEnable_routine a4 8
HAL_FIQDisableAll_routine a4 8
HAL_IDEDevice_pointer a4 4
]
ptr_ESC_Status a4 4
......
......@@ -265,12 +265,12 @@ WinInit ROUT
[ HAL
[ IDEDMA
SUB SP,SP,#4*4
MOV R2,#4*4
MOV R0,#-1
MOV R1,SP
MOV R8,#OSHW_CallHAL
MOV R9,#EntryNo_HAL_ATAControllerInfo
SWI XOS_Hardware
MOV R3,#4*4
MOV R2,SP
MOV R1,#-1
LDR R0,HAL_IDEDevice_pointer
MOV LR,PC
LDR PC,[R0,#HALDevice_IDEControllerInfo]
MOV R6,#0
CMPVC R0,#4*4
SETV LO
......@@ -280,16 +280,16 @@ WinInit ROUT
STR R6,WinIDEDMADeviceHandle
SUB SP,SP,#12*4
MOV R2,#12*4
MOV R3,#12*4
|
SUB SP,SP,#8*4
MOV R2,#8*4
MOV R3,#8*4
]
MOV R0,#0
MOV R1,SP
MOV R8,#OSHW_CallHAL
MOV R9,#EntryNo_HAL_ATAControllerInfo
SWI XOS_Hardware
MOV R2,SP
MOV R1,#0 ; bus 0
LDR R0,HAL_IDEDevice_pointer
MOV LR,PC
LDR PC,[R0,#HALDevice_IDEControllerInfo]
Pull "R2-R8,R14"
BVS %FT05
CMP R0,#8*4
......@@ -357,16 +357,16 @@ WinInit ROUT
[ TwinIDEHardware
[ IDEDMA
SUB SP,SP,#12*4
MOV R2,#12*4
MOV R3,#12*4
|
SUB SP,SP,#8*4
MOV R2,#8*4
MOV R3,#8*4
]
MOV R0,#1
MOV R1,SP
MOV R8,#OSHW_CallHAL
MOV R9,#EntryNo_HAL_ATAControllerInfo
SWI XOS_Hardware
MOV R2,SP
MOV R1,#1 ; bus 1
LDR R0,HAL_IDEDevice_pointer
MOV LR,PC
LDR PC,[R0,#HALDevice_IDEControllerInfo]
Pull "R2-R8,R14"
BVS %FT05
CMP R0,#32
......@@ -475,38 +475,8 @@ WinInit ROUT
[ HAL
TEQ R1,#Service_Serviced
BEQ %FT05
[ {FALSE} ; This code is using an obsolete version of the ATAControllerInfo call
; and its functionality has already been performed above anyway
Push "R9,R12"
SUB SP,SP,#32
MOV R0,SP
MOV R1,#32
MOV R8,#OSHW_CallHAL
MOV R9,#EntryNo_HAL_ATAControllerInfo
SWI XOS_Hardware
Pull "R2-R8,R14"
Pull "R9,R12"
BVS %FT05
STR R3,WinIDEPtr
STR R4,WinIDECtrlPtr
STRB R8,WinIDEHWDevNo
ADDR R7,WinIDEReadASector
STR R7,WinIDEReadPtr
ADDR R7,WinIDEWriteASector
STR R7,WinIDEWritePtr
MOV R14,#WinIDEHW_HAL
STRB R14,WinIDEHWType
LDRB R4,WinIDEDrives ; needed later
]
B %FT15
BNE %FT15 ; no IDE podule present
05
ADD R14,R9,#WinIDEPtr
|
LDR R14, =DefaultIDE
......
......@@ -156,41 +156,65 @@ InitEntry ROUT ; NO REENTRANCY CHECK NEEDED
MOV R9, #EntryNo_HAL_IRQEnable
SWI XOS_Hardware
BVS ErrXfree
BVS Errfree
STR R0, HAL_IRQEnable_routine+4
STR R1, HAL_IRQEnable_routine
MOV R9, #EntryNo_HAL_IRQDisable
SWI XOS_Hardware
BVS ErrXfree
BVS Errfree
STR R0, HAL_IRQDisable_routine+4
STR R1, HAL_IRQDisable_routine
MOV R9, #EntryNo_HAL_IRQStatus
SWI XOS_Hardware
BVS ErrXfree
BVS Errfree
STR R0, HAL_IRQStatus_routine+4
STR R1, HAL_IRQStatus_routine
MOV R9, #EntryNo_HAL_CounterDelay
SWI XOS_Hardware
BVS ErrXfree
BVS Errfree
STR R0, HAL_CounterDelay_routine+4
STR R1, HAL_CounterDelay_routine
[ :LNOT:FloppyPCI
MOV R9, #EntryNo_HAL_FIQDisableAll
SWI XOS_Hardware
BVS ErrXfree
BVS Errfree
STR R0, HAL_FIQDisableAll_routine+4
STR R1, HAL_FIQDisableAll_routine
MOV R9, #EntryNo_HAL_FIQEnable
SWI XOS_Hardware
BVS ErrXfree
BVS Errfree
STR R0, HAL_FIQEnable_routine+4
STR R1, HAL_FIQEnable_routine
]
; Latch onto the first IDE controller of API 0.00
LDR R0,=(HALDeviceType_ExpCtl + HALDeviceExpCtl_IDE) :OR: \
(&0000:SHL:16)
MOV R1,#0
MOV R8,#OSHW_DeviceEnumerate
SWI XOS_Hardware
BVS Errfree
CMP R1,#-1
BEQ %FT09 ; No IDE device found
STR R2,HAL_IDEDevice_pointer
MOV LR,PC
LDR PC,[R2,#HALDevice_Activate]
CMP R0,#0
BNE %FT10 ; Activated OK
09
ADR R0,ErrorBlock_BadHard
MOV R1,#0
MOV R2,#0
SWI XMessageTrans_ErrorLookup
BVS Errfree
MakeInternatErrorBlock BadHard,,"BadHard"
10
]
MOV R0,#6
......@@ -211,6 +235,7 @@ InitEntry ROUT ; NO REENTRANCY CHECK NEEDED
MOV R0,#2 ; Reason code is get IOEB/82710 state
SWI XOS_ReadSysInfo ; (R0->R0-R4)
Pull "R3,R4"
Errfree
MOVVS R9, R0 ; Save error ptr
BVS ErrXfree ; Error exit
......
......@@ -682,31 +682,31 @@ WinIDESetTimings
MOV R3, R7
BL WinIDEGetTimingForDevice
Push "R0-R3,R9"
LDRB R0, [R9,#WinIDEBusNo]
Push "R0-R3"
LDRB R1, [R9,#WinIDEBusNo]
TEQ R6, #WinIDENoDevice
MOVEQ R1, #0
ADDNE R1, SP, #5*4+0
TEQ R7, #WinIDENoDevice
MOVEQ R2, #0
ADDNE R2, SP, #5*4+8
MOV R8, #OSHW_CallHAL
MOV R9, #EntryNo_HAL_ATASetModes
ADDNE R2, SP, #4*4+0
TEQ R7, #WinIDENoDevice
MOVEQ R3, #0
ADDNE R3, SP, #4*4+8
[ Debug23
DREG R0,"Bus ",cc,Integer
DREG R1,", Block1=",cc
DREG R2,", Block2="
LDR R14,[R1,#0]
DREG R1,"Bus ",cc,Integer
DREG R2,", Block1=",cc
DREG R3,", Block2="
LDR R14,[R2,#0]
DREG R14,,cc
LDR R14,[R1,#4]
LDR R14,[R2,#4]
DREG R14," ",cc
LDR R14,[R2,#0]
LDR R14,[R3,#0]
DREG R14,", ",cc
LDR R14,[R2,#4]
LDR R14,[R3,#4]
DREG R14," "
]
SWI XOS_Hardware
Pull "R0-R3,R9"
LDR R0, HAL_IDEDevice_pointer
MOV LR, PC
LDR PC, [R0,#HALDevice_IDESetModes]
Pull "R0-R3"
MOV R3, R0
TEQ R6, #WinIDENoDevice
......@@ -747,14 +747,15 @@ WinIDESetTimings
; details.
WinIDEDetectCableType ROUT
Push "R0-R5,R9,LR"
MOV R0, R0, LSR #1
Push "R0-R5,LR"
MOV R1, R0, LSR #1
[ Debug23
DREG R0, "Cable of bus ",cc,Integer
DREG R1, "Cable of bus ",cc,Integer
]
MOV R8, #OSHW_CallHAL
MOV R9, #EntryNo_HAL_ATACableID
SWI XOS_Hardware
LDR R0, HAL_IDEDevice_pointer
MOV LR, PC
LDR PC, [R0, #HALDevice_IDECableID]
TEQ R0, #0 ; If we see CBLID- line high
BEQ %40 ; then it's definitely 40-way
......@@ -805,13 +806,13 @@ WinIDEDetectCableType ROUT
[ Debug23
DLINE " is 40-way"
]
Pull "R0-R5,R9,PC"
Pull "R0-R5,PC"
80 MOV R8, #80
[ Debug23
DLINE " is 80-way"
]
Pull "R0-R5,R9,PC"
Pull "R0-R5,PC"
LTORG
......@@ -1069,24 +1070,24 @@ WinIDESetTransferModes
; Entry: R0=device number (0 or 2)
WinIDESetDefaultTimings
Push "R0-R3,R8,R9,LR"
Push "R0-R3,LR"
MOV R2,#0
MOV R3,#&FFFFFF00
STMFD SP!,{R2,R3}
STMFD SP!,{R2,R3}
MOV R0,R0,LSR #1
MOV R1,SP
ADD R2,SP,#8
MOV R8,#OSHW_CallHAL
MOV R9,#EntryNo_HAL_ATASetModes
SWI XOS_Hardware
MOV R1,R0,LSR #1
MOV R2,SP
ADD R3,SP,#8
LDR R0,HAL_IDEDevice_pointer
MOV LR,PC
LDR PC,[R0,#HALDevice_IDESetModes]
ADD SP,SP,#16
MOV LR,#0
LDR R0,[SP]
sbaddr R1,WinIDEDriveDMAFlags
STRB LR,[R1,R0]!
STRB LR,[R1,#1]
Pull "R0-R3,R8,R9,PC"
Pull "R0-R3,PC"
]
END
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