Commits (8)
  • Robert Sprowson's avatar
    Refactor unaligned LDM in old style error return · c57300a1
    Robert Sprowson authored
    Would only trigger if ADFS was being run on an ARMv7 but using an old style FileCore that didn't support the new error scheme, hence mostly for completeness.
    Spotted by Jon Abbott, ref https://www.riscosopen.org/forum/forums/4/topics/3682
    
    Typo in error string corrected in passing.
    
    Version 3.49. Tagged as 'ADFS-3_49'
    c57300a1
  • Robert Sprowson's avatar
    Use HAL device for PATA IDE controller, and a few minor fixes · 606d918f
    Robert Sprowson authored
    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'
    606d918f
  • Robert Sprowson's avatar
    Build fix · 74deb4a5
    Robert Sprowson authored
    Last minute new label 'Errfree' was not assembled in when FloppyPCI was true.
    Retagged as ADFS-3_50.
    74deb4a5
  • Jeffrey Lee's avatar
    Preserve R12 across HAL device calls · c10bb669
    Jeffrey Lee authored
    Detail:
      s/Adfs12, s/IDEDetect - Ensure R12 is preserved over HAL device calls, the calling conventions allow the HAL to clobber it
    Admin:
      Tested on Iyonix
      Fixes abort during ROM init
    
    
    Version 3.51. Tagged as 'ADFS-3_51'
    c10bb669
  • Jeffrey Lee's avatar
    Preserve R12 across HAL device calls · c5bab079
    Jeffrey Lee authored
    Detail:
      s/Adfs50 - Ensure R12 is preserved across HAL device calls, the calling conventions allow the HAL to clobber it
    Admin:
      Tested on Iyonix
      Fixes abort during ROM init
    
    
    Version 3.51. Retagged as 'ADFS-3_51'
    c5bab079
  • Robert Sprowson's avatar
    Export a few extra bits · 8eb13bdf
    Robert Sprowson authored
    CDFSSoftATAPI 1.35 and later uses symbols instead of magic numbers for ADFS_IDEDeviceInfo and ADFS_ATAPIOp, export them here so this combination builds.
    
    Version 3.52. Tagged as 'ADFS-3_52'
    8eb13bdf
  • Robert Sprowson's avatar
    Calculate the offset to the hardware-dependent information · b95e07bc
    Robert Sprowson authored
    Don't assume that the disc address to MiscOp_Mount is always &C00, in order to locate the hardware-dependent information (see PRM 2-215), calculate the offset properly. This fixes a problem that FileCore 3.74 triggered where the LBA flag was no longer being recovered now the alignment of the request in R2 has changed, causing some drives to no longer mount if they also don't support CHS addressing.
    Strictly speaking there's no guarantee that FileCore is even asking for the boot block at all; ADFS should read the sectors itself before fulfilling the request, but historically it's always assumed that the boot block was being read, so let sleeping dogs lie.
    Ref https://www.riscosopen.org/forum/forums/4/topics/9390
    
    Version 3.53. Tagged as 'ADFS-3_53'
    b95e07bc
  • Jeffrey Lee's avatar
    Remove legacy 700us DRQ timeout for write ops · e527e619
    Jeffrey Lee authored
    Detail:
      Early versions of the ATA spec mandated that drives should assert DRQ within 700us of a write command being issued. However later versions of the spec have dropped this limit, and some devices (e.g. CF cards) are known to regularly exceed the limit.
      Remove the 700us timeout from ADFS, so that these devices can operate correctly.
      s/Adfs14 - Modify DRQ timeout check so that it will fall back to polling from TickerV if the initial 700us loop times out.
      s/StaticsIDE - Add extra word to workspace, so that the TickerV routine can still timeout the operation
    Admin:
      Tested on IOMD (~4M FSBash ops), Tungsten (~500K FSBash ops)
      Fixes "disc error 20" seen when using IDE-CF adapter on RiscPC, thanks to reasarch by Jon Abbot:
      https://www.riscosopen.org/forum/forums/4/topics/9557
    
    
    Version 3.54. Tagged as 'ADFS-3_54'
    e527e619
