EmbeddedPkg: Change use of EFI_D_* to DEBUG_*

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3739

Update all use of EFI_D_* defines in DEBUG() macros to DEBUG_* defines.

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
Michael D Kinney 2021-11-16 19:21:20 -08:00 committed by mergify[bot]
parent c5b3a56e4f
commit a1878955b2
15 changed files with 170 additions and 179 deletions

View File

@ -161,7 +161,7 @@ HandleFlash (
} else if (EFI_ERROR (Status)) {
SEND_LITERAL ("FAILError flashing partition.");
mTextOut->OutputString (mTextOut, L"Error flashing partition.\r\n");
DEBUG ((EFI_D_ERROR, "Couldn't flash image: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Couldn't flash image: %r\n", Status));
} else {
mTextOut->OutputString (mTextOut, L"Done.\r\n");
SEND_LITERAL ("OKAY");
@ -184,7 +184,7 @@ HandleErase (
Status = mPlatform->ErasePartition (PartitionName);
if (EFI_ERROR (Status)) {
SEND_LITERAL ("FAILCheck device console.");
DEBUG ((EFI_D_ERROR, "Couldn't erase image: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Couldn't erase image: %r\n", Status));
} else {
SEND_LITERAL ("OKAY");
}
@ -212,7 +212,7 @@ HandleBoot (
Status = BootAndroidBootImg (mNumDataBytes, mDataBuffer);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Failed to boot downloaded image: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Failed to boot downloaded image: %r\n", Status));
}
// We shouldn't get here
}
@ -286,13 +286,13 @@ AcceptCmd (
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
// Shouldn't get here
DEBUG ((EFI_D_ERROR, "Fastboot: gRT->ResetSystem didn't work\n"));
DEBUG ((DEBUG_ERROR, "Fastboot: gRT->ResetSystem didn't work\n"));
} else if (MATCH_CMD_LITERAL ("powerdown", Command)) {
SEND_LITERAL ("OKAY");
gRT->ResetSystem (EfiResetShutdown, EFI_SUCCESS, 0, NULL);
// Shouldn't get here
DEBUG ((EFI_D_ERROR, "Fastboot: gRT->ResetSystem didn't work\n"));
DEBUG ((DEBUG_ERROR, "Fastboot: gRT->ResetSystem didn't work\n"));
} else if (MATCH_CMD_LITERAL ("oem", Command)) {
// The "oem" command isn't in the specification, but it was observed in the
// wild, followed by a space, followed by the actual command.
@ -430,25 +430,25 @@ FastbootAppEntryPoint (
(VOID **) &mTransport
);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Fastboot: Couldn't open Fastboot Transport Protocol: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Fastboot: Couldn't open Fastboot Transport Protocol: %r\n", Status));
return Status;
}
Status = gBS->LocateProtocol (&gAndroidFastbootPlatformProtocolGuid, NULL, (VOID **) &mPlatform);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Fastboot: Couldn't open Fastboot Platform Protocol: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Fastboot: Couldn't open Fastboot Platform Protocol: %r\n", Status));
return Status;
}
Status = mPlatform->Init ();
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Fastboot: Couldn't initialise Fastboot Platform Protocol: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Fastboot: Couldn't initialise Fastboot Platform Protocol: %r\n", Status));
return Status;
}
Status = gBS->LocateProtocol (&gEfiSimpleTextOutProtocolGuid, NULL, (VOID **) &mTextOut);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR,
DEBUG ((DEBUG_ERROR,
"Fastboot: Couldn't open Text Output Protocol: %r\n", Status
));
return Status;
@ -456,14 +456,14 @@ FastbootAppEntryPoint (
Status = gBS->LocateProtocol (&gEfiSimpleTextInProtocolGuid, NULL, (VOID **) &TextIn);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Fastboot: Couldn't open Text Input Protocol: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Fastboot: Couldn't open Text Input Protocol: %r\n", Status));
return Status;
}
// Disable watchdog
Status = gBS->SetWatchdogTimer (0, 0x10000, 0, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Fastboot: Couldn't disable watchdog timer: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Fastboot: Couldn't disable watchdog timer: %r\n", Status));
}
// Create event for receipt of data from the host
@ -497,7 +497,7 @@ FastbootAppEntryPoint (
ReceiveEvent
);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Fastboot: Couldn't start transport: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Fastboot: Couldn't start transport: %r\n", Status));
return Status;
}
@ -521,7 +521,7 @@ FastbootAppEntryPoint (
mTransport->Stop ();
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Warning: Fastboot Transport Stop: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Warning: Fastboot Transport Stop: %r\n", Status));
}
mPlatform->UnInit ();

View File

@ -162,14 +162,14 @@ BootAndroidBootImg (
StrSize (LoadOptions),
LoadOptions);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Couldn't Boot Linux: %d\n", Status));
DEBUG ((DEBUG_ERROR, "Couldn't Boot Linux: %d\n", Status));
Status = EFI_DEVICE_ERROR;
goto FreeLoadOptions;
}
// If we got here we do a confused face because BootLinuxFdt returned,
// reporting success.
DEBUG ((EFI_D_ERROR, "WARNING: BdsBootLinuxFdt returned EFI_SUCCESS.\n"));
DEBUG ((DEBUG_ERROR, "WARNING: BdsBootLinuxFdt returned EFI_SUCCESS.\n"));
return EFI_SUCCESS;
FreeLoadOptions:

View File

