Hi All,

I having some trouble trying an experiment on the AARCH64 Base FVP with UEFI and
ARM Trusted Firmware. There is a buffer that is allocated by the latter in DRAM
with TZC-400 attributes that allow non-secure access. Its extents are made
available to a UEFI DXE driver through an SMC. AFAIU, it should be added to the
UEFI memory map/EL2 translation tables and subsequently allocated before it can
be used.

To add it to the memory map, I successfully call AddMemorySpace() GCD service as
follows:

 Status = gDS->AddMemorySpace(EfiGcdMemoryTypeSystemMemory,
                              (EFI_PHYSICAL_ADDRESS) mNsBufferAddress,
                              mNsBufferMaxSize,
                              EFI_MEMORY_WB | EFI_MEMORY_XP);

To allocate this buffer, I call AllocateMemorySpace GCD service immediately
after AddMemorySpace() as follows:

Status = gDS->AllocateMemorySpace(EfiGcdAllocateAddress,
                                  EfiGcdMemoryTypeSystemMemory,
                                  EFI_PAGE_SHIFT,
                                  mNsBufferMaxSize,
                                  (EFI_PHYSICAL_ADDRESS *) &mNsBufferAddress,
                                  ImageHandle,
                                  NULL);

The address of the buffer is 0xfbe00000 and size is 0x200000 i.e. it is aligned
to the page boundary. This call fails with EFI_NOT_FOUND. I am unable to figure
out what is going wrong. Am I using these interfaces in their intended way?

I have tried ignoring the error returned by AllocateMemorySpace(). This is under
the assumption that AddMemorySpace() must have added it to the translation
tables. So the buffer must be accessible even though it is not yet marked as
allocated. However, I eventually run into translation faults with this approach.

Can anyone provide some insight? Please let me know if you need any
clarifications.

Thanks a lot,
Achin

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to