summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>2009-03-09 09:20:57 +0000
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>2009-03-09 09:20:57 +0000
commit00f3851372ebdd77b0c06680d24a752ef67cec65 (patch)
tree269fd797c374ba3e0f595490222437d9d204173c /MdeModulePkg
parenta39d85f6ed4cc08b4bc07a947ea94c5f4b946e74 (diff)
downloadedk2-00f3851372ebdd77b0c06680d24a752ef67cec65.zip
edk2-00f3851372ebdd77b0c06680d24a752ef67cec65.tar.gz
edk2-00f3851372ebdd77b0c06680d24a752ef67cec65.tar.bz2
retire FvbServiceLib class in MdeModulePkg, and also remove the two instances in MdeModulePkg and ItaniumPlatformPkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7837 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Include/Library/FvbServiceLib.h279
-rw-r--r--MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf57
-rw-r--r--MdeModulePkg/Library/EdkFvbServiceLib/Fvb.c656
-rw-r--r--MdeModulePkg/Library/EdkFvbServiceLib/Fvb.h45
-rw-r--r--MdeModulePkg/MdeModulePkg.dec5
-rw-r--r--MdeModulePkg/MdeModulePkg.dsc2
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h1
7 files changed, 0 insertions, 1045 deletions
diff --git a/MdeModulePkg/Include/Library/FvbServiceLib.h b/MdeModulePkg/Include/Library/FvbServiceLib.h
deleted file mode 100644
index 49825e5..0000000
--- a/MdeModulePkg/Include/Library/FvbServiceLib.h
+++ /dev/null
@@ -1,279 +0,0 @@
-/** @file
- Firmeware Volume BLock Service Library
-
- Copyright (c) 2006 - 2007, Intel Corporation.<BR>
- All rights reserved. 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.
-
-**/
-
-#ifndef __FVB_SERVICE_LIB_H__
-#define __FVB_SERVICE_LIB_H__
-
-/**
- Reads specified number of bytes into a buffer from the specified block.
-
- The EfiFvbReadBlock() function reads the requested number of bytes from
- the requested block in the specified firmware volume and stores them in
- the provided buffer. Implementations should be mindful that the firmware
- volume might be in the ReadDisabled state. If it is in this state, the
- EfiFvbReadBlock() function must return the status code EFI_ACCESS_DENIED
- without modifying the contents of the buffer.
-
- The EfiFvbReadBlock() function must also prevent spanning block boundaries.
- If a read is requested that would span a block boundary, the read must read
- up to the boundary but not beyond. The output parameter NumBytes must be
- set to correctly indicate the number of bytes actually read.
- The caller must be aware that a read may be partially completed.
-
- If NumBytes is NULL, then ASSERT().
-
- If Buffer is NULL, then ASSERT().
-
- @param[in] Instance The FV instance to be read from.
- @param[in] Lba The logical block address to be read from
- @param[in] Offset The offset relative to the block, at which to begin reading.
- @param[in, out] NumBytes Pointer to a UINTN. On input, *NumBytes contains the total
- size of the buffer. On output, it contains the actual number
- of bytes read.
- @param[out] Buffer Pointer to a caller allocated buffer that will be
- used to hold the data read.
-
- @retval EFI_SUCCESS The firmware volume was read successfully and contents are in Buffer.
- @retval EFI_BAD_BUFFER_SIZE Read attempted across an LBA boundary. On output, NumBytes contains
- the total number of bytes returned in Buffer.
- @retval EFI_ACCESS_DENIED The firmware volume is in the ReadDisabled state.
- @retval EFI_DEVICE_ERROR The block device is not functioning correctly and could not be read.
- @retval EFI_INVALID_PARAMETER Invalid parameter, Instance is larger than the max FVB number. Lba index
- is larger than the last block of the firmware volume. Offset is larger
- than the block size.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbReadBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- OUT UINT8 *Buffer
- );
-
-
-/**
- Writes specified number of bytes from the input buffer to the block
-
- The EfiFvbWriteBlock() function writes the specified number of bytes
- from the provided buffer to the specified block and offset in the
- requested firmware volume.
-
- If the firmware volume is sticky write, the caller must ensure that
- all the bits of the specified range to write are in the EFI_FVB_ERASE_POLARITY
- state before calling the EfiFvbWriteBlock() function, or else the
- result will be unpredictable. This unpredictability arises because,
- for a sticky-write firmware volume, a write may negate a bit in the
- EFI_FVB_ERASE_POLARITY state but it cannot flip it back again. In
- general, before calling the EfiFvbWriteBlock() function, the caller
- should call the EfiFvbEraseBlock() function first to erase the specified
- block to write. A block erase cycle will transition bits from the
- (NOT)EFI_FVB_ERASE_POLARITY state back to the EFI_FVB_ERASE_POLARITY state.
- Implementations should be mindful that the firmware volume might be
- in the WriteDisabled state. If it is in this state, the EfiFvbWriteBlock()
- function must return the status code EFI_ACCESS_DENIED without modifying
- the contents of the firmware volume.
-
- The EfiFvbWriteBlock() function must also prevent spanning block boundaries.
- If a write is requested that spans a block boundary, the write must store
- up to the boundary but not beyond. The output parameter NumBytes must be
- set to correctly indicate the number of bytes actually written. The caller
- must be aware that a write may be partially completed.
- All writes, partial or otherwise, must be fully flushed to the hardware
- before the EfiFvbWriteBlock() function returns.
-
- If NumBytes is NULL, then ASSERT().
-
- @param Instance The FV instance to be written to
- @param Lba The starting logical block index to write to
- @param Offset The offset relative to the block, at which to begin writting.
- @param NumBytes Pointer to a UINTN. On input, *NumBytes contains
- the total size of the buffer. On output, it contains
- the actual number of bytes written.
- @param Buffer Pointer to a caller allocated buffer that contains
- the source for the write
-
- @retval EFI_SUCCESS The firmware volume was written successfully.
- @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
- On output, NumBytes contains the total number of bytes actually written.
- @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled state.
- @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not be written.
- @retval EFI_INVALID_PARAMETER Invalid parameter, Instance is larger than the max FVB number.
- Lba index is larger than the last block of the firmware volume.
- Offset is larger than the block size.
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbWriteBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- );
-
-
-/**
- Erases and initializes a firmware volume block.
-
- The EfiFvbEraseBlock() function erases one block specified by Lba.
- Implementations should be mindful that the firmware volume might
- be in the WriteDisabled state. If it is in this state, the EfiFvbEraseBlock()
- function must return the status code EFI_ACCESS_DENIED without
- modifying the contents of the firmware volume. If Instance is
- larger than the max FVB number, or Lba index is larger than the
- last block of the firmware volume, this function return the status
- code EFI_INVALID_PARAMETER.
-
- All calls to EfiFvbEraseBlock() must be fully flushed to the
- hardware before this function returns.
-
- @param[in] Instance The FV instance to be erased.
- @param[in] Lba The logical block index to be erased from.
-
- @retval EFI_SUCCESS The erase request was successfully completed.
- @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled state.
- @retval EFI_DEVICE_ERROR The block device is not functioning correctly and
- could not be written. The firmware device may
- have been partially erased.
- @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max
- FVB number. Lba index is larger than the last block
- of the firmware volume.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbEraseBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba
- );
-
-
-/**
- Retrieves the attributes and current settings of the specified block,
- returns resulting attributes in output parameter.
-
- The EfiFvbGetAttributes() function retrieves the attributes and current
- settings of the block specified by Instance. If Instance is larger than
- the max FVB number, this function returns the status code EFI_INVALID_PARAMETER.
-
- If Attributes is NULL, then ASSERT().
-
- @param[in] Instance The FV instance to be operated.
- @param[out] Attributes Pointer to EFI_FVB_ATTRIBUTES_2 in which the
- attributes and current settings are returned.
-
- @retval EFI_EFI_SUCCESS The firmware volume attributes were returned.
- @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max FVB number.
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbGetVolumeAttributes (
- IN UINTN Instance,
- OUT EFI_FVB_ATTRIBUTES_2 *Attributes
- );
-
-
-/**
- Modify the attributes and current settings of the specified block
- according to the input parameter.
-
- The EfiFvbSetAttributes() function sets configurable firmware volume
- attributes and returns the new settings of the firmware volume specified
- by Instance. If Instance is larger than the max FVB number, this function
- returns the status code EFI_INVALID_PARAMETER.
-
- If Attributes is NULL, then ASSERT().
-
- @param[in] Instance The FV instance to be operated.
- @param[in, out]Attributes On input, Attributes is a pointer to EFI_FVB_ATTRIBUTES_2
- that contains the desired firmware volume settings.
- On successful return, it contains the new settings of the firmware volume.
-
- @retval EFI_EFI_SUCCESS The firmware volume attributes were modified successfully.
- @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max FVB number.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbSetVolumeAttributes (
- IN UINTN Instance,
- IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
- );
-
-
-/**
- Retrieves the physical address of the specified memory mapped FV.
-
- Retrieve the base address of a memory-mapped firmware volume specified by Instance.
- If Instance is larger than the max FVB number, this function returns the status
- code EFI_INVALID_PARAMETER.
-
- If BaseAddress is NULL, then ASSERT().
-
- @param[in] Instance The FV instance to be operated.
- @param[out] BaseAddress Pointer to a caller allocated EFI_PHYSICAL_ADDRESS
- that on successful return, contains the base address
- of the firmware volume.
-
- @retval EFI_EFI_SUCCESS The firmware volume base address is returned.
- @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max FVB number.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbGetPhysicalAddress (
- IN UINTN Instance,
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress
- );
-
-
-/**
- Retrieve the block size of the specified fv.
-
- The EfiFvbGetBlockSize() function retrieves the size of the requested block.
- It also returns the number of additional blocks with the identical size.
- If Instance is larger than the max FVB number, or Lba index is larger than
- the last block of the firmware volume, this function return the status code
- EFI_INVALID_PARAMETER.
-
- If BlockSize is NULL, then ASSERT().
-
- If NumOfBlocks is NULL, then ASSERT().
-
- @param[in] Instance The FV instance to be operated.
- @param[in] Lba Indicates which block to return the size for.
- @param[out] BlockSize Pointer to a caller-allocated UINTN in which the
- size of the block is returned.
- @param[out] NumOfBlocks Pointer to a caller-allocated UINTN in which the
- number of consecutive blocks, starting with Lba,
- is returned. All blocks in this range have a size of BlockSize.
-
- @retval EFI_EFI_SUCCESS The firmware volume base address is returned.
- @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max FVB number.
- Lba index is larger than the last block of the firmware volume.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbGetBlockSize (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumOfBlocks
- );
-
-#endif
diff --git a/MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf b/MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf
deleted file mode 100644
index eb77a43..0000000
--- a/MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf
+++ /dev/null
@@ -1,57 +0,0 @@
-#/** @file
-# FvbService Library for DXE phase drivers
-#
-# This library instance provide sevice functions to access Firmware Volume Block protocol.
-#
-# Copyright (c) 2006 - 2008, Intel Corporation
-#
-# All rights reserved. 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.
-#
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = EdkFvbServiceLib
- FILE_GUID = bd4d540e-04b0-4b10-8fd5-4a7bb533cf67
- MODULE_TYPE = DXE_RUNTIME_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = FvbServiceLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
- CONSTRUCTOR = FvbLibInitialize
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 EBC
-#
-# VIRTUAL_ADDRESS_MAP_CALLBACK = FvbVirtualAddressChangeNotifyEvent
-#
-
-[Sources]
- Fvb.h
- Fvb.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- UefiRuntimeLib
- BaseMemoryLib
- DebugLib
- BaseLib
- UefiLib
- MemoryAllocationLib
-
-[Protocols]
- gEfiFirmwareVolumeBlockProtocolGuid ## NOTIFY
-
-[Guids]
- gEfiEventVirtualAddressChangeGuid ## PRODUCES
-
diff --git a/MdeModulePkg/Library/EdkFvbServiceLib/Fvb.c b/MdeModulePkg/Library/EdkFvbServiceLib/Fvb.c
deleted file mode 100644
index 85f5e5a..0000000
--- a/MdeModulePkg/Library/EdkFvbServiceLib/Fvb.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/**@file
- Firmware Volume Block Protocol Runtime Interface Abstraction
- And FVB Extension protocol Runtime Interface Abstraction
-
- mFvbEntry is an array of Handle Fvb pairs. The Fvb Lib Instance matches the
- index in the mFvbEntry array. This should be the same sequence as the FVB's
- were described in the HOB. We have to remember the handle so we can tell if
- the protocol has been reinstalled and it needs updating.
-
-
-Copyright (c) 2006 - 2008, Intel Corporation
-All rights reserved. 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.
-
-**/
-
-
-#include "Fvb.h"
-
-
-//
-// Event for Set Virtual Map Changed Event
-//
-EFI_EVENT mSetVirtualMapChangedEvent = NULL;
-
-//
-// Lib will ASSERT if more FVB devices than this are added to the system.
-//
-FVB_ENTRY *mFvbEntry = NULL;
-EFI_EVENT mFvbRegistration = NULL;
-UINTN mFvbCount = 0;
-
-/**
- Check whether an address is runtime memory or not.
-
- @param Address The Address being checked.
-
- @retval TRUE The address is runtime memory.
- @retval FALSE The address is not runtime memory.
-**/
-BOOLEAN
-IsRuntimeMemory (
- IN VOID *Address
- )
-{
- EFI_STATUS Status;
- UINT8 TmpMemoryMap[1];
- UINTN MapKey;
- UINTN DescriptorSize;
- UINT32 DescriptorVersion;
- UINTN MemoryMapSize;
- EFI_MEMORY_DESCRIPTOR *MemoryMap;
- EFI_MEMORY_DESCRIPTOR *MemoryMapPtr;
- BOOLEAN IsRuntime;
- UINTN Index;
-
- IsRuntime = FALSE;
-
- //
- // Get System MemoryMapSize
- //
- MemoryMapSize = 1;
- Status = gBS->GetMemoryMap (
- &MemoryMapSize,
- (EFI_MEMORY_DESCRIPTOR *)TmpMemoryMap,
- &MapKey,
- &DescriptorSize,
- &DescriptorVersion
- );
- ASSERT (Status == EFI_BUFFER_TOO_SMALL);
- //
- // Enlarge space here, because we will allocate pool now.
- //
- MemoryMapSize += EFI_PAGE_SIZE;
- MemoryMap = AllocatePool (MemoryMapSize);
- ASSERT (MemoryMap != NULL);
-
- //
- // Get System MemoryMap
- //
- Status = gBS->GetMemoryMap (
- &MemoryMapSize,
- MemoryMap,
- &MapKey,
- &DescriptorSize,
- &DescriptorVersion
- );
- ASSERT_EFI_ERROR (Status);
-
- MemoryMapPtr = MemoryMap;
- //
- // Search the request Address
- //
- for (Index = 0; Index < (MemoryMapSize / DescriptorSize); Index++) {
- if (((EFI_PHYSICAL_ADDRESS)(UINTN)Address >= MemoryMap->PhysicalStart) &&
- ((EFI_PHYSICAL_ADDRESS)(UINTN)Address < MemoryMap->PhysicalStart
- + LShiftU64 (MemoryMap->NumberOfPages, EFI_PAGE_SHIFT))) {
- //
- // Found it
- //
- if ((MemoryMap->Attribute & EFI_MEMORY_RUNTIME) != 0) {
- IsRuntime = TRUE;
- }
- break;
- }
- //
- // Get next item
- //
- MemoryMap = (EFI_MEMORY_DESCRIPTOR *)((UINTN) MemoryMap + DescriptorSize);
- }
-
- //
- // Done
- //
- FreePool (MemoryMapPtr);
-
- return IsRuntime;
-}
-
-
-/**
- Update mFvbEntry. Add new entry, or update existing entry if Fvb protocol is
- reinstalled.
-
- @param Event The Event that is being processed
- @param Context Event Context
-
-**/
-VOID
-EFIAPI
-FvbNotificationEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HANDLE Handle;
- UINTN Index;
- UINTN UpdateIndex;
-
- while (TRUE) {
- BufferSize = sizeof (Handle);
- Status = gBS->LocateHandle (
- ByRegisterNotify,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- mFvbRegistration,
- &BufferSize,
- &Handle
- );
- if (EFI_ERROR (Status)) {
- //
- // Exit Path of While Loop....
- //
- break;
- }
-
- UpdateIndex = MAX_FVB_COUNT;
- for (Index = 0; Index < mFvbCount; Index++) {
- if (mFvbEntry[Index].Handle == Handle) {
- //
- // If the handle is already in the table just update the protocol
- //
- UpdateIndex = Index;
- break;
- }
- }
-
- if (UpdateIndex == MAX_FVB_COUNT) {
- //
- // Use the next free slot for a new entry
- //
- UpdateIndex = mFvbCount++;
- //
- // Check the UpdateIndex whether exceed the maximum value.
- //
- ASSERT (UpdateIndex < MAX_FVB_COUNT);
- mFvbEntry[UpdateIndex].Handle = Handle;
- }
- //
- // The array does not have enough entries
- //
- ASSERT (UpdateIndex < MAX_FVB_COUNT);
-
- //
- // Get the interface pointer and if it's ours, skip it
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- (VOID **) &mFvbEntry[UpdateIndex].Fvb
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Check the FVB can be accessed in RUNTIME, The FVBs in FVB handle list come from two ways:
- // 1) Dxe Core. (FVB information is transferred from FV HOB). 2) FVB driver. The FVB produced
- // Dxe core is used to discovery DXE driver and dispatch. These FVBs can only be accessed in
- // boot time. FVB driver will discovery all FV in FLASH and these FVBs can be accessed in
- // runtime. The FVB itself produced by FVB driver is allocated in runtime memory. So we can
- // determine the what FVB can be accessed in RUNTIME by judging whether FVB itself is allocated
- // in RUNTIME memory.
- //
- mFvbEntry[UpdateIndex].IsRuntimeAccess = IsRuntimeMemory (mFvbEntry[UpdateIndex].Fvb);
- }
-}
-
-/**
- Convert all pointers in mFvbEntry after ExitBootServices.
-
- @param Event The Event that is being processed
- @param Context Event Context
-
-**/
-VOID
-EFIAPI
-FvbVirtualAddressChangeNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- UINTN Index;
-
- if (mFvbEntry != NULL) {
- for (Index = 0; Index < MAX_FVB_COUNT; Index++) {
- if (!mFvbEntry[Index].IsRuntimeAccess) {
- continue;
- }
-
- if (mFvbEntry[Index].Fvb != NULL) {
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetBlockSize);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetPhysicalAddress);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetAttributes);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->SetAttributes);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->Read);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->Write);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->EraseBlocks);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb);
- }
- }
-
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry);
- }
-}
-
-
-/**
- Library constructor function entry.
-
- @param ImageHandle The handle of image who call this library.
- @param SystemTable The point of System Table.
-
- @retval EFI_SUCESS Success construct this library.
- @retval Others Fail to construct this library.
-**/
-EFI_STATUS
-EFIAPI
-FvbLibInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- mFvbEntry = AllocateRuntimeZeroPool (sizeof (FVB_ENTRY) * MAX_FVB_COUNT);
- ASSERT (mFvbEntry != NULL);
-
- //
- // Register FvbNotificationEvent () notify function.
- //
- EfiCreateProtocolNotifyEvent (
- &gEfiFirmwareVolumeBlockProtocolGuid,
- TPL_CALLBACK,
- FvbNotificationEvent,
- NULL,
- &mFvbRegistration
- );
-
- //
- // Register SetVirtualAddressMap () notify function
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- FvbVirtualAddressChangeNotifyEvent,
- NULL,
- &gEfiEventVirtualAddressChangeGuid,
- &mSetVirtualMapChangedEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-//
-// =============================================================================
-// The following functions wrap Fvb protocol in the Runtime Lib functions.
-// The Instance translates into Fvb instance. The Fvb order defined by HOBs and
-// thus the sequence of FVB protocol addition define Instance.
-//
-
-/**
- Reads specified number of bytes into a buffer from the specified block.
-
- The EfiFvbReadBlock() function reads the requested number of bytes from
- the requested block in the specified firmware volume and stores them in
- the provided buffer. Implementations should be mindful that the firmware
- volume might be in the ReadDisabled state. If it is in this state, the
- EfiFvbReadBlock() function must return the status code EFI_ACCESS_DENIED
- without modifying the contents of the buffer.
-
- The EfiFvbReadBlock() function must also prevent spanning block boundaries.
- If a read is requested that would span a block boundary, the read must read
- up to the boundary but not beyond. The output parameter NumBytes must be
- set to correctly indicate the number of bytes actually read.
- The caller must be aware that a read may be partially completed.
-
- If NumBytes is NULL, then ASSERT().
-
- If Buffer is NULL, then ASSERT().
-
- @param[in] Instance The FV instance to be read from.
- @param[in] Lba The logical block address to be read from
- @param[in] Offset The offset relative to the block, at which to begin reading.
- @param[in, out] NumBytes Pointer to a UINTN. On input, *NumBytes contains the total
- size of the buffer. On output, it contains the actual number
- of bytes read.
- @param[out] Buffer Pointer to a caller allocated buffer that will be
- used to hold the data read.
-
- @retval EFI_SUCCESS The firmware volume was read successfully and contents are in Buffer.
- @retval EFI_BAD_BUFFER_SIZE Read attempted across an LBA boundary. On output, NumBytes contains
- the total number of bytes returned in Buffer.
- @retval EFI_ACCESS_DENIED The firmware volume is in the ReadDisabled state.
- @retval EFI_DEVICE_ERROR The block device is not functioning correctly and could not be read.
- @retval EFI_INVALID_PARAMETER Invalid parameter, Instance is larger than the max FVB number. Lba index
- is larger than the last block of the firmware volume. Offset is larger
- than the block size.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbReadBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- OUT UINT8 *Buffer
- )
-{
- ASSERT (NumBytes != NULL);
- ASSERT (Buffer != NULL);
-
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->Read (mFvbEntry[Instance].Fvb, Lba, Offset, NumBytes, Buffer);
-}
-
-/**
- Writes specified number of bytes from the input buffer to the block
-
- The EfiFvbWriteBlock() function writes the specified number of bytes
- from the provided buffer to the specified block and offset in the
- requested firmware volume.
-
- If the firmware volume is sticky write, the caller must ensure that
- all the bits of the specified range to write are in the EFI_FVB_ERASE_POLARITY
- state before calling the EfiFvbWriteBlock() function, or else the
- result will be unpredictable. This unpredictability arises because,
- for a sticky-write firmware volume, a write may negate a bit in the
- EFI_FVB_ERASE_POLARITY state but it cannot flip it back again. In
- general, before calling the EfiFvbWriteBlock() function, the caller
- should call the EfiFvbEraseBlock() function first to erase the specified
- block to write. A block erase cycle will transition bits from the
- (NOT)EFI_FVB_ERASE_POLARITY state back to the EFI_FVB_ERASE_POLARITY state.
- Implementations should be mindful that the firmware volume might be
- in the WriteDisabled state. If it is in this state, the EfiFvbWriteBlock()
- function must return the status code EFI_ACCESS_DENIED without modifying
- the contents of the firmware volume.
-
- The EfiFvbWriteBlock() function must also prevent spanning block boundaries.
- If a write is requested that spans a block boundary, the write must store
- up to the boundary but not beyond. The output parameter NumBytes must be
- set to correctly indicate the number of bytes actually written. The caller
- must be aware that a write may be partially completed.
- All writes, partial or otherwise, must be fully flushed to the hardware
- before the EfiFvbWriteBlock() function returns.
-
- If NumBytes is NULL, then ASSERT().
-
- @param Instance The FV instance to be written to.
- @param Lba The starting logical block index to write.
- @param Offset The offset relative to the block to write.
- @param NumBytes Pointer to a UINTN. On input, *NumBytes contains
- the total size of the buffer. On output, it contains
- the actual number of bytes written.
- @param Buffer Pointer to a caller allocated buffer that contains
- the source for the write
-
- @retval EFI_SUCCESS The firmware volume was written successfully.
- @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
- On output, NumBytes contains the total number of bytes actually written.
- @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled state.
- @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not be written.
- @retval EFI_INVALID_PARAMETER Invalid parameter, Instance is larger than the max FVB number.
- Lba index is larger than the last block of the firmware volume.
- Offset is larger than the block size.
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbWriteBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-{
- ASSERT (NumBytes != NULL);
-
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->Write (mFvbEntry[Instance].Fvb, Lba, Offset, NumBytes, Buffer);
-}
-
-
-/**
- Erases and initializes a firmware volume block.
-
- The EfiFvbEraseBlock() function erases one block specified by Lba.
- Implementations should be mindful that the firmware volume might
- be in the WriteDisabled state. If it is in this state, the EfiFvbEraseBlock()
- function must return the status code EFI_ACCESS_DENIED without
- modifying the contents of the firmware volume. If Instance is
- larger than the max FVB number, or Lba index is larger than the
- last block of the firmware volume, this function return the status
- code EFI_INVALID_PARAMETER.
-
- All calls to EfiFvbEraseBlock() must be fully flushed to the
- hardware before this function returns.
-
- @param[in] Instance The FV instance to be erased.
- @param[in] Lba The logical block index to be erased from.
-
- @retval EFI_SUCCESS The erase request was successfully completed.
- @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled state.
- @retval EFI_DEVICE_ERROR The block device is not functioning correctly and
- could not be written. The firmware device may
- have been partially erased.
- @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max
- FVB number. Lba index is larger than the last block
- of the firmware volume.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbEraseBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->EraseBlocks (mFvbEntry[Instance].Fvb, Lba, 1, EFI_LBA_LIST_TERMINATOR);
-}
-
-
-/**
- Retrieves the attributes and current settings of the specified block,
- returns resulting attributes in output parameter.
-
- The EfiFvbGetAttributes() function retrieves the attributes and current
- settings of the block specified by Instance. If Instance is larger than
- the max FVB number, this function returns the status code EFI_INVALID_PARAMETER.
-
- If Attributes is NULL, then ASSERT().
-
- @param[in] Instance The FV instance to be operated.
- @param[out] Attributes Pointer to EFI_FVB_ATTRIBUTES_2 in which the
- attributes and current settings are returned.
-
- @retval EFI_EFI_SUCCESS The firmware volume attributes were returned.
- @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max FVB number.
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbGetVolumeAttributes (
- IN UINTN Instance,
- OUT EFI_FVB_ATTRIBUTES_2 *Attributes
- )
-{
- ASSERT (Attributes != NULL);
-
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetAttributes (mFvbEntry[Instance].Fvb, Attributes);
-}
-
-
-/**
- Modify the attributes and current settings of the specified block
- according to the input parameter.
-
- The EfiFvbSetAttributes() function sets configurable firmware volume
- attributes and returns the new settings of the firmware volume specified
- by Instance. If Instance is larger than the max FVB number, this function
- returns the status code EFI_INVALID_PARAMETER.
-
- If Attributes is NULL, then ASSERT().
-
- @param[in] Instance The FV instance to be operated.
- @param[in, out]Attributes On input, Attributes is a pointer to EFI_FVB_ATTRIBUTES_2
- that contains the desired firmware volume settings.
- On successful return, it contains the new settings of the firmware volume.
-
- @retval EFI_EFI_SUCCESS The firmware volume attributes were modified successfully.
- @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max FVB number.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbSetVolumeAttributes (
- IN UINTN Instance,
- IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
- )
-{
- ASSERT (Attributes != NULL);
-
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->SetAttributes (mFvbEntry[Instance].Fvb, Attributes);
-}
-
-
-/**
- Retrieves the physical address of the specified memory mapped FV.
-
- Retrieve the base address of a memory-mapped firmware volume specified by Instance.
- If Instance is larger than the max FVB number, this function returns the status
- code EFI_INVALID_PARAMETER.
-
- If BaseAddress is NULL, then ASSERT().
-
- @param[in] Instance The FV instance to be operated.
- @param[out] BaseAddress Pointer to a caller allocated EFI_PHYSICAL_ADDRESS
- that on successful return, contains the base address
- of the firmware volume.
-
- @retval EFI_EFI_SUCCESS The firmware volume base address is returned.
- @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max FVB number.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbGetPhysicalAddress (
- IN UINTN Instance,
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress
- )
-{
- ASSERT (BaseAddress != NULL);
-
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetPhysicalAddress (mFvbEntry[Instance].Fvb, BaseAddress);
-}
-
-
-/**
- Retrieve the block size of the specified fv.
-
- The EfiFvbGetBlockSize() function retrieves the size of the requested block.
- It also returns the number of additional blocks with the identical size.
- If Instance is larger than the max FVB number, or Lba index is larger than
- the last block of the firmware volume, this function return the status code
- EFI_INVALID_PARAMETER.
-
- If BlockSize is NULL, then ASSERT().
-
- If NumOfBlocks is NULL, then ASSERT().
-
- @param[in] Instance The FV instance to be operated.
- @param[in] Lba Indicates which block to return the size for.
- @param[out] BlockSize Pointer to a caller-allocated UINTN in which the
- size of the block is returned.
- @param[out] NumOfBlocks Pointer to a caller-allocated UINTN in which the
- number of consecutive blocks, starting with Lba,
- is returned. All blocks in this range have a size of BlockSize.
-
- @retval EFI_EFI_SUCCESS The firmware volume base address is returned.
- @retval EFI_INVALID_PARAMETER Invalid parameter. Instance is larger than the max FVB number.
- Lba index is larger than the last block of the firmware volume.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiFvbGetBlockSize (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumOfBlocks
- )
-{
- ASSERT (BlockSize != NULL);
- ASSERT (NumOfBlocks != NULL);
-
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetBlockSize (mFvbEntry[Instance].Fvb, Lba, BlockSize, NumOfBlocks);
-}
diff --git a/MdeModulePkg/Library/EdkFvbServiceLib/Fvb.h b/MdeModulePkg/Library/EdkFvbServiceLib/Fvb.h
deleted file mode 100644
index b12894b..0000000
--- a/MdeModulePkg/Library/EdkFvbServiceLib/Fvb.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file
- The internal header file includes the common header files, defines
- internal structure FVB_ENTRY.
-
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>
-
-All rights reserved. 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.
-
-**/
-
-#ifndef __FVB_H__
-#define __FVB_H__
-
-
-#include <PiDxe.h>
-
-#include <Protocol/FirmwareVolumeBlock.h>
-
-#include <Library/FvbServiceLib.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiRuntimeLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include <Guid/EventGroup.h>
-
-#define MAX_FVB_COUNT 16
-
-typedef struct {
- EFI_HANDLE Handle;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- BOOLEAN IsRuntimeAccess;
-} FVB_ENTRY;
-
-#endif
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index eed4e4a..9db9d4a 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -76,11 +76,6 @@
## @libraryclass Library for Deferred Procedure Calls.
DpcLib|Include/Library/DpcLib.h
- ## @libraryclass Provides all FVB runtime services defined in PI specification FVB protocol to provide
- # low level control interfaces over block-oriented firmware devices.
- ##
- FvbServiceLib|Include/Library/FvbServiceLib.h
-
## @libraryclass Provides APIs for system memory test.
##
BaseMemoryTestLib|Include/Library/BaseMemoryTestLib.h
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index e4e77ff..896656a 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -61,7 +61,6 @@
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
- FvbServiceLib|MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
ExtendedHiiLib|MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.inf
UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
@@ -283,7 +282,6 @@
MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf
MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.inf
- MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf
MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
MdeModulePkg/Library/UefiIfrSupportLib/UefiIfrSupportLib.inf
MdeModulePkg/Library/BaseMemoryTestLibNull/BaseMemoryTestLibNull.inf
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h
index 1c99310..41b4a95 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h
@@ -28,7 +28,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/UefiRuntimeLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
-#include <Library/FvbServiceLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/BaseLib.h>