Commit eb6c6a2c authored by Ben Avison's avatar Ben Avison

Support the Raspberry Pi model B+

  There's some questionable code in DoSwi[Sector]DiscOp[64] where it calls
  PollChange in an apparent attempt to support the ADFS floppy state machine.
  In the no-card-detect SDFS case, we can detect from a card's state whether
  it has been changed or not; to be able to signal this to software that
  cares about such things, we increment the sequence number late in the
  process. The downside is that when the card *has* changed, two consecutive
  PollChanged calls will differ from the steady state: the first because
  MaybeChanged is signalled, the second because the sequence number
  mismatches. DetermineDiscType didn't handle this gracefully, ending up
  pointing off the internal array of disc records, resulting in a string of
  gibberish when canonicalising a drive-based file spec. Fixed by having
  DetermineDiscType double-check that the drive is not empty.

  Fixed UpCall_MediaNotPresent and UpCall_MediaNotKnown to actually use the
  media type string from MiscOp 4. For example, you'll now see "Please insert
  card 'RISCOSpi'" being generated by the Wimp under SDFS.

  Improved documentation of MiscOps 4 and 5.

  Already in use in RC12a.

Version 3.64. Tagged as 'FileCore-3_64'
parent 0dbb7645
......@@ -11,12 +11,29 @@ together, but in the absence of the original authors, it will have to do.
Despite what the PRM says, all MiscOps (except MiscOp 6) corrupt R1 on exit.
While techincally a FileCore bug, this is so long-standing that the correct
approach is probably to document it as such.
MiscOp 4 takes a drive number in R1, not a pointer to a disc name as stated
in the PRM.
Despite what the PRM says, all MiscOp SWIs (except MiscOp 6) corrupt R1 on
exit. While techincally a FileCore bug, this is so long-standing that the
correct approach is probably to document it as such. Low-level MiscOp
handlers, however, remain required to preserve R1.
If you are calling a MiscOp 4 SWI, you must provide a valid drive number in
R1 (a pointer to a disc name, as stated in the PRM, will not be accepted). If
you are implementing the low-level routine for MiscOp4, then you cannot rely
upon the value of R1 because it depends upon how it was triggered - it may be
a drive number, or it may be a corrupt value.
In addition to the special value -1 that may be returned in R5 from MiscOp 4
(to specify an indefinite timeout), the special value 0 may be returned to
indicate that the filing system does not support swapping discs at all. (This
is used, for example, by RAMFS.) In this case, R6 is unused.
The low-level MiscOp 5 routine should also accept a special value in R1 of
&80000000, which it should interpret as the "preferred drive". This is the
drive which will be ejected if the system requires a disc which is not
already in one of the drives. In this case, R4 and R5 have meanings as in
OS_UpCall 1 and 2, which may be utilised by a heuristic in the driver to
avoid ejecting too frequently. This type of MiscOp 5 behaviour cannot be
triggered using the MiscOp SWI interface.
Flag bit 0 of MiscOp 7 has nothing to do with the lock status set by
MiscOp 2 and MiscOp 3. Instead, it complements SWI ADFS_LockIDE (and
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "3.63"
Module_Version SETA 363
Module_MajorVersion SETS "3.64"
Module_Version SETA 364
Module_MinorVersion SETS ""
Module_Date SETS "20 Jul 2013"
Module_ApplicationDate SETS "20-Jul-13"
Module_Date SETS "14 Jul 2014"
Module_ApplicationDate SETS "14-Jul-14"
Module_ComponentName SETS "FileCore"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/FileCore"
Module_FullVersion SETS "3.63"
Module_HelpVersion SETS "3.63 (20 Jul 2013)"
Module_FullVersion SETS "3.64"
Module_HelpVersion SETS "3.64 (14 Jul 2014)"
/* (3.63)
/* (3.64)
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
#define Module_MajorVersion_CMHG 3.63
#define Module_MajorVersion_CMHG 3.64
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 20 Jul 2013
#define Module_Date_CMHG 14 Jul 2014
#define Module_MajorVersion "3.63"
#define Module_Version 363
#define Module_MajorVersion "3.64"
#define Module_Version 364
#define Module_MinorVersion ""
#define Module_Date "20 Jul 2013"
#define Module_Date "14 Jul 2014"
#define Module_ApplicationDate "20-Jul-13"
#define Module_ApplicationDate "14-Jul-14"
#define Module_ComponentName "FileCore"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/FileCore"
#define Module_FullVersion "3.63"
#define Module_HelpVersion "3.63 (20 Jul 2013)"
#define Module_LibraryVersionInfo "3:63"
#define Module_FullVersion "3.64"
#define Module_HelpVersion "3.64 (14 Jul 2014)"
#define Module_LibraryVersionInfo "3:64"
......@@ -539,15 +539,19 @@ DetermineDiscType ROUT
LDRVS r1, =FileType_Data
STRVS r1, [r5, #DiscRecord_DiscType]
; Disc in drive is now certain
LDRVCB r1, [r4, #DrvsDisc]
BICVC r1, r1, #Uncertain
STRVCB r1, [r4, #DrvsDisc]
; However, there is a possibility that PollChange calls during disc
; startup may have delinked the disc and drive, so make sure it's still
; valid before we mark the drive as certain
LDRB r1, [r4, #DrvsDisc]
TST r1, #Unknown :OR: Empty :OR: Full
BICEQ r1, r1, #Uncertain
STREQB r1, [r4, #DrvsDisc]
; If disc remained unidentified then check read sectors cache for errors
; If we find an error then use that
LDR r1, [r5, #DiscRecord_DiscType]
LDR lr, =FileType_Data
TEQ lr, r1
......@@ -614,12 +614,44 @@ UpCall
MOV r0, #0
STRB r0, [r2]
; Generate media type string
; Historically, FileCore ignored the media type string. ADFS and SCSIFS
; provided it (at least as far back as CVS goes) but didn't
; internationalise it. RAMFS doesn't provide it (bit it specifies a
; zero timeout so we don't get this far). Let's be paranoid and check
; that it looks like a valid string, and if it's the string "disc" then
; assume it's not internationalised and look it up in FileCore's messages.
RSBS lr, r6, #&8000 ; low number means probably invalid
MOVCC r0, r6
ADDCC r1, r6, #99
SWICC XOS_ValidateAddress
baddr r2, disc
27 LDRB r3, [r0], #1
LDRB lr, [r2], #1
TEQ r3, lr
BNE %FT28 ; string isn't "disc"
TEQ lr, #0
B %FT30 ; string is "disc", so internationalise it
28 MOV r0, r6
29 LDRB lr, [r0], #1
TEQ lr, #0
BEQ %FT40 ; found a null terminator, assume string at r6 is OK
TEQ lr, #&7F
CMPNE lr, #&1F
BLS %FT30 ; found other non-printing character, assume duff
CMP r0, r1
; No terminator found in first 100 bytes, assume duff so drop through
30 ; Generate media type string
baddr r0, disc
ADR r2, UpCall_MediaTypeBuffer
MOV r3, #?UpCall_MediaTypeBuffer
BL message_lookup_to_buffer
ADR r6, UpCall_MediaTypeBuffer
; OSS Tell driver to eject the preferred drive, if it supports ejects.
; Supported registers for the MiscOp are:
......@@ -642,7 +674,6 @@ UpCall
LDRB r1, FS_Id
MOV r2, sp
MOV r3, #-1 ;invalid device no
ADR r6, UpCall_MediaTypeBuffer
[ DebugU
DREG r0,"OnlyXOS_UpCall(",cc
DREG r1,",",cc
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