EmbeddedPkg/MmcDxe: Fix coding style
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 3 Jun 2011 09:10:26 +0000 (09:10 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 3 Jun 2011 09:10:26 +0000 (09:10 +0000)
Make the coding style more compliant with the EDK2 coding convention.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11727 6f19259b-4bc3-4df7-8a09-765794883524

EmbeddedPkg/Universal/MmcDxe/Mmc.c
EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c

index 9c67867..468bb1d 100644 (file)
@@ -52,7 +52,7 @@ InitializeMmcHostPool (
   VOID\r
   )\r
 {\r
-    InitializeListHead (&mMmcHostPool);\r
+  InitializeListHead (&mMmcHostPool);\r
 }\r
 \r
 /**\r
@@ -63,7 +63,7 @@ InsertMmcHost (
   IN MMC_HOST_INSTANCE      *MmcHostInstance\r
   )\r
 {\r
-    InsertTailList (&mMmcHostPool, &(MmcHostInstance->Link));\r
+  InsertTailList (&mMmcHostPool, &(MmcHostInstance->Link));\r
 }\r
 \r
 /*\r
@@ -74,101 +74,101 @@ RemoveMmcHost (
   IN MMC_HOST_INSTANCE      *MmcHostInstance\r
   )\r
 {\r
-    RemoveEntryList (&(MmcHostInstance->Link));\r
+  RemoveEntryList (&(MmcHostInstance->Link));\r
 }\r
 \r
-MMC_HOST_INSTANCE* CreateMmcHostInstance(\r
+MMC_HOST_INSTANCE* CreateMmcHostInstance (\r
   IN EFI_MMC_HOST_PROTOCOL* MmcHost\r
   )\r
 {\r
-    EFI_STATUS          Status;\r
-    MMC_HOST_INSTANCE*  MmcHostInstance;\r
-    EFI_DEVICE_PATH_PROTOCOL    *NewDevicePathNode;\r
-    EFI_DEVICE_PATH_PROTOCOL    *DevicePath;\r
-\r
-    MmcHostInstance = AllocateZeroPool (sizeof (MMC_HOST_INSTANCE));\r
-    if (MmcHostInstance == NULL) {\r
-        return NULL;\r
-    }\r
+  EFI_STATUS          Status;\r
+  MMC_HOST_INSTANCE*  MmcHostInstance;\r
+  EFI_DEVICE_PATH_PROTOCOL    *NewDevicePathNode;\r
+  EFI_DEVICE_PATH_PROTOCOL    *DevicePath;\r
 \r
-    MmcHostInstance->Signature = MMC_HOST_INSTANCE_SIGNATURE;\r
+  MmcHostInstance = AllocateZeroPool (sizeof (MMC_HOST_INSTANCE));\r
+  if (MmcHostInstance == NULL) {\r
+    return NULL;\r
+  }\r
 \r
-    MmcHostInstance->State = MmcHwInitializationState;\r
-    \r
-    MmcHostInstance->BlockIo.Media = AllocateCopyPool (sizeof(EFI_BLOCK_IO_MEDIA), &mMmcMediaTemplate);\r
-    if (MmcHostInstance->BlockIo.Media == NULL) {\r
-        goto FREE_INSTANCE;\r
-    }\r
+  MmcHostInstance->Signature = MMC_HOST_INSTANCE_SIGNATURE;\r
 \r
-    MmcHostInstance->BlockIo.Revision = EFI_BLOCK_IO_INTERFACE_REVISION;\r
-    MmcHostInstance->BlockIo.Reset = MmcReset;\r
-    MmcHostInstance->BlockIo.ReadBlocks = MmcReadBlocks;\r
-    MmcHostInstance->BlockIo.WriteBlocks = MmcWriteBlocks;\r
-    MmcHostInstance->BlockIo.FlushBlocks = MmcFlushBlocks;\r
+  MmcHostInstance->State = MmcHwInitializationState;\r
 \r
-    MmcHostInstance->MmcHost = MmcHost;\r
+  MmcHostInstance->BlockIo.Media = AllocateCopyPool (sizeof(EFI_BLOCK_IO_MEDIA), &mMmcMediaTemplate);\r
+  if (MmcHostInstance->BlockIo.Media == NULL) {\r
+    goto FREE_INSTANCE;\r
+  }\r
 \r
-    // Create DevicePath for the new MMC Host\r
-    Status = MmcHost->BuildDevicePath(&NewDevicePathNode);\r
-    if (EFI_ERROR (Status)) {\r
-        goto FREE_MEDIA;\r
-    }\r
+  MmcHostInstance->BlockIo.Revision = EFI_BLOCK_IO_INTERFACE_REVISION;\r
+  MmcHostInstance->BlockIo.Reset = MmcReset;\r
+  MmcHostInstance->BlockIo.ReadBlocks = MmcReadBlocks;\r
+  MmcHostInstance->BlockIo.WriteBlocks = MmcWriteBlocks;\r
+  MmcHostInstance->BlockIo.FlushBlocks = MmcFlushBlocks;\r
 \r
-    DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);\r
-    if (DevicePath == NULL) {\r
-        goto FREE_MEDIA;\r
-    }\r
-    \r
-    SetDevicePathEndNode (DevicePath);\r
-    MmcHostInstance->DevicePath = AppendDevicePathNode (DevicePath, NewDevicePathNode);\r
-\r
-    // Publish BlockIO protocol interface\r
-    Status = gBS->InstallMultipleProtocolInterfaces (\r
-                  &MmcHostInstance->MmcHandle,\r
-                  &gEfiBlockIoProtocolGuid,&(MmcHostInstance->BlockIo),\r
-                  &gEfiDevicePathProtocolGuid,MmcHostInstance->DevicePath,\r
-                  NULL\r
-                  );\r
-    if (EFI_ERROR(Status)) {\r
-        goto FREE_DEVICE_PATH;\r
-    }\r
+  MmcHostInstance->MmcHost = MmcHost;\r
+\r
+  // Create DevicePath for the new MMC Host\r
+  Status = MmcHost->BuildDevicePath(&NewDevicePathNode);\r
+  if (EFI_ERROR (Status)) {\r
+    goto FREE_MEDIA;\r
+  }\r
 \r
-    return MmcHostInstance;\r
+  DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);\r
+  if (DevicePath == NULL) {\r
+    goto FREE_MEDIA;\r
+  }\r
+\r
+  SetDevicePathEndNode (DevicePath);\r
+  MmcHostInstance->DevicePath = AppendDevicePathNode (DevicePath, NewDevicePathNode);\r
+\r
+  // Publish BlockIO protocol interface\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                &MmcHostInstance->MmcHandle,\r
+                &gEfiBlockIoProtocolGuid,&(MmcHostInstance->BlockIo),\r
+                &gEfiDevicePathProtocolGuid,MmcHostInstance->DevicePath,\r
+                NULL\r
+                );\r
+  if (EFI_ERROR(Status)) {\r
+    goto FREE_DEVICE_PATH;\r
+  }\r
+\r
+  return MmcHostInstance;\r
 \r
 FREE_DEVICE_PATH:\r
-    FreePool(DevicePath);\r
+  FreePool(DevicePath);\r
 \r
 FREE_MEDIA:\r
-    FreePool(MmcHostInstance->BlockIo.Media);\r
+  FreePool(MmcHostInstance->BlockIo.Media);\r
 \r
 FREE_INSTANCE:\r
-    FreePool(MmcHostInstance);\r
+  FreePool(MmcHostInstance);\r
 \r
-    return NULL;\r
+  return NULL;\r
 }\r
 \r
-EFI_STATUS DestroyMmcHostInstance(\r
+EFI_STATUS DestroyMmcHostInstance (\r
   IN MMC_HOST_INSTANCE* MmcHostInstance\r
   )\r
 {\r
-    EFI_STATUS Status;\r
+  EFI_STATUS Status;\r
 \r
-    // Uninstall Protocol Interfaces\r
-    Status = gBS->UninstallMultipleProtocolInterfaces(\r
+  // Uninstall Protocol Interfaces\r
+  Status = gBS->UninstallMultipleProtocolInterfaces (\r
         MmcHostInstance->MmcHandle,\r
-            &gEfiBlockIoProtocolGuid,&(MmcHostInstance->BlockIo),\r
+        &gEfiBlockIoProtocolGuid,&(MmcHostInstance->BlockIo),\r
         &gEfiDevicePathProtocolGuid,MmcHostInstance->DevicePath,\r
-            NULL\r
-            );\r
-    ASSERT_EFI_ERROR (Status);\r
-    \r
-    // Free Memory allocated for the instance\r
-    if (MmcHostInstance->BlockIo.Media) {\r
-        FreePool(MmcHostInstance->BlockIo.Media);\r
-    }\r
-    FreePool (MmcHostInstance);\r
+        NULL\r
+        );\r
+  ASSERT_EFI_ERROR (Status);\r
 \r
-    return Status;\r
+  // Free Memory allocated for the instance\r
+  if (MmcHostInstance->BlockIo.Media) {\r
+    FreePool(MmcHostInstance->BlockIo.Media);\r
+  }\r
+  FreePool (MmcHostInstance);\r
+\r
+  return Status;\r
 }\r
 \r
 /**\r
@@ -182,62 +182,62 @@ MmcDriverBindingSupported (
   IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
   )\r
 {\r
-    EFI_STATUS                      Status;\r
-    //EFI_DEVICE_PATH_PROTOCOL        *ParentDevicePath;\r
-    EFI_MMC_HOST_PROTOCOL           *MmcHost;\r
-    EFI_DEV_PATH_PTR                Node;\r
-\r
+  EFI_STATUS                      Status;\r
+  //EFI_DEVICE_PATH_PROTOCOL        *ParentDevicePath;\r
+  EFI_MMC_HOST_PROTOCOL           *MmcHost;\r
+  EFI_DEV_PATH_PTR                Node;\r
+\r
+  //\r
+  // Check RemainingDevicePath validation\r
+  //\r
+  if (RemainingDevicePath != NULL) {\r
     //\r
-    // Check RemainingDevicePath validation\r
+    // Check if RemainingDevicePath is the End of Device Path Node,\r
+    // if yes, go on checking other conditions\r
     //\r
-    if (RemainingDevicePath != NULL) {\r
-        //\r
-        // Check if RemainingDevicePath is the End of Device Path Node, \r
-        // if yes, go on checking other conditions\r
-        //\r
-        if (!IsDevicePathEnd (RemainingDevicePath)) {\r
-            //\r
-            // If RemainingDevicePath isn't the End of Device Path Node,\r
-            // check its validation\r
-            //\r
-            Node.DevPath = RemainingDevicePath;\r
-            if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||\r
-              Node.DevPath->SubType != HW_VENDOR_DP      ||\r
-              DevicePathNodeLength(Node.DevPath) != sizeof(VENDOR_DEVICE_PATH)) {\r
-                return EFI_UNSUPPORTED;\r
-            }\r
-        }\r
+    if (!IsDevicePathEnd (RemainingDevicePath)) {\r
+      //\r
+      // If RemainingDevicePath isn't the End of Device Path Node,\r
+      // check its validation\r
+      //\r
+      Node.DevPath = RemainingDevicePath;\r
+      if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||\r
+        Node.DevPath->SubType != HW_VENDOR_DP      ||\r
+        DevicePathNodeLength(Node.DevPath) != sizeof(VENDOR_DEVICE_PATH)) {\r
+          return EFI_UNSUPPORTED;\r
+      }\r
     }\r
-\r
-    //\r
-    // Check if Mmc Host protocol is installed by platform\r
-    //\r
-    Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiMmcHostProtocolGuid,\r
-                  (VOID **) &MmcHost,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
-                  );\r
-    if (Status == EFI_ALREADY_STARTED) {\r
-        return EFI_SUCCESS;\r
-    }\r
-    if (EFI_ERROR (Status)) {\r
-        return Status;\r
-    }\r
-\r
-    //\r
-    // Close the Mmc Host used to perform the supported test\r
-    //\r
-    gBS->CloseProtocol (\r
-        Controller,\r
-        &gEfiMmcHostProtocolGuid,\r
-        This->DriverBindingHandle,\r
-        Controller\r
-        );\r
-\r
+  }\r
+\r
+  //\r
+  // Check if Mmc Host protocol is installed by platform\r
+  //\r
+  Status = gBS->OpenProtocol (\r
+                Controller,\r
+                &gEfiMmcHostProtocolGuid,\r
+                (VOID **) &MmcHost,\r
+                This->DriverBindingHandle,\r
+                Controller,\r
+                EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                );\r
+  if (Status == EFI_ALREADY_STARTED) {\r
     return EFI_SUCCESS;\r
+  }\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  //\r
+  // Close the Mmc Host used to perform the supported test\r
+  //\r
+  gBS->CloseProtocol (\r
+      Controller,\r
+      &gEfiMmcHostProtocolGuid,\r
+      This->DriverBindingHandle,\r
+      Controller\r
+      );\r
+\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
@@ -251,48 +251,48 @@ MmcDriverBindingStart (
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
   )\r
 {\r
-    EFI_STATUS              Status;\r
-    MMC_HOST_INSTANCE       *MmcHostInstance;\r
-    EFI_MMC_HOST_PROTOCOL   *MmcHost;\r
-\r
+  EFI_STATUS              Status;\r
+  MMC_HOST_INSTANCE       *MmcHostInstance;\r
+  EFI_MMC_HOST_PROTOCOL   *MmcHost;\r
+\r
+  //\r
+  // Check RemainingDevicePath validation\r
+  //\r
+  if (RemainingDevicePath != NULL) {\r
     //\r
-    // Check RemainingDevicePath validation\r
+    // Check if RemainingDevicePath is the End of Device Path Node,\r
+    // if yes, return EFI_SUCCESS\r
     //\r
-    if (RemainingDevicePath != NULL) {\r
-        //\r
-        // Check if RemainingDevicePath is the End of Device Path Node, \r
-        // if yes, return EFI_SUCCESS\r
-        //\r
-        if (IsDevicePathEnd (RemainingDevicePath)) {\r
-            return EFI_SUCCESS;\r
-        }\r
+    if (IsDevicePathEnd (RemainingDevicePath)) {\r
+      return EFI_SUCCESS;\r
     }\r
-\r
-    //\r
-    // Get the Mmc Host protocol\r
-    //\r
-    Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiMmcHostProtocolGuid,\r
-                  (VOID **) &MmcHost,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
-                  );\r
-    if (EFI_ERROR (Status)) {\r
-        if (Status == EFI_ALREADY_STARTED) {\r
-            return EFI_SUCCESS;\r
-        }\r
-        return Status;\r
+  }\r
+\r
+  //\r
+  // Get the Mmc Host protocol\r
+  //\r
+  Status = gBS->OpenProtocol (\r
+                Controller,\r
+                &gEfiMmcHostProtocolGuid,\r
+                (VOID **) &MmcHost,\r
+                This->DriverBindingHandle,\r
+                Controller,\r
+                EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                );\r
+  if (EFI_ERROR (Status)) {\r
+    if (Status == EFI_ALREADY_STARTED) {\r
+      return EFI_SUCCESS;\r
     }\r
+    return Status;\r
+  }\r
 \r
-    MmcHostInstance = CreateMmcHostInstance(MmcHost);\r
-    if (MmcHostInstance != NULL) {\r
-        // Add the handle to the pool\r
-        InsertMmcHost (MmcHostInstance);\r
-    }\r
+  MmcHostInstance = CreateMmcHostInstance(MmcHost);\r
+  if (MmcHostInstance != NULL) {\r
+    // Add the handle to the pool\r
+    InsertMmcHost (MmcHostInstance);\r
+  }\r
 \r
-    return EFI_SUCCESS;\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
@@ -307,33 +307,33 @@ MmcDriverBindingStop (
   IN  EFI_HANDLE                    *ChildHandleBuffer\r
   )\r
 {\r
-    EFI_STATUS          Status = EFI_SUCCESS;\r
-    LIST_ENTRY          *CurrentLink;\r
-    MMC_HOST_INSTANCE   *MmcHostInstance;\r
-\r
-    MMC_TRACE("MmcDriverBindingStop()");\r
-\r
-    // For each MMC instance\r
-    CurrentLink = mMmcHostPool.ForwardLink;\r
-    while (CurrentLink != NULL && CurrentLink != &mMmcHostPool && (Status == EFI_SUCCESS)) {\r
-        MmcHostInstance = MMC_HOST_INSTANCE_FROM_LINK(CurrentLink);\r
-        ASSERT(MmcHostInstance != NULL);\r
-\r
-        // Close gEfiMmcHostProtocolGuid\r
-        Status = gBS->CloseProtocol (\r
-                    Controller,\r
-                    &gEfiMmcHostProtocolGuid,(VOID **) &MmcHostInstance->MmcHost,\r
-                    This->DriverBindingHandle\r
-                    );\r
-\r
-        // Remove MMC Host Instance from the pool\r
-        RemoveMmcHost (MmcHostInstance);\r
-\r
-        // Destroy MmcHostInstance\r
-        DestroyMmcHostInstance (MmcHostInstance);\r
-    }\r
+  EFI_STATUS          Status = EFI_SUCCESS;\r
+  LIST_ENTRY          *CurrentLink;\r
+  MMC_HOST_INSTANCE   *MmcHostInstance;\r
 \r
-    return Status;\r
+  MMC_TRACE("MmcDriverBindingStop()");\r
+\r
+  // For each MMC instance\r
+  CurrentLink = mMmcHostPool.ForwardLink;\r
+  while (CurrentLink != NULL && CurrentLink != &mMmcHostPool && (Status == EFI_SUCCESS)) {\r
+    MmcHostInstance = MMC_HOST_INSTANCE_FROM_LINK(CurrentLink);\r
+    ASSERT(MmcHostInstance != NULL);\r
+\r
+    // Close gEfiMmcHostProtocolGuid\r
+    Status = gBS->CloseProtocol (\r
+                Controller,\r
+                &gEfiMmcHostProtocolGuid,(VOID **) &MmcHostInstance->MmcHost,\r
+                This->DriverBindingHandle\r
+                );\r
+\r
+    // Remove MMC Host Instance from the pool\r
+    RemoveMmcHost (MmcHostInstance);\r
+\r
+    // Destroy MmcHostInstance\r
+    DestroyMmcHostInstance (MmcHostInstance);\r
+  }\r
+\r
+  return Status;\r
 }\r
 \r
 EFI_DRIVER_BINDING_PROTOCOL gMmcDriverBinding = {\r
@@ -355,33 +355,33 @@ MmcDxeInitialize (
   IN EFI_SYSTEM_TABLE   *SystemTable\r
   )\r
 {\r
-    EFI_STATUS  Status;\r
-\r
-    //\r
-    // Initializes MMC Host pool\r
-    //\r
-    InitializeMmcHostPool ();\r
-\r
-    //\r
-    // Install driver model protocol(s).\r
-    //\r
-    Status = EfiLibInstallDriverBindingComponentName2 (\r
-             ImageHandle,\r
-             SystemTable,\r
-             &gMmcDriverBinding,\r
-             ImageHandle,\r
-             &gMmcComponentName,\r
-             &gMmcComponentName2\r
-             );\r
-    ASSERT_EFI_ERROR (Status);\r
-\r
-    // Install driver diagnostics\r
-    Status = gBS->InstallMultipleProtocolInterfaces (\r
-                  &ImageHandle, \r
-                  &gEfiDriverDiagnostics2ProtocolGuid,&gMmcDriverDiagnostics2,\r
-                  NULL\r
-                  );\r
-    ASSERT_EFI_ERROR (Status);\r
-\r
-    return Status;\r
+  EFI_STATUS  Status;\r
+\r
+  //\r
+  // Initializes MMC Host pool\r
+  //\r
+  InitializeMmcHostPool ();\r
+\r
+  //\r
+  // Install driver model protocol(s).\r
+  //\r
+  Status = EfiLibInstallDriverBindingComponentName2 (\r
+           ImageHandle,\r
+           SystemTable,\r
+           &gMmcDriverBinding,\r
+           ImageHandle,\r
+           &gMmcComponentName,\r
+           &gMmcComponentName2\r
+           );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  // Install driver diagnostics\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                &ImageHandle,\r
+                &gEfiDriverDiagnostics2ProtocolGuid,&gMmcDriverDiagnostics2,\r
+                NULL\r
+                );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return Status;\r
 }\r
index a77c8f0..138e87e 100644 (file)
 \r
 EFI_STATUS\r
 MmcNotifyState (\r
-  MMC_HOST_INSTANCE *MmcHostInstance,\r
-  MMC_STATE State\r
-  ) {\r
-    MmcHostInstance->State = State;\r
-    return MmcHostInstance->MmcHost->NotifyState(State);\r
+  IN MMC_HOST_INSTANCE *MmcHostInstance,\r
+  IN MMC_STATE State\r
+  )\r
+{\r
+  MmcHostInstance->State = State;\r
+  return MmcHostInstance->MmcHost->NotifyState(State);\r
 }\r
 \r
-VOID PrintOCR(UINT32 ocr) {\r
-    UINTN minv, maxv, volts;\r
-    UINTN loop;\r
-\r
-    minv  = 36;  // 3.6\r
-    maxv  = 20;  // 2.0\r
-    volts = 20;  // 2.0\r
-\r
-    // The MMC register bits [23:8] indicate the working range of the card\r
-    for (loop = 8; loop < 24; loop++) {\r
-        if (ocr & (1 << loop)) {\r
-            if (minv > volts) minv = volts;\r
-            if (maxv < volts) maxv = volts + 1;\r
-        }\r
-        volts = volts + 1;\r
+VOID\r
+PrintOCR (\r
+  IN UINT32 Ocr\r
+  )\r
+{\r
+  UINTN minv, maxv, volts;\r
+  UINTN loop;\r
+\r
+  minv  = 36;  // 3.6\r
+  maxv  = 20;  // 2.0\r
+  volts = 20;  // 2.0\r
+\r
+  // The MMC register bits [23:8] indicate the working range of the card\r
+  for (loop = 8; loop < 24; loop++) {\r
+    if (Ocr & (1 << loop)) {\r
+      if (minv > volts) minv = volts;\r
+      if (maxv < volts) maxv = volts + 1;\r
     }\r
-\r
-    DEBUG((EFI_D_ERROR, "- PrintOCR ocr (0x%X)\n",ocr));\r
-    DEBUG((EFI_D_ERROR, "\t- Card operating voltage: %d.%d to %d.%d\n", minv/10, minv % 10, maxv/10, maxv % 10));\r
-    if (((ocr >> 29) & 3) == 0)\r
-        DEBUG((EFI_D_ERROR, "\t- AccessMode: Byte Mode\n"));\r
-    else\r
-        DEBUG((EFI_D_ERROR, "\t- AccessMode: Block Mode (0x%X)\n",((ocr >> 29) & 3)));\r
-\r
-    if (ocr & MMC_OCR_POWERUP)\r
-        DEBUG((EFI_D_ERROR, "\t- PowerUp\n"));\r
-    else\r
-        DEBUG((EFI_D_ERROR, "\t- Voltage Not Supported\n"));\r
+    volts = volts + 1;\r
+  }\r
+\r
+  DEBUG((EFI_D_ERROR, "- PrintOCR Ocr (0x%X)\n",Ocr));\r
+  DEBUG((EFI_D_ERROR, "\t- Card operating voltage: %d.%d to %d.%d\n", minv/10, minv % 10, maxv/10, maxv % 10));\r
+  if (((Ocr >> 29) & 3) == 0) {\r
+    DEBUG((EFI_D_ERROR, "\t- AccessMode: Byte Mode\n"));\r
+  } else {\r
+    DEBUG((EFI_D_ERROR, "\t- AccessMode: Block Mode (0x%X)\n",((Ocr >> 29) & 3)));\r
+  }\r
+\r
+  if (Ocr & MMC_OCR_POWERUP) {\r
+    DEBUG((EFI_D_ERROR, "\t- PowerUp\n"));\r
+  } else {\r
+    DEBUG((EFI_D_ERROR, "\t- Voltage Not Supported\n"));\r
+  }\r
 }\r
 \r
-VOID PrintCID(UINT32* cid) {\r
-    DEBUG((EFI_D_ERROR, "- PrintCID\n"));\r
-    DEBUG((EFI_D_ERROR, "\t- Manufacturing date: %d/%d\n",(cid[0] >> 8) & 0xF,(cid[0] >> 12) & 0xFF));\r
-    DEBUG((EFI_D_ERROR, "\t- Product serial number: 0x%X%X\n",cid[1] & 0xFFFFFF,(cid[0] >> 24) & 0xFF));\r
-    DEBUG((EFI_D_ERROR, "\t- Product revision: %d\n",cid[1] >> 24));\r
-    //DEBUG((EFI_D_ERROR, "\t- Product name: %s\n",(char*)(cid + 2)));\r
-    DEBUG((EFI_D_ERROR, "\t- OEM ID: %c%c\n",(cid[3] >> 8) & 0xFF,(cid[3] >> 16) & 0xFF));\r
+VOID PrintCID (\r
+  IN UINT32* Cid\r
+  )\r
+{\r
+  DEBUG((EFI_D_ERROR, "- PrintCID\n"));\r
+  DEBUG((EFI_D_ERROR, "\t- Manufacturing date: %d/%d\n",(Cid[0] >> 8) & 0xF,(Cid[0] >> 12) & 0xFF));\r
+  DEBUG((EFI_D_ERROR, "\t- Product serial number: 0x%X%X\n",Cid[1] & 0xFFFFFF,(Cid[0] >> 24) & 0xFF));\r
+  DEBUG((EFI_D_ERROR, "\t- Product revision: %d\n",Cid[1] >> 24));\r
+  //DEBUG((EFI_D_ERROR, "\t- Product name: %s\n",(char*)(Cid + 2)));\r
+  DEBUG((EFI_D_ERROR, "\t- OEM ID: %c%c\n",(Cid[3] >> 8) & 0xFF,(Cid[3] >> 16) & 0xFF));\r
 }\r
 \r
-VOID PrintCSD(UINT32* csd) {\r
-    UINTN val32;\r
-    CONST CHAR8* str_unit[] = { "100kbit/s","1Mbit/s","10Mbit/s","100MBit/s","Unkbown","Unkbown","Unkbown","Unkbown" };\r
-    CONST CHAR8* str_value[] = { "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" };\r
-\r
-    if (((csd[2] >> 30) & 0x3) == 0)\r
-        DEBUG((EFI_D_ERROR, "- PrintCSD Version 1.01-1.10/Version 2.00/Standard Capacity\n"));\r
-    else if (((csd[2] >> 30) & 0x3) == 1)\r
-        DEBUG((EFI_D_ERROR, "- PrintCSD Version 2.00/High Capacity\n"));\r
-    else\r
-        DEBUG((EFI_D_ERROR, "- PrintCSD Version Higher than v3.3\n"));\r
-\r
-    DEBUG((EFI_D_ERROR, "\t- Supported card command class: 0x%X\n",MMC_CSD_GET_CCC(csd)));\r
-    DEBUG((EFI_D_ERROR, "\t- Speed: %a %a\n",str_value[(MMC_CSD_GET_TRANSPEED(csd) >> 3) & 0xF],str_unit[MMC_CSD_GET_TRANSPEED(csd) & 7]));\r
-    DEBUG((EFI_D_ERROR, "\t- Maximum Read Data Block: %d\n",2 << (MMC_CSD_GET_READBLLEN(csd)-1)));\r
-    DEBUG((EFI_D_ERROR, "\t- Maximum Write Data Block: %d\n",2 << (MMC_CSD_GET_WRITEBLLEN(csd)-1)));\r
-    \r
-    if (!MMC_CSD_GET_FILEFORMATGRP(csd)) {\r
-        val32 = MMC_CSD_GET_FILEFORMAT(csd);\r
-        if (val32 == 0)         DEBUG((EFI_D_ERROR, "\t- Format(0): Hard disk-like file system with partition table\n"));\r
-        else if (val32 == 1)    DEBUG((EFI_D_ERROR, "\t- Format(1): DOS FAT (floppy-like) with boot sector only (no partition table)\n"));\r
-        else if (val32 == 2)    DEBUG((EFI_D_ERROR, "\t- Format(2): Universal File Format\n"));\r
-        else                    DEBUG((EFI_D_ERROR, "\t- Format(3): Others/Unknown\n"));\r
-    } else {\r
-        DEBUG((EFI_D_ERROR, "\t- Format: Reserved\n"));\r
-    }\r
+VOID\r
+PrintCSD (\r
+  IN UINT32* Csd\r
+  )\r
+{\r
+  UINTN Value;\r
+  CONST CHAR8* str_unit[] = { "100kbit/s","1Mbit/s","10Mbit/s","100MBit/s","Unkbown","Unkbown","Unkbown","Unkbown" };\r
+  CONST CHAR8* str_value[] = { "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" };\r
+\r
+  if (((Csd[2] >> 30) & 0x3) == 0) {\r
+    DEBUG((EFI_D_ERROR, "- PrintCSD Version 1.01-1.10/Version 2.00/Standard Capacity\n"));\r
+  } else if (((Csd[2] >> 30) & 0x3) == 1) {\r
+    DEBUG((EFI_D_ERROR, "- PrintCSD Version 2.00/High Capacity\n"));\r
+  } else {\r
+    DEBUG((EFI_D_ERROR, "- PrintCSD Version Higher than v3.3\n"));\r
+  }\r
+\r
+  DEBUG((EFI_D_ERROR, "\t- Supported card command class: 0x%X\n",MMC_CSD_GET_CCC(Csd)));\r
+  DEBUG((EFI_D_ERROR, "\t- Speed: %a %a\n",str_value[(MMC_CSD_GET_TRANSPEED(Csd) >> 3) & 0xF],str_unit[MMC_CSD_GET_TRANSPEED(Csd) & 7]));\r
+  DEBUG((EFI_D_ERROR, "\t- Maximum Read Data Block: %d\n",2 << (MMC_CSD_GET_READBLLEN(Csd)-1)));\r
+  DEBUG((EFI_D_ERROR, "\t- Maximum Write Data Block: %d\n",2 << (MMC_CSD_GET_WRITEBLLEN(Csd)-1)));\r
+\r
+  if (!MMC_CSD_GET_FILEFORMATGRP(Csd)) {\r
+    Value = MMC_CSD_GET_FILEFORMAT(Csd);\r
+    if (Value == 0)         DEBUG((EFI_D_ERROR, "\t- Format(0): Hard disk-like file system with partition table\n"));\r
+    else if (Value == 1)    DEBUG((EFI_D_ERROR, "\t- Format(1): DOS FAT (floppy-like) with boot sector only (no partition table)\n"));\r
+    else if (Value == 2)    DEBUG((EFI_D_ERROR, "\t- Format(2): Universal File Format\n"));\r
+    else                    DEBUG((EFI_D_ERROR, "\t- Format(3): Others/Unknown\n"));\r
+  } else {\r
+    DEBUG((EFI_D_ERROR, "\t- Format: Reserved\n"));\r
+  }\r
 }\r
 \r
-VOID PrintRCA(UINT32 rca) {\r
-    DEBUG((EFI_D_ERROR, "- PrintRCA: 0x%X\n",rca));\r
-    DEBUG((EFI_D_ERROR, "\t- Status: 0x%X\n",rca & 0xFFFF));\r
-    DEBUG((EFI_D_ERROR, "\t- RCA: 0x%X\n",(rca >> 16) & 0xFFFF));\r
+VOID\r
+PrintRCA (\r
+  IN UINT32 Rca\r
+  )\r
+{\r
+  DEBUG((EFI_D_ERROR, "- PrintRCA: 0x%X\n",Rca));\r
+  DEBUG((EFI_D_ERROR, "\t- Status: 0x%X\n",Rca & 0xFFFF));\r
+  DEBUG((EFI_D_ERROR, "\t- RCA: 0x%X\n",(Rca >> 16) & 0xFFFF));\r
 }\r
 \r
-VOID PrintResponseR1(UINT32 response) {\r
-    DEBUG((EFI_D_INFO, "Response: 0x%X\n",response));\r
-    if (response & (1 << 8))                 DEBUG((EFI_D_INFO, "\t- READY_FOR_DATA\n"));\r
-\r
-    if (((response >> 9) & 0xF) == 0)         DEBUG((EFI_D_INFO, "\t- State: Idle\n"));\r
-    else if (((response >> 9) & 0xF) == 1)    DEBUG((EFI_D_INFO, "\t- State: Ready\n"));\r
-    else if (((response >> 9) & 0xF) == 2)    DEBUG((EFI_D_INFO, "\t- State: Ident\n"));\r
-    else if (((response >> 9) & 0xF) == 3)    DEBUG((EFI_D_INFO, "\t- State: StandBy\n"));\r
-    else if (((response >> 9) & 0xF) == 4)    DEBUG((EFI_D_INFO, "\t- State: Tran\n"));\r
-    else if (((response >> 9) & 0xF) == 5)    DEBUG((EFI_D_INFO, "\t- State: Data\n"));\r
-    else if (((response >> 9) & 0xF) == 6)    DEBUG((EFI_D_INFO, "\t- State: Rcv\n"));\r
-    else if (((response >> 9) & 0xF) == 7)    DEBUG((EFI_D_INFO, "\t- State: Prg\n"));\r
-    else if (((response >> 9) & 0xF) == 8)    DEBUG((EFI_D_INFO, "\t- State: Dis\n"));\r
-    else                                     DEBUG((EFI_D_INFO, "\t- State: Reserved\n"));\r
+VOID\r
+PrintResponseR1 (\r
+  IN  UINT32 Response\r
+  )\r
+{\r
+  DEBUG((EFI_D_INFO, "Response: 0x%X\n",Response));\r
+  if (Response & (1 << 8))                  DEBUG((EFI_D_INFO, "\t- READY_FOR_DATA\n"));\r
+\r
+  if (((Response >> 9) & 0xF) == 0)         DEBUG((EFI_D_INFO, "\t- State: Idle\n"));\r
+  else if (((Response >> 9) & 0xF) == 1)    DEBUG((EFI_D_INFO, "\t- State: Ready\n"));\r
+  else if (((Response >> 9) & 0xF) == 2)    DEBUG((EFI_D_INFO, "\t- State: Ident\n"));\r
+  else if (((Response >> 9) & 0xF) == 3)    DEBUG((EFI_D_INFO, "\t- State: StandBy\n"));\r
+  else if (((Response >> 9) & 0xF) == 4)    DEBUG((EFI_D_INFO, "\t- State: Tran\n"));\r
+  else if (((Response >> 9) & 0xF) == 5)    DEBUG((EFI_D_INFO, "\t- State: Data\n"));\r
+  else if (((Response >> 9) & 0xF) == 6)    DEBUG((EFI_D_INFO, "\t- State: Rcv\n"));\r
+  else if (((Response >> 9) & 0xF) == 7)    DEBUG((EFI_D_INFO, "\t- State: Prg\n"));\r
+  else if (((Response >> 9) & 0xF) == 8)    DEBUG((EFI_D_INFO, "\t- State: Dis\n"));\r
+  else                                      DEBUG((EFI_D_INFO, "\t- State: Reserved\n"));\r
 }\r
 \r
 EFI_STATUS\r
 EFIAPI\r
 MmcGetCardStatus(\r
-               MMC_HOST_INSTANCE     *MmcHostInstance\r
-  ){\r
-    EFI_STATUS              Status=EFI_SUCCESS;\r
-    UINT32                  Response[4];\r
-    UINTN                   CmdArg;\r
-    EFI_MMC_HOST_PROTOCOL   *MmcHost;\r
-\r
-    MmcHost = MmcHostInstance->MmcHost;\r
-    CmdArg = 0;\r
-\r
-    if (MmcHost == NULL) {\r
-        return EFI_INVALID_PARAMETER;\r
-    }\r
-    if(MmcHostInstance->State != MmcHwInitializationState){\r
-       //Get the Status of the card.\r
-       CmdArg = MmcHostInstance->CardInfo.RCA << 16;\r
-       Status = MmcHost->SendCommand(MMC_CMD13, CmdArg);\r
-       if (EFI_ERROR(Status)) {\r
-               DEBUG((EFI_D_ERROR, "MmcGetCardStatus(MMC_CMD13): Error and Status = %r\n", Status));\r
-               ASSERT(0);\r
-               return Status;\r
-       }\r
-\r
-       //Read Response\r
-       MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R1,Response);\r
-       PrintResponseR1(Response[0]);\r
+       IN MMC_HOST_INSTANCE     *MmcHostInstance\r
+  )\r
+{\r
+  EFI_STATUS              Status;\r
+  UINT32                  Response[4];\r
+  UINTN                   CmdArg;\r
+  EFI_MMC_HOST_PROTOCOL   *MmcHost;\r
+\r
+  Status = EFI_SUCCESS;\r
+  MmcHost = MmcHostInstance->MmcHost;\r
+  CmdArg = 0;\r
+\r
+  if (MmcHost == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+  if(MmcHostInstance->State != MmcHwInitializationState){\r
+    //Get the Status of the card.\r
+    CmdArg = MmcHostInstance->CardInfo.RCA << 16;\r
+    Status = MmcHost->SendCommand(MMC_CMD13, CmdArg);\r
+    if (EFI_ERROR(Status)) {\r
+      DEBUG((EFI_D_ERROR, "MmcGetCardStatus(MMC_CMD13): Error and Status = %r\n", Status));\r
+      ASSERT(0);\r
+      return Status;\r
     }\r
 \r
-       return Status;\r
+    //Read Response\r
+    MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R1,Response);\r
+    PrintResponseR1(Response[0]);\r
+  }\r
+\r
+  return Status;\r
 }\r
 \r
 EFI_STATUS\r
 EFIAPI\r
 MmcIdentificationMode (\r
-  MMC_HOST_INSTANCE     *MmcHostInstance\r
-  ) {\r
-    EFI_STATUS              Status;\r
-    UINT32                  Response[4];\r
-    UINTN                   Timeout;\r
-    UINTN                   CmdArg;\r
-    BOOLEAN                 bHCS;\r
-    EFI_MMC_HOST_PROTOCOL   *MmcHost;\r
-    UINTN                   CmdRetryCnt;\r
-    \r
-    MmcHost = MmcHostInstance->MmcHost;\r
-    CmdArg = 0;\r
-    bHCS = FALSE;\r
-\r
-    if (MmcHost == NULL) {\r
-        return EFI_INVALID_PARAMETER;\r
-    }\r
-\r
-    // We can get into this function if we restart the identification mode\r
-    if (MmcHostInstance->State == MmcHwInitializationState) {\r
-        // Initialize the MMC Host HW\r
-        Status = MmcNotifyState (MmcHostInstance, MmcHwInitializationState);\r
-        if (EFI_ERROR(Status)) {\r
-            DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcHwInitializationState\n"));\r
-            return Status;\r
-        }\r
-    } else {\r
-        //Note: Could even be used in all cases. But it looks this command could put the state machine into inactive for some cards\r
-        Status = MmcHost->SendCommand(MMC_CMD0, 0);\r
-        if (EFI_ERROR(Status)) {\r
-            DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD0): Error\n"));\r
-            return Status;\r
-        }\r
+  IN MMC_HOST_INSTANCE     *MmcHostInstance\r
+  )\r
+{\r
+  EFI_STATUS              Status;\r
+  UINT32                  Response[4];\r
+  UINTN                   Timeout;\r
+  UINTN                   CmdArg;\r
+  BOOLEAN                 IsHCS;\r
+  EFI_MMC_HOST_PROTOCOL   *MmcHost;\r
+  UINTN                   CmdRetryCnt;\r
+\r
+  MmcHost = MmcHostInstance->MmcHost;\r
+  CmdArg = 0;\r
+  IsHCS = FALSE;\r
+\r
+  if (MmcHost == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  // We can get into this function if we restart the identification mode\r
+  if (MmcHostInstance->State == MmcHwInitializationState) {\r
+    // Initialize the MMC Host HW\r
+    Status = MmcNotifyState (MmcHostInstance, MmcHwInitializationState);\r
+    if (EFI_ERROR(Status)) {\r
+      DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcHwInitializationState\n"));\r
+      return Status;\r
     }\r
-\r
-    Status = MmcNotifyState (MmcHostInstance, MmcIdleState);\r
+  } else {\r
+    //Note: Could even be used in all cases. But it looks this command could put the state machine into inactive for some cards\r
+    Status = MmcHost->SendCommand(MMC_CMD0, 0);\r
     if (EFI_ERROR(Status)) {\r
-        DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdleState\n"));\r
-        return Status;\r
+      DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD0): Error\n"));\r
+      return Status;\r
     }\r
-\r
-    // Are we using SDIO ?\r
-    Status = MmcHost->SendCommand(MMC_CMD5, 0);\r
-    if (Status == EFI_SUCCESS) {\r
-        DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD5): Error - SDIO not supported.\n"));\r
-        return EFI_UNSUPPORTED;\r
+  }\r
+\r
+  Status = MmcNotifyState (MmcHostInstance, MmcIdleState);\r
+  if (EFI_ERROR(Status)) {\r
+    DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdleState\n"));\r
+    return Status;\r
+  }\r
+\r
+  // Are we using SDIO ?\r
+  Status = MmcHost->SendCommand(MMC_CMD5, 0);\r
+  if (Status == EFI_SUCCESS) {\r
+    DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD5): Error - SDIO not supported.\n"));\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
+  // Check which kind of card we are using. Ver2.00 or later SD Memory Card (PL180 is SD v1.1)\r
+  CmdArg = (0x0UL << 12 | BIT8 | 0xCEUL << 0);\r
+  Status = MmcHost->SendCommand(MMC_CMD8, CmdArg);\r
+  if (Status == EFI_SUCCESS) {\r
+    DEBUG ((EFI_D_ERROR, "Card is SD2.0 => Supports high capacity\n"));\r
+    IsHCS = TRUE;\r
+    MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R7,Response);\r
+    PrintResponseR1(Response[0]);\r
+    //check if it is valid response\r
+    if(Response[0] != CmdArg){\r
+      DEBUG ((EFI_D_ERROR, "The Card is not usable\n"));\r
+      return EFI_UNSUPPORTED;\r
     }\r
-\r
-    // Check which kind of card we are using. Ver2.00 or later SD Memory Card (PL180 is SD v1.1)\r
-    CmdArg = (0x0UL << 12 | BIT8 | 0xCEUL << 0);\r
-    Status = MmcHost->SendCommand(MMC_CMD8, CmdArg);\r
+  } else {\r
+    DEBUG ((EFI_D_ERROR, "Not a SD2.0 Card\n"));\r
+  }\r
+\r
+  // We need to wait for the MMC or SD card is ready => (gCardInfo.OCRData.Busy == 1)\r
+  Timeout = MAX_RETRY_COUNT;\r
+  while (Timeout > 0) {\r
+    // SD Card or MMC Card ? CMD55 indicates to the card that the next command is an application specific command\r
+    Status = MmcHost->SendCommand(MMC_CMD55, 0);\r
     if (Status == EFI_SUCCESS) {\r
-        DEBUG ((EFI_D_ERROR, "Card is SD2.0 => Supports high capacity\n"));\r
-        bHCS = TRUE;\r
-        MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R7,Response);\r
-        PrintResponseR1(Response[0]);\r
-        //check if it is valid response\r
-        if(Response[0] != CmdArg){\r
-               DEBUG ((EFI_D_ERROR, "The Card is not usable\n"));\r
-               return EFI_UNSUPPORTED;\r
-        }\r
-    } else {\r
-        DEBUG ((EFI_D_ERROR, "Not a SD2.0 Card\n"));\r
-    }\r
-\r
-    // We need to wait for the MMC or SD card is ready => (gCardInfo.OCRData.Busy == 1)\r
-    Timeout = MAX_RETRY_COUNT;\r
-    while (Timeout > 0) {\r
-        // SD Card or MMC Card ? CMD55 indicates to the card that the next command is an application specific command\r
-        Status = MmcHost->SendCommand(MMC_CMD55, 0);\r
-        if (Status == EFI_SUCCESS) {\r
-            DEBUG ((EFI_D_INFO, "Card should be SD\n"));\r
-            if (bHCS) {\r
-                MmcHostInstance->CardInfo.CardType = SD_CARD_2;\r
-            } else {\r
-                MmcHostInstance->CardInfo.CardType = SD_CARD;\r
-            }\r
-\r
-            // Note: The first time CmdArg will be zero\r
-            CmdArg = ((UINTN *) &(MmcHostInstance->CardInfo.OCRData))[0];\r
-            if (bHCS) {\r
-                CmdArg |= BIT30;\r
-            }\r
-            Status = MmcHost->SendCommand(MMC_ACMD41, CmdArg);\r
-            if (!EFI_ERROR(Status)) {\r
-              MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_OCR,Response);\r
-              ((UINT32 *) &(MmcHostInstance->CardInfo.OCRData))[0] = Response[0];\r
-            }\r
+        DEBUG ((EFI_D_INFO, "Card should be SD\n"));\r
+        if (IsHCS) {\r
+            MmcHostInstance->CardInfo.CardType = SD_CARD_2;\r
         } else {\r
-            DEBUG ((EFI_D_INFO, "Card should be MMC\n"));\r
-            MmcHostInstance->CardInfo.CardType = MMC_CARD;\r
-\r
-            Status = MmcHost->SendCommand(MMC_CMD1, 0x800000);\r
-            if (!EFI_ERROR(Status)) {\r
-              MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_OCR,Response);\r
-              ((UINT32 *) &(MmcHostInstance->CardInfo.OCRData))[0] = Response[0];\r
-            }\r
+            MmcHostInstance->CardInfo.CardType = SD_CARD;\r
         }\r
 \r
+        // Note: The first time CmdArg will be zero\r
+        CmdArg = ((UINTN *) &(MmcHostInstance->CardInfo.OCRData))[0];\r
+        if (IsHCS) {\r
+            CmdArg |= BIT30;\r
+        }\r
+        Status = MmcHost->SendCommand(MMC_ACMD41, CmdArg);\r
         if (!EFI_ERROR(Status)) {\r
-          if (MmcHostInstance->CardInfo.OCRData.Busy == 0) {\r
-              MicroSecondDelay(1);\r
-              Timeout--;\r
-          } else {\r
-              if ((MmcHostInstance->CardInfo.CardType == SD_CARD_2) && (MmcHostInstance->CardInfo.OCRData.AccessMode & BIT1)) {\r
-                  MmcHostInstance->CardInfo.CardType = SD_CARD_2_HIGH;\r
-                  DEBUG ((EFI_D_ERROR, "High capacity card.\n"));\r
-              }\r
-              break;  // The MMC/SD card is ready. Continue the Identification Mode\r
-          }\r
-        } else {\r
-          MicroSecondDelay(1);\r
-          Timeout--;\r
+          MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_OCR,Response);\r
+          ((UINT32 *) &(MmcHostInstance->CardInfo.OCRData))[0] = Response[0];\r
         }\r
-    }\r
-\r
-    if (Timeout == 0) {\r
-        DEBUG((EFI_D_ERROR, "MmcIdentificationMode(): No Card\n"));\r
-        ASSERT(0);\r
-        return EFI_NO_MEDIA;\r
     } else {\r
-        PrintOCR(Response[0]);\r
-    }\r
-\r
-    Status = MmcNotifyState (MmcHostInstance, MmcReadyState);\r
-    if (EFI_ERROR(Status)) {\r
-        DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcReadyState\n"));\r
-        return Status;\r
-    }\r
-\r
-    Status = MmcHost->SendCommand(MMC_CMD2, 0);\r
-    if (EFI_ERROR(Status)) {\r
-        DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD2): Error\n"));\r
-        ASSERT(0);\r
-        return Status;\r
-    }\r
-    MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_CID,Response);\r
-    PrintCID(Response);\r
-\r
-    Status = MmcNotifyState (MmcHostInstance, MmcIdentificationState);\r
-    if (EFI_ERROR(Status)) {\r
-        DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdentificationState\n"));\r
-        return Status;\r
-    }\r
+        DEBUG ((EFI_D_INFO, "Card should be MMC\n"));\r
+        MmcHostInstance->CardInfo.CardType = MMC_CARD;\r
 \r
-    CmdArg = 0;\r
-    CmdRetryCnt = CMD_RETRY_COUNT;\r
-    //Keep sending CMD 3 until card enters to Standby mode and Card status is ready\r
-    while((MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_STDBY) && CmdRetryCnt-- ){\r
-        Status = MmcHost->SendCommand(MMC_CMD3, CmdArg);\r
-        if (EFI_ERROR(Status)) {\r
-            DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD3): Error\n"));\r
-            return Status;\r
+        Status = MmcHost->SendCommand(MMC_CMD1, 0x800000);\r
+        if (!EFI_ERROR(Status)) {\r
+          MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_OCR,Response);\r
+          ((UINT32 *) &(MmcHostInstance->CardInfo.OCRData))[0] = Response[0];\r
         }\r
-        MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_RCA,Response);\r
-        PrintRCA(Response[0]);\r
     }\r
 \r
-    // For MMC card, RCA is assigned by CMD3 while CMD3 dumps the RCA for SD card\r
-    if (MmcHostInstance->CardInfo.CardType != MMC_CARD) {\r
-        MmcHostInstance->CardInfo.RCA = Response[0] >> 16;\r
+    if (!EFI_ERROR(Status)) {\r
+      if (MmcHostInstance->CardInfo.OCRData.Busy == 0) {\r
+          MicroSecondDelay(1);\r
+          Timeout--;\r
+      } else {\r
+          if ((MmcHostInstance->CardInfo.CardType == SD_CARD_2) && (MmcHostInstance->CardInfo.OCRData.AccessMode & BIT1)) {\r
+              MmcHostInstance->CardInfo.CardType = SD_CARD_2_HIGH;\r
+              DEBUG ((EFI_D_ERROR, "High capacity card.\n"));\r
+          }\r
+          break;  // The MMC/SD card is ready. Continue the Identification Mode\r
+      }\r
     } else {\r
-        MmcHostInstance->CardInfo.RCA = CmdArg;\r
+      MicroSecondDelay(1);\r
+      Timeout--;\r
     }\r
-\r
-    Status = MmcNotifyState (MmcHostInstance, MmcStandByState);\r
+  }\r
+\r
+  if (Timeout == 0) {\r
+    DEBUG((EFI_D_ERROR, "MmcIdentificationMode(): No Card\n"));\r
+    ASSERT(0);\r
+    return EFI_NO_MEDIA;\r
+  } else {\r
+    PrintOCR(Response[0]);\r
+  }\r
+\r
+  Status = MmcNotifyState (MmcHostInstance, MmcReadyState);\r
+  if (EFI_ERROR(Status)) {\r
+    DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcReadyState\n"));\r
+    return Status;\r
+  }\r
+\r
+  Status = MmcHost->SendCommand(MMC_CMD2, 0);\r
+  if (EFI_ERROR(Status)) {\r
+    DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD2): Error\n"));\r
+    ASSERT(0);\r
+    return Status;\r
+  }\r
+  MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_CID,Response);\r
+  PrintCID(Response);\r
+\r
+  Status = MmcNotifyState (MmcHostInstance, MmcIdentificationState);\r
+  if (EFI_ERROR(Status)) {\r
+    DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcIdentificationState\n"));\r
+    return Status;\r
+  }\r
+\r
+  CmdArg = 0;\r
+  CmdRetryCnt = CMD_RETRY_COUNT;\r
+  //Keep sending CMD 3 until card enters to Standby mode and Card status is ready\r
+  while((MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_STDBY) && CmdRetryCnt--) {\r
+    Status = MmcHost->SendCommand(MMC_CMD3, CmdArg);\r
     if (EFI_ERROR(Status)) {\r
-        DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcStandByState\n"));\r
+        DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD3): Error\n"));\r
         return Status;\r
     }\r
-\r
-    return EFI_SUCCESS;\r
+    MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_RCA,Response);\r
+    PrintRCA(Response[0]);\r
+  }\r
+\r
+  // For MMC card, RCA is assigned by CMD3 while CMD3 dumps the RCA for SD card\r
+  if (MmcHostInstance->CardInfo.CardType != MMC_CARD) {\r
+    MmcHostInstance->CardInfo.RCA = Response[0] >> 16;\r
+  } else {\r
+    MmcHostInstance->CardInfo.RCA = CmdArg;\r
+  }\r
+\r
+  Status = MmcNotifyState (MmcHostInstance, MmcStandByState);\r
+  if (EFI_ERROR(Status)) {\r
+    DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcStandByState\n"));\r
+    return Status;\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 EFI_STATUS\r
@@ -339,10 +365,11 @@ EFIAPI
 MmcReset (\r
   IN EFI_BLOCK_IO_PROTOCOL    *This,\r
   IN BOOLEAN                  ExtendedVerification\r
-  ) {\r
-    // Implement me. Either send a CMD0 (could not work for some MMC host) or just turn off/turn\r
-    //      on power and restart Identification mode\r
-    return EFI_SUCCESS;\r
+  )\r
+{\r
+  // Implement me. Either send a CMD0 (could not work for some MMC host) or just turn off/turn\r
+  //      on power and restart Identification mode\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 EFI_STATUS\r
@@ -350,244 +377,246 @@ MmcDetectCard (
   EFI_MMC_HOST_PROTOCOL     *MmcHost\r
   )\r
 {\r
-    if (!MmcHost->IsCardPresent()) {\r
-        return EFI_NO_MEDIA;\r
-    } else {\r
-        return EFI_SUCCESS;\r
-    }\r
+  if (!MmcHost->IsCardPresent()) {\r
+    return EFI_NO_MEDIA;\r
+  } else {\r
+    return EFI_SUCCESS;\r
+  }\r
 }\r
 \r
 #define MMCI0_BLOCKLEN 512\r
 #define MMCI0_TIMEOUT  10000\r
 \r
-EFI_STATUS MmcIoBlocks (\r
+EFI_STATUS\r
+MmcIoBlocks (\r
   IN EFI_BLOCK_IO_PROTOCOL    *This,\r
   IN UINTN                    Transfer,\r
   IN UINT32                   MediaId,\r
   IN EFI_LBA                  Lba,\r
   IN UINTN                    BufferSize,\r
   OUT VOID                    *Buffer\r
-  ) {\r
-    UINT32                  Response[4];\r
-    EFI_STATUS              Status;\r
-    UINTN                   CardSize, NumBlocks, BlockSize, CmdArg;\r
-    UINTN                   Timeout;\r
-    UINTN                   Cmd;\r
-    MMC_HOST_INSTANCE       *MmcHostInstance;\r
-    EFI_MMC_HOST_PROTOCOL   *MmcHost;\r
-    UINTN                   BytesRemainingToBeTransfered;\r
-    UINTN                   BlockCount = 1;\r
-\r
-    MmcHostInstance = MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS(This);\r
-    ASSERT(MmcHostInstance != 0);\r
-    MmcHost = MmcHostInstance->MmcHost;\r
-    ASSERT(MmcHost);\r
-\r
-    if (MmcHost == 0) {\r
-        return EFI_INVALID_PARAMETER;\r
+  )\r
+{\r
+  UINT32                  Response[4];\r
+  EFI_STATUS              Status;\r
+  UINTN                   CardSize, NumBlocks, BlockSize, CmdArg;\r
+  UINTN                   Timeout;\r
+  UINTN                   Cmd;\r
+  MMC_HOST_INSTANCE       *MmcHostInstance;\r
+  EFI_MMC_HOST_PROTOCOL   *MmcHost;\r
+  UINTN                   BytesRemainingToBeTransfered;\r
+  UINTN                   BlockCount = 1;\r
+\r
+  MmcHostInstance = MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS(This);\r
+  ASSERT(MmcHostInstance != 0);\r
+  MmcHost = MmcHostInstance->MmcHost;\r
+  ASSERT(MmcHost);\r
+\r
+  if (MmcHost == 0) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  // Check if a Card is Present\r
+  if (!MmcHost->IsCardPresent()) {\r
+    MmcHostInstance->BlockIo.Media->MediaPresent = FALSE;\r
+    MmcHostInstance->BlockIo.Media->LastBlock    = 0;\r
+    MmcHostInstance->BlockIo.Media->BlockSize    = 512;  // Should be zero but there is a bug in DiskIo\r
+    MmcHostInstance->BlockIo.Media->ReadOnly     = FALSE;\r
+    return EFI_NO_MEDIA;\r
+  }\r
+\r
+  // If the driver has not been initialized yet then go into Iddentification Mode\r
+  if (MmcHostInstance->State == MmcHwInitializationState) {\r
+    MmcIdentificationMode (MmcHostInstance);\r
+\r
+    //Send a command to get Card specific data\r
+    CmdArg = MmcHostInstance->CardInfo.RCA << 16;\r
+    Status = MmcHost->SendCommand(MMC_CMD9, CmdArg);\r
+    if (EFI_ERROR(Status)) {\r
+      DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD9): Error, Status=%r\n", Status));\r
+      ASSERT(0);\r
+      return Status;\r
     }\r
-\r
-    // Check if a Card is Present\r
-    if (!MmcHost->IsCardPresent()) {\r
-        MmcHostInstance->BlockIo.Media->MediaPresent = FALSE;\r
-        MmcHostInstance->BlockIo.Media->LastBlock    = 0;\r
-        MmcHostInstance->BlockIo.Media->BlockSize    = 512;  // Should be zero but there is a bug in DiskIo\r
-        MmcHostInstance->BlockIo.Media->ReadOnly     = FALSE; \r
-        return EFI_NO_MEDIA;\r
+    //Read Response\r
+    MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_CSD,Response);\r
+    PrintCSD(Response);\r
+\r
+    if (MmcHostInstance->CardInfo.CardType == SD_CARD_2_HIGH) {\r
+      ASSERT(0);  //TODO: Implementation needed\r
+      CardSize = MMC_CSD_GET_DEVICESIZE(Response);\r
+      NumBlocks = ((CardSize + 1) * 1024);;\r
+      BlockSize = 1 << MMC_CSD_GET_READBLLEN(Response);\r
+    } else {\r
+      CardSize = MMC_CSD_GET_DEVICESIZE(Response);\r
+      NumBlocks = (CardSize + 1) * (1 << (MMC_CSD_GET_DEVICESIZEMULT(Response) + 2));\r
+      BlockSize = 1 << MMC_CSD_GET_READBLLEN(Response);\r
     }\r
 \r
-    // If the driver has not been initialized yet then go into Iddentification Mode\r
-    if (MmcHostInstance->State == MmcHwInitializationState) {\r
-        MmcIdentificationMode (MmcHostInstance);\r
-\r
-        //Send a command to get Card specific data\r
-        CmdArg = MmcHostInstance->CardInfo.RCA << 16;\r
-        Status = MmcHost->SendCommand(MMC_CMD9, CmdArg);\r
-        if (EFI_ERROR(Status)) {\r
-            DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD9): Error, Status=%r\n", Status));\r
-            ASSERT(0);\r
-            return Status;\r
-        }\r
-        //Read Response\r
-        MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_CSD,Response);\r
-        PrintCSD(Response);\r
-\r
-        if (MmcHostInstance->CardInfo.CardType == SD_CARD_2_HIGH) {\r
-            ASSERT(0);  //TODO: Implementation needed\r
-            CardSize = MMC_CSD_GET_DEVICESIZE(Response);\r
-            NumBlocks = ((CardSize + 1) * 1024);;\r
-            BlockSize = 1 << MMC_CSD_GET_READBLLEN(Response);\r
-        } else {\r
-            CardSize = MMC_CSD_GET_DEVICESIZE(Response);\r
-            NumBlocks = (CardSize + 1) * (1 << (MMC_CSD_GET_DEVICESIZEMULT(Response) + 2));\r
-            BlockSize = 1 << MMC_CSD_GET_READBLLEN(Response);\r
-        }\r
-\r
-        //For >=2G card, BlockSize may be 1K, but the transfer size is 512 bytes.\r
-        if (BlockSize > 512) {\r
-            NumBlocks = MultU64x32(NumBlocks, BlockSize/512);\r
-            BlockSize = 512;        \r
-        }\r
+    //For >=2G card, BlockSize may be 1K, but the transfer size is 512 bytes.\r
+    if (BlockSize > 512) {\r
+      NumBlocks = MultU64x32(NumBlocks, BlockSize/512);\r
+      BlockSize = 512;\r
+    }\r
 \r
-        MmcHostInstance->BlockIo.Media->LastBlock    = (NumBlocks - 1);\r
-        MmcHostInstance->BlockIo.Media->BlockSize    = BlockSize;\r
-        MmcHostInstance->BlockIo.Media->ReadOnly     = MmcHost->IsReadOnly();\r
-        MmcHostInstance->BlockIo.Media->MediaPresent = TRUE; \r
-        MmcHostInstance->BlockIo.Media->MediaId++; \r
-\r
-        CmdArg = MmcHostInstance->CardInfo.RCA << 16;\r
-        Status = MmcHost->SendCommand(MMC_CMD7, CmdArg);\r
-        if (EFI_ERROR(Status)) {\r
-            DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD7): Error and Status = %r\n", Status));\r
-            ASSERT(0);\r
-            return Status;\r
-        }\r
+    MmcHostInstance->BlockIo.Media->LastBlock    = (NumBlocks - 1);\r
+    MmcHostInstance->BlockIo.Media->BlockSize    = BlockSize;\r
+    MmcHostInstance->BlockIo.Media->ReadOnly     = MmcHost->IsReadOnly();\r
+    MmcHostInstance->BlockIo.Media->MediaPresent = TRUE;\r
+    MmcHostInstance->BlockIo.Media->MediaId++;\r
 \r
-        Status = MmcNotifyState (MmcHostInstance, MmcTransferState);\r
-        if (EFI_ERROR(Status)) {\r
-            DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcTransferState\n"));\r
-            return Status;\r
-        }\r
-    } else {\r
-        // Maybe test if the card has changed to update gMmcMedia information\r
-        if (MmcHostInstance->State == MmcTransferState) {\r
-            //DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : MmcTransferState\n"));\r
-        } else if (MmcHostInstance->State == MmcStandByState) {\r
-            DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : MmcStandByState\n"));\r
-        } else {\r
-            ASSERT(0);\r
-        }\r
+    CmdArg = MmcHostInstance->CardInfo.RCA << 16;\r
+    Status = MmcHost->SendCommand(MMC_CMD7, CmdArg);\r
+    if (EFI_ERROR(Status)) {\r
+      DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD7): Error and Status = %r\n", Status));\r
+      ASSERT(0);\r
+      return Status;\r
     }\r
 \r
-    if (Lba > This->Media->LastBlock) {\r
-        ASSERT(0);\r
-        return EFI_INVALID_PARAMETER;\r
+    Status = MmcNotifyState (MmcHostInstance, MmcTransferState);\r
+    if (EFI_ERROR(Status)) {\r
+      DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcTransferState\n"));\r
+      return Status;\r
+    }\r
+  } else {\r
+    // Maybe test if the card has changed to update gMmcMedia information\r
+    if (MmcHostInstance->State == MmcTransferState) {\r
+      //DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : MmcTransferState\n"));\r
+    } else if (MmcHostInstance->State == MmcStandByState) {\r
+      DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : MmcStandByState\n"));\r
+    } else {\r
+      ASSERT(0);\r
     }\r
-  \r
-    if ((BufferSize % This->Media->BlockSize) != 0) {\r
-        ASSERT(0);\r
-        return EFI_BAD_BUFFER_SIZE;\r
+  }\r
+\r
+  if (Lba > This->Media->LastBlock) {\r
+      ASSERT(0);\r
+      return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  if ((BufferSize % This->Media->BlockSize) != 0) {\r
+      ASSERT(0);\r
+      return EFI_BAD_BUFFER_SIZE;\r
+  }\r
+\r
+  BytesRemainingToBeTransfered = BufferSize;\r
+  while (BytesRemainingToBeTransfered > 0) {\r
+\r
+    // Check if the Card is in Ready status\r
+    CmdArg = MmcHostInstance->CardInfo.RCA << 16;\r
+    Response[0] = 0;\r
+    Timeout = 20;\r
+    while(!(Response[0] & MMC_R0_READY_FOR_DATA) && (MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_TRAN) && Timeout--) {\r
+      Status = MmcHost->SendCommand(MMC_CMD13, CmdArg);\r
+      if (!EFI_ERROR(Status)) {\r
+        MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R1,Response);\r
+      }\r
     }\r
 \r
-    BytesRemainingToBeTransfered = BufferSize;\r
-    while (BytesRemainingToBeTransfered > 0) {\r
-\r
-       //Check if the Card is in Ready status\r
-               CmdArg = MmcHostInstance->CardInfo.RCA << 16;\r
-               Response[0] = 0;\r
-               Timeout = 20;\r
-       while(!(Response[0] & MMC_R0_READY_FOR_DATA) && (MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_TRAN) && Timeout--) {\r
-               Status = MmcHost->SendCommand(MMC_CMD13, CmdArg);\r
-               if (!EFI_ERROR(Status)){\r
-                       MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R1,Response);\r
-               }\r
-       }\r
-\r
-       if (0 == Timeout) {\r
-               DEBUG((EFI_D_ERROR, "The Card is busy\n"));\r
-               return EFI_NOT_READY;\r
+    if (0 == Timeout) {\r
+      DEBUG((EFI_D_ERROR, "The Card is busy\n"));\r
+      return EFI_NOT_READY;\r
     }\r
 \r
-        // Set Block Length\r
-        Status = MmcHost->SendCommand(MMC_CMD16, This->Media->BlockSize);\r
-        if (EFI_ERROR(Status)) {\r
-               DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD16): Error This->Media->BlockSize:%d and Error = %r\n",This->Media->BlockSize, Status));\r
-            return Status;\r
-        }\r
+    // Set Block Length\r
+    Status = MmcHost->SendCommand(MMC_CMD16, This->Media->BlockSize);\r
+    if (EFI_ERROR(Status)) {\r
+      DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD16): Error This->Media->BlockSize:%d and Error = %r\n",This->Media->BlockSize, Status));\r
+      return Status;\r
+    }\r
 \r
-        // Block Count (not used). Could return an error for SD card\r
-        MmcHost->SendCommand(MMC_CMD23, BlockCount);\r
+    // Block Count (not used). Could return an error for SD card\r
+    MmcHost->SendCommand(MMC_CMD23, BlockCount);\r
 \r
-        //Set command argument based on the card access mode (Byte mode or Block mode)\r
-        if (MmcHostInstance->CardInfo.OCRData.AccessMode & BIT1) {\r
-            CmdArg = Lba;\r
-        } else {\r
-            CmdArg = Lba * This->Media->BlockSize;\r
-        }\r
+    //Set command argument based on the card access mode (Byte mode or Block mode)\r
+    if (MmcHostInstance->CardInfo.OCRData.AccessMode & BIT1) {\r
+      CmdArg = Lba;\r
+    } else {\r
+      CmdArg = Lba * This->Media->BlockSize;\r
+    }\r
 \r
-        if (Transfer == MMC_IOBLOCKS_READ) {\r
+    if (Transfer == MMC_IOBLOCKS_READ) {\r
 #ifndef USE_STREAM\r
-            // Read a single block\r
-            Cmd = MMC_CMD17;\r
+      // Read a single block\r
+      Cmd = MMC_CMD17;\r
 #else\r
-            //TODO: Should we support read stream (MMC_CMD11)\r
+      //TODO: Should we support read stream (MMC_CMD11)\r
 #endif\r
-        } else {\r
+    } else {\r
 #ifndef USE_STREAM\r
-            // Write a single block\r
-            Cmd = MMC_CMD24;\r
+      // Write a single block\r
+      Cmd = MMC_CMD24;\r
 #else\r
-            //TODO: Should we support write stream (MMC_CMD20)\r
+      //TODO: Should we support write stream (MMC_CMD20)\r
 #endif\r
-        }\r
-        Status = MmcHost->SendCommand(Cmd, CmdArg);\r
-        if (EFI_ERROR(Status)) {\r
-            DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD%d): Error %r\n",Cmd, Status));\r
-            return Status;\r
-        }\r
+    }\r
+    Status = MmcHost->SendCommand(Cmd, CmdArg);\r
+    if (EFI_ERROR(Status)) {\r
+      DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD%d): Error %r\n",Cmd, Status));\r
+      return Status;\r
+    }\r
 \r
-        if (Transfer == MMC_IOBLOCKS_READ) {\r
+    if (Transfer == MMC_IOBLOCKS_READ) {\r
 #ifndef USE_STREAM\r
-            // Read one block of Data\r
-            Status = MmcHost->ReadBlockData(Lba,This->Media->BlockSize,Buffer);\r
-            if (EFI_ERROR(Status)) {\r
-                DEBUG((EFI_D_BLKIO, "MmcIdentificationMode(): Error Read Block Data and Status = %r\n", Status));\r
-                return Status;\r
-            }\r
+      // Read one block of Data\r
+      Status = MmcHost->ReadBlockData(Lba,This->Media->BlockSize,Buffer);\r
+      if (EFI_ERROR(Status)) {\r
+        DEBUG((EFI_D_BLKIO, "MmcIdentificationMode(): Error Read Block Data and Status = %r\n", Status));\r
+        return Status;\r
+      }\r
 #else\r
-            //TODO: Read a steam\r
-            ASSERT(0);\r
+      //TODO: Read a steam\r
+      ASSERT(0);\r
 #endif\r
-            Status = MmcNotifyState (MmcHostInstance, MmcProgrammingState);\r
-            if (EFI_ERROR(Status)) {\r
-                DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcProgrammingState\n"));\r
-                return Status;\r
-            }\r
-        } else {\r
+      Status = MmcNotifyState (MmcHostInstance, MmcProgrammingState);\r
+      if (EFI_ERROR(Status)) {\r
+        DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcProgrammingState\n"));\r
+        return Status;\r
+      }\r
+    } else {\r
 #ifndef USE_STREAM\r
-            // Write one block of Data\r
-            Status = MmcHost->WriteBlockData(Lba,This->Media->BlockSize,Buffer);\r
-            if (EFI_ERROR(Status)) {\r
-                DEBUG((EFI_D_BLKIO, "MmcIdentificationMode(): Error Write Block Data and Status = %r\n", Status));\r
-                return Status;\r
-            }\r
+      // Write one block of Data\r
+      Status = MmcHost->WriteBlockData(Lba,This->Media->BlockSize,Buffer);\r
+      if (EFI_ERROR(Status)) {\r
+        DEBUG((EFI_D_BLKIO, "MmcIdentificationMode(): Error Write Block Data and Status = %r\n", Status));\r
+        return Status;\r
+      }\r
 #else\r
-            //TODO: Write a steam\r
-            ASSERT(0);\r
+      //TODO: Write a steam\r
+      ASSERT(0);\r
 #endif\r
-        }\r
+    }\r
 \r
-        // Command 12 - Stop transmission (ends read)\r
-        Status = MmcHost->SendCommand(MMC_CMD12, 0);\r
-       if (!EFI_ERROR(Status)) {\r
-               MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R1b,Response);\r
-       }\r
-\r
-        // Command 13 - Read status and wait for programming to complete (return to tran)\r
-        Timeout = MMCI0_TIMEOUT;\r
-        CmdArg = MmcHostInstance->CardInfo.RCA << 16;\r
-       Response[0] = 0;\r
-       while(!(Response[0] & MMC_R0_READY_FOR_DATA) && (MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_TRAN) && Timeout--) {\r
-               Status = MmcHost->SendCommand(MMC_CMD13, CmdArg);\r
-               if (!EFI_ERROR(Status)) {\r
-               MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R1,Response);\r
-               }\r
-            NanoSecondDelay(100);\r
-            Timeout--;\r
-        }\r
+    // Command 12 - Stop transmission (ends read)\r
+    Status = MmcHost->SendCommand(MMC_CMD12, 0);\r
+    if (!EFI_ERROR(Status)) {\r
+      MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R1b,Response);\r
+    }\r
 \r
-        Status = MmcNotifyState (MmcHostInstance, MmcTransferState);\r
-        if (EFI_ERROR(Status)) {\r
-            DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcTransferState\n"));\r
-            return Status;\r
-        }\r
+    // Command 13 - Read status and wait for programming to complete (return to tran)\r
+    Timeout = MMCI0_TIMEOUT;\r
+    CmdArg = MmcHostInstance->CardInfo.RCA << 16;\r
+    Response[0] = 0;\r
+    while(!(Response[0] & MMC_R0_READY_FOR_DATA) && (MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_TRAN) && Timeout--) {\r
+      Status = MmcHost->SendCommand(MMC_CMD13, CmdArg);\r
+      if (!EFI_ERROR(Status)) {\r
+        MmcHost->ReceiveResponse(MMC_RESPONSE_TYPE_R1,Response);\r
+      }\r
+      NanoSecondDelay(100);\r
+      Timeout--;\r
+    }\r
 \r
-        BytesRemainingToBeTransfered -= This->Media->BlockSize;\r
-        Lba    += BlockCount;\r
-        Buffer = (UINT8 *)Buffer + This->Media->BlockSize;\r
+    Status = MmcNotifyState (MmcHostInstance, MmcTransferState);\r
+    if (EFI_ERROR(Status)) {\r
+      DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcTransferState\n"));\r
+      return Status;\r
     }\r
 \r
-    return EFI_SUCCESS;\r
+    BytesRemainingToBeTransfered -= This->Media->BlockSize;\r
+    Lba    += BlockCount;\r
+    Buffer = (UINT8 *)Buffer + This->Media->BlockSize;\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 EFI_STATUS\r
@@ -598,8 +627,9 @@ MmcReadBlocks (
   IN EFI_LBA                  Lba,\r
   IN UINTN                    BufferSize,\r
   OUT VOID                    *Buffer\r
-  ) {\r
-    return MmcIoBlocks (This, MMC_IOBLOCKS_READ, MediaId, Lba, BufferSize, Buffer);\r
+  )\r
+{\r
+  return MmcIoBlocks (This, MMC_IOBLOCKS_READ, MediaId, Lba, BufferSize, Buffer);\r
 }\r
 \r
 EFI_STATUS\r
@@ -610,15 +640,17 @@ MmcWriteBlocks (
   IN EFI_LBA                  Lba,\r
   IN UINTN                    BufferSize,\r
   IN VOID                     *Buffer\r
-  ) {\r
-    return MmcIoBlocks (This, MMC_IOBLOCKS_WRITE, MediaId, Lba, BufferSize, Buffer);\r
+  )\r
+{\r
+  return MmcIoBlocks (This, MMC_IOBLOCKS_WRITE, MediaId, Lba, BufferSize, Buffer);\r
 }\r
 \r
 EFI_STATUS\r
 EFIAPI\r
 MmcFlushBlocks (\r
   IN EFI_BLOCK_IO_PROTOCOL  *This\r
-  ) {\r
-    return EFI_SUCCESS;\r
+  )\r
+{\r
+  return EFI_SUCCESS;\r
 }\r
 \r