@ -99,7 +99,7 @@ SubmitRecieveToken (
FragmentBuffer = AllocatePool (RX_FRAGMENT_SIZE);
ASSERT (FragmentBuffer != NULL);
if (FragmentBuffer == NULL) {
DEBUG ((EFI_D_ERROR, "TCP Fastboot out of resources"));
DEBUG ((DEBUG_ERROR, "TCP Fastboot out of resources"));
return EFI_OUT_OF_RESOURCES;
}
@ -109,7 +109,7 @@ SubmitRecieveToken (
Status = mTcpConnection->Receive (mTcpConnection, &mReceiveToken[mNextSubmitIndex]);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "TCP Receive: %r\n", Status));
DEBUG ((DEBUG_ERROR, "TCP Receive: %r\n", Status));
FreePool (FragmentBuffer);
}
@ -140,7 +140,7 @@ ConnectionClosed (
Status = mTcpListener->Accept (mTcpListener, &mAcceptToken);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "TCP Accept: %r\n", Status));
DEBUG ((DEBUG_ERROR, "TCP Accept: %r\n", Status));
}
}
@ -195,7 +195,7 @@ DataReceived (
NewEntry = AllocatePool (sizeof (FASTBOOT_TCP_PACKET_LIST));
if (NewEntry == NULL) {
DEBUG ((EFI_D_ERROR, "TCP Fastboot: Out of resources\n"));
DEBUG ((DEBUG_ERROR, "TCP Fastboot: Out of resources\n"));
return;
}
@ -215,7 +215,7 @@ DataReceived (
NewEntry->Buffer = NULL;
NewEntry->BufferSize = 0;
DEBUG ((EFI_D_ERROR, "\nTCP Fastboot Receive error: %r\n", Status));
DEBUG ((DEBUG_ERROR, "\nTCP Fastboot Receive error: %r\n", Status));
}
InsertTailList (&mPacketListHead, &NewEntry->Link);
@ -244,10 +244,10 @@ ConnectionAccepted (
Status = AcceptToken->CompletionToken.Status;
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "TCP Fastboot: Connection Error: %r\n", Status));
DEBUG ((DEBUG_ERROR, "TCP Fastboot: Connection Error: %r\n", Status));
return;
}
DEBUG ((EFI_D_ERROR, "TCP Fastboot: Connection Received.\n"));
DEBUG ((DEBUG_ERROR, "TCP Fastboot: Connection Received.\n"));
//
// Accepting a new TCP connection creates a new instance of the TCP protocol.
@ -263,7 +263,7 @@ ConnectionAccepted (
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Open TCP Connection: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Open TCP Connection: %r\n", Status));
return;
}
@ -335,7 +335,7 @@ TcpFastbootTransportStart (
&HandleBuffer
);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Find TCP Service Binding: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Find TCP Service Binding: %r\n", Status));
return Status;
}
@ -351,13 +351,13 @@ TcpFastbootTransportStart (
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Open TCP Service Binding: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Open TCP Service Binding: %r\n", Status));
return Status;
}
Status = mTcpServiceBinding->CreateChild (mTcpServiceBinding, &mTcpHandle);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "TCP ServiceBinding Create: %r\n", Status));
DEBUG ((DEBUG_ERROR, "TCP ServiceBinding Create: %r\n", Status));
return Status;
}
@ -370,7 +370,7 @@ TcpFastbootTransportStart (
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Open TCP Protocol: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Open TCP Protocol: %r\n", Status));
}
//
@ -423,7 +423,7 @@ TcpFastbootTransportStart (
} while (!Ip4ModeData.IsConfigured);
Status = mTcpListener->Configure (mTcpListener, &TcpConfigData);
} else if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "TCP Configure: %r\n", Status));
DEBUG ((DEBUG_ERROR, "TCP Configure: %r\n", Status));
return Status;
}
@ -443,7 +443,7 @@ TcpFastbootTransportStart (
Status = mTcpListener->Accept (mTcpListener, &mAcceptToken);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "TCP Accept: %r\n", Status));
DEBUG ((DEBUG_ERROR, "TCP Accept: %r\n", Status));
return Status;
}
@ -539,7 +539,7 @@ DataSent (
Status = mTransmitToken.CompletionToken.Status;
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "TCP Fastboot transmit result: %r\n", Status));
DEBUG ((DEBUG_ERROR, "TCP Fastboot transmit result: %r\n", Status));
gBS->SignalEvent (*(EFI_EVENT *) Context);
}
@ -584,7 +584,7 @@ TcpFastbootTransportSend (
Status = mTcpConnection->Transmit (mTcpConnection, &mTransmitToken);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "TCP Transmit: %r\n", Status));
DEBUG ((DEBUG_ERROR, "TCP Transmit: %r\n", Status));
return Status;
}
@ -642,7 +642,7 @@ TcpFastbootTransportEntryPoint (
(VOID **) &mTextOut
);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Fastboot: Open Text Output Protocol: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Fastboot: Open Text Output Protocol: %r\n", Status));
return Status;
}
@ -653,7 +653,7 @@ TcpFastbootTransportEntryPoint (
&mTransportProtocol
);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Fastboot: Install transport Protocol: %r\n", Status));
DEBUG ((DEBUG_ERROR, "Fastboot: Install transport Protocol: %r\n", Status));
}
return Status;

View File

