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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user