summaryrefslogtreecommitdiffstats
path: root/EmbeddedPkg
diff options
context:
space:
mode:
Diffstat (limited to 'EmbeddedPkg')
-rw-r--r--EmbeddedPkg/GdbStub/Arm/Processor.c76
-rw-r--r--EmbeddedPkg/GdbStub/GdbStub.c48
-rw-r--r--EmbeddedPkg/GdbStub/GdbStubInternal.h2
-rw-r--r--EmbeddedPkg/GdbStub/Ia32/Processor.c24
-rw-r--r--EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c267
5 files changed, 207 insertions, 210 deletions
diff --git a/EmbeddedPkg/GdbStub/Arm/Processor.c b/EmbeddedPkg/GdbStub/Arm/Processor.c
index 2d33d97290..38abb69d7e 100644
--- a/EmbeddedPkg/GdbStub/Arm/Processor.c
+++ b/EmbeddedPkg/GdbStub/Arm/Processor.c
@@ -94,7 +94,7 @@ MaxEfiException (
VOID
)
{
- return sizeof (gExceptionType)/sizeof (EFI_EXCEPTION_TYPE_ENTRY);
+ return sizeof (gExceptionType) / sizeof (EFI_EXCEPTION_TYPE_ENTRY);
}
@@ -108,7 +108,7 @@ MaxRegisterCount (
VOID
)
{
- return sizeof (gRegisterOffsets)/sizeof (UINTN);
+ return sizeof (gRegisterOffsets) / sizeof (UINTN);
}
@@ -140,7 +140,7 @@ CheckIsa (
@retval the pointer to the RegNumber-th pointer
**/
UINTN *
-FindPointerToRegister(
+FindPointerToRegister (
IN EFI_SYSTEM_CONTEXT SystemContext,
IN UINTN RegNumber
)
@@ -170,20 +170,20 @@ BasicReadRegister (
CHAR8 Char;
if (gRegisterOffsets[RegNumber] > 0xF00) {
- AsciiSPrint(OutBufPtr, 9, "00000000");
+ AsciiSPrint (OutBufPtr, 9, "00000000");
OutBufPtr += 8;
return OutBufPtr;
}
RegSize = 0;
while (RegSize < 32) {
- Char = mHexToStr[(UINT8)((*FindPointerToRegister(SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
+ Char = mHexToStr[(UINT8)((*FindPointerToRegister (SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
if ((Char >= 'A') && (Char <= 'F')) {
Char = Char - 'A' + 'a';
}
*OutBufPtr++ = Char;
- Char = mHexToStr[(UINT8)((*FindPointerToRegister(SystemContext, RegNumber) >> RegSize) & 0xf)];
+ Char = mHexToStr[(UINT8)((*FindPointerToRegister (SystemContext, RegNumber) >> RegSize) & 0xf)];
if ((Char >= 'A') && (Char <= 'F')) {
Char = Char - 'A' + 'a';
}
@@ -212,7 +212,7 @@ ReadNthRegister (
RegNumber = AsciiStrHexToUintn (&InBuffer[1]);
- if (RegNumber >= MaxRegisterCount()) {
+ if (RegNumber >= MaxRegisterCount ()) {
SendError (GDB_EINVALIDREGNUM);
return;
}
@@ -221,7 +221,7 @@ ReadNthRegister (
OutBufPtr = BasicReadRegister (SystemContext, RegNumber, OutBufPtr);
*OutBufPtr = '\0'; // the end of the buffer
- SendPacket(OutBuffer);
+ SendPacket (OutBuffer);
}
@@ -238,18 +238,18 @@ ReadGeneralRegisters (
UINTN Index;
CHAR8 *OutBuffer;
CHAR8 *OutBufPtr;
- UINTN RegisterCount = MaxRegisterCount();
+ UINTN RegisterCount = MaxRegisterCount ();
// It is not safe to allocate pool here....
- OutBuffer = AllocatePool((RegisterCount * 8) + 1); // 8 bytes per register in string format plus a null to terminate
+ OutBuffer = AllocatePool ((RegisterCount * 8) + 1); // 8 bytes per register in string format plus a null to terminate
OutBufPtr = OutBuffer;
for (Index = 0; Index < RegisterCount; Index++) {
OutBufPtr = BasicReadRegister (SystemContext, Index, OutBufPtr);
}
*OutBufPtr = '\0';
- SendPacket(OutBuffer);
- FreePool(OutBuffer);
+ SendPacket (OutBuffer);
+ FreePool (OutBuffer);
}
@@ -278,7 +278,7 @@ CHAR8
NewValue = 0;
RegSize = 0;
while (RegSize < 32) {
- TempValue = HexCharToInt(*InBufPtr++);
+ TempValue = HexCharToInt (*InBufPtr++);
if ((INTN)TempValue < 0) {
SendError (GDB_EBADMEMDATA);
@@ -286,7 +286,7 @@ CHAR8
}
NewValue += (TempValue << (RegSize+4));
- TempValue = HexCharToInt(*InBufPtr++);
+ TempValue = HexCharToInt (*InBufPtr++);
if ((INTN)TempValue < 0) {
SendError (GDB_EBADMEMDATA);
@@ -296,7 +296,7 @@ CHAR8
NewValue += (TempValue << RegSize);
RegSize = RegSize + 8;
}
- *(FindPointerToRegister(SystemContext, RegNumber)) = NewValue;
+ *(FindPointerToRegister (SystemContext, RegNumber)) = NewValue;
return InBufPtr;
}
@@ -327,7 +327,7 @@ WriteNthRegister (
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
// check if this is a valid Register Number
- if (RegNumber >= MaxRegisterCount()) {
+ if (RegNumber >= MaxRegisterCount ()) {
SendError (GDB_EINVALIDREGNUM);
return;
}
@@ -353,11 +353,11 @@ WriteGeneralRegisters (
UINTN i;
CHAR8 *InBufPtr; /// pointer to the input buffer
UINTN MinLength;
- UINTN RegisterCount = MaxRegisterCount();
+ UINTN RegisterCount = MaxRegisterCount ();
MinLength = (RegisterCount * 8) + 1; // 'G' plus the registers in ASCII format
- if (AsciiStrLen(InBuffer) < MinLength) {
+ if (AsciiStrLen (InBuffer) < MinLength) {
//Bad message. Message is not the right length
SendError (GDB_EBADBUFSIZE);
return;
@@ -367,7 +367,7 @@ WriteGeneralRegisters (
// Read the new values for the registers from the input buffer to an array, NewValueArray.
// The values in the array are in the gdb ordering
- for(i = 0; i < RegisterCount; i++) {
+ for (i = 0; i < RegisterCount; i++) {
InBufPtr = BasicWriteRegister (SystemContext, i, InBufPtr);
}
@@ -421,7 +421,7 @@ AddSingleStep (
mSingleStepActive = FALSE;
}
- InvalidateInstructionCacheRange((VOID *)mSingleStepPC, mSingleStepDataSize);
+ 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));
}
@@ -446,7 +446,7 @@ RemoveSingleStep (
//DEBUG((EFI_D_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);
+ InvalidateInstructionCacheRange ((VOID *)mSingleStepPC, mSingleStepDataSize);
mSingleStepActive = FALSE;
}
@@ -466,7 +466,7 @@ ContinueAtAddress (
)
{
if (PacketData[1] != '\0') {
- SystemContext.SystemContextArm->PC = AsciiStrHexToUintn(&PacketData[1]);
+ SystemContext.SystemContextArm->PC = AsciiStrHexToUintn (&PacketData[1]);
}
}
@@ -484,7 +484,7 @@ SingleStep (
IN CHAR8 *PacketData
)
{
- SendNotSupported();
+ SendNotSupported ();
}
UINTN
@@ -521,15 +521,15 @@ SearchBreakpointList (
LIST_ENTRY *Current;
ARM_SOFTWARE_BREAKPOINT *Breakpoint;
- Current = GetFirstNode(&BreakpointList);
- while (!IsNull(&BreakpointList, Current)) {
+ Current = GetFirstNode (&BreakpointList);
+ while (!IsNull (&BreakpointList, Current)) {
Breakpoint = ARM_SOFTWARE_BREAKPOINT_FROM_LINK(Current);
if (Address == Breakpoint->Address) {
return Breakpoint;
}
- Current = GetNextNode(&BreakpointList, Current);
+ Current = GetNextNode (&BreakpointList, Current);
}
return NULL;
@@ -542,25 +542,25 @@ SetBreakpoint (
{
ARM_SOFTWARE_BREAKPOINT *Breakpoint;
- Breakpoint = SearchBreakpointList(Address);
+ Breakpoint = SearchBreakpointList (Address);
if (Breakpoint != NULL) {
return;
}
// create and fill breakpoint structure
- Breakpoint = AllocatePool(sizeof(ARM_SOFTWARE_BREAKPOINT));
+ Breakpoint = AllocatePool (sizeof(ARM_SOFTWARE_BREAKPOINT));
Breakpoint->Signature = ARM_SOFTWARE_BREAKPOINT_SIGNATURE;
Breakpoint->Address = Address;
Breakpoint->Instruction = *(UINT32 *)Address;
// Add it to the list
- InsertTailList(&BreakpointList, &Breakpoint->Link);
+ InsertTailList (&BreakpointList, &Breakpoint->Link);
// Insert the software breakpoint
*(UINT32 *)Address = GDB_ARM_BKPT;
- InvalidateInstructionCacheRange((VOID *)Address, 4);
+ InvalidateInstructionCacheRange ((VOID *)Address, 4);
//DEBUG((EFI_D_ERROR, "SetBreakpoint at 0x%08x (was: 0x%08x is:0x%08x)\n", Address, Breakpoint->Instruction, *(UINT32 *)Address));
}
@@ -572,22 +572,22 @@ ClearBreakpoint (
{
ARM_SOFTWARE_BREAKPOINT *Breakpoint;
- Breakpoint = SearchBreakpointList(Address);
+ Breakpoint = SearchBreakpointList (Address);
if (Breakpoint == NULL) {
return;
}
// Add it to the list
- RemoveEntryList(&Breakpoint->Link);
+ RemoveEntryList (&Breakpoint->Link);
// Restore the original instruction
*(UINT32 *)Address = Breakpoint->Instruction;
- InvalidateInstructionCacheRange((VOID *)Address, 4);
+ 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));
- FreePool(Breakpoint);
+ FreePool (Breakpoint);
}
VOID
@@ -602,7 +602,7 @@ InsertBreakPoint (
UINTN Length;
UINTN ErrorCode;
- ErrorCode = ParseBreakpointPacket(PacketData, &Type, &Address, &Length);
+ ErrorCode = ParseBreakpointPacket (PacketData, &Type, &Address, &Length);
if (ErrorCode > 0) {
SendError ((UINT8)ErrorCode);
return;
@@ -618,7 +618,7 @@ InsertBreakPoint (
return;
}
- SetBreakpoint(Address);
+ SetBreakpoint (Address);
SendSuccess ();
}
@@ -651,7 +651,7 @@ RemoveBreakPoint (
return;
}
- ClearBreakpoint(Address);
+ ClearBreakpoint (Address);
SendSuccess ();
}
@@ -662,7 +662,7 @@ InitializeProcessor (
)
{
// Initialize breakpoint list
- InitializeListHead(&BreakpointList);
+ InitializeListHead (&BreakpointList);
}
BOOLEAN
diff --git a/EmbeddedPkg/GdbStub/GdbStub.c b/EmbeddedPkg/GdbStub/GdbStub.c
index 8a13cc8a19..9136c14b2b 100644
--- a/EmbeddedPkg/GdbStub/GdbStub.c
+++ b/EmbeddedPkg/GdbStub/GdbStub.c
@@ -75,7 +75,6 @@ GdbStubEntry (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
-
{
EFI_STATUS Status;
EFI_DEBUG_SUPPORT_PROTOCOL *DebugSupport;
@@ -84,8 +83,7 @@ GdbStubEntry (
UINTN Index;
UINTN Processor;
BOOLEAN IsaSupported;
-
-
+
Status = EfiGetSystemConfigurationTable (&gEfiDebugImageInfoTableGuid, (VOID **)&gDebugImageTableHeader);
if (EFI_ERROR (Status)) {
gDebugImageTableHeader = NULL;
@@ -136,10 +134,9 @@ GdbStubEntry (
DEBUG ((EFI_D_INFO, "Debug Support Protocol Processor Index %d\n", gMaxProcessorIndex));
// Call processor-specific init routine
- InitializeProcessor();
+ InitializeProcessor ();
for (Processor = 0; Processor <= gMaxProcessorIndex; Processor++) {
-
for (Index = 0; Index < MaxEfiException (); Index++) {
Status = DebugSupport->RegisterExceptionCallback (DebugSupport, Processor, GdbExceptionHandler, gExceptionType[Index].Exception);
ASSERT_EFI_ERROR (Status);
@@ -165,7 +162,7 @@ GdbStubEntry (
ASSERT_EFI_ERROR (Status);
//
- // Register for protocol notifactions on this event
+ // Register for protocol notifications on this event
//
Status = gBS->RegisterProtocolNotify (
&gEfiLoadedImageProtocolGuid,
@@ -182,8 +179,6 @@ GdbStubEntry (
return EFI_SUCCESS;
}
-
-
/**
Transfer length bytes of input buffer, starting at Address, to memory.
@@ -485,12 +480,11 @@ EFIAPI
SendNotSupported (
VOID
)
-{
+{
SendPacket ("");
}
-
/**
Send the T signal with the given exception type (in gdb order) and possibly with n:r pairs related to the watchpoints
@@ -596,11 +590,11 @@ ConvertEFItoGDBtype (
IN EFI_EXCEPTION_TYPE EFIExceptionType
)
{
- UINTN i;
+ UINTN Index;
- for (i=0; i < MaxEfiException() ; i++) {
- if (gExceptionType[i].Exception == EFIExceptionType) {
- return gExceptionType[i].SignalNo;
+ for (Index = 0; Index < MaxEfiException () ; Index++) {
+ if (gExceptionType[Index].Exception == EFIExceptionType) {
+ return gExceptionType[Index].SignalNo;
}
}
return GDB_SIGTRAP; // this is a GDB trap
@@ -635,14 +629,14 @@ ReadFromMemory (
InBufPtr++; // this skips ',' in the buffer
/* Error checking */
- if (AsciiStrLen(AddressBuffer) >= MAX_ADDR_SIZE) {
+ if (AsciiStrLen (AddressBuffer) >= MAX_ADDR_SIZE) {
Print((CHAR16 *)L"Address is too long\n");
SendError (GDB_EBADMEMADDRBUFSIZE);
return;
}
// 2 = 'm' + ','
- if (AsciiStrLen(PacketData) - AsciiStrLen(AddressBuffer) - 2 >= MAX_LENGTH_SIZE) {
+ if (AsciiStrLen (PacketData) - AsciiStrLen (AddressBuffer) - 2 >= MAX_LENGTH_SIZE) {
Print((CHAR16 *)L"Length is too long\n");
SendError (GDB_EBADMEMLENGTH);
return;
@@ -699,14 +693,14 @@ WriteToMemory (
/* Error checking */
//Check if Address is not too long.
- if (AsciiStrLen(AddressBuffer) >= MAX_ADDR_SIZE) {
+ if (AsciiStrLen (AddressBuffer) >= MAX_ADDR_SIZE) {
Print ((CHAR16 *)L"Address too long..\n");
SendError (GDB_EBADMEMADDRBUFSIZE);
return;
}
//Check if message length is not too long
- if (AsciiStrLen(LengthBuffer) >= MAX_LENGTH_SIZE) {
+ if (AsciiStrLen (LengthBuffer) >= MAX_LENGTH_SIZE) {
Print ((CHAR16 *)L"Length too long..\n");
SendError (GDB_EBADMEMLENGBUFSIZE);
return;
@@ -714,7 +708,7 @@ WriteToMemory (
// Check if Message is not too long/short.
// 3 = 'M' + ',' + ':'
- MessageLength = (AsciiStrLen(PacketData) - AsciiStrLen(AddressBuffer) - AsciiStrLen(LengthBuffer) - 3);
+ MessageLength = (AsciiStrLen (PacketData) - AsciiStrLen (AddressBuffer) - AsciiStrLen (LengthBuffer) - 3);
if (MessageLength != (2*Length)) {
//Message too long/short. New data is not the right size.
SendError (GDB_EBADMEMDATASIZE);
@@ -770,7 +764,7 @@ ParseBreakpointPacket (
*AddressBufferPtr = '\0';
//Check if Address is not too long.
- if (AsciiStrLen(AddressBuffer) >= MAX_ADDR_SIZE) {
+ if (AsciiStrLen (AddressBuffer) >= MAX_ADDR_SIZE) {
Print ((CHAR16 *)L"Address too long..\n");
return 40; //EMSGSIZE: Message size too long.
}
@@ -801,7 +795,7 @@ gXferObjectReadResponse (
CHAR8 Char;
UINTN Count;
- // responce starts with 'm' or 'l' if it is the end
+ // Response starts with 'm' or 'l' if it is the end
OutBufPtr = gOutBuffer;
*OutBufPtr++ = Type;
Count = 1;
@@ -989,12 +983,11 @@ PeCoffLoaderGetDebuggerInfo (
}
-
/**
Process "qXfer:object:read:annex:offset,length" request.
Returns an XML document that contains loaded libraries. In our case it is
- infomration in the EFI Debug Inmage Table converted into an XML document.
+ information in the EFI Debug Image Table converted into an XML document.
GDB will call with an arbitrary length (it can't know the real length and
will reply with chunks of XML that are easy for us to deal with. Gdb will
@@ -1006,12 +999,12 @@ PeCoffLoaderGetDebuggerInfo (
<library name="/a/l/f/f.dll"><segment address="0x30000000"/></library>
</library-list>
- Since we can not allocate memory in interupt context this module has
+ Since we can not allocate memory in interrupt context this module has
assumptions about how it will get called:
1) Length will generally be max remote packet size (big enough)
2) First Offset of an XML document read needs to be 0
3) This code will return back small chunks of the XML document on every read.
- Each subseqent call will ask for the next availble part of the document.
+ Each subsequent call will ask for the next available part of the document.
Note: The only variable size element in the XML is:
" <library name=\"%s\"><segment address=\"%p\"/></library>\n" and it is
@@ -1039,6 +1032,7 @@ QxferLibrary (
// Force a retry from the beginning
gPacketqXferLibraryOffset = 0;
+
return;
}
@@ -1117,7 +1111,7 @@ GdbExceptionHandler (
CHAR8 *Ptr;
- if (ValidateException(ExceptionType, SystemContext) == FALSE) {
+ if (ValidateException (ExceptionType, SystemContext) == FALSE) {
return;
}
@@ -1254,7 +1248,7 @@ GdbPeriodicCallBack (
if (gCtrlCBreakFlag) {
//
// Update the context to force a single step trap when we exit the GDB
- // stub. This will trasfer control to GdbExceptionHandler () and let
+ // stub. This will transfer control to GdbExceptionHandler () and let
// us break into the program. We don't want to break into the GDB stub.
//
AddSingleStep (SystemContext);
diff --git a/EmbeddedPkg/GdbStub/GdbStubInternal.h b/EmbeddedPkg/GdbStub/GdbStubInternal.h
index 5f15420f02..e84ca3a0ab 100644
--- a/EmbeddedPkg/GdbStub/GdbStubInternal.h
+++ b/EmbeddedPkg/GdbStub/GdbStubInternal.h
@@ -63,7 +63,7 @@ extern CONST CHAR8 mHexToStr[];
#define GDB_SIGTRAP 5 // Trace Trap (Breakpoint and SingleStep)
#define GDB_SIGEMT 7 // Emulator Trap
#define GDB_SIGFPE 8 // Floating point exception
-#define GDB_SIGSEGV 11 // Setgment violation, page fault
+#define GDB_SIGSEGV 11 // Segment violation, page fault
//
diff --git a/EmbeddedPkg/GdbStub/Ia32/Processor.c b/EmbeddedPkg/GdbStub/Ia32/Processor.c
index a6aceaef99..e327b3e6db 100644
--- a/EmbeddedPkg/GdbStub/Ia32/Processor.c
+++ b/EmbeddedPkg/GdbStub/Ia32/Processor.c
@@ -147,7 +147,7 @@ CheckIsa (
@retval the pointer to the RegNumber-th pointer
**/
UINTN *
-FindPointerToRegister(
+FindPointerToRegister (
IN EFI_SYSTEM_CONTEXT SystemContext,
IN UINTN RegNumber
)
@@ -177,8 +177,8 @@ BasicReadRegister (
RegSize = 0;
while (RegSize < REG_SIZE) {
- *OutBufPtr++ = mHexToStr[((*FindPointerToRegister(SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
- *OutBufPtr++ = mHexToStr[((*FindPointerToRegister(SystemContext, RegNumber) >> RegSize) & 0xf)];
+ *OutBufPtr++ = mHexToStr[((*FindPointerToRegister (SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
+ *OutBufPtr++ = mHexToStr[((*FindPointerToRegister (SystemContext, RegNumber) >> RegSize) & 0xf)];
RegSize = RegSize + 8;
}
return OutBufPtr;
@@ -210,7 +210,7 @@ ReadNthRegister (
}
OutBufPtr = OutBuffer;
- OutBufPtr = BasicReadRegister(SystemContext, RegNumber, OutBufPtr);
+ OutBufPtr = BasicReadRegister (SystemContext, RegNumber, OutBufPtr);
*OutBufPtr = '\0'; // the end of the buffer
SendPacket(OutBuffer);
@@ -233,8 +233,8 @@ ReadGeneralRegisters (
CHAR8 *OutBufPtr; // pointer to the output buffer
OutBufPtr = OutBuffer;
- for(i = 0 ; i < MaxRegisterCount() ; i++) { // there are only 16 registers to read
- OutBufPtr = BasicReadRegister(SystemContext, i, OutBufPtr);
+ for (i = 0 ; i < MaxRegisterCount() ; i++) { // there are only 16 registers to read
+ OutBufPtr = BasicReadRegister (SystemContext, i, OutBufPtr);
}
*OutBufPtr = '\0'; // the end of the buffer
@@ -282,7 +282,7 @@ BasicWriteRegister (
NewValue += (TempValue << RegSize);
RegSize = RegSize + 8;
}
- *(FindPointerToRegister(SystemContext, RegNumber)) = NewValue;
+ *(FindPointerToRegister (SystemContext, RegNumber)) = NewValue;
return InBufPtr;
}
@@ -353,8 +353,8 @@ WriteGeneralRegisters (
// Read the new values for the registers from the input buffer to an array, NewValueArray.
// The values in the array are in the gdb ordering
- for(i=0; i < MaxRegisterCount(); i++) { // there are only 16 registers to write
- InBufPtr = BasicWriteRegister(SystemContext, i, InBufPtr);
+ for (i=0; i < MaxRegisterCount(); i++) { // there are only 16 registers to write
+ InBufPtr = BasicWriteRegister (SystemContext, i, InBufPtr);
}
SendSuccess();
@@ -867,7 +867,7 @@ InsertBreakPoint (
if (Status == EFI_UNSUPPORTED) {
Print ((CHAR16 *)L"Not supported\n");
- SendNotSupported();
+ SendNotSupported ();
return;
}
@@ -946,7 +946,7 @@ RemoveBreakPoint (
if (Status == EFI_UNSUPPORTED) {
Print ((CHAR16 *)L"Not supported.\n");
- SendNotSupported();
+ SendNotSupported ();
return;
}
@@ -956,7 +956,7 @@ RemoveBreakPoint (
}
//Remove breakpoint
- Status = DisableDebugRegister(SystemContext, Register);
+ Status = DisableDebugRegister (SystemContext, Register);
if (EFI_ERROR(Status)) {
Print ((CHAR16 *)L"Invalid argument.\n");
SendError (GDB_EINVALIDARG);
diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
index 72e6d4c6d1..fa0eccd40d 100644
--- a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
+++ b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
*
* This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License
@@ -40,36 +40,36 @@ PrintOCR (
IN UINT32 Ocr
)
{
- UINTN minv;
- UINTN maxv;
- UINTN volts;
- UINTN loop;
+ UINTN MinV;
+ UINTN MaxV;
+ UINTN Volts;
+ UINTN Loop;
- minv = 36; // 3.6
- maxv = 20; // 2.0
- volts = 20; // 2.0
+ MinV = 36; // 3.6
+ MaxV = 20; // 2.0
+ Volts = 20; // 2.0
// The MMC register bits [23:8] indicate the working range of the card
- for (loop = 8; loop < 24; loop++) {
- if (Ocr & (1 << loop)) {
- if (minv > volts) minv = volts;
- if (maxv < volts) maxv = volts + 1;
+ for (Loop = 8; Loop < 24; Loop++) {
+ if (Ocr & (1 << Loop)) {
+ if (MinV > Volts) MinV = Volts;
+ if (MaxV < Volts) MaxV = Volts + 1;
}
- volts = volts + 1;
+ Volts = Volts + 1;
}
- 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 ((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));
if (((Ocr >> 29) & 3) == 0) {
- DEBUG((EFI_D_ERROR, "\t- AccessMode: Byte Mode\n"));
+ DEBUG ((EFI_D_ERROR, "\t- AccessMode: Byte Mode\n"));
} else {
- DEBUG((EFI_D_ERROR, "\t- AccessMode: Block Mode (0x%X)\n",((Ocr >> 29) & 3)));
+ DEBUG ((EFI_D_ERROR, "\t- AccessMode: Block Mode (0x%X)\n", ((Ocr >> 29) & 3)));
}
if (Ocr & MMC_OCR_POWERUP) {
- DEBUG((EFI_D_ERROR, "\t- PowerUp\n"));
+ DEBUG ((EFI_D_ERROR, "\t- PowerUp\n"));
} else {
- DEBUG((EFI_D_ERROR, "\t- Voltage Not Supported\n"));
+ DEBUG ((EFI_D_ERROR, "\t- Voltage Not Supported\n"));
}
}
@@ -77,17 +77,19 @@ VOID 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 ((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));
}
#if !defined(MDEPKG_NDEBUG)
-CONST CHAR8* mStrUnit[] = { "100kbit/s","1Mbit/s","10Mbit/s","100MBit/s","Unkbown","Unkbown","Unkbown","Unkbown" };
-CONST CHAR8* mStrValue[] = { "1.0","1.2","1.3","1.5","2.0","2.5","3.0","3.5","4.0","4.5","5.0","Unknown","Unknown","Unknown","Unknown" };
+CONST CHAR8* mStrUnit[] = { "100kbit/s", "1Mbit/s", "10Mbit/s", "100MBit/s",
+ "Unknown", "Unknown", "Unknown", "Unknown" };
+CONST CHAR8* mStrValue[] = { "1.0", "1.2", "1.3", "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "5.0",
+ "Unknown", "Unknown", "Unknown", "Unknown" };
#endif
VOID
@@ -98,26 +100,26 @@ 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 ((EFI_D_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 ((EFI_D_ERROR, "- PrintCSD Version 2.00/High Capacity\n"));
} else {
- DEBUG((EFI_D_ERROR, "- PrintCSD Version Higher than v3.3\n"));
+ DEBUG ((EFI_D_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 ((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)));
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"));
- else if (Value == 1) DEBUG((EFI_D_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"));
- else DEBUG((EFI_D_ERROR, "\t- Format(3): Others/Unknown\n"));
+ 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"));
+ else if (Value == 1) DEBUG ((EFI_D_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"));
+ else DEBUG ((EFI_D_ERROR, "\t- Format (3): Others/Unknown\n"));
} else {
- DEBUG((EFI_D_ERROR, "\t- Format: Reserved\n"));
+ DEBUG ((EFI_D_ERROR, "\t- Format: Reserved\n"));
}
}
@@ -126,9 +128,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 ((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));
}
VOID
@@ -136,19 +138,21 @@ PrintResponseR1 (
IN UINT32 Response
)
{
- DEBUG((EFI_D_INFO, "Response: 0x%X\n",Response));
- if (Response & MMC_R0_READY_FOR_DATA) DEBUG((EFI_D_INFO, "\t- READY_FOR_DATA\n"));
-
- if (((Response >> 9) & 0xF) == 0) DEBUG((EFI_D_INFO, "\t- State: Idle\n"));
- else if (((Response >> 9) & 0xF) == 1) DEBUG((EFI_D_INFO, "\t- State: Ready\n"));
- else if (((Response >> 9) & 0xF) == 2) DEBUG((EFI_D_INFO, "\t- State: Ident\n"));
- else if (((Response >> 9) & 0xF) == 3) DEBUG((EFI_D_INFO, "\t- State: StandBy\n"));
- else if (((Response >> 9) & 0xF) == 4) DEBUG((EFI_D_INFO, "\t- State: Tran\n"));
- else if (((Response >> 9) & 0xF) == 5) DEBUG((EFI_D_INFO, "\t- State: Data\n"));
- else if (((Response >> 9) & 0xF) == 6) DEBUG((EFI_D_INFO, "\t- State: Rcv\n"));
- else if (((Response >> 9) & 0xF) == 7) DEBUG((EFI_D_INFO, "\t- State: Prg\n"));
- else if (((Response >> 9) & 0xF) == 8) DEBUG((EFI_D_INFO, "\t- State: Dis\n"));
- else DEBUG((EFI_D_INFO, "\t- State: Reserved\n"));
+ DEBUG ((EFI_D_INFO, "Response: 0x%X\n", Response));
+ if (Response & MMC_R0_READY_FOR_DATA) {
+ DEBUG ((EFI_D_INFO, "\t- READY_FOR_DATA\n"));
+ }
+
+ if (((Response >> 9) & 0xF) == 0) DEBUG ((EFI_D_INFO, "\t- State: Idle\n"));
+ else if (((Response >> 9) & 0xF) == 1) DEBUG ((EFI_D_INFO, "\t- State: Ready\n"));
+ else if (((Response >> 9) & 0xF) == 2) DEBUG ((EFI_D_INFO, "\t- State: Ident\n"));
+ else if (((Response >> 9) & 0xF) == 3) DEBUG ((EFI_D_INFO, "\t- State: StandBy\n"));
+ else if (((Response >> 9) & 0xF) == 4) DEBUG ((EFI_D_INFO, "\t- State: Tran\n"));
+ else if (((Response >> 9) & 0xF) == 5) DEBUG ((EFI_D_INFO, "\t- State: Data\n"));
+ else if (((Response >> 9) & 0xF) == 6) DEBUG ((EFI_D_INFO, "\t- State: Rcv\n"));
+ else if (((Response >> 9) & 0xF) == 7) DEBUG ((EFI_D_INFO, "\t- State: Prg\n"));
+ else if (((Response >> 9) & 0xF) == 8) DEBUG ((EFI_D_INFO, "\t- State: Dis\n"));
+ else DEBUG ((EFI_D_INFO, "\t- State: Reserved\n"));
}
EFI_STATUS
@@ -173,14 +177,14 @@ MmcGetCardStatus(
//Get the Status of the card.
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));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcGetCardStatus(MMC_CMD13): Error and Status = %r\n", Status));
return Status;
}
//Read Response
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1,Response);
- PrintResponseR1(Response[0]);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1, Response);
+ PrintResponseR1 (Response[0]);
}
return Status;
@@ -211,28 +215,28 @@ MmcIdentificationMode (
if (MmcHostInstance->State == MmcHwInitializationState) {
// Initialize the MMC Host HW
Status = MmcNotifyState (MmcHostInstance, MmcHwInitializationState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcHwInitializationState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcHwInitializationState\n"));
return Status;
}
}
Status = MmcHost->SendCommand (MmcHost, MMC_CMD0, 0);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD0): Error\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD0): Error\n"));
return Status;
}
Status = MmcNotifyState (MmcHostInstance, MmcIdleState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdleState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdleState\n"));
return Status;
}
// 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.\n"));
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD5): Error - SDIO not supported.\n"));
return EFI_UNSUPPORTED;
}
@@ -242,8 +246,8 @@ MmcIdentificationMode (
if (Status == EFI_SUCCESS) {
DEBUG ((EFI_D_ERROR, "Card is SD2.0 => Supports high capacity\n"));
IsHCS = TRUE;
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R7,Response);
- PrintResponseR1(Response[0]);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R7, Response);
+ PrintResponseR1 (Response[0]);
//check if it is valid response
if(Response[0] != CmdArg){
DEBUG ((EFI_D_ERROR, "The Card is not usable\n"));
@@ -272,8 +276,8 @@ MmcIdentificationMode (
CmdArg |= BIT30;
}
Status = MmcHost->SendCommand (MmcHost, MMC_ACMD41, CmdArg);
- if (!EFI_ERROR(Status)) {
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR,Response);
+ if (!EFI_ERROR (Status)) {
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR, Response);
((UINT32 *) &(MmcHostInstance->CardInfo.OCRData))[0] = Response[0];
}
} else {
@@ -281,15 +285,15 @@ MmcIdentificationMode (
MmcHostInstance->CardInfo.CardType = MMC_CARD;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD1, 0x800000);
- if (!EFI_ERROR(Status)) {
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR,Response);
+ if (!EFI_ERROR (Status)) {
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_OCR, Response);
((UINT32 *) &(MmcHostInstance->CardInfo.OCRData))[0] = Response[0];
}
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
if (!MmcHostInstance->CardInfo.OCRData.PowerUp) {
- MicroSecondDelay(1);
+ MicroSecondDelay (1);
Timeout--;
} else {
if ((MmcHostInstance->CardInfo.CardType == SD_CARD_2) && (MmcHostInstance->CardInfo.OCRData.AccessMode & BIT1)) {
@@ -299,35 +303,35 @@ MmcIdentificationMode (
break; // The MMC/SD card is ready. Continue the Identification Mode
}
} else {
- MicroSecondDelay(1);
+ MicroSecondDelay (1);
Timeout--;
}
}
if (Timeout == 0) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(): No Card\n"));
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(): No Card\n"));
return EFI_NO_MEDIA;
} else {
- PrintOCR(Response[0]);
+ PrintOCR (Response[0]);
}
Status = MmcNotifyState (MmcHostInstance, MmcReadyState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcReadyState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_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"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD2): Error\n"));
return Status;
}
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_CID,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_CID, Response);
PrintCID(Response);
Status = MmcNotifyState (MmcHostInstance, MmcIdentificationState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdentificationState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdentificationState\n"));
return Status;
}
@@ -338,13 +342,13 @@ MmcIdentificationMode (
//
CmdArg = 1;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD3, CmdArg);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD3): Error\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD3): Error\n"));
return Status;
}
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_RCA,Response);
- PrintRCA(Response[0]);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_RCA, Response);
+ PrintRCA (Response[0]);
// For MMC card, RCA is assigned by CMD3 while CMD3 dumps the RCA for SD card
if (MmcHostInstance->CardInfo.CardType != MMC_CARD) {
@@ -354,8 +358,8 @@ MmcIdentificationMode (
}
Status = MmcNotifyState (MmcHostInstance, MmcStandByState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcStandByState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcStandByState\n"));
return Status;
}
@@ -379,27 +383,27 @@ EFI_STATUS InitializeMmcDevice (
//Send a command to get Card specific data
CmdArg = MmcHostInstance->CardInfo.RCA << 16;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD9, CmdArg);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD9): Error, Status=%r\n", Status));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD9): Error, Status=%r\n", Status));
return Status;
}
//Read Response
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_CSD,Response);
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_CSD, Response);
PrintCSD(Response);
if (MmcHostInstance->CardInfo.CardType == SD_CARD_2_HIGH) {
- CardSize = HC_MMC_CSD_GET_DEVICESIZE(Response);
+ CardSize = HC_MMC_CSD_GET_DEVICESIZE (Response);
NumBlocks = ((CardSize + 1) * 1024);
BlockSize = 1 << MMC_CSD_GET_READBLLEN(Response);
} else {
- CardSize = MMC_CSD_GET_DEVICESIZE(Response);
- NumBlocks = (CardSize + 1) * (1 << (MMC_CSD_GET_DEVICESIZEMULT(Response) + 2));
+ CardSize = MMC_CSD_GET_DEVICESIZE (Response);
+ NumBlocks = (CardSize + 1) * (1 << (MMC_CSD_GET_DEVICESIZEMULT (Response) + 2));
BlockSize = 1 << MMC_CSD_GET_READBLLEN(Response);
}
//For >=2G card, BlockSize may be 1K, but the transfer size is 512 bytes.
if (BlockSize > 512) {
- NumBlocks = MultU64x32(NumBlocks, BlockSize/512);
+ NumBlocks = MultU64x32 (NumBlocks, BlockSize/512);
BlockSize = 512;
}
@@ -411,21 +415,21 @@ EFI_STATUS InitializeMmcDevice (
CmdArg = MmcHostInstance->CardInfo.RCA << 16;
Status = MmcHost->SendCommand (MmcHost, MMC_CMD7, CmdArg);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD7): Error and Status = %r\n", Status));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD7): Error and Status = %r\n", Status));
return Status;
}
Status = MmcNotifyState (MmcHostInstance, MmcTransferState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcTransferState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcTransferState\n"));
return Status;
}
// Set Block Length
Status = MmcHost->SendCommand (MmcHost, MMC_CMD16, MmcHostInstance->BlockIo.Media->BlockSize);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD16): Error MmcHostInstance->BlockIo.Media->BlockSize: %d and Error = %r\n",MmcHostInstance->BlockIo.Media->BlockSize, Status));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD16): Error MmcHostInstance->BlockIo.Media->BlockSize: %d and Error = %r\n", MmcHostInstance->BlockIo.Media->BlockSize, Status));
return Status;
}
@@ -446,7 +450,7 @@ MmcReset (
{
MMC_HOST_INSTANCE *MmcHostInstance;
- MmcHostInstance = MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS(This);
+ MmcHostInstance = MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS (This);
if (MmcHostInstance->MmcHost == NULL) {
// Nothing to do
@@ -506,10 +510,10 @@ MmcIoBlocks (
UINTN BytesRemainingToBeTransfered;
UINTN BlockCount = 1;
- MmcHostInstance = MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS(This);
- ASSERT(MmcHostInstance != 0);
+ MmcHostInstance = MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS (This);
+ ASSERT (MmcHostInstance != 0);
MmcHost = MmcHostInstance->MmcHost;
- ASSERT(MmcHost);
+ ASSERT (MmcHost);
if ((MmcHost == 0)|| (Buffer == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -546,16 +550,16 @@ MmcIoBlocks (
Response[0] = 0;
Timeout = 20;
while( (!(Response[0] & MMC_R0_READY_FOR_DATA))
- && (MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_TRAN)
+ && (MMC_R0_CURRENTSTATE (Response) != MMC_R0_STATE_TRAN)
&& Timeout--) {
Status = MmcHost->SendCommand (MmcHost, MMC_CMD13, CmdArg);
- if (!EFI_ERROR(Status)) {
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1,Response);
+ if (!EFI_ERROR (Status)) {
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1, Response);
}
}
if (0 == Timeout) {
- DEBUG((EFI_D_ERROR, "The Card is busy\n"));
+ DEBUG ((EFI_D_ERROR, "The Card is busy\n"));
return EFI_NOT_READY;
}
@@ -582,46 +586,46 @@ MmcIoBlocks (
#endif
}
Status = MmcHost->SendCommand (MmcHost, Cmd, CmdArg);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIoBlocks(MMC_CMD%d): Error %r\n",Cmd, Status));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIoBlocks(MMC_CMD%d): Error %r\n", Cmd, Status));
return Status;
}
if (Transfer == MMC_IOBLOCKS_READ) {
#ifndef USE_STREAM
// Read one block of Data
- Status = MmcHost->ReadBlockData (MmcHost, Lba,This->Media->BlockSize,Buffer);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_BLKIO, "MmcIoBlocks(): Error Read Block Data and Status = %r\n", Status));
+ Status = MmcHost->ReadBlockData (MmcHost, Lba, This->Media->BlockSize, Buffer);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_BLKIO, "MmcIoBlocks(): Error Read Block Data and Status = %r\n", Status));
return Status;
}
#else
//TODO: Read a stream
- ASSERT(0);
+ ASSERT (0);
#endif
Status = MmcNotifyState (MmcHostInstance, MmcProgrammingState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIoBlocks() : Error MmcProgrammingState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIoBlocks() : Error MmcProgrammingState\n"));
return Status;
}
} else {
#ifndef USE_STREAM
// Write one block of Data
- Status = MmcHost->WriteBlockData (MmcHost, Lba,This->Media->BlockSize,Buffer);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_BLKIO, "MmcIoBlocks(): Error Write Block Data and Status = %r\n", Status));
+ Status = MmcHost->WriteBlockData (MmcHost, Lba, This->Media->BlockSize, Buffer);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_BLKIO, "MmcIoBlocks(): Error Write Block Data and Status = %r\n", Status));
return Status;
}
#else
//TODO: Write a stream
- ASSERT(0);
+ ASSERT (0);
#endif
}
// Command 12 - Stop transmission (ends read)
Status = MmcHost->SendCommand (MmcHost, MMC_CMD12, 0);
- if (!EFI_ERROR(Status)) {
- MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1b,Response);
+ if (!EFI_ERROR (Status)) {
+ MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1b, Response);
}
// Command 13 - Read status and wait for programming to complete (return to tran)
@@ -629,21 +633,21 @@ MmcIoBlocks (
CmdArg = MmcHostInstance->CardInfo.RCA << 16;
Response[0] = 0;
while( (!(Response[0] & MMC_R0_READY_FOR_DATA))
- && (MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_TRAN)
+ && (MMC_R0_CURRENTSTATE (Response) != MMC_R0_STATE_TRAN)
&& Timeout--) {
Status = MmcHost->SendCommand (MmcHost, MMC_CMD13, CmdArg);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1, Response);
if ((Response[0] & MMC_R0_READY_FOR_DATA)) {
break; // Prevents delay once finished
}
}
- NanoSecondDelay(100);
+ NanoSecondDelay (100);
}
Status = MmcNotifyState (MmcHostInstance, MmcTransferState);
- if (EFI_ERROR(Status)) {
- DEBUG((EFI_D_ERROR, "MmcIoBlocks() : Error MmcTransferState\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MmcIoBlocks() : Error MmcTransferState\n"));
return Status;
}
@@ -689,4 +693,3 @@ MmcFlushBlocks (
{
return EFI_SUCCESS;
}
-