/* Get the base address and size for the NV storage area used for UEFI variable storage. */
EFI_STATUS EFIAPI GetVariableFlashNvStorageInfo(OUT EFI_PHYSICAL_ADDRESS *BaseAddress, OUT UINT64 *Length)
/* Get the base address and size for the NV storage area used for UEFI variable storage. */
EFI_STATUS EFIAPI GetVariableFlashNvStorageInfo(OUT EFI_PHYSICAL_ADDRESS *BaseAddress, OUT UINT64 *Length)
{
  EFI_STATUS           Status;
  VARIABLE_FLASH_INFO  *VariableFlashInfo;
  if ((BaseAddress == NULL) || (Length == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  Status = GetVariableFlashInfoFromHob (&VariableFlashInfo);
  if (!EFI_ERROR (Status)) {
    *BaseAddress = VariableFlashInfo->NvVariableBaseAddress;
    *Length      = VariableFlashInfo->NvVariableLength;
  } else {
    *BaseAddress = (EFI_PHYSICAL_ADDRESS)(PcdGet64 (PcdFlashNvStorageVariableBase64) != 0 ?
                                          PcdGet64 (PcdFlashNvStorageVariableBase64) :
                                          PcdGet32 (PcdFlashNvStorageVariableBase)
                                          );
    *Length = (UINT64)PcdGet32 (PcdFlashNvStorageVariableSize);
  }
  return EFI_SUCCESS;
}