Initial import.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
1939
EdkNt32Pkg/RuntimeDxe/FvbServices/Common/FWBlockService.c
Normal file
1939
EdkNt32Pkg/RuntimeDxe/FvbServices/Common/FWBlockService.c
Normal file
File diff suppressed because it is too large
Load Diff
324
EdkNt32Pkg/RuntimeDxe/FvbServices/Common/FwBlockService.h
Normal file
324
EdkNt32Pkg/RuntimeDxe/FvbServices/Common/FwBlockService.h
Normal file
@@ -0,0 +1,324 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, 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.
|
||||
|
||||
Module Name:
|
||||
|
||||
FwBlockService.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Firmware volume block driver for Intel Firmware Hub (FWH) device
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _FW_BLOCK_SERVICE_H
|
||||
#define _FW_BLOCK_SERVICE_H
|
||||
|
||||
//
|
||||
// Statements that include other header files
|
||||
//
|
||||
#include "Tiano.h"
|
||||
#include "EfiFirmwareVolumeHeader.h"
|
||||
#include "EfiRuntimeLib.h"
|
||||
#include "EfiHobLib.h"
|
||||
#include "EfiScriptLib.h"
|
||||
|
||||
#include EFI_PROTOCOL_PRODUCER (FirmwareVolumeBlock)
|
||||
#include EFI_PROTOCOL_PRODUCER (FvbExtension)
|
||||
#include EFI_GUID_DEFINITION (AlternateFvBlock)
|
||||
#include EFI_GUID_DEFINITION (Hob)
|
||||
#include EFI_GUID_DEFINITION (DxeServices)
|
||||
#include EFI_PROTOCOL_CONSUMER (CpuIo)
|
||||
|
||||
#define FVB_MAX_RETRY_TIMES 10000000
|
||||
#define FWH_BLOCK_ERASE_SETUP_COMMAND 0x20
|
||||
#define FWH_BLOCK_ERASE_CONFIRM_COMMAND 0xd0
|
||||
#define FWH_READ_STATUS_COMMAND 0x70
|
||||
#define FWH_CLEAR_STATUS_COMMAND 0x50
|
||||
#define FWH_READ_ARRAY_COMMAND 0xff
|
||||
#define FWH_WRITE_SETUP_COMMAND 0x40
|
||||
#define FWH_OPEN_FEATURE_SPACE_COMMAND 0x91
|
||||
#define FWH_READ_LOCK (1 << 2)
|
||||
#define FWH_WRITE_LOCK (1 << 1)
|
||||
#define FWH_LOCK_DOWN 1
|
||||
#define FWH_WRITE_STATE_STATUS (1 << 7)
|
||||
#define FWH_ERASE_STATUS (1 << 5)
|
||||
#define FWH_PROGRAM_STATUS (1 << 4)
|
||||
#define FWH_VPP_STATUS (1 << 3)
|
||||
#define STALL_TIME 5
|
||||
#define FWH_ERASE_STATUS_BITS (FWH_ERASE_STATUS || FWH_VPP_STATUS)
|
||||
#define FWH_WRITE_STATUS_BITS (FWH_WRITE_STATUS || FWH_VPP_STATUS)
|
||||
#define CFI_BLOCK_LOCK_UNLOCK 0x60
|
||||
#define CFI_BLOCK_LOCK_CONFIRM 1
|
||||
#define CFI_BLOCK_UNLOCK_CONFIRM 0xD0
|
||||
#define CFI_QUERY 0x98
|
||||
|
||||
//
|
||||
// BugBug: Add documentation here for data structure!!!!
|
||||
//
|
||||
#define FVB_PHYSICAL 0
|
||||
#define FVB_VIRTUAL 1
|
||||
|
||||
typedef struct {
|
||||
EFI_LOCK FvbDevLock;
|
||||
UINTN FvBase[2];
|
||||
UINTN FvWriteBase[2];
|
||||
UINTN NumOfBlocks;
|
||||
BOOLEAN WriteEnabled;
|
||||
EFI_FIRMWARE_VOLUME_HEADER VolumeHeader;
|
||||
} EFI_FW_VOL_INSTANCE;
|
||||
|
||||
typedef struct {
|
||||
UINT32 NumFv;
|
||||
EFI_FW_VOL_INSTANCE *FvInstance[2];
|
||||
UINT8 *FvbScratchSpace[2];
|
||||
} ESAL_FWB_GLOBAL;
|
||||
|
||||
//
|
||||
// Fvb Protocol instance data
|
||||
//
|
||||
#define FVB_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
|
||||
#define FVB_EXTEND_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE, FvbExtension, FVB_DEVICE_SIGNATURE)
|
||||
#define FVB_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('F', 'V', 'B', 'C')
|
||||
|
||||
typedef struct {
|
||||
MEMMAP_DEVICE_PATH MemMapDevPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevPath;
|
||||
} FV_DEVICE_PATH;
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
FV_DEVICE_PATH DevicePath;
|
||||
UINTN Instance;
|
||||
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
|
||||
EFI_FVB_EXTENSION_PROTOCOL FvbExtension;
|
||||
} EFI_FW_VOL_BLOCK_DEVICE;
|
||||
|
||||
EFI_STATUS
|
||||
GetFvbInfo (
|
||||
IN EFI_PHYSICAL_ADDRESS FvBaseAddress,
|
||||
OUT EFI_FIRMWARE_VOLUME_HEADER **FvbInfo
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EnableFvbWrites (
|
||||
IN BOOLEAN EnableWrites
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PlatformGetFvbWriteBase (
|
||||
IN UINTN CurrentBaseAddress,
|
||||
IN UINTN *NewBaseAddress,
|
||||
IN BOOLEAN *WriteEnabled
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EnablePlatformFvb (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
SetPlatformFvbLock (
|
||||
IN UINTN LbaAddress
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbReadBlock (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BlockOffset,
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN UINT8 *Buffer,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbWriteBlock (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BlockOffset,
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN UINT8 *Buffer,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbEraseBlock (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA Lba,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbSetVolumeAttributes (
|
||||
IN UINTN Instance,
|
||||
IN OUT EFI_FVB_ATTRIBUTES *Attributes,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbGetVolumeAttributes (
|
||||
IN UINTN Instance,
|
||||
OUT EFI_FVB_ATTRIBUTES *Attributes,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbGetPhysicalAddress (
|
||||
IN UINTN Instance,
|
||||
OUT EFI_PHYSICAL_ADDRESS *Address,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
FvbClassAddressChangeEvent (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbSpecificInitialize (
|
||||
IN ESAL_FWB_GLOBAL *mFvbModuleGlobal
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbGetLbaAddress (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA Lba,
|
||||
OUT UINTN *LbaAddress,
|
||||
OUT UINTN *LbaWriteAddress,
|
||||
OUT UINTN *LbaLength,
|
||||
OUT UINTN *NumOfBlocks,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbEraseCustomBlockRange (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINTN OffsetStartLba,
|
||||
IN EFI_LBA LastLba,
|
||||
IN UINTN OffsetLastLba,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
//
|
||||
// Protocol APIs
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolGetAttributes (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
OUT EFI_FVB_ATTRIBUTES *Attributes
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolSetAttributes (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
IN OUT EFI_FVB_ATTRIBUTES *Attributes
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolGetPhysicalAddress (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
OUT EFI_PHYSICAL_ADDRESS *Address
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolGetBlockSize (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
IN EFI_LBA Lba,
|
||||
OUT UINTN *BlockSize,
|
||||
OUT UINTN *NumOfBlocks
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolRead (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN Offset,
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN UINT8 *Buffer
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolWrite (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN Offset,
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN UINT8 *Buffer
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolEraseBlocks (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbExtendProtocolEraseCustomBlockRange (
|
||||
IN EFI_FVB_EXTENSION_PROTOCOL *This,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINTN OffsetStartLba,
|
||||
IN EFI_LBA LastLba,
|
||||
IN UINTN OffsetLastLba
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
42
EdkNt32Pkg/RuntimeDxe/FvbServices/Common/ia32/Ia32Fwh.c
Normal file
42
EdkNt32Pkg/RuntimeDxe/FvbServices/Common/ia32/Ia32Fwh.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, 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.
|
||||
|
||||
Module Name:
|
||||
|
||||
Ia32Fwh.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "FWBlockService.h"
|
||||
|
||||
EFI_STATUS
|
||||
FvbSpecificInitialize (
|
||||
IN ESAL_FWB_GLOBAL *mFvbModuleGlobal
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Additional initialize code for IA32 platform.
|
||||
|
||||
Arguments:
|
||||
ESAL_FWB_GLOBAL - Global pointer that points to the instance data
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
27
EdkNt32Pkg/RuntimeDxe/FvbServices/Nt32Fwh.dxs
Normal file
27
EdkNt32Pkg/RuntimeDxe/FvbServices/Nt32Fwh.dxs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, 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.
|
||||
|
||||
Module Name:
|
||||
|
||||
Nt32Fwh.dxs
|
||||
|
||||
Abstract:
|
||||
|
||||
Dependency expression source file.
|
||||
|
||||
--*/
|
||||
#include <AutoGen.h>
|
||||
#include <DxeDepex.h>
|
||||
|
||||
|
||||
DEPENDENCY_START
|
||||
TRUE
|
||||
DEPENDENCY_END
|
47
EdkNt32Pkg/RuntimeDxe/FvbServices/Nt32Fwh.mbd
Normal file
47
EdkNt32Pkg/RuntimeDxe/FvbServices/Nt32Fwh.mbd
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, 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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>FwBlockService</BaseName>
|
||||
<Guid>BDFE5FAA-2A35-44bb-B17A-8084D4E2B9E9</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, 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>
|
||||
<Created>2006-03-14 17:04</Created>
|
||||
<Modified>2006-03-19 15:17</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>BaseMemoryLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>DxeServicesTableLib</Library>
|
||||
<Library>BaseDebugLibNull</Library>
|
||||
<Library>EdkDxePrintLib</Library>
|
||||
<Library>EdkDxeRuntimeDriverLib</Library>
|
||||
<Library>DxeHobLib</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
</Libraries>
|
||||
<BuildOptions ToolChain="MSFT">
|
||||
<ImageEntryPoint>_ModuleEntryPoint</ImageEntryPoint>
|
||||
</BuildOptions>
|
||||
</ModuleBuildDescription>
|
89
EdkNt32Pkg/RuntimeDxe/FvbServices/Nt32Fwh.msa
Normal file
89
EdkNt32Pkg/RuntimeDxe/FvbServices/Nt32Fwh.msa
Normal file
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, 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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>FwBlockService</BaseName>
|
||||
<ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
|
||||
<ComponentType>RT_DRIVER</ComponentType>
|
||||
<Guid>BDFE5FAA-2A35-44bb-B17A-8084D4E2B9E9</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for DiskIo module.</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, 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>0</Specification>
|
||||
<Created>2006-03-14 17:04</Created>
|
||||
<Updated>2006-03-19 15:17</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DxeServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DxeRuntimeDriverLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">HobLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>Nt32Fwh.dxs</Filename>
|
||||
<Arch ArchType="IA32">
|
||||
<Filename>nt32\FwBlockService.c</Filename>
|
||||
<Filename>nt32\FwBlockService.h</Filename>
|
||||
<Filename>nt32\FvbInfo.c</Filename>
|
||||
</Arch>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
<PackageName>EdkModulePkg</PackageName>
|
||||
<PackageName>EdkNt32Pkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="SOMETIMES_PRODUCED">DevicePath</Protocol>
|
||||
<Protocol Usage="SOMETIMES_PRODUCED">FirmwareVolumeBlock</Protocol>
|
||||
<Protocol Usage="ALWAYS_PRODUCED">FvbExtension</Protocol>
|
||||
</Protocols>
|
||||
<Events>
|
||||
<CreateEvents>
|
||||
<Event Usage="ALWAYS_CONSUMED" EventGroup="EVENT_GROUP_VIRTUAL_ADDRESS_CHANGE">
|
||||
<C_Name>gEfiEventVirtualAddressChangeGuid</C_Name>
|
||||
<Guid>0x13fa7698, 0xc831, 0x49c7, 0x87, 0xea, 0x8f, 0x43, 0xfc, 0xc2, 0x51, 0x96</Guid>
|
||||
</Event>
|
||||
</CreateEvents>
|
||||
</Events>
|
||||
<Hobs>
|
||||
<Hob Usage="ALWAYS_CONSUMED" HobType="FIRMWARE_VOLUME"></Hob>
|
||||
</Hobs>
|
||||
<Guids>
|
||||
<GuidEntry Usage="ALWAYS_PRODUCED">
|
||||
<C_Name>AlternateFvBlock</C_Name>
|
||||
</GuidEntry>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>FvbInitialize</ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<SetVirtualAddressMapCallBack></SetVirtualAddressMapCallBack>
|
||||
<ExitBootServicesCallBack></ExitBootServicesCallBack>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
47
EdkNt32Pkg/RuntimeDxe/FvbServices/build.xml
Normal file
47
EdkNt32Pkg/RuntimeDxe/FvbServices/build.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, 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.-->
|
||||
<project basedir="." default="FwBlockService"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="RuntimeDxe\FvbServices"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="FwBlockService">
|
||||
<GenBuild baseName="FwBlockService" mbdFilename="${MODULE_DIR}\Nt32Fwh.mbd" msaFilename="${MODULE_DIR}\Nt32Fwh.msa"/>
|
||||
</target>
|
||||
<target depends="FwBlockService_clean" name="clean"/>
|
||||
<target depends="FwBlockService_cleanall" name="cleanall"/>
|
||||
<target name="FwBlockService_clean">
|
||||
<OutputDirSetup baseName="FwBlockService" mbdFilename="${MODULE_DIR}\Nt32Fwh.mbd" msaFilename="${MODULE_DIR}\Nt32Fwh.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\FwBlockService_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\FwBlockService_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="FwBlockService_cleanall">
|
||||
<OutputDirSetup baseName="FwBlockService" mbdFilename="${MODULE_DIR}\Nt32Fwh.mbd" msaFilename="${MODULE_DIR}\Nt32Fwh.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\FwBlockService_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\FwBlockService_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**FwBlockService*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
1493
EdkNt32Pkg/RuntimeDxe/FvbServices/nt32/FWBlockService.c
Normal file
1493
EdkNt32Pkg/RuntimeDxe/FvbServices/nt32/FWBlockService.c
Normal file
File diff suppressed because it is too large
Load Diff
125
EdkNt32Pkg/RuntimeDxe/FvbServices/nt32/FvbInfo.c
Normal file
125
EdkNt32Pkg/RuntimeDxe/FvbServices/nt32/FvbInfo.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, 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.
|
||||
|
||||
Module Name:
|
||||
|
||||
FvbInfo.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Defines data structure that is the volume header found.These data is intent
|
||||
to decouple FVB driver with FV header.
|
||||
|
||||
--*/
|
||||
|
||||
#include "FlashLayout.h"
|
||||
|
||||
#define FIRMWARE_BLOCK_SIZE 0x10000
|
||||
|
||||
typedef struct {
|
||||
UINT64 FvLength;
|
||||
EFI_FIRMWARE_VOLUME_HEADER FvbInfo;
|
||||
//
|
||||
// EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
|
||||
//
|
||||
EFI_FV_BLOCK_MAP_ENTRY End[1];
|
||||
} EFI_FVB_MEDIA_INFO;
|
||||
|
||||
#define FVB_MEDIA_BLOCK_SIZE FIRMWARE_BLOCK_SIZE
|
||||
#define RECOVERY_BOIS_BLOCK_NUM FIRMWARE_BLOCK_NUMBER
|
||||
#define SYSTEM_NV_BLOCK_NUM 2
|
||||
|
||||
EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo[] = {
|
||||
//
|
||||
// Recovery BOIS FVB
|
||||
//
|
||||
{
|
||||
EFI_WINNT_FIRMWARE_LENGTH,
|
||||
{
|
||||
{
|
||||
0,
|
||||
}, // ZeroVector[16]
|
||||
EFI_FIRMWARE_FILE_SYSTEM_GUID,
|
||||
FVB_MEDIA_BLOCK_SIZE * RECOVERY_BOIS_BLOCK_NUM,
|
||||
EFI_FVH_SIGNATURE,
|
||||
EFI_FVB_READ_ENABLED_CAP |
|
||||
EFI_FVB_READ_STATUS |
|
||||
EFI_FVB_WRITE_ENABLED_CAP |
|
||||
EFI_FVB_WRITE_STATUS |
|
||||
EFI_FVB_ERASE_POLARITY,
|
||||
sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),
|
||||
0, // CheckSum
|
||||
{
|
||||
0,
|
||||
}, // Reserved[3]
|
||||
1, // Revision
|
||||
{
|
||||
RECOVERY_BOIS_BLOCK_NUM,
|
||||
FVB_MEDIA_BLOCK_SIZE,
|
||||
}
|
||||
},
|
||||
{
|
||||
0,
|
||||
0
|
||||
}
|
||||
},
|
||||
//
|
||||
// Systen NvStorage FVB
|
||||
//
|
||||
{
|
||||
EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,
|
||||
{
|
||||
{
|
||||
0,
|
||||
}, // ZeroVector[16]
|
||||
EFI_SYSTEM_NV_DATA_HOB_GUID,
|
||||
FVB_MEDIA_BLOCK_SIZE * SYSTEM_NV_BLOCK_NUM,
|
||||
EFI_FVH_SIGNATURE,
|
||||
EFI_FVB_READ_ENABLED_CAP |
|
||||
EFI_FVB_READ_STATUS |
|
||||
EFI_FVB_WRITE_ENABLED_CAP |
|
||||
EFI_FVB_WRITE_STATUS |
|
||||
EFI_FVB_ERASE_POLARITY,
|
||||
sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),
|
||||
0, // CheckSum
|
||||
{
|
||||
0,
|
||||
}, // Reserved[3]
|
||||
1, // Revision
|
||||
{
|
||||
SYSTEM_NV_BLOCK_NUM,
|
||||
FVB_MEDIA_BLOCK_SIZE,
|
||||
}
|
||||
},
|
||||
{
|
||||
0,
|
||||
0
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
GetFvbInfo (
|
||||
IN UINT64 FvLength,
|
||||
OUT EFI_FIRMWARE_VOLUME_HEADER **FvbInfo
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
for (Index = 0; Index < sizeof (mPlatformFvbMediaInfo) / sizeof (EFI_FVB_MEDIA_INFO); Index += 1) {
|
||||
if (mPlatformFvbMediaInfo[Index].FvLength == FvLength) {
|
||||
*FvbInfo = &mPlatformFvbMediaInfo[Index].FvbInfo;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
238
EdkNt32Pkg/RuntimeDxe/FvbServices/nt32/FwBlockService.h
Normal file
238
EdkNt32Pkg/RuntimeDxe/FvbServices/nt32/FwBlockService.h
Normal file
@@ -0,0 +1,238 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, 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.
|
||||
|
||||
Module Name:
|
||||
|
||||
FwBlockService.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Firmware volume block driver for Intel Firmware Hub (FWH) device
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _FW_BLOCK_SERVICE_H
|
||||
#define _FW_BLOCK_SERVICE_H
|
||||
|
||||
//
|
||||
// BugBug: Add documentation here for data structure!!!!
|
||||
//
|
||||
#define FVB_PHYSICAL 0
|
||||
#define FVB_VIRTUAL 1
|
||||
|
||||
typedef struct {
|
||||
EFI_LOCK FvbDevLock;
|
||||
UINTN FvBase[2];
|
||||
UINTN NumOfBlocks;
|
||||
EFI_FIRMWARE_VOLUME_HEADER VolumeHeader;
|
||||
} EFI_FW_VOL_INSTANCE;
|
||||
|
||||
typedef struct {
|
||||
UINT32 NumFv;
|
||||
EFI_FW_VOL_INSTANCE *FvInstance[2];
|
||||
UINT8 *FvbScratchSpace[2];
|
||||
} ESAL_FWB_GLOBAL;
|
||||
|
||||
//
|
||||
// Fvb Protocol instance data
|
||||
//
|
||||
#define FVB_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
|
||||
#define FVB_EXTEND_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE, FvbExtension, FVB_DEVICE_SIGNATURE)
|
||||
#define FVB_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('F', 'V', 'B', 'N')
|
||||
|
||||
typedef struct {
|
||||
MEMMAP_DEVICE_PATH MemMapDevPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevPath;
|
||||
} FV_DEVICE_PATH;
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
FV_DEVICE_PATH DevicePath;
|
||||
UINTN Instance;
|
||||
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
|
||||
EFI_FVB_EXTENSION_PROTOCOL FvbExtension;
|
||||
} EFI_FW_VOL_BLOCK_DEVICE;
|
||||
|
||||
EFI_STATUS
|
||||
GetFvbInfo (
|
||||
IN UINT64 FvLength,
|
||||
OUT EFI_FIRMWARE_VOLUME_HEADER **FvbInfo
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbReadBlock (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BlockOffset,
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN UINT8 *Buffer,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbWriteBlock (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BlockOffset,
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN UINT8 *Buffer,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbEraseBlock (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA Lba,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbSetVolumeAttributes (
|
||||
IN UINTN Instance,
|
||||
IN OUT EFI_FVB_ATTRIBUTES *Attributes,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbGetVolumeAttributes (
|
||||
IN UINTN Instance,
|
||||
OUT EFI_FVB_ATTRIBUTES *Attributes,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbGetPhysicalAddress (
|
||||
IN UINTN Instance,
|
||||
OUT EFI_PHYSICAL_ADDRESS *Address,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
FvbClassAddressChangeEvent (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FvbGetLbaAddress (
|
||||
IN UINTN Instance,
|
||||
IN EFI_LBA Lba,
|
||||
OUT UINTN *LbaAddress,
|
||||
OUT UINTN *LbaLength,
|
||||
OUT UINTN *NumOfBlocks,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
;
|
||||
|
||||
//
|
||||
// Protocol APIs
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolGetAttributes (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
OUT EFI_FVB_ATTRIBUTES *Attributes
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolSetAttributes (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
IN OUT EFI_FVB_ATTRIBUTES *Attributes
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolGetPhysicalAddress (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
OUT EFI_PHYSICAL_ADDRESS *Address
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolGetBlockSize (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
IN EFI_LBA Lba,
|
||||
OUT UINTN *BlockSize,
|
||||
OUT UINTN *NumOfBlocks
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolRead (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN Offset,
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN UINT8 *Buffer
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolWrite (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN Offset,
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN UINT8 *Buffer
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolEraseBlocks (
|
||||
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbExtendProtocolEraseCustomBlockRange (
|
||||
IN EFI_FVB_EXTENSION_PROTOCOL *This,
|
||||
IN EFI_LBA StartLba,
|
||||
IN UINTN OffsetStartLba,
|
||||
IN EFI_LBA LastLba,
|
||||
IN UINTN OffsetLastLba
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user