/* In Tdx guest there are 2 ways to access mmio, TdVmcall or direct access. For direct access, the shared bit of the PageTableEntry should be set. The mmio region information is retrieved from hob list. */
EFI_STATUS SetMmioSharedBit(VOID)
/* In Tdx guest there are 2 ways to access mmio, TdVmcall or direct access. For direct access, the shared bit of the PageTableEntry should be set. The mmio region information is retrieved from hob list. */
EFI_STATUS SetMmioSharedBit(VOID)
{
  EFI_PEI_HOB_POINTERS  Hob;
  Hob.Raw = (UINT8 *)GetHobList ();
  while (!END_OF_HOB_LIST (Hob)) {
    if (  (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR)
       && (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_MAPPED_IO))
    {
      MemEncryptTdxSetPageSharedBit (
        0,
        Hob.ResourceDescriptor->PhysicalStart,
        EFI_SIZE_TO_PAGES (Hob.ResourceDescriptor->ResourceLength)
        );
    }
    Hob.Raw = GET_NEXT_HOB (Hob);
  }
  return EFI_SUCCESS;
}