summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ArmPkg/Library/BdsLib/BdsFilePath.c126
-rw-r--r--ArmPlatformPkg/PrePeiCore/MainMPCore.c4
-rw-r--r--ArmPlatformPkg/Sec/Sec.c10
-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
8 files changed, 277 insertions, 280 deletions
diff --git a/ArmPkg/Library/BdsLib/BdsFilePath.c b/ArmPkg/Library/BdsLib/BdsFilePath.c
index 2c93243795..2f8788ad1f 100644
--- a/ArmPkg/Library/BdsLib/BdsFilePath.c
+++ b/ArmPkg/Library/BdsLib/BdsFilePath.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
@@ -77,14 +77,14 @@ BdsGetDeviceUsb (
// Get all the UsbIo handles
UsbIoHandleCount = 0;
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiUsbIoProtocolGuid, NULL, &UsbIoHandleCount, &UsbIoBuffer);
- if (EFI_ERROR(Status) || (UsbIoHandleCount == 0)) {
+ if (EFI_ERROR (Status) || (UsbIoHandleCount == 0)) {
return Status;
}
// Check if one of the handles matches the USB description
for (Index = 0; Index < UsbIoHandleCount; Index++) {
Status = gBS->HandleProtocol (UsbIoBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **) &UsbIoDevicePath);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
TmpDevicePath = UsbIoDevicePath;
while (!IsDevicePathEnd (TmpDevicePath)) {
// Check if the Device Path node is a USB Removable device Path node
@@ -94,11 +94,11 @@ BdsGetDeviceUsb (
WwidDevicePath2 = (USB_WWID_DEVICE_PATH*)TmpDevicePath;
if ((WwidDevicePath1->VendorId == WwidDevicePath2->VendorId) &&
(WwidDevicePath1->ProductId == WwidDevicePath2->ProductId) &&
- (CompareMem (WwidDevicePath1+1, WwidDevicePath2+1, DevicePathNodeLength(WwidDevicePath1)-sizeof(USB_WWID_DEVICE_PATH)) == 0))
+ (CompareMem (WwidDevicePath1+1, WwidDevicePath2+1, DevicePathNodeLength(WwidDevicePath1)-sizeof (USB_WWID_DEVICE_PATH)) == 0))
{
*DeviceHandle = UsbIoBuffer[Index];
// Add the additional original Device Path Nodes (eg: FilePath Device Path Node) to the new Device Path
- *NewDevicePath = AppendDevicePath (UsbIoDevicePath, NextDevicePathNode(RemovableDevicePath));
+ *NewDevicePath = AppendDevicePath (UsbIoDevicePath, NextDevicePathNode (RemovableDevicePath));
return EFI_SUCCESS;
}
} else {
@@ -112,7 +112,7 @@ BdsGetDeviceUsb (
{
*DeviceHandle = UsbIoBuffer[Index];
// Add the additional original Device Path Nodes (eg: FilePath Device Path Node) to the new Device Path
- *NewDevicePath = AppendDevicePath (UsbIoDevicePath, NextDevicePathNode(RemovableDevicePath));
+ *NewDevicePath = AppendDevicePath (UsbIoDevicePath, NextDevicePathNode (RemovableDevicePath));
return EFI_SUCCESS;
}
}
@@ -131,7 +131,7 @@ BdsIsRemovableHd (
IN EFI_DEVICE_PATH* DevicePath
)
{
- return IS_DEVICE_PATH_NODE(DevicePath, MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP);
+ return IS_DEVICE_PATH_NODE (DevicePath, MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP);
}
EFI_STATUS
@@ -153,14 +153,14 @@ BdsGetDeviceHd (
// Get all the DiskIo handles
PartitionHandleCount = 0;
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiDiskIoProtocolGuid, NULL, &PartitionHandleCount, &PartitionBuffer);
- if (EFI_ERROR(Status) || (PartitionHandleCount == 0)) {
+ if (EFI_ERROR (Status) || (PartitionHandleCount == 0)) {
return Status;
}
// Check if one of the handles matches the Hard Disk Description
for (Index = 0; Index < PartitionHandleCount; Index++) {
Status = gBS->HandleProtocol (PartitionBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **) &PartitionDevicePath);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
TmpDevicePath = PartitionDevicePath;
while (!IsDevicePathEnd (TmpDevicePath)) {
// Check if the Device Path node is a HD Removable device Path node
@@ -168,12 +168,12 @@ BdsGetDeviceHd (
HardDriveDevicePath1 = (HARDDRIVE_DEVICE_PATH*)RemovableDevicePath;
HardDriveDevicePath2 = (HARDDRIVE_DEVICE_PATH*)TmpDevicePath;
if ((HardDriveDevicePath1->SignatureType == HardDriveDevicePath2->SignatureType) &&
- (CompareGuid ((EFI_GUID *)HardDriveDevicePath1->Signature,(EFI_GUID *)HardDriveDevicePath2->Signature) == TRUE) &&
+ (CompareGuid ((EFI_GUID *)HardDriveDevicePath1->Signature, (EFI_GUID *)HardDriveDevicePath2->Signature) == TRUE) &&
(HardDriveDevicePath1->PartitionNumber == HardDriveDevicePath2->PartitionNumber))
{
*DeviceHandle = PartitionBuffer[Index];
// Add the additional original Device Path Nodes (eg: FilePath Device Path Node) to the new Device Path
- *NewDevicePath = AppendDevicePath (PartitionDevicePath, NextDevicePathNode(RemovableDevicePath));
+ *NewDevicePath = AppendDevicePath (PartitionDevicePath, NextDevicePathNode (RemovableDevicePath));
return EFI_SUCCESS;
}
}
@@ -191,7 +191,7 @@ BdsIsRemovableCdrom (
IN EFI_DEVICE_PATH* DevicePath
)
{
- return IS_DEVICE_PATH_NODE(DevicePath, MEDIA_DEVICE_PATH, MEDIA_CDROM_DP);
+ return IS_DEVICE_PATH_NODE (DevicePath, MEDIA_DEVICE_PATH, MEDIA_CDROM_DP);
}
EFI_STATUS
@@ -239,8 +239,8 @@ IsRemovableDevice (
TmpDevicePath = DevicePath;
while (!IsDevicePathEnd (TmpDevicePath)) {
- for (Index = 0; Index < sizeof(RemovableDeviceSupport) / sizeof(BDS_REMOVABLE_DEVICE_SUPPORT); Index++) {
- if (RemovableDeviceSupport[Index].IsRemovable(TmpDevicePath)) {
+ for (Index = 0; Index < sizeof (RemovableDeviceSupport) / sizeof (BDS_REMOVABLE_DEVICE_SUPPORT); Index++) {
+ if (RemovableDeviceSupport[Index].IsRemovable (TmpDevicePath)) {
return TRUE;
}
}
@@ -271,9 +271,9 @@ TryRemovableDevice (
TmpDevicePath = DevicePath;
while (!IsDevicePathEnd (TmpDevicePath) && !RemovableFound) {
- for (Index = 0; Index < sizeof(RemovableDeviceSupport) / sizeof(BDS_REMOVABLE_DEVICE_SUPPORT); Index++) {
+ for (Index = 0; Index < sizeof (RemovableDeviceSupport) / sizeof (BDS_REMOVABLE_DEVICE_SUPPORT); Index++) {
RemovableDevice = &RemovableDeviceSupport[Index];
- if (RemovableDevice->IsRemovable(TmpDevicePath)) {
+ if (RemovableDevice->IsRemovable (TmpDevicePath)) {
RemovableDevicePath = TmpDevicePath;
RemovableFound = TRUE;
break;
@@ -338,7 +338,7 @@ BdsConnectDevicePath (
}
/*// We need to check if RemainingDevicePath does not point on the last node. Otherwise, calling
- // NextDevicePathNode() will return an undetermined Device Path Node
+ // NextDevicePathNode () will return an undetermined Device Path Node
if (!IsDevicePathEnd (RemainingDevicePath)) {
RemainingDevicePath = NextDevicePathNode (RemainingDevicePath);
}*/
@@ -348,7 +348,7 @@ BdsConnectDevicePath (
// Now, we have got the whole Device Path connected, call again ConnectController to ensure all the supported Driver
// Binding Protocol are connected (such as DiskIo and SimpleFileSystem)
Remaining = DevicePath;
- Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid,&Remaining,Handle);
+ Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &Remaining, Handle);
if (!EFI_ERROR (Status)) {
Status = gBS->ConnectController (*Handle, NULL, Remaining, FALSE);
if (EFI_ERROR (Status)) {
@@ -393,9 +393,9 @@ BdsFileSystemSupport (
EFI_STATUS Status;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FsProtocol;
- Status = gBS->HandleProtocol (Handle,&gEfiSimpleFileSystemProtocolGuid, (VOID **)&FsProtocol);
+ Status = gBS->HandleProtocol (Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&FsProtocol);
- return (!EFI_ERROR(Status) && IS_DEVICE_PATH_NODE(RemainingDevicePath,MEDIA_DEVICE_PATH,MEDIA_FILEPATH_DP));
+ return (!EFI_ERROR (Status) && IS_DEVICE_PATH_NODE (RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP));
}
EFI_STATUS
@@ -416,32 +416,32 @@ BdsFileSystemLoadImage (
EFI_FILE_PROTOCOL *File;
UINTN Size;
- ASSERT (IS_DEVICE_PATH_NODE(RemainingDevicePath,MEDIA_DEVICE_PATH,MEDIA_FILEPATH_DP));
+ ASSERT (IS_DEVICE_PATH_NODE (RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP));
FilePathDevicePath = (FILEPATH_DEVICE_PATH*)RemainingDevicePath;
- Status = gBS->HandleProtocol(Handle,&gEfiSimpleFileSystemProtocolGuid, (VOID **)&FsProtocol);
- if (EFI_ERROR(Status)) {
+ Status = gBS->HandleProtocol (Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&FsProtocol);
+ if (EFI_ERROR (Status)) {
return Status;
}
// Try to Open the volume and get root directory
Status = FsProtocol->OpenVolume (FsProtocol, &Fs);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
File = NULL;
- Status = Fs->Open(Fs, &File, FilePathDevicePath->PathName, EFI_FILE_MODE_READ, 0);
- if (EFI_ERROR(Status)) {
+ Status = Fs->Open (Fs, &File, FilePathDevicePath->PathName, EFI_FILE_MODE_READ, 0);
+ if (EFI_ERROR (Status)) {
return Status;
}
Size = 0;
- File->GetInfo(File, &gEfiFileInfoGuid, &Size, NULL);
+ File->GetInfo (File, &gEfiFileInfoGuid, &Size, NULL);
FileInfo = AllocatePool (Size);
- Status = File->GetInfo(File, &gEfiFileInfoGuid, &Size, FileInfo);
- if (EFI_ERROR(Status)) {
+ Status = File->GetInfo (File, &gEfiFileInfoGuid, &Size, FileInfo);
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -450,14 +450,14 @@ BdsFileSystemLoadImage (
if (ImageSize) {
*ImageSize = Size;
}
- FreePool(FileInfo);
+ FreePool (FileInfo);
Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(Size), Image);
// Try to allocate in any pages if failed to allocate memory at the defined location
if ((Status == EFI_OUT_OF_RESOURCES) && (Type != AllocateAnyPages)) {
Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesCode, EFI_SIZE_TO_PAGES(Size), Image);
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Status = File->Read (File, &Size, (VOID*)(UINTN)(*Image));
}
@@ -471,8 +471,8 @@ BdsMemoryMapSupport (
IN EFI_DEVICE_PATH *RemainingDevicePath
)
{
- return IS_DEVICE_PATH_NODE(DevicePath,HARDWARE_DEVICE_PATH,HW_MEMMAP_DP) ||
- IS_DEVICE_PATH_NODE(RemainingDevicePath,HARDWARE_DEVICE_PATH,HW_MEMMAP_DP);
+ return IS_DEVICE_PATH_NODE (DevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP) ||
+ IS_DEVICE_PATH_NODE (RemainingDevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP);
}
EFI_STATUS
@@ -489,10 +489,10 @@ BdsMemoryMapLoadImage (
MEMMAP_DEVICE_PATH* MemMapPathDevicePath;
UINTN Size;
- if (IS_DEVICE_PATH_NODE(RemainingDevicePath,HARDWARE_DEVICE_PATH,HW_MEMMAP_DP)) {
+ if (IS_DEVICE_PATH_NODE (RemainingDevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP)) {
MemMapPathDevicePath = (MEMMAP_DEVICE_PATH*)RemainingDevicePath;
} else {
- ASSERT (IS_DEVICE_PATH_NODE(DevicePath,HARDWARE_DEVICE_PATH,HW_MEMMAP_DP));
+ ASSERT (IS_DEVICE_PATH_NODE (DevicePath, HARDWARE_DEVICE_PATH, HW_MEMMAP_DP));
MemMapPathDevicePath = (MEMMAP_DEVICE_PATH*)DevicePath;
}
@@ -506,7 +506,7 @@ BdsMemoryMapLoadImage (
if ((Status == EFI_OUT_OF_RESOURCES) && (Type != AllocateAnyPages)) {
Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesCode, EFI_SIZE_TO_PAGES(Size), Image);
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
CopyMem ((VOID*)(UINTN)(*Image), (CONST VOID*)(UINTN)MemMapPathDevicePath->StartingAddress, Size);
if (ImageSize != NULL) {
@@ -524,7 +524,7 @@ BdsFirmwareVolumeSupport (
IN EFI_DEVICE_PATH *RemainingDevicePath
)
{
- return IS_DEVICE_PATH_NODE(RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP);
+ return IS_DEVICE_PATH_NODE (RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP);
}
EFI_STATUS
@@ -546,10 +546,10 @@ BdsFirmwareVolumeLoadImage (
UINT32 AuthenticationStatus;
VOID* ImageBuffer;
- ASSERT (IS_DEVICE_PATH_NODE(RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP));
+ ASSERT (IS_DEVICE_PATH_NODE (RemainingDevicePath, MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP));
- Status = gBS->HandleProtocol(Handle,&gEfiFirmwareVolume2ProtocolGuid, (VOID **)&FwVol);
- if (EFI_ERROR(Status)) {
+ Status = gBS->HandleProtocol (Handle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&FwVol);
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -576,7 +576,7 @@ BdsFirmwareVolumeLoadImage (
// In case the buffer has some address requirements, we must copy the buffer to a buffer following the requirements
if (Type != AllocateAnyPages) {
Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize),Image);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
CopyMem ((VOID*)(UINTN)(*Image), ImageBuffer, *ImageSize);
FreePool (ImageBuffer);
}
@@ -588,7 +588,7 @@ BdsFirmwareVolumeLoadImage (
if ((Status == EFI_OUT_OF_RESOURCES) && (Type != AllocateAnyPages)) {
Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize), Image);
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
CopyMem ((VOID*)(UINTN)(*Image), ImageBuffer, *ImageSize);
FreePool (ImageBuffer);
}
@@ -604,13 +604,13 @@ BdsFirmwareVolumeLoadImage (
&Attrib,
&AuthenticationStatus
);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize), Image);
// Try to allocate in any pages if failed to allocate memory at the defined location
if ((Status == EFI_OUT_OF_RESOURCES) && (Type != AllocateAnyPages)) {
Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesCode, EFI_SIZE_TO_PAGES(*ImageSize), Image);
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Status = FwVol->ReadFile (
FwVol,
FvNameGuid,
@@ -636,7 +636,7 @@ BdsPxeSupport (
EFI_STATUS Status;
EFI_PXE_BASE_CODE_PROTOCOL* PxeBcProtocol;
- if (!IsDevicePathEnd(RemainingDevicePath)) {
+ if (!IsDevicePathEnd (RemainingDevicePath)) {
return FALSE;
}
@@ -671,12 +671,12 @@ BdsPxeLoadImage (
Status = LoadFileProtocol->LoadFile (LoadFileProtocol, DevicePath, TRUE, &BufferSize, NULL);
if (Status == EFI_BUFFER_TOO_SMALL) {
Status = gBS->AllocatePages (Type, EfiBootServicesCode, EFI_SIZE_TO_PAGES(BufferSize), Image);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
Status = LoadFileProtocol->LoadFile (LoadFileProtocol, DevicePath, TRUE, &BufferSize, (VOID*)(UINTN)(*Image));
- if (!EFI_ERROR(Status) && (ImageSize != NULL)) {
+ if (!EFI_ERROR (Status) && (ImageSize != NULL)) {
*ImageSize = BufferSize;
}
}
@@ -696,18 +696,18 @@ BdsTftpSupport (
EFI_PXE_BASE_CODE_PROTOCOL *PxeBcProtocol;
// Validate the Remaining Device Path
- if (IsDevicePathEnd(RemainingDevicePath)) {
+ if (IsDevicePathEnd (RemainingDevicePath)) {
return FALSE;
}
- if (!IS_DEVICE_PATH_NODE(RemainingDevicePath,MESSAGING_DEVICE_PATH,MSG_IPv4_DP) &&
- !IS_DEVICE_PATH_NODE(RemainingDevicePath,MESSAGING_DEVICE_PATH,MSG_IPv6_DP)) {
+ if (!IS_DEVICE_PATH_NODE (RemainingDevicePath, MESSAGING_DEVICE_PATH, MSG_IPv4_DP) &&
+ !IS_DEVICE_PATH_NODE (RemainingDevicePath, MESSAGING_DEVICE_PATH, MSG_IPv6_DP)) {
return FALSE;
}
NextDevicePath = NextDevicePathNode (RemainingDevicePath);
- if (IsDevicePathEnd(NextDevicePath)) {
+ if (IsDevicePathEnd (NextDevicePath)) {
return FALSE;
}
- if (!IS_DEVICE_PATH_NODE(NextDevicePath,MEDIA_DEVICE_PATH,MEDIA_FILEPATH_DP)) {
+ if (!IS_DEVICE_PATH_NODE (NextDevicePath, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP)) {
return FALSE;
}
@@ -738,18 +738,18 @@ BdsTftpLoadImage (
FILEPATH_DEVICE_PATH* FilePathDevicePath;
EFI_IP_ADDRESS LocalIp;
- ASSERT(IS_DEVICE_PATH_NODE(RemainingDevicePath,MESSAGING_DEVICE_PATH,MSG_IPv4_DP));
+ ASSERT(IS_DEVICE_PATH_NODE (RemainingDevicePath, MESSAGING_DEVICE_PATH, MSG_IPv4_DP));
IPv4DevicePathNode = (IPv4_DEVICE_PATH*)RemainingDevicePath;
FilePathDevicePath = (FILEPATH_DEVICE_PATH*)(IPv4DevicePathNode + 1);
Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
Status = Pxe->Start (Pxe, FALSE);
- if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) {
+ if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
return Status;
}
@@ -759,7 +759,7 @@ BdsTftpLoadImage (
CopyMem (&LocalIp.v4, &IPv4DevicePathNode->LocalIpAddress, sizeof (EFI_IPv4_ADDRESS));
Status = Pxe->SetStationIp (Pxe, &LocalIp, NULL);
}
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -777,12 +777,12 @@ BdsTftpLoadImage (
NULL,
TRUE
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
// Allocate a buffer to hold the whole file.
- TftpBuffer = AllocatePool(TftpBufferSize);
+ TftpBuffer = AllocatePool (TftpBufferSize);
if (TftpBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -799,8 +799,8 @@ BdsTftpLoadImage (
NULL,
FALSE
);
- if (EFI_ERROR(Status)) {
- FreePool(TftpBuffer);
+ if (EFI_ERROR (Status)) {
+ FreePool (TftpBuffer);
} else if (ImageSize != NULL) {
*ImageSize = (UINTN)TftpBufferSize;
}
@@ -874,20 +874,20 @@ BdsStartEfiApplication (
// Find the nearest supported file loader
Status = BdsLoadImage (DevicePath, AllocateAnyPages, &BinaryBuffer, &BinarySize);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
// Load the image from the Buffer with Boot Services function
Status = gBS->LoadImage (TRUE, ParentImageHandle, DevicePath, (VOID*)(UINTN)BinaryBuffer, BinarySize, &ImageHandle);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
// Passed LoadOptions to the EFI Application
if (LoadOptionsSize != 0) {
Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
diff --git a/ArmPlatformPkg/PrePeiCore/MainMPCore.c b/ArmPlatformPkg/PrePeiCore/MainMPCore.c
index aeea8f5bda..afe36a7538 100644
--- a/ArmPlatformPkg/PrePeiCore/MainMPCore.c
+++ b/ArmPlatformPkg/PrePeiCore/MainMPCore.c
@@ -121,7 +121,7 @@ PrimaryMain (
CreatePpiList (&PpiListSize, &PpiList);
// Enable the GIC Distributor
- ArmGicEnableDistributor(PcdGet32(PcdGicDistributorBase));
+ ArmGicEnableDistributor (PcdGet32(PcdGicDistributorBase));
// If ArmVe has not been built as Standalone then we need to wake up the secondary cores
if (FeaturePcdGet (PcdSendSgiToBringUpSecondaryCores)) {
@@ -155,5 +155,5 @@ PrimaryMain (
SecCoreData.StackSize = (TemporaryRamBase + TemporaryRamSize) - (UINTN)SecCoreData.StackBase;
// Jump to PEI core entry point
- (PeiCoreEntryPoint)(&SecCoreData, PpiList);
+ PeiCoreEntryPoint (&SecCoreData, PpiList);
}
diff --git a/ArmPlatformPkg/Sec/Sec.c b/ArmPlatformPkg/Sec/Sec.c
index be165442bf..52fa53a647 100644
--- a/ArmPlatformPkg/Sec/Sec.c
+++ b/ArmPlatformPkg/Sec/Sec.c
@@ -35,20 +35,20 @@ CEntryPoint (
UINTN JumpAddress;
// Invalidate the data cache. Doesn't have to do the Data cache clean.
- ArmInvalidateDataCache();
+ ArmInvalidateDataCache ();
// Invalidate Instruction Cache
- ArmInvalidateInstructionCache();
+ ArmInvalidateInstructionCache ();
// Invalidate I & D TLBs
- ArmInvalidateInstructionAndDataTlb();
+ ArmInvalidateInstructionAndDataTlb ();
// CPU specific settings
ArmCpuSetup (MpId);
// Enable Floating Point Coprocessor if supported by the platform
if (FixedPcdGet32 (PcdVFPEnabled)) {
- ArmEnableVFP();
+ ArmEnableVFP ();
}
// Initialize peripherals that must be done at the early stage
@@ -95,7 +95,7 @@ CEntryPoint (
// Test if Trustzone is supported on this platform
if (FixedPcdGetBool (PcdTrustzoneSupport)) {
- if (ArmIsMpCore()) {
+ if (ArmIsMpCore ()) {
// Setup SMP in Non Secure world
ArmCpuSetupSmpNonSecure (GET_CORE_ID(MpId));
}
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;
}
-