/*++\r
\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. 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 - 2007, Intel Corporation\r
+All rights reserved. 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
Module Name:\r
\r
FWBlockService.c\r
- \r
+\r
Abstract:\r
\r
Revision History\r
date items to there virtual address.\r
\r
mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] - Physical copy of instance data\r
- mFvbModuleGlobal->FvInstance[FVB_VIRTUAL] - Virtual pointer to common \r
+ mFvbModuleGlobal->FvInstance[FVB_VIRTUAL] - Virtual pointer to common\r
instance data.\r
\r
Arguments:\r
\r
(Standard EFI notify event - EFI_EVENT_NOTIFY)\r
\r
-Returns: \r
+Returns:\r
\r
None\r
\r
FwhInstance - The EFI_FW_VOL_INSTANCE fimrware instance structure\r
Virtual - Whether CPU is in virtual or physical mode\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - Successfully returns\r
EFI_INVALID_PARAMETER - Instance not found\r
\r
Arguments:\r
Instance - The FV instance whose base address is going to be\r
returned\r
- Address - Pointer to a caller allocated EFI_PHYSICAL_ADDRESS \r
+ Address - Pointer to a caller allocated EFI_PHYSICAL_ADDRESS\r
that on successful return, contains the base address\r
- of the firmware volume. \r
+ of the firmware volume.\r
Global - Pointer to ESAL_FWB_GLOBAL that contains all\r
instance data\r
Virtual - Whether CPU is in virtual or physical mode\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - Successfully returns\r
EFI_INVALID_PARAMETER - Instance not found\r
\r
resulting attributes in output parameter\r
\r
Arguments:\r
- Instance - The FV instance whose attributes is going to be \r
+ Instance - The FV instance whose attributes is going to be\r
returned\r
Attributes - Output buffer which contains attributes\r
Global - Pointer to ESAL_FWB_GLOBAL that contains all\r
instance data\r
Virtual - Whether CPU is in virtual or physical mode\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - Successfully returns\r
EFI_INVALID_PARAMETER - Instance not found\r
\r
Arguments:\r
Instance - The FV instance which the Lba belongs to\r
Lba - The logical block address\r
- LbaAddress - On output, contains the physical starting address \r
+ LbaAddress - On output, contains the physical starting address\r
of the Lba\r
LbaLength - On output, contains the length of the block\r
NumOfBlocks - A pointer to a caller allocated UINTN in which the\r
instance data\r
Virtual - Whether CPU is in virtual or physical mode\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - Successfully returns\r
EFI_INVALID_PARAMETER - Instance not found\r
\r
instance data\r
Virtual - Whether CPU is in virtual or physical mode\r
\r
-Returns: \r
- EFI_SUCCESS - The firmware volume was read successfully and \r
+Returns:\r
+ EFI_SUCCESS - The firmware volume was read successfully and\r
contents are in Buffer\r
EFI_BAD_BUFFER_SIZE - Read attempted across a LBA boundary. On output,\r
NumBytes contains the total number of bytes returned\r
in Buffer\r
EFI_ACCESS_DENIED - The firmware volume is in the ReadDisabled state\r
- EFI_DEVICE_ERROR - The block device is not functioning correctly and \r
+ EFI_DEVICE_ERROR - The block device is not functioning correctly and\r
could not be read\r
EFI_INVALID_PARAMETER - Instance not found, or NumBytes, Buffer are NULL\r
\r
instance data\r
Virtual - Whether CPU is in virtual or physical mode\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - The firmware volume was written successfully\r
EFI_BAD_BUFFER_SIZE - Write attempted across a LBA boundary. On output,\r
NumBytes contains the total number of bytes\r
actually written\r
EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state\r
- EFI_DEVICE_ERROR - The block device is not functioning correctly and \r
+ EFI_DEVICE_ERROR - The block device is not functioning correctly and\r
could not be written\r
EFI_INVALID_PARAMETER - Instance not found, or NumBytes, Buffer are NULL\r
\r
instance data\r
Virtual - Whether CPU is in virtual or physical mode\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - The erase request was successfully completed\r
EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state\r
- EFI_DEVICE_ERROR - The block device is not functioning correctly and \r
+ EFI_DEVICE_ERROR - The block device is not functioning correctly and\r
could not be written. Firmware device may have been\r
partially erased\r
EFI_INVALID_PARAMETER - Instance not found\r
Arguments:\r
Instance - The FV instance to be erased\r
StartLba - The starting logical block index to be erased\r
- OffsetStartLba - Offset into the starting block at which to \r
+ OffsetStartLba - Offset into the starting block at which to\r
begin erasing\r
LastLba - The last logical block index to be erased\r
OffsetStartLba - Offset into the last block at which to end erasing\r
instance data\r
Virtual - Whether CPU is in virtual or physical mode\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - The firmware volume was erased successfully\r
EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state\r
- EFI_DEVICE_ERROR - The block device is not functioning correctly and \r
+ EFI_DEVICE_ERROR - The block device is not functioning correctly and\r
could not be written. Firmware device may have been\r
partially erased\r
EFI_INVALID_PARAMETER - Instance not found\r
/*++\r
\r
Routine Description:\r
- Modifies the current settings of the firmware volume according to the \r
+ Modifies the current settings of the firmware volume according to the\r
input parameter, and returns the new setting of the volume\r
\r
Arguments:\r
- Instance - The FV instance whose attributes is going to be \r
+ Instance - The FV instance whose attributes is going to be\r
modified\r
- Attributes - On input, it is a pointer to EFI_FVB_ATTRIBUTES \r
+ Attributes - On input, it is a pointer to EFI_FVB_ATTRIBUTES\r
containing the desired firmware volume settings.\r
On successful return, it contains the new settings\r
of the firmware volume\r
instance data\r
Virtual - Whether CPU is in virtual or physical mode\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - Successfully returns\r
EFI_ACCESS_DENIED - The volume setting is locked and cannot be modified\r
EFI_INVALID_PARAMETER - Instance not found, or The attributes requested are\r
\r
Returns:\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - Successfully returns\r
\r
--*/\r
returned. All blocks in this range have a size of\r
BlockSize\r
\r
-Returns: \r
- EFI_SUCCESS - The firmware volume was read successfully and \r
+Returns:\r
+ EFI_SUCCESS - The firmware volume was read successfully and\r
contents are in Buffer\r
\r
--*/\r
This - Calling context\r
Attributes - output buffer which contains attributes\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - Successfully returns\r
\r
--*/\r
This - Calling context\r
Attributes - output buffer which contains attributes\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - Successfully returns\r
\r
--*/\r
EFIAPI\r
FvbProtocolEraseBlocks (\r
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
- ... \r
+ ...\r
)\r
/*++\r
\r
Routine Description:\r
\r
- The EraseBlock() function erases one or more blocks as denoted by the \r
+ The EraseBlock() function erases one or more blocks as denoted by the\r
variable argument list. The entire parameter list of blocks must be verified\r
- prior to erasing any blocks. If a block is requested that does not exist \r
- within the associated firmware volume (it has a larger index than the last \r
+ prior to erasing any blocks. If a block is requested that does not exist\r
+ within the associated firmware volume (it has a larger index than the last\r
block of the firmware volume), the EraseBlock() function must return\r
EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.\r
\r
Arguments:\r
This - Calling context\r
- ... - Starting LBA followed by Number of Lba to erase. \r
+ ... - Starting LBA followed by Number of Lba to erase.\r
a -1 to terminate the list.\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - The erase request was successfully completed\r
EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state\r
- EFI_DEVICE_ERROR - The block device is not functioning correctly and \r
+ EFI_DEVICE_ERROR - The block device is not functioning correctly and\r
could not be written. Firmware device may have been\r
partially erased\r
\r
output, indicates the actual number of bytes written\r
Buffer - Buffer containing source data for the write.\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - The firmware volume was written successfully\r
EFI_BAD_BUFFER_SIZE - Write attempted across a LBA boundary. On output,\r
NumBytes contains the total number of bytes\r
actually written\r
EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state\r
- EFI_DEVICE_ERROR - The block device is not functioning correctly and \r
+ EFI_DEVICE_ERROR - The block device is not functioning correctly and\r
could not be written\r
EFI_INVALID_PARAMETER - NumBytes or Buffer are NULL\r
\r
output, indicates the actual number of bytes Read\r
Buffer - Buffer containing source data for the Read.\r
\r
-Returns: \r
- EFI_SUCCESS - The firmware volume was read successfully and \r
+Returns:\r
+ EFI_SUCCESS - The firmware volume was read successfully and\r
contents are in Buffer\r
EFI_BAD_BUFFER_SIZE - Read attempted across a LBA boundary. On output,\r
NumBytes contains the total number of bytes returned\r
in Buffer\r
EFI_ACCESS_DENIED - The firmware volume is in the ReadDisabled state\r
- EFI_DEVICE_ERROR - The block device is not functioning correctly and \r
+ EFI_DEVICE_ERROR - The block device is not functioning correctly and\r
could not be read\r
EFI_INVALID_PARAMETER - NumBytes or Buffer are NULL\r
\r
Arguments:\r
This - Calling context\r
StartLba - The starting logical block index to be erased\r
- OffsetStartLba - Offset into the starting block at which to \r
+ OffsetStartLba - Offset into the starting block at which to\r
begin erasing\r
LastLba - The last logical block index to be erased\r
OffsetStartLba - Offset into the last block at which to end erasing\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - The firmware volume was erased successfully\r
EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state\r
- EFI_DEVICE_ERROR - The block device is not functioning correctly and \r
+ EFI_DEVICE_ERROR - The block device is not functioning correctly and\r
could not be written. Firmware device may have been\r
partially erased\r
\r
Arguments:\r
FwVolHeader - A pointer to a firmware volume header\r
\r
-Returns: \r
+Returns:\r
EFI_SUCCESS - The firmware volume is consistent\r
EFI_NOT_FOUND - The firmware volume has corrupted. So it is not an FV\r
\r
// Allocate runtime services data for global variable, which contains\r
// the private data of all firmware volume block instances\r
//\r
- Status = gBS->AllocatePool (\r
- EfiRuntimeServicesData,\r
- sizeof (ESAL_FWB_GLOBAL),\r
- &mFvbModuleGlobal\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
+ mFvbModuleGlobal = AllocateRuntimePool (sizeof (ESAL_FWB_GLOBAL));\r
+ ASSERT (mFvbModuleGlobal != NULL);\r
\r
//\r
// Calculate the total size for all firmware volume block instances\r
// the private data of each FV instance. But in virtual mode or in physical\r
// mode, the address of the the physical memory may be different.\r
//\r
- Status = gBS->AllocatePool (\r
- EfiRuntimeServicesData,\r
- BufferSize,\r
- &mFvbModuleGlobal->FvInstance[FVB_PHYSICAL]\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
+ mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] = AllocateRuntimePool (BufferSize);\r
+ ASSERT (mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] != NULL);\r
\r
//\r
// Make a virtual copy of the FvInstance pointer.\r
//\r
// Add a FVB Protocol Instance\r
//\r
- Status = gBS->AllocatePool (\r
- EfiRuntimeServicesData,\r
- sizeof (EFI_FW_VOL_BLOCK_DEVICE),\r
- &FvbDevice\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
+ FvbDevice = AllocateRuntimePool (sizeof (EFI_FW_VOL_BLOCK_DEVICE));\r
+ ASSERT (FvbDevice != NULL);\r
\r
CopyMem (FvbDevice, &mFvbDeviceTemplate, sizeof (EFI_FW_VOL_BLOCK_DEVICE));\r
\r
//\r
// Allocate for scratch space, an intermediate buffer for FVB extention\r
//\r
- Status = gBS->AllocatePool (\r
- EfiRuntimeServicesData,\r
- MaxLbaSize,\r
- &mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL]\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
+ mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL] = AllocateRuntimePool (MaxLbaSize);\r
+ ASSERT (mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL] != NULL);\r
\r
mFvbModuleGlobal->FvbScratchSpace[FVB_VIRTUAL] = mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL];\r
\r