MmcDxe Diagnostics: return EFI_UNSUPPORTED for Language other than english

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14706 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Olivier Martin 2013-09-23 09:43:51 +00:00 committed by oliviermartin
parent 1d7b547e69
commit c8af31eca6
1 changed files with 11 additions and 5 deletions

View File

@ -17,6 +17,7 @@
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h> #include <Library/MemoryAllocationLib.h>
#include <Library/BaseLib.h>
#include "Mmc.h" #include "Mmc.h"
@ -31,7 +32,7 @@ DiagnosticInitLog (
) )
{ {
mLogRemainChar = MaxBufferChar; mLogRemainChar = MaxBufferChar;
mLogBuffer = AllocatePool ((UINTN)MaxBufferChar * sizeof(CHAR16)); mLogBuffer = AllocatePool ((UINTN)MaxBufferChar * sizeof (CHAR16));
return mLogBuffer; return mLogBuffer;
} }
@ -79,8 +80,8 @@ CompareBuffer (
for (i = 0; i < (BufferSize >> 3); i++) { for (i = 0; i < (BufferSize >> 3); i++) {
if (*BufferA64 != *BufferB64) { if (*BufferA64 != *BufferB64) {
DEBUG((EFI_D_ERROR, "CompareBuffer: Error at %i", i)); DEBUG ((EFI_D_ERROR, "CompareBuffer: Error at %i", i));
DEBUG((EFI_D_ERROR, "(0x%lX) != (0x%lX)\n", *BufferA64, *BufferB64)); DEBUG ((EFI_D_ERROR, "(0x%lX) != (0x%lX)\n", *BufferA64, *BufferB64));
return FALSE; return FALSE;
} }
BufferA64++; BufferA64++;
@ -192,6 +193,11 @@ MmcDriverDiagnosticsRunDiagnostics (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// Check Language is supported (i.e. is "en-*" - only English is supported)
if (AsciiStrnCmp (Language, "en", 2) != 0) {
return EFI_UNSUPPORTED;
}
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
*ErrorType = NULL; *ErrorType = NULL;
*BufferSize = DIAGNOSTIC_LOGBUFFER_MAXCHAR; *BufferSize = DIAGNOSTIC_LOGBUFFER_MAXCHAR;
@ -202,8 +208,8 @@ MmcDriverDiagnosticsRunDiagnostics (
// For each MMC instance // For each MMC instance
CurrentLink = mMmcHostPool.ForwardLink; CurrentLink = mMmcHostPool.ForwardLink;
while (CurrentLink != NULL && CurrentLink != &mMmcHostPool && (Status == EFI_SUCCESS)) { while (CurrentLink != NULL && CurrentLink != &mMmcHostPool && (Status == EFI_SUCCESS)) {
MmcHostInstance = MMC_HOST_INSTANCE_FROM_LINK(CurrentLink); MmcHostInstance = MMC_HOST_INSTANCE_FROM_LINK (CurrentLink);
ASSERT(MmcHostInstance != NULL); ASSERT (MmcHostInstance != NULL);
// LBA=1 Size=BlockSize // LBA=1 Size=BlockSize
DiagnosticLog (L"MMC Driver Diagnostics - Test: First Block\n"); DiagnosticLog (L"MMC Driver Diagnostics - Test: First Block\n");