Commit d216d585 authored by Ben Avison's avatar Ben Avison
Browse files

Fix abort affecting Raspberry Pi B+ and Raspberry Pi 2

  These two boards don't have functional card detect lines on their microSD
  slots, so follow a different code path from most other RISC OS platforms.
  There was an issue when you accessed an object (other than the root
  directory) for which it (if it was a directory) or any of its parent
  directories were not in the directory cache, and it is specified by
  reference to disc name rather than drive number, and where the disc is not
  currently in a drive (or it's in a drive but hasn't been mounted since it
  was inserted). The additional PollChange inserted by DiscOp with a
  specified boot block (as used to identify the disc format when scanning
  drives to see if the disc in each drive has changed) which was intended to
  support some ADFS floppy drives had the side-effect with SDFS-type
  card-detect-less change detection (which has to wait until at least one
  DiscOp has been issued before it can tell if the card has changed) that
  FileCore's disc and drive records became unlinked part-way through the
  FullLookup routine. In later subroutines, this meant we ended up
  misidentifying the controller to which the disc was attached, and because
  SDFS didn't (until recently) have any hard discs, the hard disc controller
  was uninitialised, resulting in a data abort. This is fixed by making
  WhatDisc check for whether the disc record it's about to return has been
  delinked from the drive record, and repeat the process if so. Also removed
  some dead code (an alternate entry to WhatDiscCommon) while I was at it.
  Tested on Raspberry Pi B+ and 2.

Version 3.65. Tagged as 'FileCore-3_65'
parent c936f6ac
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "3.64"
Module_Version SETA 364
Module_MajorVersion SETS "3.65"
Module_Version SETA 365
Module_MinorVersion SETS ""
Module_Date SETS "14 Jul 2014"
Module_ApplicationDate SETS "14-Jul-14"
Module_Date SETS "02 Feb 2015"
Module_ApplicationDate SETS "02-Feb-15"
Module_ComponentName SETS "FileCore"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/FileCore"
Module_FullVersion SETS "3.64"
Module_HelpVersion SETS "3.64 (14 Jul 2014)"
Module_FullVersion SETS "3.65"
Module_HelpVersion SETS "3.65 (02 Feb 2015)"
/* (3.64)
/* (3.65)
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
#define Module_MajorVersion_CMHG 3.64
#define Module_MajorVersion_CMHG 3.65
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 14 Jul 2014
#define Module_Date_CMHG 02 Feb 2015
#define Module_MajorVersion "3.64"
#define Module_Version 364
#define Module_MajorVersion "3.65"
#define Module_Version 365
#define Module_MinorVersion ""
#define Module_Date "14 Jul 2014"
#define Module_Date "02 Feb 2015"
#define Module_ApplicationDate "14-Jul-14"
#define Module_ApplicationDate "02-Feb-15"
#define Module_ComponentName "FileCore"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/FileCore"
#define Module_FullVersion "3.64"
#define Module_HelpVersion "3.64 (14 Jul 2014)"
#define Module_LibraryVersionInfo "3:64"
#define Module_FullVersion "3.65"
#define Module_HelpVersion "3.65 (02 Feb 2015)"
#define Module_LibraryVersionInfo "3:65"
......@@ -156,6 +156,48 @@ DebugXr switch {FALSE} ; debug long filenames - rename
DebugXd switch {FALSE} ; debug long filenames - directory names
DebugCW switch {FALSE} ; debug write cacheing of dirs
Push "r0-r2"
MOV r0,#0
BREG r0,"DiscRec ",cc
DiscRecPtr r1,r0
LDRB r2,[r1,#DiscFlags]
BREG r2," DiscFlags ",cc
LDRB r2,[r1,#Priority]
BREG r2," Priority ",cc
LDRB r2,[r1,#DiscsDrv]
BREG r2," DiscsDrv ",cc
LDRB r2,[r1,#DiscUsage]
BREG r2," DiscUsage "
ADD r0,r0,#1
CMP r0,#8
Pull "r0-r2"
Push "r0-r2"
MOV r0,#0
BREG r0,"DrvRec ",cc
DrvRecPtr r1,r0
LDRB r2,[r1,#DrvsDisc]
BREG r2," DrvsDisc ",cc
LDRB r2,[r1,#DrvFlags]
BREG r2," DrvFlags ",cc
LDRB r2,[r1,#LockCount]
BREG r2," LockCount ",cc
LDR r2,[r1,#ChangedSeqNum]
DREG r2, " ChangedSeqNum "
ADD r0,r0,#1
CMP r0,#8
Pull "r0-r2"
GBLS NeedHdrDebug
GBLS NeedHdrProc
GBLS NeedHdrHostFS
......@@ -48,26 +48,17 @@
; disc good, return disc rec associated with drive
WhatDisc ROUT
Push "r0,r4,r5,r6,r10,lr"
MOV r10, #1
B WhatDiscCommon
Push "r0,r4,r5,r6,lr"
Push "r0,r4,r5,r6,r10,lr"
MOV r10, #0
; Drop through to WhatDiscCommon
[ Debug4 :LOR: DebugL
DREG R1, "<WhatDiscCommon(Drv=",cc
DREG R10, ",Opt=",cc
DREG R1, "<WhatDisc(Drv=",cc
BL CheckDriveNumber
; Test the disc's presence in the drive
MOV r0, r1
BL PollChange ;(R0->LR)
......@@ -88,8 +79,7 @@ WhatDiscCommon
BL MountDiscOnDrive ; (r1,r4->V+r0,r1,r2,r4,r5,r6)
TEQ r10, #0
BLNE DetermineDiscType ; (r1,r2,r4,r5,r6->V+r0,r2,r5,r6)
BL DetermineDiscType ; (r1,r2,r4,r5,r6->V+r0,r2,r5,r6)
MOVVC r3, r5
MOVVC r0, #0
B %FT80
......@@ -108,9 +98,8 @@ WhatDiscCommon
; If disc hasn't been identified and we're interested in that....
TEQ r10, #0
LDRNE lr, [r3, #DiscFlags]
TSTNE lr, #DiscNotIdentified
LDR lr, [r3, #DiscFlags]
TST lr, #DiscNotIdentified
[ DebugL
......@@ -134,8 +123,22 @@ WhatDiscCommon
DebugError " WhatDisc error"
; DetermineDiscType can cause the disc and drive records to become
; unlinked due to the PollChanged within the DiscOps used to load the
; boot block - this was designed to support ADFS floppies, but interacts
; badly in particular with SDFS for removable drives with no disc detect
; (e.g. Raspberry Pi B+). If this happens, loop round and try again.
LDR r0, [r3, #DiscsDrv]
TEQ r0, #8
Pull "r0,r4,r5,r6,pc"
90 ADD sp, sp, #4
Pull "r4,r5,r6,pc"
STRVS r0, [sp]
Pull "r0,r4,r5,r6,r10,pc"
Pull "r0,r4,r5,r6,pc"
; ================
; CheckDriveNumber
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