From 11c20f4e06d252feaa65aa5e526686baf015762d Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Thu, 22 Sep 2011 22:53:54 +0000 Subject: Arm Packages: Fixed coding style/Line endings to follow EDK2 coding convention Arm Packages: Fixed mispelling Arm Packages: Reduced warnings all over the code git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12407 6f19259b-4bc3-4df7-8a09-765794883524 --- EmbeddedPkg/Ebl/HwDebug.c | 4 +- EmbeddedPkg/EblExternCmd/EntryPointGlue.c | 2 + EmbeddedPkg/EblExternCmd/Main.c | 1 + EmbeddedPkg/EmbeddedPkg.dsc | 3 - EmbeddedPkg/GdbStub/Arm/Processor.c | 6 +- EmbeddedPkg/GdbStub/GdbStub.c | 5 +- EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c | 6 +- EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.c | 1 - .../TemplateSerialPortLib/TemplateSerialPortLib.c | 10 +- EmbeddedPkg/Universal/MmcDxe/Diagnostics.c | 323 +++++++++++---------- 10 files changed, 192 insertions(+), 169 deletions(-) (limited to 'EmbeddedPkg') diff --git a/EmbeddedPkg/Ebl/HwDebug.c b/EmbeddedPkg/Ebl/HwDebug.c index 2ecf9d6d31..1b33222827 100644 --- a/EmbeddedPkg/Ebl/HwDebug.c +++ b/EmbeddedPkg/Ebl/HwDebug.c @@ -24,7 +24,7 @@ /** Dump memory - Argv[0] - "md"[.#] # is optiona width 1, 2, 4, or 8. Default 1 + Argv[0] - "md"[.#] # is optional width 1, 2, 4, or 8. Default 1 Argv[1] - Hex Address to dump Argv[2] - Number of hex bytes to dump (0x20 is default) @@ -34,7 +34,7 @@ @param Argc Number of command arguments in Argv @param Argv Array of strings that represent the parsed command line. - Argv[0] is the comamnd name + Argv[0] is the command name @return EFI_SUCCESS diff --git a/EmbeddedPkg/EblExternCmd/EntryPointGlue.c b/EmbeddedPkg/EblExternCmd/EntryPointGlue.c index cffd844bd0..87757dfd47 100644 --- a/EmbeddedPkg/EblExternCmd/EntryPointGlue.c +++ b/EmbeddedPkg/EblExternCmd/EntryPointGlue.c @@ -17,6 +17,8 @@ **/ +#include "Ebl.h" + #define CMD_SEPARATOR ';' #define MAX_ARGS 32 diff --git a/EmbeddedPkg/EblExternCmd/Main.c b/EmbeddedPkg/EblExternCmd/Main.c index 9f38c5de58..9e75c909cc 100644 --- a/EmbeddedPkg/EblExternCmd/Main.c +++ b/EmbeddedPkg/EblExternCmd/Main.c @@ -23,6 +23,7 @@ **/ +#include "Ebl.h" /** Entry point with Argc, Argv. Put your code here. diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc index 0ee7122a0f..8862f3d1ec 100644 --- a/EmbeddedPkg/EmbeddedPkg.dsc +++ b/EmbeddedPkg/EmbeddedPkg.dsc @@ -172,9 +172,6 @@ gEmbeddedTokenSpaceGuid.PcdPrePiHobBase|0 gEmbeddedTokenSpaceGuid.PcdPrePiStackBase|0 gEmbeddedTokenSpaceGuid.PcdPrePiStackSize|0 - gEmbeddedTokenSpaceGuid.PcdPrePiTempMemorySize|0 - gEmbeddedTokenSpaceGuid.PcdPrePiBfvBaseAddress|0 - gEmbeddedTokenSpaceGuid.PcdPrePiBfvSize|0 # # Optinal feature to help prevent EFI memory map fragments diff --git a/EmbeddedPkg/GdbStub/Arm/Processor.c b/EmbeddedPkg/GdbStub/Arm/Processor.c index 7626f5df52..2d33d97290 100644 --- a/EmbeddedPkg/GdbStub/Arm/Processor.c +++ b/EmbeddedPkg/GdbStub/Arm/Processor.c @@ -195,7 +195,7 @@ BasicReadRegister ( } -/** ‘p n’ +/** Reads the n-th register's value into an output buffer and sends it as a packet @param SystemContext Register content at time of the exception @param InBuffer Pointer to the input buffer received from gdb server @@ -225,7 +225,7 @@ ReadNthRegister ( } -/** ‘g’ +/** Reads the general registers into an output buffer and sends it as a packet @param SystemContext Register content at time of the exception **/ @@ -452,7 +452,7 @@ RemoveSingleStep ( -/** ‘c [addr ]’ +/** Continue. addr is Address to resume. If addr is omitted, resume at current Address. diff --git a/EmbeddedPkg/GdbStub/GdbStub.c b/EmbeddedPkg/GdbStub/GdbStub.c index c2d8be868d..742de505ca 100644 --- a/EmbeddedPkg/GdbStub/GdbStub.c +++ b/EmbeddedPkg/GdbStub/GdbStub.c @@ -132,9 +132,8 @@ GdbStubEntry ( Status = DebugSupport->GetMaximumProcessorIndex (DebugSupport, &gMaxProcessorIndex); ASSERT_EFI_ERROR (Status); - // Make this an EFI_D_INFO after we get everything debugged. - DEBUG ((EFI_D_ERROR, "Debug Support Protocol ISA %x\n", DebugSupport->Isa)); - DEBUG ((EFI_D_ERROR, "Debug Support Protocol Processor Index %d\n", gMaxProcessorIndex)); + DEBUG ((EFI_D_INFO, "Debug Support Protocol ISA %x\n", DebugSupport->Isa)); + DEBUG ((EFI_D_INFO, "Debug Support Protocol Processor Index %d\n", gMaxProcessorIndex)); // Call processor-specific init routine InitializeProcessor(); diff --git a/EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c b/EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c index d3c050499a..e6aabf940a 100755 --- a/EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c +++ b/EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c @@ -210,7 +210,7 @@ BasicReadRegister ( } -/** ‘p n’ +/** Reads the n-th register's value into an output buffer and sends it as a packet @param SystemContext Register content at time of the exception @param InBuffer Pointer to the input buffer received from gdb server @@ -240,7 +240,7 @@ ReadNthRegister ( } -/** ‘g’ +/** Reads the general registers into an output buffer and sends it as a packet @param SystemContext Register content at time of the exception **/ @@ -390,7 +390,7 @@ WriteGeneralRegisters ( -/** ‘c [addr ]’ +/** Continue. addr is Address to resume. If addr is omitted, resume at current Address. diff --git a/EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.c b/EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.c index e12a5ac38e..eb4b66c3ad 100755 --- a/EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.c +++ b/EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.c @@ -678,7 +678,6 @@ GdbFWrite ( case 'F': return; - break; } } } diff --git a/EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.c b/EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.c index a446f6a5b8..9cc2b79a8c 100644 --- a/EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.c +++ b/EmbeddedPkg/Library/TemplateSerialPortLib/TemplateSerialPortLib.c @@ -37,11 +37,11 @@ SerialPortInitialize ( /** Write data to serial device. - @param Buffer Point of data buffer which need to be writed. + @param Buffer Point of data buffer which need to be written. @param NumberOfBytes Number of output bytes which are cached in Buffer. @retval 0 Write data failed. - @retval !0 Actual number of bytes writed to serial device. + @retval !0 Actual number of bytes written to serial device. **/ UINTN @@ -56,13 +56,13 @@ SerialPortWrite ( /** - Read data from serial device and save the datas in buffer. + Read data from serial device and save the data in buffer. - @param Buffer Point of data buffer which need to be writed. + @param Buffer Point of data buffer which need to be written. @param NumberOfBytes Number of output bytes which are cached in Buffer. @retval 0 Read data failed. - @retval !0 Aactual number of bytes read from serial device. + @retval !0 Actual number of bytes read from serial device. **/ UINTN diff --git a/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c b/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c index a477135684..516c832bb5 100644 --- a/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c +++ b/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c @@ -25,121 +25,146 @@ CHAR16* mLogBuffer = NULL; UINTN mLogRemainChar = 0; -CHAR16* DiagnosticInitLog(UINTN MaxBufferChar) { - mLogRemainChar = MaxBufferChar; - mLogBuffer = AllocatePool ((UINTN)MaxBufferChar * sizeof(CHAR16)); - return mLogBuffer; +CHAR16* +DiagnosticInitLog ( + UINTN MaxBufferChar + ) +{ + mLogRemainChar = MaxBufferChar; + mLogBuffer = AllocatePool ((UINTN)MaxBufferChar * sizeof(CHAR16)); + return mLogBuffer; } -UINTN DiagnosticLog(CONST CHAR16* Str) { - UINTN len = StrLen (Str); - if (len <= mLogRemainChar) { - mLogRemainChar -= len; - StrCpy (mLogBuffer, Str); - mLogBuffer += len; - return len; - } else { - return 0; - } +UINTN +DiagnosticLog ( + CONST CHAR16* Str + ) +{ + UINTN len = StrLen (Str); + if (len <= mLogRemainChar) { + mLogRemainChar -= len; + StrCpy (mLogBuffer, Str); + mLogBuffer += len; + return len; + } else { + return 0; + } } -VOID GenerateRandomBuffer(VOID* Buffer, UINTN BufferSize) { - UINT64 i; - UINT64* Buffer64 = (UINT64*)Buffer; +VOID +GenerateRandomBuffer ( + VOID* Buffer, + UINTN BufferSize + ) +{ + UINT64 i; + UINT64* Buffer64 = (UINT64*)Buffer; - for (i = 0; i < (BufferSize >> 3); i++) { - *Buffer64 = i | (~i << 32); - Buffer64++; - } + for (i = 0; i < (BufferSize >> 3); i++) { + *Buffer64 = i | (~i << 32); + Buffer64++; + } } -BOOLEAN CompareBuffer(VOID *BufferA, VOID *BufferB, UINTN BufferSize) { - UINTN i; - UINT64* BufferA64 = (UINT64*)BufferA; - UINT64* BufferB64 = (UINT64*)BufferB; - - 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)); - return FALSE; - } - BufferA64++; - BufferB64++; +BOOLEAN +CompareBuffer ( + VOID *BufferA, + VOID *BufferB, + UINTN BufferSize + ) +{ + UINTN i; + UINT64* BufferA64 = (UINT64*)BufferA; + UINT64* BufferB64 = (UINT64*)BufferB; + + 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)); + return FALSE; } - return TRUE; + BufferA64++; + BufferB64++; + } + return TRUE; } -EFI_STATUS MmcReadWriteDataTest(MMC_HOST_INSTANCE *MmcHostInstance, EFI_LBA Lba, UINTN BufferSize) { - VOID *BackBuffer; - VOID *WriteBuffer; - VOID *ReadBuffer; - EFI_STATUS Status; - - // Check if a Media is Present - if (!MmcHostInstance->BlockIo.Media->MediaPresent) { - DiagnosticLog(L"ERROR: No Media Present\n"); - return EFI_NO_MEDIA; - } - - if (MmcHostInstance->State != MmcTransferState) { - DiagnosticLog(L"ERROR: Not ready for Transfer state\n"); - return EFI_NOT_READY; - } - - BackBuffer = AllocatePool(BufferSize); - WriteBuffer = AllocatePool(BufferSize); - ReadBuffer = AllocatePool(BufferSize); - - // Read (and save) buffer at a specific location - Status = MmcReadBlocks (&(MmcHostInstance->BlockIo), MmcHostInstance->BlockIo.Media->MediaId,Lba,BufferSize,BackBuffer); - if (Status != EFI_SUCCESS) { - DiagnosticLog(L"ERROR: Fail to Read Block (1)\n"); - return Status; - } - - // Write buffer at the same location - GenerateRandomBuffer(WriteBuffer,BufferSize); - Status = MmcWriteBlocks (&(MmcHostInstance->BlockIo), MmcHostInstance->BlockIo.Media->MediaId,Lba,BufferSize,WriteBuffer); - if (Status != EFI_SUCCESS) { - DiagnosticLog(L"ERROR: Fail to Write Block (1)\n"); - return Status; - } - - // Read the buffer at the same location - Status = MmcReadBlocks (&(MmcHostInstance->BlockIo), MmcHostInstance->BlockIo.Media->MediaId,Lba,BufferSize,ReadBuffer); - if (Status != EFI_SUCCESS) { - DiagnosticLog(L"ERROR: Fail to Read Block (2)\n"); - return Status; - } +EFI_STATUS +MmcReadWriteDataTest ( + MMC_HOST_INSTANCE *MmcHostInstance, + EFI_LBA Lba, + UINTN BufferSize + ) +{ + VOID *BackBuffer; + VOID *WriteBuffer; + VOID *ReadBuffer; + EFI_STATUS Status; + + // Check if a Media is Present + if (!MmcHostInstance->BlockIo.Media->MediaPresent) { + DiagnosticLog (L"ERROR: No Media Present\n"); + return EFI_NO_MEDIA; + } + + if (MmcHostInstance->State != MmcTransferState) { + DiagnosticLog (L"ERROR: Not ready for Transfer state\n"); + return EFI_NOT_READY; + } + + BackBuffer = AllocatePool (BufferSize); + WriteBuffer = AllocatePool (BufferSize); + ReadBuffer = AllocatePool (BufferSize); + + // Read (and save) buffer at a specific location + Status = MmcReadBlocks (&(MmcHostInstance->BlockIo), MmcHostInstance->BlockIo.Media->MediaId,Lba,BufferSize,BackBuffer); + if (Status != EFI_SUCCESS) { + DiagnosticLog (L"ERROR: Fail to Read Block (1)\n"); + return Status; + } - // Check that is conform - if (!CompareBuffer(ReadBuffer,WriteBuffer,BufferSize)) { - DiagnosticLog(L"ERROR: Fail to Read/Write Block (1)\n"); - return EFI_INVALID_PARAMETER; - } + // Write buffer at the same location + GenerateRandomBuffer (WriteBuffer,BufferSize); + Status = MmcWriteBlocks (&(MmcHostInstance->BlockIo), MmcHostInstance->BlockIo.Media->MediaId,Lba,BufferSize,WriteBuffer); + if (Status != EFI_SUCCESS) { + DiagnosticLog (L"ERROR: Fail to Write Block (1)\n"); + return Status; + } - // Restore content at the original location - Status = MmcWriteBlocks (&(MmcHostInstance->BlockIo), MmcHostInstance->BlockIo.Media->MediaId,Lba,BufferSize,BackBuffer); - if (Status != EFI_SUCCESS) { - DiagnosticLog(L"ERROR: Fail to Write Block (2)\n"); - return Status; - } + // Read the buffer at the same location + Status = MmcReadBlocks (&(MmcHostInstance->BlockIo), MmcHostInstance->BlockIo.Media->MediaId,Lba,BufferSize,ReadBuffer); + if (Status != EFI_SUCCESS) { + DiagnosticLog (L"ERROR: Fail to Read Block (2)\n"); + return Status; + } + + // Check that is conform + if (!CompareBuffer (ReadBuffer,WriteBuffer,BufferSize)) { + DiagnosticLog (L"ERROR: Fail to Read/Write Block (1)\n"); + return EFI_INVALID_PARAMETER; + } + + // Restore content at the original location + Status = MmcWriteBlocks (&(MmcHostInstance->BlockIo), MmcHostInstance->BlockIo.Media->MediaId,Lba,BufferSize,BackBuffer); + if (Status != EFI_SUCCESS) { + DiagnosticLog (L"ERROR: Fail to Write Block (2)\n"); + return Status; + } - // Read the restored content - Status = MmcReadBlocks (&(MmcHostInstance->BlockIo), MmcHostInstance->BlockIo.Media->MediaId,Lba,BufferSize,ReadBuffer); - if (Status != EFI_SUCCESS) { - DiagnosticLog(L"ERROR: Fail to Read Block (3)\n"); - return Status; - } + // Read the restored content + Status = MmcReadBlocks (&(MmcHostInstance->BlockIo), MmcHostInstance->BlockIo.Media->MediaId,Lba,BufferSize,ReadBuffer); + if (Status != EFI_SUCCESS) { + DiagnosticLog (L"ERROR: Fail to Read Block (3)\n"); + return Status; + } - // Check the content is correct - if (!CompareBuffer(ReadBuffer,BackBuffer,BufferSize)) { - DiagnosticLog(L"ERROR: Fail to Read/Write Block (2)\n"); - return EFI_INVALID_PARAMETER; - } + // Check the content is correct + if (!CompareBuffer (ReadBuffer,BackBuffer,BufferSize)) { + DiagnosticLog (L"ERROR: Fail to Read/Write Block (2)\n"); + return EFI_INVALID_PARAMETER; + } - return EFI_SUCCESS; + return EFI_SUCCESS; } EFI_STATUS @@ -155,55 +180,55 @@ MmcDriverDiagnosticsRunDiagnostics ( OUT CHAR16 **Buffer ) { - LIST_ENTRY *CurrentLink; - MMC_HOST_INSTANCE *MmcHostInstance; - EFI_STATUS Status; - - if (Language == NULL || - ErrorType == NULL || - Buffer == NULL || - ControllerHandle == NULL || - BufferSize == NULL) { - return EFI_INVALID_PARAMETER; - } - - Status = EFI_SUCCESS; - *ErrorType = NULL; - *BufferSize = DIAGNOSTIC_LOGBUFFER_MAXCHAR; - *Buffer = DiagnosticInitLog(DIAGNOSTIC_LOGBUFFER_MAXCHAR); - - DiagnosticLog(L"MMC Driver Diagnostics\n"); - - // For each MMC instance - CurrentLink = mMmcHostPool.ForwardLink; - while (CurrentLink != NULL && CurrentLink != &mMmcHostPool && (Status == EFI_SUCCESS)) { - MmcHostInstance = MMC_HOST_INSTANCE_FROM_LINK(CurrentLink); - ASSERT(MmcHostInstance != NULL); - - // LBA=1 Size=BlockSize - DiagnosticLog(L"MMC Driver Diagnostics - Test: First Block\n"); - Status = MmcReadWriteDataTest(MmcHostInstance, 1, MmcHostInstance->BlockIo.Media->BlockSize); - - // LBA=2 Size=BlockSize - DiagnosticLog(L"MMC Driver Diagnostics - Test: Second Block\n"); - Status = MmcReadWriteDataTest(MmcHostInstance, 2, MmcHostInstance->BlockIo.Media->BlockSize); - - // LBA=10 Size=BlockSize - DiagnosticLog(L"MMC Driver Diagnostics - Test: Any Block\n"); - Status = MmcReadWriteDataTest(MmcHostInstance, MmcHostInstance->BlockIo.Media->LastBlock >> 1, MmcHostInstance->BlockIo.Media->BlockSize); - - // LBA=LastBlock Size=BlockSize - DiagnosticLog(L"MMC Driver Diagnostics - Test: Last Block\n"); - Status = MmcReadWriteDataTest(MmcHostInstance, MmcHostInstance->BlockIo.Media->LastBlock, MmcHostInstance->BlockIo.Media->BlockSize); - - // LBA=1 Size=2*BlockSize - DiagnosticLog(L"MMC Driver Diagnostics - Test: First Block / 2 BlockSSize\n"); - Status = MmcReadWriteDataTest(MmcHostInstance, 1, 2*MmcHostInstance->BlockIo.Media->BlockSize); - - CurrentLink = CurrentLink->ForwardLink; - } - - return Status; + LIST_ENTRY *CurrentLink; + MMC_HOST_INSTANCE *MmcHostInstance; + EFI_STATUS Status; + + if ((Language == NULL) || + (ErrorType == NULL) || + (Buffer == NULL) || + (ControllerHandle == NULL) || + (BufferSize == NULL)) { + return EFI_INVALID_PARAMETER; + } + + Status = EFI_SUCCESS; + *ErrorType = NULL; + *BufferSize = DIAGNOSTIC_LOGBUFFER_MAXCHAR; + *Buffer = DiagnosticInitLog (DIAGNOSTIC_LOGBUFFER_MAXCHAR); + + DiagnosticLog (L"MMC Driver Diagnostics\n"); + + // For each MMC instance + CurrentLink = mMmcHostPool.ForwardLink; + while (CurrentLink != NULL && CurrentLink != &mMmcHostPool && (Status == EFI_SUCCESS)) { + MmcHostInstance = MMC_HOST_INSTANCE_FROM_LINK(CurrentLink); + ASSERT(MmcHostInstance != NULL); + + // LBA=1 Size=BlockSize + DiagnosticLog (L"MMC Driver Diagnostics - Test: First Block\n"); + Status = MmcReadWriteDataTest (MmcHostInstance, 1, MmcHostInstance->BlockIo.Media->BlockSize); + + // LBA=2 Size=BlockSize + DiagnosticLog (L"MMC Driver Diagnostics - Test: Second Block\n"); + Status = MmcReadWriteDataTest (MmcHostInstance, 2, MmcHostInstance->BlockIo.Media->BlockSize); + + // LBA=10 Size=BlockSize + DiagnosticLog (L"MMC Driver Diagnostics - Test: Any Block\n"); + Status = MmcReadWriteDataTest (MmcHostInstance, MmcHostInstance->BlockIo.Media->LastBlock >> 1, MmcHostInstance->BlockIo.Media->BlockSize); + + // LBA=LastBlock Size=BlockSize + DiagnosticLog (L"MMC Driver Diagnostics - Test: Last Block\n"); + Status = MmcReadWriteDataTest (MmcHostInstance, MmcHostInstance->BlockIo.Media->LastBlock, MmcHostInstance->BlockIo.Media->BlockSize); + + // LBA=1 Size=2*BlockSize + DiagnosticLog (L"MMC Driver Diagnostics - Test: First Block / 2 BlockSSize\n"); + Status = MmcReadWriteDataTest (MmcHostInstance, 1, 2*MmcHostInstance->BlockIo.Media->BlockSize); + + CurrentLink = CurrentLink->ForwardLink; + } + + return Status; } // -- cgit v1.2.3