MdeModulePkg: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
/** @file
|
||||
|
||||
These are the common Fault Tolerant Write (FTW) functions that are shared
|
||||
These are the common Fault Tolerant Write (FTW) functions that are shared
|
||||
by DXE FTW driver and SMM FTW driver.
|
||||
|
||||
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -23,7 +23,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
Query the largest block that may be updated in a fault tolerant manner.
|
||||
|
||||
|
||||
@param This The pointer to this protocol instance.
|
||||
@param This The pointer to this protocol instance.
|
||||
@param BlockSize A pointer to a caller allocated UINTN that is updated to
|
||||
indicate the size of the largest block that can be updated.
|
||||
|
||||
@@ -59,7 +59,7 @@ FtwGetMaxBlockSize (
|
||||
|
||||
All writes must be completed or aborted before another fault tolerant write can occur.
|
||||
|
||||
@param This The pointer to this protocol instance.
|
||||
@param This The pointer to this protocol instance.
|
||||
@param CallerId The GUID identifying the write.
|
||||
@param PrivateDataSize The size of the caller's private data
|
||||
that must be recorded for each write.
|
||||
@@ -174,7 +174,7 @@ FtwAllocate (
|
||||
Since the content has already backuped in spare block, the write is
|
||||
guaranteed to be completed with fault tolerant manner.
|
||||
|
||||
@param This The pointer to this protocol instance.
|
||||
@param This The pointer to this protocol instance.
|
||||
@param Fvb The FVB protocol that provides services for
|
||||
reading, writing, and erasing the target block.
|
||||
@param BlockSize The size of the block.
|
||||
@@ -289,7 +289,7 @@ FtwWriteRecord (
|
||||
manner, ensuring at all times that either the original contents or
|
||||
the modified contents are available.
|
||||
|
||||
@param This The pointer to this protocol instance.
|
||||
@param This The pointer to this protocol instance.
|
||||
@param Lba The logical block address of the target block.
|
||||
@param Offset The offset within the target block to place the data.
|
||||
@param Length The number of bytes to write to the target block.
|
||||
@@ -299,11 +299,11 @@ FtwWriteRecord (
|
||||
reading, writing, and erasing the target block.
|
||||
@param Buffer The data to write.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully
|
||||
@retval EFI_ABORTED The function could not complete successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The input data can't fit within the spare block.
|
||||
@retval EFI_SUCCESS The function completed successfully
|
||||
@retval EFI_ABORTED The function could not complete successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The input data can't fit within the spare block.
|
||||
Offset + *NumBytes > SpareAreaLength.
|
||||
@retval EFI_ACCESS_DENIED No writes have been allocated.
|
||||
@retval EFI_ACCESS_DENIED No writes have been allocated.
|
||||
@retval EFI_OUT_OF_RESOURCES Cannot allocate enough memory resource.
|
||||
@retval EFI_NOT_FOUND Cannot find FVB protocol by handle.
|
||||
|
||||
@@ -348,7 +348,7 @@ FtwWrite (
|
||||
|
||||
Header = FtwDevice->FtwLastWriteHeader;
|
||||
Record = FtwDevice->FtwLastWriteRecord;
|
||||
|
||||
|
||||
if (IsErasedFlashBuffer ((UINT8 *) Header, sizeof (EFI_FAULT_TOLERANT_WRITE_HEADER))) {
|
||||
if (PrivateData == NULL) {
|
||||
//
|
||||
@@ -631,7 +631,7 @@ FtwWrite (
|
||||
Restarts a previously interrupted write. The caller must provide the
|
||||
block protocol needed to complete the interrupted write.
|
||||
|
||||
@param This The pointer to this protocol instance.
|
||||
@param This The pointer to this protocol instance.
|
||||
@param FvBlockHandle The handle of FVB protocol that provides services for
|
||||
reading, writing, and erasing the target block.
|
||||
|
||||
@@ -727,7 +727,7 @@ FtwRestart (
|
||||
/**
|
||||
Aborts all previous allocated writes.
|
||||
|
||||
@param This The pointer to this protocol instance.
|
||||
@param This The pointer to this protocol instance.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully
|
||||
@retval EFI_ABORTED The function could not complete successfully.
|
||||
@@ -785,7 +785,7 @@ FtwAbort (
|
||||
manner, ensuring at all times that either the original contents or
|
||||
the modified contents are available.
|
||||
|
||||
@param This The pointer to this protocol instance.
|
||||
@param This The pointer to this protocol instance.
|
||||
@param CallerId The GUID identifying the last write.
|
||||
@param Lba The logical block address of the last write.
|
||||
@param Offset The offset within the block of the last write.
|
||||
|
@@ -3,14 +3,14 @@
|
||||
The internal header file includes the common header files, defines
|
||||
internal structure and functions used by Ftw module.
|
||||
|
||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -82,7 +82,7 @@ typedef struct {
|
||||
UINTN FtwWorkSpaceSize; // Size of working space range that stores write record.
|
||||
EFI_LBA FtwWorkSpaceLbaInSpare; // Start LBA of working space in spare block.
|
||||
UINTN FtwWorkSpaceBaseInSpare;// Offset into the FtwWorkSpaceLbaInSpare block.
|
||||
UINT8 *FtwWorkSpace; // Point to Work Space in memory buffer
|
||||
UINT8 *FtwWorkSpace; // Point to Work Space in memory buffer
|
||||
//
|
||||
// Following a buffer of FtwWorkSpace[FTW_WORK_SPACE_SIZE],
|
||||
// Allocated with EFI_FTW_DEVICE.
|
||||
@@ -183,11 +183,11 @@ FtwAllocate (
|
||||
reading, writing, and erasing the target block.
|
||||
@param Buffer The data to write.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully
|
||||
@retval EFI_ABORTED The function could not complete successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The input data can't fit within the spare block.
|
||||
@retval EFI_SUCCESS The function completed successfully
|
||||
@retval EFI_ABORTED The function could not complete successfully.
|
||||
@retval EFI_BAD_BUFFER_SIZE The input data can't fit within the spare block.
|
||||
Offset + *NumBytes > SpareAreaLength.
|
||||
@retval EFI_ACCESS_DENIED No writes have been allocated.
|
||||
@retval EFI_ACCESS_DENIED No writes have been allocated.
|
||||
@retval EFI_OUT_OF_RESOURCES Cannot allocate enough memory resource.
|
||||
@retval EFI_NOT_FOUND Cannot find FVB protocol by handle.
|
||||
|
||||
@@ -290,7 +290,7 @@ FtwGetLastWrite (
|
||||
partially erased.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the LBAs listed
|
||||
in the variable argument list do
|
||||
not exist in the firmware volume.
|
||||
not exist in the firmware volume.
|
||||
|
||||
|
||||
**/
|
||||
@@ -654,10 +654,10 @@ EFI_STATUS
|
||||
FtwGetSarProtocol (
|
||||
OUT VOID **SarProtocol
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Function returns an array of handles that support the FVB protocol
|
||||
in a buffer allocated from pool.
|
||||
in a buffer allocated from pool.
|
||||
|
||||
@param[out] NumberHandles The number of handles returned in Buffer.
|
||||
@param[out] Buffer A pointer to the buffer to return the requested
|
||||
@@ -689,7 +689,7 @@ GetFvbCountAndBuffer (
|
||||
**/
|
||||
EFI_STATUS
|
||||
InitFtwDevice (
|
||||
OUT EFI_FTW_DEVICE **FtwData
|
||||
OUT EFI_FTW_DEVICE **FtwData
|
||||
);
|
||||
|
||||
|
||||
@@ -700,7 +700,7 @@ InitFtwDevice (
|
||||
|
||||
@retval EFI_SUCCESS Initialize the FTW protocol successfully.
|
||||
@retval EFI_NOT_FOUND No proper FVB protocol was found.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
InitFtwProtocol (
|
||||
|
@@ -2,18 +2,18 @@
|
||||
|
||||
This is a simple fault tolerant write driver.
|
||||
|
||||
This boot service protocol only provides fault tolerant write capability for
|
||||
block devices. The protocol has internal non-volatile intermediate storage
|
||||
of the data and private information. It should be able to recover
|
||||
automatically from a critical fault, such as power failure.
|
||||
This boot service protocol only provides fault tolerant write capability for
|
||||
block devices. The protocol has internal non-volatile intermediate storage
|
||||
of the data and private information. It should be able to recover
|
||||
automatically from a critical fault, such as power failure.
|
||||
|
||||
The implementation uses an FTW (Fault Tolerant Write) Work Space.
|
||||
The implementation uses an FTW (Fault Tolerant Write) Work Space.
|
||||
This work space is a memory copy of the work space on the Working Block,
|
||||
the size of the work space is the FTW_WORK_SPACE_SIZE bytes.
|
||||
|
||||
|
||||
The work space stores each write record as EFI_FTW_RECORD structure.
|
||||
The spare block stores the write buffer before write to the target block.
|
||||
|
||||
|
||||
The write record has three states to specify the different phase of write operation.
|
||||
1) WRITE_ALLOCATED is that the record is allocated in write space.
|
||||
The information of write operation is stored in write record structure.
|
||||
@@ -27,27 +27,27 @@
|
||||
Final copy the data from the spare block to the target block.
|
||||
|
||||
To make this drive work well, the following conditions must be satisfied:
|
||||
1. The write NumBytes data must be fit within Spare area.
|
||||
1. The write NumBytes data must be fit within Spare area.
|
||||
Offset + NumBytes <= SpareAreaLength
|
||||
2. The whole flash range has the same block size.
|
||||
3. Working block is an area which contains working space in its last block and has the same size as spare block.
|
||||
4. Working Block area must be in the single one Firmware Volume Block range which FVB protocol is produced on.
|
||||
4. Working Block area must be in the single one Firmware Volume Block range which FVB protocol is produced on.
|
||||
5. Spare area must be in the single one Firmware Volume Block range which FVB protocol is produced on.
|
||||
6. Any write data area (SpareAreaLength Area) which the data will be written into must be
|
||||
6. Any write data area (SpareAreaLength Area) which the data will be written into must be
|
||||
in the single one Firmware Volume Block range which FVB protocol is produced on.
|
||||
7. If write data area (such as Variable range) is enlarged, the spare area range must be enlarged.
|
||||
The spare area must be enough large to store the write data before write them into the target range.
|
||||
If one of them is not satisfied, FtwWrite may fail.
|
||||
Usually, Spare area only takes one block. That's SpareAreaLength = BlockSize, NumberOfSpareBlock = 1.
|
||||
|
||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -65,7 +65,7 @@ EFI_EVENT mFvbRegistration = NULL;
|
||||
@retval EFI_SUCCESS The interface information for the specified protocol was returned.
|
||||
@retval EFI_UNSUPPORTED The device does not support the FVB protocol.
|
||||
@retval EFI_INVALID_PARAMETER FvBlockHandle is not a valid EFI_HANDLE or FvBlock is NULL.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
FtwGetFvbByHandle (
|
||||
@@ -104,8 +104,8 @@ FtwGetSarProtocol (
|
||||
// Locate Swap Address Range protocol
|
||||
//
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiSwapAddressRangeProtocolGuid,
|
||||
NULL,
|
||||
&gEfiSwapAddressRangeProtocolGuid,
|
||||
NULL,
|
||||
SarProtocol
|
||||
);
|
||||
return Status;
|
||||
@@ -113,7 +113,7 @@ FtwGetSarProtocol (
|
||||
|
||||
/**
|
||||
Function returns an array of handles that support the FVB protocol
|
||||
in a buffer allocated from pool.
|
||||
in a buffer allocated from pool.
|
||||
|
||||
@param[out] NumberHandles The number of handles returned in Buffer.
|
||||
@param[out] Buffer A pointer to the buffer to return the requested
|
||||
@@ -124,7 +124,7 @@ FtwGetSarProtocol (
|
||||
@retval EFI_NOT_FOUND No FVB handle was found.
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results.
|
||||
@retval EFI_INVALID_PARAMETER NumberHandles is NULL or Buffer is NULL.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetFvbCountAndBuffer (
|
||||
@@ -169,10 +169,10 @@ FvbNotificationEvent (
|
||||
//
|
||||
// Just return to avoid installing FaultTolerantWriteProtocol again
|
||||
// if Fault Tolerant Write protocol has been installed.
|
||||
//
|
||||
//
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiFaultTolerantWriteProtocolGuid,
|
||||
NULL,
|
||||
&gEfiFaultTolerantWriteProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &FtwProtocol
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
@@ -186,8 +186,8 @@ FvbNotificationEvent (
|
||||
Status = InitFtwProtocol (FtwDevice);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Install protocol interface
|
||||
//
|
||||
@@ -198,10 +198,10 @@ FvbNotificationEvent (
|
||||
&FtwDevice->FtwInstance
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
Status = gBS->CloseEvent (Event);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ FvbNotificationEvent (
|
||||
@retval EFI_SUCCESS The initialization finished successfully.
|
||||
@retval EFI_OUT_OF_RESOURCES Allocate memory error
|
||||
@retval EFI_INVALID_PARAMETER Workspace or Spare block does not exist
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -239,7 +239,7 @@ FaultTolerantWriteInitialize (
|
||||
|
||||
//
|
||||
// Register FvbNotificationEvent () notify function.
|
||||
//
|
||||
//
|
||||
EfiCreateProtocolNotifyEvent (
|
||||
&gEfiFirmwareVolumeBlockProtocolGuid,
|
||||
TPL_CALLBACK,
|
||||
@@ -247,6 +247,6 @@ FaultTolerantWriteInitialize (
|
||||
(VOID *)FtwDevice,
|
||||
&mFvbRegistration
|
||||
);
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
## @file
|
||||
# Fault Tolerant Write Dxe Driver.
|
||||
#
|
||||
# This driver installs Fault Tolerant Write (FTW) protocol,
|
||||
# This driver installs Fault Tolerant Write (FTW) protocol,
|
||||
# which provides fault tolerant write capability for block devices.
|
||||
# Its implementation depends on the full functionality FVB protocol that support read, write/erase flash access.
|
||||
#
|
||||
# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// /** @file
|
||||
// FaultTolerantWriteDxe Localized Strings and Content
|
||||
//
|
||||
// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -12,8 +12,8 @@
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
"Fault Tolerant Flash Write DXE Driver"
|
||||
|
||||
|
||||
|
@@ -2,18 +2,18 @@
|
||||
|
||||
This is a simple fault tolerant write driver that is intended to use in the SMM environment.
|
||||
|
||||
This boot service protocol only provides fault tolerant write capability for
|
||||
block devices. The protocol has internal non-volatile intermediate storage
|
||||
of the data and private information. It should be able to recover
|
||||
automatically from a critical fault, such as power failure.
|
||||
This boot service protocol only provides fault tolerant write capability for
|
||||
block devices. The protocol has internal non-volatile intermediate storage
|
||||
of the data and private information. It should be able to recover
|
||||
automatically from a critical fault, such as power failure.
|
||||
|
||||
The implementation uses an FTW (Fault Tolerant Write) Work Space.
|
||||
The implementation uses an FTW (Fault Tolerant Write) Work Space.
|
||||
This work space is a memory copy of the work space on the Working Block,
|
||||
the size of the work space is the FTW_WORK_SPACE_SIZE bytes.
|
||||
|
||||
|
||||
The work space stores each write record as EFI_FTW_RECORD structure.
|
||||
The spare block stores the write buffer before write to the target block.
|
||||
|
||||
|
||||
The write record has three states to specify the different phase of write operation.
|
||||
1) WRITE_ALLOCATED is that the record is allocated in write space.
|
||||
The information of write operation is stored in write record structure.
|
||||
@@ -27,13 +27,13 @@
|
||||
Final copy the data from the spare block to the target block.
|
||||
|
||||
To make this drive work well, the following conditions must be satisfied:
|
||||
1. The write NumBytes data must be fit within Spare area.
|
||||
1. The write NumBytes data must be fit within Spare area.
|
||||
Offset + NumBytes <= SpareAreaLength
|
||||
2. The whole flash range has the same block size.
|
||||
3. Working block is an area which contains working space in its last block and has the same size as spare block.
|
||||
4. Working Block area must be in the single one Firmware Volume Block range which FVB protocol is produced on.
|
||||
4. Working Block area must be in the single one Firmware Volume Block range which FVB protocol is produced on.
|
||||
5. Spare area must be in the single one Firmware Volume Block range which FVB protocol is produced on.
|
||||
6. Any write data area (SpareAreaLength Area) which the data will be written into must be
|
||||
6. Any write data area (SpareAreaLength Area) which the data will be written into must be
|
||||
in the single one Firmware Volume Block range which FVB protocol is produced on.
|
||||
7. If write data area (such as Variable range) is enlarged, the spare area range must be enlarged.
|
||||
The spare area must be enough large to store the write data before write them into the target range.
|
||||
@@ -41,16 +41,16 @@
|
||||
Usually, Spare area only takes one block. That's SpareAreaLength = BlockSize, NumberOfSpareBlock = 1.
|
||||
|
||||
Caution: This module requires additional review when modified.
|
||||
This driver need to make sure the CommBuffer is not in the SMRAM range.
|
||||
This driver need to make sure the CommBuffer is not in the SMRAM range.
|
||||
|
||||
Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -119,8 +119,8 @@ FtwGetSarProtocol (
|
||||
// Locate Smm Swap Address Range protocol
|
||||
//
|
||||
Status = gSmst->SmmLocateProtocol (
|
||||
&gEfiSmmSwapAddressRangeProtocolGuid,
|
||||
NULL,
|
||||
&gEfiSmmSwapAddressRangeProtocolGuid,
|
||||
NULL,
|
||||
SarProtocol
|
||||
);
|
||||
return Status;
|
||||
@@ -128,7 +128,7 @@ FtwGetSarProtocol (
|
||||
|
||||
/**
|
||||
Function returns an array of handles that support the SMM FVB protocol
|
||||
in a buffer allocated from pool.
|
||||
in a buffer allocated from pool.
|
||||
|
||||
@param[out] NumberHandles The number of handles returned in Buffer.
|
||||
@param[out] Buffer A pointer to the buffer to return the requested
|
||||
@@ -227,7 +227,7 @@ GetFvbByAddressAndAttribute (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Find the proper SMM Fvb handle by the address and attributes.
|
||||
//
|
||||
@@ -276,8 +276,8 @@ GetFvbByAddressAndAttribute (
|
||||
This SMI handler provides services for the fault tolerant write wrapper driver.
|
||||
|
||||
Caution: This function requires additional review when modified.
|
||||
This driver need to make sure the CommBuffer is not in the SMRAM range.
|
||||
Also in FTW_FUNCTION_GET_LAST_WRITE case, check SmmFtwGetLastWriteHeader->Data +
|
||||
This driver need to make sure the CommBuffer is not in the SMRAM range.
|
||||
Also in FTW_FUNCTION_GET_LAST_WRITE case, check SmmFtwGetLastWriteHeader->Data +
|
||||
SmmFtwGetLastWriteHeader->PrivateDataSize within communication buffer.
|
||||
|
||||
@param[in] DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
|
||||
@@ -287,14 +287,14 @@ GetFvbByAddressAndAttribute (
|
||||
from a non-SMM environment into an SMM environment.
|
||||
@param[in, out] CommBufferSize The size of the CommBuffer.
|
||||
|
||||
@retval EFI_SUCCESS The interrupt was handled and quiesced. No other handlers
|
||||
@retval EFI_SUCCESS The interrupt was handled and quiesced. No other handlers
|
||||
should still be called.
|
||||
@retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quiesced but other handlers should
|
||||
@retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quiesced but other handlers should
|
||||
still be called.
|
||||
@retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pending and other handlers should still
|
||||
@retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pending and other handlers should still
|
||||
be called.
|
||||
@retval EFI_INTERRUPT_PENDING The interrupt could not be quiesced.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -364,7 +364,7 @@ SmmFaultTolerantWriteHandler (
|
||||
&SmmGetMaxBlockSizeHeader->BlockSize
|
||||
);
|
||||
break;
|
||||
|
||||
|
||||
case FTW_FUNCTION_ALLOCATE:
|
||||
if (CommBufferPayloadSize < sizeof (SMM_FTW_ALLOCATE_HEADER)) {
|
||||
DEBUG ((EFI_D_ERROR, "Allocate: SMM communication buffer size invalid!\n"));
|
||||
@@ -378,7 +378,7 @@ SmmFaultTolerantWriteHandler (
|
||||
SmmFtwAllocateHeader->NumberOfWrites
|
||||
);
|
||||
break;
|
||||
|
||||
|
||||
case FTW_FUNCTION_WRITE:
|
||||
if (CommBufferPayloadSize < OFFSET_OF (SMM_FTW_WRITE_HEADER, Data)) {
|
||||
DEBUG ((EFI_D_ERROR, "Write: SMM communication buffer size invalid!\n"));
|
||||
@@ -412,7 +412,7 @@ SmmFaultTolerantWriteHandler (
|
||||
PrivateData = (VOID *)&SmmFtwWriteHeader->Data[Length];
|
||||
}
|
||||
Status = GetFvbByAddressAndAttribute (
|
||||
SmmFtwWriteHeader->FvbBaseAddress,
|
||||
SmmFtwWriteHeader->FvbBaseAddress,
|
||||
SmmFtwWriteHeader->FvbAttributes,
|
||||
&SmmFvbHandle
|
||||
);
|
||||
@@ -428,7 +428,7 @@ SmmFaultTolerantWriteHandler (
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case FTW_FUNCTION_RESTART:
|
||||
if (CommBufferPayloadSize < sizeof (SMM_FTW_RESTART_HEADER)) {
|
||||
DEBUG ((EFI_D_ERROR, "Restart: SMM communication buffer size invalid!\n"));
|
||||
@@ -436,10 +436,10 @@ SmmFaultTolerantWriteHandler (
|
||||
}
|
||||
SmmFtwRestartHeader = (SMM_FTW_RESTART_HEADER *) SmmFtwFunctionHeader->Data;
|
||||
Status = GetFvbByAddressAndAttribute (
|
||||
SmmFtwRestartHeader->FvbBaseAddress,
|
||||
SmmFtwRestartHeader->FvbBaseAddress,
|
||||
SmmFtwRestartHeader->FvbAttributes,
|
||||
&SmmFvbHandle
|
||||
);
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = FtwRestart (&mFtwDevice->FtwInstance, SmmFvbHandle);
|
||||
}
|
||||
@@ -448,7 +448,7 @@ SmmFaultTolerantWriteHandler (
|
||||
case FTW_FUNCTION_ABORT:
|
||||
Status = FtwAbort (&mFtwDevice->FtwInstance);
|
||||
break;
|
||||
|
||||
|
||||
case FTW_FUNCTION_GET_LAST_WRITE:
|
||||
if (CommBufferPayloadSize < OFFSET_OF (SMM_FTW_GET_LAST_WRITE_HEADER, Data)) {
|
||||
DEBUG ((EFI_D_ERROR, "GetLastWrite: SMM communication buffer size invalid!\n"));
|
||||
@@ -499,13 +499,13 @@ SmmFaultTolerantWriteHandler (
|
||||
|
||||
/**
|
||||
SMM Firmware Volume Block Protocol notification event handler.
|
||||
|
||||
|
||||
@param[in] Protocol Points to the protocol's unique identifier
|
||||
@param[in] Interface Points to the interface instance
|
||||
@param[in] Handle The handle on which the interface was installed
|
||||
|
||||
@retval EFI_SUCCESS SmmEventCallback runs successfully
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -519,14 +519,14 @@ FvbNotificationEvent (
|
||||
EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL *FtwProtocol;
|
||||
EFI_HANDLE SmmFtwHandle;
|
||||
EFI_HANDLE FtwHandle;
|
||||
|
||||
|
||||
//
|
||||
// Just return to avoid install SMM FaultTolerantWriteProtocol again
|
||||
// if SMM Fault Tolerant Write protocol had been installed.
|
||||
//
|
||||
//
|
||||
Status = gSmst->SmmLocateProtocol (
|
||||
&gEfiSmmFaultTolerantWriteProtocolGuid,
|
||||
NULL,
|
||||
&gEfiSmmFaultTolerantWriteProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &FtwProtocol
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
@@ -550,7 +550,7 @@ FvbNotificationEvent (
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&mFtwDevice->FtwInstance
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
///
|
||||
/// Register SMM FTW SMI handler
|
||||
@@ -569,13 +569,13 @@ FvbNotificationEvent (
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
SMM END_OF_DXE protocol notification event handler.
|
||||
|
||||
|
||||
@param Protocol Points to the protocol's unique identifier
|
||||
@param Interface Points to the interface instance
|
||||
@param Handle The handle on which the interface was installed
|
||||
@@ -636,7 +636,7 @@ SmmFaultTolerantWriteInitialize (
|
||||
|
||||
//
|
||||
// Register FvbNotificationEvent () notify function.
|
||||
//
|
||||
//
|
||||
Status = gSmst->SmmRegisterProtocolNotify (
|
||||
&gEfiSmmFirmwareVolumeBlockProtocolGuid,
|
||||
FvbNotificationEvent,
|
||||
@@ -645,6 +645,6 @@ SmmFaultTolerantWriteInitialize (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
FvbNotificationEvent (NULL, NULL, NULL);
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
## @file
|
||||
# Fault Tolerant Write Smm Driver.
|
||||
#
|
||||
# This driver installs SMM Fault Tolerant Write (FTW) protocol, which provides fault
|
||||
# tolerant write capability in SMM environment for block devices. Its implementation
|
||||
# depends on the full functionality SMM FVB protocol that support read, write/erase
|
||||
# This driver installs SMM Fault Tolerant Write (FTW) protocol, which provides fault
|
||||
# tolerant write capability in SMM environment for block devices. Its implementation
|
||||
# depends on the full functionality SMM FVB protocol that support read, write/erase
|
||||
# flash access.
|
||||
#
|
||||
# Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@@ -1,15 +1,15 @@
|
||||
/** @file
|
||||
|
||||
The common header file for SMM FTW module and SMM FTW DXE Module.
|
||||
The common header file for SMM FTW module and SMM FTW DXE Module.
|
||||
|
||||
Copyright (c) 2011, Intel Corporation. All rights reserved. <BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved. <BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -1,16 +1,16 @@
|
||||
/** @file
|
||||
|
||||
Implement the Fault Tolerant Write (FTW) protocol based on SMM FTW
|
||||
Implement the Fault Tolerant Write (FTW) protocol based on SMM FTW
|
||||
module.
|
||||
|
||||
Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved. <BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved. <BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -46,28 +46,28 @@ InitCommunicateBuffer (
|
||||
IN UINTN Function
|
||||
)
|
||||
{
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
SMM_FTW_COMMUNICATE_FUNCTION_HEADER *SmmFtwFunctionHeader;
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
SMM_FTW_COMMUNICATE_FUNCTION_HEADER *SmmFtwFunctionHeader;
|
||||
|
||||
//
|
||||
// The whole buffer size: SMM_COMMUNICATE_HEADER_SIZE + SMM_FTW_COMMUNICATE_HEADER_SIZE + DataSize.
|
||||
//
|
||||
SmmCommunicateHeader = AllocateZeroPool (DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_FTW_COMMUNICATE_HEADER_SIZE);
|
||||
ASSERT (SmmCommunicateHeader != NULL);
|
||||
|
||||
|
||||
//
|
||||
// Prepare data buffer.
|
||||
//
|
||||
CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmFaultTolerantWriteProtocolGuid);
|
||||
SmmCommunicateHeader->MessageLength = DataSize + SMM_FTW_COMMUNICATE_HEADER_SIZE;
|
||||
|
||||
|
||||
SmmFtwFunctionHeader = (SMM_FTW_COMMUNICATE_FUNCTION_HEADER *) SmmCommunicateHeader->Data;
|
||||
SmmFtwFunctionHeader->Function = Function;
|
||||
|
||||
*CommunicateBuffer = SmmCommunicateHeader;
|
||||
if (DataPtr != NULL) {
|
||||
*DataPtr = SmmFtwFunctionHeader->Data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ InitCommunicateBuffer (
|
||||
|
||||
@param[in, out] SmmCommunicateHeader The communicate buffer.
|
||||
@param[in] DataSize The payload size.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SendCommunicateBuffer (
|
||||
@@ -86,8 +86,8 @@ SendCommunicateBuffer (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN CommSize;
|
||||
SMM_FTW_COMMUNICATE_FUNCTION_HEADER *SmmFtwFunctionHeader;
|
||||
|
||||
SMM_FTW_COMMUNICATE_FUNCTION_HEADER *SmmFtwFunctionHeader;
|
||||
|
||||
CommSize = DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_FTW_COMMUNICATE_HEADER_SIZE;
|
||||
Status = mSmmCommunication->Communicate (mSmmCommunication, SmmCommunicateHeader, &CommSize);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -103,7 +103,7 @@ SendCommunicateBuffer (
|
||||
@param[in] FvbHandle The handle of FVB protocol that provides services.
|
||||
@param[out] FvbBaseAddress The base address of the FVB attached with FvbHandle.
|
||||
@param[out] FvbAttributes The attributes of the FVB attached with FvbHandle.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval Others The function could not complete successfully.
|
||||
|
||||
@@ -122,14 +122,14 @@ ConvertFvbHandle (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
Status = Fvb->GetPhysicalAddress (Fvb, FvbBaseAddress);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = Fvb->GetAttributes (Fvb, FvbAttributes);
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ FtwGetMaxBlockSize (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN PayloadSize;
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
SMM_FTW_GET_MAX_BLOCK_SIZE_HEADER *SmmFtwBlockSizeHeader;
|
||||
|
||||
//
|
||||
@@ -162,7 +162,7 @@ FtwGetMaxBlockSize (
|
||||
//
|
||||
PayloadSize = sizeof (SMM_FTW_GET_MAX_BLOCK_SIZE_HEADER);
|
||||
InitCommunicateBuffer ((VOID **)&SmmCommunicateHeader, (VOID **)&SmmFtwBlockSizeHeader, PayloadSize, FTW_FUNCTION_GET_MAX_BLOCK_SIZE);
|
||||
|
||||
|
||||
//
|
||||
// Send data to SMM.
|
||||
//
|
||||
@@ -171,9 +171,9 @@ FtwGetMaxBlockSize (
|
||||
//
|
||||
// Get data from SMM
|
||||
//
|
||||
*BlockSize = SmmFtwBlockSizeHeader->BlockSize;
|
||||
*BlockSize = SmmFtwBlockSizeHeader->BlockSize;
|
||||
FreePool (SmmCommunicateHeader);
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ FtwAllocate (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN PayloadSize;
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
SMM_FTW_ALLOCATE_HEADER *SmmFtwAllocateHeader;
|
||||
|
||||
//
|
||||
@@ -220,8 +220,8 @@ FtwAllocate (
|
||||
InitCommunicateBuffer ((VOID **)&SmmCommunicateHeader, (VOID **)&SmmFtwAllocateHeader, PayloadSize, FTW_FUNCTION_ALLOCATE);
|
||||
CopyGuid (&SmmFtwAllocateHeader->CallerId, CallerId);
|
||||
SmmFtwAllocateHeader->PrivateDataSize = PrivateDataSize;
|
||||
SmmFtwAllocateHeader->NumberOfWrites = NumberOfWrites;
|
||||
|
||||
SmmFtwAllocateHeader->NumberOfWrites = NumberOfWrites;
|
||||
|
||||
//
|
||||
// Send data to SMM.
|
||||
//
|
||||
@@ -276,7 +276,7 @@ FtwWrite (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN PayloadSize;
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
SMM_FTW_WRITE_HEADER *SmmFtwWriteHeader;
|
||||
|
||||
//
|
||||
@@ -292,7 +292,7 @@ FtwWrite (
|
||||
InitCommunicateBuffer ((VOID **)&SmmCommunicateHeader, (VOID **)&SmmFtwWriteHeader, PayloadSize, FTW_FUNCTION_WRITE);
|
||||
|
||||
//
|
||||
// FvBlockHandle can not be used in SMM environment. Here we get the FVB protocol first, then get FVB base address
|
||||
// FvBlockHandle can not be used in SMM environment. Here we get the FVB protocol first, then get FVB base address
|
||||
// and its attribute. Send these information to SMM handler, the SMM handler will find the proper FVB to write data.
|
||||
//
|
||||
Status = ConvertFvbHandle (FvBlockHandle, &SmmFtwWriteHeader->FvbBaseAddress, &SmmFtwWriteHeader->FvbAttributes);
|
||||
@@ -300,9 +300,9 @@ FtwWrite (
|
||||
FreePool (SmmCommunicateHeader);
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
|
||||
SmmFtwWriteHeader->Lba = Lba;
|
||||
SmmFtwWriteHeader->Offset = Offset;
|
||||
SmmFtwWriteHeader->Offset = Offset;
|
||||
SmmFtwWriteHeader->Length = Length;
|
||||
CopyMem (SmmFtwWriteHeader->Data, Buffer, Length);
|
||||
if (PrivateData == NULL) {
|
||||
@@ -316,7 +316,7 @@ FtwWrite (
|
||||
// Send data to SMM.
|
||||
//
|
||||
Status = SendCommunicateBuffer (SmmCommunicateHeader, PayloadSize);
|
||||
FreePool (SmmCommunicateHeader);
|
||||
FreePool (SmmCommunicateHeader);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -342,22 +342,22 @@ FtwRestart (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN PayloadSize;
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
SMM_FTW_RESTART_HEADER *SmmFtwRestartHeader;
|
||||
|
||||
|
||||
//
|
||||
// Initialize the communicate buffer.
|
||||
//
|
||||
PayloadSize = sizeof (SMM_FTW_RESTART_HEADER);
|
||||
InitCommunicateBuffer ((VOID **)&SmmCommunicateHeader, (VOID **)&SmmFtwRestartHeader, PayloadSize, FTW_FUNCTION_RESTART);
|
||||
InitCommunicateBuffer ((VOID **)&SmmCommunicateHeader, (VOID **)&SmmFtwRestartHeader, PayloadSize, FTW_FUNCTION_RESTART);
|
||||
|
||||
//
|
||||
// FvBlockHandle can not be used in SMM environment. Here we get the FVB protocol first, then get FVB base address
|
||||
// FvBlockHandle can not be used in SMM environment. Here we get the FVB protocol first, then get FVB base address
|
||||
// and its attribute. Send these information to SMM handler, the SMM handler will find the proper FVB to write data.
|
||||
//
|
||||
Status = ConvertFvbHandle (FvBlockHandle, &SmmFtwRestartHeader->FvbBaseAddress, &SmmFtwRestartHeader->FvbAttributes);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreePool (SmmCommunicateHeader);
|
||||
FreePool (SmmCommunicateHeader);
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ FtwRestart (
|
||||
// Send data to SMM.
|
||||
//
|
||||
Status = SendCommunicateBuffer (SmmCommunicateHeader, PayloadSize);
|
||||
FreePool (SmmCommunicateHeader);
|
||||
FreePool (SmmCommunicateHeader);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -387,19 +387,19 @@ FtwAbort (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
|
||||
//
|
||||
// Initialize the communicate buffer.
|
||||
//
|
||||
InitCommunicateBuffer ((VOID **)&SmmCommunicateHeader, NULL, 0, FTW_FUNCTION_ABORT);
|
||||
|
||||
|
||||
//
|
||||
// Send data to SMM.
|
||||
//
|
||||
Status = SendCommunicateBuffer (SmmCommunicateHeader, 0);
|
||||
|
||||
FreePool (SmmCommunicateHeader);
|
||||
FreePool (SmmCommunicateHeader);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ FtwGetLastWrite (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN PayloadSize;
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
|
||||
SMM_FTW_GET_LAST_WRITE_HEADER *SmmFtwGetLastWriteHeader;
|
||||
|
||||
//
|
||||
@@ -465,7 +465,7 @@ FtwGetLastWrite (
|
||||
*PrivateDataSize = SmmFtwGetLastWriteHeader->PrivateDataSize;
|
||||
if (Status == EFI_SUCCESS || Status == EFI_BUFFER_TOO_SMALL) {
|
||||
*Lba = SmmFtwGetLastWriteHeader->Lba;
|
||||
*Offset = SmmFtwGetLastWriteHeader->Offset;
|
||||
*Offset = SmmFtwGetLastWriteHeader->Offset;
|
||||
*Length = SmmFtwGetLastWriteHeader->Length;
|
||||
*Complete = SmmFtwGetLastWriteHeader->Complete;
|
||||
CopyGuid (CallerId, &SmmFtwGetLastWriteHeader->CallerId);
|
||||
@@ -476,7 +476,7 @@ FtwGetLastWrite (
|
||||
*Complete = SmmFtwGetLastWriteHeader->Complete;
|
||||
}
|
||||
|
||||
FreePool (SmmCommunicateHeader);
|
||||
FreePool (SmmCommunicateHeader);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -501,12 +501,12 @@ SmmFtwReady (
|
||||
//
|
||||
// Just return to avoid install SMM FaultTolerantWriteProtocol again
|
||||
// if Fault Tolerant Write protocol had been installed.
|
||||
//
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiFaultTolerantWriteProtocolGuid, NULL, (VOID **)&FtwProtocol);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@@ -520,9 +520,9 @@ SmmFtwReady (
|
||||
&mFaultTolerantWriteDriver
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
Status = gBS->CloseEvent (Event);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
|
||||
@@ -551,12 +551,12 @@ FaultTolerantWriteSmmInitialize (
|
||||
//
|
||||
EfiCreateProtocolNotifyEvent (
|
||||
&gEfiSmmFaultTolerantWriteProtocolGuid,
|
||||
TPL_CALLBACK,
|
||||
SmmFtwReady,
|
||||
NULL,
|
||||
TPL_CALLBACK,
|
||||
SmmFtwReady,
|
||||
NULL,
|
||||
&SmmFtwRegistration
|
||||
);
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -3,14 +3,14 @@
|
||||
The internal header file includes the common header files, defines
|
||||
internal structure and functions used by FTW module.
|
||||
|
||||
Copyright (c) 2011, Intel Corporation. All rights reserved. <BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved. <BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
# the related operations in SMM handler in SMM FTW module. You can use the FTW protocol
|
||||
# before End Of Dxe or use FaultTolerantWriteDxe module instead if you really want to.
|
||||
#
|
||||
# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -36,13 +36,13 @@
|
||||
FaultTolerantWriteSmmDxe.c
|
||||
FaultTolerantWriteSmmDxe.h
|
||||
FaultTolerantWriteSmmCommon.h
|
||||
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
BaseLib
|
||||
UefiBootServicesTableLib
|
||||
DebugLib
|
||||
DxeServicesTableLib
|
||||
@@ -56,7 +56,7 @@
|
||||
## CONSUMES
|
||||
gEfiSmmFaultTolerantWriteProtocolGuid
|
||||
gEfiFirmwareVolumeBlockProtocolGuid ## CONSUMES
|
||||
|
||||
|
||||
[Depex]
|
||||
gEfiSmmCommunicationProtocolGuid
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// /** @file
|
||||
// FaultTolerantWriteSmmDxe Localized Strings and Content
|
||||
//
|
||||
// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -12,8 +12,8 @@
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
"Fault Tolerant Flash Write SMM/DXE Bridge Driver"
|
||||
|
||||
|
||||
|
@@ -2,14 +2,14 @@
|
||||
|
||||
Internal generic functions to operate flash block.
|
||||
|
||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -89,7 +89,7 @@ FtwEraseBlock (
|
||||
partially erased.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the LBAs listed
|
||||
in the variable argument list do
|
||||
not exist in the firmware volume.
|
||||
not exist in the firmware volume.
|
||||
|
||||
|
||||
**/
|
||||
@@ -970,11 +970,11 @@ GetPreviousRecordOfWrites (
|
||||
**/
|
||||
EFI_STATUS
|
||||
InitFtwDevice (
|
||||
OUT EFI_FTW_DEVICE **FtwData
|
||||
OUT EFI_FTW_DEVICE **FtwData
|
||||
)
|
||||
{
|
||||
EFI_FTW_DEVICE *FtwDevice;
|
||||
|
||||
|
||||
//
|
||||
// Allocate private data of this driver,
|
||||
// Including the FtwWorkSpace[FTW_WORK_SPACE_SIZE].
|
||||
@@ -1005,11 +1005,11 @@ InitFtwDevice (
|
||||
if (FtwDevice->WorkSpaceAddress == 0) {
|
||||
FtwDevice->WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwWorkingBase);
|
||||
}
|
||||
|
||||
|
||||
FtwDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS) PcdGet64 (PcdFlashNvStorageFtwSpareBase64);
|
||||
if (FtwDevice->SpareAreaAddress == 0) {
|
||||
FtwDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwSpareBase);
|
||||
}
|
||||
}
|
||||
|
||||
*FtwData = FtwDevice;
|
||||
return EFI_SUCCESS;
|
||||
@@ -1024,7 +1024,7 @@ InitFtwDevice (
|
||||
@retval EFI_SUCCESS Find the FVB protocol successfully.
|
||||
@retval EFI_NOT_FOUND No proper FVB protocol was found.
|
||||
@retval EFI_ABORTED Some data can not be got or be invalid.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
FindFvbForFtw (
|
||||
@@ -1068,7 +1068,7 @@ FindFvbForFtw (
|
||||
//
|
||||
Status = Fvb->GetAttributes (Fvb, &Attributes);
|
||||
if (EFI_ERROR (Status) || ((Attributes & EFI_FVB2_WRITE_STATUS) == 0)) {
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// Compare the address and select the right one
|
||||
@@ -1188,7 +1188,7 @@ FindFvbForFtw (
|
||||
|
||||
@retval EFI_SUCCESS Initialize the FTW protocol successfully.
|
||||
@retval EFI_NOT_FOUND No proper FVB protocol was found.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
InitFtwProtocol (
|
||||
@@ -1208,7 +1208,7 @@ InitFtwProtocol (
|
||||
Status = FindFvbForFtw (FtwDevice);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate the start LBA of working block.
|
||||
@@ -1338,7 +1338,7 @@ InitFtwProtocol (
|
||||
if (FtwDevice->FtwWorkSpace[Offset] != FTW_ERASED_BYTE) {
|
||||
Offset += FTW_WRITE_TOTAL_SIZE (FtwHeader->NumberOfWrites, FtwHeader->PrivateDataSize);
|
||||
}
|
||||
|
||||
|
||||
if (!IsErasedFlashBuffer (FtwDevice->FtwWorkSpace + Offset, FtwDevice->FtwWorkSpaceSize - Offset)) {
|
||||
Status = FtwReclaimWorkSpace (FtwDevice, TRUE);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -1378,7 +1378,7 @@ InitFtwProtocol (
|
||||
FtwDevice->FtwInstance.Restart = FtwRestart;
|
||||
FtwDevice->FtwInstance.Abort = FtwAbort;
|
||||
FtwDevice->FtwInstance.GetLastWrite = FtwGetLastWrite;
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// /** @file
|
||||
// SmmFaultTolerantWriteDxe Localized Strings and Content
|
||||
//
|
||||
// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -12,8 +12,8 @@
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
"SMM Fault Tolerant Flash Write Driver"
|
||||
|
||||
|
||||
|
@@ -2,14 +2,14 @@
|
||||
|
||||
Internal functions to operate Working Block Space.
|
||||
|
||||
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
Reference in New Issue
Block a user