summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r--MdeModulePkg/Library/EdkFvbServiceLib/CommonHeader.h49
-rw-r--r--MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf123
-rw-r--r--MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.msa81
-rw-r--r--MdeModulePkg/Library/EdkFvbServiceLib/EntryPoint.c54
-rw-r--r--MdeModulePkg/Library/EdkFvbServiceLib/Fvb.h44
5 files changed, 351 insertions, 0 deletions
diff --git a/MdeModulePkg/Library/EdkFvbServiceLib/CommonHeader.h b/MdeModulePkg/Library/EdkFvbServiceLib/CommonHeader.h
new file mode 100644
index 0000000..01f5eb9
--- /dev/null
+++ b/MdeModulePkg/Library/EdkFvbServiceLib/CommonHeader.h
@@ -0,0 +1,49 @@
+/**@file
+ Common header file shared by all source files.
+
+ This file includes package header files, library classes and protocol, PPI & GUID definitions.
+
+ Copyright (c) 2006 - 2007, 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.
+**/
+
+#ifndef __COMMON_HEADER_H_
+#define __COMMON_HEADER_H_
+
+
+//
+// The package level header files this module uses
+//
+#include <PiDxe.h>
+//
+// The protocols, PPI and GUID defintions for this module
+//
+#include <Protocol/FirmwareVolumeBlock.h>
+#include <Protocol/FvbExtension.h>
+//
+// The Library classes this module consumes
+//
+#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>
+
+//
+// Declaration for callback Event.
+//
+VOID
+EFIAPI
+FvbVirtualAddressChangeNotifyEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+#endif
diff --git a/MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf b/MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf
new file mode 100644
index 0000000..9a89bfb
--- /dev/null
+++ b/MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf
@@ -0,0 +1,123 @@
+#/** @file
+# FvbService Library for UEFI drivers
+#
+# This library instance provide sevice functions to access Firmware Volume Block protocol.
+# Copyright (c) 2006 - 2007, 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 Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = EdkFvbServiceLib
+ FILE_GUID = bd4d540e-04b0-4b10-8fd5-4a7bb533cf67
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = EdkFvbServiceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
+ EDK_RELEASE_VERSION = 0x00020000
+ EFI_SPECIFICATION_VERSION = 0x00020000
+
+ CONSTRUCTOR = FvbLibInitialize
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+# VIRTUAL_ADDRESS_MAP_CALLBACK = FvbVirtualAddressChangeNotifyEvent
+#
+
+################################################################################
+#
+# Sources Section - list of files that are required for the build to succeed.
+#
+################################################################################
+
+[Sources.common]
+ Fvb.h
+
+[Sources.Ia32]
+ Ia32/Fvb.c
+
+[Sources.X64]
+ x64/Fvb.c
+
+[Sources.IPF]
+ Ipf/Fvb.c
+
+
+################################################################################
+#
+# Includes Section - list of Include locations that are required for
+# this module.
+#
+################################################################################
+
+[Includes]
+ $(WORKSPACE)/MdePkg/Include/Library
+
+################################################################################
+#
+# Package Dependency Section - list of Package files that are required for
+# this module.
+#
+################################################################################
+
+[Packages]
+ MdePkg/MdePkg.dec
+ IntelFrameworkPkg/IntelFrameworkPkg.dec
+
+################################################################################
+#
+# Library Class Section - list of Library Classes that are required for
+# this module.
+#
+################################################################################
+
+[LibraryClasses.IA32]
+ UefiBootServicesTableLib
+ UefiRuntimeLib
+ BaseMemoryLib
+ DebugLib
+ BaseLib
+ UefiLib
+
+[LibraryClasses.X64]
+ UefiBootServicesTableLib
+ UefiRuntimeLib
+ BaseMemoryLib
+ DebugLib
+ BaseLib
+ UefiLib
+
+
+################################################################################
+#
+# Protocol C Name Section - list of Protocol and Protocol Notify C Names
+# that this module uses or produces.
+#
+################################################################################
+
+[Protocols]
+ gEfiFirmwareVolumeBlockProtocolGuid # PROTOCOL_NOTIFY SOMETIMES_CONSUMED
+
+[Protocols.IA32]
+ gEfiFvbExtensionProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiFirmwareVolumeBlockProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+
+[Protocols.X64]
+ gEfiFvbExtensionProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiFirmwareVolumeBlockProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+
diff --git a/MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.msa b/MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.msa
new file mode 100644
index 0000000..2aa7abb
--- /dev/null
+++ b/MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.msa
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <MsaHeader>
+ <ModuleName>EdkFvbServiceLib</ModuleName>
+ <ModuleType>DXE_DRIVER</ModuleType>
+ <GuidValue>bd4d540e-04b0-4b10-8fd5-4a7bb533cf67</GuidValue>
+ <Version>1.0</Version>
+ <Abstract>FvbService Library for UEFI drivers</Abstract>
+ <Description>This library instance provide sevice functions to access Firmware Volume Block protocol.</Description>
+ <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
+ <License>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.</License>
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
+ </MsaHeader>
+ <ModuleDefinitions>
+ <SupportedArchitectures>IA32 X64 IPF</SupportedArchitectures>
+ <BinaryModule>false</BinaryModule>
+ <OutputFileBasename>EdkFvbServiceLib</OutputFileBasename>
+ </ModuleDefinitions>
+ <LibraryClassDefinitions>
+ <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
+ <Keyword>EdkFvbServiceLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
+ <Keyword>UefiLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
+ <Keyword>BaseLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
+ <Keyword>DebugLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
+ <Keyword>BaseMemoryLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
+ <Keyword>UefiRuntimeLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
+ <Keyword>UefiBootServicesTableLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IPF">
+ <Keyword>EdkDxeSalLib</Keyword>
+ </LibraryClass>
+ </LibraryClassDefinitions>
+ <SourceFiles>
+ <Filename>Fvb.h</Filename>
+ <Filename SupArchList="IA32">Ia32/Fvb.c</Filename>
+ <Filename SupArchList="X64">x64/Fvb.c</Filename>
+ <Filename SupArchList="IPF">Ipf/Fvb.c</Filename>
+ </SourceFiles>
+ <PackageDependencies>
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
+ <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
+ </PackageDependencies>
+ <Protocols>
+ <Protocol Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
+ <ProtocolCName>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolCName>
+ </Protocol>
+ <Protocol Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
+ <ProtocolCName>gEfiFvbExtensionProtocolGuid</ProtocolCName>
+ </Protocol>
+ <ProtocolNotify Usage="SOMETIMES_CONSUMED">
+ <ProtocolNotifyCName>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolNotifyCName>
+ </ProtocolNotify>
+ </Protocols>
+ <Externs>
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
+ <Extern>
+ <Constructor>FvbLibInitialize</Constructor>
+ </Extern>
+ <Extern>
+ <SetVirtualAddressMapCallBack>FvbVirtualAddressChangeNotifyEvent</SetVirtualAddressMapCallBack>
+ </Extern>
+ </Externs>
+</ModuleSurfaceArea> \ No newline at end of file
diff --git a/MdeModulePkg/Library/EdkFvbServiceLib/EntryPoint.c b/MdeModulePkg/Library/EdkFvbServiceLib/EntryPoint.c
new file mode 100644
index 0000000..9cdf594
--- /dev/null
+++ b/MdeModulePkg/Library/EdkFvbServiceLib/EntryPoint.c
@@ -0,0 +1,54 @@
+/**@file
+ Entry Point Source file.
+
+ This file contains the user entry point
+
+ Copyright (c) 2006 - 2007, 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 common header file for this module.
+//
+#include "CommonHeader.h"
+
+//
+// Event for Exit Boot Services Callback
+//
+STATIC EFI_EVENT mExitBootServicesEvent = NULL;
+
+/**
+ The user Entry Point for module EdkFvbServiceLib. The user code starts with this function.
+
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.
+ @param[in] SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+ @retval other Some error occurs when executing this entry point.
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeEdkFvbServiceLib(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->CreateEvent (
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_NOTIFY,
+ FvbVirtualAddressChangeNotifyEvent,
+ NULL,
+ &mExitBootServicesEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/MdeModulePkg/Library/EdkFvbServiceLib/Fvb.h b/MdeModulePkg/Library/EdkFvbServiceLib/Fvb.h
new file mode 100644
index 0000000..0f17932
--- /dev/null
+++ b/MdeModulePkg/Library/EdkFvbServiceLib/Fvb.h
@@ -0,0 +1,44 @@
+/**
+ The internal header file for EdkFvbServiceLib.
+
+Copyright (c) 2006 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
+
+**/
+
+#ifndef __FVB_H__
+#define __FVB_H__
+
+//
+// The package level header files this module uses
+//
+#include <PiDxe.h>
+//
+// The protocols, PPI and GUID defintions for this module
+//
+#include <Protocol/FirmwareVolumeBlock.h>
+#include <Protocol/FvbExtension.h>
+//
+// The Library classes this module consumes
+//
+#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>
+
+#define MAX_FVB_COUNT 16
+
+typedef struct {
+ EFI_HANDLE Handle;
+ EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
+ EFI_FVB_EXTENSION_PROTOCOL *FvbExtension;
+ BOOLEAN IsRuntimeAccess;
+} FVB_ENTRY;
+
+#endif