1. 10 Aug, 2019 1 commit
    • Ben Avison's avatar
      Set shareability bit in page tables for IO region on Pi 2 onwards · 699a746a
      Ben Avison authored
      RISCOS_MapInIO does relatively little processing on the L1PT flags that the
      HAL passes to it. However, when modules come along later and try to locate
      IO again, using OS_Memory 13, access permissions are specified using a
      variation on dynamic area flags. The kernel translates from these to L1PT
      flags, and one of the rules it applies is that the shareability bit is set
      if on a multiprocessor system. On Pi 2 and later, this means it doesn't find
      a match amongst the sections that were mapped in by the HAL, and in practice
      this means BCMVideo ends up causing 16MB of IO space to be mapped in twice.
      
      Fix this by passing the L1_S flag to RISCOS_MapInIO on Pi 2 and later. This
      effectively frees up an additional 16MB of logical address space for dynamic
      areas.
      
      Version 0.81. Tagged as 'HAL_BCM2835-0_81'
      699a746a
  2. 02 Aug, 2019 1 commit
    • Ben Avison's avatar
      Address of mailbox given to GPU should have cacheability bits set correctly · 34d04d6b
      Ben Avison authored
      On entry to HAL_SendHostMessage, we ensure the contents of the mailbox buffer
      are flushed out to the ARM L2 cache (if applicable) and main memory. There
      were a couple of instructions to fill in the top two bits of the address
      before passing it to the VC, but they were commented out for reasons that are
      not clear.
      
      The effect of this is that the VC will look in its L1 and L2 caches for the
      data in the buffer. On Pi 1 and 0, this wouldn't be too bad, since ARM11
      didn't have its own L2 cache and would have written the data into the VC L2
      cache instead, meaning that there would only be coherencency problems if the
      VC L1 cache still contained the old contents of the address. On Pi 2-4, it's
      more risky, because the VC L2 cache could also be inconsistent with main
      memory at this point.
      
      Reinstating the top two bits doesn't appear to cause any ill effects I can
      see (tested on Pi 1 and 4), so put these instructions back in.
      
      Version 0.80. Tagged as 'HAL_BCM2835-0_80'
      34d04d6b
  3. 20 May, 2019 1 commit
    • Robert Sprowson's avatar
      Add Compute Module 3+ support · 12a389b2
      Robert Sprowson authored
      GPIO.s,hdr/BCM2835: Table of known ids updated
      SPI.s: Fix long broken compute module support (only the original CM1 would have exported SPI2 due to not checking for the new id scheme).
      Unrelated, SDIO.s: Use CallOS macro.
      
      Thanks to Chris Hall for testing this on a CM3+ 8GB model.
      
      Version 0.79. Tagged as 'HAL_BCM2835-0_79'
      12a389b2
  4. 25 Feb, 2019 1 commit
    • Robert Sprowson's avatar
      Check Board_Model only once · 7c2fe7dc
      Robert Sprowson authored
      Do an upfront check for the model being 0, if that ever changes there's probably something seriously different. Look only at the Board_Revision elsewhere.
      Add the other Compute module to the SPI2 check (though currently the checks don't consider "New" revision words).
      
      Version 0.78. Tagged as 'BCM2835-0_78'
      7c2fe7dc
  5. 01 Dec, 2018 1 commit
    • Robert Sprowson's avatar
      Appease Thor · 9a2c1030
      Robert Sprowson authored
      SDIO.s: a condition code mixup meant that during intense SD card activity the thunder bolt symbol would appear due to poking the non-LED lines on 3B+
      GPIO.s: extend the 'free for use' table to include 3A+ pins, otherwise it read off the end; add an ASSERT to catch this in future
      
      Version 0.77. Tagged as 'BCM2835-0_77'
      9a2c1030
  6. 26 Oct, 2018 1 commit
  7. 07 Jul, 2018 1 commit
    • Jeffrey Lee's avatar
      Merge SMP branch to trunk · 06491820
      Jeffrey Lee authored
      Detail:
        hdr/StaticWS - Reserve workspace for QA7 peripheral address, HAL-wide spinlock, and doorbell device
        Makefile, s/DBell - Add doorbell device implementation
        hdr/BCM2835 - Clean up dead macros, add new macros for spinlock claim/release and basic CPU detection. Define new IRQ numbers for the "QA7" peripheral.
        hdr/CastleMacros, s/Top - Generate two HAL descriptors and entry point tables: One for single-core machines and one for multi-core machines. This avoids some MP-related overheads on ARM11 models of Pi. Implement SMP HAL entry points.
        s/Interrupts - Add support for the QA7 interrupts. Although some interrupts can be flexibly routed to different cores, we currently stick with a static scheme.
        s/Messaging - Use CPUDetect macro
      Admin:
        Untested
        Requires Kernel-6_09
      
      
      Version 0.76. Tagged as 'BCM2835-0_76'
      06491820
  8. 10 Apr, 2018 1 commit
    • Robert Sprowson's avatar
      Debug UART typo & clarification · 8c7c60d9
      Robert Sprowson authored
      Top.s: HAL_UARTStartUp takes 0's based UART numbers, so the debug setup would go wrong (if HAL_UARTStartUp actually checked the value).
      UART.s: Re-express the baud register default value so its origin is clear.
      Retagged as BCM2835-0_75 as the (non-debug) version is binary identical.
      8c7c60d9
  9. 21 Mar, 2018 1 commit
    • Robert Sprowson's avatar
      Safe GPIO pins table updates · b0ddf21a
      Robert Sprowson authored
      Add Pi3 B+ and Zero W.
      Split out CM3 from CM1, since the CM3 reuses some high GPIO lines as bit bashed SMPSU IIC bus, so we can't offer those for GPIO like on CM1.
      
      Version 0.75. Tagged as 'BCM2835-0_75'
      b0ddf21a
  10. 19 Mar, 2018 1 commit
    • Jeffrey Lee's avatar
      Fix SD activity LED on 3B+ · f90ce9ec
      Jeffrey Lee authored
      Detail:
        hdr/BCM2835 - Add some new board revision values
        s/SDIO - Treat the 3B+ the same as the 3B when handling the activity LED. Also detect the Embest-manufactured CM1 and treat it the same as the Sony one.
      Admin:
        Tested on Raspberry Pi 3B+
      
      
      Version 0.74. Tagged as 'BCM2835-0_74'
      f90ce9ec
  11. 09 Sep, 2017 2 commits
    • Jeffrey Lee's avatar
      Fix keyboard scan dependencies · 640e2cc1
      Jeffrey Lee authored
      Detail:
        s/KbdScan - Add RTSupport to the list of modules (dependency of DWCDriver)
      Admin:
        Tested on Raspberry Pi 3
      
      
      Version 0.73. Tagged as 'BCM2835-0_73'
      640e2cc1
    • ROOL's avatar
      Participate in keyboard scan dependencies · 14f24328
      ROOL authored
      Detail:
        Add keyboard scan code with list of modules that the kernel needs to do the same.
        Reorder the HALEntries to match Kernel-5_89.
        Remove unused stub functions (now KbdScan exists).
      Admin:
        Submission for USB bounty.
      
      Version 0.72. Tagged as 'BCM2835-0_72'
      14f24328
  12. 31 Jul, 2017 1 commit
    • Jeffrey Lee's avatar
      Fix compatibility with latest firmware · d58d5839
      Jeffrey Lee authored
      Detail:
        Firmware as of 28th July will allow the GPU to make use of the top 16MB of RAM in 1GB machines. This overlaps the ARM's IO space, essentially making that area of memory inaccessible to us.
        This causes problems because we rely on a couple of buffers which are located in VC memory (virtual GPIO buffer & FT5406 touchscreen buffer)
        At some point extra mailbox messages were added to allow the ARM to dictate the location of these buffers; so make use of those messages wherever possible.
        File changes:
        s/Messaging - Remove VirtGPIOBuf and TouchBuf related tags from the initialisation tag sequence. Add new GetVCBuffer function that can be called post-MMU init to deal with getting/setting the buffer addresses.
        s/Top - Use GetVCBuffer to initialise VirtGPIOBuf
        s/Touch - Use GetVCBuffer to get touchscreen buffer
        hdr/StaticWS - Remove TouchBuf from workspace, no longer needed
      Admin:
        Tested on Raspberry Pi 3 with firmware from March 2016 (Set commands not supported), 21st July 2017 (set commands supported, but upper 16MB not used), 28th July 2017 (set commands supported and necessary)
      
      
      Version 0.71. Tagged as 'BCM2835-0_71'
      d58d5839
  13. 27 Jul, 2017 1 commit
  14. 14 May, 2017 1 commit
    • Robert Sprowson's avatar
      Add new scheme ids for A+ and B+ to id table · 2e99b15b
      Robert Sprowson authored
      Apparently there are some A+ 1.1 and B+ 1.2's in the wild not built with their former id's (0x12 and 0x13) but using the newer 24 bit id scheme. Add aliases for these.
      
      Version 0.70. Tagged as 'BCM2835-0_70'
      2e99b15b
  15. 21 Feb, 2017 4 commits
    • Robert Sprowson's avatar
      Add support for CM3 and CM3L with or without eMMC · 6eeefb37
      Robert Sprowson authored
      The SDIO HAL device reports when it is sure fixed disc media is attached (ie. eMMC soldered on the same PCB) which causes SDFS to report this to FileCore as a fixed disc, skipping the removable safety checks.
      However, CM3 and CM3L both return the same board id so we can't work out which is which. Additionally, someone could attach an external eMMC in theory on a custom expansion board (instead of an SD card socket like the CMIO has).
      To resolve this, we assign IO expander line 6 of U8 to be a safety catch. If that line is held low, it signifies this is definitely a CM3 - in effect this is a "definitely has eMMC" or "maybe has eMMC" switch.
      
      Tested on CM1, CM3, CM3L, and a suitably modified CM3 with the help of Chris Hall.
      
      Version 0.69. Tagged as 'BCM2835-0_69'
      6eeefb37
    • Robert Sprowson's avatar
      Refactor early GPU queries · e65005cf
      Robert Sprowson authored
      Remove the baffling double indirection of RamAd (and unused exports SerNo and MacAdd), and treat these the same as the other pre-HAL_Init query results.
      This means the scope of the tagbuffer is limited to Messaging.s, rather than having to be kept preserved globally.
      Use memcpy() to copy tag list to tagbuffer for clarity.
      Tested on a Pi 3.
      
      Version 0.68. Tagged as 'BCM2835-0_68'
      e65005cf
    • Robert Sprowson's avatar
      Fix for register corruption · 62e5efb4
      Robert Sprowson authored
      In HAL_QueryPlatform a mixture of register naming overlooks r6 (aka v3) gets used, but not preserved.
      Uppercase opcodes, add a few more comments around the CRC calculation.
      62e5efb4
    • Robert Sprowson's avatar
      Correct a couple of comments · 4a8fd0a1
      Robert Sprowson authored
      Some misleading notes about IIC0, and other minor clarifications.
      4a8fd0a1
  16. 11 Feb, 2017 1 commit
    • ROOL's avatar
      Transition Pi HAL to GPIO API 1.00 · d3f4d7ef
      ROOL authored
      Detail:
        Move the register accesses for GPIO to the HAL, since they are hardware specific.
        Add recognition of board types for Pi 3, Compute module 3, rev 3 Pi 0's, and the newer Pi 2's with BCM2837 on them.
      Admin:
        Based in part on a submission from Tank.
        Tested on a Pi 2. Requires corresponding GPIO module (tag GPIO-1_00-1_11_2_1 or later).
      
      Version 0.67. Tagged as 'BCM2835-0_67'
      d3f4d7ef
  17. 20 Jan, 2017 1 commit
    • Jeffrey Lee's avatar
      Add JTAG debugging support · e626e215
      Jeffrey Lee authored
      Detail:
        hdr/BCM2835 - Add switch to allow GPIOs 22-27 to be reconfigured for ARM JTAG access
        s/Top - Configure GPIOs for JTAG if switch enabled
        s/GPIO - Disable GPIO HAL device if JTAG enabled (try and avoid any software messing with the pins)
      Admin:
        Tested on Raspberry Pi 1 B, B+
      
      
      Version 0.66. Tagged as 'BCM2835-0_66'
      e626e215
  18. 12 Dec, 2016 1 commit
    • Jeffrey Lee's avatar
      Fix crash with HALDebug {TRUE} · e277e70f
      Jeffrey Lee authored
      Detail:
        s/Top - Update internal HAL debug functions to preserve all the required registers; the new HAL_Debug / UART function implementations corrupt more of the caller-save registers than the old ones did
      Admin:
        Tested on Raspberry Pi
      
      
      Version 0.65. Tagged as 'BCM2835-0_65'
      e277e70f
  19. 10 Dec, 2016 1 commit
    • ROOL's avatar
      Report POR flag to the kernel · 3467df7b
      ROOL authored
      Detail:
        Look at the reset status register and use the HADPOR flag to influence the OSStartFlag_POR value.
        Fixes problem of OS_Byte 253 always reporting a hard reset, never a power on reset.
      Admin:
        Tested on a Pi 2.
        Submission for USB bounty.
      
      Version 0.64. Tagged as 'BCM2835-0_64'
      3467df7b
  20. 25 Oct, 2016 1 commit
    • Jeffrey Lee's avatar
      Fix UART error IRQs not being cleared · e5872c90
      Jeffrey Lee authored
      Detail:
        s/UART - Update HAL_UARTReceiveByte to clear error IRQs when the FIFO is believed to be empty. Disable IRQs in some complex routines to prevent any re-entrancy issues, and also clear the RX threshold IRQ when flushing the FIFOs or adjusting the threshold level.
      Admin:
        Tested on Raspberry Pi 1
        Resolves ticket #429
      
      
      Version 0.63. Tagged as 'BCM2835-0_63'
      e5872c90
  21. 22 Oct, 2016 1 commit
  22. 15 Oct, 2016 2 commits
    • 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
    • Robert Sprowson's avatar
      Groundwork · 9192c127
      Robert Sprowson authored
      IIC.s/Stubs.s:
      Don't import workspace when it's not used
      Top.s:
      Move the dead loops to just after the vectors. In practice these are ineffectual because the firmware (now) loads the image at &8000 to please Linux, so we're mostly wasting our time producing ROM images with vectors at the start.
      Pad image to &8000 so it can be loaded at 0 (using Kernel_Old=1 in config.txt) or &8000 (default).
      Line up/capitalise a few stray mnemonics, use APCS register naming.
      Call HAL_DebugTXStrInline for "HAL Init completed" rather than an inline loop, since earlier in the same function we called HAL_DebugTXStrInline happily.
      
      Version 0.60. Tagged as 'BCM2835-0_60'
      9192c127
  23. 09 Oct, 2016 1 commit
    • Jeffrey Lee's avatar
      Implement HAL UART API. Tidy up debug output. · b5d4e1d0
      Jeffrey Lee authored
      Detail:
        hdr/BCM2835, hdr/StaticWS, s/Debug, s/Top, s/Video - Fix up the two serial debug switches to work correctly. Disable debug by default.
        s/UART, hdr/UART - Implement HAL UART API, for the PL011 UART.
      Admin:
        Tested on Raspberry Pi 1 B
        Requires DualSerial 0.25 to work correctly
      
      
      Version 0.59. Tagged as 'BCM2835-0_59'
      b5d4e1d0
  24. 09 May, 2016 1 commit
    • Jeffrey Lee's avatar
      GET Hdr:CPU.Arch · 2b6c0909
      Jeffrey Lee authored
      Detail:
        s/SDIO - Add a GET of Hdr:CPU.Arch, as it's now required for use of the DivRem macro
      Admin:
        Tested on Raspberry Pi
      
      
      Version 0.58. Tagged as 'BCM2835-0_58'
      2b6c0909
  25. 04 Apr, 2016 1 commit
    • Jeffrey Lee's avatar
      Fix sticky SD activity LED on Pi 3 B · 486e778f
      Jeffrey Lee authored
      Detail:
        s/SDIO - Signed counter wrap-around once &80007fff was reached was causing the code to think the activity LED was permanently off, resulting in the code only making "turn on" requests. Calculating the difference as a (signed) 16bit value solves the problem.
      Admin:
        Tested on Pi 3 B
        Fixes SD activity LED being stuck on after e.g. letting Verify run for a few seconds.
      
      
      Version 0.57. Tagged as 'BCM2835-0_57'
      486e778f
  26. 29 Mar, 2016 1 commit
    • Jeffrey Lee's avatar
      Fix waiting on wrong mailbox address · eefa2115
      Jeffrey Lee authored
      Detail:
        s/Top - Fix cores sat in the holding pattern waiting on a write to the wrong address. Also, set up lr so we can return to the holding pattern if desired.
      Admin:
        Tested on Pi 3 B
        Now possible to launch simple code sequences on the other cores
      
      
      Version 0.56. Tagged as 'BCM2835-0_56'
      eefa2115
  27. 28 Mar, 2016 1 commit
    • Jeffrey Lee's avatar
      Put the other cores into a holding pattern · 56779d91
      Jeffrey Lee authored
      Detail:
        s/Top - On multi-core chips, the ARM boot stub has the other cores sat waiting in a loop near &0. Clearing RAM will inadvertantly break them out of this and most likely cause random crashes later on, so inbetween relocating the ROM and clearing RAM make sure we put the cores into a sleep loop in the HAL. Further mailbox writes can then be used to break them out of this loop, using a similar scheme to that used to break them out of the boot stub loop.
        hdr/BCM2835 - Add some register definitions from the BCM2836 docs
      Admin:
        Tested on Pi 2B, 3B
        Not currently dealing with kernel_old=1 case where all cores enter the ROM on startup
      
      
      Version 0.55. Tagged as 'BCM2835-0_55'
      56779d91
  28. 26 Mar, 2016 2 commits
    • Jeffrey Lee's avatar
      Fix SD card activity LED on Pi 3B · 3e87de33
      Jeffrey Lee authored
      Detail:
        hdr/BCM2835 - Remove mailbox definitions - use the ones exported by BCMSupport to avoid needless duplication
        hdr/StaticWS, s/Messaging, s/Top - Use the mailbox property interface to request & map in the virtual GPIO buffer (if present)
        s/SDIO - On the Pi 3B, the GPIO that was used for the SD activity GPIO is now used for a different purpose. To control the activity LED we need to go via an I2C attached GPIO extender, which itself is exposed to the ARM via the new "virtual GPIO" buffer
        s/VCHIQ - Update to use BCMSupport mailbox definitions
      Admin:
        Tested on Pi 1B, 3B
      
      
      Version 0.54. Tagged as 'BCM2835-0_54'
      3e87de33
    • Jeffrey Lee's avatar
      Fix constant under-voltage warnings on Pi 3 · be0775b6
      Jeffrey Lee authored
      Detail:
        s/IIC - Only adjust the pin mux settings for the pins + IIC controller which we're using, the other pins/controllers might be being used for another purpose (on Pi 3 GPIO0/SDA0 seems related to power control/under-voltage detection)
      Admin:
        Tested on Pi 3
        Fixes constant rainbow square (under-volt warning) shown by firmware and inability to scale clock speed above default
      
      
      Version 0.53. Tagged as 'BCM2835-0_53'
      be0775b6
  29. 25 Mar, 2016 1 commit
    • Jeffrey Lee's avatar
      Fix Pi 3 UART clock rate. Add HAL device for the GPU mailboxes. · c1a6cf63
      Jeffrey Lee authored
      Detail:
        s/Messaging - Ensure the PL011 UART module clock is set to 3MHz on startup, in order to allow the debug terminal to work
        hdr/StaticWS, s/Top - Add a basic HAL device to expose the GPU mailboxes
      Admin:
        Tested on Raspberry Pi 1B/2B/3B
        Fixes garbled debug terminal input/output on Pi 3
      
      
      Version 0.52. Tagged as 'BCM2835-0_52'
      c1a6cf63
  30. 08 Jan, 2016 1 commit
    • Jeffrey Lee's avatar
      Fix build error. Add HAL_PlatformName implementation. · 419bb1d2
      Jeffrey Lee authored
      Detail:
        s/Stubs, s/Top - Remove references to deleted HAL ATA calls
        s/GPIO, s/Top - Add implementation of HAL_PlatformName. Located in s/GPIO to allow easy re-use of the board revision table.
      Admin:
        Tested on Pi 2 Model B
      
      
      Version 0.51. Tagged as 'BCM2835-0_51'
      419bb1d2
  31. 15 Nov, 2015 1 commit
    • Jeffrey Lee's avatar
      Add basic HAL device for the official DSI display/touchscreen. Delete superfluous code. · 76db1228
      Jeffrey Lee authored
      Detail:
        Makefile, s/Touch - Basic HAL device for the official touchscreen, which just exposes the address of the buffer which the GPU periodically fills with a register dump of the touchscreen controller.
        hdr/BCM2835 - Remove old comment. Add new tag for getting the touchscreen buffer address.
        hdr/StaticWS - Remove old workspace entries. Add new entries for touchscreen.
        s/Messaging - Remove the messagebox tags which set a screen mode on startup (BCMVideo will handle that for us), and just blank the screen instead (to stop the GPU displaying a coloured square). Add tag to get the touchscreen buffer address.
        s/Top - Register touchscreen HAL device during HAL_InitDevices. Remove more old code.
      Admin:
        Tested on Raspberry Pi 1 B
      
      
      Version 0.50. Tagged as 'BCM2835-0_50'
      76db1228
  32. 08 Nov, 2015 1 commit
    • Ben Avison's avatar
      Compatibility with latest Pi firmware · 059ba08a
      Ben Avison authored
      Detail:
        * Recent versions of the firmware call the ROM's entry point in HYP mode
          (except for ARM11 boards which don't have it). Detect this eventuality
          and drop into SVC mode safely if so.
        * Whilst testing this fix, I discovered that occasionally, secondary CPUs
          seem to be being woken up, and start executing the ROM entry point also.
          This shouldn't be happening, but for safety's sake, I'm detecting this
          eventuality and putting any secondary CPUs into a sleep loop.
      Admin:
        Tested on Pi 1 and 2. Requires HdrSrc 2.56.
      
      Version 0.49. Tagged as 'BCM2835-0_49'
      059ba08a
  33. 29 Oct, 2015 1 commit
    • Robert Sprowson's avatar
      Build fix · e4b2b1fd
      Robert Sprowson authored
      Hdr:GPIODevice is already included via StaticWS.
      
      Version 0.48. Tagged as 'BCM2835-0_48'
      e4b2b1fd
  34. 14 Aug, 2015 1 commit
    • Jeffrey Lee's avatar
      Add extra memory barrier · fa58a55a
      Jeffrey Lee authored
      Detail:
        s/DMA - Although there are already plenty of memory barriers present to deal with the BCM2835's dodgy peripheral interface, code examination suggests one extra barrier is needed to make sure things will work correctly once the default NCB cache policy is Normal, non-cacheable rather than Device.
      Admin:
        Tested on Raspberry Pi 1
      
      
      Version 0.47. Tagged as 'BCM2835-0_47'
      fa58a55a