• Robert Sprowson's avatar
    Move CMOS settings out of riscos.img · afc8ef8d
    Robert Sprowson authored
    The Pi is unusual in self modifying the ROM image when a CMOS setting was changed (due to there being none on the PCB), with the potential of ending up with a corrupt OS image on disc.
    Remove this code and emulate the CMOS using normal RAM, and using the Pi firmware to load the CMOS file in for us (like fatload does on OMAP based designs) by using its ability to load a second arbitrary file at an address, intended in the Linux world to load a disc image.
    
    To use this you will need to add
      ramfsfile=CMOS
      ramfsaddr=0x508000
    to config.txt which loads it 5MB (ie. ImageSize) above the default load address (&8000), though as noted in the changes to BCM2835-0_60 we don't really need to load at offset &8000 but generally do since that's the Pi firmware's default.
    
    hdr/StaticWS:
    New workspace to hold our CMOS copy.
    CMOS.s:
    Remove the 2k magic block, add a simple bytewise copy loop implementation.
    SDIO.s:
    Extend ADR range.
    Top.s:
    Copy what the Pi firmware loads somewhere safe until the MMU is on, then copy it back (converting from logical to physical order along the way).
    Change other values recovered from pre-MMU times using advanced post indexed addressing technology (TM) rather than switching around sb a lot.
    
    Tested on a Pi 3, with and without an initial CMOS file present.
    
    Version 0.61. Tagged as 'BCM2835-0_61'
    afc8ef8d
SDIO 30.2 KB