diff options
author | Olivier Martin <olivier.martin@arm.com> | 2014-01-09 19:15:06 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-01-09 19:15:06 +0000 |
commit | 5c5a34d485eb200c81f89ebc8553a77167ba2c44 (patch) | |
tree | 18eade33f83c48d18d9b94e99075eac6d3b0402e /EmbeddedPkg/Universal | |
parent | b4fdedc2543c6d193c70ae5339a56824a9729e68 (diff) | |
download | edk2-platforms-5c5a34d485eb200c81f89ebc8553a77167ba2c44.tar.xz |
MmcDxe: Perform diagnostics specifically on the requested controller
In RunDiagnostics, find the controller specified by ControllerHandle and run
diagnostics only on that controller, returning EFI_UNSUPPORTED if it isn't in
the driver's pool of managed devices.
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@15075 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EmbeddedPkg/Universal')
-rw-r--r-- | EmbeddedPkg/Universal/MmcDxe/Diagnostics.c | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c b/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c index 14035afb10..310b7cc820 100644 --- a/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c +++ b/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c @@ -1,7 +1,7 @@ /** @file
Diagnostics Protocol implementation for the MMC DXE driver
- Copyright (c) 2011, ARM Limited. All rights reserved.
+ Copyright (c) 2011-2014, 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
@@ -205,34 +205,43 @@ MmcDriverDiagnosticsRunDiagnostics ( DiagnosticLog (L"MMC Driver Diagnostics\n");
- // For each MMC instance
+ // Find the MMC Host instance on which we have been asked to run diagnostics
+ MmcHostInstance = NULL;
CurrentLink = mMmcHostPool.ForwardLink;
while (CurrentLink != NULL && CurrentLink != &mMmcHostPool && (Status == EFI_SUCCESS)) {
- MmcHostInstance = MMC_HOST_INSTANCE_FROM_LINK (CurrentLink);
- ASSERT (MmcHostInstance != NULL);
+ MmcHostInstance = MMC_HOST_INSTANCE_FROM_LINK(CurrentLink);
+ ASSERT(MmcHostInstance != NULL);
+ if (MmcHostInstance->MmcHandle == ControllerHandle) {
+ break;
+ }
+ CurrentLink = CurrentLink->ForwardLink;
+ }
- // LBA=1 Size=BlockSize
- DiagnosticLog (L"MMC Driver Diagnostics - Test: First Block\n");
- Status = MmcReadWriteDataTest (MmcHostInstance, 1, MmcHostInstance->BlockIo.Media->BlockSize);
+ // If we didn't find the controller, return EFI_UNSUPPORTED
+ if ((MmcHostInstance == NULL)
+ || (MmcHostInstance->MmcHandle != ControllerHandle)) {
+ return EFI_UNSUPPORTED;
+ }
- // LBA=2 Size=BlockSize
- DiagnosticLog (L"MMC Driver Diagnostics - Test: Second Block\n");
- Status = MmcReadWriteDataTest (MmcHostInstance, 2, MmcHostInstance->BlockIo.Media->BlockSize);
+ // LBA=1 Size=BlockSize
+ DiagnosticLog (L"MMC Driver Diagnostics - Test: First Block\n");
+ Status = MmcReadWriteDataTest (MmcHostInstance, 1, 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=2 Size=BlockSize
+ DiagnosticLog (L"MMC Driver Diagnostics - Test: Second Block\n");
+ Status = MmcReadWriteDataTest (MmcHostInstance, 2, 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=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=1 Size=2*BlockSize
- DiagnosticLog (L"MMC Driver Diagnostics - Test: First Block / 2 BlockSSize\n");
- Status = MmcReadWriteDataTest (MmcHostInstance, 1, 2*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);
- CurrentLink = CurrentLink->ForwardLink;
- }
+ // 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);
return Status;
}
|