36 ZeroMem (&SdMmcCmdBlk,
sizeof (SdMmcCmdBlk));
37 ZeroMem (&SdMmcStatusBlk,
sizeof (SdMmcStatusBlk));
38 ZeroMem (&Packet,
sizeof (Packet));
40 Packet.SdMmcCmdBlk = &SdMmcCmdBlk;
41 Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
42 Packet.Timeout = SD_MMC_HC_GENERIC_TIMEOUT;
44 SdMmcCmdBlk.CommandIndex = EMMC_GO_IDLE_STATE;
45 SdMmcCmdBlk.CommandType = SdMmcCommandTypeBc;
46 SdMmcCmdBlk.ResponseType = 0;
47 SdMmcCmdBlk.CommandArgument = 0;
74 IN OUT UINT32 *Argument
82 ZeroMem (&SdMmcCmdBlk,
sizeof (SdMmcCmdBlk));
83 ZeroMem (&SdMmcStatusBlk,
sizeof (SdMmcStatusBlk));
84 ZeroMem (&Packet,
sizeof (Packet));
86 Packet.SdMmcCmdBlk = &SdMmcCmdBlk;
87 Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
88 Packet.Timeout = SD_MMC_HC_GENERIC_TIMEOUT;
90 SdMmcCmdBlk.CommandIndex = EMMC_SEND_OP_COND;
91 SdMmcCmdBlk.CommandType = SdMmcCommandTypeBcr;
92 SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR3;
93 SdMmcCmdBlk.CommandArgument = *Argument;
96 if (!EFI_ERROR (Status)) {
100 *Argument = SdMmcStatusBlk.Resp0;
130 ZeroMem (&SdMmcCmdBlk,
sizeof (SdMmcCmdBlk));
131 ZeroMem (&SdMmcStatusBlk,
sizeof (SdMmcStatusBlk));
132 ZeroMem (&Packet,
sizeof (Packet));
134 Packet.SdMmcCmdBlk = &SdMmcCmdBlk;
135 Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
136 Packet.Timeout = SD_MMC_HC_GENERIC_TIMEOUT;
138 SdMmcCmdBlk.CommandIndex = EMMC_ALL_SEND_CID;
139 SdMmcCmdBlk.CommandType = SdMmcCommandTypeBcr;
140 SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR2;
141 SdMmcCmdBlk.CommandArgument = 0;
174 ZeroMem (&SdMmcCmdBlk,
sizeof (SdMmcCmdBlk));
175 ZeroMem (&SdMmcStatusBlk,
sizeof (SdMmcStatusBlk));
176 ZeroMem (&Packet,
sizeof (Packet));
178 Packet.SdMmcCmdBlk = &SdMmcCmdBlk;
179 Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
180 Packet.Timeout = SD_MMC_HC_GENERIC_TIMEOUT;
182 SdMmcCmdBlk.CommandIndex = EMMC_SET_RELATIVE_ADDR;
183 SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
184 SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
185 SdMmcCmdBlk.CommandArgument = (UINT32)Rca << 16;
222 ZeroMem (&SdMmcCmdBlk,
sizeof (SdMmcCmdBlk));
223 ZeroMem (&SdMmcStatusBlk,
sizeof (SdMmcStatusBlk));
224 ZeroMem (&Packet,
sizeof (Packet));
226 Packet.SdMmcCmdBlk = &SdMmcCmdBlk;
227 Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
228 Packet.Timeout = SD_MMC_HC_GENERIC_TIMEOUT;
230 SdMmcCmdBlk.CommandIndex = EMMC_SEND_CSD;
231 SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
232 SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR2;
233 SdMmcCmdBlk.CommandArgument = (UINT32)Rca << 16;
236 if (!EFI_ERROR (Status)) {
240 CopyMem (((UINT8 *)Csd) + 1, &SdMmcStatusBlk.Resp0, sizeof (
EMMC_CSD) - 1);
271 ZeroMem (&SdMmcCmdBlk,
sizeof (SdMmcCmdBlk));
272 ZeroMem (&SdMmcStatusBlk,
sizeof (SdMmcStatusBlk));
273 ZeroMem (&Packet,
sizeof (Packet));
275 Packet.SdMmcCmdBlk = &SdMmcCmdBlk;
276 Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
277 Packet.Timeout = SD_MMC_HC_GENERIC_TIMEOUT;
279 SdMmcCmdBlk.CommandIndex = EMMC_SELECT_DESELECT_CARD;
280 SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
281 SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
282 SdMmcCmdBlk.CommandArgument = (UINT32)Rca << 16;
314 ZeroMem (&SdMmcCmdBlk,
sizeof (SdMmcCmdBlk));
315 ZeroMem (&SdMmcStatusBlk,
sizeof (SdMmcStatusBlk));
316 ZeroMem (&Packet,
sizeof (Packet));
318 Packet.SdMmcCmdBlk = &SdMmcCmdBlk;
319 Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
320 Packet.Timeout = SD_MMC_HC_GENERIC_TIMEOUT;
322 SdMmcCmdBlk.CommandIndex = EMMC_SEND_EXT_CSD;
323 SdMmcCmdBlk.CommandType = SdMmcCommandTypeAdtc;
324 SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
325 SdMmcCmdBlk.CommandArgument = 0x00000000;
327 Packet.InDataBuffer = ExtCsd;
366 ZeroMem (&SdMmcCmdBlk,
sizeof (SdMmcCmdBlk));
367 ZeroMem (&SdMmcStatusBlk,
sizeof (SdMmcStatusBlk));
368 ZeroMem (&Packet,
sizeof (Packet));
370 Packet.SdMmcCmdBlk = &SdMmcCmdBlk;
371 Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
372 Packet.Timeout = SD_MMC_HC_GENERIC_TIMEOUT;
374 SdMmcCmdBlk.CommandIndex = EMMC_SWITCH;
375 SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
376 SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1b;
377 SdMmcCmdBlk.CommandArgument = (Access << 24) | (Index << 16) | (Value << 8) | CmdSet;
403 OUT UINT32 *DevStatus
411 ZeroMem (&SdMmcCmdBlk,
sizeof (SdMmcCmdBlk));
412 ZeroMem (&SdMmcStatusBlk,
sizeof (SdMmcStatusBlk));
413 ZeroMem (&Packet,
sizeof (Packet));
415 Packet.SdMmcCmdBlk = &SdMmcCmdBlk;
416 Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
417 Packet.Timeout = SD_MMC_HC_GENERIC_TIMEOUT;
419 SdMmcCmdBlk.CommandIndex = EMMC_SEND_STATUS;
420 SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc;
421 SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
422 SdMmcCmdBlk.CommandArgument = (UINT32)Rca << 16;
425 if (!EFI_ERROR (Status)) {
426 *DevStatus = SdMmcStatusBlk.Resp0;
459 UINT8 TuningBlock[128];
461 ZeroMem (&SdMmcCmdBlk,
sizeof (SdMmcCmdBlk));
462 ZeroMem (&SdMmcStatusBlk,
sizeof (SdMmcStatusBlk));
463 ZeroMem (&Packet,
sizeof (Packet));
465 Packet.SdMmcCmdBlk = &SdMmcCmdBlk;
466 Packet.SdMmcStatusBlk = &SdMmcStatusBlk;
467 Packet.Timeout = SD_MMC_HC_GENERIC_TIMEOUT;
469 SdMmcCmdBlk.CommandIndex = EMMC_SEND_TUNING_BLOCK;
470 SdMmcCmdBlk.CommandType = SdMmcCommandTypeAdtc;
471 SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1;
472 SdMmcCmdBlk.CommandArgument = 0;
474 Packet.InDataBuffer = TuningBlock;
476 Packet.InTransferLength =
sizeof (TuningBlock);
478 Packet.InTransferLength = 64;
520 Status =
SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2,
sizeof (HostCtrl2), &HostCtrl2);
521 if (EFI_ERROR (Status)) {
531 if (EFI_ERROR (Status)) {
532 DEBUG ((DEBUG_ERROR,
"EmmcTuningClkForHs200: Send tuning block fails with %r\n", Status));
536 Status =
SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2,
TRUE,
sizeof (HostCtrl2), &HostCtrl2);
537 if (EFI_ERROR (Status)) {
541 if ((HostCtrl2 & (BIT6 | BIT7)) == 0) {
545 if ((HostCtrl2 & (BIT6 | BIT7)) == BIT7) {
548 }
while (++Retry < 40);
550 DEBUG ((DEBUG_ERROR,
"EmmcTuningClkForHs200: Send tuning block fails at %d times with HostCtrl2 %02x\n", Retry, HostCtrl2));
554 HostCtrl2 = (UINT8) ~(BIT6 | BIT7);
555 Status =
SdMmcHcAndMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2,
sizeof (HostCtrl2), &HostCtrl2);
556 if (EFI_ERROR (Status)) {
560 return EFI_DEVICE_ERROR;
584 if (EFI_ERROR (Status)) {
585 DEBUG ((DEBUG_ERROR,
"EmmcCheckSwitchStatus: Send status fails with %r\n", Status));
592 if ((DevStatus & BIT7) != 0) {
593 DEBUG ((DEBUG_ERROR,
"EmmcCheckSwitchStatus: The switch operation fails as DevStatus is 0x%08x\n", DevStatus));
594 return EFI_DEVICE_ERROR;
641 }
else if (BusWidth == 8) {
644 return EFI_INVALID_PARAMETER;
652 Status =
EmmcSwitch (PassThru, Slot, Access, Index, Value, CmdSet);
653 if (EFI_ERROR (Status)) {
654 DEBUG ((DEBUG_ERROR,
"EmmcSwitchBusWidth: Switch to bus width %d fails with %r\n", BusWidth, Status));
659 if (EFI_ERROR (Status)) {
693 IN SD_MMC_BUS_MODE BusTiming,
704 BOOLEAN DelaySendStatus;
706 Private = SD_MMC_HC_PRIVATE_FROM_THIS (PassThru);
715 Value = (UINT8)((DriverStrength.Emmc << 4) | 3);
718 Value = (UINT8)((DriverStrength.Emmc << 4) | 2);
728 DEBUG ((DEBUG_ERROR,
"EmmcSwitchBusTiming: Unsupported BusTiming(%d)\n", BusTiming));
729 return EFI_INVALID_PARAMETER;
732 Status =
EmmcSwitch (PassThru, Slot, Access, Index, Value, CmdSet);
733 if (EFI_ERROR (Status)) {
734 DEBUG ((DEBUG_ERROR,
"EmmcSwitchBusTiming: Switch to bus timing %d fails with %r\n", BusTiming, Status));
738 if ((BusTiming == SdMmcMmcHsSdr) || (BusTiming == SdMmcMmcHsDdr)) {
740 Status =
SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL1,
sizeof (HostCtrl1), &HostCtrl1);
741 if (EFI_ERROR (Status)) {
745 HostCtrl1 = (UINT8) ~BIT2;
746 Status =
SdMmcHcAndMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL1,
sizeof (HostCtrl1), &HostCtrl1);
747 if (EFI_ERROR (Status)) {
753 if (EFI_ERROR (Status)) {
767 if (Private->Slot[Slot].CurrentFreq < (ClockFreq * 1000)) {
769 if (EFI_ERROR (Status)) {
773 DelaySendStatus =
FALSE;
775 DelaySendStatus =
TRUE;
782 if (EFI_ERROR (Status)) {
786 if (DelaySendStatus) {
788 if (EFI_ERROR (Status)) {
824 if (((BusMode->BusTiming != SdMmcMmcHsSdr) && (BusMode->BusTiming != SdMmcMmcHsDdr) && (BusMode->BusTiming != SdMmcMmcLegacy)) ||
825 (BusMode->ClockFreq > 52))
827 return EFI_INVALID_PARAMETER;
830 if (BusMode->BusTiming == SdMmcMmcHsDdr) {
837 if (EFI_ERROR (Status)) {
841 return EmmcSwitchBusTiming (PciIo, PassThru, Slot, Rca, BusMode->DriverStrength, BusMode->BusTiming, BusMode->ClockFreq);
871 if ((BusMode->BusTiming != SdMmcMmcHs200) ||
872 ((BusMode->BusWidth != 4) && (BusMode->BusWidth != 8)))
874 return EFI_INVALID_PARAMETER;
878 if (EFI_ERROR (Status)) {
882 Status =
EmmcSwitchBusTiming (PciIo, PassThru, Slot, Rca, BusMode->DriverStrength, BusMode->BusTiming, BusMode->ClockFreq);
883 if (EFI_ERROR (Status)) {
921 if ((BusMode->BusTiming != SdMmcMmcHs400) ||
922 (BusMode->BusWidth != 8))
924 return EFI_INVALID_PARAMETER;
927 Hs200BusMode.BusTiming = SdMmcMmcHs200;
928 Hs200BusMode.BusWidth = BusMode->BusWidth;
929 Hs200BusMode.ClockFreq = BusMode->ClockFreq;
930 Hs200BusMode.DriverStrength = BusMode->DriverStrength;
933 if (EFI_ERROR (Status)) {
941 HsFreq = BusMode->ClockFreq < 52 ? BusMode->ClockFreq : 52;
942 Status =
EmmcSwitchBusTiming (PciIo, PassThru, Slot, Rca, BusMode->DriverStrength, SdMmcMmcHsSdr, HsFreq);
943 if (EFI_ERROR (Status)) {
948 if (EFI_ERROR (Status)) {
952 return EmmcSwitchBusTiming (PciIo, PassThru, Slot, Rca, BusMode->DriverStrength, BusMode->BusTiming, BusMode->ClockFreq);
971 IN SD_MMC_BUS_MODE BusTiming
977 Capabilities = &Private->Capability[SlotIndex];
982 if ((((ExtCsd->DeviceType & (BIT6 | BIT7)) != 0) && (Capabilities->Hs400 != 0)) && (Capabilities->BusWidth8 != 0)) {
988 if ((((ExtCsd->DeviceType & (BIT4 | BIT5)) != 0) && (Capabilities->Sdr104 != 0))) {
994 if ((((ExtCsd->DeviceType & (BIT2 | BIT3)) != 0) && (Capabilities->Ddr50 != 0))) {
1000 if ((((ExtCsd->DeviceType & BIT1) != 0) && (Capabilities->HighSpeed != 0))) {
1005 case SdMmcMmcLegacy:
1006 if ((ExtCsd->DeviceType & BIT0) != 0) {
1036 SD_MMC_BUS_MODE BusTiming;
1042 BusTiming = SdMmcMmcHs400;
1043 while (BusTiming > SdMmcMmcLegacy) {
1069 IN SD_MMC_BUS_MODE BusTiming,
1073 if ((BusWidth == 8) && (Private->Capability[SlotIndex].BusWidth8 != 0)) {
1075 }
else if ((BusWidth == 4) && (BusTiming != SdMmcMmcHs400)) {
1077 }
else if ((BusWidth == 1) && ((BusTiming == SdMmcMmcHsSdr) || (BusTiming == SdMmcMmcLegacy))) {
1099 IN SD_MMC_BUS_MODE BusTiming
1103 UINT8 PreferredBusWidth;
1105 PreferredBusWidth = Private->Slot[SlotIndex].OperatingParameters.BusWidth;
1107 if ((PreferredBusWidth != EDKII_SD_MMC_BUS_WIDTH_IGNORE) &&
1110 BusWidth = PreferredBusWidth;
1137 IN SD_MMC_BUS_MODE BusTiming
1140 UINT32 PreferredClockFreq;
1141 UINT32 MaxClockFreq;
1143 PreferredClockFreq = Private->Slot[SlotIndex].OperatingParameters.ClockFreq;
1145 switch (BusTiming) {
1159 if ((PreferredClockFreq != EDKII_SD_MMC_CLOCK_FREQ_IGNORE) && (PreferredClockFreq < MaxClockFreq)) {
1160 return PreferredClockFreq;
1162 return MaxClockFreq;
1181 IN SD_MMC_BUS_MODE BusTiming
1187 PreferredDriverStrength = Private->Slot[SlotIndex].OperatingParameters.DriverStrength;
1188 DriverStrength.Emmc = EmmcDriverStrengthType0;
1190 if ((PreferredDriverStrength.Emmc != EDKII_SD_MMC_DRIVER_STRENGTH_IGNORE) &&
1191 (ExtCsd->DriverStrength & (BIT0 << PreferredDriverStrength.Emmc)))
1193 DriverStrength.Emmc = PreferredDriverStrength.Emmc;
1196 return DriverStrength;
1250 Private = SD_MMC_HC_PRIVATE_FROM_THIS (PassThru);
1252 Status =
EmmcGetCsd (PassThru, Slot, Rca, &Csd);
1253 if (EFI_ERROR (Status)) {
1254 DEBUG ((DEBUG_ERROR,
"EmmcSetBusMode: GetCsd fails with %r\n", Status));
1259 if (EFI_ERROR (Status)) {
1260 DEBUG ((DEBUG_ERROR,
"EmmcSetBusMode: Select fails with %r\n", Status));
1264 ASSERT (Private->BaseClkFreq[Slot] != 0);
1270 if (EFI_ERROR (Status)) {
1271 DEBUG ((DEBUG_ERROR,
"EmmcSetBusMode: GetExtCsd fails with %r\n", Status));
1279 "EmmcSetBusMode: Target bus mode: timing = %d, width = %d, clock freq = %d, driver strength = %d\n",
1283 BusMode.DriverStrength.Emmc
1286 if (BusMode.BusTiming == SdMmcMmcHs400) {
1288 }
else if (BusMode.BusTiming == SdMmcMmcHs200) {
1300 DEBUG ((DEBUG_INFO,
"EmmcSetBusMode: Switch to %a %r\n", (BusMode.BusTiming == SdMmcMmcHs400) ?
"HS400" : ((BusMode.BusTiming == SdMmcMmcHs200) ?
"HS200" :
"HighSpeed"), Status));
1330 PciIo = Private->PciIo;
1331 PassThru = &Private->PassThru;
1334 if (EFI_ERROR (Status)) {
1335 DEBUG ((DEBUG_VERBOSE,
"EmmcIdentification: Executing Cmd0 fails with %r\n", Status));
1343 if (EFI_ERROR (Status)) {
1344 DEBUG ((DEBUG_VERBOSE,
"EmmcIdentification: Executing Cmd1 fails with %r\n", Status));
1350 if (Retry++ == 100) {
1351 DEBUG ((DEBUG_VERBOSE,
"EmmcIdentification: Executing Cmd1 fails too many times\n"));
1352 return EFI_DEVICE_ERROR;
1355 gBS->Stall (10 * 1000);
1356 }
while ((Ocr & BIT31) == 0);
1359 if (EFI_ERROR (Status)) {
1360 DEBUG ((DEBUG_VERBOSE,
"EmmcIdentification: Executing Cmd2 fails with %r\n", Status));
1372 if (EFI_ERROR (Status)) {
1373 DEBUG ((DEBUG_ERROR,
"EmmcIdentification: Executing Cmd3 fails with %r\n", Status));
1380 DEBUG ((DEBUG_INFO,
"EmmcIdentification: Found a EMMC device at slot [%d], RCA [%d]\n", Slot, Rca));
1381 Private->Slot[Slot].CardType = EmmcCardType;
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_STATUS EmmcSwitchBusWidth(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, IN BOOLEAN IsDdr, IN UINT8 BusWidth)
BOOLEAN EmmcIsBusTimingSupported(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN EMMC_EXT_CSD *ExtCsd, IN SD_MMC_BUS_MODE BusTiming)
EFI_STATUS EmmcSendStatus(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, OUT UINT32 *DevStatus)
EFI_STATUS EmmcCheckSwitchStatus(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca)
EFI_STATUS EmmcSetBusMode(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca)
EFI_STATUS EmmcSwitchToHS200(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, IN SD_MMC_BUS_SETTINGS *BusMode)
EFI_STATUS EmmcGetExtCsd(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, OUT EMMC_EXT_CSD *ExtCsd)
EFI_STATUS EmmcSwitchToHighSpeed(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, IN SD_MMC_BUS_SETTINGS *BusMode)
EFI_STATUS EmmcSetRca(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca)
EDKII_SD_MMC_DRIVER_STRENGTH EmmcGetTargetDriverStrength(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN EMMC_EXT_CSD *ExtCsd, IN SD_MMC_BUS_MODE BusTiming)
EFI_STATUS EmmcGetOcr(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN OUT UINT32 *Argument)
UINT32 EmmcGetTargetClockFreq(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN EMMC_EXT_CSD *ExtCsd, IN SD_MMC_BUS_MODE BusTiming)
EFI_STATUS EmmcSendTuningBlk(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT8 BusWidth)
UINT8 EmmcGetTargetBusWidth(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN EMMC_EXT_CSD *ExtCsd, IN SD_MMC_BUS_MODE BusTiming)
BOOLEAN EmmcIsBusWidthSupported(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN SD_MMC_BUS_MODE BusTiming, IN UINT16 BusWidth)
EFI_STATUS EmmcGetAllCid(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot)
EFI_STATUS EmmcIdentification(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 Slot)
EFI_STATUS EmmcSelect(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca)
EFI_STATUS EmmcReset(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot)
SD_MMC_BUS_MODE EmmcGetTargetBusTiming(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN EMMC_EXT_CSD *ExtCsd)
EFI_STATUS EmmcSwitch(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT8 Access, IN UINT8 Index, IN UINT8 Value, IN UINT8 CmdSet)
EFI_STATUS EmmcTuningClkForHs200(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT8 BusWidth)
EFI_STATUS EmmcSwitchToHS400(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, IN SD_MMC_BUS_SETTINGS *BusMode)
EFI_STATUS EmmcSwitchBusTiming(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, IN EDKII_SD_MMC_DRIVER_STRENGTH DriverStrength, IN SD_MMC_BUS_MODE BusTiming, IN UINT32 ClockFreq)
VOID EmmcGetTargetBusMode(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN EMMC_EXT_CSD *ExtCsd, OUT SD_MMC_BUS_SETTINGS *BusMode)
EFI_STATUS EmmcGetCsd(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, OUT EMMC_CSD *Csd)
#define OFFSET_OF(TYPE, Field)
#define DEBUG(Expression)
EFI_STATUS EFIAPI SdMmcPassThruPassThru(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This, IN UINT8 Slot, IN OUT EFI_SD_MMC_PASS_THRU_COMMAND_PACKET *Packet, IN EFI_EVENT Event OPTIONAL)
EFI_STATUS SdMmcHcClockSupply(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 Slot, IN SD_MMC_BUS_MODE BusTiming, IN BOOLEAN FirstTimeSetup, IN UINT64 ClockFreq)
EFI_STATUS EFIAPI SdMmcHcRwMmio(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 BarIndex, IN UINT32 Offset, IN BOOLEAN Read, IN UINT8 Count, IN OUT VOID *Data)
EFI_STATUS SdMmcHcUhsSignaling(IN EFI_HANDLE ControllerHandle, IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Slot, IN SD_MMC_BUS_MODE Timing)
EFI_STATUS EFIAPI SdMmcHcAndMmio(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 BarIndex, IN UINT32 Offset, IN UINT8 Count, IN VOID *AndData)
EFI_STATUS SdMmcHcSetBusWidth(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Slot, IN UINT16 BusWidth)
EFI_STATUS EFIAPI SdMmcHcOrMmio(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 BarIndex, IN UINT32 Offset, IN UINT8 Count, IN VOID *OrData)