/* Check if the env is ready for execute specified TRB. */
EFI_STATUS EmmcPeimCheckTrbEnv(IN UINTN Bar, IN EMMC_TRB *Trb)
/* Check if the env is ready for execute specified TRB. */
EFI_STATUS EmmcPeimCheckTrbEnv(IN UINTN Bar, IN EMMC_TRB *Trb)
{
  EFI_STATUS           Status;
  EMMC_COMMAND_PACKET  *Packet;
  UINT32               PresentState;
  Packet = Trb->Packet;
  if ((Packet->EmmcCmdBlk->CommandType == EmmcCommandTypeAdtc) ||
      (Packet->EmmcCmdBlk->ResponseType == EmmcResponceTypeR1b) ||
      (Packet->EmmcCmdBlk->ResponseType == EmmcResponceTypeR5b))
  {
    PresentState = BIT0 | BIT1;
  } else {
    PresentState = BIT0;
  }
  Status = EmmcPeimHcCheckMmioSet (
             Bar + EMMC_HC_PRESENT_STATE,
             sizeof (PresentState),
             PresentState,
             0
             );
  return Status;
}