\r
Internal generic functions to operate flash block.\r
\r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
**/\r
\r
partially erased.\r
@retval EFI_INVALID_PARAMETER One or more of the LBAs listed\r
in the variable argument list do\r
- not exist in the firmware volume. \r
+ not exist in the firmware volume.\r
\r
\r
**/\r
**/\r
EFI_STATUS\r
InitFtwDevice (\r
- OUT EFI_FTW_DEVICE **FtwData \r
+ OUT EFI_FTW_DEVICE **FtwData\r
)\r
{\r
EFI_FTW_DEVICE *FtwDevice;\r
- \r
+\r
//\r
// Allocate private data of this driver,\r
// Including the FtwWorkSpace[FTW_WORK_SPACE_SIZE].\r
if (FtwDevice->WorkSpaceAddress == 0) {\r
FtwDevice->WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwWorkingBase);\r
}\r
- \r
+\r
FtwDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS) PcdGet64 (PcdFlashNvStorageFtwSpareBase64);\r
if (FtwDevice->SpareAreaAddress == 0) {\r
FtwDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwSpareBase);\r
- } \r
+ }\r
\r
*FtwData = FtwDevice;\r
return EFI_SUCCESS;\r
@retval EFI_SUCCESS Find the FVB protocol successfully.\r
@retval EFI_NOT_FOUND No proper FVB protocol was found.\r
@retval EFI_ABORTED Some data can not be got or be invalid.\r
- \r
+\r
**/\r
EFI_STATUS\r
FindFvbForFtw (\r
//\r
Status = Fvb->GetAttributes (Fvb, &Attributes);\r
if (EFI_ERROR (Status) || ((Attributes & EFI_FVB2_WRITE_STATUS) == 0)) {\r
- continue; \r
+ continue;\r
}\r
//\r
// Compare the address and select the right one\r
\r
@retval EFI_SUCCESS Initialize the FTW protocol successfully.\r
@retval EFI_NOT_FOUND No proper FVB protocol was found.\r
- \r
+\r
**/\r
EFI_STATUS\r
InitFtwProtocol (\r
Status = FindFvbForFtw (FtwDevice);\r
if (EFI_ERROR (Status)) {\r
return EFI_NOT_FOUND;\r
- } \r
+ }\r
\r
//\r
// Calculate the start LBA of working block.\r
if (FtwDevice->FtwWorkSpace[Offset] != FTW_ERASED_BYTE) {\r
Offset += FTW_WRITE_TOTAL_SIZE (FtwHeader->NumberOfWrites, FtwHeader->PrivateDataSize);\r
}\r
- \r
+\r
if (!IsErasedFlashBuffer (FtwDevice->FtwWorkSpace + Offset, FtwDevice->FtwWorkSpaceSize - Offset)) {\r
Status = FtwReclaimWorkSpace (FtwDevice, TRUE);\r
ASSERT_EFI_ERROR (Status);\r
FtwDevice->FtwInstance.Restart = FtwRestart;\r
FtwDevice->FtwInstance.Abort = FtwAbort;\r
FtwDevice->FtwInstance.GetLastWrite = FtwGetLastWrite;\r
- \r
+\r
return EFI_SUCCESS;\r
}\r
\r