@ -208,7 +208,7 @@ FindCompatibleNodeReg (
}
if ((*RegSize % 16) != 0) {
DEBUG ((EFI_D_ERROR,
DEBUG ((DEBUG_ERROR,
"%a: '%a' compatible node has invalid 'reg' property (size == 0x%x)\n",
__FUNCTION__, CompatibleString, *RegSize));
return EFI_NOT_FOUND;
@ -261,13 +261,13 @@ FindNextMemoryNodeReg (
//
Status = GetNodeProperty (This, Next, "reg", Reg, RegSize);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_WARN,
DEBUG ((DEBUG_WARN,
"%a: ignoring memory node with no 'reg' property\n",
__FUNCTION__));
continue;
}
if ((*RegSize % 16) != 0) {
DEBUG ((EFI_D_WARN,
DEBUG ((DEBUG_WARN,
"%a: ignoring memory node with invalid 'reg' property (size == 0x%x)\n",
__FUNCTION__, *RegSize));
continue;
@ -391,14 +391,14 @@ InitializeFdtClientDxe (
DeviceTreeBase = (VOID *)(UINTN)*(UINT64 *)GET_GUID_HOB_DATA (Hob);
if (fdt_check_header (DeviceTreeBase) != 0) {
DEBUG ((EFI_D_ERROR, "%a: No DTB found @ 0x%p\n", __FUNCTION__,
DEBUG ((DEBUG_ERROR, "%a: No DTB found @ 0x%p\n", __FUNCTION__,
DeviceTreeBase));
return EFI_NOT_FOUND;
}
mDeviceTreeBase = DeviceTreeBase;
DEBUG ((EFI_D_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, mDeviceTreeBase));
DEBUG ((DEBUG_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, mDeviceTreeBase));
//
// Register a protocol notify for the EDKII Platform Has Device Tree

View File

@ -416,7 +416,7 @@ AddSingleStep (
}
InvalidateInstructionCacheRange ((VOID *)mSingleStepPC, mSingleStepDataSize);
//DEBUG((EFI_D_ERROR, "AddSingleStep at 0x%08x (was: 0x%08x is:0x%08x)\n", SystemContext.SystemContextArm->PC, mSingleStepData, *(UINT32 *)mSingleStepPC));
//DEBUG((DEBUG_ERROR, "AddSingleStep at 0x%08x (was: 0x%08x is:0x%08x)\n", SystemContext.SystemContextArm->PC, mSingleStepData, *(UINT32 *)mSingleStepPC));
}
@ -437,7 +437,7 @@ RemoveSingleStep (
if (mSingleStepDataSize == sizeof (UINT16)) {
*(UINT16 *)mSingleStepPC = (UINT16)mSingleStepData;
} else {
//DEBUG((EFI_D_ERROR, "RemoveSingleStep at 0x%08x (was: 0x%08x is:0x%08x)\n", SystemContext.SystemContextArm->PC, *(UINT32 *)mSingleStepPC, mSingleStepData));
//DEBUG((DEBUG_ERROR, "RemoveSingleStep at 0x%08x (was: 0x%08x is:0x%08x)\n", SystemContext.SystemContextArm->PC, *(UINT32 *)mSingleStepPC, mSingleStepData));
*(UINT32 *)mSingleStepPC = mSingleStepData;
}
InvalidateInstructionCacheRange ((VOID *)mSingleStepPC, mSingleStepDataSize);
@ -556,7 +556,7 @@ SetBreakpoint (
*(UINT32 *)Address = GDB_ARM_BKPT;
InvalidateInstructionCacheRange ((VOID *)Address, 4);
//DEBUG((EFI_D_ERROR, "SetBreakpoint at 0x%08x (was: 0x%08x is:0x%08x)\n", Address, Breakpoint->Instruction, *(UINT32 *)Address));
//DEBUG((DEBUG_ERROR, "SetBreakpoint at 0x%08x (was: 0x%08x is:0x%08x)\n", Address, Breakpoint->Instruction, *(UINT32 *)Address));
}
VOID
@ -579,7 +579,7 @@ ClearBreakpoint (
*(UINT32 *)Address = Breakpoint->Instruction;
InvalidateInstructionCacheRange ((VOID *)Address, 4);
//DEBUG((EFI_D_ERROR, "ClearBreakpoint at 0x%08x (was: 0x%08x is:0x%08x)\n", Address, GDB_ARM_BKPT, *(UINT32 *)Address));
//DEBUG((DEBUG_ERROR, "ClearBreakpoint at 0x%08x (was: 0x%08x is:0x%08x)\n", Address, GDB_ARM_BKPT, *(UINT32 *)Address));
FreePool (Breakpoint);
}
@ -607,7 +607,7 @@ InsertBreakPoint (
break;
default :
DEBUG((EFI_D_ERROR, "Insert breakpoint default: %x\n", Type));
DEBUG((DEBUG_ERROR, "Insert breakpoint default: %x\n", Type));
SendError (GDB_EINVALIDBRKPOINTTYPE);
return;
}
@ -694,4 +694,3 @@ ValidateException (
return TRUE;
}

View File

@ -91,7 +91,7 @@ GdbStubEntry (
&Handles
);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Debug Support Protocol not found\n"));
DEBUG ((DEBUG_ERROR, "Debug Support Protocol not found\n"));
return Status;
}
@ -116,7 +116,7 @@ GdbStubEntry (
FreePool (Handles);
if (!IsaSupported) {
DEBUG ((EFI_D_ERROR, "Debug Support Protocol does not support our ISA\n"));
DEBUG ((DEBUG_ERROR, "Debug Support Protocol does not support our ISA\n"));
return EFI_NOT_FOUND;
}
@ -124,8 +124,8 @@ GdbStubEntry (
Status = DebugSupport->GetMaximumProcessorIndex (DebugSupport, &gMaxProcessorIndex);
ASSERT_EFI_ERROR (Status);
DEBUG ((EFI_D_INFO, "Debug Support Protocol ISA %x\n", DebugSupport->Isa));
DEBUG ((EFI_D_INFO, "Debug Support Protocol Processor Index %d\n", gMaxProcessorIndex));
DEBUG ((DEBUG_INFO, "Debug Support Protocol ISA %x\n", DebugSupport->Isa));
DEBUG ((DEBUG_INFO, "Debug Support Protocol Processor Index %d\n", gMaxProcessorIndex));
// Call processor-specific init routine
InitializeProcessor ();

View File

@ -108,7 +108,7 @@ LocateAndInstallAcpiFromFvConditional (
AcpiTableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) AcpiTable)->Length;
ASSERT (SectionSize >= AcpiTableSize);
DEBUG ((EFI_D_ERROR, "- Found '%c%c%c%c' ACPI Table\n",
DEBUG ((DEBUG_ERROR, "- Found '%c%c%c%c' ACPI Table\n",
(((EFI_ACPI_DESCRIPTION_HEADER *) AcpiTable)->Signature & 0xFF),
((((EFI_ACPI_DESCRIPTION_HEADER *) AcpiTable)->Signature >> 8) & 0xFF),
((((EFI_ACPI_DESCRIPTION_HEADER *) AcpiTable)->Signature >> 16) & 0xFF),

View File

@ -199,8 +199,8 @@ GdbGetChar (
Char = IoRead8 (gPort);
// Make this an EFI_D_INFO after we get everything debugged.
DEBUG ((EFI_D_ERROR, "<%c<", Char));
// Make this an DEBUG_INFO after we get everything debugged.
DEBUG ((DEBUG_ERROR, "<%c<", Char));
return Char;
}
@ -221,8 +221,8 @@ GdbPutChar (
{
UINT8 Data;
// Make this an EFI_D_INFO after we get everything debugged.
DEBUG ((EFI_D_ERROR, ">%c>", Char));
// Make this an DEBUG_INFO after we get everything debugged.
DEBUG ((DEBUG_ERROR, ">%c>", Char));
// Wait for the serial port to be ready
do {
@ -250,7 +250,3 @@ GdbPutString (
String++;
}
}

View File

@ -361,7 +361,7 @@ FfsProcessSection (
//
// GetInfo failed
//
DEBUG ((EFI_D_ERROR, "Decompress GetInfo Failed - %r\n", Status));
DEBUG ((DEBUG_ERROR, "Decompress GetInfo Failed - %r\n", Status));
return EFI_NOT_FOUND;
}
//
@ -415,7 +415,7 @@ FfsProcessSection (
//
// Decompress failed
//
DEBUG ((EFI_D_ERROR, "Decompress Failed - %r\n", Status));
DEBUG ((DEBUG_ERROR, "Decompress Failed - %r\n", Status));
return EFI_NOT_FOUND;
} else {
return FfsProcessSection (
@ -874,5 +874,3 @@ FfsProcessFvFile (
return EFI_SUCCESS;
}

View File

@ -154,7 +154,7 @@ LoadDxeCoreFromFfsFile (
BuildModuleHob (&FvFileInfo.FileName, (EFI_PHYSICAL_ADDRESS)(UINTN)ImageAddress, EFI_SIZE_TO_PAGES ((UINT32) ImageSize) * EFI_PAGE_SIZE, EntryPoint);
DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading DxeCore at 0x%10p EntryPoint=0x%10p\n", (VOID *)(UINTN)ImageAddress, (VOID *)(UINTN)EntryPoint));
DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Loading DxeCore at 0x%10p EntryPoint=0x%10p\n", (VOID *)(UINTN)ImageAddress, (VOID *)(UINTN)EntryPoint));
Hob = GetHobList ();
if (StackSize == 0) {
@ -191,7 +191,7 @@ LoadDxeCoreFromFfsFile (
}
// Should never get here as DXE Core does not return
DEBUG ((EFI_D_ERROR, "DxeCore returned\n"));
DEBUG ((DEBUG_ERROR, "DxeCore returned\n"));
ASSERT (FALSE);
return EFI_DEVICE_ERROR;
@ -247,5 +247,3 @@ DecompressFirstFv (
return Status;
}

View File

@ -74,8 +74,8 @@ CompareBuffer (
for (i = 0; i < (BufferSize >> 3); i++) {
if (*BufferA64 != *BufferB64) {
DEBUG ((EFI_D_ERROR, "CompareBuffer: Error at %i", i));
DEBUG ((EFI_D_ERROR, "(0x%lX) != (0x%lX)\n", *BufferA64, *BufferB64));
DEBUG ((DEBUG_ERROR, "CompareBuffer: Error at %i", i));
DEBUG ((DEBUG_ERROR, "(0x%lX) != (0x%lX)\n", *BufferA64, *BufferB64));
return FALSE;
}
BufferA64++;

View File

@ -21,7 +21,7 @@
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#define MMC_TRACE(txt) DEBUG((EFI_D_BLKIO, "MMC: " txt "\n"))
#define MMC_TRACE(txt) DEBUG((DEBUG_BLKIO, "MMC: " txt "\n"))
#define MMC_IOBLOCKS_READ 0
#define MMC_IOBLOCKS_WRITE 1

View File

@ -43,7 +43,7 @@ MmcGetCardStatus (
CmdArg = MmcHostInstance->CardInfo.RCA << 16;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD13, CmdArg);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcGetCardStatus(MMC_CMD13): Error and Status = %r\n", Status));
DEBUG ((DEBUG_ERROR, "MmcGetCardStatus(MMC_CMD13): Error and Status = %r\n", Status));
return Status;
}
@ -163,7 +163,7 @@ MmcTransferBlock (
Status = MmcHost->SendCommand (MmcHost, Cmd, CmdArg);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "%a(MMC_CMD%d): Error %r\n", __func__, Cmd, Status));
DEBUG ((DEBUG_ERROR, "%a(MMC_CMD%d): Error %r\n", __func__, Cmd, Status));
return Status;
}
@ -171,20 +171,20 @@ MmcTransferBlock (
// Read Data
Status = MmcHost->ReadBlockData (MmcHost, Lba, BufferSize, Buffer);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_BLKIO, "%a(): Error Read Block Data and Status = %r\n", __func__, Status));
DEBUG ((DEBUG_BLKIO, "%a(): Error Read Block Data and Status = %r\n", __func__, Status));
MmcStopTransmission (MmcHost);
return Status;
}
Status = MmcNotifyState (MmcHostInstance, MmcProgrammingState);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "%a() : Error MmcProgrammingState\n", __func__));
DEBUG ((DEBUG_ERROR, "%a() : Error MmcProgrammingState\n", __func__));
return Status;
}
} else {
// Write Data
Status = MmcHost->WriteBlockData (MmcHost, Lba, BufferSize, Buffer);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_BLKIO, "%a(): Error Write Block Data and Status = %r\n", __func__, Status));
DEBUG ((DEBUG_BLKIO, "%a(): Error Write Block Data and Status = %r\n", __func__, Status));
MmcStopTransmission (MmcHost);
return Status;
}
@ -209,14 +209,14 @@ MmcTransferBlock (
if (BufferSize > This->Media->BlockSize) {
Status = MmcHost->SendCommand (MmcHost, MMC_CMD12, 0);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_BLKIO, "%a(): Error and Status:%r\n", __func__, Status));
DEBUG ((DEBUG_BLKIO, "%a(): Error and Status:%r\n", __func__, Status));
}
MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1b, Response);
}
Status = MmcNotifyState (MmcHostInstance, MmcTransferState);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIoBlocks() : Error MmcTransferState\n"));
DEBUG ((DEBUG_ERROR, "MmcIoBlocks() : Error MmcTransferState\n"));
return Status;
}
return Status;
@ -318,7 +318,7 @@ MmcIoBlocks (
}
if (0 == Timeout) {
DEBUG ((EFI_D_ERROR, "The Card is busy\n"));
DEBUG ((DEBUG_ERROR, "The Card is busy\n"));
return EFI_NOT_READY;
}
@ -346,7 +346,7 @@ MmcIoBlocks (
}
Status = MmcTransferBlock (This, Cmd, Transfer, MediaId, Lba, ConsumeSize, Buffer);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "%a(): Failed to transfer block and Status:%r\n", __func__, Status));
DEBUG ((DEBUG_ERROR, "%a(): Failed to transfer block and Status:%r\n", __func__, Status));
}
RemainingBlock -= BlockCount;

View File

@ -20,12 +20,12 @@ PrintCID (
IN UINT32* Cid
)
{
DEBUG ((EFI_D_ERROR, "- PrintCID\n"));
DEBUG ((EFI_D_ERROR, "\t- Manufacturing date: %d/%d\n", (Cid[0] >> 8) & 0xF, (Cid[0] >> 12) & 0xFF));
DEBUG ((EFI_D_ERROR, "\t- Product serial number: 0x%X%X\n", Cid[1] & 0xFFFFFF, (Cid[0] >> 24) & 0xFF));
DEBUG ((EFI_D_ERROR, "\t- Product revision: %d\n", Cid[1] >> 24));
//DEBUG ((EFI_D_ERROR, "\t- Product name: %s\n", (char*)(Cid + 2)));
DEBUG ((EFI_D_ERROR, "\t- OEM ID: %c%c\n", (Cid[3] >> 8) & 0xFF, (Cid[3] >> 16) & 0xFF));
DEBUG ((DEBUG_ERROR, "- PrintCID\n"));
DEBUG ((DEBUG_ERROR, "\t- Manufacturing date: %d/%d\n", (Cid[0] >> 8) & 0xF, (Cid[0] >> 12) & 0xFF));
DEBUG ((DEBUG_ERROR, "\t- Product serial number: 0x%X%X\n", Cid[1] & 0xFFFFFF, (Cid[0] >> 24) & 0xFF));
DEBUG ((DEBUG_ERROR, "\t- Product revision: %d\n", Cid[1] >> 24));
//DEBUG ((DEBUG_ERROR, "\t- Product name: %s\n", (char*)(Cid + 2)));
DEBUG ((DEBUG_ERROR, "\t- OEM ID: %c%c\n", (Cid[3] >> 8) & 0xFF, (Cid[3] >> 16) & 0xFF));
}
@ -37,31 +37,31 @@ PrintCSD (
UINTN Value;
if (((Csd[2] >> 30) & 0x3) == 0) {
DEBUG ((EFI_D_ERROR, "- PrintCSD Version 1.01-1.10/Version 2.00/Standard Capacity\n"));
DEBUG ((DEBUG_ERROR, "- PrintCSD Version 1.01-1.10/Version 2.00/Standard Capacity\n"));
} else if (((Csd[2] >> 30) & 0x3) == 1) {
DEBUG ((EFI_D_ERROR, "- PrintCSD Version 2.00/High Capacity\n"));
DEBUG ((DEBUG_ERROR, "- PrintCSD Version 2.00/High Capacity\n"));
} else {
DEBUG ((EFI_D_ERROR, "- PrintCSD Version Higher than v3.3\n"));
DEBUG ((DEBUG_ERROR, "- PrintCSD Version Higher than v3.3\n"));
}
DEBUG ((EFI_D_ERROR, "\t- Supported card command class: 0x%X\n", MMC_CSD_GET_CCC (Csd)));
DEBUG ((EFI_D_ERROR, "\t- Speed: %a %a\n",mStrValue[(MMC_CSD_GET_TRANSPEED (Csd) >> 3) & 0xF],mStrUnit[MMC_CSD_GET_TRANSPEED (Csd) & 7]));
DEBUG ((EFI_D_ERROR, "\t- Maximum Read Data Block: %d\n",2 << (MMC_CSD_GET_READBLLEN (Csd)-1)));
DEBUG ((EFI_D_ERROR, "\t- Maximum Write Data Block: %d\n",2 << (MMC_CSD_GET_WRITEBLLEN (Csd)-1)));
DEBUG ((DEBUG_ERROR, "\t- Supported card command class: 0x%X\n", MMC_CSD_GET_CCC (Csd)));
DEBUG ((DEBUG_ERROR, "\t- Speed: %a %a\n",mStrValue[(MMC_CSD_GET_TRANSPEED (Csd) >> 3) & 0xF],mStrUnit[MMC_CSD_GET_TRANSPEED (Csd) & 7]));
DEBUG ((DEBUG_ERROR, "\t- Maximum Read Data Block: %d\n",2 << (MMC_CSD_GET_READBLLEN (Csd)-1)));
DEBUG ((DEBUG_ERROR, "\t- Maximum Write Data Block: %d\n",2 << (MMC_CSD_GET_WRITEBLLEN (Csd)-1)));
if (!MMC_CSD_GET_FILEFORMATGRP (Csd)) {
Value = MMC_CSD_GET_FILEFORMAT (Csd);
if (Value == 0) {
DEBUG ((EFI_D_ERROR, "\t- Format (0): Hard disk-like file system with partition table\n"));
DEBUG ((DEBUG_ERROR, "\t- Format (0): Hard disk-like file system with partition table\n"));
} else if (Value == 1) {
DEBUG ((EFI_D_ERROR, "\t- Format (1): DOS FAT (floppy-like) with boot sector only (no partition table)\n"));
DEBUG ((DEBUG_ERROR, "\t- Format (1): DOS FAT (floppy-like) with boot sector only (no partition table)\n"));
} else if (Value == 2) {
DEBUG ((EFI_D_ERROR, "\t- Format (2): Universal File Format\n"));
DEBUG ((DEBUG_ERROR, "\t- Format (2): Universal File Format\n"));
} else {
DEBUG ((EFI_D_ERROR, "\t- Format (3): Others/Unknown\n"));
DEBUG ((DEBUG_ERROR, "\t- Format (3): Others/Unknown\n"));
}
} else {
DEBUG ((EFI_D_ERROR, "\t- Format: Reserved\n"));
DEBUG ((DEBUG_ERROR, "\t- Format: Reserved\n"));
}
}
@ -70,9 +70,9 @@ PrintRCA (
IN UINT32 Rca
)
{
DEBUG ((EFI_D_ERROR, "- PrintRCA: 0x%X\n", Rca));
DEBUG ((EFI_D_ERROR, "\t- Status: 0x%X\n", Rca & 0xFFFF));
DEBUG ((EFI_D_ERROR, "\t- RCA: 0x%X\n", (Rca >> 16) & 0xFFFF));
DEBUG ((DEBUG_ERROR, "- PrintRCA: 0x%X\n", Rca));
DEBUG ((DEBUG_ERROR, "\t- Status: 0x%X\n", Rca & 0xFFFF));
DEBUG ((DEBUG_ERROR, "\t- RCA: 0x%X\n", (Rca >> 16) & 0xFFFF));
}
VOID
@ -102,18 +102,18 @@ PrintOCR (
Volts++;
}
DEBUG ((EFI_D_ERROR, "- PrintOCR Ocr (0x%X)\n",Ocr));
DEBUG ((EFI_D_ERROR, "\t- Card operating voltage: %d.%d to %d.%d\n", MinV/10, MinV % 10, MaxV/10, MaxV % 10));
DEBUG ((DEBUG_ERROR, "- PrintOCR Ocr (0x%X)\n",Ocr));
DEBUG ((DEBUG_ERROR, "\t- Card operating voltage: %d.%d to %d.%d\n", MinV/10, MinV % 10, MaxV/10, MaxV % 10));
if (((Ocr >> 29) & 3) == 0) {
DEBUG ((EFI_D_ERROR, "\t- AccessMode: Byte Mode\n"));
DEBUG ((DEBUG_ERROR, "\t- AccessMode: Byte Mode\n"));
} else {
DEBUG ((EFI_D_ERROR, "\t- AccessMode: Block Mode (0x%X)\n", ((Ocr >> 29) & 3)));
DEBUG ((DEBUG_ERROR, "\t- AccessMode: Block Mode (0x%X)\n", ((Ocr >> 29) & 3)));
}
if (Ocr & MMC_OCR_POWERUP) {
DEBUG ((EFI_D_ERROR, "\t- PowerUp\n"));
DEBUG ((DEBUG_ERROR, "\t- PowerUp\n"));
} else {
DEBUG ((EFI_D_ERROR, "\t- Voltage Not Supported\n"));
DEBUG ((DEBUG_ERROR, "\t- Voltage Not Supported\n"));
}
}
@ -122,41 +122,41 @@ PrintResponseR1 (
IN UINT32 Response
)
{
DEBUG ((EFI_D_INFO, "Response: 0x%X\n", Response));
DEBUG ((DEBUG_INFO, "Response: 0x%X\n", Response));
if (Response & MMC_R0_READY_FOR_DATA) {
DEBUG ((EFI_D_INFO, "\t- READY_FOR_DATA\n"));
DEBUG ((DEBUG_INFO, "\t- READY_FOR_DATA\n"));
}
switch ((Response >> 9) & 0xF) {
case 0:
DEBUG ((EFI_D_INFO, "\t- State: Idle\n"));
DEBUG ((DEBUG_INFO, "\t- State: Idle\n"));
break;
case 1:
DEBUG ((EFI_D_INFO, "\t- State: Ready\n"));
DEBUG ((DEBUG_INFO, "\t- State: Ready\n"));
break;
case 2:
DEBUG ((EFI_D_INFO, "\t- State: Ident\n"));
DEBUG ((DEBUG_INFO, "\t- State: Ident\n"));
break;
case 3:
DEBUG ((EFI_D_INFO, "\t- State: StandBy\n"));
DEBUG ((DEBUG_INFO, "\t- State: StandBy\n"));
break;
case 4:
DEBUG ((EFI_D_INFO, "\t- State: Tran\n"));
DEBUG ((DEBUG_INFO, "\t- State: Tran\n"));
break;
case 5:
DEBUG ((EFI_D_INFO, "\t- State: Data\n"));
DEBUG ((DEBUG_INFO, "\t- State: Data\n"));
break;
case 6:
DEBUG ((EFI_D_INFO, "\t- State: Rcv\n"));
DEBUG ((DEBUG_INFO, "\t- State: Rcv\n"));
break;
case 7:
DEBUG ((EFI_D_INFO, "\t- State: Prg\n"));
DEBUG ((DEBUG_INFO, "\t- State: Prg\n"));
break;
case 8:
DEBUG ((EFI_D_INFO, "\t- State: Dis\n"));
DEBUG ((DEBUG_INFO, "\t- State: Dis\n"));
break;
default:
DEBUG ((EFI_D_INFO, "\t- State: Reserved\n"));
DEBUG ((DEBUG_INFO, "\t- State: Reserved\n"));
break;
}
}

View File

@ -81,16 +81,16 @@ EmmcGetDeviceState (
RCA = MmcHostInstance->CardInfo.RCA << RCA_SHIFT_OFFSET;
Status = Host->SendCommand (Host, MMC_CMD13, RCA);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcGetDeviceState(): Failed to get card status, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcGetDeviceState(): Failed to get card status, Status=%r.\n", Status));
return Status;
}
Status = Host->ReceiveResponse (Host, MMC_RESPONSE_TYPE_R1, &Data);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcGetDeviceState(): Failed to get response of CMD13, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcGetDeviceState(): Failed to get response of CMD13, Status=%r.\n", Status));
return Status;
}
if (Data & EMMC_SWITCH_ERROR) {
DEBUG ((EFI_D_ERROR, "EmmcGetDeviceState(): Failed to switch expected mode, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcGetDeviceState(): Failed to switch expected mode, Status=%r.\n", Status));
return EFI_DEVICE_ERROR;
}
*State = DEVICE_STATE(Data);
@ -116,14 +116,14 @@ EmmcSetEXTCSD (
EMMC_CMD6_ARG_VALUE(Value) | EMMC_CMD6_ARG_CMD_SET(1);
Status = Host->SendCommand (Host, MMC_CMD6, Argument);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcSetEXTCSD(): Failed to send CMD6, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcSetEXTCSD(): Failed to send CMD6, Status=%r.\n", Status));
return Status;
}
// Make sure device exiting prog mode
do {
Status = EmmcGetDeviceState (MmcHostInstance, &State);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcSetEXTCSD(): Failed to get device state, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcSetEXTCSD(): Failed to get device state, Status=%r.\n", Status));
return Status;
}
} while (State == EMMC_PRG_STATE);
@ -150,13 +150,13 @@ EmmcIdentificationMode (
// Fetch card identity register
Status = Host->SendCommand (Host, MMC_CMD2, 0);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcIdentificationMode(): Failed to send CMD2, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcIdentificationMode(): Failed to send CMD2, Status=%r.\n", Status));
return Status;
}
Status = Host->ReceiveResponse (Host, MMC_RESPONSE_TYPE_R2, (UINT32 *)&(MmcHostInstance->CardInfo.CIDData));
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcIdentificationMode(): CID retrieval error, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcIdentificationMode(): CID retrieval error, Status=%r.\n", Status));
return Status;
}
@ -165,41 +165,41 @@ EmmcIdentificationMode (
RCA = MmcHostInstance->CardInfo.RCA << RCA_SHIFT_OFFSET;
Status = Host->SendCommand (Host, MMC_CMD3, RCA);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcIdentificationMode(): RCA set error, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcIdentificationMode(): RCA set error, Status=%r.\n", Status));
return Status;
}
// Fetch card specific data
Status = Host->SendCommand (Host, MMC_CMD9, RCA);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcIdentificationMode(): Failed to send CMD9, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcIdentificationMode(): Failed to send CMD9, Status=%r.\n", Status));
return Status;
}
Status = Host->ReceiveResponse (Host, MMC_RESPONSE_TYPE_R2, (UINT32 *)&(MmcHostInstance->CardInfo.CSDData));
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcIdentificationMode(): CSD retrieval error, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcIdentificationMode(): CSD retrieval error, Status=%r.\n", Status));
return Status;
}
// Select the card
Status = Host->SendCommand (Host, MMC_CMD7, RCA);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcIdentificationMode(): Card selection error, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcIdentificationMode(): Card selection error, Status=%r.\n", Status));
}
if (MMC_HOST_HAS_SETIOS(Host)) {
// Set 1-bit bus width
Status = Host->SetIos (Host, 0, 1, EMMCBACKWARD);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcIdentificationMode(): Set 1-bit bus width error, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcIdentificationMode(): Set 1-bit bus width error, Status=%r.\n", Status));
return Status;
}
// Set 1-bit bus width for EXTCSD
Status = EmmcSetEXTCSD (MmcHostInstance, EXTCSD_BUS_WIDTH, EMMC_BUS_WIDTH_1BIT);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcIdentificationMode(): Set extcsd bus width error, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcIdentificationMode(): Set extcsd bus width error, Status=%r.\n", Status));
return Status;
}
}
@ -211,12 +211,12 @@ EmmcIdentificationMode (
}
Status = Host->SendCommand (Host, MMC_CMD8, 0);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcIdentificationMode(): ECSD fetch error, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcIdentificationMode(): ECSD fetch error, Status=%r.\n", Status));
}
Status = Host->ReadBlockData (Host, 0, 512, (UINT32 *)MmcHostInstance->CardInfo.ECSDData);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcIdentificationMode(): ECSD read error, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcIdentificationMode(): ECSD read error, Status=%r.\n", Status));
goto FreePageExit;
}
@ -224,7 +224,7 @@ EmmcIdentificationMode (
do {
Status = EmmcGetDeviceState (MmcHostInstance, &State);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "EmmcIdentificationMode(): Failed to get device state, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "EmmcIdentificationMode(): Failed to get device state, Status=%r.\n", Status));
goto FreePageExit;
}
} while (State == EMMC_DATA_STATE);
@ -353,14 +353,14 @@ InitializeSdMmcDevice (
CmdArg = MmcHostInstance->CardInfo.RCA << 16;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD9, CmdArg);
if (EFI_ERROR (Status)) {
DEBUG((EFI_D_ERROR, "InitializeSdMmcDevice(MMC_CMD9): Error, Status=%r\n", Status));
DEBUG((DEBUG_ERROR, "InitializeSdMmcDevice(MMC_CMD9): Error, Status=%r\n", Status));
return Status;
}
// Read Response
Status = MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_CSD, Response);
if (EFI_ERROR (Status)) {
DEBUG((EFI_D_ERROR, "InitializeSdMmcDevice(): Failed to receive CSD, Status=%r\n", Status));
DEBUG((DEBUG_ERROR, "InitializeSdMmcDevice(): Failed to receive CSD, Status=%r\n", Status));
return Status;
}
PrintCSD (Response);
@ -395,7 +395,7 @@ InitializeSdMmcDevice (
CmdArg = MmcHostInstance->CardInfo.RCA << 16;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD7, CmdArg);
if (EFI_ERROR (Status)) {
DEBUG((EFI_D_ERROR, "InitializeSdMmcDevice(MMC_CMD7): Error and Status = %r\n", Status));
DEBUG((DEBUG_ERROR, "InitializeSdMmcDevice(MMC_CMD7): Error and Status = %r\n", Status));
return Status;
}
@ -416,38 +416,38 @@ InitializeSdMmcDevice (
/* SCR */
Status = MmcHost->SendCommand (MmcHost, MMC_ACMD51, 0);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "%a(MMC_ACMD51): Error and Status = %r\n", __func__, Status));
DEBUG ((DEBUG_ERROR, "%a(MMC_ACMD51): Error and Status = %r\n", __func__, Status));
return Status;
} else {
Status = MmcHost->ReadBlockData (MmcHost, 0, 8, Buffer);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "%a(MMC_ACMD51): ReadBlockData Error and Status = %r\n", __func__, Status));
DEBUG ((DEBUG_ERROR, "%a(MMC_ACMD51): ReadBlockData Error and Status = %r\n", __func__, Status));
return Status;
}
CopyMem (&Scr, Buffer, 8);
if (Scr.SD_SPEC == 2) {
if (Scr.SD_SPEC3 == 1) {
if (Scr.SD_SPEC4 == 1) {
DEBUG ((EFI_D_INFO, "Found SD Card for Spec Version 4.xx\n"));
} else {
DEBUG ((EFI_D_INFO, "Found SD Card for Spec Version 3.0x\n"));
}
if (Scr.SD_SPEC4 == 1) {
DEBUG ((DEBUG_INFO, "Found SD Card for Spec Version 4.xx\n"));
} else {
DEBUG ((DEBUG_INFO, "Found SD Card for Spec Version 3.0x\n"));
}
} else {
if (Scr.SD_SPEC4 == 0) {
DEBUG ((EFI_D_INFO, "Found SD Card for Spec Version 2.0\n"));
} else {
DEBUG ((EFI_D_ERROR, "Found invalid SD Card\n"));
}
if (Scr.SD_SPEC4 == 0) {
DEBUG ((DEBUG_INFO, "Found SD Card for Spec Version 2.0\n"));
} else {
DEBUG ((DEBUG_ERROR, "Found invalid SD Card\n"));
}
}
} else {
if ((Scr.SD_SPEC3 == 0) && (Scr.SD_SPEC4 == 0)) {
if (Scr.SD_SPEC == 1) {
DEBUG ((EFI_D_INFO, "Found SD Card for Spec Version 1.10\n"));
} else {
DEBUG ((EFI_D_INFO, "Found SD Card for Spec Version 1.0\n"));
}
DEBUG ((DEBUG_INFO, "Found SD Card for Spec Version 1.10\n"));
} else {
DEBUG ((DEBUG_INFO, "Found SD Card for Spec Version 1.0\n"));
}
} else {
DEBUG ((EFI_D_ERROR, "Found invalid SD Card\n"));
DEBUG ((DEBUG_ERROR, "Found invalid SD Card\n"));
}
}
}
@ -543,19 +543,19 @@ MmcIdentificationMode (
// Initialize the MMC Host HW
Status = MmcNotifyState (MmcHostInstance, MmcHwInitializationState);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcHwInitializationState, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode() : Error MmcHwInitializationState, Status=%r.\n", Status));
return Status;
}
}
Status = MmcHost->SendCommand (MmcHost, MMC_CMD0, 0);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD0): Error, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode(MMC_CMD0): Error, Status=%r.\n", Status));
return Status;
}
Status = MmcNotifyState (MmcHostInstance, MmcIdleState);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdleState, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode() : Error MmcIdleState, Status=%r.\n", Status));
return Status;
}
@ -568,14 +568,14 @@ MmcIdentificationMode (
break;
Status = MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR, (UINT32 *)&OcrResponse);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Failed to receive OCR, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode() : Failed to receive OCR, Status=%r.\n", Status));
return Status;
}
Timeout--;
} while (!OcrResponse.Ocr.PowerUp && (Timeout > 0));
if (Status == EFI_SUCCESS) {
if (!OcrResponse.Ocr.PowerUp) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD1): Card initialisation failure, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode(MMC_CMD1): Card initialisation failure, Status=%r.\n", Status));
return EFI_DEVICE_ERROR;
}
OcrResponse.Ocr.PowerUp = 0;
@ -595,7 +595,7 @@ MmcIdentificationMode (
// Are we using SDIO ?
Status = MmcHost->SendCommand (MmcHost, MMC_CMD5, 0);
if (Status == EFI_SUCCESS) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD5): Error - SDIO not supported, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode(MMC_CMD5): Error - SDIO not supported, Status=%r.\n", Status));
return EFI_UNSUPPORTED;
}
@ -603,21 +603,21 @@ MmcIdentificationMode (
CmdArg = (0x0UL << 12 | BIT8 | 0xCEUL << 0);
Status = MmcHost->SendCommand (MmcHost, MMC_CMD8, CmdArg);
if (Status == EFI_SUCCESS) {
DEBUG ((EFI_D_ERROR, "Card is SD2.0 => Supports high capacity\n"));
DEBUG ((DEBUG_ERROR, "Card is SD2.0 => Supports high capacity\n"));
IsHCS = TRUE;
Status = MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R7, Response);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Failed to receive response to CMD8, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode() : Failed to receive response to CMD8, Status=%r.\n", Status));
return Status;
}
PrintResponseR1 (Response[0]);
// Check if it is valid response
if (Response[0] != CmdArg) {
DEBUG ((EFI_D_ERROR, "The Card is not usable\n"));
DEBUG ((DEBUG_ERROR, "The Card is not usable\n"));
return EFI_UNSUPPORTED;
}
} else {
DEBUG ((EFI_D_ERROR, "Not a SD2.0 Card\n"));
DEBUG ((DEBUG_ERROR, "Not a SD2.0 Card\n"));
}
// We need to wait for the MMC or SD card is ready => (gCardInfo.OCRData.PowerUp == 1)
@ -626,7 +626,7 @@ MmcIdentificationMode (
// SD Card or MMC Card ? CMD55 indicates to the card that the next command is an application specific command
Status = MmcHost->SendCommand (MmcHost, MMC_CMD55, 0);
if (Status == EFI_SUCCESS) {
DEBUG ((EFI_D_INFO, "Card should be SD\n"));
DEBUG ((DEBUG_INFO, "Card should be SD\n"));
if (IsHCS) {
MmcHostInstance->CardInfo.CardType = SD_CARD_2;
} else {
@ -642,20 +642,20 @@ MmcIdentificationMode (
if (!EFI_ERROR (Status)) {
Status = MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR, Response);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Failed to receive OCR, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode() : Failed to receive OCR, Status=%r.\n", Status));
return Status;
}
((UINT32 *) &(MmcHostInstance->CardInfo.OCRData))[0] = Response[0];
}
} else {
DEBUG ((EFI_D_INFO, "Card should be MMC\n"));
DEBUG ((DEBUG_INFO, "Card should be MMC\n"));
MmcHostInstance->CardInfo.CardType = MMC_CARD;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD1, 0x800000);
if (!EFI_ERROR (Status)) {
Status = MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR, Response);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Failed to receive OCR, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode() : Failed to receive OCR, Status=%r.\n", Status));
return Status;
}
((UINT32 *) &(MmcHostInstance->CardInfo.OCRData))[0] = Response[0];
@ -669,7 +669,7 @@ MmcIdentificationMode (
} else {
if ((MmcHostInstance->CardInfo.CardType == SD_CARD_2) && (MmcHostInstance->CardInfo.OCRData.AccessMode & BIT1)) {
MmcHostInstance->CardInfo.CardType = SD_CARD_2_HIGH;
DEBUG ((EFI_D_ERROR, "High capacity card.\n"));
DEBUG ((DEBUG_ERROR, "High capacity card.\n"));
}
break; // The MMC/SD card is ready. Continue the Identification Mode
}
@ -680,7 +680,7 @@ MmcIdentificationMode (
}
if (Timeout == 0) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(): No Card\n"));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode(): No Card\n"));
return EFI_NO_MEDIA;
} else {
PrintOCR (Response[0]);
@ -688,18 +688,18 @@ MmcIdentificationMode (
Status = MmcNotifyState (MmcHostInstance, MmcReadyState);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcReadyState\n"));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode() : Error MmcReadyState\n"));
return Status;
}
Status = MmcHost->SendCommand (MmcHost, MMC_CMD2, 0);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD2): Error\n"));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode(MMC_CMD2): Error\n"));
return Status;
}
Status = MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_CID, Response);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Failed to receive CID, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode() : Failed to receive CID, Status=%r.\n", Status));
return Status;
}
@ -707,7 +707,7 @@ MmcIdentificationMode (
Status = MmcHost->NotifyState (MmcHost, MmcIdentificationState);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdentificationState\n"));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode() : Error MmcIdentificationState\n"));
return Status;
}
@ -719,13 +719,13 @@ MmcIdentificationMode (
CmdArg = 1;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD3, CmdArg);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD3): Error\n"));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode(MMC_CMD3): Error\n"));
return Status;
}
Status = MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_RCA, Response);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Failed to receive RCA, Status=%r.\n", Status));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode() : Failed to receive RCA, Status=%r.\n", Status));
return Status;
}
PrintRCA (Response[0]);
@ -738,7 +738,7 @@ MmcIdentificationMode (
}
Status = MmcNotifyState (MmcHostInstance, MmcStandByState);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcStandByState\n"));
DEBUG ((DEBUG_ERROR, "MmcIdentificationMode() : Error MmcStandByState\n"));
return Status;
}
@ -759,13 +759,13 @@ InitializeMmcDevice (
Status = MmcIdentificationMode (MmcHostInstance);
if (EFI_ERROR (Status)) {
DEBUG((EFI_D_ERROR, "InitializeMmcDevice(): Error in Identification Mode, Status=%r\n", Status));
DEBUG((DEBUG_ERROR, "InitializeMmcDevice(): Error in Identification Mode, Status=%r\n", Status));
return Status;
}
Status = MmcNotifyState (MmcHostInstance, MmcTransferState);
if (EFI_ERROR (Status)) {
DEBUG((EFI_D_ERROR, "InitializeMmcDevice(): Error MmcTransferState, Status=%r\n", Status));
DEBUG((DEBUG_ERROR, "InitializeMmcDevice(): Error MmcTransferState, Status=%r\n", Status));
return Status;
}
@ -781,7 +781,7 @@ InitializeMmcDevice (
// Set Block Length
Status = MmcHost->SendCommand (MmcHost, MMC_CMD16, MmcHostInstance->BlockIo.Media->BlockSize);
if (EFI_ERROR (Status)) {
DEBUG((EFI_D_ERROR, "InitializeMmcDevice(MMC_CMD16): Error MmcHostInstance->BlockIo.Media->BlockSize: %d and Error = %r\n",
DEBUG((DEBUG_ERROR, "InitializeMmcDevice(MMC_CMD16): Error MmcHostInstance->BlockIo.Media->BlockSize: %d and Error = %r\n",
MmcHostInstance->BlockIo.Media->BlockSize, Status));
return Status;
}
@ -790,7 +790,7 @@ InitializeMmcDevice (
if (MmcHostInstance->CardInfo.CardType == MMC_CARD) {
Status = MmcHost->SendCommand (MmcHost, MMC_CMD23, BlockCount);
if (EFI_ERROR (Status)) {
DEBUG((EFI_D_ERROR, "InitializeMmcDevice(MMC_CMD23): Error, Status=%r\n", Status));
DEBUG((DEBUG_ERROR, "InitializeMmcDevice(MMC_CMD23): Error, Status=%r\n", Status));
return Status;
}
}