......@@ -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.48"
Module_Version SETA 348
Module_MajorVersion SETS "3.54"
Module_Version SETA 354
Module_MinorVersion SETS ""
Module_Date SETS "27 Jan 2013"
Module_ApplicationDate SETS "27-Jan-13"
Module_Date SETS "18 Nov 2017"
Module_ApplicationDate SETS "18-Nov-17"
Module_ComponentName SETS "ADFS"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/ADFS/ADFS"
Module_FullVersion SETS "3.48"
Module_HelpVersion SETS "3.48 (27 Jan 2013)"
Module_FullVersion SETS "3.54"
Module_HelpVersion SETS "3.54 (18 Nov 2017)"
END
/* (3.48)
/* (3.54)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 3.48
#define Module_MajorVersion_CMHG 3.54
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 27 Jan 2013
#define Module_Date_CMHG 18 Nov 2017
#define Module_MajorVersion "3.48"
#define Module_Version 348
#define Module_MajorVersion "3.54"
#define Module_Version 354
#define Module_MinorVersion ""
#define Module_Date "27 Jan 2013"
#define Module_Date "18 Nov 2017"
#define Module_ApplicationDate "27-Jan-13"
#define Module_ApplicationDate "18-Nov-17"
#define Module_ComponentName "ADFS"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/ADFS/ADFS"
#define Module_FullVersion "3.48"
#define Module_HelpVersion "3.48 (27 Jan 2013)"
#define Module_LibraryVersionInfo "3:48"
#define Module_FullVersion "3.54"
#define Module_HelpVersion "3.54 (18 Nov 2017)"
#define Module_LibraryVersionInfo "3:54"
......@@ -52,7 +52,7 @@ SWIClass SETS ADFSSWI_Name
AddSWI NOP2 ; &4024E
AddSWI NOP3 ; &4024F
AddSWI ECCSAndRetries ; &40250
AddSWI LockIDE ; &40251
AddSWI LockIDE ; &40251
AddSWI FreeSpace64 ; &40252
AddSWI IDEDeviceInfo ; &40253
AddSWI DiscOp64 ; &40254
......@@ -60,6 +60,39 @@ SWIClass SETS ADFSSWI_Name
ADFSSWICheckValue * @
; ADFS_IDEDeviceInfo reason codes
^ 0
ADFSIDEDeviceInfo_ByLegacyID # 1
ADFSIDEDeviceInfo_ByID # 1
ADFSIDEDeviceInfo_ByDrive # 1
; ADFS_IDEDeviceInfo flags
ADFSIDEDeviceInfo_DeviceIDShift * 0
ADFSIDEDeviceInfo_DeviceIDMask * &F:SHL:ADFSIDEDeviceInfo_DeviceIDShift
ADFSIDEDeviceInfo_CPIDShift * 4
ADFSIDEDeviceInfo_CPIDMask * &FF:SHL:ADFSIDEDeviceInfo_CPIDShift
; ADFS_IDEDeviceInfo device types
^ 0
ADFSIDEDeviceInfo_None # 1
ADFSIDEDeviceInfo_NonPacket # 1
ADFSIDEDeviceInfo_Packet # 1
; ADFS_ATAPIOp flags
ADFSATAPIOp_Reset * 1:SHL:0
ADFSATAPIOp_DeviceIDShift * 12
ADFSATAPIOp_DeviceIDMask * &F:SHL:ADFSATAPIOp_DeviceIDShift
ADFSATAPIOp_CPIDShift * 16
ADFSATAPIOp_CPIDMask * &FF:SHL:ADFSATAPIOp_CPIDShift
ADFSATAPIOp_TransShift * 24
ADFSATAPIOp_TransNone * 0:SHL:ADFSATAPIOp_TransShift
ADFSATAPIOp_TransRead * 1:SHL:ADFSATAPIOp_TransShift
ADFSATAPIOp_TransWrite * 2:SHL:ADFSATAPIOp_TransShift
ADFSATAPIOp_TransMask * 3:SHL:ADFSATAPIOp_TransShift
ADFSATAPIOp_DMA * 1:SHL:26
ADFSATAPIOp_DMADIR * 1:SHL:27
OPT OldOpt
END
;
; 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
......
......@@ -27,7 +27,7 @@ $num FSErr $name, $str
11 FSErr FormatEsc, Escape whilst formatting (disc structure invalid)
70 FSErr FormatNotSupportedOnWinnie, Format not available for Winnies
71 FSErr DensityNotSupported, Density not supported
72 FSErr SectorSizeNotSupported, Sectors size not supported
72 FSErr SectorSizeNotSupported, Sector size not supported
73 FSErr TooManySectors, Too many sectors on a track
74 FSErr BadFormat, Bad format
75 FSErr TooManyDefects2, Too many defects
......
......@@ -280,6 +280,7 @@ $lab DrvRecPtr $Rptr,$Rindex,$cond
; byte on the earlier list. The last 64 bytes describe the disc to ADFS.
; Any other bytes may be used as params for the low level drivers
DefectListDiscAdd * &400+&800
SzDefectList * &200
DefectEndMark bit 29
MaxStruc * 64
......@@ -476,6 +477,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,14 @@ 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
Push "R12"
MOV LR,PC
LDR PC,[R0,#HALDevice_IDEControllerInfo]
Pull "R12"
MOV R6,#0
CMPVC R0,#4*4
SETV LO
......@@ -280,16 +282,18 @@ 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
Push "R12"
MOV LR,PC
LDR PC,[R0,#HALDevice_IDEControllerInfo]
Pull "R12"
Pull "R2-R8,R14"
BVS %FT05
CMP R0,#8*4
......@@ -357,16 +361,18 @@ 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
Push "R12"
MOV LR,PC
LDR PC,[R0,#HALDevice_IDEControllerInfo]
Pull "R12"
Pull "R2-R8,R14"
BVS %FT05
CMP R0,#32
......@@ -475,38 +481,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
BNE %FT15 ; no IDE podule present
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
05
ADD R14,R9,#WinIDEPtr
|
LDR R14, =DefaultIDE
......@@ -1092,7 +1068,7 @@ WinMount ROUT
; Entry:
; R0 = 0
; R1 = drive (4..7)
; R2 = disc address to read (sector aligned)
; R2 = disc byte address to read (sector aligned)
; R3 -> transfer buffer (word aligned)
; R4 = length in bytes
; (R5 -> disc record to fill in: floppies only)
......@@ -1178,6 +1154,13 @@ WinMount ROUT
; First check defect list
; R3 -> boot block read from disc
[ BigDisc
MOV LR,R2,LSL#9 ; turn back into a byte offet (knocks out DiscBits too)
|
BIC LR,R2,#DiscBits
]
RSB R5,LR,#DefectListDiscAdd
ADD R3,R3,R5 ; Offset from dataptr to boot block
MOV R5,R3 ; R5 -> boot block
MOV R1,#0 ; zero checksum
MOV R4,#SzDefectList - MaxStruc
......@@ -1262,7 +1245,7 @@ WinMount ROUT
; R3 -> boot block
; R2 still holds disc address from above
MOV R1,R2,LSR#(32-3) ; R1 = 0/1
MOV R1,R2,LSR#(32-3) ; R1 = drive number
LDRB R0,[R3,#SzDefectList - MaxStruc + SecsPerTrk]
sbaddr LR,WinIDEDriveSecsPerTrk ; set up WinIDEDriveSecsPerTrk
......
......@@ -932,13 +932,15 @@ WinIDEStartTransfer ROUT
; it was a data out op
; R8 -> scatter list
; R9 = bytes we want from/for first sector
; Wait for DRQ to become asserted: according to CAM 2.1, this can
; take as long as 700us although Conner drives appear to assert it
; immediately. This loop is inaccurate because the resolution of
; the delay routine is only 0.5us but it is good enough for this.
; NOTE: if this is part of a background op (except for the first part
; which is started in foreground), IRQs are disabled.
; DRIVES THAT TAKE A LONG TIME TO ASSERT DRQ WILL RUIN INTERRUPT LATENCY
; We need to wait for DRQ to be asserted before we can send the first sector of
; data. However the drive won't raise an interrupt - we must poll the
; controller.
; Early versions of the ATA spec state that it can take up to 700us before DRQ
; is asserted, but later versions of the spec have dropped this limit. We might
; be in an IRQ, so we can't wait here forever, as that would ruin interrupt
; latency. Most drives will respond within 700us, so go for a compromise of
; waiting here for up to 700us, with a fallback of polling from TickerV for
; drives that take longer.
MOV R1,#700 ; counter for loop
80
......@@ -953,9 +955,7 @@ WinIDEStartTransfer ROUT
; have got DRQ or are giving up waiting
CMPS R1,#0 ; giving up?
MOVEQ R0,#WinIDEErrNoDRQ ; if so, return error
SETV EQ
Pull "R1-R6,R8-R9,PC",VS
BEQ %FT81
; got DRQ so write data
......@@ -982,6 +982,19 @@ WinIDEStartTransfer ROUT
CLRV
Pull "R1-R6,R8-R9,PC"
81
; set up the TickerV DRQ poll routine
PHPSEI LR
LDR R1, WinTickCount ; preserve current timeout
STR R1, WinIDEDRQTimeout
MOV R1, #1
STR R1, WinTickCount
ADR R1, WinIDEDRQPoll
STR R1, WinTickCallAddress
PLP LR
Pull "R1-R6,R8-R9,PC"
LTORG
;*********************************************************************
......@@ -1847,6 +1860,95 @@ WinIDETimeout ROUT
;*********************************************************************
WinIDEDRQPoll ROUT
;
; Called every centisecond from TickerV when we're waiting for DRQ for the
; first sector of a write op.
;
; Entry:
; SB -> static workspace
; MODE: IRQ or SVC
; IRQs disabled
;
; Exit:
; All registers preserved
; Switch to SVC mode as will join main thread of IRQ
Push "$WinIDEIRQRegsA,LR" ; same regs as IRQHandler
WritePSRc SVC_mode :OR: I_bit,LR,,R0
NOP
; Now in SVC mode - save main regs
Push "$WinIDEIRQRegsB,LR" ; same regs as IRQHandler
; Set up registers suitable for branching to IRQ code
[ TwinIDEHardware
LDR R9,WinIDECurrentHW
|
sbaddr R9,WinIDEHardware
]
[ HAL
ASSERT WinIDECtrlPtr = 0
ASSERT WinIDEPtr = 4
LDMIA R9,{IDECtrl,IDE} ; IDE -> IDE hardware
|
LDR IDE,[R9,#WinIDEPtr]
]
; Check for timeout
LDR R2,WinIDEDRQTimeout
SUBS R2,R2,#1
BEQ %FT95
; Check for DRQ
LDRB R0,IDERegAltStatus
TST R0,#IDEStatusDRQ
STREQ R2,WinIDEDRQTimeout
MOVEQ R2,#1
BEQ %FT90
; got DRQ so write data
LDR R1,WinIDETmpScatterEntry ; R1 -> buffer
LDR R0,WinIDEBlockSize ; R0 = max bytes to move
; R0 = length to transfer (up to 512 bytes will be moved)
; R1 -> buffer
; Call data write routine
MOV LR,PC ; set link
LDR PC,[R9,#WinIDEWritePtr] ; (R0,R1,IDE->R0,R1)
; returns here
; Restore standard ticker routine
ADR R2,WinIDETimeout
STR R2,WinTickCallAddress
90
STR R2,WinTickCount
; First restore SVC regs and switch back to original mode
Pull "$WinIDEIRQRegsB,LR"
RestPSR R0,,c
NOP
; Now back in original mode
Pull "$WinIDEIRQRegsA,PC"
95
MOV R0,#WinIDEErrNoDRQ ; R0 = error code
LDR R2,WinIDEDiscAddress ; R2 = disc address of start of op
LDR R3,WinIDEScatterPtr ; R3 -> scatter list
LDRB R7,WinIDECommandCode ; R7 = IDE command code
B WinIDEIRQError
;*********************************************************************
WinIDEUpdateScatterList ROUT
;
; Updates scatter list by the length of a transfer
......
......@@ -305,10 +305,8 @@ ConvertErrorForParent ROUT
ORREQ R0, R0, #ExternalErrorBit
Pull "PC", EQ ; then set external error bit, and return
Push "R1,R2"
ASSERT NewDiscErrorBit < bit2 ; LDM ignores bits 0 and 1
LDMIA R0, {R1,R2,R3}
; MOV LR, #&80
; STMIA LR, {R0-R3}
BIC R3, R0, #3 ; Knock out the 2 flags
LDMIA R3, {R1,R2,R3}
[ BigDisc
TSTS R2, #DiscBits
TEQEQS R3, #0 ; return old-style error if address is small
......@@ -324,8 +322,6 @@ ConvertErrorForParent ROUT
ADR R0, WinIDEErrorNo
STMIA R0, {R1,R2}
ORR R0, R0, #DiscErrorBit+ExternalErrorBit
; MOV LR,#&A0
; STMIA LR, {R0,R1,R2}
B %FT90
05
]
......@@ -336,8 +332,6 @@ ConvertErrorForParent ROUT
AND LR, R1, #MaxDiscErr:SHL:8
ORR R0, R0, LR, LSL #(24-8)
ORR R0, R0, #DiscErrorBit
; MOV LR,#&A0
; STMIA LR, {R0}
90
Pull "R1,R2,PC"
]
......
......@@ -156,41 +156,67 @@ 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
Push "R12"
MOV LR,PC
LDR PC,[R2,#HALDevice_Activate]
Pull "R12"
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
......@@ -204,16 +230,17 @@ InitEntry ROUT ; NO REENTRANCY CHECK NEEDED
; Check what hardware there is for drivers to talk to
[ FloppyPodule:LOR:FloppyPCI
MOV R0,#MachHas82710
|
Push "R3,R4"
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
[ FloppyPodule:LOR:FloppyPCI
MOV R0,#MachHas82710
|
TEQS R0,#0 ; 0 => no IOEB
MOVEQ R0,#MachHas1772 ; if no IOEB, old machine
MOVNE R0,#MachHas82710 ; if IOEB, assume 710
......
......@@ -682,31 +682,31 @@ WinIDESetTimings
MOV R3, R7
BL WinIDEGetTimingForDevice
Push "R0-R3,R9"
LDRB R0, [R9,#WinIDEBusNo]
Push "R0-R3,R12"
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, #5*4+0
TEQ R7, #WinIDENoDevice
MOVEQ R3, #0
ADDNE R3, SP, #5*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,R12"
MOV R3, R0
TEQ R6, #WinIDENoDevice
......@@ -747,14 +747,17 @@ 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
Push "R12"
MOV LR, PC
LDR PC, [R0, #HALDevice_IDECableID]
Pull "R12"
TEQ R0, #0 ; If we see CBLID- line high
BEQ %40 ; then it's definitely 40-way
......@@ -805,13 +808,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 +1072,25 @@ 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
ADD SP,SP,#16
MOV R1,R0,LSR #1
MOV R2,SP
ADD R3,SP,#8
LDR R0,HAL_IDEDevice_pointer
Push "R12"
MOV LR,PC
LDR PC,[R0,#HALDevice_IDESetModes]
LDR R12, [SP], #20
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
......@@ -227,6 +227,7 @@ WinDriveTypes a4 4
WinTickCount a4 4 ; decremented every centisecond
WinTickCallAddress a4 4 ; if !0, called when count==0
WinIDEDRQTimeout a4 4 ; counter for DRQ timeouts
;*********************************************************************
......