• Jeffrey Lee's avatar
    Fix PCI_RAMAlloc to be physically aligned · eca21ced
    Jeffrey Lee authored
    Detail:
      Although PCI_RAMAlloc claims to allocate blocks at the given alignment, both of the two implementations available (OS_Heap 7 and non-OS_Heap 7) perform the alignment and boundary checks using the logical address of the block. Most of the time this seems to work (few clients need anything greater than 4K page alignment), but for those clients that do need greater alignment, this can easily lead to failure.
      s/Memory - Change PCI_RAMAlloc implementation so that it ensures the block of memory it uses is aligned in both logical and physical spaces. Really it's only the physical alignment we care about, but for now the easiest/safest fix is to match the alignment and stick with the current logically-aligned allocation routines.
      s/GetAll, s/Interface, s/Memory - Use definitions from Hdr:OSMem where appropriate
    Admin:
      Tested on Raspberry Pi 3
      SMP module is now able to correctly get a 16K-aligned block for use as L1PT
      Note that skipping the first few pages of the area recommended by OS_Memory 12 does introduce the risk of non-aligned/non-contiguous areas being returned once the DA becomes close to full. But, for the case where the desired 32MB physically aligned block isn't available and we fall back to smaller block sizes, there's always been the danger that we'll start returning invalid blocks to the client (whether due to the client asking for an alignment we can't satisfy, or the DA exceeding the limits of the aligned area OS_Memory suggested to us)
    
    
    Version 0.15. Tagged as 'PCI-0_15'
    eca21ced
VersionASM 1009 Bytes