VirtualBox

Changeset 102514 in vbox for trunk


Ignore:
Timestamp:
Dec 7, 2023 9:02:42 AM (14 months ago)
Author:
vboxsync
Message:

include/VBox/platforms/vbox-armv8.h: Allow setting a dedicated MMIO region which is below 4GiB in addition to the standard MMIO region which can be anywhere in the address space (will be required for PCI MEM32 BARs), bugref:10528

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/platforms/vbox-armv8.h

    r101435 r102514  
    7878    /** Size of the MMIO region in bytes, 0 if not available. */
    7979    uint64_t                    cbMmio;
     80    /** Offset backwards to the start of the MMIO32 region from the start of this descriptor, 0 if not available. */
     81    uint64_t                    u64OffBackMmio32;
     82    /** Size of the MMIO32 region in bytes, 0 if not available. */
     83    uint64_t                    cbMmio32;
    8084    /** Padding to 64KiB. */
    81     uint8_t                     abPadding[_64K - 4 * sizeof(uint32_t) - 10 * sizeof(uint64_t)];
     85    uint8_t                     abPadding[_64K - 4 * sizeof(uint32_t) - 12 * sizeof(uint64_t)];
    8286} VBOXPLATFORMARMV8;
    8387AssertCompileSize(VBOXPLATFORMARMV8, _64K);
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/Include/Library/VBoxArmPlatformLib.h

    r101432 r102514  
    127127UINTN EFIAPI VBoxArmPlatformMmioSizeGet(VOID);
    128128
     129
     130/**
     131 * Returns the physical address of the start of the MMIO32 region.
     132 *
     133 * @returns Physical address of the MMIO32 region start.
     134 */
     135EFI_PHYSICAL_ADDRESS EFIAPI VBoxArmPlatformMmio32StartGetPhysAddr(VOID);
     136
     137
     138/**
     139 * Returns the size of the MMIO32 region.
     140 *
     141 * @returns Size of the MMIO32 region.
     142 */
     143UINTN EFIAPI VBoxArmPlatformMmio32SizeGet(VOID);
     144
    129145#endif
    130146
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/Library/VBoxArmPlatformLib/VBoxArmPlatformLib.c

    r101434 r102514  
    148148    return pDesc->cbMmio;
    149149}
     150
     151
     152EFI_PHYSICAL_ADDRESS EFIAPI VBoxArmPlatformMmio32StartGetPhysAddr(VOID)
     153{
     154    PCVBOXPLATFORMARMV8 pDesc = (PCVBOXPLATFORMARMV8)VBoxArmPlatformDescGet();
     155    ASSERT(pDesc->u32Magic == VBOXPLATFORMARMV8_MAGIC);
     156
     157    if (!pDesc->cbMmio)
     158        return 0;
     159
     160    return (EFI_PHYSICAL_ADDRESS)((UINTN)pDesc - pDesc->u64OffBackMmio32);
     161}
     162
     163
     164UINTN EFIAPI VBoxArmPlatformMmio32SizeGet(VOID)
     165{
     166    PCVBOXPLATFORMARMV8 pDesc = (PCVBOXPLATFORMARMV8)VBoxArmPlatformDescGet();
     167    ASSERT(pDesc->u32Magic == VBOXPLATFORMARMV8_MAGIC);
     168
     169    return pDesc->cbMmio32;
     170}
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/Library/VBoxVirtMemInfoLib/VBoxVirtMemInfoLib.c

    r101434 r102514  
    4646
    4747// Number of Virtual Memory Map Descriptors
    48 #define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS  6
     48#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS  7
    4949
    5050/**
     
    126126  VirtualMemoryTable[3].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_RO;
    127127
    128   // Map the VBox descriptor region readonnly.
     128  // Map the VBox descriptor region readonly.
    129129  VirtualMemoryTable[4].PhysicalBase = VBoxArmPlatformDescGetPhysAddr();
    130130  VirtualMemoryTable[4].VirtualBase  = VirtualMemoryTable[4].PhysicalBase;
     
    132132  VirtualMemoryTable[4].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_RO;
    133133
     134  // Map the MMIO32 region if it exists.
     135  if (VBoxArmPlatformMmio32SizeGet() != 0)
     136  {
     137    VirtualMemoryTable[5].PhysicalBase = VBoxArmPlatformMmio32StartGetPhysAddr();
     138    VirtualMemoryTable[5].VirtualBase  = VirtualMemoryTable[5].PhysicalBase;
     139    VirtualMemoryTable[5].Length       = VBoxArmPlatformMmio32SizeGet();
     140    VirtualMemoryTable[5].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
     141  }
     142
    134143  // End of Table
    135   ZeroMem (&VirtualMemoryTable[5], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));
     144  ZeroMem (&VirtualMemoryTable[6], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));
    136145
    137146  for (UINTN i = 0; i < MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS; i++)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette