mirror of https://github.com/acidanthera/audk.git
Nt32Pkg: Remove it
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1812 Now since EmulatorPkg supports to run in Windows environment, this patch removes Nt32Pkg to remove duplicate code in edk2 repo. Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
4d5d781278
commit
7afa0cea8f
|
@ -1,95 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
BootMode.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Tiano PEIM to provide the platform support functionality within Windows
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <PiPei.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Ppi/MasterBootMode.h>
|
||||
#include <Ppi/BootInRecoveryMode.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PeimEntryPoint.h>
|
||||
|
||||
|
||||
//
|
||||
// Module globals
|
||||
//
|
||||
EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {
|
||||
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||
&gEfiPeiMasterBootModePpiGuid,
|
||||
NULL
|
||||
};
|
||||
|
||||
EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {
|
||||
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||
&gEfiPeiBootInRecoveryModePpiGuid,
|
||||
NULL
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeBootMode (
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Peform the boot mode determination logic
|
||||
|
||||
Arguments:
|
||||
|
||||
FileHandle - Handle of the file being invoked.
|
||||
PeiServices - Describes the list of possible PEI Services.
|
||||
|
||||
Returns:
|
||||
|
||||
Status - EFI_SUCCESS if the boot mode could be set
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN BootMode;
|
||||
|
||||
DEBUG ((EFI_D_ERROR, "NT32 Boot Mode PEIM Loaded\n"));
|
||||
|
||||
//
|
||||
// Let's assume things are OK if not told otherwise
|
||||
// Should we read an environment variable in order to easily change this?
|
||||
//
|
||||
BootMode = BOOT_WITH_FULL_CONFIGURATION;
|
||||
|
||||
Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
if (BootMode == BOOT_IN_RECOVERY_MODE) {
|
||||
Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
## @file
|
||||
# Component description file for BootMode module
|
||||
#
|
||||
# This module provides platform specific function to detect boot mode.
|
||||
# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = BootMode
|
||||
FILE_GUID = B7611005-1F26-45ba-A3DB-01F39DDB2785
|
||||
MODULE_TYPE = PEIM
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = InitializeBootMode
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 EBC
|
||||
#
|
||||
|
||||
[Sources]
|
||||
BootModePei.c
|
||||
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
PeimEntryPoint
|
||||
DebugLib
|
||||
|
||||
|
||||
[Ppis]
|
||||
gEfiPeiMasterBootModePpiGuid # PPI ALWAYS_PRODUCED
|
||||
gEfiPeiBootInRecoveryModePpiGuid # PPI SOMETIMES_PRODUCED
|
||||
|
||||
[depex]
|
||||
TRUE
|
|
@ -1,547 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
Cpu.c
|
||||
|
||||
Abstract:
|
||||
|
||||
NT Emulation Architectural Protocol Driver as defined in Tiano.
|
||||
This CPU module abstracts the interrupt subsystem of a platform and
|
||||
the CPU-specific setjump/long pair. Other services are not implemented
|
||||
in this driver.
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "CpuDriver.h"
|
||||
|
||||
UINT64 mTimerPeriod;
|
||||
|
||||
CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
|
||||
CPU_ARCH_PROT_PRIVATE_SIGNATURE,
|
||||
NULL,
|
||||
{
|
||||
WinNtFlushCpuDataCache,
|
||||
WinNtEnableInterrupt,
|
||||
WinNtDisableInterrupt,
|
||||
WinNtGetInterruptState,
|
||||
WinNtInit,
|
||||
WinNtRegisterInterruptHandler,
|
||||
WinNtGetTimerValue,
|
||||
WinNtSetMemoryAttributes,
|
||||
1,
|
||||
4
|
||||
},
|
||||
{
|
||||
CpuMemoryServiceRead,
|
||||
CpuMemoryServiceWrite,
|
||||
CpuIoServiceRead,
|
||||
CpuIoServiceWrite
|
||||
},
|
||||
0,
|
||||
TRUE
|
||||
};
|
||||
|
||||
#define EFI_CPU_DATA_MAXIMUM_LENGTH 0x100
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Service routines for the driver
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtFlushCpuDataCache (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||
IN EFI_PHYSICAL_ADDRESS Start,
|
||||
IN UINT64 Length,
|
||||
IN EFI_CPU_FLUSH_TYPE FlushType
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine would provide support for flushing the CPU data cache.
|
||||
In the case of NT emulation environment, this flushing is not necessary and
|
||||
is thus not implemented.
|
||||
|
||||
Arguments:
|
||||
|
||||
Pointer to CPU Architectural Protocol interface
|
||||
Start adddress in memory to flush
|
||||
Length of memory to flush
|
||||
Flush type
|
||||
|
||||
Returns:
|
||||
|
||||
Status
|
||||
EFI_SUCCESS
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: FlushType - add argument and description to function comment
|
||||
// TODO: EFI_UNSUPPORTED - add return value to function comment
|
||||
{
|
||||
if (FlushType == EfiCpuFlushTypeWriteBackInvalidate) {
|
||||
//
|
||||
// Only WB flush is supported. We actually need do nothing on NT emulator
|
||||
// environment. Classify this to follow EFI spec
|
||||
//
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
//
|
||||
// Other flush types are not supported by NT emulator
|
||||
//
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtEnableInterrupt (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine provides support for emulation of the interrupt enable of the
|
||||
the system. For our purposes, CPU enable is just a BOOLEAN that the Timer
|
||||
Architectural Protocol observes in order to defer behaviour while in its
|
||||
emulated interrupt, or timer tick.
|
||||
|
||||
Arguments:
|
||||
|
||||
Pointer to CPU Architectural Protocol interface
|
||||
|
||||
Returns:
|
||||
|
||||
Status
|
||||
EFI_SUCCESS
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
{
|
||||
CPU_ARCH_PROTOCOL_PRIVATE *Private;
|
||||
|
||||
Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
|
||||
Private->InterruptState = TRUE;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtDisableInterrupt (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine provides support for emulation of the interrupt disable of the
|
||||
the system. For our purposes, CPU enable is just a BOOLEAN that the Timer
|
||||
Architectural Protocol observes in order to defer behaviour while in its
|
||||
emulated interrupt, or timer tick.
|
||||
|
||||
Arguments:
|
||||
|
||||
Pointer to CPU Architectural Protocol interface
|
||||
|
||||
Returns:
|
||||
|
||||
Status
|
||||
EFI_SUCCESS
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
{
|
||||
CPU_ARCH_PROTOCOL_PRIVATE *Private;
|
||||
|
||||
Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
|
||||
Private->InterruptState = FALSE;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtGetInterruptState (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||
OUT BOOLEAN *State
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine provides support for emulation of the interrupt disable of the
|
||||
the system. For our purposes, CPU enable is just a BOOLEAN that the Timer
|
||||
Architectural Protocol observes in order to defer behaviour while in its
|
||||
emulated interrupt, or timer tick.
|
||||
|
||||
Arguments:
|
||||
|
||||
Pointer to CPU Architectural Protocol interface
|
||||
|
||||
Returns:
|
||||
|
||||
Status
|
||||
EFI_SUCCESS
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: State - add argument and description to function comment
|
||||
// TODO: EFI_INVALID_PARAMETER - add return value to function comment
|
||||
{
|
||||
CPU_ARCH_PROTOCOL_PRIVATE *Private;
|
||||
|
||||
if (State == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
|
||||
*State = Private->InterruptState;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtInit (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||
IN EFI_CPU_INIT_TYPE InitType
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine would support generation of a CPU INIT. At
|
||||
present, this code does not provide emulation.
|
||||
|
||||
Arguments:
|
||||
|
||||
Pointer to CPU Architectural Protocol interface
|
||||
INIT Type
|
||||
|
||||
Returns:
|
||||
|
||||
Status
|
||||
EFI_UNSUPPORTED - not yet implemented
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: InitType - add argument and description to function comment
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtRegisterInterruptHandler (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||
IN EFI_EXCEPTION_TYPE InterruptType,
|
||||
IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine would support registration of an interrupt handler. At
|
||||
present, this code does not provide emulation.
|
||||
|
||||
Arguments:
|
||||
|
||||
Pointer to CPU Architectural Protocol interface
|
||||
Pointer to interrupt handlers
|
||||
Interrupt type
|
||||
|
||||
Returns:
|
||||
|
||||
Status
|
||||
EFI_UNSUPPORTED - not yet implemented
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: InterruptType - add argument and description to function comment
|
||||
// TODO: InterruptHandler - add argument and description to function comment
|
||||
{
|
||||
|
||||
//
|
||||
// Do parameter checking for EFI spec conformance
|
||||
//
|
||||
if (InterruptType < 0 || InterruptType > 0xff) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
//
|
||||
// Do nothing for Nt32 emulation
|
||||
//
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtGetTimerValue (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||
IN UINT32 TimerIndex,
|
||||
OUT UINT64 *TimerValue,
|
||||
OUT UINT64 *TimerPeriod OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine would support querying of an on-CPU timer. At present,
|
||||
this code does not provide timer emulation.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to CPU Architectural Protocol interface
|
||||
TimerIndex - Index of given CPU timer
|
||||
TimerValue - Output of the timer
|
||||
TimerPeriod - Output of the timer period
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_UNSUPPORTED - not yet implemented
|
||||
EFI_INVALID_PARAMETER - TimeValue is NULL
|
||||
|
||||
--*/
|
||||
{
|
||||
if (TimerValue == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (TimerIndex != 0) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
gWinNt->QueryPerformanceCounter ((LARGE_INTEGER *)TimerValue);
|
||||
|
||||
if (TimerPeriod != NULL) {
|
||||
*TimerPeriod = mTimerPeriod;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSetMemoryAttributes (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
||||
IN UINT64 Length,
|
||||
IN UINT64 Attributes
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine would support querying of an on-CPU timer. At present,
|
||||
this code does not provide timer emulation.
|
||||
|
||||
Arguments:
|
||||
|
||||
Pointer to CPU Architectural Protocol interface
|
||||
Start address of memory region
|
||||
The size in bytes of the memory region
|
||||
The bit mask of attributes to set for the memory region
|
||||
|
||||
Returns:
|
||||
|
||||
Status
|
||||
EFI_UNSUPPORTED - not yet implemented
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: BaseAddress - add argument and description to function comment
|
||||
// TODO: Length - add argument and description to function comment
|
||||
// TODO: Attributes - add argument and description to function comment
|
||||
// TODO: EFI_INVALID_PARAMETER - add return value to function comment
|
||||
{
|
||||
//
|
||||
// Check for invalid parameter for Spec conformance
|
||||
//
|
||||
if (Length == 0) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Do nothing for Nt32 emulation
|
||||
//
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Logs SMBIOS record.
|
||||
|
||||
@param Smbios Pointer to SMBIOS protocol instance.
|
||||
@param Buffer Pointer to the data buffer.
|
||||
|
||||
**/
|
||||
VOID
|
||||
LogSmbiosData (
|
||||
IN EFI_SMBIOS_PROTOCOL *Smbios,
|
||||
IN UINT8 *Buffer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
|
||||
SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
|
||||
Status = Smbios->Add (
|
||||
Smbios,
|
||||
NULL,
|
||||
&SmbiosHandle,
|
||||
(EFI_SMBIOS_TABLE_HEADER*)Buffer
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
CpuUpdateSmbios (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This function will log processor version and frequency data to Smbios.
|
||||
|
||||
Arguments:
|
||||
Event - Event whose notification function is being invoked.
|
||||
Context - Pointer to the notification function's context.
|
||||
|
||||
Returns:
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32 TotalSize;
|
||||
EFI_SMBIOS_PROTOCOL *Smbios;
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
STRING_REF Token;
|
||||
UINTN CpuVerStrLen;
|
||||
EFI_STRING CpuVerStr;
|
||||
SMBIOS_TABLE_TYPE4 *SmbiosRecord;
|
||||
CHAR8 *OptionalStrStart;
|
||||
|
||||
//
|
||||
// Locate Smbios protocol.
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)&Smbios);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize strings to HII database
|
||||
//
|
||||
HiiHandle = HiiAddPackages (
|
||||
&gEfiCallerIdGuid,
|
||||
NULL,
|
||||
CpuStrings,
|
||||
NULL
|
||||
);
|
||||
ASSERT (HiiHandle != NULL);
|
||||
|
||||
Token = STRING_TOKEN (STR_PROCESSOR_VERSION);
|
||||
CpuVerStr = HiiGetPackageString(&gEfiCallerIdGuid, Token, NULL);
|
||||
CpuVerStrLen = StrLen(CpuVerStr);
|
||||
ASSERT (CpuVerStrLen <= SMBIOS_STRING_MAX_LENGTH);
|
||||
|
||||
|
||||
TotalSize = (UINT32)(sizeof(SMBIOS_TABLE_TYPE4) + CpuVerStrLen + 1 + 1);
|
||||
SmbiosRecord = AllocatePool(TotalSize);
|
||||
ZeroMem(SmbiosRecord, TotalSize);
|
||||
|
||||
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION;
|
||||
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE4);
|
||||
//
|
||||
// Make handle chosen by smbios protocol.add automatically.
|
||||
//
|
||||
SmbiosRecord->Hdr.Handle = 0;
|
||||
//
|
||||
// Processor version is the 1st string.
|
||||
//
|
||||
SmbiosRecord->ProcessorVersion = 1;
|
||||
//
|
||||
// Store CPU frequency data record to data hub - It's an emulator so make up a value
|
||||
//
|
||||
SmbiosRecord->CurrentSpeed = 1234;
|
||||
|
||||
OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
|
||||
UnicodeStrToAsciiStr(CpuVerStr, OptionalStrStart);
|
||||
|
||||
//
|
||||
// Now we have got the full smbios record, call smbios protocol to add this record.
|
||||
//
|
||||
LogSmbiosData(Smbios, (UINT8 *) SmbiosRecord);
|
||||
FreePool (SmbiosRecord);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeCpu (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize the state information for the CPU Architectural Protocol
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle of the loaded driver
|
||||
Pointer to the System Table
|
||||
|
||||
Returns:
|
||||
|
||||
Status
|
||||
|
||||
EFI_SUCCESS - protocol instance can be published
|
||||
EFI_OUT_OF_RESOURCES - cannot allocate protocol data structure
|
||||
EFI_DEVICE_ERROR - cannot create the thread
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT64 Frequency;
|
||||
|
||||
//
|
||||
// Retrieve the frequency of the performance counter in Hz.
|
||||
//
|
||||
gWinNt->QueryPerformanceFrequency ((LARGE_INTEGER *)&Frequency);
|
||||
|
||||
//
|
||||
// Convert frequency in Hz to a clock period in femtoseconds.
|
||||
//
|
||||
mTimerPeriod = DivU64x64Remainder (1000000000000000, Frequency, NULL);
|
||||
|
||||
CpuUpdateSmbios ();
|
||||
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mCpuTemplate.Handle,
|
||||
&gEfiCpuArchProtocolGuid, &mCpuTemplate.Cpu,
|
||||
&gEfiCpuIo2ProtocolGuid, &mCpuTemplate.CpuIo,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
|
@ -1,182 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
CpuDriver.h
|
||||
|
||||
Abstract:
|
||||
|
||||
NT Emulation Architectural Protocol Driver as defined in Tiano.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
|
||||
#define _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
|
||||
|
||||
|
||||
#include <FrameworkDxe.h>
|
||||
#include <IndustryStandard/SmBios.h>
|
||||
#include <Protocol/Cpu.h>
|
||||
#include <Protocol/Smbios.h>
|
||||
#include <Protocol/FrameworkHii.h>
|
||||
#include <Guid/DataHubRecords.h>
|
||||
#include <Protocol/CpuIo2.h>
|
||||
#include <Protocol/WinNtIo.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/HiiLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/WinNtLib.h>
|
||||
|
||||
|
||||
extern UINT8 CpuStrings[];
|
||||
|
||||
//
|
||||
// Internal Data Structures
|
||||
//
|
||||
#define CPU_ARCH_PROT_PRIVATE_SIGNATURE SIGNATURE_32 ('c', 'a', 'p', 'd')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
EFI_CPU_ARCH_PROTOCOL Cpu;
|
||||
EFI_CPU_IO2_PROTOCOL CpuIo;
|
||||
|
||||
//
|
||||
// Local Data for CPU interface goes here
|
||||
//
|
||||
CRITICAL_SECTION NtCriticalSection;
|
||||
BOOLEAN InterruptState;
|
||||
|
||||
} CPU_ARCH_PROTOCOL_PRIVATE;
|
||||
|
||||
#define CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS(a) \
|
||||
CR (a, \
|
||||
CPU_ARCH_PROTOCOL_PRIVATE, \
|
||||
Cpu, \
|
||||
CPU_ARCH_PROT_PRIVATE_SIGNATURE \
|
||||
)
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CpuMemoryServiceRead (
|
||||
IN EFI_CPU_IO2_PROTOCOL *This,
|
||||
IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT64 Address,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CpuMemoryServiceWrite (
|
||||
IN EFI_CPU_IO2_PROTOCOL *This,
|
||||
IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT64 Address,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CpuIoServiceRead (
|
||||
IN EFI_CPU_IO2_PROTOCOL *This,
|
||||
IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT64 UserAddress,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *UserBuffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CpuIoServiceWrite (
|
||||
IN EFI_CPU_IO2_PROTOCOL *This,
|
||||
IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT64 UserAddress,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *UserBuffer
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeCpu (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtFlushCpuDataCache (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||
IN EFI_PHYSICAL_ADDRESS Start,
|
||||
IN UINT64 Length,
|
||||
IN EFI_CPU_FLUSH_TYPE FlushType
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtEnableInterrupt (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtDisableInterrupt (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtGetInterruptState (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||
OUT BOOLEAN *State
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtInit (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||
IN EFI_CPU_INIT_TYPE InitType
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtRegisterInterruptHandler (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||
IN EFI_EXCEPTION_TYPE InterruptType,
|
||||
IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtGetTimerValue (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||
IN UINT32 TimerIndex,
|
||||
OUT UINT64 *TimerValue,
|
||||
OUT UINT64 *TimerPeriod OPTIONAL
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSetMemoryAttributes (
|
||||
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
||||
IN UINT64 Length,
|
||||
IN UINT64 Attributes
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,335 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
CpuIo.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This is the code that publishes the CPU I/O Protocol.
|
||||
The intent herein is to have a single I/O service that can load
|
||||
as early as possible, extend into runtime, and be layered upon by
|
||||
the implementations of architectural protocols and the PCI Root
|
||||
Bridge I/O Protocol.
|
||||
|
||||
**/
|
||||
|
||||
#include <CpuDriver.h>
|
||||
|
||||
#define IA32_MAX_IO_ADDRESS 0xFFFF
|
||||
#define IA32_MAX_MEM_ADDRESS 0xFFFFFFFF
|
||||
|
||||
EFI_STATUS
|
||||
CpuIoCheckAddressRange (
|
||||
IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT64 Address,
|
||||
IN UINTN Count,
|
||||
IN VOID *Buffer,
|
||||
IN UINT64 Limit
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CpuMemoryServiceRead (
|
||||
IN EFI_CPU_IO2_PROTOCOL *This,
|
||||
IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT64 Address,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Perform the Memory Access Read service for the CPU I/O Protocol
|
||||
|
||||
Arguments:
|
||||
|
||||
Pointer to an instance of the CPU I/O Protocol
|
||||
Width of the Memory Access
|
||||
Address of the Memory access
|
||||
Count of the number of accesses to perform
|
||||
Pointer to the buffer to read or write from memory
|
||||
|
||||
Returns:
|
||||
|
||||
Status
|
||||
|
||||
EFI_SUCCESS - The data was read from or written to the EFI
|
||||
System.
|
||||
EFI_INVALID_PARAMETER - Width is invalid for this EFI System.
|
||||
EFI_INVALID_PARAMETER - Buffer is NULL.
|
||||
EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
|
||||
EFI_UNSUPPORTED - The address range specified by Address, Width,
|
||||
and Count is not valid for this EFI System.
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (!Buffer) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Do nothing for Nt32 version
|
||||
//
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CpuMemoryServiceWrite (
|
||||
IN EFI_CPU_IO2_PROTOCOL *This,
|
||||
IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT64 Address,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Perform the Memory Access Read service for the CPU I/O Protocol
|
||||
|
||||
Arguments:
|
||||
|
||||
Pointer to an instance of the CPU I/O Protocol
|
||||
Width of the Memory Access
|
||||
Address of the Memory access
|
||||
Count of the number of accesses to perform
|
||||
Pointer to the buffer to read or write from memory
|
||||
|
||||
Returns:
|
||||
|
||||
Status
|
||||
|
||||
EFI_SUCCESS - The data was read from or written to the EFI System.
|
||||
EFI_INVALID_PARAMETER - Width is invalid for this EFI System.
|
||||
EFI_INVALID_PARAMETER - Buffer is NULL.
|
||||
EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
|
||||
EFI_UNSUPPORTED - The address range specified by Address, Width, and
|
||||
Count is not valid for this EFI System.
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (!Buffer) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Do nothing for Nt32 version
|
||||
//
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CpuIoServiceRead (
|
||||
IN EFI_CPU_IO2_PROTOCOL *This,
|
||||
IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT64 UserAddress,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *UserBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This is the service that implements the I/O read
|
||||
|
||||
Arguments:
|
||||
|
||||
Pointer to an instance of the CPU I/O Protocol
|
||||
Width of the Memory Access
|
||||
Address of the I/O access
|
||||
Count of the number of accesses to perform
|
||||
Pointer to the buffer to read or write from I/O space
|
||||
|
||||
Returns:
|
||||
|
||||
Status
|
||||
EFI_SUCCESS - The data was read from or written to the EFI System.
|
||||
EFI_INVALID_PARAMETER - Width is invalid for this EFI System.
|
||||
EFI_INVALID_PARAMETER - Buffer is NULL.
|
||||
EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
|
||||
EFI_UNSUPPORTED - The address range specified by Address, Width, and
|
||||
Count is not valid for this EFI System.
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: UserAddress - add argument and description to function comment
|
||||
// TODO: UserBuffer - add argument and description to function comment
|
||||
{
|
||||
UINTN Address;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (!UserBuffer) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Address = (UINTN) UserAddress;
|
||||
|
||||
if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = CpuIoCheckAddressRange (Width, Address, Count, UserBuffer, IA32_MAX_IO_ADDRESS);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Do nothing for Nt32 version
|
||||
//
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CpuIoServiceWrite (
|
||||
IN EFI_CPU_IO2_PROTOCOL *This,
|
||||
IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT64 UserAddress,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *UserBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
This is the service that implements the I/O Write
|
||||
|
||||
Arguments:
|
||||
|
||||
Pointer to an instance of the CPU I/O Protocol
|
||||
Width of the Memory Access
|
||||
Address of the I/O access
|
||||
Count of the number of accesses to perform
|
||||
Pointer to the buffer to read or write from I/O space
|
||||
|
||||
Returns:
|
||||
|
||||
Status
|
||||
|
||||
Status
|
||||
EFI_SUCCESS - The data was read from or written to the EFI System.
|
||||
EFI_INVALID_PARAMETER - Width is invalid for this EFI System.
|
||||
EFI_INVALID_PARAMETER - Buffer is NULL.
|
||||
EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
|
||||
EFI_UNSUPPORTED - The address range specified by Address, Width, and
|
||||
Count is not valid for this EFI System.
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: UserAddress - add argument and description to function comment
|
||||
// TODO: UserBuffer - add argument and description to function comment
|
||||
{
|
||||
UINTN Address;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (!UserBuffer) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Address = (UINTN) UserAddress;
|
||||
|
||||
if ((Width < 0) || (Width >= EfiCpuIoWidthMaximum)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = CpuIoCheckAddressRange (Width, Address, Count, UserBuffer, IA32_MAX_IO_ADDRESS);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Do nothing for Nt32 version
|
||||
//
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
CpuIoCheckAddressRange (
|
||||
IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT64 Address,
|
||||
IN UINTN Count,
|
||||
IN VOID *Buffer,
|
||||
IN UINT64 Limit
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Width - TODO: add argument description
|
||||
Address - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
Limit - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_UNSUPPORTED - TODO: Add description for return value
|
||||
EFI_UNSUPPORTED - TODO: Add description for return value
|
||||
EFI_UNSUPPORTED - TODO: Add description for return value
|
||||
EFI_SUCCESS - TODO: Add description for return value
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN AlignMask;
|
||||
|
||||
if (Address > Limit) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// For FiFo type, the target address won't increase during the access, so treat count as 1
|
||||
//
|
||||
if (Width >= EfiCpuIoWidthFifoUint8 && Width <= EfiCpuIoWidthFifoUint64) {
|
||||
Count = 1;
|
||||
}
|
||||
|
||||
Width = (EFI_CPU_IO_PROTOCOL_WIDTH)(Width & 0x03);
|
||||
if (Address - 1 + ((UINTN)1 << Width) * Count > Limit) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
AlignMask = ((UINTN)1 << Width) - 1;
|
||||
if ((UINTN) Buffer & AlignMask) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
## @file
|
||||
# Component description file for Cpu module.
|
||||
#
|
||||
# This CPU module abstracts the interrupt subsystem of a platform and the CPU-specific setjump-long pair.
|
||||
# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = Cpu
|
||||
FILE_GUID = ee993080-5197-4d4e-b63c-f1f7413e33ce
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = InitializeCpu
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
|
||||
[Sources]
|
||||
CpuIo.c
|
||||
Cpu.c
|
||||
CpuDriver.h
|
||||
Strings.uni
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
UefiBootServicesTableLib
|
||||
MemoryAllocationLib
|
||||
BaseMemoryLib
|
||||
UefiDriverEntryPoint
|
||||
DebugLib
|
||||
HiiLib
|
||||
WinNtLib
|
||||
|
||||
[Protocols]
|
||||
gEfiWinNtIoProtocolGuid # PROTOCOL_NOTIFY SOMETIMES_CONSUMED
|
||||
gEfiSmbiosProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
|
||||
gEfiWinNtIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiCpuIo2ProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||
gEfiCpuArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||
|
||||
[Depex]
|
||||
gEfiSmbiosProtocolGuid
|
|
@ -1,24 +0,0 @@
|
|||
// *++
|
||||
//
|
||||
// Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
// Module Name:
|
||||
//
|
||||
// Strings.uni
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// String definition
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
/=#
|
||||
|
||||
#langdef en-US "English"
|
||||
#langdef fr-FR "Français"
|
||||
|
||||
|
||||
#string STR_PROCESSOR_VERSION #language en-US "NT32 Emulated Processor"
|
||||
#language fr-FR "Processeur Émulé par NT32"
|
File diff suppressed because it is too large
Load Diff
|
@ -1,154 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
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.
|
||||
|
||||
**/
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <PiDxe.h>
|
||||
#include <WinNtDxe.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Guid/EventGroup.h>
|
||||
#include <Guid/FirmwareFileSystem2.h>
|
||||
#include <Guid/SystemNvDataGuid.h>
|
||||
#include <Protocol/FirmwareVolumeBlock.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DxeServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
|
||||
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;
|
||||
|
||||
EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo[] = {
|
||||
//
|
||||
// Recovery BOIS FVB
|
||||
//
|
||||
{
|
||||
FixedPcdGet32 (PcdWinNtFlashFvRecoverySize),
|
||||
{
|
||||
{
|
||||
0,
|
||||
}, // ZeroVector[16]
|
||||
EFI_FIRMWARE_FILE_SYSTEM2_GUID,
|
||||
FixedPcdGet32 (PcdWinNtFlashFvRecoverySize),
|
||||
EFI_FVH_SIGNATURE,
|
||||
EFI_FVB2_MEMORY_MAPPED |
|
||||
EFI_FVB2_READ_ENABLED_CAP |
|
||||
EFI_FVB2_READ_STATUS |
|
||||
EFI_FVB2_WRITE_ENABLED_CAP |
|
||||
EFI_FVB2_WRITE_STATUS |
|
||||
EFI_FVB2_ERASE_POLARITY |
|
||||
EFI_FVB2_ALIGNMENT_16,
|
||||
sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),
|
||||
0xE947, // CheckSum
|
||||
0, // ExtHeaderOffset
|
||||
{
|
||||
0,
|
||||
}, // Reserved[1]
|
||||
2, // Revision
|
||||
{
|
||||
FixedPcdGet32 (PcdWinNtFlashFvRecoverySize)/FixedPcdGet32 (PcdWinNtFirmwareBlockSize),
|
||||
FixedPcdGet32 (PcdWinNtFirmwareBlockSize),
|
||||
}
|
||||
},
|
||||
{
|
||||
0,
|
||||
0
|
||||
}
|
||||
},
|
||||
//
|
||||
// Systen NvStorage FVB
|
||||
//
|
||||
{
|
||||
FixedPcdGet32 (PcdFlashNvStorageVariableSize) +
|
||||
FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +
|
||||
FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +
|
||||
FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize),
|
||||
{
|
||||
{
|
||||
0,
|
||||
}, // ZeroVector[16]
|
||||
EFI_SYSTEM_NV_DATA_FV_GUID,
|
||||
FixedPcdGet32 (PcdFlashNvStorageVariableSize) +
|
||||
FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +
|
||||
FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +
|
||||
FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize),
|
||||
EFI_FVH_SIGNATURE,
|
||||
EFI_FVB2_MEMORY_MAPPED |
|
||||
EFI_FVB2_READ_ENABLED_CAP |
|
||||
EFI_FVB2_READ_STATUS |
|
||||
EFI_FVB2_WRITE_ENABLED_CAP |
|
||||
EFI_FVB2_WRITE_STATUS |
|
||||
EFI_FVB2_ERASE_POLARITY |
|
||||
EFI_FVB2_ALIGNMENT_16,
|
||||
sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),
|
||||
0xFBFF, // CheckSum
|
||||
0, // ExtHeaderOffset
|
||||
{
|
||||
0,
|
||||
}, // Reserved[1]
|
||||
2, // Revision
|
||||
{
|
||||
(FixedPcdGet32 (PcdFlashNvStorageVariableSize) +
|
||||
FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +
|
||||
FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +
|
||||
FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize)) / FixedPcdGet32 (PcdWinNtFirmwareBlockSize),
|
||||
FixedPcdGet32 (PcdWinNtFirmwareBlockSize),
|
||||
}
|
||||
},
|
||||
{
|
||||
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;
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
## @file
|
||||
# Component description file for Nt32 Fimware Volume Block DXE driver module.
|
||||
#
|
||||
# This DXE runtime driver implements and produces the Fimware Volue Block Protocol on
|
||||
# NT32 emulator.
|
||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = FvbServicesRuntimeDxe
|
||||
FILE_GUID = BDFE5FAA-2A35-44bb-B17A-8084D4E2B9E9
|
||||
MODULE_TYPE = DXE_RUNTIME_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
ENTRY_POINT = FvbInitialize
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
|
||||
[Sources]
|
||||
FvbInfo.c
|
||||
FwBlockService.h
|
||||
FWBlockService.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
UefiBootServicesTableLib
|
||||
MemoryAllocationLib
|
||||
BaseMemoryLib
|
||||
HobLib
|
||||
DebugLib
|
||||
UefiRuntimeLib
|
||||
DxeServicesTableLib
|
||||
BaseLib
|
||||
UefiDriverEntryPoint
|
||||
UefiLib
|
||||
PcdLib
|
||||
|
||||
[Guids]
|
||||
gEfiEventVirtualAddressChangeGuid # ALWAYS_CONSUMED Create Event: EVENT_GROUP_GUID
|
||||
|
||||
[Protocols]
|
||||
gEfiFirmwareVolumeBlockProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||
gEfiDevicePathProtocolGuid # PROTOCOL SOMETIMES_PRODUCED
|
||||
|
||||
[FixedPcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashFvRecoverySize
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareBlockSize
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageEventLogSize
|
||||
|
||||
[Pcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareFdSize
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashFvRecoveryBase
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageEventLogBase
|
||||
|
||||
[Depex]
|
||||
TRUE
|
||||
|
|
@ -1,208 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
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 SIGNATURE_32 ('F', 'V', 'B', 'N')
|
||||
|
||||
typedef struct {
|
||||
MEDIA_FW_VOL_DEVICE_PATH FvDevPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevPath;
|
||||
} FV_PIWG_DEVICE_PATH;
|
||||
|
||||
typedef struct {
|
||||
MEMMAP_DEVICE_PATH MemMapDevPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevPath;
|
||||
} FV_MEMMAP_DEVICE_PATH;
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
UINTN Instance;
|
||||
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
|
||||
} 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 CONST EFI_LBA Lba,
|
||||
IN CONST UINTN BlockOffset,
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN CONST 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_2 *Attributes,
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
FvbGetVolumeAttributes (
|
||||
IN UINTN Instance,
|
||||
OUT EFI_FVB_ATTRIBUTES_2 *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 CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
OUT EFI_FVB_ATTRIBUTES_2 *Attributes
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolSetAttributes (
|
||||
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolGetPhysicalAddress (
|
||||
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
OUT EFI_PHYSICAL_ADDRESS *Address
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolGetBlockSize (
|
||||
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
IN CONST EFI_LBA Lba,
|
||||
OUT UINTN *BlockSize,
|
||||
OUT UINTN *NumOfBlocks
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolRead (
|
||||
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
IN CONST EFI_LBA Lba,
|
||||
IN CONST UINTN Offset,
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN UINT8 *Buffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FvbProtocolWrite (
|
||||
IN CONST 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 CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
...
|
||||
);
|
||||
|
||||
#endif
|
|
@ -1,74 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
WinNtLib.h
|
||||
|
||||
Abstract:
|
||||
Public include file for the WinNt Library
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __WIN_NT_INCLUDE_H__
|
||||
#define __WIN_NT_INCLUDE_H__
|
||||
|
||||
//
|
||||
// Win32 include files do not compile clean with /W4, so we use the warning
|
||||
// pragma to suppress the warnings for Win32 only. This way our code can stil
|
||||
// compile at /W4 (highest warning level) with /WX (warnings cause build
|
||||
// errors).
|
||||
//
|
||||
#pragma warning(disable : 4115)
|
||||
#pragma warning(disable : 4201)
|
||||
#pragma warning(disable : 4028)
|
||||
#pragma warning(disable : 4133)
|
||||
|
||||
#define GUID _WINNT_DUP_GUID_____
|
||||
#define _LIST_ENTRY _WINNT_DUP_LIST_ENTRY_FORWARD
|
||||
#define LIST_ENTRY _WINNT_DUP_LIST_ENTRY
|
||||
#if defined (MDE_CPU_IA32) && (_MSC_VER < 1800)
|
||||
#define InterlockedIncrement _WINNT_DUP_InterlockedIncrement
|
||||
#define InterlockedDecrement _WINNT_DUP_InterlockedDecrement
|
||||
#define InterlockedCompareExchange64 _WINNT_DUP_InterlockedCompareExchange64
|
||||
#endif
|
||||
#undef UNALIGNED
|
||||
#undef CONST
|
||||
#undef VOID
|
||||
#undef DEBUG_EVENT
|
||||
|
||||
// WQBugBug: This typedef is to make "windows.h" buildable.
|
||||
// It should be removed after the root cause why
|
||||
// size_t is undefined when go into the line below is found.
|
||||
#if defined (MDE_CPU_IA32)
|
||||
typedef UINT32 size_t ;
|
||||
#endif
|
||||
|
||||
#include "windows.h"
|
||||
|
||||
#undef GUID
|
||||
#undef _LIST_ENTRY
|
||||
#undef LIST_ENTRY
|
||||
#undef InterlockedIncrement
|
||||
#undef InterlockedDecrement
|
||||
#undef InterlockedCompareExchange64
|
||||
#undef InterlockedCompareExchangePointer
|
||||
#undef CreateEventEx
|
||||
|
||||
#define VOID void
|
||||
|
||||
//
|
||||
// Prevent collisions with Windows API name macros that deal with Unicode/Not issues
|
||||
//
|
||||
#undef LoadImage
|
||||
#undef CreateEvent
|
||||
|
||||
//
|
||||
// Set the warnings back on as the EFI code must be /W4.
|
||||
//
|
||||
#pragma warning(default : 4115)
|
||||
#pragma warning(default : 4201)
|
||||
|
||||
|
||||
#endif
|
|
@ -1,29 +0,0 @@
|
|||
/**@file
|
||||
Setup Variable data structure for NT32 platform.
|
||||
|
||||
Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __WIN_NT_SYSTEM_CONFIGUE_H__
|
||||
#define __WIN_NT_SYSTEM_CONFIGUE_H__
|
||||
|
||||
#define EFI_WIN_NT_SYSTEM_CONFIG_GUID \
|
||||
{ 0xb347f047, 0xaf8c, 0x490e, { 0xac, 0x07, 0x0a, 0xa9, 0xb7, 0xe5, 0x38, 0x58 }}
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
//
|
||||
// Console output mode
|
||||
//
|
||||
UINT32 ConOutColumn;
|
||||
UINT32 ConOutRow;
|
||||
} WIN_NT_SYSTEM_CONFIGURATION;
|
||||
#pragma pack()
|
||||
|
||||
|
||||
extern EFI_GUID gEfiWinNtSystemConfigGuid;
|
||||
|
||||
#endif
|
|
@ -1,16 +0,0 @@
|
|||
/** @file
|
||||
Public include file for the WinNt Library
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __WIN_NT_LIB_H__
|
||||
#define __WIN_NT_LIB_H__
|
||||
|
||||
#include <Protocol/WinNtThunk.h>
|
||||
|
||||
extern EFI_WIN_NT_THUNK_PROTOCOL *gWinNt;
|
||||
|
||||
#endif
|
|
@ -1,60 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
NtAutoscan.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Nt Autoscan PPI
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __NT_PEI_AUTOSCAN_H__
|
||||
#define __NT_PEI_AUTOSCAN_H__
|
||||
|
||||
#include <WinNtDxe.h>
|
||||
|
||||
#define PEI_NT_AUTOSCAN_PPI_GUID \
|
||||
{ \
|
||||
0xdce384d, 0x7c, 0x4ba5, {0x94, 0xbd, 0xf, 0x6e, 0xb6, 0x4d, 0x2a, 0xa9 } \
|
||||
}
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *PEI_NT_AUTOSCAN) (
|
||||
IN UINTN Index,
|
||||
OUT EFI_PHYSICAL_ADDRESS * MemoryBase,
|
||||
OUT UINT64 *MemorySize
|
||||
);
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This service is called from Index == 0 until it returns EFI_UNSUPPORTED.
|
||||
It allows discontinuous memory regions to be supported by the emulator.
|
||||
It uses gSystemMemory[] and gSystemMemoryCount that were created by
|
||||
parsing the Windows environment variable EFI_MEMORY_SIZE.
|
||||
The size comes from the varaible and the address comes from the call to
|
||||
WinNtOpenFile.
|
||||
|
||||
Arguments:
|
||||
Index - Which memory region to use
|
||||
MemoryBase - Return Base address of memory region
|
||||
MemorySize - Return size in bytes of the memory region
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - If memory region was mapped
|
||||
EFI_UNSUPPORTED - If Index is not supported
|
||||
|
||||
--*/
|
||||
typedef struct {
|
||||
PEI_NT_AUTOSCAN NtAutoScan;
|
||||
} PEI_NT_AUTOSCAN_PPI;
|
||||
|
||||
extern EFI_GUID gPeiNtAutoScanPpiGuid;
|
||||
|
||||
#endif
|
|
@ -1,56 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
NtFwh.h
|
||||
|
||||
Abstract:
|
||||
|
||||
WinNt FWH PPI as defined in Tiano
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __NT_PEI_FWH_H__
|
||||
#define __NT_PEI_FWH_H__
|
||||
|
||||
#include <WinNtDxe.h>
|
||||
|
||||
#define NT_FWH_PPI_GUID \
|
||||
{ \
|
||||
0x4e76928f, 0x50ad, 0x4334, {0xb0, 0x6b, 0xa8, 0x42, 0x13, 0x10, 0x8a, 0x57 } \
|
||||
}
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *NT_FWH_INFORMATION) (
|
||||
IN UINTN Index,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS * FdBase,
|
||||
IN OUT UINT64 *FdSize
|
||||
);
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Return the FD Size and base address. Since the FD is loaded from a
|
||||
file into Windows memory only the SEC will know it's address.
|
||||
|
||||
Arguments:
|
||||
Index - Which FD, starts at zero.
|
||||
FdSize - Size of the FD in bytes
|
||||
FdBase - Start address of the FD. Assume it points to an FV Header
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Return the Base address and size of the FV
|
||||
EFI_UNSUPPORTED - Index does nto map to an FD in the system
|
||||
|
||||
--*/
|
||||
typedef struct {
|
||||
NT_FWH_INFORMATION NtFwh;
|
||||
} NT_FWH_PPI;
|
||||
|
||||
extern EFI_GUID gNtFwhPpiGuid;
|
||||
|
||||
#endif
|
|
@ -1,59 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
NtPeiLoadFile.h
|
||||
|
||||
Abstract:
|
||||
|
||||
WinNt Load File PPI.
|
||||
|
||||
When the PEI core is done it calls the DXE IPL via PPI
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __NT_PEI_LOAD_FILE_H__
|
||||
#define __NT_PEI_LOAD_FILE_H__
|
||||
|
||||
#include <WinNtDxe.h>
|
||||
|
||||
#define NT_PEI_LOAD_FILE_GUID \
|
||||
{ \
|
||||
0xfd0c65eb, 0x405, 0x4cd2, {0x8a, 0xee, 0xf4, 0x0, 0xef, 0x13, 0xba, 0xc2 } \
|
||||
}
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *NT_PEI_LOAD_FILE) (
|
||||
VOID *Pe32Data,
|
||||
EFI_PHYSICAL_ADDRESS *ImageAddress,
|
||||
UINT64 *ImageSize,
|
||||
EFI_PHYSICAL_ADDRESS *EntryPoint
|
||||
);
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Loads and relocates a PE/COFF image into memory.
|
||||
|
||||
Arguments:
|
||||
Pe32Data - The base address of the PE/COFF file that is to be loaded and relocated
|
||||
ImageAddress - The base address of the relocated PE/COFF image
|
||||
ImageSize - The size of the relocated PE/COFF image
|
||||
EntryPoint - The entry point of the relocated PE/COFF image
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The file was loaded and relocated
|
||||
EFI_OUT_OF_RESOURCES - There was not enough memory to load and relocate the PE/COFF file
|
||||
|
||||
--*/
|
||||
typedef struct {
|
||||
NT_PEI_LOAD_FILE PeiLoadFileService;
|
||||
} NT_PEI_LOAD_FILE_PPI;
|
||||
|
||||
extern EFI_GUID gNtPeiLoadFilePpiGuid;
|
||||
|
||||
#endif
|
|
@ -1,50 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
NtThunk.h
|
||||
|
||||
Abstract:
|
||||
|
||||
WinNt Thunk interface PPI
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __NT_PEI_WIN_NT_THUNK_H__
|
||||
#define __NT_PEI_WIN_NT_THUNK_H__
|
||||
|
||||
#include <WinNtDxe.h>
|
||||
|
||||
#define PEI_NT_THUNK_PPI_GUID \
|
||||
{ \
|
||||
0x98c281e5, 0xf906, 0x43dd, {0xa9, 0x2b, 0xb0, 0x3, 0xbf, 0x27, 0x65, 0xda } \
|
||||
}
|
||||
|
||||
typedef
|
||||
VOID *
|
||||
(EFIAPI *PEI_NT_THUNK_INTERFACE) (
|
||||
VOID
|
||||
);
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Export of EFI_WIN_NT_THUNK_PROTOCOL from the Windows SEC.
|
||||
|
||||
Arguments:
|
||||
InterfaceBase - Address of the EFI_WIN_NT_THUNK_PROTOCOL
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Data returned
|
||||
|
||||
--*/
|
||||
typedef struct {
|
||||
PEI_NT_THUNK_INTERFACE NtThunk;
|
||||
} PEI_NT_THUNK_PPI;
|
||||
|
||||
extern EFI_GUID gPeiNtThunkPpiGuid;
|
||||
|
||||
#endif
|
|
@ -1,146 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
WinNtIo.h
|
||||
|
||||
Abstract:
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __WIN_NT_IO_H__
|
||||
#define __WIN_NT_IO_H__
|
||||
|
||||
#include <Protocol/WinNtThunk.h>
|
||||
|
||||
#define EFI_WIN_NT_IO_PROTOCOL_GUID \
|
||||
{ 0x96eb4ad6, 0xa32a, 0x11d4, { 0xbc, 0xfd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
|
||||
|
||||
extern EFI_GUID gEfiWinNtIoProtocolGuid;
|
||||
|
||||
typedef struct {
|
||||
EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
|
||||
EFI_GUID *TypeGuid;
|
||||
CHAR16 *EnvString;
|
||||
UINT16 InstanceNumber;
|
||||
} EFI_WIN_NT_IO_PROTOCOL;
|
||||
|
||||
//
|
||||
// The following GUIDs are used in EFI_WIN_NT_IO_PROTOCOL_GUID
|
||||
// Device paths. They map 1:1 with NT envirnment variables. The variables
|
||||
// define what virtual hardware the emulator/WinNtBusDriver will produce.
|
||||
//
|
||||
//
|
||||
// EFI_WIN_NT_VIRTUAL_DISKS
|
||||
//
|
||||
#define EFI_WIN_NT_VIRTUAL_DISKS_GUID \
|
||||
{ \
|
||||
0xc95a928, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiWinNtVirtualDisksGuid;
|
||||
|
||||
//
|
||||
// EFI_WIN_NT_PHYSICAL_DISKS
|
||||
//
|
||||
#define EFI_WIN_NT_PHYSICAL_DISKS_GUID \
|
||||
{ \
|
||||
0xc95a92f, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiWinNtPhysicalDisksGuid;
|
||||
|
||||
//
|
||||
// EFI_WIN_NT_FILE_SYSTEM
|
||||
//
|
||||
#define EFI_WIN_NT_FILE_SYSTEM_GUID \
|
||||
{ \
|
||||
0xc95a935, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiWinNtFileSystemGuid;
|
||||
|
||||
//
|
||||
// EFI_WIN_NT_SERIAL_PORT
|
||||
//
|
||||
#define EFI_WIN_NT_SERIAL_PORT_GUID \
|
||||
{ \
|
||||
0xc95a93d, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiWinNtSerialPortGuid;
|
||||
|
||||
//
|
||||
// EFI_WIN_NT_UGA
|
||||
//
|
||||
#define EFI_WIN_NT_UGA_GUID \
|
||||
{ \
|
||||
0xab248e99, 0xabe1, 0x11d4, {0xbd, 0xd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiWinNtUgaGuid;
|
||||
|
||||
//
|
||||
// EFI_WIN_NT_GOP
|
||||
//
|
||||
#define EFI_WIN_NT_GOP_GUID \
|
||||
{ \
|
||||
0x4e11e955, 0xccca, 0x11d4, 0xbd, 0xd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiWinNtGopGuid;
|
||||
|
||||
//
|
||||
// EFI_WIN_NT_CONSOLE
|
||||
//
|
||||
#define EFI_WIN_NT_CONSOLE_GUID \
|
||||
{ \
|
||||
0xba73672c, 0xa5d3, 0x11d4, {0xbd, 0x0, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiWinNtConsoleGuid;
|
||||
|
||||
//
|
||||
// EFI_WIN_NT_MEMORY
|
||||
//
|
||||
#define EFI_WIN_NT_MEMORY_GUID \
|
||||
{ \
|
||||
0x99042912, 0x122a, 0x11d4, {0xbd, 0xd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiWinNtMemoryGuid;
|
||||
|
||||
//
|
||||
// EFI_WIN_NT_CPU_MODEL
|
||||
//
|
||||
#define EFI_WIN_NT_CPU_MODEL_GUID \
|
||||
{ \
|
||||
0xbee9b6ce, 0x2f8a, 0x11d4, {0xbd, 0xd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiWinNtCPUModelGuid;
|
||||
|
||||
//
|
||||
// EFI_WIN_NT_CPU_SPEED
|
||||
//
|
||||
#define EFI_WIN_NT_CPU_SPEED_GUID \
|
||||
{ \
|
||||
0xd4f29055, 0xe1fb, 0x11d4, {0xbd, 0xd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiWinNtCPUSpeedGuid;
|
||||
|
||||
//
|
||||
// EFI_WIN_NT_PASS_THROUGH
|
||||
//
|
||||
#define EFI_WIN_NT_PASS_THROUGH_GUID \
|
||||
{ \
|
||||
0xcc664eb8, 0x3c24, 0x4086, {0xb6, 0xf6, 0x34, 0xe8, 0x56, 0xbc, 0xe3, 0x6e } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiWinNtPassThroughGuid;
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,23 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
WinNtLib.h
|
||||
|
||||
Abstract:
|
||||
Public include file for the WinNt Library
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __WIN_NT_DXE_H__
|
||||
#define __WIN_NT_DXE_H__
|
||||
|
||||
//
|
||||
// This forces Windows.h WIN32 include file to be included
|
||||
// it's needed for WinNtThunk.h
|
||||
// WinNtIo.h depends on WinNtThunk.h
|
||||
//
|
||||
#include <Common/WinNtInclude.h>
|
||||
#endif
|
|
@ -1,25 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
WinNtLib.h
|
||||
|
||||
Abstract:
|
||||
Public include file for the WinNt Library
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __WIN_NT_PEIM_H__
|
||||
#define __WIN_NT_PEIM_H__
|
||||
|
||||
//
|
||||
// This forces Windows.h WIN32 include file to be included
|
||||
// it's needed for WinNtThunk.h
|
||||
//
|
||||
#include <Common/WinNtInclude.h>
|
||||
|
||||
#include <Protocol/WinNtThunk.h>
|
||||
|
||||
#endif
|
|
@ -1,45 +0,0 @@
|
|||
## @file
|
||||
# Memory Status Code Library for UEFI drivers
|
||||
#
|
||||
# Lib to provide memory journal status code reporting Routines
|
||||
#
|
||||
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = DxeNt32OemHookStatusCodeLib
|
||||
FILE_GUID = EF172A23-C7C5-47b7-B24E-D10DFE15540F
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = OemHookStatusCodeLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
# HOB Guid C Name: gEfiWinNtThunkProtocolGuid Hob Type: GUID_EXTENSION
|
||||
#
|
||||
|
||||
[Sources]
|
||||
Nt32OemHookStatusCodeLib.c
|
||||
|
||||
|
||||
[Packages]
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
ReportStatusCodeLib
|
||||
BaseMemoryLib
|
||||
PrintLib
|
||||
HobLib
|
||||
DebugLib
|
||||
|
||||
[Protocols]
|
||||
gEfiWinNtThunkProtocolGuid # ALWAYS_CONSUMED
|
|
@ -1,232 +0,0 @@
|
|||
/** @file
|
||||
OEM hook status code library functions with no library constructor/destructor
|
||||
|
||||
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name: Nt32OemHookStatusCodeLib.c
|
||||
|
||||
**/
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <WinNtDxe.h>
|
||||
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Protocol/WinNtThunk.h>
|
||||
#include <Guid/StatusCodeDataTypeId.h>
|
||||
#include <Guid/StatusCodeDataTypeDebug.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/OemHookStatusCodeLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
|
||||
//
|
||||
// Cache of WinNtThunk protocol
|
||||
//
|
||||
EFI_WIN_NT_THUNK_PROTOCOL *mWinNt;
|
||||
|
||||
//
|
||||
// Cache of standard output handle .
|
||||
//
|
||||
HANDLE mStdOut;
|
||||
|
||||
/**
|
||||
|
||||
Initialize OEM status code device .
|
||||
|
||||
@return Always return EFI_SUCCESS.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
OemHookStatusCodeInitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_HOB_GUID_TYPE *GuidHob;
|
||||
|
||||
//
|
||||
// Retrieve WinNtThunkProtocol from GUID'ed HOB
|
||||
//
|
||||
GuidHob = GetFirstGuidHob (&gEfiWinNtThunkProtocolGuid);
|
||||
ASSERT (GuidHob != NULL);
|
||||
mWinNt = (EFI_WIN_NT_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));
|
||||
ASSERT (mWinNt != NULL);
|
||||
|
||||
//
|
||||
// Cache standard output handle.
|
||||
//
|
||||
mStdOut = mWinNt->GetStdHandle (STD_OUTPUT_HANDLE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Report status code to OEM device.
|
||||
|
||||
@param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
|
||||
|
||||
@param Value Describes the current status of a hardware or software entity.
|
||||
This included information about the class and subclass that is used to classify the entity
|
||||
as well as an operation. For progress codes, the operation is the current activity.
|
||||
For error codes, it is the exception. For debug codes, it is not defined at this time.
|
||||
Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
|
||||
Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
|
||||
|
||||
@param Instance The enumeration of a hardware or software entity within the system.
|
||||
A system may contain multiple entities that match a class/subclass pairing.
|
||||
The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
|
||||
not meaningful, or not relevant. Valid instance numbers start with 1.
|
||||
|
||||
|
||||
@param CallerId This optional parameter may be used to identify the caller.
|
||||
This parameter allows the status code driver to apply different rules to different callers.
|
||||
Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.
|
||||
|
||||
|
||||
@param Data This optional parameter may be used to pass additional data
|
||||
|
||||
@return The function always return EFI_SUCCESS.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
OemHookStatusCodeReport (
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
IN UINT32 Instance,
|
||||
IN EFI_GUID *CallerId, OPTIONAL
|
||||
IN EFI_STATUS_CODE_DATA *Data OPTIONAL
|
||||
)
|
||||
{
|
||||
CHAR8 *Filename;
|
||||
CHAR8 *Description;
|
||||
CHAR8 *Format;
|
||||
CHAR8 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];
|
||||
UINT32 ErrorLevel;
|
||||
UINT32 LineNumber;
|
||||
UINTN CharCount;
|
||||
BASE_LIST Marker;
|
||||
|
||||
Buffer[0] = '\0';
|
||||
|
||||
if (Data != NULL &&
|
||||
ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {
|
||||
//
|
||||
// Print ASSERT() information into output buffer.
|
||||
//
|
||||
CharCount = AsciiSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
"\n\rASSERT!: %a (%d): %a\n\r",
|
||||
Filename,
|
||||
LineNumber,
|
||||
Description
|
||||
);
|
||||
|
||||
//
|
||||
// Callout to standard output.
|
||||
//
|
||||
mWinNt->WriteFile (
|
||||
mStdOut,
|
||||
Buffer,
|
||||
(DWORD)CharCount,
|
||||
(LPDWORD)&CharCount,
|
||||
NULL
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
} else if (Data != NULL &&
|
||||
ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
|
||||
//
|
||||
// Print DEBUG() information into output buffer.
|
||||
//
|
||||
CharCount = AsciiBSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
Format,
|
||||
Marker
|
||||
);
|
||||
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
|
||||
//
|
||||
// Print ERROR information into output buffer.
|
||||
//
|
||||
CharCount = AsciiSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
"ERROR: C%x:V%x I%x",
|
||||
CodeType,
|
||||
Value,
|
||||
Instance
|
||||
);
|
||||
|
||||
//
|
||||
// Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.
|
||||
//
|
||||
|
||||
if (CallerId != NULL) {
|
||||
CharCount += AsciiSPrint (
|
||||
&Buffer[CharCount - 1],
|
||||
(sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
|
||||
" %g",
|
||||
CallerId
|
||||
);
|
||||
}
|
||||
|
||||
if (Data != NULL) {
|
||||
CharCount += AsciiSPrint (
|
||||
&Buffer[CharCount - 1],
|
||||
(sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
|
||||
" %p",
|
||||
Data
|
||||
);
|
||||
}
|
||||
|
||||
CharCount += AsciiSPrint (
|
||||
&Buffer[CharCount - 1],
|
||||
(sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
|
||||
"\n\r"
|
||||
);
|
||||
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
|
||||
CharCount = AsciiSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
"PROGRESS CODE: V%x I%x\n\r",
|
||||
Value,
|
||||
Instance
|
||||
);
|
||||
} else {
|
||||
CharCount = AsciiSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
"Undefined: C%x:V%x I%x\n\r",
|
||||
CodeType,
|
||||
Value,
|
||||
Instance
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Callout to standard output.
|
||||
//
|
||||
mWinNt->WriteFile (
|
||||
mStdOut,
|
||||
Buffer,
|
||||
(DWORD)CharCount,
|
||||
(LPDWORD)&CharCount,
|
||||
NULL
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,402 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
PeiNt32PeCoffExtraActionLib.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Provides services to perform additional actions to relocate and unload
|
||||
PE/Coff image for NT32 environment specific purpose such as souce level debug.
|
||||
This version only works for DXE phase
|
||||
|
||||
|
||||
**/
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <WinNtDxe.h>
|
||||
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Protocol/WinNtThunk.h>
|
||||
|
||||
#include <Library/PeCoffLib.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/PeCoffExtraActionLib.h>
|
||||
|
||||
#define MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE 0x100
|
||||
|
||||
typedef struct {
|
||||
CHAR8 *PdbPointer;
|
||||
VOID *ModHandle;
|
||||
} PDB_NAME_TO_MOD_HANDLE;
|
||||
|
||||
|
||||
//
|
||||
// Cache of WinNtThunk protocol
|
||||
//
|
||||
EFI_WIN_NT_THUNK_PROTOCOL *mWinNt = NULL;
|
||||
|
||||
//
|
||||
// An Array to hold the ModHandle
|
||||
//
|
||||
PDB_NAME_TO_MOD_HANDLE *mPdbNameModHandleArray = NULL;
|
||||
UINTN mPdbNameModHandleArraySize = 0;
|
||||
|
||||
|
||||
/**
|
||||
The constructor function gets the pointer of the WinNT thunk functions
|
||||
It will ASSERT() if NT thunk protocol is not installed.
|
||||
|
||||
@retval EFI_SUCCESS WinNT thunk protocol is found and cached.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Nt32PeCoffGetWinNtThunkStucture (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_HOB_GUID_TYPE *GuidHob;
|
||||
|
||||
//
|
||||
// Retrieve WinNtThunkProtocol from GUID'ed HOB
|
||||
//
|
||||
GuidHob = GetFirstGuidHob (&gEfiWinNtThunkProtocolGuid);
|
||||
ASSERT (GuidHob != NULL);
|
||||
mWinNt = (EFI_WIN_NT_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));
|
||||
ASSERT (mWinNt != NULL);
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Convert the passed in Ascii string to Unicode.
|
||||
|
||||
This function Convert the passed in Ascii string to Unicode.Optionally return
|
||||
the length of the strings..
|
||||
|
||||
@param AsciiString Pointer to an AscII string
|
||||
@param StrLen Length of string
|
||||
|
||||
@return Pointer to malloc'ed Unicode version of Ascii
|
||||
|
||||
**/
|
||||
CHAR16 *
|
||||
AsciiToUnicode (
|
||||
IN CHAR8 *Ascii,
|
||||
IN UINTN *StrLen OPTIONAL
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
CHAR16 *Unicode;
|
||||
|
||||
//
|
||||
// Allocate a buffer for unicode string
|
||||
//
|
||||
for (Index = 0; Ascii[Index] != '\0'; Index++)
|
||||
;
|
||||
Unicode = mWinNt->HeapAlloc ( mWinNt->GetProcessHeap (),
|
||||
HEAP_ZERO_MEMORY,
|
||||
((Index + 1) * sizeof (CHAR16))
|
||||
);
|
||||
if (Unicode == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (Index = 0; Ascii[Index] != '\0'; Index++) {
|
||||
Unicode[Index] = (CHAR16) Ascii[Index];
|
||||
}
|
||||
|
||||
Unicode[Index] = '\0';
|
||||
|
||||
if (StrLen != NULL) {
|
||||
*StrLen = Index;
|
||||
}
|
||||
|
||||
return Unicode;
|
||||
}
|
||||
/**
|
||||
Store the ModHandle in an array indexed by the Pdb File name.
|
||||
The ModHandle is needed to unload the image.
|
||||
|
||||
|
||||
@param ImageContext - Input data returned from PE Laoder Library. Used to find the
|
||||
.PDB file name of the PE Image.
|
||||
@param ModHandle - Returned from LoadLibraryEx() and stored for call to
|
||||
FreeLibrary().
|
||||
|
||||
@return return EFI_SUCCESS when ModHandle was stored.
|
||||
|
||||
--*/
|
||||
EFI_STATUS
|
||||
AddModHandle (
|
||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
|
||||
IN VOID *ModHandle
|
||||
)
|
||||
|
||||
{
|
||||
UINTN Index;
|
||||
PDB_NAME_TO_MOD_HANDLE *Array;
|
||||
UINTN PreviousSize;
|
||||
PDB_NAME_TO_MOD_HANDLE *TempArray;
|
||||
HANDLE Handle;
|
||||
|
||||
//
|
||||
// Return EFI_ALREADY_STARTED if this DLL has already been loaded
|
||||
//
|
||||
Array = mPdbNameModHandleArray;
|
||||
for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
|
||||
if (Array->PdbPointer != NULL && Array->ModHandle == ModHandle) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
}
|
||||
|
||||
Array = mPdbNameModHandleArray;
|
||||
for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
|
||||
if (Array->PdbPointer == NULL) {
|
||||
//
|
||||
// Make a copy of the stirng and store the ModHandle
|
||||
//
|
||||
Handle = mWinNt->GetProcessHeap ();
|
||||
Array->PdbPointer = mWinNt->HeapAlloc ( Handle,
|
||||
HEAP_ZERO_MEMORY,
|
||||
AsciiStrLen (ImageContext->PdbPointer) + 1
|
||||
);
|
||||
|
||||
ASSERT (Array->PdbPointer != NULL);
|
||||
|
||||
AsciiStrCpy (Array->PdbPointer, ImageContext->PdbPointer);
|
||||
Array->ModHandle = ModHandle;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// No free space in mPdbNameModHandleArray so grow it by
|
||||
// MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE entires.
|
||||
//
|
||||
PreviousSize = mPdbNameModHandleArraySize * sizeof (PDB_NAME_TO_MOD_HANDLE);
|
||||
mPdbNameModHandleArraySize += MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE;
|
||||
//
|
||||
// re-allocate a new buffer and copy the old values to the new locaiton.
|
||||
//
|
||||
TempArray = mWinNt->HeapAlloc ( mWinNt->GetProcessHeap (),
|
||||
HEAP_ZERO_MEMORY,
|
||||
mPdbNameModHandleArraySize * sizeof (PDB_NAME_TO_MOD_HANDLE)
|
||||
);
|
||||
|
||||
CopyMem ((VOID *) (UINTN) TempArray, (VOID *) (UINTN)mPdbNameModHandleArray, PreviousSize);
|
||||
|
||||
mWinNt->HeapFree (mWinNt->GetProcessHeap (), 0, mPdbNameModHandleArray);
|
||||
|
||||
mPdbNameModHandleArray = TempArray;
|
||||
if (mPdbNameModHandleArray == NULL) {
|
||||
ASSERT (FALSE);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
return AddModHandle (ImageContext, ModHandle);
|
||||
}
|
||||
/**
|
||||
Return the ModHandle and delete the entry in the array.
|
||||
|
||||
|
||||
@param ImageContext - Input data returned from PE Laoder Library. Used to find the
|
||||
.PDB file name of the PE Image.
|
||||
|
||||
@return
|
||||
ModHandle - ModHandle assoicated with ImageContext is returned
|
||||
NULL - No ModHandle associated with ImageContext
|
||||
|
||||
**/
|
||||
VOID *
|
||||
RemoveModeHandle (
|
||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
PDB_NAME_TO_MOD_HANDLE *Array;
|
||||
|
||||
if (ImageContext->PdbPointer == NULL) {
|
||||
//
|
||||
// If no PDB pointer there is no ModHandle so return NULL
|
||||
//
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Array = mPdbNameModHandleArray;
|
||||
for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
|
||||
if ((Array->PdbPointer != NULL) && (AsciiStrCmp(Array->PdbPointer, ImageContext->PdbPointer) == 0)) {
|
||||
//
|
||||
// If you find a match return it and delete the entry
|
||||
//
|
||||
mWinNt->HeapFree (mWinNt->GetProcessHeap (), 0, Array->PdbPointer);
|
||||
Array->PdbPointer = NULL;
|
||||
return Array->ModHandle;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
Performs additional actions after a PE/COFF image has been loaded and relocated.
|
||||
|
||||
For NT32, this function load symbols to support source level debugging.
|
||||
|
||||
If ImageContext is NULL, then ASSERT().
|
||||
|
||||
@param ImageContext Pointer to the image context structure that describes the
|
||||
PE/COFF image that has already been loaded and relocated.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PeCoffLoaderRelocateImageExtraAction (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *DllEntryPoint;
|
||||
CHAR16 *DllFileName;
|
||||
HMODULE Library;
|
||||
UINTN Index;
|
||||
|
||||
ASSERT (ImageContext != NULL);
|
||||
|
||||
if (mWinNt == NULL) {
|
||||
Nt32PeCoffGetWinNtThunkStucture ();
|
||||
}
|
||||
|
||||
//
|
||||
// If we load our own PE COFF images the Windows debugger can not source
|
||||
// level debug our code. If a valid PDB pointer exists usw it to load
|
||||
// the *.dll file as a library using Windows* APIs. This allows
|
||||
// source level debug. The image is still loaded and relocated
|
||||
// in the Framework memory space like on a real system (by the code above),
|
||||
// but the entry point points into the DLL loaded by the code bellow.
|
||||
//
|
||||
|
||||
DllEntryPoint = NULL;
|
||||
|
||||
//
|
||||
// Load the DLL if it's not an EBC image.
|
||||
//
|
||||
if ((ImageContext->PdbPointer != NULL) &&
|
||||
(ImageContext->Machine != EFI_IMAGE_MACHINE_EBC)) {
|
||||
//
|
||||
// Convert filename from ASCII to Unicode
|
||||
//
|
||||
DllFileName = AsciiToUnicode (ImageContext->PdbPointer, &Index);
|
||||
|
||||
//
|
||||
// Check that we have a valid filename
|
||||
//
|
||||
if (Index < 5 || DllFileName[Index - 4] != '.') {
|
||||
mWinNt->HeapFree (mWinNt->GetProcessHeap (), 0, DllFileName);
|
||||
|
||||
//
|
||||
// Never return an error if PeCoffLoaderRelocateImage() succeeded.
|
||||
// The image will run, but we just can't source level debug. If we
|
||||
// return an error the image will not run.
|
||||
//
|
||||
return;
|
||||
}
|
||||
//
|
||||
// Replace .PDB with .DLL on the filename
|
||||
//
|
||||
DllFileName[Index - 3] = 'D';
|
||||
DllFileName[Index - 2] = 'L';
|
||||
DllFileName[Index - 1] = 'L';
|
||||
|
||||
//
|
||||
// Load the .DLL file into the user process's address space for source
|
||||
// level debug
|
||||
//
|
||||
Library = mWinNt->LoadLibraryEx (DllFileName, NULL, DONT_RESOLVE_DLL_REFERENCES);
|
||||
if (Library != NULL) {
|
||||
//
|
||||
// InitializeDriver is the entry point we put in all our EFI DLL's. The
|
||||
// DONT_RESOLVE_DLL_REFERENCES argument to LoadLIbraryEx() suppresses the
|
||||
// normal DLL entry point of DllMain, and prevents other modules that are
|
||||
// referenced in side the DllFileName from being loaded. There is no error
|
||||
// checking as the we can point to the PE32 image loaded by Tiano. This
|
||||
// step is only needed for source level debugging
|
||||
//
|
||||
DllEntryPoint = (VOID *) (UINTN) mWinNt->GetProcAddress (Library, "InitializeDriver");
|
||||
|
||||
}
|
||||
|
||||
if ((Library != NULL) && (DllEntryPoint != NULL)) {
|
||||
Status = AddModHandle (ImageContext, Library);
|
||||
if (Status == EFI_ALREADY_STARTED) {
|
||||
//
|
||||
// If the DLL has already been loaded before, then this instance of the DLL can not be debugged.
|
||||
//
|
||||
ImageContext->PdbPointer = NULL;
|
||||
DEBUG ((EFI_D_ERROR, "WARNING: DLL already loaded. No source level debug %s. \n", DllFileName));
|
||||
} else {
|
||||
//
|
||||
// This DLL is not already loaded, so source level debugging is supported.
|
||||
//
|
||||
ImageContext->EntryPoint = (EFI_PHYSICAL_ADDRESS) (UINTN) DllEntryPoint;
|
||||
DEBUG ((EFI_D_INFO, "LoadLibraryEx (%s,\n NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName));
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// This DLL does not support source level debugging at all.
|
||||
//
|
||||
DEBUG ((EFI_D_ERROR, "WARNING: No source level debug %s. \n", DllFileName));
|
||||
}
|
||||
|
||||
mWinNt->HeapFree (mWinNt->GetProcessHeap (), 0, DllFileName);
|
||||
}
|
||||
|
||||
//
|
||||
// Never return an error if PeCoffLoaderRelocateImage() succeeded.
|
||||
// The image will run, but we just can't source level debug. If we
|
||||
// return an error the image will not run.
|
||||
//
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
Performs additional actions just before a PE/COFF image is unloaded. Any resources
|
||||
that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.
|
||||
|
||||
For NT32, this function unloads symbols for source level debugging.
|
||||
|
||||
If ImageContext is NULL, then ASSERT().
|
||||
|
||||
@param ImageContext Pointer to the image context structure that describes the
|
||||
PE/COFF image that is being unloaded.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PeCoffLoaderUnloadImageExtraAction (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
{
|
||||
VOID *ModHandle;
|
||||
|
||||
ASSERT (ImageContext != NULL);
|
||||
|
||||
ModHandle = RemoveModeHandle (ImageContext);
|
||||
if (ModHandle != NULL) {
|
||||
mWinNt->FreeLibrary (ModHandle);
|
||||
}
|
||||
return;
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
## @file
|
||||
# PeCoff extra action libary for DXE phase that run NT32 emulator.
|
||||
#
|
||||
# Lib to provide memory journal status code reporting Routines
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = DxeNt32PeCoffExtraActionLib
|
||||
FILE_GUID = 23AF9A54-3D7C-444d-8318-E9CF752DA349
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PeCoffExtraActionLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_DRIVER
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
|
||||
[Sources]
|
||||
DxeNt32PeCoffExtraActionLib.c
|
||||
|
||||
[Packages]
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
HobLib
|
||||
BaseMemoryLib
|
||||
|
||||
[Protocols]
|
||||
gEfiWinNtThunkProtocolGuid # ALWAYS_CONSUMED
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
## @file
|
||||
# A library to produce the global variable 'gWinNt'
|
||||
#
|
||||
# This library contains a single global variable 'gWinNt' along with a constructor to initialize that global.
|
||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
##
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = DxeWinNtLib
|
||||
FILE_GUID = f6b5871d-5226-41b3-a569-3ff893fdc7bc
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = WinNtLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
|
||||
|
||||
CONSTRUCTOR = WinNtLibConstructor
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
# HOB Guid C Name: gEfiWinNtThunkProtocolGuid Hob Type: GUID_EXTENSION
|
||||
#
|
||||
|
||||
[Sources]
|
||||
WinNtLib.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
HobLib
|
||||
DebugLib
|
||||
|
||||
[Protocols]
|
||||
gEfiWinNtThunkProtocolGuid # Used as HOB in the code.
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
WinNtLib.c
|
||||
|
||||
Abstract:
|
||||
|
||||
WinNt Library
|
||||
|
||||
**/
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <WinNtDxe.h>
|
||||
#include <Library/WinNtLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
|
||||
|
||||
EFI_WIN_NT_THUNK_PROTOCOL *gWinNt;
|
||||
|
||||
EFI_STATUS
|
||||
WinNtLibConstructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_HOB_GUID_TYPE *GuidHob;
|
||||
|
||||
GuidHob = GetFirstGuidHob (&gEfiWinNtThunkProtocolGuid);
|
||||
ASSERT (GuidHob != NULL);
|
||||
gWinNt = (EFI_WIN_NT_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));
|
||||
ASSERT (gWinNt != NULL);
|
||||
return EFI_SUCCESS;
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
## @file
|
||||
# Component description file for the EdkNt32PeiPeCoffGetEntryPointLib library.
|
||||
#
|
||||
# PeCoffGetEntryPointLib library class for NT32 instance implemented by use NTPeiLoadFile PPI.
|
||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = EdkNt32PeiPeCoffGetEntryPointLib
|
||||
FILE_GUID = 434b164e-5fa6-4a3d-bc04-02da2a4eeb26
|
||||
MODULE_TYPE = PEIM
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PeCoffGetEntryPointLib|PEI_CORE PEIM SEC
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
|
||||
[Sources]
|
||||
PeCoffGetEntryPoint.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
PeiServicesLib
|
||||
|
||||
[Ppis]
|
||||
gNtPeiLoadFilePpiGuid # PPI ALWAYS_CONSUMED
|
||||
|
|
@ -1,318 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
PeCoffGetEntryPoint.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Tiano PE/COFF loader
|
||||
|
||||
Revision History
|
||||
|
||||
**/
|
||||
|
||||
#include <PiPei.h>
|
||||
#include <IndustryStandard/PeImage.h>
|
||||
#include <WinNtPeim.h>
|
||||
#include <Ppi/NtPeiLoadFile.h>
|
||||
#include <Library/PeCoffGetEntryPointLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
|
||||
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
PeCoffLoaderGetEntryPoint (
|
||||
IN VOID *Pe32Data,
|
||||
IN OUT VOID **EntryPoint
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Loads a PE/COFF image into memory, this is not follow the original purpose of
|
||||
PeCoffGetEntryPoint library class. But it's ok that Unix package not run on a real
|
||||
platform and this is for source level debug.
|
||||
|
||||
Arguments:
|
||||
|
||||
Pe32Data - Pointer to a PE/COFF Image
|
||||
|
||||
EntryPoint - Pointer to the entry point of the PE/COFF image
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS if the EntryPoint was returned
|
||||
EFI_INVALID_PARAMETER if the EntryPoint could not be found from Pe32Data
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
|
||||
NT_PEI_LOAD_FILE_PPI *PeiNtService;
|
||||
EFI_PHYSICAL_ADDRESS ImageAddress;
|
||||
UINT64 ImageSize;
|
||||
EFI_PHYSICAL_ADDRESS ImageEntryPoint;
|
||||
|
||||
ASSERT (Pe32Data != NULL);
|
||||
ASSERT (EntryPoint != NULL);
|
||||
|
||||
Status = PeiServicesLocatePpi (
|
||||
&gNtPeiLoadFilePpiGuid,
|
||||
0,
|
||||
&PpiDescriptor,
|
||||
(VOID**)&PeiNtService
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = PeiNtService->PeiLoadFileService (
|
||||
Pe32Data,
|
||||
&ImageAddress,
|
||||
&ImageSize,
|
||||
&ImageEntryPoint
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
*EntryPoint = (VOID*)(UINTN)ImageEntryPoint;
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the machine type of PE/COFF image.
|
||||
This is copied from MDE BasePeCoffGetEntryPointLib, the code should be sync with it.
|
||||
The reason is NT32 package needs to load the image to memory to support source
|
||||
level debug.
|
||||
|
||||
|
||||
@param Pe32Data Pointer to a PE/COFF header
|
||||
|
||||
@return Machine type or zero if not a valid iamge
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
PeCoffLoaderGetMachineType (
|
||||
IN VOID *Pe32Data
|
||||
)
|
||||
{
|
||||
EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
|
||||
EFI_IMAGE_DOS_HEADER *DosHdr;
|
||||
|
||||
ASSERT (Pe32Data != NULL);
|
||||
|
||||
DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
|
||||
if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
|
||||
//
|
||||
// DOS image header is present, so read the PE header after the DOS image header.
|
||||
//
|
||||
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
|
||||
} else {
|
||||
//
|
||||
// DOS image header is not present, so PE header is at the image base.
|
||||
//
|
||||
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;
|
||||
}
|
||||
|
||||
if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
|
||||
return Hdr.Te->Machine;
|
||||
} else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
|
||||
return Hdr.Pe32->FileHeader.Machine;
|
||||
}
|
||||
|
||||
return 0x0000;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns a pointer to the PDB file name for a PE/COFF image that has been
|
||||
loaded into system memory with the PE/COFF Loader Library functions.
|
||||
|
||||
Returns the PDB file name for the PE/COFF image specified by Pe32Data. If
|
||||
the PE/COFF image specified by Pe32Data is not a valid, then NULL is
|
||||
returned. If the PE/COFF image specified by Pe32Data does not contain a
|
||||
debug directory entry, then NULL is returned. If the debug directory entry
|
||||
in the PE/COFF image specified by Pe32Data does not contain a PDB file name,
|
||||
then NULL is returned.
|
||||
If Pe32Data is NULL, then ASSERT().
|
||||
|
||||
@param Pe32Data Pointer to the PE/COFF image that is loaded in system
|
||||
memory.
|
||||
|
||||
@return The PDB file name for the PE/COFF image specified by Pe32Data or NULL
|
||||
if it cannot be retrieved.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
PeCoffLoaderGetPdbPointer (
|
||||
IN VOID *Pe32Data
|
||||
)
|
||||
{
|
||||
EFI_IMAGE_DOS_HEADER *DosHdr;
|
||||
EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
|
||||
EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
|
||||
EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
|
||||
UINTN DirCount;
|
||||
VOID *CodeViewEntryPointer;
|
||||
INTN TEImageAdjust;
|
||||
UINT32 NumberOfRvaAndSizes;
|
||||
UINT16 Magic;
|
||||
|
||||
ASSERT (Pe32Data != NULL);
|
||||
|
||||
TEImageAdjust = 0;
|
||||
DirectoryEntry = NULL;
|
||||
DebugEntry = NULL;
|
||||
NumberOfRvaAndSizes = 0;
|
||||
|
||||
DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
|
||||
if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
|
||||
//
|
||||
// DOS image header is present, so read the PE header after the DOS image header.
|
||||
//
|
||||
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
|
||||
} else {
|
||||
//
|
||||
// DOS image header is not present, so PE header is at the image base.
|
||||
//
|
||||
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;
|
||||
}
|
||||
|
||||
if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
|
||||
if (Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress != 0) {
|
||||
DirectoryEntry = &Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG];
|
||||
TEImageAdjust = sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize;
|
||||
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN) Hdr.Te +
|
||||
Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress +
|
||||
TEImageAdjust);
|
||||
}
|
||||
} else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
|
||||
//
|
||||
// NOTE: We use Machine field to identify PE32/PE32+, instead of Magic.
|
||||
// It is due to backward-compatibility, for some system might
|
||||
// generate PE32+ image with PE32 Magic.
|
||||
//
|
||||
switch (Hdr.Pe32->FileHeader.Machine) {
|
||||
case IMAGE_FILE_MACHINE_I386:
|
||||
//
|
||||
// Assume PE32 image with IA32 Machine field.
|
||||
//
|
||||
Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
|
||||
break;
|
||||
case IMAGE_FILE_MACHINE_X64:
|
||||
case IMAGE_FILE_MACHINE_IA64:
|
||||
//
|
||||
// Assume PE32+ image with X64 or IA64 Machine field
|
||||
//
|
||||
Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
|
||||
break;
|
||||
default:
|
||||
//
|
||||
// For unknow Machine field, use Magic in optional Header
|
||||
//
|
||||
Magic = Hdr.Pe32->OptionalHeader.Magic;
|
||||
}
|
||||
|
||||
if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
|
||||
//
|
||||
// Use PE32 offset get Debug Directory Entry
|
||||
//
|
||||
NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
|
||||
DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
|
||||
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) ((UINTN) Pe32Data + DirectoryEntry->VirtualAddress);
|
||||
} else if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
|
||||
//
|
||||
// Use PE32+ offset get Debug Directory Entry
|
||||
//
|
||||
NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
|
||||
DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
|
||||
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) ((UINTN) Pe32Data + DirectoryEntry->VirtualAddress);
|
||||
}
|
||||
|
||||
if (NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
|
||||
DirectoryEntry = NULL;
|
||||
DebugEntry = NULL;
|
||||
}
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (DebugEntry == NULL || DirectoryEntry == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) {
|
||||
if (DebugEntry->Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
|
||||
if (DebugEntry->SizeOfData > 0) {
|
||||
CodeViewEntryPointer = (VOID *) ((UINTN) DebugEntry->RVA + ((UINTN)Pe32Data) + (UINTN)TEImageAdjust);
|
||||
switch (* (UINT32 *) CodeViewEntryPointer) {
|
||||
case CODEVIEW_SIGNATURE_NB10:
|
||||
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));
|
||||
case CODEVIEW_SIGNATURE_RSDS:
|
||||
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY));
|
||||
case CODEVIEW_SIGNATURE_MTOC:
|
||||
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the size of the PE/COFF headers
|
||||
|
||||
Returns the size of the PE/COFF header specified by Pe32Data.
|
||||
If Pe32Data is NULL, then ASSERT().
|
||||
|
||||
@param Pe32Data Pointer to the PE/COFF image that is loaded in system
|
||||
memory.
|
||||
|
||||
@return Size of PE/COFF header in bytes or zero if not a valid image.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
PeCoffGetSizeOfHeaders (
|
||||
IN VOID *Pe32Data
|
||||
)
|
||||
{
|
||||
EFI_IMAGE_DOS_HEADER *DosHdr;
|
||||
EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
|
||||
UINTN SizeOfHeaders;
|
||||
|
||||
ASSERT (Pe32Data != NULL);
|
||||
|
||||
DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
|
||||
if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
|
||||
//
|
||||
// DOS image header is present, so read the PE header after the DOS image header.
|
||||
//
|
||||
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
|
||||
} else {
|
||||
//
|
||||
// DOS image header is not present, so PE header is at the image base.
|
||||
//
|
||||
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;
|
||||
}
|
||||
|
||||
if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
|
||||
SizeOfHeaders = sizeof (EFI_TE_IMAGE_HEADER) + (UINTN)Hdr.Te->BaseOfCode - (UINTN)Hdr.Te->StrippedSize;
|
||||
} else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
|
||||
SizeOfHeaders = Hdr.Pe32->OptionalHeader.SizeOfHeaders;
|
||||
} else {
|
||||
SizeOfHeaders = 0;
|
||||
}
|
||||
|
||||
return (UINT32) SizeOfHeaders;
|
||||
}
|
||||
|
|
@ -1,241 +0,0 @@
|
|||
/** @file
|
||||
OEM hook status code library functions with no library constructor/destructor
|
||||
|
||||
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name: Nt32OemHookStatusCodeLib.c
|
||||
|
||||
**/
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <WinNtPeim.h>
|
||||
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Guid/StatusCodeDataTypeId.h>
|
||||
#include <Guid/StatusCodeDataTypeDebug.h>
|
||||
#include <Ppi/NtThunk.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/OemHookStatusCodeLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
|
||||
//
|
||||
// Cache of WinNtThunk protocol
|
||||
//
|
||||
EFI_WIN_NT_THUNK_PROTOCOL *mWinNt;
|
||||
|
||||
//
|
||||
// Cache of standard output handle .
|
||||
//
|
||||
HANDLE mStdOut;
|
||||
|
||||
/**
|
||||
|
||||
Initialize OEM status code device .
|
||||
|
||||
@return Always return EFI_SUCCESS.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
OemHookStatusCodeInitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
PEI_NT_THUNK_PPI *NtThunkPpi;
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
//
|
||||
// Locate NtThunkPpi for retrieving standard output handle
|
||||
//
|
||||
Status = PeiServicesLocatePpi (
|
||||
&gPeiNtThunkPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **) &NtThunkPpi
|
||||
);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
mWinNt = (EFI_WIN_NT_THUNK_PROTOCOL *) NtThunkPpi->NtThunk ();
|
||||
|
||||
|
||||
//
|
||||
// Cache standard output handle.
|
||||
//
|
||||
mStdOut = mWinNt->GetStdHandle (STD_OUTPUT_HANDLE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Report status code to OEM device.
|
||||
|
||||
@param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
|
||||
|
||||
@param Value Describes the current status of a hardware or software entity.
|
||||
This included information about the class and subclass that is used to classify the entity
|
||||
as well as an operation. For progress codes, the operation is the current activity.
|
||||
For error codes, it is the exception. For debug codes, it is not defined at this time.
|
||||
Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
|
||||
Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
|
||||
|
||||
@param Instance The enumeration of a hardware or software entity within the system.
|
||||
A system may contain multiple entities that match a class/subclass pairing.
|
||||
The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
|
||||
not meaningful, or not relevant. Valid instance numbers start with 1.
|
||||
|
||||
|
||||
@param CallerId This optional parameter may be used to identify the caller.
|
||||
This parameter allows the status code driver to apply different rules to different callers.
|
||||
Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.
|
||||
|
||||
|
||||
@param Data This optional parameter may be used to pass additional data
|
||||
|
||||
@return The function always return EFI_SUCCESS.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
OemHookStatusCodeReport (
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
IN UINT32 Instance,
|
||||
IN EFI_GUID *CallerId, OPTIONAL
|
||||
IN EFI_STATUS_CODE_DATA *Data OPTIONAL
|
||||
)
|
||||
{
|
||||
CHAR8 *Filename;
|
||||
CHAR8 *Description;
|
||||
CHAR8 *Format;
|
||||
CHAR8 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];
|
||||
UINT32 ErrorLevel;
|
||||
UINT32 LineNumber;
|
||||
UINTN CharCount;
|
||||
BASE_LIST Marker;
|
||||
|
||||
Buffer[0] = '\0';
|
||||
|
||||
if (Data != NULL &&
|
||||
ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {
|
||||
//
|
||||
// Print ASSERT() information into output buffer.
|
||||
//
|
||||
CharCount = AsciiSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
"\n\rASSERT!: %a (%d): %a\n\r",
|
||||
Filename,
|
||||
LineNumber,
|
||||
Description
|
||||
);
|
||||
|
||||
//
|
||||
// Callout to standard output.
|
||||
//
|
||||
mWinNt->WriteFile (
|
||||
mStdOut,
|
||||
Buffer,
|
||||
(DWORD)CharCount,
|
||||
(LPDWORD)&CharCount,
|
||||
NULL
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
} else if (Data != NULL &&
|
||||
ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
|
||||
//
|
||||
// Print DEBUG() information into output buffer.
|
||||
//
|
||||
CharCount = AsciiBSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
Format,
|
||||
Marker
|
||||
);
|
||||
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
|
||||
//
|
||||
// Print ERROR information into output buffer.
|
||||
//
|
||||
CharCount = AsciiSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
"ERROR: C%x:V%x I%x",
|
||||
CodeType,
|
||||
Value,
|
||||
Instance
|
||||
);
|
||||
|
||||
//
|
||||
// Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.
|
||||
//
|
||||
|
||||
if (CallerId != NULL) {
|
||||
CharCount += AsciiSPrint (
|
||||
&Buffer[CharCount - 1],
|
||||
(sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
|
||||
" %g",
|
||||
CallerId
|
||||
);
|
||||
}
|
||||
|
||||
if (Data != NULL) {
|
||||
CharCount += AsciiSPrint (
|
||||
&Buffer[CharCount - 1],
|
||||
(sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
|
||||
" %p",
|
||||
Data
|
||||
);
|
||||
}
|
||||
|
||||
CharCount += AsciiSPrint (
|
||||
&Buffer[CharCount - 1],
|
||||
(sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
|
||||
"\n\r"
|
||||
);
|
||||
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
|
||||
CharCount = AsciiSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
"PROGRESS CODE: V%x I%x\n\r",
|
||||
Value,
|
||||
Instance
|
||||
);
|
||||
} else {
|
||||
CharCount = AsciiSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
"Undefined: C%x:V%x I%x\n\r",
|
||||
CodeType,
|
||||
Value,
|
||||
Instance
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Callout to standard output.
|
||||
//
|
||||
mWinNt->WriteFile (
|
||||
mStdOut,
|
||||
Buffer,
|
||||
(DWORD)CharCount,
|
||||
(LPDWORD)&CharCount,
|
||||
NULL
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
## @file
|
||||
# Memory Status Code Library for UEFI drivers
|
||||
#
|
||||
# Lib to provide memory journal status code reporting Routines
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = PeiNt32OemHookStatusCodeLib
|
||||
FILE_GUID = 0C2070F9-02A7-4e8e-B584-84EA922363FB
|
||||
MODULE_TYPE = PEIM
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = OemHookStatusCodeLib|PEIM
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
|
||||
[Sources]
|
||||
Nt32OemHookStatusCodeLib.c
|
||||
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
PeiServicesLib
|
||||
ReportStatusCodeLib
|
||||
BaseMemoryLib
|
||||
PrintLib
|
||||
DebugLib
|
||||
|
||||
[Ppis]
|
||||
gPeiNtThunkPpiGuid # PPI ALWAYS_CONSUMED
|
||||
|
|
@ -1,244 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
PeiNt32PeCoffExtraActionLib.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Provides services to perform additional actions to relocate and unload
|
||||
PE/Coff image for NT32 environment specific purpose such as souce level debug.
|
||||
This version only works for PEI phase
|
||||
|
||||
|
||||
**/
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <PiPei.h>
|
||||
#include <WinNtPeim.h>
|
||||
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Ppi/NtThunk.h>
|
||||
|
||||
#include <PiPei.h>
|
||||
#include <Library/PeCoffLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/PeCoffExtraActionLib.h>
|
||||
|
||||
//
|
||||
// Cache of WinNtThunk protocol
|
||||
//
|
||||
EFI_WIN_NT_THUNK_PROTOCOL *mWinNt = NULL;
|
||||
|
||||
/**
|
||||
The function caches the pointer of the WinNT thunk functions
|
||||
It will ASSERT() if NT thunk ppi is not installed.
|
||||
|
||||
@retval EFI_SUCCESS WinNT thunk protocol is found and cached.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Nt32PeCoffGetWinNtThunkStucture (
|
||||
)
|
||||
{
|
||||
PEI_NT_THUNK_PPI *NtThunkPpi;
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
//
|
||||
// Locate NtThunkPpi for retrieving standard output handle
|
||||
//
|
||||
Status = PeiServicesLocatePpi (
|
||||
&gPeiNtThunkPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **) &NtThunkPpi
|
||||
);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
mWinNt = (EFI_WIN_NT_THUNK_PROTOCOL *) NtThunkPpi->NtThunk ();
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Convert the passed in Ascii string to Unicode.
|
||||
|
||||
This function Convert the passed in Ascii string to Unicode.Optionally return
|
||||
the length of the strings..
|
||||
|
||||
@param AsciiString Pointer to an AscII string
|
||||
@param StrLen Length of string
|
||||
|
||||
@return Pointer to malloc'ed Unicode version of Ascii
|
||||
|
||||
**/
|
||||
CHAR16 *
|
||||
AsciiToUnicode (
|
||||
IN CHAR8 *Ascii,
|
||||
IN UINTN *StrLen OPTIONAL
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
CHAR16 *Unicode;
|
||||
|
||||
//
|
||||
// Allocate a buffer for unicode string
|
||||
//
|
||||
for (Index = 0; Ascii[Index] != '\0'; Index++)
|
||||
;
|
||||
Unicode = mWinNt->HeapAlloc ( mWinNt->GetProcessHeap (),
|
||||
HEAP_ZERO_MEMORY,
|
||||
((Index + 1) * sizeof (CHAR16))
|
||||
);
|
||||
if (Unicode == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (Index = 0; Ascii[Index] != '\0'; Index++) {
|
||||
Unicode[Index] = (CHAR16) Ascii[Index];
|
||||
}
|
||||
|
||||
Unicode[Index] = '\0';
|
||||
|
||||
if (StrLen != NULL) {
|
||||
*StrLen = Index;
|
||||
}
|
||||
|
||||
return Unicode;
|
||||
}
|
||||
|
||||
/**
|
||||
Performs additional actions after a PE/COFF image has been loaded and relocated.
|
||||
|
||||
For NT32, this function load symbols to support source level debugging.
|
||||
|
||||
If ImageContext is NULL, then ASSERT().
|
||||
|
||||
@param ImageContext Pointer to the image context structure that describes the
|
||||
PE/COFF image that has already been loaded and relocated.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PeCoffLoaderRelocateImageExtraAction (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
{
|
||||
VOID *DllEntryPoint;
|
||||
CHAR16 *DllFileName;
|
||||
HMODULE Library;
|
||||
UINTN Index;
|
||||
|
||||
ASSERT (ImageContext != NULL);
|
||||
|
||||
if (mWinNt == NULL) {
|
||||
Nt32PeCoffGetWinNtThunkStucture ();
|
||||
}
|
||||
//
|
||||
// If we load our own PE COFF images the Windows debugger can not source
|
||||
// level debug our code. If a valid PDB pointer exists usw it to load
|
||||
// the *.dll file as a library using Windows* APIs. This allows
|
||||
// source level debug. The image is still loaded and relocated
|
||||
// in the Framework memory space like on a real system (by the code above),
|
||||
// but the entry point points into the DLL loaded by the code bellow.
|
||||
//
|
||||
|
||||
DllEntryPoint = NULL;
|
||||
|
||||
//
|
||||
// Load the DLL if it's not an EBC image.
|
||||
//
|
||||
if ((ImageContext->PdbPointer != NULL) &&
|
||||
(ImageContext->Machine != EFI_IMAGE_MACHINE_EBC)) {
|
||||
//
|
||||
// Convert filename from ASCII to Unicode
|
||||
//
|
||||
DllFileName = AsciiToUnicode (ImageContext->PdbPointer, &Index);
|
||||
|
||||
//
|
||||
// Check that we have a valid filename
|
||||
//
|
||||
if (Index < 5 || DllFileName[Index - 4] != '.') {
|
||||
mWinNt->HeapFree (mWinNt->GetProcessHeap (), 0, DllFileName);
|
||||
|
||||
//
|
||||
// Never return an error if PeCoffLoaderRelocateImage() succeeded.
|
||||
// The image will run, but we just can't source level debug. If we
|
||||
// return an error the image will not run.
|
||||
//
|
||||
return;
|
||||
}
|
||||
//
|
||||
// Replace .PDB with .DLL on the filename
|
||||
//
|
||||
DllFileName[Index - 3] = 'D';
|
||||
DllFileName[Index - 2] = 'L';
|
||||
DllFileName[Index - 1] = 'L';
|
||||
|
||||
//
|
||||
// Load the .DLL file into the user process's address space for source
|
||||
// level debug
|
||||
//
|
||||
Library = mWinNt->LoadLibraryEx (DllFileName, NULL, DONT_RESOLVE_DLL_REFERENCES);
|
||||
if (Library != NULL) {
|
||||
//
|
||||
// InitializeDriver is the entry point we put in all our EFI DLL's. The
|
||||
// DONT_RESOLVE_DLL_REFERENCES argument to LoadLIbraryEx() suppresses the
|
||||
// normal DLL entry point of DllMain, and prevents other modules that are
|
||||
// referenced in side the DllFileName from being loaded. There is no error
|
||||
// checking as the we can point to the PE32 image loaded by Tiano. This
|
||||
// step is only needed for source level debugging
|
||||
//
|
||||
DllEntryPoint = (VOID *) (UINTN) mWinNt->GetProcAddress (Library, "InitializeDriver");
|
||||
|
||||
}
|
||||
|
||||
if ((Library != NULL) && (DllEntryPoint != NULL)) {
|
||||
ImageContext->EntryPoint = (EFI_PHYSICAL_ADDRESS) (UINTN) DllEntryPoint;
|
||||
DEBUG ((EFI_D_INFO, "LoadLibraryEx (%s,\n NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName));
|
||||
} else {
|
||||
DEBUG ((EFI_D_ERROR, "WARNING: No source level debug %s. \n", DllFileName));
|
||||
}
|
||||
|
||||
mWinNt->HeapFree (mWinNt->GetProcessHeap (), 0, DllFileName);
|
||||
}
|
||||
|
||||
//
|
||||
// Never return an error if PeCoffLoaderRelocateImage() succeeded.
|
||||
// The image will run, but we just can't source level debug. If we
|
||||
// return an error the image will not run.
|
||||
//
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
Performs additional actions just before a PE/COFF image is unloaded. Any resources
|
||||
that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.
|
||||
|
||||
For NT32, this function unloads symbols for source level debugging.
|
||||
|
||||
If ImageContext is NULL, then ASSERT().
|
||||
|
||||
@param ImageContext Pointer to the image context structure that describes the
|
||||
PE/COFF image that is being unloaded.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PeCoffLoaderUnloadImageExtraAction (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
{
|
||||
ASSERT (ImageContext != NULL);
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
## @file
|
||||
# PeCoff extra action libary for Pei phase that run NT32 emulator.
|
||||
#
|
||||
# Lib to provide memory journal status code reporting Routines
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = PeiNt32PeCoffExtraActionLib
|
||||
FILE_GUID = 057C712A-84F0-4f4a-94CB-713EEF002E2F
|
||||
MODULE_TYPE = PEIM
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PeCoffExtraActionLib|PEI_CORE PEIM
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
|
||||
[Sources]
|
||||
PeiNt32PeCoffExtraActionLib.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
PeiServicesLib
|
||||
DebugLib
|
||||
|
||||
[Ppis]
|
||||
gPeiNtThunkPpiGuid # PPI ALWAYS_CONSUMED
|
|
@ -1,253 +0,0 @@
|
|||
/** @file
|
||||
Perform the platform memory test
|
||||
|
||||
Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "PlatformBootManager.h"
|
||||
|
||||
EFI_HII_HANDLE gStringPackHandle = NULL;
|
||||
EFI_GUID mPlatformBootManagerStringPackGuid = {
|
||||
0x154dd51, 0x9079, 0x4a10, { 0x89, 0x5c, 0x9c, 0x7, 0x72, 0x81, 0x57, 0x88 }
|
||||
};
|
||||
// extern UINT8 BdsDxeStrings[];
|
||||
|
||||
//
|
||||
// BDS Platform Functions
|
||||
//
|
||||
|
||||
/**
|
||||
Perform the memory test base on the memory test intensive level,
|
||||
and update the memory resource.
|
||||
|
||||
@param Level The memory test intensive level.
|
||||
|
||||
@retval EFI_STATUS Success test all the system memory and update
|
||||
the memory resource
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PlatformBootManagerMemoryTest (
|
||||
IN EXTENDMEM_COVERAGE_LEVEL Level
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS KeyStatus;
|
||||
EFI_STATUS InitStatus;
|
||||
EFI_STATUS ReturnStatus;
|
||||
BOOLEAN RequireSoftECCInit;
|
||||
EFI_GENERIC_MEMORY_TEST_PROTOCOL *GenMemoryTest;
|
||||
UINT64 TestedMemorySize;
|
||||
UINT64 TotalMemorySize;
|
||||
UINTN TestPercent;
|
||||
UINT64 PreviousValue;
|
||||
BOOLEAN ErrorOut;
|
||||
BOOLEAN TestAbort;
|
||||
EFI_INPUT_KEY Key;
|
||||
CHAR16 StrPercent[80];
|
||||
CHAR16 *StrTotalMemory;
|
||||
CHAR16 *Pos;
|
||||
CHAR16 *TmpStr;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
|
||||
UINT32 TempData;
|
||||
UINTN StrTotalMemorySize;
|
||||
|
||||
ReturnStatus = EFI_SUCCESS;
|
||||
ZeroMem (&Key, sizeof (EFI_INPUT_KEY));
|
||||
|
||||
StrTotalMemorySize = 128;
|
||||
Pos = AllocateZeroPool (StrTotalMemorySize);
|
||||
ASSERT (Pos != NULL);
|
||||
|
||||
if (gStringPackHandle == NULL) {
|
||||
gStringPackHandle = HiiAddPackages (
|
||||
&mPlatformBootManagerStringPackGuid,
|
||||
gImageHandle,
|
||||
PlatformBootManagerLibStrings,
|
||||
NULL
|
||||
);
|
||||
ASSERT (gStringPackHandle != NULL);
|
||||
}
|
||||
|
||||
StrTotalMemory = Pos;
|
||||
|
||||
TestedMemorySize = 0;
|
||||
TotalMemorySize = 0;
|
||||
PreviousValue = 0;
|
||||
ErrorOut = FALSE;
|
||||
TestAbort = FALSE;
|
||||
|
||||
SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
|
||||
SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
|
||||
SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
|
||||
|
||||
RequireSoftECCInit = FALSE;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiGenericMemTestProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &GenMemoryTest
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreePool (Pos);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
InitStatus = GenMemoryTest->MemoryTestInit (
|
||||
GenMemoryTest,
|
||||
Level,
|
||||
&RequireSoftECCInit
|
||||
);
|
||||
if (InitStatus == EFI_NO_MEDIA) {
|
||||
//
|
||||
// The PEI codes also have the relevant memory test code to check the memory,
|
||||
// it can select to test some range of the memory or all of them. If PEI code
|
||||
// checks all the memory, this BDS memory test will has no not-test memory to
|
||||
// do the test, and then the status of EFI_NO_MEDIA will be returned by
|
||||
// "MemoryTestInit". So it does not need to test memory again, just return.
|
||||
//
|
||||
FreePool (Pos);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
|
||||
TmpStr = HiiGetString (gStringPackHandle, STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST), NULL);
|
||||
|
||||
if (TmpStr != NULL) {
|
||||
PrintXY (10, 10, NULL, NULL, TmpStr);
|
||||
FreePool (TmpStr);
|
||||
}
|
||||
} else {
|
||||
DEBUG ((EFI_D_INFO, "Enter memory test.\n"));
|
||||
}
|
||||
do {
|
||||
Status = GenMemoryTest->PerformMemoryTest (
|
||||
GenMemoryTest,
|
||||
&TestedMemorySize,
|
||||
&TotalMemorySize,
|
||||
&ErrorOut,
|
||||
TestAbort
|
||||
);
|
||||
if (ErrorOut && (Status == EFI_DEVICE_ERROR)) {
|
||||
TmpStr = HiiGetString (gStringPackHandle, STRING_TOKEN (STR_SYSTEM_MEM_ERROR), NULL);
|
||||
if (TmpStr != NULL) {
|
||||
PrintXY (10, 10, NULL, NULL, TmpStr);
|
||||
FreePool (TmpStr);
|
||||
}
|
||||
|
||||
ASSERT (0);
|
||||
}
|
||||
|
||||
if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
|
||||
TempData = (UINT32) DivU64x32 (TotalMemorySize, 16);
|
||||
TestPercent = (UINTN) DivU64x32 (
|
||||
DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16),
|
||||
TempData
|
||||
);
|
||||
if (TestPercent != PreviousValue) {
|
||||
UnicodeValueToStringS (StrPercent, sizeof (StrPercent), 0, TestPercent, 0);
|
||||
TmpStr = HiiGetString (gStringPackHandle, STRING_TOKEN (STR_MEMORY_TEST_PERCENT), NULL);
|
||||
if (TmpStr != NULL) {
|
||||
//
|
||||
// TmpStr size is 64, StrPercent is reserved to 16.
|
||||
//
|
||||
StrnCatS (
|
||||
StrPercent,
|
||||
sizeof (StrPercent) / sizeof (CHAR16),
|
||||
TmpStr,
|
||||
sizeof (StrPercent) / sizeof (CHAR16) - StrLen (StrPercent) - 1
|
||||
);
|
||||
PrintXY (10, 10, NULL, NULL, StrPercent);
|
||||
FreePool (TmpStr);
|
||||
}
|
||||
|
||||
TmpStr = HiiGetString (gStringPackHandle, STRING_TOKEN (STR_PERFORM_MEM_TEST), NULL);
|
||||
if (TmpStr != NULL) {
|
||||
BootLogoUpdateProgress (
|
||||
Foreground,
|
||||
Background,
|
||||
TmpStr,
|
||||
Color,
|
||||
TestPercent,
|
||||
(UINTN) PreviousValue
|
||||
);
|
||||
FreePool (TmpStr);
|
||||
}
|
||||
}
|
||||
|
||||
PreviousValue = TestPercent;
|
||||
} else {
|
||||
DEBUG ((EFI_D_INFO, "Perform memory test (ESC to skip).\n"));
|
||||
}
|
||||
|
||||
if (!PcdGetBool (PcdConInConnectOnDemand)) {
|
||||
KeyStatus = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
if (!EFI_ERROR (KeyStatus) && (Key.ScanCode == SCAN_ESC)) {
|
||||
if (!RequireSoftECCInit) {
|
||||
if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
|
||||
TmpStr = HiiGetString (gStringPackHandle, STRING_TOKEN (STR_PERFORM_MEM_TEST), NULL);
|
||||
if (TmpStr != NULL) {
|
||||
BootLogoUpdateProgress (
|
||||
Foreground,
|
||||
Background,
|
||||
TmpStr,
|
||||
Color,
|
||||
100,
|
||||
(UINTN) PreviousValue
|
||||
);
|
||||
FreePool (TmpStr);
|
||||
}
|
||||
|
||||
PrintXY (10, 10, NULL, NULL, L"100");
|
||||
}
|
||||
Status = GenMemoryTest->Finished (GenMemoryTest);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
TestAbort = TRUE;
|
||||
}
|
||||
}
|
||||
} while (Status != EFI_NOT_FOUND);
|
||||
|
||||
Status = GenMemoryTest->Finished (GenMemoryTest);
|
||||
|
||||
Done:
|
||||
if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
|
||||
UnicodeValueToStringS (StrTotalMemory, StrTotalMemorySize, COMMA_TYPE, TotalMemorySize, 0);
|
||||
if (StrTotalMemory[0] == L',') {
|
||||
StrTotalMemory++;
|
||||
StrTotalMemorySize -= sizeof (CHAR16);
|
||||
}
|
||||
|
||||
TmpStr = HiiGetString (gStringPackHandle, STRING_TOKEN (STR_MEM_TEST_COMPLETED), NULL);
|
||||
if (TmpStr != NULL) {
|
||||
StrnCatS (
|
||||
StrTotalMemory,
|
||||
StrTotalMemorySize / sizeof (CHAR16),
|
||||
TmpStr,
|
||||
StrTotalMemorySize / sizeof (CHAR16) - StrLen (StrTotalMemory) - 1
|
||||
);
|
||||
FreePool (TmpStr);
|
||||
}
|
||||
|
||||
PrintXY (10, 10, NULL, NULL, StrTotalMemory);
|
||||
BootLogoUpdateProgress (
|
||||
Foreground,
|
||||
Background,
|
||||
StrTotalMemory,
|
||||
Color,
|
||||
100,
|
||||
(UINTN) PreviousValue
|
||||
);
|
||||
|
||||
} else {
|
||||
DEBUG ((EFI_D_INFO, "%d bytes of system memory tested OK\r\n", TotalMemorySize));
|
||||
}
|
||||
|
||||
FreePool (Pos);
|
||||
return ReturnStatus;
|
||||
}
|
|
@ -1,416 +0,0 @@
|
|||
/** @file
|
||||
This file include all platform action which can be customized
|
||||
by IBV/OEM.
|
||||
|
||||
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "PlatformBootManager.h"
|
||||
|
||||
EFI_GUID mBootMenuFile = {
|
||||
0xEEC25BDC, 0x67F2, 0x4D95, { 0xB1, 0xD5, 0xF8, 0x1B, 0x20, 0x39, 0xD1, 0x1D }
|
||||
};
|
||||
|
||||
/**
|
||||
Perform the platform diagnostic, such like test memory. OEM/IBV also
|
||||
can customize this function to support specific platform diagnostic.
|
||||
|
||||
@param MemoryTestLevel The memory test intensive level
|
||||
@param QuietBoot Indicate if need to enable the quiet boot
|
||||
|
||||
**/
|
||||
VOID
|
||||
PlatformBootManagerDiagnostics (
|
||||
IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel,
|
||||
IN BOOLEAN QuietBoot
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Here we can decide if we need to show
|
||||
// the diagnostics screen
|
||||
// Notes: this quiet boot code should be remove
|
||||
// from the graphic lib
|
||||
//
|
||||
if (QuietBoot) {
|
||||
BootLogoEnableLogo ();
|
||||
|
||||
//
|
||||
// Perform system diagnostic
|
||||
//
|
||||
Status = PlatformBootManagerMemoryTest (MemoryTestLevel);
|
||||
if (EFI_ERROR (Status)) {
|
||||
BootLogoDisableLogo ();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Perform system diagnostic
|
||||
//
|
||||
Status = PlatformBootManagerMemoryTest (MemoryTestLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
Do the platform specific action before the console is connected.
|
||||
|
||||
Such as:
|
||||
Update console variable;
|
||||
Register new Driver#### or Boot####;
|
||||
Signal ReadyToLock event.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PlatformBootManagerBeforeConsole (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
EFI_STATUS Status;
|
||||
WIN_NT_SYSTEM_CONFIGURATION *Configuration;
|
||||
|
||||
GetVariable2 (L"Setup", &gEfiWinNtSystemConfigGuid, (VOID **) &Configuration, NULL);
|
||||
if (Configuration != NULL) {
|
||||
//
|
||||
// SetupVariable is corrupt
|
||||
//
|
||||
Configuration->ConOutRow = PcdGet32 (PcdConOutColumn);
|
||||
Configuration->ConOutColumn = PcdGet32 (PcdConOutRow);
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
L"Setup",
|
||||
&gEfiWinNtSystemConfigGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
sizeof (WIN_NT_SYSTEM_CONFIGURATION),
|
||||
Configuration
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((EFI_D_ERROR, "Failed to save Setup Variable to non-volatile storage, Status = %r\n", Status));
|
||||
}
|
||||
FreePool (Configuration);
|
||||
}
|
||||
|
||||
//
|
||||
// Update the ocnsole variables.
|
||||
//
|
||||
for (Index = 0; gPlatformConsole[Index].DevicePath != NULL; Index++) {
|
||||
if ((gPlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {
|
||||
EfiBootManagerUpdateConsoleVariable (ConIn, gPlatformConsole[Index].DevicePath, NULL);
|
||||
}
|
||||
|
||||
if ((gPlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {
|
||||
EfiBootManagerUpdateConsoleVariable (ConOut, gPlatformConsole[Index].DevicePath, NULL);
|
||||
}
|
||||
|
||||
if ((gPlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {
|
||||
EfiBootManagerUpdateConsoleVariable (ErrOut, gPlatformConsole[Index].DevicePath, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// From PI spec vol2:
|
||||
// Prior to invoking any UEFI drivers, applications, or connecting consoles,
|
||||
// the platform should signal the event EFI_END_OF_DXE_EVENT_GUID
|
||||
//
|
||||
EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);
|
||||
|
||||
//
|
||||
// Dispatch deferred images after EndOfDxe event.
|
||||
//
|
||||
EfiBootManagerDispatchDeferredImages ();
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the priority number.
|
||||
|
||||
@param BootOption
|
||||
**/
|
||||
UINTN
|
||||
BootOptionPriority (
|
||||
CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
|
||||
)
|
||||
{
|
||||
//
|
||||
// Make sure Shell is first
|
||||
//
|
||||
if (StrCmp (BootOption->Description, L"UEFI Shell") == 0) {
|
||||
return 0;
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
|
||||
INTN
|
||||
EFIAPI
|
||||
CompareBootOption (
|
||||
CONST EFI_BOOT_MANAGER_LOAD_OPTION *Left,
|
||||
CONST EFI_BOOT_MANAGER_LOAD_OPTION *Right
|
||||
)
|
||||
{
|
||||
return BootOptionPriority (Left) - BootOptionPriority (Right);
|
||||
}
|
||||
|
||||
/**
|
||||
Generate device path include the input file guid info.
|
||||
|
||||
@param FileGuid Input file guid for the BootManagerMenuApp.
|
||||
|
||||
@retval DevicePath for BootManagerMenuApp.
|
||||
**/
|
||||
EFI_DEVICE_PATH *
|
||||
FvFilePath (
|
||||
EFI_GUID *FileGuid
|
||||
)
|
||||
{
|
||||
|
||||
EFI_STATUS Status;
|
||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;
|
||||
|
||||
EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid);
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
gImageHandle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
(VOID **) &LoadedImage
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return AppendDevicePathNode (
|
||||
DevicePathFromHandle (LoadedImage->DeviceHandle),
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &FileNode
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Create one boot option for BootManagerMenuApp.
|
||||
|
||||
@param FileGuid Input file guid for the BootManagerMenuApp.
|
||||
@param Description Description of the BootManagerMenuApp boot option.
|
||||
@param Position Position of the new load option to put in the ****Order variable.
|
||||
@param IsBootCategory Whether this is a boot category.
|
||||
|
||||
|
||||
@retval OptionNumber Return the option number info.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
RegisterBootManagerMenuAppBootOption (
|
||||
EFI_GUID *FileGuid,
|
||||
CHAR16 *Description,
|
||||
UINTN Position,
|
||||
BOOLEAN IsBootCategory
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION NewOption;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
UINTN OptionNumber;
|
||||
|
||||
DevicePath = FvFilePath (FileGuid);
|
||||
Status = EfiBootManagerInitializeLoadOption (
|
||||
&NewOption,
|
||||
LoadOptionNumberUnassigned,
|
||||
LoadOptionTypeBoot,
|
||||
IsBootCategory ? LOAD_OPTION_ACTIVE : LOAD_OPTION_CATEGORY_APP,
|
||||
Description,
|
||||
DevicePath,
|
||||
NULL,
|
||||
0
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
FreePool (DevicePath);
|
||||
|
||||
Status = EfiBootManagerAddLoadOptionVariable (&NewOption, Position);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
OptionNumber = NewOption.OptionNumber;
|
||||
|
||||
EfiBootManagerFreeLoadOption (&NewOption);
|
||||
|
||||
return OptionNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
Check if it's a Device Path pointing to BootManagerMenuApp.
|
||||
|
||||
@param DevicePath Input device path.
|
||||
|
||||
@retval TRUE The device path is BootManagerMenuApp File Device Path.
|
||||
@retval FALSE The device path is NOT BootManagerMenuApp File Device Path.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsBootManagerMenuAppFilePath (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
{
|
||||
EFI_HANDLE FvHandle;
|
||||
VOID *NameGuid;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid, &DevicePath, &FvHandle);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) DevicePath);
|
||||
if (NameGuid != NULL) {
|
||||
return CompareGuid (NameGuid, &mBootMenuFile);
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Return the boot option number to the BootManagerMenuApp.
|
||||
|
||||
If not found it in the current boot option, create a new one.
|
||||
|
||||
@retval OptionNumber Return the boot option number to the BootManagerMenuApp.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
GetBootManagerMenuAppOption (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINTN BootOptionCount;
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
|
||||
UINTN Index;
|
||||
UINTN OptionNumber;
|
||||
|
||||
OptionNumber = 0;
|
||||
|
||||
BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
|
||||
|
||||
for (Index = 0; Index < BootOptionCount; Index++) {
|
||||
if (IsBootManagerMenuAppFilePath (BootOptions[Index].FilePath)) {
|
||||
OptionNumber = BootOptions[Index].OptionNumber;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
|
||||
|
||||
if (Index >= BootOptionCount) {
|
||||
//
|
||||
// If not found the BootManagerMenuApp, create it.
|
||||
//
|
||||
OptionNumber = (UINT16) RegisterBootManagerMenuAppBootOption (&mBootMenuFile, L"UEFI BootManagerMenuApp", (UINTN) -1, FALSE);
|
||||
}
|
||||
|
||||
return OptionNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
Do the platform specific action after the console is connected.
|
||||
|
||||
Such as:
|
||||
Dynamically switch output mode;
|
||||
Signal console ready platform customized event;
|
||||
Run diagnostics like memory testing;
|
||||
Connect certain devices;
|
||||
Dispatch aditional option roms.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PlatformBootManagerAfterConsole (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL White;
|
||||
EFI_INPUT_KEY Enter;
|
||||
EFI_INPUT_KEY F2;
|
||||
EFI_INPUT_KEY F7;
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
|
||||
UINTN OptionNumber;
|
||||
|
||||
Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
|
||||
White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
|
||||
|
||||
EfiBootManagerConnectAll ();
|
||||
EfiBootManagerRefreshAllBootOption ();
|
||||
|
||||
//
|
||||
// Register ENTER as CONTINUE key
|
||||
//
|
||||
Enter.ScanCode = SCAN_NULL;
|
||||
Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;
|
||||
EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);
|
||||
//
|
||||
// Map F2 to Boot Manager Menu
|
||||
//
|
||||
F2.ScanCode = SCAN_F2;
|
||||
F2.UnicodeChar = CHAR_NULL;
|
||||
EfiBootManagerGetBootManagerMenu (&BootOption);
|
||||
EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 0, &F2, NULL);
|
||||
|
||||
//
|
||||
// 3. Boot Device List menu
|
||||
//
|
||||
F7.ScanCode = SCAN_F7;
|
||||
F7.UnicodeChar = CHAR_NULL;
|
||||
OptionNumber = GetBootManagerMenuAppOption ();
|
||||
EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)OptionNumber, 0, &F7, NULL);
|
||||
|
||||
//
|
||||
// Make Shell as the first boot option
|
||||
//
|
||||
EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, (SORT_COMPARE) CompareBootOption);
|
||||
|
||||
PlatformBootManagerDiagnostics (QUICK, TRUE);
|
||||
|
||||
PrintXY (10, 10, &White, &Black, L"F2 to enter Setup. ");
|
||||
PrintXY (10, 30, &White, &Black, L"F7 to enter Boot Manager Menu.");
|
||||
PrintXY (10, 50, &White, &Black, L"Enter to boot directly.");
|
||||
}
|
||||
|
||||
/**
|
||||
This function is called each second during the boot manager waits the timeout.
|
||||
|
||||
@param TimeoutRemain The remaining timeout.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PlatformBootManagerWaitCallback (
|
||||
UINT16 TimeoutRemain
|
||||
)
|
||||
{
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White;
|
||||
UINT16 Timeout;
|
||||
|
||||
Timeout = PcdGet16 (PcdPlatformBootTimeOut);
|
||||
|
||||
Black.Raw = 0x00000000;
|
||||
White.Raw = 0x00FFFFFF;
|
||||
|
||||
BootLogoUpdateProgress (
|
||||
White.Pixel,
|
||||
Black.Pixel,
|
||||
L"Start boot option",
|
||||
White.Pixel,
|
||||
(Timeout - TimeoutRemain) * 100 / Timeout,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
The function is called when no boot option could be launched,
|
||||
including platform recovery options and options pointing to applications
|
||||
built into firmware volumes.
|
||||
|
||||
If this function returns, BDS attempts to enter an infinite loop.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PlatformBootManagerUnableToBoot (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
/**@file
|
||||
Head file for BDS Platform specific code
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#ifndef _PLATFORM_BOOT_MANAGER_H
|
||||
#define _PLATFORM_BOOT_MANAGER_H
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <Guid/WinNtSystemConfig.h>
|
||||
#include <Protocol/GenericMemoryTest.h>
|
||||
#include <Protocol/WinNtThunk.h>
|
||||
#include <Protocol/WinNtIo.h>
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/FirmwareVolume2.h>
|
||||
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/UefiBootManagerLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/HiiLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/DxeServicesLib.h>
|
||||
#include <Library/BootLogoLib.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
UINTN ConnectType;
|
||||
} PLATFORM_CONSOLE_CONNECT_ENTRY;
|
||||
|
||||
extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
|
||||
|
||||
#define gEndEntire \
|
||||
{ \
|
||||
END_DEVICE_PATH_TYPE,\
|
||||
END_ENTIRE_DEVICE_PATH_SUBTYPE,\
|
||||
END_DEVICE_PATH_LENGTH,\
|
||||
0\
|
||||
}
|
||||
|
||||
#define CONSOLE_OUT BIT0
|
||||
#define CONSOLE_IN BIT1
|
||||
#define STD_ERROR BIT2
|
||||
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH VendorDevicePath;
|
||||
UINT32 Instance;
|
||||
} WIN_NT_VENDOR_DEVICE_PATH_NODE;
|
||||
|
||||
//
|
||||
// Below is the platform console device path
|
||||
//
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH NtBus;
|
||||
WIN_NT_VENDOR_DEVICE_PATH_NODE SerialDevice;
|
||||
UART_DEVICE_PATH Uart;
|
||||
VENDOR_DEVICE_PATH TerminalType;
|
||||
EFI_DEVICE_PATH_PROTOCOL End;
|
||||
} NT_ISA_SERIAL_DEVICE_PATH;
|
||||
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH NtBus;
|
||||
WIN_NT_VENDOR_DEVICE_PATH_NODE NtGopDevice;
|
||||
EFI_DEVICE_PATH_PROTOCOL End;
|
||||
} NT_PLATFORM_GOP_DEVICE_PATH;
|
||||
|
||||
/**
|
||||
Use SystemTable Conout to stop video based Simple Text Out consoles from going
|
||||
to the video device. Put up LogoFile on every video device that is a console.
|
||||
|
||||
@param[in] LogoFile File name of logo to display on the center of the screen.
|
||||
|
||||
@retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.
|
||||
@retval EFI_UNSUPPORTED Logo not found
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PlatformBootManagerEnableQuietBoot (
|
||||
IN EFI_GUID *LogoFile
|
||||
);
|
||||
|
||||
/**
|
||||
Use SystemTable Conout to turn on video based Simple Text Out consoles. The
|
||||
Simple Text Out screens will now be synced up with all non video output devices
|
||||
|
||||
@retval EFI_SUCCESS UGA devices are back in text mode and synced up.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PlatformBootManagerDisableQuietBoot (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Perform the memory test base on the memory test intensive level,
|
||||
and update the memory resource.
|
||||
|
||||
@param Level The memory test intensive level.
|
||||
|
||||
@retval EFI_STATUS Success test all the system memory and update
|
||||
the memory resource
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PlatformBootManagerMemoryTest (
|
||||
IN EXTENDMEM_COVERAGE_LEVEL Level
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Show progress bar with title above it. It only works in Graphics mode.
|
||||
|
||||
|
||||
@param TitleForeground Foreground color for Title.
|
||||
@param TitleBackground Background color for Title.
|
||||
@param Title Title above progress bar.
|
||||
@param ProgressColor Progress bar color.
|
||||
@param Progress Progress (0-100)
|
||||
@param PreviousValue The previous value of the progress.
|
||||
|
||||
@retval EFI_STATUS Success update the progress bar
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PlatformBootManagerShowProgress (
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
|
||||
IN CHAR16 *Title,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
|
||||
IN UINTN Progress,
|
||||
IN UINTN PreviousValue
|
||||
);
|
||||
|
||||
#endif // _PLATFORM_BOOT_MANAGER_H
|
|
@ -1,69 +0,0 @@
|
|||
## @file
|
||||
# Include all platform action which can be customized by IBV/OEM.
|
||||
#
|
||||
# Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = PlatformBootManagerLib
|
||||
FILE_GUID = F0D9063A-DADB-4185-85E2-D7ACDA93F7A6
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PlatformBootManagerLib|DXE_DRIVER
|
||||
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 EBC
|
||||
#
|
||||
|
||||
[Sources]
|
||||
PlatformData.c
|
||||
PlatformBootManager.c
|
||||
PlatformBootManager.h
|
||||
MemoryTest.c
|
||||
Strings.uni
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
UefiBootServicesTableLib
|
||||
UefiRuntimeServicesTableLib
|
||||
UefiLib
|
||||
UefiBootManagerLib
|
||||
PcdLib
|
||||
DxeServicesLib
|
||||
MemoryAllocationLib
|
||||
DevicePathLib
|
||||
HiiLib
|
||||
PrintLib
|
||||
BootLogoLib
|
||||
|
||||
[Guids]
|
||||
gEfiWinNtSystemConfigGuid
|
||||
gEfiEndOfDxeEventGroupGuid
|
||||
|
||||
[Protocols]
|
||||
gEfiGenericMemTestProtocolGuid ## CONSUMES
|
||||
gEfiGraphicsOutputProtocolGuid ## CONSUMES
|
||||
gEfiUgaDrawProtocolGuid ## CONSUMES
|
||||
gEfiBootLogoProtocolGuid ## CONSUMES
|
||||
gEfiFirmwareVolume2ProtocolGuid ## CONSUMES
|
||||
|
||||
[Pcd]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBootlogoOnlyEnable
|
|
@ -1,152 +0,0 @@
|
|||
/**@file
|
||||
Defined the platform specific device path which will be filled to
|
||||
ConIn/ConOut variables.
|
||||
|
||||
Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#include "PlatformBootManager.h"
|
||||
|
||||
//
|
||||
// Platform specific keyboard device path
|
||||
//
|
||||
NT_PLATFORM_GOP_DEVICE_PATH gGopDevicePath0 = {
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
|
||||
EFI_WIN_NT_THUNK_PROTOCOL_GUID
|
||||
},
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),
|
||||
EFI_WIN_NT_GOP_GUID,
|
||||
0
|
||||
},
|
||||
gEndEntire
|
||||
};
|
||||
|
||||
NT_PLATFORM_GOP_DEVICE_PATH gGopDevicePath1 = {
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
|
||||
EFI_WIN_NT_THUNK_PROTOCOL_GUID
|
||||
},
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),
|
||||
EFI_WIN_NT_GOP_GUID,
|
||||
1
|
||||
},
|
||||
gEndEntire
|
||||
};
|
||||
|
||||
//
|
||||
// Platform specific serial device path
|
||||
//
|
||||
NT_ISA_SERIAL_DEVICE_PATH gNtSerialDevicePath0 = {
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
|
||||
EFI_WIN_NT_THUNK_PROTOCOL_GUID
|
||||
},
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),
|
||||
EFI_WIN_NT_SERIAL_PORT_GUID
|
||||
},
|
||||
{
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_UART_DP,
|
||||
(UINT8) (sizeof (UART_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8),
|
||||
0,
|
||||
115200,
|
||||
8,
|
||||
1,
|
||||
1
|
||||
},
|
||||
{
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_VENDOR_DP,
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
|
||||
DEVICE_PATH_MESSAGING_PC_ANSI
|
||||
},
|
||||
gEndEntire
|
||||
};
|
||||
|
||||
NT_ISA_SERIAL_DEVICE_PATH gNtSerialDevicePath1 = {
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
|
||||
EFI_WIN_NT_THUNK_PROTOCOL_GUID
|
||||
},
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),
|
||||
EFI_WIN_NT_SERIAL_PORT_GUID,
|
||||
1
|
||||
},
|
||||
{
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_UART_DP,
|
||||
(UINT8) (sizeof (UART_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8),
|
||||
0,
|
||||
115200,
|
||||
8,
|
||||
1,
|
||||
1
|
||||
},
|
||||
{
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_VENDOR_DP,
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
|
||||
DEVICE_PATH_MESSAGING_PC_ANSI
|
||||
},
|
||||
gEndEntire
|
||||
};
|
||||
|
||||
//
|
||||
// Predefined platform default console device path
|
||||
//
|
||||
PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = {
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &gNtSerialDevicePath0,
|
||||
(CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
|
||||
},
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &gNtSerialDevicePath1,
|
||||
(CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
|
||||
},
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &gGopDevicePath0,
|
||||
(CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
|
||||
},
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &gGopDevicePath1,
|
||||
(CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
|
||||
},
|
||||
{
|
||||
NULL,
|
||||
0
|
||||
}
|
||||
};
|
|
@ -1,27 +0,0 @@
|
|||
///** @file
|
||||
//
|
||||
// String definitions for PlatformBootManagerLib.
|
||||
//
|
||||
// Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
//**/
|
||||
|
||||
/=#
|
||||
|
||||
#langdef en-US "English"
|
||||
#langdef fr-FR "Français"
|
||||
|
||||
#string STR_PERFORM_MEM_TEST #language en-US "Perform memory test (ESC to skip)"
|
||||
#language fr-FR "Exécute l'examen de mémoire (ESC pour sauter)"
|
||||
#string STR_MEMORY_TEST_PERCENT #language en-US "% of the system memory tested OK"
|
||||
#language fr-FR "% de la mémoire de système essayée D'ACCORD"
|
||||
#string STR_ESC_TO_SKIP_MEM_TEST #language en-US "Press ESC key to skip memory test"
|
||||
#language fr-FR "Appuie sur ESC sauter examen de mémoire"
|
||||
#string STR_MEM_TEST_COMPLETED #language en-US " bytes of system memory tested OK\r\n"
|
||||
#language fr-FR "octets dela mémoire de système essayée D'ACCORD\r\n"
|
||||
#string STR_SYSTEM_MEM_ERROR #language en-US "System encounters memory errors"
|
||||
#language fr-FR "le Système rencontre les erreurs de mémoire"
|
||||
#string STR_START_BOOT_OPTION #language en-US "Start boot option"
|
||||
#language fr-FR "l'option de botte de Début"
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
/** @file
|
||||
Provides a platform-specific method to enable Secure Boot Custom Mode setup.
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
#include <Library/PcdLib.h>
|
||||
|
||||
|
||||
/**
|
||||
|
||||
This function provides a platform-specific method to detect whether the platform
|
||||
is operating by a physically present user.
|
||||
|
||||
Programmatic changing of platform security policy (such as disable Secure Boot,
|
||||
or switch between Standard/Custom Secure Boot mode) MUST NOT be possible during
|
||||
Boot Services or after exiting EFI Boot Services. Only a physically present user
|
||||
is allowed to perform these operations.
|
||||
|
||||
NOTE THAT: This function cannot depend on any EFI Variable Service since they are
|
||||
not available when this function is called in AuthenticateVariable driver.
|
||||
|
||||
@retval TRUE The platform is operated by a physically present user.
|
||||
@retval FALSE The platform is NOT operated by a physically present user.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
UserPhysicalPresent (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
## @file
|
||||
# Provides a platform-specific method to enable Secure Boot Custom Mode setup.
|
||||
#
|
||||
# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = PlatformSecureLib
|
||||
FILE_GUID = F263EC2A-F0DB-4640-8B12-4ED22A506FB1
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PlatformSecureLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_DRIVER
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 EBC
|
||||
#
|
||||
|
||||
[Sources]
|
||||
PlatformSecureLib.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
|
@ -1,135 +0,0 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
#include <Uefi.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/WinNtLib.h>
|
||||
|
||||
/**
|
||||
This function causes a system-wide reset (cold reset), in which
|
||||
all circuitry within the system returns to its initial state. This type of reset
|
||||
is asynchronous to system operation and operates without regard to
|
||||
cycle boundaries.
|
||||
|
||||
If this function returns, it means that the system does not support cold reset.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ResetCold (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
gWinNt->ExitProcess (0);
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
This function causes a system-wide initialization (warm reset), in which all processors
|
||||
are set to their initial state. Pending cycles are not corrupted.
|
||||
|
||||
If this function returns, it means that the system does not support warm reset.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ResetWarm (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
ResetCold ();
|
||||
}
|
||||
|
||||
/**
|
||||
This function causes the system to enter a power state equivalent
|
||||
to the ACPI G2/S5 or G3 states.
|
||||
|
||||
If this function returns, it means that the system does not support shut down reset.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ResetShutdown (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
ResetCold ();
|
||||
}
|
||||
|
||||
/**
|
||||
This function causes the system to enter S3 and then wake up immediately.
|
||||
|
||||
If this function returns, it means that the system does not support S3 feature.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
EnterS3WithImmediateWake (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
ResetCold ();
|
||||
}
|
||||
|
||||
/**
|
||||
This function causes a systemwide reset. The exact type of the reset is
|
||||
defined by the EFI_GUID that follows the Null-terminated Unicode string passed
|
||||
into ResetData. If the platform does not recognize the EFI_GUID in ResetData
|
||||
the platform must pick a supported reset type to perform.The platform may
|
||||
optionally log the parameters from any non-normal reset that occurs.
|
||||
|
||||
@param[in] DataSize The size, in bytes, of ResetData.
|
||||
@param[in] ResetData The data buffer starts with a Null-terminated string,
|
||||
followed by the EFI_GUID.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ResetPlatformSpecific (
|
||||
IN UINTN DataSize,
|
||||
IN VOID *ResetData
|
||||
)
|
||||
{
|
||||
ResetCold ();
|
||||
}
|
||||
|
||||
/**
|
||||
The ResetSystem function resets the entire platform.
|
||||
|
||||
@param[in] ResetType The type of reset to perform.
|
||||
@param[in] ResetStatus The status code for the reset.
|
||||
@param[in] DataSize The size, in bytes, of ResetData.
|
||||
@param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
|
||||
the data buffer starts with a Null-terminated string, optionally
|
||||
followed by additional binary data. The string is a description
|
||||
that the caller may use to further indicate the reason for the
|
||||
system reset.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ResetSystem (
|
||||
IN EFI_RESET_TYPE ResetType,
|
||||
IN EFI_STATUS ResetStatus,
|
||||
IN UINTN DataSize,
|
||||
IN VOID *ResetData OPTIONAL
|
||||
)
|
||||
{
|
||||
switch (ResetType) {
|
||||
case EfiResetWarm:
|
||||
ResetWarm ();
|
||||
break;
|
||||
|
||||
case EfiResetCold:
|
||||
ResetCold ();
|
||||
break;
|
||||
|
||||
case EfiResetShutdown:
|
||||
ResetShutdown ();
|
||||
return;
|
||||
|
||||
case EfiResetPlatformSpecific:
|
||||
ResetPlatformSpecific (DataSize, ResetData);
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
## @file
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = Nt32ResetSystemLib
|
||||
FILE_GUID = A7EBA1F6-5505-4fba-8895-386EE02B2FAC
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = ResetSystemLib
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
|
||||
[Sources]
|
||||
ResetSystemLib.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
WinNtLib
|
||||
DebugLib
|
|
@ -1,123 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
Metronome.c
|
||||
|
||||
Abstract:
|
||||
|
||||
NT Emulation Metronome Architectural Protocol Driver as defined in DXE CIS
|
||||
|
||||
**/
|
||||
|
||||
#include "Metronome.h"
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
EFI_METRONOME_ARCH_PROTOCOL mMetronome = {
|
||||
WinNtMetronomeDriverWaitForTick,
|
||||
TICK_PERIOD
|
||||
};
|
||||
|
||||
//
|
||||
// Worker Functions
|
||||
//
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtMetronomeDriverWaitForTick (
|
||||
IN EFI_METRONOME_ARCH_PROTOCOL *This,
|
||||
IN UINT32 TickNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
The WaitForTick() function waits for the number of ticks specified by
|
||||
TickNumber from a known time source in the platform. If TickNumber of
|
||||
ticks are detected, then EFI_SUCCESS is returned. The actual time passed
|
||||
between entry of this function and the first tick is between 0 and
|
||||
TickPeriod 100 nS units. If you want to guarantee that at least TickPeriod
|
||||
time has elapsed, wait for two ticks. This function waits for a hardware
|
||||
event to determine when a tick occurs. It is possible for interrupt
|
||||
processing, or exception processing to interrupt the execution of the
|
||||
WaitForTick() function. Depending on the hardware source for the ticks, it
|
||||
is possible for a tick to be missed. This function cannot guarantee that
|
||||
ticks will not be missed. If a timeout occurs waiting for the specified
|
||||
number of ticks, then EFI_TIMEOUT is returned.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - The EFI_METRONOME_ARCH_PROTOCOL instance.
|
||||
TickNumber - Number of ticks to wait.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The wait for the number of ticks specified by TickNumber
|
||||
succeeded.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT64 SleepTime;
|
||||
|
||||
//
|
||||
// Calculate the time to sleep. Win API smallest unit to sleep is 1 millisec
|
||||
// Tick Period is in 100ns units, divide by 10000 to convert to ms
|
||||
//
|
||||
SleepTime = DivU64x32 (MultU64x32 ((UINT64) TickNumber, TICK_PERIOD) + 9999, 10000);
|
||||
gWinNt->Sleep ((UINT32) SleepTime);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtMetronomeDriverInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize the Metronome Architectural Protocol driver
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - ImageHandle of the loaded driver
|
||||
|
||||
|
||||
SystemTable - Pointer to the System Table
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Metronome Architectural Protocol created
|
||||
|
||||
EFI_OUT_OF_RESOURCES - Not enough resources available to initialize driver.
|
||||
|
||||
EFI_DEVICE_ERROR - A device error occured attempting to initialize the driver.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
|
||||
//
|
||||
// Install the Metronome Architectural Protocol onto a new handle
|
||||
//
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&Handle,
|
||||
&gEfiMetronomeArchProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&mMetronome
|
||||
);
|
||||
|
||||
return Status;
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
Metronome.h
|
||||
|
||||
Abstract:
|
||||
|
||||
NT Emulation Metronome Architectural Protocol Driver as defined in DXE CIS
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _NT_THUNK_METRONOME_H_
|
||||
#define _NT_THUNK_METRONOME_H_
|
||||
|
||||
#include <Uefi.h>
|
||||
#include <WinNtDxe.h>
|
||||
#include <Protocol/Metronome.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/WinNtLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
|
||||
|
||||
//
|
||||
// Period of on tick in 100 nanosecond units
|
||||
//
|
||||
#define TICK_PERIOD 2000
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtMetronomeDriverInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - TODO: add argument description
|
||||
SystemTable - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtMetronomeDriverWaitForTick (
|
||||
IN EFI_METRONOME_ARCH_PROTOCOL *This,
|
||||
IN UINT32 TickNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
TickNumber - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
|
@ -1,46 +0,0 @@
|
|||
## @file
|
||||
# NT Emulation Metronome Architectural Protocol Driver as defined in DXE CIS
|
||||
#
|
||||
# This metronome module simulates metronome by Sleep WinAPI.
|
||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = Metronome
|
||||
FILE_GUID = 154CAB4A-52B5-46CD-99C3-4368ABBACFFD
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = WinNtMetronomeDriverInitialize
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
|
||||
[Sources]
|
||||
Metronome.h
|
||||
Metronome.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
UefiBootServicesTableLib
|
||||
WinNtLib
|
||||
UefiDriverEntryPoint
|
||||
BaseLib
|
||||
|
||||
[Protocols]
|
||||
gEfiMetronomeArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||
|
||||
[Depex]
|
||||
TRUE
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscBaseBoardManufacturerData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_BASE_BOARD_MANUFACTURER_DATA, MiscBaseBoardManufacturer) = {
|
||||
STRING_TOKEN(STR_MISC_BASE_BOARD_MANUFACTURER),
|
||||
STRING_TOKEN(STR_MISC_BASE_BOARD_PRODUCT_NAME),
|
||||
STRING_TOKEN(STR_MISC_BASE_BOARD_VERSION),
|
||||
STRING_TOKEN(STR_MISC_BASE_BOARD_SERIAL_NUMBER),
|
||||
STRING_TOKEN(STR_MISC_BASE_BOARD_ASSET_TAG),
|
||||
STRING_TOKEN(STR_MISC_BASE_BOARD_CHASSIS_LOCATION),
|
||||
{ // BaseBoardFeatureFlags
|
||||
1, // Motherboard
|
||||
0, // RequiresDaughterCard
|
||||
0, // Removable
|
||||
1, // Replaceable,
|
||||
0, // HotSwappable
|
||||
0, // Reserved
|
||||
},
|
||||
EfiBaseBoardTypeUnknown, // BaseBoardType
|
||||
{ // BaseBoardChassisLink
|
||||
EFI_MISC_SUBCLASS_GUID, // ProducerName
|
||||
1, // Instance
|
||||
1, // SubInstance
|
||||
},
|
||||
0, // BaseBoardNumberLinks
|
||||
{ // LinkN
|
||||
EFI_MISC_SUBCLASS_GUID, // ProducerName
|
||||
1, // Instance
|
||||
1, // SubInstance
|
||||
},
|
||||
};
|
||||
|
||||
/* eof - MiscBaseBoardManufacturerData.c */
|
|
@ -1,161 +0,0 @@
|
|||
/** @file
|
||||
BaseBoard manufacturer information boot time changes.
|
||||
SMBIOS type 2.
|
||||
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
(C) Copyright 2017 Hewlett Packard Enterprise Development LP<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
/**
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscBaseBoardManufacturer (Type 2).
|
||||
|
||||
@param RecordData Pointer to copy of RecordData from the Data Table.
|
||||
|
||||
@retval EFI_SUCCESS All parameters were valid.
|
||||
@retval EFI_UNSUPPORTED Unexpected RecordType value.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
||||
|
||||
**/
|
||||
MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer)
|
||||
{
|
||||
CHAR8 *OptionalStrStart;
|
||||
UINTN ManuStrLen;
|
||||
UINTN ProductStrLen;
|
||||
UINTN VerStrLen;
|
||||
UINTN AssetTagStrLen;
|
||||
UINTN SerialNumStrLen;
|
||||
UINTN ChassisStrLen;
|
||||
EFI_STATUS Status;
|
||||
EFI_STRING Manufacturer;
|
||||
EFI_STRING Product;
|
||||
EFI_STRING Version;
|
||||
EFI_STRING SerialNumber;
|
||||
EFI_STRING AssetTag;
|
||||
EFI_STRING Chassis;
|
||||
STRING_REF TokenToGet;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
SMBIOS_TABLE_TYPE2 *SmbiosRecord;
|
||||
EFI_MISC_BASE_BOARD_MANUFACTURER *ForType2InputData;
|
||||
|
||||
ForType2InputData = (EFI_MISC_BASE_BOARD_MANUFACTURER *)RecordData;
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (RecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_MANUFACTURER);
|
||||
Manufacturer = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
ManuStrLen = StrLen(Manufacturer);
|
||||
if (ManuStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_PRODUCT_NAME);
|
||||
Product = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
ProductStrLen = StrLen(Product);
|
||||
if (ProductStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_VERSION);
|
||||
Version = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
VerStrLen = StrLen(Version);
|
||||
if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_SERIAL_NUMBER);
|
||||
SerialNumber = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
SerialNumStrLen = StrLen(SerialNumber);
|
||||
if (SerialNumStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_ASSET_TAG);
|
||||
AssetTag = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
AssetTagStrLen = StrLen(AssetTag);
|
||||
if (AssetTagStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_CHASSIS_LOCATION);
|
||||
Chassis = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
ChassisStrLen = StrLen(Chassis);
|
||||
if (ChassisStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Two zeros following the last string.
|
||||
//
|
||||
// Since we fill NumberOfContainedObjectHandles = 0, remove sizeof (UINT16) bytes for ContainedObjectHandles[1]
|
||||
//
|
||||
SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE2) - sizeof (UINT16) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssetTagStrLen + 1 + ChassisStrLen + 1 + 1);
|
||||
ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE2) - sizeof (UINT16) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssetTagStrLen + 1 + ChassisStrLen + 1 + 1);
|
||||
|
||||
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION;
|
||||
//
|
||||
// Since we fill NumberOfContainedObjectHandles = 0, remove sizeof (UINT16) bytes for ContainedObjectHandles[1]
|
||||
//
|
||||
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2) - sizeof (UINT16);
|
||||
//
|
||||
// Make handle chosen by smbios protocol.add automatically.
|
||||
//
|
||||
SmbiosRecord->Hdr.Handle = 0;
|
||||
//
|
||||
// Manu will be the 1st optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->Manufacturer = 1;
|
||||
//
|
||||
// ProductName will be the 2st optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->ProductName = 2;
|
||||
//
|
||||
// Version will be the 3rd optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->Version = 3;
|
||||
//
|
||||
// SerialNumber will be the 4th optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->SerialNumber = 4;
|
||||
//
|
||||
// AssetTag will be the 5th optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->AssetTag = 5;
|
||||
|
||||
//
|
||||
// LocationInChassis will be the 6th optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->LocationInChassis = 6;
|
||||
SmbiosRecord->FeatureFlag = (*(BASE_BOARD_FEATURE_FLAGS*)&(ForType2InputData->BaseBoardFeatureFlags));
|
||||
SmbiosRecord->ChassisHandle = 0;
|
||||
SmbiosRecord->BoardType = (UINT8)ForType2InputData->BaseBoardType;
|
||||
SmbiosRecord->NumberOfContainedObjectHandles = 0;
|
||||
|
||||
OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
|
||||
//
|
||||
// Since we fill NumberOfContainedObjectHandles = 0, just after this field to fill string
|
||||
//
|
||||
OptionalStrStart -= sizeof (UINT16);
|
||||
UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart);
|
||||
UnicodeStrToAsciiStr(Product, OptionalStrStart + ManuStrLen + 1);
|
||||
UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1);
|
||||
UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1);
|
||||
UnicodeStrToAsciiStr(AssetTag, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1);
|
||||
UnicodeStrToAsciiStr(Chassis, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssetTagStrLen + 1);
|
||||
//
|
||||
// Now we have got the full smbios record, call smbios protocol to add this record.
|
||||
//
|
||||
Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
|
||||
|
||||
FreePool(SmbiosRecord);
|
||||
return Status;
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscBiosVendorData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_BIOS_VENDOR_DATA, MiscBiosVendor) = {
|
||||
STRING_TOKEN(STR_MISC_BIOS_VENDOR), // BiosVendor
|
||||
STRING_TOKEN(STR_MISC_BIOS_VERSION), // BiosVersion
|
||||
STRING_TOKEN(STR_MISC_BIOS_RELEASE_DATE), // BiosReleaseDate
|
||||
0xBABE, // BiosStartingAddress
|
||||
{ // BiosPhysicalDeviceSize
|
||||
2, // Value
|
||||
3, // Exponent
|
||||
},
|
||||
{ // BiosCharacteristics1
|
||||
0, // Reserved1 :2
|
||||
0, // Unknown :1
|
||||
1, // BiosCharacteristicsNotSupported :1
|
||||
0, // IsaIsSupported :1
|
||||
0, // McaIsSupported :1
|
||||
0, // EisaIsSupported :1
|
||||
0, // PciIsSupported :1
|
||||
0, // PcmciaIsSupported :1
|
||||
0, // PlugAndPlayIsSupported :1
|
||||
0, // ApmIsSupported :1
|
||||
0, // BiosIsUpgradable :1
|
||||
0, // BiosShadowingAllowed :1
|
||||
0, // VlVesaIsSupported :1
|
||||
0, // EscdSupportIsAvailable :1
|
||||
0, // BootFromCdIsSupported :1
|
||||
0, // SelectableBootIsSupported :1
|
||||
0, // RomBiosIsSocketed :1
|
||||
0, // BootFromPcmciaIsSupported :1
|
||||
0, // EDDSpecificationIsSupported :1
|
||||
0, // JapaneseNecFloppyIsSupported :1
|
||||
0, // JapaneseToshibaFloppyIsSupported :1
|
||||
0, // Floppy525_360IsSupported :1
|
||||
0, // Floppy525_12IsSupported :1
|
||||
0, // Floppy35_720IsSupported :1
|
||||
0, // Floppy35_288IsSupported :1
|
||||
0, // PrintScreenIsSupported :1
|
||||
0, // Keyboard8042IsSupported :1
|
||||
0, // SerialIsSupported :1
|
||||
0, // PrinterIsSupported :1
|
||||
0, // CgaMonoIsSupported :1
|
||||
0, // NecPc98 :1
|
||||
0, // AcpiIsSupported :1
|
||||
0, // UsbLegacyIsSupported :1
|
||||
0, // AgpIsSupported :1
|
||||
0, // I20BootIsSupported :1
|
||||
0, // Ls120BootIsSupported :1
|
||||
0, // AtapiZipDriveBootIsSupported :1
|
||||
0, // Boot1394IsSupported :1
|
||||
0, // SmartBatteryIsSupported :1
|
||||
0, // BiosBootSpecIsSupported :1
|
||||
0, // FunctionKeyNetworkBootIsSupported :1
|
||||
0 // Reserved :22
|
||||
},
|
||||
{ // BiosCharacteristics2
|
||||
0, // BiosReserved :16
|
||||
0, // SystemReserved :16
|
||||
0 // Reserved :32
|
||||
},
|
||||
};
|
||||
|
||||
/* eof - MiscBiosVendorData.c */
|
|
@ -1,190 +0,0 @@
|
|||
/** @file
|
||||
BIOS vendor information boot time changes.
|
||||
Misc. subclass type 2.
|
||||
SMBIOS type 0.
|
||||
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
/**
|
||||
This function returns the value & exponent to Base2 for a given
|
||||
Hex value. This is used to calculate the BiosPhysicalDeviceSize.
|
||||
|
||||
@param Value The hex value which is to be converted into value-exponent form
|
||||
@param Exponent The exponent out of the conversion
|
||||
|
||||
@retval EFI_SUCCESS All parameters were valid and *Value & *Exponent have been set.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetValueExponentBase2(
|
||||
IN OUT UINTN *Value,
|
||||
OUT UINTN *Exponent
|
||||
)
|
||||
{
|
||||
if ((Value == NULL) || (Exponent == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
while ((*Value % 2) == 0) {
|
||||
*Value=*Value/2;
|
||||
(*Exponent)++;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Field Filling Function. Transform an EFI_EXP_BASE2_DATA to a byte, with '64k'
|
||||
as the unit.
|
||||
|
||||
@param Base2Data Pointer to Base2_Data
|
||||
|
||||
@retval EFI_SUCCESS Transform successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
Base2ToByteWith64KUnit (
|
||||
IN EFI_EXP_BASE2_DATA *Base2Data
|
||||
)
|
||||
{
|
||||
UINT16 Value;
|
||||
UINT16 Exponent;
|
||||
|
||||
Value = Base2Data->Value;
|
||||
Exponent = Base2Data->Exponent;
|
||||
Exponent -= 16;
|
||||
Value <<= Exponent;
|
||||
|
||||
return Value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscBiosVendor (Type 0).
|
||||
|
||||
@param RecordData Pointer to copy of RecordData from the Data Table.
|
||||
|
||||
@retval EFI_SUCCESS All parameters were valid.
|
||||
@retval EFI_UNSUPPORTED Unexpected RecordType value.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
||||
|
||||
**/
|
||||
MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor)
|
||||
{
|
||||
CHAR8 *OptionalStrStart;
|
||||
UINTN VendorStrLen;
|
||||
UINTN VerStrLen;
|
||||
UINTN DateStrLen;
|
||||
CHAR16 *Version;
|
||||
CHAR16 *ReleaseDate;
|
||||
EFI_STATUS Status;
|
||||
EFI_STRING Char16String;
|
||||
STRING_REF TokenToGet;
|
||||
STRING_REF TokenToUpdate;
|
||||
SMBIOS_TABLE_TYPE0 *SmbiosRecord;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
EFI_MISC_BIOS_VENDOR *ForType0InputData;
|
||||
|
||||
ForType0InputData = (EFI_MISC_BIOS_VENDOR *)RecordData;
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (RecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Version = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
|
||||
if (StrLen (Version) > 0) {
|
||||
TokenToUpdate = STRING_TOKEN (STR_MISC_BIOS_VERSION);
|
||||
HiiSetString (mHiiHandle, TokenToUpdate, Version, NULL);
|
||||
}
|
||||
|
||||
ReleaseDate = (CHAR16 *) PcdGetPtr (PcdFirmwareReleaseDateString);
|
||||
if (StrLen(ReleaseDate) > 0) {
|
||||
TokenToUpdate = STRING_TOKEN (STR_MISC_BIOS_RELEASE_DATE);
|
||||
HiiSetString (mHiiHandle, TokenToUpdate, ReleaseDate, NULL);
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_BIOS_VENDOR);
|
||||
Char16String = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
VendorStrLen = StrLen(Char16String);
|
||||
if (VendorStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_BIOS_VERSION);
|
||||
Version = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
VerStrLen = StrLen(Version);
|
||||
if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_BIOS_RELEASE_DATE);
|
||||
ReleaseDate = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
DateStrLen = StrLen(ReleaseDate);
|
||||
if (DateStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Two zeros following the last string.
|
||||
//
|
||||
SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1);
|
||||
ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1);
|
||||
|
||||
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_INFORMATION;
|
||||
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE0);
|
||||
//
|
||||
// Make handle chosen by smbios protocol.add automatically.
|
||||
//
|
||||
SmbiosRecord->Hdr.Handle = 0;
|
||||
//
|
||||
// Vendor will be the 1st optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->Vendor = 1;
|
||||
//
|
||||
// Version will be the 2nd optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->BiosVersion = 2;
|
||||
SmbiosRecord->BiosSegment = (UINT16)ForType0InputData->BiosStartingAddress;
|
||||
//
|
||||
// ReleaseDate will be the 3rd optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->BiosReleaseDate = 3;
|
||||
//
|
||||
// Nt32 has no PCD value to indicate BIOS Size, just fill 0 for simply.
|
||||
//
|
||||
SmbiosRecord->BiosSize = 0;
|
||||
SmbiosRecord->BiosCharacteristics = *(MISC_BIOS_CHARACTERISTICS*)(&ForType0InputData->BiosCharacteristics1);
|
||||
//
|
||||
// CharacterExtensionBytes also store in ForType0InputData->BiosCharacteristics1 later two bytes to save size.
|
||||
//
|
||||
SmbiosRecord->BIOSCharacteristicsExtensionBytes[0] = *((UINT8 *) &ForType0InputData->BiosCharacteristics1 + 4);
|
||||
SmbiosRecord->BIOSCharacteristicsExtensionBytes[1] = *((UINT8 *) &ForType0InputData->BiosCharacteristics1 + 5);
|
||||
|
||||
SmbiosRecord->SystemBiosMajorRelease = ForType0InputData->BiosMajorRelease;
|
||||
SmbiosRecord->SystemBiosMinorRelease = ForType0InputData->BiosMinorRelease;
|
||||
SmbiosRecord->EmbeddedControllerFirmwareMajorRelease = ForType0InputData->BiosEmbeddedFirmwareMajorRelease;
|
||||
SmbiosRecord->EmbeddedControllerFirmwareMinorRelease = ForType0InputData->BiosEmbeddedFirmwareMinorRelease;
|
||||
|
||||
OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
|
||||
UnicodeStrToAsciiStr(Char16String, OptionalStrStart);
|
||||
UnicodeStrToAsciiStr(Version, OptionalStrStart + VendorStrLen + 1);
|
||||
UnicodeStrToAsciiStr(ReleaseDate, OptionalStrStart + VendorStrLen + 1 + VerStrLen + 1);
|
||||
//
|
||||
// Now we have got the full smbios record, call smbios protocol to add this record.
|
||||
//
|
||||
Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
|
||||
|
||||
FreePool(SmbiosRecord);
|
||||
return Status;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscBootInformationData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_BOOT_INFORMATION_STATUS_DATA, BootInformationStatus) = {
|
||||
EfiBootInformationStatusNoError, // BootInformationStatus
|
||||
0 // BootInformationData
|
||||
};
|
||||
|
||||
/* eof - MiscBootInformationData.c */
|
|
@ -1,62 +0,0 @@
|
|||
/** @file
|
||||
boot information boot time changes.
|
||||
SMBIOS type 32.
|
||||
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
|
||||
/**
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscBootInformation (Type 32).
|
||||
|
||||
@param RecordData Pointer to copy of RecordData from the Data Table.
|
||||
|
||||
@retval EFI_SUCCESS All parameters were valid.
|
||||
@retval EFI_UNSUPPORTED Unexpected RecordType value.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
||||
|
||||
**/
|
||||
|
||||
MISC_SMBIOS_TABLE_FUNCTION(BootInformationStatus)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
SMBIOS_TABLE_TYPE32 *SmbiosRecord;
|
||||
EFI_MISC_BOOT_INFORMATION_STATUS* ForType32InputData;
|
||||
|
||||
ForType32InputData = (EFI_MISC_BOOT_INFORMATION_STATUS *)RecordData;
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (RecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Two zeros following the last string.
|
||||
//
|
||||
SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
|
||||
ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
|
||||
|
||||
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION;
|
||||
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);
|
||||
//
|
||||
// Make handle chosen by smbios protocol.add automatically.
|
||||
//
|
||||
SmbiosRecord->Hdr.Handle = 0;
|
||||
SmbiosRecord->BootStatus = (UINT8)ForType32InputData->BootInformationStatus;
|
||||
|
||||
//
|
||||
// Now we have got the full smbios record, call smbios protocol to add this record.
|
||||
//
|
||||
Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
|
||||
|
||||
FreePool(SmbiosRecord);
|
||||
return Status;
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
(C) Copyright 2017 Hewlett Packard Enterprise Development LP<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscChassisManufacturerData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Chassis Manufacturer data.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_CHASSIS_MANUFACTURER_DATA, MiscChassisManufacturer) = {
|
||||
STRING_TOKEN(STR_MISC_CHASSIS_MANUFACTURER), // ChassisManufactrurer
|
||||
STRING_TOKEN(STR_MISC_CHASSIS_VERSION), // ChassisVersion
|
||||
STRING_TOKEN(STR_MISC_CHASSIS_SERIAL_NUMBER), // ChassisSerialNumber
|
||||
STRING_TOKEN(STR_MISC_CHASSIS_ASSET_TAG), // ChassisAssetTag
|
||||
{ // ChassisTypeStatus
|
||||
EfiMiscChassisTypeOther, // ChassisType
|
||||
0, // ChassisLockPresent
|
||||
0 // Reserved
|
||||
},
|
||||
EfiChassisStateOther, // ChassisBootupState
|
||||
EfiChassisStateOther, // ChassisPowerSupplyState
|
||||
EfiChassisStateOther, // ChassisThermalState
|
||||
EfiChassisSecurityStatusOther, // ChassisSecurityState
|
||||
0, // ChassisOemDefined
|
||||
1, // Height
|
||||
1 // NumberofPowerCords
|
||||
};
|
||||
|
||||
/* eof - MiscChassisManufacaturerData.c */
|
|
@ -1,171 +0,0 @@
|
|||
/** @file
|
||||
Chassis manufacturer information boot time changes.
|
||||
SMBIOS type 3.
|
||||
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
(C) Copyright 2017 Hewlett Packard Enterprise Development LP<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
/**
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscChassisManufacturer (Type 3).
|
||||
|
||||
@param RecordData Pointer to copy of RecordData from the Data Table.
|
||||
|
||||
@retval EFI_SUCCESS All parameters were valid.
|
||||
@retval EFI_UNSUPPORTED Unexpected RecordType value.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
||||
|
||||
**/
|
||||
MISC_SMBIOS_TABLE_FUNCTION(MiscChassisManufacturer)
|
||||
{
|
||||
CHAR8 *OptionalStrStart;
|
||||
UINTN ManuStrLen;
|
||||
UINTN VerStrLen;
|
||||
UINTN AssetTagStrLen;
|
||||
UINTN SerialNumStrLen;
|
||||
UINTN SkuNumberStrLen;
|
||||
EFI_STATUS Status;
|
||||
EFI_STRING Manufacturer;
|
||||
EFI_STRING Version;
|
||||
EFI_STRING SerialNumber;
|
||||
EFI_STRING AssetTag;
|
||||
EFI_STRING SkuNumber;
|
||||
STRING_REF TokenToGet;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
SMBIOS_TABLE_TYPE3 *SmbiosRecord;
|
||||
EFI_MISC_CHASSIS_MANUFACTURER *ForType3InputData;
|
||||
UINT8 *Buffer;
|
||||
|
||||
ForType3InputData = (EFI_MISC_CHASSIS_MANUFACTURER *)RecordData;
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (RecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_MANUFACTURER);
|
||||
Manufacturer = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
ManuStrLen = StrLen(Manufacturer);
|
||||
if (ManuStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_VERSION);
|
||||
Version = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
VerStrLen = StrLen(Version);
|
||||
if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_SERIAL_NUMBER);
|
||||
SerialNumber = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
SerialNumStrLen = StrLen(SerialNumber);
|
||||
if (SerialNumStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_ASSET_TAG);
|
||||
AssetTag = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
AssetTagStrLen = StrLen(AssetTag);
|
||||
if (AssetTagStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_SKU_NUMBER);
|
||||
SkuNumber = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
SkuNumberStrLen = StrLen(SkuNumber);
|
||||
if (SkuNumberStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Two zeros following the last string.
|
||||
//
|
||||
// Since we set ContainedElementCount = 0 and ContainedElementRecordLength = 0,
|
||||
// remove sizeof (CONTAINED_ELEMENT) for ContainedElements[1].
|
||||
//
|
||||
// Add sizeof (SMBIOS_TABLE_STRING) for SKU Number, since not contained in SMBIOS_TABLE_TYPE3.
|
||||
//
|
||||
SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE3) - sizeof (CONTAINED_ELEMENT) + sizeof (SMBIOS_TABLE_STRING) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssetTagStrLen + 1 + SkuNumberStrLen + 1 + 1);
|
||||
ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE3) - sizeof (CONTAINED_ELEMENT) + sizeof (SMBIOS_TABLE_STRING) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssetTagStrLen + 1 + SkuNumberStrLen + 1 + 1);
|
||||
|
||||
Buffer = (UINT8 *) SmbiosRecord;
|
||||
|
||||
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE;
|
||||
//
|
||||
// Since we set ContainedElementCount = 0 and ContainedElementRecordLength = 0,
|
||||
// remove sizeof (CONTAINED_ELEMENT) for ContainedElements[1].
|
||||
//
|
||||
// Add sizeof (SMBIOS_TABLE_STRING) for SKU Number, since not contained in SMBIOS_TABLE_TYPE3.
|
||||
//
|
||||
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE3) - sizeof (CONTAINED_ELEMENT) + sizeof (SMBIOS_TABLE_STRING);
|
||||
//
|
||||
// Make handle chosen by smbios protocol.add automatically.
|
||||
//
|
||||
SmbiosRecord->Hdr.Handle = 0;
|
||||
//
|
||||
// Manu will be the 1st optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->Manufacturer = 1;
|
||||
SmbiosRecord->Type = (UINT8)ForType3InputData->ChassisType.ChassisType;
|
||||
//
|
||||
// Version will be the 2nd optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->Version = 2;
|
||||
//
|
||||
// SerialNumber will be the 3rd optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->SerialNumber = 3;
|
||||
//
|
||||
// AssetTag will be the 4th optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->AssetTag = 4;
|
||||
|
||||
SmbiosRecord->BootupState = (UINT8)ForType3InputData->ChassisBootupState;
|
||||
SmbiosRecord->PowerSupplyState = (UINT8)ForType3InputData->ChassisPowerSupplyState;
|
||||
SmbiosRecord->ThermalState = (UINT8)ForType3InputData->ChassisThermalState;
|
||||
SmbiosRecord->SecurityStatus = (UINT8)ForType3InputData->ChassisSecurityState;
|
||||
CopyMem (SmbiosRecord->OemDefined,(UINT8*)&ForType3InputData->ChassisOemDefined, 4);
|
||||
SmbiosRecord->Height = (UINT8)ForType3InputData->ChassisHeight;
|
||||
SmbiosRecord->NumberofPowerCords = (UINT8)ForType3InputData->ChassisNumberPowerCords;
|
||||
SmbiosRecord->ContainedElementCount = 0;
|
||||
SmbiosRecord->ContainedElementRecordLength = 0;
|
||||
|
||||
//
|
||||
// SKU Number will be the 5th optional string following the formatted structure.
|
||||
//
|
||||
// Since SKU Number is not in SMBIOS_TABLE_TYPE3 structure, must locate it after ContainedElementRecordLength.
|
||||
//
|
||||
Buffer[sizeof (SMBIOS_TABLE_TYPE3) - sizeof (CONTAINED_ELEMENT)] = 5;
|
||||
|
||||
OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
|
||||
//
|
||||
// Since we set ContainedElementCount = 0 and ContainedElementRecordLength = 0,
|
||||
// remove sizeof (CONTAINED_ELEMENT) for ContainedElements[1].
|
||||
//
|
||||
OptionalStrStart -= sizeof (CONTAINED_ELEMENT);
|
||||
//
|
||||
// Add sizeof (SMBIOS_TABLE_STRING) for SKU Number, since not contained in SMBIOS_TABLE_TYPE3.
|
||||
//
|
||||
OptionalStrStart += sizeof (SMBIOS_TABLE_STRING);
|
||||
UnicodeStrToAsciiStr (Manufacturer, OptionalStrStart);
|
||||
UnicodeStrToAsciiStr (Version, OptionalStrStart + ManuStrLen + 1);
|
||||
UnicodeStrToAsciiStr (SerialNumber, OptionalStrStart + ManuStrLen + 1 + VerStrLen + 1);
|
||||
UnicodeStrToAsciiStr (AssetTag, OptionalStrStart + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1);
|
||||
UnicodeStrToAsciiStr (SkuNumber, OptionalStrStart + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssetTagStrLen + 1);
|
||||
|
||||
//
|
||||
// Now we have got the full smbios record, call smbios protocol to add this record.
|
||||
//
|
||||
Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
|
||||
|
||||
FreePool(SmbiosRecord);
|
||||
return Status;
|
||||
}
|
|
@ -1,169 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscDevicePath.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Misc class required EFI Device Path definitions (Ports, slots &
|
||||
onboard devices)
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _MISC_DEVICE_PATH_H
|
||||
#define _MISC_DEVICE_PATH_H
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
//
|
||||
// USB
|
||||
//
|
||||
|
||||
/* For reference:
|
||||
#define USB1_1_STR "ACPI(PNP0A03,0)/PCI(1D,0)."
|
||||
#define USB1_2_STR "ACPI(PNP0A03,0)/PCI(1D,1)."
|
||||
#define USB1_3_STR "ACPI(PNP0A03,0)/PCI(1D,2)."
|
||||
#define USB2_1_STR "ACPI(PNP0A03,0)/PCI(1D,7)."
|
||||
*/
|
||||
|
||||
//
|
||||
// #define acpi { 0x02, 0x01, 0x00, 0x0C, 0x0a0341d0, 0x00000000 }
|
||||
// #define pci( device,function) { 0x01, 0x01, 0x00, 0x06, device, function }
|
||||
// #define end { 0xFF, 0xFF, 0x00, 0x04 }
|
||||
//
|
||||
#define DP_ACPI \
|
||||
{ \
|
||||
ACPI_DEVICE_PATH, ACPI_DP, (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), (UINT8) \
|
||||
((sizeof (ACPI_HID_DEVICE_PATH)) >> 8), EISA_PNP_ID (0x0A03), 0 \
|
||||
}
|
||||
#define DP_PCI(device, function) \
|
||||
{ \
|
||||
HARDWARE_DEVICE_PATH, HW_PCI_DP, (UINT8) (sizeof (PCI_DEVICE_PATH)), (UINT8) \
|
||||
((sizeof (PCI_DEVICE_PATH)) >> 8), function, device \
|
||||
}
|
||||
#define DP_END \
|
||||
{ \
|
||||
END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, END_DEVICE_PATH_LENGTH, 0 \
|
||||
}
|
||||
|
||||
#define DP_LPC(eisaid, function) \
|
||||
{ \
|
||||
ACPI_DEVICE_PATH, ACPI_DP, (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), (UINT8) \
|
||||
((sizeof (ACPI_HID_DEVICE_PATH)) >> 8), EISA_PNP_ID (eisaid), function \
|
||||
}
|
||||
|
||||
//
|
||||
// Shanmu >> moved to TianoDevicePath.h
|
||||
//
|
||||
|
||||
/*
|
||||
typedef struct _USB_PORT_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH PciBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} USB_PORT_DEVICE_PATH;
|
||||
|
||||
|
||||
//IDE ??I am not sure. Should this be ATAPI_DEVICE_PATH
|
||||
typedef struct _IDE_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH PciBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} IDE_DEVICE_PATH;
|
||||
|
||||
//RMC Connector
|
||||
typedef struct _RMC_CONN_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH PciBridgeDevicePath;
|
||||
PCI_DEVICE_PATH PciBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} RMC_CONN_DEVICE_PATH;
|
||||
|
||||
//static RMC_CONN_DEVICE_PATH mRmcConnDevicePath = { acpi, pci( 0x1E,0x00 ),pci( 0x0A,0x00 ), end };
|
||||
|
||||
//RIDE
|
||||
typedef struct _RIDE_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH PciBridgeDevicePath;
|
||||
PCI_DEVICE_PATH PciBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} RIDE_DEVICE_PATH;
|
||||
|
||||
//static RIDE_DEVICE_PATH mRideDevicePath = { acpi, pci( 0x1E,0x00 ),pci( 0x02,0x00 ), end };
|
||||
|
||||
//Gigabit NIC
|
||||
//typedef struct _GB_NIC_DEVICE_PATH
|
||||
//{
|
||||
// ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
// PCI_DEVICE_PATH PciBridgeDevicePath;
|
||||
// PCI_DEVICE_PATH PciXBridgeDevicePath;
|
||||
// PCI_DEVICE_PATH PciXBusDevicePath;
|
||||
// EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
//} GB_NIC_DEVICE_PATH;
|
||||
|
||||
//static GB_NIC_DEVICE_PATH mGbNicDevicePath = { acpi, pci( 0x03,0x00 ),pci( 0x1F,0x00 ),pci( 0x07,0x00 ), end };
|
||||
|
||||
|
||||
//P/S2 Connector
|
||||
typedef struct _PS2_CONN_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH LpcBridgeDevicePath;
|
||||
ACPI_HID_DEVICE_PATH LpcBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} PS2_CONN_DEVICE_PATH;
|
||||
|
||||
//static PS2_CONN_DEVICE_PATH mPs2KeyboardDevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0303,0 ), end };
|
||||
//static PS2_CONN_DEVICE_PATH mPs2MouseDevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0303,1 ), end };
|
||||
|
||||
//Serial Port Connector
|
||||
typedef struct _SERIAL_CONN_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH LpcBridgeDevicePath;
|
||||
ACPI_HID_DEVICE_PATH LpcBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} SERIAL_CONN_DEVICE_PATH;
|
||||
|
||||
//static SERIAL_CONN_DEVICE_PATH mCom1DevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0501,0 ), end };
|
||||
//static SERIAL_CONN_DEVICE_PATH mCom2DevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0501,1 ), end };
|
||||
|
||||
//Parallel Port Connector
|
||||
typedef struct _PARALLEL_CONN_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH LpcBridgeDevicePath;
|
||||
ACPI_HID_DEVICE_PATH LpcBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} PARALLEL_CONN_DEVICE_PATH;
|
||||
|
||||
//static PARALLEL_CONN_DEVICE_PATH mLpt1DevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0401,0 ), end };
|
||||
|
||||
//Floopy Connector
|
||||
typedef struct _FLOOPY_CONN_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH LpcBridgeDevicePath;
|
||||
ACPI_HID_DEVICE_PATH LpcBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} FLOOPY_CONN_DEVICE_PATH;
|
||||
|
||||
//static FLOOPY_CONN_DEVICE_PATH mFloopyADevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0604,0 ), end };
|
||||
//static FLOOPY_CONN_DEVICE_PATH mFloopyBDevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0604,1 ), end };
|
||||
|
||||
*/
|
||||
|
||||
//
|
||||
// End Shanmu
|
||||
//
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
|
@ -1,32 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscNumberOfInstallableLanguagesData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA, NumberOfInstallableLanguages)
|
||||
= {
|
||||
1, // NumberOfInstallableLanguages
|
||||
{ // LanguageFlags
|
||||
0, // AbbreviatedLanguageFormat
|
||||
0 // Reserved
|
||||
},
|
||||
0, // CurrentLanguageNumber
|
||||
};
|
||||
|
||||
/* eof - MiscNumberOfInstallableLanguagesData.c */
|
|
@ -1,225 +0,0 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
/*++
|
||||
Check whether the language is supported for given HII handle
|
||||
|
||||
@param HiiHandle The HII package list handle.
|
||||
@param Offset The offest of current lanague in the supported languages.
|
||||
@param CurrentLang The language code.
|
||||
|
||||
@retval TRUE Supported.
|
||||
@retval FALSE Not Supported.
|
||||
|
||||
--*/
|
||||
VOID
|
||||
EFIAPI
|
||||
CurrentLanguageMatch (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
OUT UINT16 *Offset,
|
||||
OUT CHAR8 *CurrentLang
|
||||
)
|
||||
{
|
||||
CHAR8 *DefaultLang;
|
||||
CHAR8 *BestLanguage;
|
||||
CHAR8 *Languages;
|
||||
CHAR8 *MatchLang;
|
||||
CHAR8 *EndMatchLang;
|
||||
UINTN CompareLength;
|
||||
|
||||
Languages = HiiGetSupportedLanguages (HiiHandle);
|
||||
if (Languages == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&CurrentLang, NULL);
|
||||
DefaultLang = (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang);
|
||||
BestLanguage = GetBestLanguage (
|
||||
Languages,
|
||||
FALSE,
|
||||
(CurrentLang != NULL) ? CurrentLang : "",
|
||||
DefaultLang,
|
||||
NULL
|
||||
);
|
||||
if (BestLanguage != NULL) {
|
||||
//
|
||||
// Find the best matching RFC 4646 language, compute the offset.
|
||||
//
|
||||
CompareLength = AsciiStrLen (BestLanguage);
|
||||
for (MatchLang = Languages, (*Offset) = 0; MatchLang != '\0'; (*Offset)++) {
|
||||
//
|
||||
// Seek to the end of current match language.
|
||||
//
|
||||
for (EndMatchLang = MatchLang; *EndMatchLang != '\0' && *EndMatchLang != ';'; EndMatchLang++);
|
||||
|
||||
if ((EndMatchLang == MatchLang + CompareLength) && AsciiStrnCmp(MatchLang, BestLanguage, CompareLength) == 0) {
|
||||
//
|
||||
// Find the current best Language in the supported languages
|
||||
//
|
||||
break;
|
||||
}
|
||||
//
|
||||
// best language match be in the supported language.
|
||||
//
|
||||
ASSERT (*EndMatchLang == ';');
|
||||
MatchLang = EndMatchLang + 1;
|
||||
}
|
||||
FreePool (BestLanguage);
|
||||
}
|
||||
|
||||
FreePool (Languages);
|
||||
if (CurrentLang != NULL) {
|
||||
FreePool (CurrentLang);
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get next language from language code list (with separator ';').
|
||||
|
||||
@param LangCode Input: point to first language in the list. On
|
||||
Otput: point to next language in the list, or
|
||||
NULL if no more language in the list.
|
||||
@param Lang The first language in the list.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
GetNextLanguage (
|
||||
IN OUT CHAR8 **LangCode,
|
||||
OUT CHAR8 *Lang
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
CHAR8 *StringPtr;
|
||||
|
||||
ASSERT (LangCode != NULL);
|
||||
ASSERT (*LangCode != NULL);
|
||||
ASSERT (Lang != NULL);
|
||||
|
||||
Index = 0;
|
||||
StringPtr = *LangCode;
|
||||
while (StringPtr[Index] != 0 && StringPtr[Index] != ';') {
|
||||
Index++;
|
||||
}
|
||||
|
||||
CopyMem (Lang, StringPtr, Index);
|
||||
Lang[Index] = 0;
|
||||
|
||||
if (StringPtr[Index] == ';') {
|
||||
Index++;
|
||||
}
|
||||
*LangCode = StringPtr + Index;
|
||||
}
|
||||
|
||||
/**
|
||||
This function returns the number of supported languages on HiiHandle.
|
||||
|
||||
@param HiiHandle The HII package list handle.
|
||||
|
||||
@retval The number of supported languages.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
GetSupportedLanguageNumber (
|
||||
IN EFI_HII_HANDLE HiiHandle
|
||||
)
|
||||
{
|
||||
CHAR8 *Lang;
|
||||
CHAR8 *Languages;
|
||||
CHAR8 *LanguageString;
|
||||
UINT16 LangNumber;
|
||||
|
||||
Languages = HiiGetSupportedLanguages (HiiHandle);
|
||||
if (Languages == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
LangNumber = 0;
|
||||
Lang = AllocatePool (AsciiStrSize (Languages));
|
||||
if (Lang != NULL) {
|
||||
LanguageString = Languages;
|
||||
while (*LanguageString != 0) {
|
||||
GetNextLanguage (&LanguageString, Lang);
|
||||
LangNumber++;
|
||||
}
|
||||
FreePool (Lang);
|
||||
}
|
||||
FreePool (Languages);
|
||||
return LangNumber;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscNumberOfInstallableLanguages (Type 13).
|
||||
|
||||
@param RecordData Pointer to copy of RecordData from the Data Table.
|
||||
|
||||
@retval EFI_SUCCESS All parameters were valid.
|
||||
@retval EFI_UNSUPPORTED Unexpected RecordType value.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
||||
|
||||
**/
|
||||
MISC_SMBIOS_TABLE_FUNCTION(NumberOfInstallableLanguages)
|
||||
{
|
||||
UINTN LangStrLen;
|
||||
CHAR8 CurrentLang[SMBIOS_STRING_MAX_LENGTH + 1];
|
||||
CHAR8 *OptionalStrStart;
|
||||
UINT16 Offset;
|
||||
EFI_STATUS Status;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
SMBIOS_TABLE_TYPE13 *SmbiosRecord;
|
||||
EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES *ForType13InputData;
|
||||
|
||||
ForType13InputData = (EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES *)RecordData;
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (RecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ForType13InputData->NumberOfInstallableLanguages = GetSupportedLanguageNumber (mHiiHandle);
|
||||
|
||||
//
|
||||
// Try to check if current langcode matches with the langcodes in installed languages
|
||||
//
|
||||
ZeroMem(CurrentLang, SMBIOS_STRING_MAX_LENGTH + 1);
|
||||
CurrentLanguageMatch (mHiiHandle, &Offset, CurrentLang);
|
||||
LangStrLen = AsciiStrLen(CurrentLang);
|
||||
|
||||
//
|
||||
// Two zeros following the last string.
|
||||
//
|
||||
SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + LangStrLen + 1 + 1);
|
||||
ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + LangStrLen + 1 + 1);
|
||||
|
||||
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION;
|
||||
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13);
|
||||
//
|
||||
// Make handle chosen by smbios protocol.add automatically.
|
||||
//
|
||||
SmbiosRecord->Hdr.Handle = 0;
|
||||
|
||||
SmbiosRecord->InstallableLanguages = (UINT8)ForType13InputData->NumberOfInstallableLanguages;
|
||||
SmbiosRecord->Flags = (UINT8)ForType13InputData->LanguageFlags.AbbreviatedLanguageFormat;
|
||||
SmbiosRecord->CurrentLanguages = 1;
|
||||
OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
|
||||
AsciiStrCpy(OptionalStrStart, CurrentLang);
|
||||
//
|
||||
// Now we have got the full smbios record, call smbios protocol to add this record.
|
||||
//
|
||||
Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
|
||||
|
||||
FreePool(SmbiosRecord);
|
||||
return Status;
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscOemStringData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_OEM_STRING_DATA, OemString) = {
|
||||
STRING_TOKEN(STR_MISC_OEM_STRING)
|
||||
};
|
||||
|
||||
/* eof - MiscOemStringData.c */
|
|
@ -1,70 +0,0 @@
|
|||
/** @file
|
||||
boot information boot time changes.
|
||||
SMBIOS type 11.
|
||||
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
/**
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscOemString (Type 11).
|
||||
|
||||
@param RecordData Pointer to copy of RecordData from the Data Table.
|
||||
|
||||
@retval EFI_SUCCESS All parameters were valid.
|
||||
@retval EFI_UNSUPPORTED Unexpected RecordType value.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
||||
|
||||
**/
|
||||
MISC_SMBIOS_TABLE_FUNCTION(OemString)
|
||||
{
|
||||
UINTN OemStrLen;
|
||||
CHAR8 *OptionalStrStart;
|
||||
EFI_STATUS Status;
|
||||
EFI_STRING OemStr;
|
||||
STRING_REF TokenToGet;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
SMBIOS_TABLE_TYPE11 *SmbiosRecord;
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (RecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_OEM_STRING);
|
||||
OemStr = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
OemStrLen = StrLen(OemStr);
|
||||
if (OemStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Two zeros following the last string.
|
||||
//
|
||||
SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);
|
||||
ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);
|
||||
|
||||
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_OEM_STRINGS;
|
||||
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE11);
|
||||
//
|
||||
// Make handle chosen by smbios protocol.add automatically.
|
||||
//
|
||||
SmbiosRecord->Hdr.Handle = 0;
|
||||
SmbiosRecord->StringCount = 1;
|
||||
OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
|
||||
UnicodeStrToAsciiStr(OemStr, OptionalStrStart);
|
||||
|
||||
//
|
||||
// Now we have got the full smbios record, call smbios protocol to add this record.
|
||||
//
|
||||
Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
|
||||
|
||||
FreePool(SmbiosRecord);
|
||||
return Status;
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscPortInternalConnectorDesignatorData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortInternalConnectorDesignator) = {
|
||||
STRING_TOKEN(STR_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR), // PortInternalConnectorDesignator
|
||||
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_CONNECTOR_DESIGNATOR), // PortExternalConnectorDesignator
|
||||
EfiPortConnectorTypeOther, // PortInternalConnectorType
|
||||
EfiPortConnectorTypeOther, // PortExternalConnectorType
|
||||
EfiPortTypeNone, // PortType
|
||||
0 // PortPath
|
||||
};
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortKeyboard) = {
|
||||
STRING_TOKEN (STR_MISC_PORT_INTERNAL_KEYBOARD), // PortInternalConnectorDesignator
|
||||
STRING_TOKEN (STR_MISC_PORT_EXTERNAL_KEYBOARD), // PortExternalConnectorDesignator
|
||||
EfiPortConnectorTypeNone, // PortInternalConnectorType
|
||||
EfiPortConnectorTypePS2, // PortExternalConnectorType
|
||||
EfiPortTypeKeyboard, // PortType
|
||||
// mPs2KbyboardDevicePath // PortPath
|
||||
//
|
||||
0
|
||||
};
|
||||
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortMouse) = {
|
||||
STRING_TOKEN (STR_MISC_PORT_INTERNAL_MOUSE), // PortInternalConnectorDesignator
|
||||
STRING_TOKEN (STR_MISC_PORT_EXTERNAL_MOUSE), // PortExternalConnectorDesignator
|
||||
EfiPortConnectorTypeNone, // PortInternalConnectorType
|
||||
EfiPortConnectorTypePS2, // PortExternalConnectorType
|
||||
EfiPortTypeMouse, // PortType
|
||||
// mPs2MouseDevicePath // PortPath
|
||||
//
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom1) = {
|
||||
STRING_TOKEN(STR_MISC_PORT_INTERNAL_COM1),
|
||||
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM1),
|
||||
EfiPortConnectorTypeNone,
|
||||
EfiPortConnectorTypeDB9Female,
|
||||
EfiPortTypeSerial16550ACompatible,
|
||||
0
|
||||
};
|
||||
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom2) = {
|
||||
STRING_TOKEN(STR_MISC_PORT_INTERNAL_COM2),
|
||||
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM2),
|
||||
EfiPortConnectorTypeNone,
|
||||
EfiPortConnectorTypeDB9Female,
|
||||
EfiPortTypeSerial16550ACompatible,
|
||||
0
|
||||
};
|
||||
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortExtensionPower) = {
|
||||
STRING_TOKEN(STR_MISC_PORT_INTERNAL_EXTENSION_POWER),
|
||||
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_EXTENSION_POWER),
|
||||
EfiPortConnectorTypeOther,
|
||||
EfiPortConnectorTypeNone,
|
||||
EfiPortTypeOther,
|
||||
0
|
||||
};
|
||||
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortFloppy) = {
|
||||
STRING_TOKEN(STR_MISC_PORT_INTERNAL_FLOPPY),
|
||||
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_FLOPPY),
|
||||
EfiPortConnectorTypeOnboardFloppy,
|
||||
EfiPortConnectorTypeNone,
|
||||
EfiPortTypeOther,
|
||||
0
|
||||
};
|
||||
|
||||
/* eof - MiscPortInternalConnectorDesignatorData.c */
|
|
@ -1,166 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscPortInternalConnectorDesignatorFunction.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
|
||||
MISC_SMBIOS_TABLE_FUNCTION (
|
||||
MiscPortInternalConnectorDesignator
|
||||
)
|
||||
/*++
|
||||
Description:
|
||||
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscPortConnectorInformation (Type 8).
|
||||
|
||||
Parameters:
|
||||
|
||||
RecordType
|
||||
Type of record to be processed from the Data Table.
|
||||
mMiscSubclassDataTable[].RecordType
|
||||
|
||||
RecordLen
|
||||
Size of static RecordData from the Data Table.
|
||||
mMiscSubclassDataTable[].RecordLen
|
||||
|
||||
RecordData
|
||||
Pointer to copy of RecordData from the Data Table. Changes made
|
||||
to this copy will be written to the Data Hub but will not alter
|
||||
the contents of the static Data Table.
|
||||
|
||||
LogRecordData
|
||||
Set *LogRecordData to TRUE to log RecordData to Data Hub.
|
||||
Set *LogRecordData to FALSE when there is no more data to log.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS
|
||||
All parameters were valid and *RecordData and *LogRecordData have
|
||||
been set.
|
||||
|
||||
EFI_UNSUPPORTED
|
||||
Unexpected RecordType value.
|
||||
|
||||
EFI_INVALID_PARAMETER
|
||||
One of the following parameter conditions was true:
|
||||
RecordLen was zero.
|
||||
RecordData was NULL.
|
||||
LogRecordData was NULL.
|
||||
--*/
|
||||
{
|
||||
CHAR8 *OptionalStrStart;
|
||||
UINTN InternalRefStrLen;
|
||||
UINTN ExternalRefStrLen;
|
||||
EFI_STRING InternalRef;
|
||||
EFI_STRING ExternalRef;
|
||||
STRING_REF TokenForInternal;
|
||||
STRING_REF TokenForExternal;
|
||||
EFI_STATUS Status;
|
||||
SMBIOS_TABLE_TYPE8 *SmbiosRecord;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR *ForType8InputData;
|
||||
|
||||
ForType8InputData = (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR *)RecordData;
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (RecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
TokenForInternal = 0;
|
||||
TokenForExternal = 0;
|
||||
|
||||
switch (ForType8InputData->PortInternalConnectorDesignator) {
|
||||
|
||||
case STR_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR:
|
||||
TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR);
|
||||
TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_CONNECTOR_DESIGNATOR);
|
||||
break;
|
||||
case STR_MISC_PORT_INTERNAL_KEYBOARD:
|
||||
TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_KEYBOARD);
|
||||
TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_KEYBOARD);
|
||||
break;
|
||||
case STR_MISC_PORT_INTERNAL_MOUSE:
|
||||
TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_MOUSE);
|
||||
TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_MOUSE);
|
||||
break;
|
||||
case STR_MISC_PORT_INTERNAL_COM1:
|
||||
TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_COM1);
|
||||
TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM1);
|
||||
break;
|
||||
case STR_MISC_PORT_INTERNAL_COM2:
|
||||
TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_COM2);
|
||||
TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM2);
|
||||
break;
|
||||
case STR_MISC_PORT_INTERNAL_EXTENSION_POWER:
|
||||
TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_EXTENSION_POWER);
|
||||
TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_EXTENSION_POWER);
|
||||
break;
|
||||
case STR_MISC_PORT_INTERNAL_FLOPPY:
|
||||
TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_FLOPPY);
|
||||
TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_FLOPPY);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
InternalRef = HiiGetPackageString(&gEfiCallerIdGuid, TokenForInternal, NULL);
|
||||
InternalRefStrLen = StrLen(InternalRef);
|
||||
if (InternalRefStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
ExternalRef = HiiGetPackageString(&gEfiCallerIdGuid, TokenForExternal, NULL);
|
||||
ExternalRefStrLen = StrLen(ExternalRef);
|
||||
if (ExternalRefStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Two zeros following the last string.
|
||||
//
|
||||
SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE8) + InternalRefStrLen + 1 + ExternalRefStrLen + 1 + 1);
|
||||
ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE8) + InternalRefStrLen + 1 + ExternalRefStrLen + 1 + 1);
|
||||
|
||||
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION;
|
||||
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE8);
|
||||
//
|
||||
// Make handle chosen by smbios protocol.add automatically.
|
||||
//
|
||||
SmbiosRecord->Hdr.Handle = 0;
|
||||
SmbiosRecord->InternalReferenceDesignator = 1;
|
||||
SmbiosRecord->InternalConnectorType = (UINT8)ForType8InputData->PortInternalConnectorType;
|
||||
SmbiosRecord->ExternalReferenceDesignator = 2;
|
||||
SmbiosRecord->ExternalConnectorType = (UINT8)ForType8InputData->PortExternalConnectorType;
|
||||
SmbiosRecord->PortType = (UINT8)ForType8InputData->PortType;
|
||||
|
||||
OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
|
||||
UnicodeStrToAsciiStr(InternalRef, OptionalStrStart);
|
||||
UnicodeStrToAsciiStr(ExternalRef, OptionalStrStart + InternalRefStrLen + 1);
|
||||
|
||||
//
|
||||
// Now we have got the full smbios record, call smbios protocol to add this record.
|
||||
//
|
||||
Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
|
||||
|
||||
FreePool(SmbiosRecord);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* eof - MiscSystemManufacturerFunction.c */
|
|
@ -1,36 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscResetCapabilitiesData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_RESET_CAPABILITIES, MiscResetCapabilities) = {
|
||||
{ // ResetCapabilities
|
||||
0, // Status
|
||||
0, // BootOption
|
||||
0, // BootOptionOnLimit
|
||||
0, // WatchdogTimerPresent
|
||||
0 // Reserved
|
||||
},
|
||||
0, // ResetCount
|
||||
0, // ResetLimit
|
||||
0, // ResetTimerInterval
|
||||
0 // ResetTimeout
|
||||
};
|
||||
|
||||
/* eof - MiscResetCapabilities.c */
|
|
@ -1,66 +0,0 @@
|
|||
/** @file
|
||||
ResetCapabilities.
|
||||
SMBIOS type 23.
|
||||
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
/**
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscOemString (Type 11).
|
||||
|
||||
@param RecordData Pointer to copy of RecordData from the Data Table.
|
||||
|
||||
@retval EFI_SUCCESS All parameters were valid.
|
||||
@retval EFI_UNSUPPORTED Unexpected RecordType value.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
||||
|
||||
**/
|
||||
MISC_SMBIOS_TABLE_FUNCTION(MiscResetCapabilities)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
SMBIOS_TABLE_TYPE23 *SmbiosRecord;
|
||||
EFI_MISC_RESET_CAPABILITIES *ForType23InputData;
|
||||
|
||||
ForType23InputData = (EFI_MISC_RESET_CAPABILITIES *)RecordData;
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (RecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Two zeros following the last string.
|
||||
//
|
||||
SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
|
||||
ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
|
||||
|
||||
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_RESET;
|
||||
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE23);
|
||||
//
|
||||
// Make handle chosen by smbios protocol.add automatically.
|
||||
//
|
||||
SmbiosRecord->Hdr.Handle = 0;
|
||||
SmbiosRecord->Capabilities = *(UINT8*)&(ForType23InputData->ResetCapabilities);
|
||||
SmbiosRecord->ResetCount = (UINT16)ForType23InputData->ResetCount;
|
||||
SmbiosRecord->ResetLimit = (UINT16)ForType23InputData->ResetLimit;
|
||||
SmbiosRecord->TimerInterval = (UINT16)ForType23InputData->ResetTimerInterval;
|
||||
SmbiosRecord->Timeout = (UINT16)ForType23InputData->ResetTimeout;
|
||||
|
||||
//
|
||||
// Now we have got the full smbios record, call smbios protocol to add this record.
|
||||
//
|
||||
Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
|
||||
|
||||
FreePool(SmbiosRecord);
|
||||
return Status;
|
||||
}
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
## @file
|
||||
# Misc Sub class driver
|
||||
#
|
||||
# Parses the MiscSubclassDataTable and reports any generated data to the DataHub.
|
||||
# All .uni file who tagged with "ToolCode="DUMMY"" in following file list is included by
|
||||
# MiscSubclassDriver.uni file, the StrGather tool will expand MiscSubclassDriver.uni file
|
||||
# and parse all .uni file.
|
||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = MiscSubclass
|
||||
FILE_GUID = 4A9B9DB8-EC62-4A92-818F-8AA0246D246E
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
ENTRY_POINT = MiscSubclassDriverEntryPoint
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
|
||||
[Sources]
|
||||
MiscBaseBoardManufacturerData.c
|
||||
MiscBaseBoardManufacturerFunction.c
|
||||
MiscBiosVendorData.c
|
||||
MiscBiosVendorFunction.c
|
||||
MiscBootInformationData.c
|
||||
MiscBootInformationFunction.c
|
||||
MiscChassisManufacturerData.c
|
||||
MiscChassisManufacturerFunction.c
|
||||
MiscNumberOfInstallableLanguagesData.c
|
||||
MiscNumberOfInstallableLanguagesFunction.c
|
||||
MiscOemStringData.c
|
||||
MiscOemStringFunction.c
|
||||
MiscPortInternalConnectorDesignatorData.c
|
||||
MiscPortInternalConnectorDesignatorFunction.c
|
||||
MiscResetCapabilitiesData.c
|
||||
MiscResetCapabilitiesFunction.c
|
||||
MiscSystemLanguageStringData.c
|
||||
MiscSystemLanguageStringFunction.c
|
||||
MiscSystemManufacturerData.c
|
||||
MiscSystemManufacturerFunction.c
|
||||
MiscSystemOptionStringData.c
|
||||
MiscSystemOptionStringFunction.c
|
||||
MiscSystemSlotDesignationData.c
|
||||
MiscSystemSlotDesignationFunction.c
|
||||
MiscDevicePath.h
|
||||
MiscSubclassDriver.h
|
||||
MiscSubclassDriver.uni
|
||||
MiscSubclassDriverDataTable.c
|
||||
MiscSubclassDriverEntryPoint.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DevicePathLib
|
||||
UefiBootServicesTableLib
|
||||
BaseMemoryLib
|
||||
UefiDriverEntryPoint
|
||||
UefiLib
|
||||
HiiLib
|
||||
DebugLib
|
||||
BaseLib
|
||||
MemoryAllocationLib
|
||||
PcdLib
|
||||
|
||||
[Protocols]
|
||||
gEfiWinNtIoProtocolGuid # PROTOCOL_NOTIFY SOMETIMES_CONSUMED
|
||||
gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
|
||||
[Pcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareReleaseDateString
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtMemorySize
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang
|
||||
|
||||
[Depex]
|
||||
gEfiSmbiosProtocolGuid
|
|
@ -1,123 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscSubclassDriver.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Header file for MiscSubclass Driver.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _MISC_SUBCLASS_DRIVER_H
|
||||
#define _MISC_SUBCLASS_DRIVER_H
|
||||
|
||||
#include <FrameworkDxe.h>
|
||||
#include <WinNtDxe.h>
|
||||
#include <Guid/DataHubRecords.h>
|
||||
#include <IndustryStandard/SmBios.h>
|
||||
#include <Protocol/Smbios.h>
|
||||
#include <Protocol/WinNtIo.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/HiiLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <MiscDevicePath.h>
|
||||
|
||||
|
||||
//
|
||||
// Data table entry update function.
|
||||
//
|
||||
typedef EFI_STATUS (EFIAPI EFI_MISC_SMBIOS_DATA_FUNCTION) (
|
||||
IN VOID *RecordData,
|
||||
IN EFI_SMBIOS_PROTOCOL *Smbios
|
||||
);
|
||||
|
||||
//
|
||||
// Data table entry definition.
|
||||
//
|
||||
typedef struct {
|
||||
//
|
||||
// intermediat input data for SMBIOS record
|
||||
//
|
||||
VOID *RecordData;
|
||||
EFI_MISC_SMBIOS_DATA_FUNCTION *Function;
|
||||
} EFI_MISC_SMBIOS_DATA_TABLE;
|
||||
|
||||
//
|
||||
// Data Table extern definitions.
|
||||
//
|
||||
#define MISC_SMBIOS_TABLE_EXTERNS(NAME1, NAME2, NAME3) \
|
||||
extern NAME1 NAME2 ## Data; \
|
||||
extern EFI_MISC_SMBIOS_DATA_FUNCTION NAME3 ## Function
|
||||
|
||||
|
||||
//
|
||||
// Data Table entries
|
||||
//
|
||||
#define MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(NAME1, NAME2) \
|
||||
{ \
|
||||
& NAME1 ## Data, \
|
||||
& NAME2 ## Function \
|
||||
}
|
||||
|
||||
//
|
||||
// Global definition macros.
|
||||
//
|
||||
#define MISC_SMBIOS_TABLE_DATA(NAME1, NAME2) \
|
||||
NAME1 NAME2 ## Data
|
||||
|
||||
#define MISC_SMBIOS_TABLE_FUNCTION(NAME2) \
|
||||
EFI_STATUS EFIAPI NAME2 ## Function( \
|
||||
IN VOID *RecordData, \
|
||||
IN EFI_SMBIOS_PROTOCOL *Smbios \
|
||||
)
|
||||
|
||||
|
||||
//
|
||||
// Data Table Array
|
||||
//
|
||||
extern EFI_MISC_SMBIOS_DATA_TABLE mMiscSubclassDataTable[];
|
||||
|
||||
//
|
||||
// Data Table Array Entries
|
||||
//
|
||||
extern UINTN mMiscSubclassDataTableEntries;
|
||||
extern UINT8 MiscSubclassStrings[];
|
||||
extern EFI_HII_HANDLE mHiiHandle;
|
||||
|
||||
|
||||
/**
|
||||
Add an SMBIOS record.
|
||||
|
||||
@param Smbios The EFI_SMBIOS_PROTOCOL instance.
|
||||
@param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
|
||||
@param Record The data for the fixed portion of the SMBIOS record. The format of the record is
|
||||
determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
|
||||
by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
|
||||
a set of null terminated strings and a null.
|
||||
|
||||
@retval EFI_SUCCESS Record was added.
|
||||
@retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
AddSmbiosRecord (
|
||||
IN EFI_SMBIOS_PROTOCOL *Smbios,
|
||||
OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
|
||||
IN EFI_SMBIOS_TABLE_HEADER *Record
|
||||
);
|
||||
|
||||
#endif /* _MISC_SUBCLASS_DRIVER_H */
|
||||
|
||||
/* eof - MiscSubclassDriver.h */
|
|
@ -1,114 +0,0 @@
|
|||
// *++
|
||||
//
|
||||
// Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
// (C) Copyright 2017 Hewlett Packard Enterprise Development LP<BR>
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
// Module Name:
|
||||
//
|
||||
// MiscSubclassStrings.Vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Misc. Subclass formset.
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
/=#
|
||||
|
||||
#langdef en-US "English"
|
||||
#langdef fr-FR "Français"
|
||||
|
||||
|
||||
#string STR_MISC_SUBCLASS_DRIVER_TITLE #language en-US "Not used"
|
||||
|
||||
#string STR_MISC_BASE_BOARD_MANUFACTURER #language en-US "Base Board Manufacturer"
|
||||
#string STR_MISC_BASE_BOARD_PRODUCT_NAME #language en-US "Base Board Product Name"
|
||||
#string STR_MISC_BASE_BOARD_VERSION #language en-US "Base Board Version"
|
||||
#string STR_MISC_BASE_BOARD_SERIAL_NUMBER #language en-US "Base Board Serial Number"
|
||||
#string STR_MISC_BASE_BOARD_ASSET_TAG #language en-US "Base Board Asset Tag"
|
||||
#string STR_MISC_BASE_BOARD_CHASSIS_LOCATION #language en-US "Base Board Chassis Location"
|
||||
|
||||
#string STR_MISC_BIOS_VENDOR #language en-US "Bios Vendor"
|
||||
#string STR_MISC_BIOS_VERSION #language en-US "R9 Prime"
|
||||
#language fr-FR "Perfection R9"
|
||||
#string STR_MISC_BIOS_RELEASE_DATE #language en-US "Bios Release Date"
|
||||
|
||||
#string STR_MISC_CHASSIS_MANUFACTURER #language en-US "Chassis Manufacturer"
|
||||
#string STR_MISC_CHASSIS_VERSION #language en-US "Chassis Version"
|
||||
#string STR_MISC_CHASSIS_SERIAL_NUMBER #language en-US "Chassis Serial Number"
|
||||
#string STR_MISC_CHASSIS_ASSET_TAG #language en-US "Chassis Asset Tag"
|
||||
#string STR_MISC_CHASSIS_SKU_NUMBER #language en-US "Chassis SKU Number"
|
||||
|
||||
#string STR_MISC_OEM_STRING #language en-US "System Language String"
|
||||
|
||||
#string STR_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR #language en-US "Port Internal Connector"
|
||||
#string STR_MISC_PORT_EXTERNAL_CONNECTOR_DESIGNATOR #language en-US "Port External Connector"
|
||||
#string STR_MISC_PORT_INTERNAL_KEYBOARD #language en-US "J1A1"
|
||||
#string STR_MISC_PORT_EXTERNAL_KEYBOARD #language en-US "Keyboard"
|
||||
#string STR_MISC_PORT_INTERNAL_MOUSE #language en-US "J1A1"
|
||||
#string STR_MISC_PORT_EXTERNAL_MOUSE #language en-US "Mouse"
|
||||
#string STR_MISC_PORT_INTERNAL_COM1 #language en-US "J2A1"
|
||||
#string STR_MISC_PORT_EXTERNAL_COM1 #language en-US "COM 1"
|
||||
#string STR_MISC_PORT_INTERNAL_LPT1 #language en-US "J4A2"
|
||||
#string STR_MISC_PORT_EXTERNAL_LPT1 #language en-US "LPT 1"
|
||||
#string STR_MISC_PORT_INTERNAL_EXTENSION_POWER #language en-US "J5C1"
|
||||
#string STR_MISC_PORT_EXTERNAL_EXTENSION_POWER #language en-US "Extension Power Header"
|
||||
#string STR_MISC_PORT_INTERNAL_USB1 #language en-US "JA5A1"
|
||||
#string STR_MISC_PORT_EXTERNAL_USB1 #language en-US "USB"
|
||||
#string STR_MISC_PORT_INTERNAL_USB2 #language en-US "J2A2"
|
||||
#string STR_MISC_PORT_EXTERNAL_USB2 #language en-US "USB"
|
||||
#string STR_MISC_PORT_INTERNAL_NETWORK #language en-US "JA5A1"
|
||||
#string STR_MISC_PORT_EXTERNAL_NETWORK #language en-US "RJ-45 Type"
|
||||
#string STR_MISC_PORT_INTERNAL_MIC #language en-US "J6A1"
|
||||
#string STR_MISC_PORT_EXTERNAL_MIC #language en-US "Audio Mic In"
|
||||
#string STR_MISC_PORT_INTERNAL_LINE_IN #language en-US "J6A1"
|
||||
#string STR_MISC_PORT_EXTERNAL_LINE_IN #language en-US "Audio Line In"
|
||||
#string STR_MISC_PORT_INTERNAL_LINE_OUT #language en-US "J6A1"
|
||||
#string STR_MISC_PORT_EXTERNAL_LINE_OUT #language en-US "Audio Line Out"
|
||||
#string STR_MISC_PORT_INTERNAL_FLOPPY #language en-US "J4H1"
|
||||
#string STR_MISC_PORT_EXTERNAL_FLOPPY #language en-US "OnBoard Floppy Type"
|
||||
#string STR_MISC_PORT_INTERNAL_IDE1 #language en-US "J6H2"
|
||||
#string STR_MISC_PORT_EXTERNAL_IDE1 #language en-US "OnBoard Primary IDE"
|
||||
#string STR_MISC_PORT_INTERNAL_IDE2 #language en-US "J6H1"
|
||||
#string STR_MISC_PORT_EXTERNAL_IDE2 #language en-US "OnBoard Secondary IDE"
|
||||
#string STR_MISC_PORT_INTERNAL_SOUND_IN1 #language en-US "J8B1"
|
||||
#string STR_MISC_PORT_EXTERNAL_SOUND_IN1 #language en-US "OnBoard Sound Input Type"
|
||||
#string STR_MISC_PORT_INTERNAL_SOUND_IN2 #language en-US "J6B1"
|
||||
#string STR_MISC_PORT_EXTERNAL_SOUND_IN2 #language en-US "OnBoard Sound Input Type"
|
||||
#string STR_MISC_PORT_INTERNAL_FRONT_PANEL #language en-US "J9G1"
|
||||
#string STR_MISC_PORT_EXTERNAL_FRONT_PANEL #language en-US "Front Panel Header Type"
|
||||
#string STR_MISC_PORT_INTERNAL_CPU_FAN #language en-US "J2F1"
|
||||
#string STR_MISC_PORT_EXTERNAL_CPU_FAN #language en-US "CPU Fan Header"
|
||||
#string STR_MISC_PORT_INTERNAL_FRONT_FAN #language en-US "J9H3"
|
||||
#string STR_MISC_PORT_EXTERNAL_FRONT_FAN #language en-US "Front Chassis Fan"
|
||||
#string STR_MISC_PORT_INTERNAL_REAR_FAN #language en-US "J1B1"
|
||||
#string STR_MISC_PORT_EXTERNAL_REAR_FAN #language en-US "Rear Chassis Fan"
|
||||
#string STR_MISC_PORT_INTERNAL_CONFIG_JUMPER #language en-US "J9H2"
|
||||
#string STR_MISC_PORT_EXTERNAL_CONFIG_JUMPER #language en-US "Configuration Jumper"
|
||||
#string STR_MISC_PORT_INTERNAL_AUDIO_PANEL #language en-US "J8A1"
|
||||
#string STR_MISC_PORT_EXTERNAL_AUDIO_PANEL #language en-US "Audio Front Panel Header"
|
||||
#string STR_MISC_PORT_INTERNAL_USB_PANEL #language en-US "J9F1"
|
||||
#string STR_MISC_PORT_EXTERNAL_USB_PANEL #language en-US "USB Front Panel Header"
|
||||
#string STR_MISC_PORT_INTERNAL_ATX_POWER #language en-US "J2H1"
|
||||
#string STR_MISC_PORT_EXTERNAL_ATX_POWER #language en-US "ATX Power Header"
|
||||
#string STR_MISC_PORT_INTERNAL_COM2 #language en-US "J5A1"
|
||||
#string STR_MISC_PORT_EXTERNAL_COM2 #language en-US "COM 2"
|
||||
#string STR_MISC_PORT_INTERNAL_USB3 #language en-US "J1D3"
|
||||
#string STR_MISC_PORT_EXTERNAL_USB3 #language en-US "USB"
|
||||
|
||||
#string STR_MISC_SYSTEM_LANGUAGE_STRING #language en-US "System Language String"
|
||||
|
||||
#string STR_MISC_SYSTEM_MANUFACTURER #language en-US "System Manufacturer"
|
||||
#string STR_MISC_SYSTEM_PRODUCT_NAME #language en-US "NT32 Emulation Environment"
|
||||
#language fr-FR "Environnement De l'Émulation NT32"
|
||||
|
||||
#string STR_MISC_SYSTEM_VERSION #language en-US "System Version"
|
||||
#string STR_MISC_SYSTEM_SERIAL_NUMBER #language en-US "System Serial Number"
|
||||
|
||||
#string STR_MISC_SYSTEM_OPTION_STRING #language en-US "System Option String"
|
||||
|
||||
#string STR_MISC_SYSTEM_SLOT_DESIGNATION #language en-US "System Slot Designation"
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscSubclassDriverDataTable.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
|
||||
//
|
||||
// External definitions referenced by Data Table entries.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_BASE_BOARD_MANUFACTURER_DATA, MiscBaseBoardManufacturer, MiscBaseBoardManufacturer);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_BIOS_VENDOR_DATA, MiscBiosVendor,MiscBiosVendor );
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_BOOT_INFORMATION_STATUS_DATA, BootInformationStatus, BootInformationStatus);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_CHASSIS_MANUFACTURER_DATA, MiscChassisManufacturer, MiscChassisManufacturer);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA,NumberOfInstallableLanguages, NumberOfInstallableLanguages);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_OEM_STRING_DATA,OemString, OemString);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortInternalConnectorDesignator, MiscPortInternalConnectorDesignator);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortKeyboard, MiscPortInternalConnectorDesignator);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortMouse, MiscPortInternalConnectorDesignator);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom1, MiscPortInternalConnectorDesignator);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom2, MiscPortInternalConnectorDesignator);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortExtensionPower, MiscPortInternalConnectorDesignator);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortFloppy, MiscPortInternalConnectorDesignator);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_RESET_CAPABILITIES, MiscResetCapabilities, MiscResetCapabilities);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA,SystemLanguageString, SystemLanguageString);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_SYSTEM_MANUFACTURER_DATA, MiscSystemManufacturer, MiscSystemManufacturer);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_SYSTEM_OPTION_STRING_DATA, SystemOptionString, SystemOptionString);
|
||||
MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotDesignation, MiscSystemSlotDesignation);
|
||||
|
||||
|
||||
//
|
||||
// Data Table.
|
||||
//
|
||||
EFI_MISC_SMBIOS_DATA_TABLE mMiscSubclassDataTable[] = {
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscBaseBoardManufacturer, MiscBaseBoardManufacturer),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscBiosVendor,MiscBiosVendor ),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( BootInformationStatus, BootInformationStatus),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscChassisManufacturer, MiscChassisManufacturer),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(NumberOfInstallableLanguages, NumberOfInstallableLanguages),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(OemString, OemString),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortInternalConnectorDesignator, MiscPortInternalConnectorDesignator),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortKeyboard, MiscPortInternalConnectorDesignator),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortMouse, MiscPortInternalConnectorDesignator),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortCom1, MiscPortInternalConnectorDesignator),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortCom2, MiscPortInternalConnectorDesignator),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortExtensionPower, MiscPortInternalConnectorDesignator),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortFloppy, MiscPortInternalConnectorDesignator),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscResetCapabilities, MiscResetCapabilities),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(SystemLanguageString, SystemLanguageString),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscSystemManufacturer, MiscSystemManufacturer),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( SystemOptionString, SystemOptionString),
|
||||
MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscSystemSlotDesignation, MiscSystemSlotDesignation),
|
||||
};
|
||||
|
||||
//
|
||||
// Number of Data Table entries.
|
||||
//
|
||||
UINTN mMiscSubclassDataTableEntries = (sizeof mMiscSubclassDataTable) / sizeof (EFI_MISC_SMBIOS_DATA_TABLE);
|
||||
|
||||
/* eof - MiscSubclassDriverDataTable.c */
|
|
@ -1,194 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscSubclassDriverEntryPoint.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
EFI_HII_HANDLE mHiiHandle;
|
||||
|
||||
/**
|
||||
This is the standard EFI driver point that detects whether there is a
|
||||
MemoryConfigurationData Variable and, if so, reports memory configuration info
|
||||
to the DataHub.
|
||||
|
||||
@param ImageHandle Handle for the image of this driver
|
||||
@param SystemTable Pointer to the EFI System Table
|
||||
|
||||
@return EFI_SUCCESS if the data is successfully reported
|
||||
@return EFI_NOT_FOUND if the HOB list could not be located.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
LogMemorySmbiosRecord (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT64 TotalMemorySize;
|
||||
UINT8 NumSlots;
|
||||
SMBIOS_TABLE_TYPE19 *Type19Record;
|
||||
EFI_SMBIOS_HANDLE MemArrayMappedAddrSmbiosHandle;
|
||||
EFI_SMBIOS_PROTOCOL *Smbios;
|
||||
CHAR16 *Nt32MemString;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
NumSlots = 1;
|
||||
|
||||
//
|
||||
// Process Memory String in form size!size ...
|
||||
// So 64!64 is 128 MB
|
||||
//
|
||||
Nt32MemString = PcdGetPtr (PcdWinNtMemorySize);
|
||||
for (TotalMemorySize = 0; *Nt32MemString != '\0';) {
|
||||
TotalMemorySize += StrDecimalToUint64 (Nt32MemString);
|
||||
while (*Nt32MemString != '\0') {
|
||||
if (*Nt32MemString == '!') {
|
||||
Nt32MemString++;
|
||||
break;
|
||||
}
|
||||
Nt32MemString++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Convert Total Memory Size to based on KiloByte
|
||||
//
|
||||
TotalMemorySize = LShiftU64 (TotalMemorySize, 20);
|
||||
//
|
||||
// Generate Memory Array Mapped Address info
|
||||
//
|
||||
Type19Record = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE19) + 2);
|
||||
Type19Record->Hdr.Type = EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS;
|
||||
Type19Record->Hdr.Length = sizeof(SMBIOS_TABLE_TYPE19);
|
||||
Type19Record->Hdr.Handle = 0;
|
||||
Type19Record->StartingAddress = 0;
|
||||
Type19Record->EndingAddress = (UINT32)RShiftU64(TotalMemorySize, 10) - 1;
|
||||
Type19Record->MemoryArrayHandle = 0;
|
||||
Type19Record->PartitionWidth = (UINT8)(NumSlots);
|
||||
|
||||
//
|
||||
// Generate Memory Array Mapped Address info (TYPE 19)
|
||||
//
|
||||
Status = AddSmbiosRecord (Smbios, &MemArrayMappedAddrSmbiosHandle, (EFI_SMBIOS_TABLE_HEADER*) Type19Record);
|
||||
|
||||
FreePool(Type19Record);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MiscSubclassDriverEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
Description:
|
||||
|
||||
Standard EFI driver point. This driver parses the mMiscSubclassDataTable
|
||||
structure and reports any generated data to the DataHub.
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle
|
||||
Handle for the image of this driver
|
||||
|
||||
SystemTable
|
||||
Pointer to the EFI System Table
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS
|
||||
The data was successfully reported to the Data Hub.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Index;
|
||||
EFI_STATUS EfiStatus;
|
||||
EFI_SMBIOS_PROTOCOL *Smbios;
|
||||
|
||||
EfiStatus = gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios);
|
||||
|
||||
if (EFI_ERROR(EfiStatus)) {
|
||||
DEBUG((EFI_D_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStatus));
|
||||
return EfiStatus;
|
||||
}
|
||||
|
||||
mHiiHandle = HiiAddPackages (
|
||||
&gEfiCallerIdGuid,
|
||||
NULL,
|
||||
MiscSubclassStrings,
|
||||
NULL
|
||||
);
|
||||
ASSERT (mHiiHandle != NULL);
|
||||
|
||||
for (Index = 0; Index < mMiscSubclassDataTableEntries; ++Index) {
|
||||
//
|
||||
// If the entry have a function pointer, just log the data.
|
||||
//
|
||||
if (mMiscSubclassDataTable[Index].Function != NULL) {
|
||||
EfiStatus = (*mMiscSubclassDataTable[Index].Function)(
|
||||
mMiscSubclassDataTable[Index].RecordData,
|
||||
Smbios
|
||||
);
|
||||
|
||||
if (EFI_ERROR(EfiStatus)) {
|
||||
DEBUG((EFI_D_ERROR, "Misc smbios store error. Index=%d, ReturnStatus=%r\n", Index, EfiStatus));
|
||||
return EfiStatus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Log Memory SMBIOS Record
|
||||
//
|
||||
EfiStatus = LogMemorySmbiosRecord();
|
||||
return EfiStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Add an SMBIOS record.
|
||||
|
||||
@param Smbios The EFI_SMBIOS_PROTOCOL instance.
|
||||
@param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
|
||||
@param Record The data for the fixed portion of the SMBIOS record. The format of the record is
|
||||
determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
|
||||
by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
|
||||
a set of null terminated strings and a null.
|
||||
|
||||
@retval EFI_SUCCESS Record was added.
|
||||
@retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
AddSmbiosRecord (
|
||||
IN EFI_SMBIOS_PROTOCOL *Smbios,
|
||||
OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
|
||||
IN EFI_SMBIOS_TABLE_HEADER *Record
|
||||
)
|
||||
{
|
||||
*SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
|
||||
return Smbios->Add (
|
||||
Smbios,
|
||||
NULL,
|
||||
SmbiosHandle,
|
||||
Record
|
||||
);
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscSystemLanguageStringData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA, SystemLanguageString) = {
|
||||
0,
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_LANGUAGE_STRING)
|
||||
};
|
||||
|
||||
/* eof - MiscSystemLanguageStringData.c */
|
|
@ -1,72 +0,0 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
/**
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscOemString (Type 11).
|
||||
|
||||
@param RecordData Pointer to copy of RecordData from the Data Table.
|
||||
|
||||
@retval EFI_SUCCESS All parameters were valid.
|
||||
@retval EFI_UNSUPPORTED Unexpected RecordType value.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
||||
|
||||
**/
|
||||
MISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
SMBIOS_TABLE_TYPE13 *SmbiosRecord;
|
||||
UINTN StrLeng;
|
||||
CHAR8 *OptionalStrStart;
|
||||
EFI_STRING Str;
|
||||
STRING_REF TokenToGet;
|
||||
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (RecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_LANGUAGE_STRING);
|
||||
Str = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
StrLeng = StrLen(Str);
|
||||
if (StrLeng > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Two zeros following the last string.
|
||||
//
|
||||
SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);
|
||||
ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);
|
||||
|
||||
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION;
|
||||
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13);
|
||||
//
|
||||
// Make handle chosen by smbios protocol.add automatically.
|
||||
//
|
||||
SmbiosRecord->Hdr.Handle = 0;
|
||||
SmbiosRecord->InstallableLanguages = 1;
|
||||
SmbiosRecord->Flags = 1;
|
||||
SmbiosRecord->CurrentLanguages = 1;
|
||||
OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
|
||||
UnicodeStrToAsciiStr(Str, OptionalStrStart);
|
||||
|
||||
|
||||
//
|
||||
// Now we have got the full smbios record, call smbios protocol to add this record.
|
||||
//
|
||||
Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
|
||||
|
||||
FreePool(SmbiosRecord);
|
||||
return Status;
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscSystemManufacturerData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) System Manufacturer data.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_MANUFACTURER_DATA, MiscSystemManufacturer)
|
||||
= {
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_MANUFACTURER),
|
||||
// SystemManufactrurer
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME),
|
||||
// SystemProductName
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_VERSION),
|
||||
// SystemVersion
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_SERIAL_NUMBER),
|
||||
// SystemSerialNumber
|
||||
{
|
||||
0xbadfaced,
|
||||
0xdead,
|
||||
0xbeef,
|
||||
0x13,
|
||||
0x13,
|
||||
0x13,
|
||||
0x13,
|
||||
0x13,
|
||||
0x13,
|
||||
0x13,
|
||||
0x13
|
||||
},
|
||||
// SystemUuid
|
||||
EfiSystemWakeupTypePowerSwitch // SystemWakeupType
|
||||
};
|
||||
|
||||
/* eof - MiscSystemManufacturerData.c */
|
|
@ -1,129 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscSystemManufacturerFunction.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
/**
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscSystemManufacturer (Type 1).
|
||||
|
||||
@param RecordData Pointer to copy of RecordData from the Data Table.
|
||||
|
||||
@retval EFI_SUCCESS All parameters were valid.
|
||||
@retval EFI_UNSUPPORTED Unexpected RecordType value.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
||||
|
||||
**/
|
||||
MISC_SMBIOS_TABLE_FUNCTION(MiscSystemManufacturer)
|
||||
{
|
||||
CHAR8 *OptionalStrStart;
|
||||
UINTN ManuStrLen;
|
||||
UINTN VerStrLen;
|
||||
UINTN PdNameStrLen;
|
||||
UINTN SerialNumStrLen;
|
||||
EFI_STATUS Status;
|
||||
EFI_STRING Manufacturer;
|
||||
EFI_STRING ProductName;
|
||||
EFI_STRING Version;
|
||||
EFI_STRING SerialNumber;
|
||||
STRING_REF TokenToGet;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
SMBIOS_TABLE_TYPE1 *SmbiosRecord;
|
||||
EFI_MISC_SYSTEM_MANUFACTURER *ForType1InputData;
|
||||
|
||||
ForType1InputData = (EFI_MISC_SYSTEM_MANUFACTURER *)RecordData;
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (RecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_MANUFACTURER);
|
||||
Manufacturer = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
ManuStrLen = StrLen(Manufacturer);
|
||||
if (ManuStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_PRODUCT_NAME);
|
||||
ProductName = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
PdNameStrLen = StrLen(ProductName);
|
||||
if (PdNameStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_VERSION);
|
||||
Version = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
VerStrLen = StrLen(Version);
|
||||
if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SERIAL_NUMBER);
|
||||
SerialNumber = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
SerialNumStrLen = StrLen(SerialNumber);
|
||||
if (SerialNumStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
//
|
||||
// Two zeros following the last string.
|
||||
//
|
||||
SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE1) + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + 1);
|
||||
ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE1) + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + 1);
|
||||
|
||||
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_INFORMATION;
|
||||
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE1);
|
||||
//
|
||||
// Make handle chosen by smbios protocol.add automatically.
|
||||
//
|
||||
SmbiosRecord->Hdr.Handle = 0;
|
||||
//
|
||||
// Manu will be the 1st optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->Manufacturer = 1;
|
||||
//
|
||||
// ProductName will be the 2nd optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->ProductName = 2;
|
||||
//
|
||||
// Version will be the 3rd optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->Version = 3;
|
||||
//
|
||||
// Version will be the 4th optional string following the formatted structure.
|
||||
//
|
||||
SmbiosRecord->SerialNumber = 4;
|
||||
CopyMem ((UINT8 *) (&SmbiosRecord->Uuid),&ForType1InputData->SystemUuid,16);
|
||||
SmbiosRecord->WakeUpType = (UINT8)ForType1InputData->SystemWakeupType;
|
||||
|
||||
OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
|
||||
UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart);
|
||||
UnicodeStrToAsciiStr(ProductName, OptionalStrStart + ManuStrLen + 1);
|
||||
UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1);
|
||||
UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1);
|
||||
|
||||
//
|
||||
// Now we have got the full smbios record, call smbios protocol to add this record.
|
||||
//
|
||||
Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
|
||||
|
||||
FreePool(SmbiosRecord);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* eof - MiscSystemManufacturerFunction.c */
|
|
@ -1,26 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscSystemOptionStringData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_OPTION_STRING_DATA, SystemOptionString) = {
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_OPTION_STRING)
|
||||
};
|
||||
|
||||
/* eof - MiscSystemOptionStringData.c */
|
|
@ -1,71 +0,0 @@
|
|||
/** @file
|
||||
BIOS system option string boot time changes.
|
||||
SMBIOS type 12.
|
||||
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
|
||||
/**
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscSystemOptionString (Type 12).
|
||||
|
||||
@param RecordData Pointer to copy of RecordData from the Data Table.
|
||||
|
||||
@retval EFI_SUCCESS All parameters were valid.
|
||||
@retval EFI_UNSUPPORTED Unexpected RecordType value.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
||||
|
||||
**/
|
||||
MISC_SMBIOS_TABLE_FUNCTION(SystemOptionString)
|
||||
{
|
||||
CHAR8 *OptionalStrStart;
|
||||
UINTN OptStrLen;
|
||||
EFI_STRING OptionString;
|
||||
EFI_STATUS Status;
|
||||
STRING_REF TokenToGet;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
SMBIOS_TABLE_TYPE12 *SmbiosRecord;
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (RecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_OPTION_STRING);
|
||||
OptionString = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
OptStrLen = StrLen(OptionString);
|
||||
if (OptStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Two zeros following the last string.
|
||||
//
|
||||
SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE12) + OptStrLen + 1 + 1);
|
||||
ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE12) + OptStrLen + 1 + 1);
|
||||
|
||||
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS;
|
||||
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE12);
|
||||
//
|
||||
// Make handle chosen by smbios protocol.add automatically.
|
||||
//
|
||||
SmbiosRecord->Hdr.Handle = 0;
|
||||
|
||||
SmbiosRecord->StringCount = 1;
|
||||
OptionalStrStart = (CHAR8*) (SmbiosRecord + 1);
|
||||
UnicodeStrToAsciiStr(OptionString, OptionalStrStart);
|
||||
//
|
||||
// Now we have got the full smbios record, call smbios protocol to add this record.
|
||||
//
|
||||
Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
|
||||
|
||||
FreePool(SmbiosRecord);
|
||||
return Status;
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
MiscSystemSlotDesignationData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotDesignation) = {
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_SLOT_DESIGNATION), // SlotDesignation
|
||||
EfiSlotTypeOther, // SlotType
|
||||
EfiSlotDataBusWidthOther, // SlotDataBusWidth
|
||||
EfiSlotUsageOther, // SlotUsage
|
||||
EfiSlotLengthOther, // SlotLength
|
||||
0, // SlotId
|
||||
{ // SlotCharacteristics
|
||||
0, // CharacteristicsUnknown :1;
|
||||
0, // Provides50Volts :1;
|
||||
0, // Provides33Volts :1;
|
||||
0, // SharedSlot :1;
|
||||
0, // PcCard16Supported :1;
|
||||
0, // CardBusSupported :1;
|
||||
0, // ZoomVideoSupported :1;
|
||||
0, // ModemRingResumeSupported:1;
|
||||
0, // PmeSignalSupported :1;
|
||||
0, // HotPlugDevicesSupported :1;
|
||||
0, // SmbusSignalSupported :1;
|
||||
0 // Reserved :21;
|
||||
},
|
||||
0 // SlotDevicePath
|
||||
};
|
||||
|
||||
/* eof - MiscSystemSlotsData.c */
|
|
@ -1,86 +0,0 @@
|
|||
/** @file
|
||||
BIOS system slot designator information boot time changes.
|
||||
SMBIOS type 9.
|
||||
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
/**
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscSystemSlotDesignator structure (Type 9).
|
||||
|
||||
@param RecordData Pointer to copy of RecordData from the Data Table.
|
||||
|
||||
@retval EFI_SUCCESS All parameters were valid.
|
||||
@retval EFI_UNSUPPORTED Unexpected RecordType value.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
||||
|
||||
**/
|
||||
MISC_SMBIOS_TABLE_FUNCTION(MiscSystemSlotDesignation)
|
||||
{
|
||||
CHAR8 *OptionalStrStart;
|
||||
UINTN SlotDesignationStrLen;
|
||||
EFI_STATUS Status;
|
||||
EFI_STRING SlotDesignation;
|
||||
STRING_REF TokenToGet;
|
||||
SMBIOS_TABLE_TYPE9 *SmbiosRecord;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
EFI_MISC_SYSTEM_SLOT_DESIGNATION* ForType9InputData;
|
||||
|
||||
ForType9InputData = (EFI_MISC_SYSTEM_SLOT_DESIGNATION *)RecordData;
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (RecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
TokenToGet = 0;
|
||||
switch (ForType9InputData->SlotDesignation) {
|
||||
case STR_MISC_SYSTEM_SLOT_DESIGNATION:
|
||||
TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_DESIGNATION);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SlotDesignation = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
||||
SlotDesignationStrLen = StrLen(SlotDesignation);
|
||||
if (SlotDesignationStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Two zeros following the last string.
|
||||
//
|
||||
SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE9) + SlotDesignationStrLen + 1 + 1);
|
||||
ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE9) +SlotDesignationStrLen + 1 + 1);
|
||||
|
||||
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_SLOTS;
|
||||
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE9);
|
||||
SmbiosRecord->Hdr.Handle = 0;
|
||||
SmbiosRecord->SlotDesignation = 1;
|
||||
SmbiosRecord->SlotType = (UINT8)ForType9InputData->SlotType;
|
||||
SmbiosRecord->SlotDataBusWidth = (UINT8)ForType9InputData->SlotDataBusWidth;
|
||||
SmbiosRecord->CurrentUsage = (UINT8)ForType9InputData->SlotUsage;
|
||||
SmbiosRecord->SlotLength = (UINT8)ForType9InputData->SlotLength;
|
||||
SmbiosRecord->SlotID = ForType9InputData->SlotId;
|
||||
|
||||
//
|
||||
// Slot Characteristics
|
||||
//
|
||||
CopyMem ((UINT8 *) &SmbiosRecord->SlotCharacteristics1,(UINT8 *) &ForType9InputData->SlotCharacteristics,2);
|
||||
OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
|
||||
UnicodeStrToAsciiStr(SlotDesignation, OptionalStrStart);
|
||||
//
|
||||
// Now we have got the full smbios record, call smbios protocol to add this record.
|
||||
//
|
||||
Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
|
||||
|
||||
FreePool(SmbiosRecord);
|
||||
return Status;
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
## @file
|
||||
# This package is a platform package that provide platform module/library
|
||||
# required by NT32 platform.
|
||||
#
|
||||
# File/Directory Orignazation:
|
||||
# |- Sec : Emulation SecCore for Nt32 platform
|
||||
# |- *Pei : PEIM drivers
|
||||
# |- *Dxe : DXE drivers
|
||||
# |- Nt32Pkg.dec : This file
|
||||
# |- Nt32Pkg.dsc : Nt32 platform DSC file
|
||||
# |- Nt32Pkg.fdf : Flash description file for Nt32Pkg. It is used for creating FD file.
|
||||
# |- Include : Include files for Nt32Pkg
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
|
||||
[Defines]
|
||||
DEC_SPECIFICATION = 0x00010005
|
||||
PACKAGE_NAME = Nt32Pkg
|
||||
PACKAGE_GUID = 0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3
|
||||
PACKAGE_VERSION = 0.4
|
||||
|
||||
[Includes]
|
||||
Include
|
||||
|
||||
[LibraryClasses]
|
||||
##
|
||||
# Expose EFI_WIN_NT_THUNK_PROTOCOL's interface, this protocol wrapper all
|
||||
# necessary Window API used by Nt32 enumlation environment.
|
||||
WinNtLib|Include/Library/WinNtLib.h
|
||||
|
||||
[Guids]
|
||||
gEfiWinNtPassThroughGuid = { 0xCC664EB8, 0x3C24, 0x4086, { 0xB6, 0xF6, 0x34, 0xE8, 0x56, 0xBC, 0xE3, 0x6E }}
|
||||
gEfiWinNtConsoleGuid = { 0xBA73672C, 0xA5D3, 0x11D4, { 0xBD, 0x00, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}
|
||||
gEfiWinNtUgaGuid = { 0xAB248E99, 0xABE1, 0x11D4, { 0xBD, 0x0D, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}
|
||||
gEfiWinNtGopGuid = { 0x4e11e955, 0xccca, 0x11d4, { 0xbd, 0x0d, 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81 }}
|
||||
gEfiWinNtSerialPortGuid = { 0x0C95A93D, 0xA006, 0x11D4, { 0xBC, 0xFA, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}
|
||||
gEfiWinNtFileSystemGuid = { 0x0C95A935, 0xA006, 0x11D4, { 0xBC, 0xFA, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}
|
||||
gEfiWinNtPhysicalDisksGuid = { 0x0C95A92F, 0xA006, 0x11D4, { 0xBC, 0xFA, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}
|
||||
gEfiWinNtVirtualDisksGuid = { 0x0C95A928, 0xA006, 0x11D4, { 0xBC, 0xFA, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}
|
||||
gEfiNt32PkgTokenSpaceGuid = { 0x0D79A645, 0x1D91, 0x40a6, { 0xA8, 0x1F, 0x61, 0xE6, 0x98, 0x2B, 0x32, 0xB4 }}
|
||||
gEfiWinNtSystemConfigGuid = { 0xb347f047, 0xaf8c, 0x490e, { 0xac, 0x07, 0x0a, 0xa9, 0xb7, 0xe5, 0x38, 0x58 }}
|
||||
|
||||
[Ppis]
|
||||
## This PPI wrapper all necessary windows API used by PEI driver in NT32 environment.
|
||||
gPeiNtThunkPpiGuid = { 0x98c281e5, 0xf906, 0x43dd, { 0xa9, 0x2b, 0xb0, 0x03, 0xbf, 0x27, 0x65, 0xda }}
|
||||
## This PPI provide system memory scan interface which simulate real platform perform
|
||||
# memory's auto scan.
|
||||
gPeiNtAutoScanPpiGuid = { 0x0dce384d, 0x007c, 0x4ba5, { 0x94, 0xbd, 0x0f, 0x6e, 0xb6, 0x4d, 0x2a, 0xa9 }}
|
||||
## This PPI provide interace to loads and relocates a PE/COFF image into memory.
|
||||
gNtPeiLoadFilePpiGuid = { 0xfd0c65eb, 0x0405, 0x4cd2, { 0x8a, 0xee, 0xf4, 0x0, 0xef, 0x13, 0xba, 0xc2 }}
|
||||
## This PPI instance hold information for an simulated firmware device.
|
||||
gNtFwhPpiGuid = { 0x4e76928f, 0x50ad, 0x4334, {0xb0, 0x6b, 0xa8, 0x42, 0x13, 0x10, 0x8a, 0x57 }}
|
||||
|
||||
[Protocols]
|
||||
gWinNtBusDriverGuid = { 0x0419f582, 0x0625, 0x4531, { 0x8a, 0x33, 0x85, 0xa9, 0x96, 0x5c, 0x95, 0xbc }}
|
||||
gEfiWinNtThunkProtocolGuid = { 0x58C518B1, 0x76F3, 0x11D4, { 0xBC, 0xEA, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}
|
||||
gEfiWinNtIoProtocolGuid = { 0x96EB4AD6, 0xA32A, 0x11D4, { 0xBC, 0xFD, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}
|
||||
|
||||
[PcdsFixedAtBuild]
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageEventLogBase|0x0|UINT32|0x0000100e
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageEventLogSize|0x0|UINT32|0x0000100f
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashFvRecoveryBase|0x0|UINT32|0x00001010
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashFvRecoverySize|0x0|UINT32|0x00001011
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareFdSize|0x0|UINT32|0x00001012
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareBlockSize|0|UINT32|0x00001013
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageVariableBase|0x0|UINT32|0x00001014
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageFtwSpareBase|0x0|UINT32|0x00001015
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageFtwWorkingBase|0x0|UINT32|0x00001016
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFdBaseAddress|0x0|UINT32|0x00001017
|
||||
|
||||
[PcdsFixedAtBuild, PcdsPatchableInModule]
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtBootMode|1|UINT32|0x00001006
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareVolume|L"..\\Fv\\Fv_Recovery.fd"|VOID*|0x00001009
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtMemorySizeForSecMain|L"64!64"|VOID*|0x0000100c
|
||||
|
||||
[PcdsDynamic, PcdsDynamicEx]
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtPhysicalDisk|L"E:RW;245760;512"|VOID*|0x00001000
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtVirtualDisk|L"FW;40960;512"|VOID*|0x00001001
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtSerialPort|L"COM1!COM2"|VOID*|0x00001002
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtUga|L"UGA Window 1!UGA Window 2"|VOID*|0x00001003
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L"."|VOID*|0x00001004
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtMemorySize|L"64!64"|VOID*|0x00001005
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtConsole|L"Bus Driver Console Window"|VOID*|0x0000100a
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtGop|L"UGA Window 1!UGA Window 2"|VOID*|0x0000100d
|
||||
|
|
@ -1,483 +0,0 @@
|
|||
## @file
|
||||
# EFI/Framework Emulation Platform with UEFI HII interface supported.
|
||||
#
|
||||
# The Emulation Platform can be used to debug individual modules, prior to creating
|
||||
# a real platform. This also provides an example for how an DSC is created.
|
||||
#
|
||||
# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2015, Hewlett-Packard Development Company, L.P.<BR>
|
||||
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Defines Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
PLATFORM_NAME = NT32
|
||||
PLATFORM_GUID = EB216561-961F-47EE-9EF9-CA426EF547C2
|
||||
PLATFORM_VERSION = 0.4
|
||||
DSC_SPECIFICATION = 0x00010005
|
||||
OUTPUT_DIRECTORY = Build/NT32$(ARCH)
|
||||
SUPPORTED_ARCHITECTURES = IA32|X64
|
||||
BUILD_TARGETS = DEBUG|RELEASE|NOOPT
|
||||
SKUID_IDENTIFIER = DEFAULT
|
||||
FLASH_DEFINITION = Nt32Pkg/Nt32Pkg.fdf
|
||||
#
|
||||
# This flag is to control tool to generate PCD info for dynamic(ex) PCD,
|
||||
# then enable or disable PCD info feature. TRUE is enable, and FLASE is disable.
|
||||
# If the flag is absent, it will be same as FALSE.
|
||||
#
|
||||
PCD_INFO_GENERATION = TRUE
|
||||
|
||||
#
|
||||
# Defines for default states. These can be changed on the command line.
|
||||
# -D FLAG=VALUE
|
||||
#
|
||||
# Note: Secure Boot feature highly depends on the OpenSSL building. To enable this
|
||||
# feature, please follow the instructions found in the file "Patch-HOWTO.txt"
|
||||
# located in CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
|
||||
#
|
||||
DEFINE SECURE_BOOT_ENABLE = FALSE
|
||||
|
||||
#
|
||||
# Network definition
|
||||
# SnpNt32Dxe.inf will be used.
|
||||
#
|
||||
DEFINE NETWORK_TLS_ENABLE = FALSE
|
||||
DEFINE NETWORK_IP6_ENABLE = FALSE
|
||||
DEFINE NETWORK_SNP_ENABLE = FALSE
|
||||
DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# SKU Identification section - list of all SKU IDs supported by this
|
||||
# Platform.
|
||||
#
|
||||
################################################################################
|
||||
[SkuIds]
|
||||
0|DEFAULT # The entry: 0|DEFAULT is reserved and always required.
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Library Class section - list of all Library Classes needed by this Platform.
|
||||
#
|
||||
################################################################################
|
||||
[LibraryClasses]
|
||||
#
|
||||
# Entry point
|
||||
#
|
||||
PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
|
||||
PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
|
||||
DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
|
||||
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
||||
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
|
||||
#
|
||||
# Basic
|
||||
#
|
||||
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
|
||||
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
|
||||
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
|
||||
CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
|
||||
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
|
||||
PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
|
||||
PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
|
||||
PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
|
||||
CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
|
||||
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
|
||||
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
|
||||
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
|
||||
#
|
||||
# UEFI & PI
|
||||
#
|
||||
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
|
||||
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
|
||||
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
|
||||
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
|
||||
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
|
||||
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
|
||||
DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
|
||||
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiTianoCustomDecompressLib.inf
|
||||
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
|
||||
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
|
||||
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
|
||||
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
|
||||
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
|
||||
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
|
||||
|
||||
#
|
||||
# Generic Modules
|
||||
#
|
||||
UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
|
||||
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
||||
OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
|
||||
GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
|
||||
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
|
||||
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
|
||||
TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
|
||||
SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
|
||||
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
|
||||
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
|
||||
#
|
||||
# Platform
|
||||
#
|
||||
PlatformBootManagerLib|Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
|
||||
#
|
||||
# Misc
|
||||
#
|
||||
DebugLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
|
||||
DebugPrintErrorLevelLib|MdeModulePkg/Library/DxeDebugPrintErrorLevelLib/DxeDebugPrintErrorLevelLib.inf
|
||||
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
|
||||
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
|
||||
CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
|
||||
LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
|
||||
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
|
||||
ResetSystemLib|Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.inf
|
||||
!if $(NETWORK_TLS_ENABLE) == TRUE
|
||||
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
|
||||
!else
|
||||
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
|
||||
!endif
|
||||
|
||||
!if $(SECURE_BOOT_ENABLE) == TRUE
|
||||
PlatformSecureLib|Nt32Pkg/Library/PlatformSecureLib/PlatformSecureLib.inf
|
||||
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
|
||||
AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
|
||||
!else
|
||||
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
||||
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
|
||||
!endif
|
||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||
|
||||
[LibraryClasses.common.USER_DEFINED]
|
||||
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
|
||||
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
|
||||
ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
|
||||
OemHookStatusCodeLib|Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.inf
|
||||
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
|
||||
[LibraryClasses.common.PEIM,LibraryClasses.common.PEI_CORE]
|
||||
#
|
||||
# PEI phase common
|
||||
#
|
||||
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
|
||||
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
|
||||
ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
|
||||
ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
|
||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
|
||||
IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf
|
||||
PeCoffGetEntryPointLib|Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/Nt32PeiPeCoffGetEntryPointLib.inf
|
||||
PeCoffExtraActionLib|Nt32Pkg/Library/PeiNt32PeCoffExtraActionLib/PeiNt32PeCoffExtraActionLib.inf
|
||||
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
|
||||
|
||||
[LibraryClasses.common.PEI_CORE]
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
|
||||
|
||||
[LibraryClasses.common.PEIM]
|
||||
PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
|
||||
OemHookStatusCodeLib|Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.inf
|
||||
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
|
||||
|
||||
[LibraryClasses.common]
|
||||
#
|
||||
# DXE phase common
|
||||
#
|
||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
|
||||
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
||||
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
||||
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
|
||||
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
|
||||
OemHookStatusCodeLib|Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.inf
|
||||
PeCoffExtraActionLib|Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.inf
|
||||
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
|
||||
WinNtLib|Nt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.inf
|
||||
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
|
||||
TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
|
||||
|
||||
[LibraryClasses.common.DXE_CORE]
|
||||
HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
|
||||
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
|
||||
[LibraryClasses.common.DXE_SMM_DRIVER]
|
||||
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
|
||||
|
||||
[LibraryClasses.common.UEFI_DRIVER]
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
|
||||
[LibraryClasses.common.UEFI_APPLICATION]
|
||||
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
||||
PrintLib|MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf
|
||||
|
||||
[LibraryClasses.common.DXE_RUNTIME_DRIVER]
|
||||
#
|
||||
# Runtime
|
||||
#
|
||||
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Pcd Section - list of all EDK II PCD Entries defined by this Platform
|
||||
#
|
||||
################################################################################
|
||||
[PcdsFeatureFlag]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplBuildPageTables|FALSE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|FALSE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics|TRUE
|
||||
|
||||
[PcdsFixedAtBuild]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy|0x00000000
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0x0
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x0
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000040
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x1f
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareVolume|L"..\\Fv\\Nt32.fd"
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareBlockSize|0x10000
|
||||
gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x0f
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
|
||||
|
||||
!if $(SECURE_BOOT_ENABLE) == TRUE
|
||||
# override the default values from SecurityPkg to ensure images from all sources are verified in secure boot
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
|
||||
!endif
|
||||
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform
|
||||
#
|
||||
################################################################################
|
||||
[PcdsDynamicDefault.common.DEFAULT]
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtSerialPort|L"COM1!COM2"|VOID*|20
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtGop|L"UGA Window 1!UGA Window 2"|VOID*|52
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtConsole|L"Bus Driver Console Window"|VOID*|52
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtVirtualDisk|L"FW;40960;512"|VOID*|26
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtMemorySize|L"64!64"|VOID*|12
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtPhysicalDisk|L"a:RW;2880;512!d:RO;307200;2048!j:RW;262144;512"|VOID*|100
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtUga|L"UGA Window 1!UGA Window 2"|VOID*|52
|
||||
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
|
||||
|
||||
[PcdsDynamicDefault.Ia32]
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L"."|VOID*|106
|
||||
|
||||
[PcdsDynamicDefault.x64]
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L"."|VOID*|106
|
||||
|
||||
[PcdsDynamicHii.common.DEFAULT]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn|L"SetupConsoleConfig"|gEfiNt32PkgTokenSpaceGuid|0x0|80
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|L"SetupConsoleConfig"|gEfiNt32PkgTokenSpaceGuid|0x4|25
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|10
|
||||
gEfiMdePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel|L"HwErrRecSupport"|gEfiGlobalVariableGuid|0x0|1
|
||||
|
||||
###################################################################################################
|
||||
#
|
||||
# Components Section - list of the modules and components that will be processed by compilation
|
||||
# tools and the EDK II tools to generate PE32/PE32+/Coff image files.
|
||||
#
|
||||
# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
|
||||
# into firmware volume images. This section is just a list of modules to compile from
|
||||
# source into UEFI-compliant binaries.
|
||||
# It is the FDF file that contains information on combining binary files into firmware
|
||||
# volume images, whose concept is beyond UEFI and is described in PI specification.
|
||||
# Binary modules do not need to be listed in this section, as they should be
|
||||
# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi),
|
||||
# Logo (Logo.bmp), and etc.
|
||||
# There may also be modules listed in this section that are not required in the FDF file,
|
||||
# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
|
||||
# generated for it, but the binary will not be put into any firmware volume.
|
||||
#
|
||||
###################################################################################################
|
||||
[Components]
|
||||
##
|
||||
# SEC Phase modules
|
||||
##
|
||||
Nt32Pkg/Sec/SecMain.inf
|
||||
|
||||
##
|
||||
# PEI Phase modules
|
||||
##
|
||||
MdeModulePkg/Core/Pei/PeiMain.inf
|
||||
MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
|
||||
<LibraryClasses>
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
}
|
||||
MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf
|
||||
MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
|
||||
Nt32Pkg/WinNtOemHookStatusCodeHandlerPei/WinNtOemHookStatusCodeHandlerPei.inf
|
||||
Nt32Pkg/BootModePei/BootModePei.inf
|
||||
Nt32Pkg/StallPei/StallPei.inf
|
||||
Nt32Pkg/WinNtFlashMapPei/WinNtFlashMapPei.inf
|
||||
|
||||
MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
|
||||
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
||||
|
||||
Nt32Pkg/WinNtAutoScanPei/WinNtAutoScanPei.inf
|
||||
Nt32Pkg/WinNtFirmwareVolumePei/WinNtFirmwareVolumePei.inf
|
||||
Nt32Pkg/WinNtThunkPPIToProtocolPei/WinNtThunkPPIToProtocolPei.inf
|
||||
MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
|
||||
##
|
||||
# DXE Phase modules
|
||||
##
|
||||
MdeModulePkg/Core/Dxe/DxeMain.inf {
|
||||
<LibraryClasses>
|
||||
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
|
||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||
<BuildOptions>
|
||||
*_*_*_CC_FLAGS =
|
||||
}
|
||||
|
||||
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
|
||||
<LibraryClasses>
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
}
|
||||
Nt32Pkg/MetronomeDxe/MetronomeDxe.inf
|
||||
Nt32Pkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||
Nt32Pkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
|
||||
<LibraryClasses>
|
||||
!if $(SECURE_BOOT_ENABLE) == TRUE
|
||||
NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
|
||||
!endif
|
||||
}
|
||||
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
||||
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
|
||||
Nt32Pkg/WinNtThunkDxe/WinNtThunkDxe.inf
|
||||
Nt32Pkg/CpuRuntimeDxe/CpuRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
|
||||
Nt32Pkg/MiscSubClassPlatformDxe/MiscSubClassPlatformDxe.inf
|
||||
Nt32Pkg/TimerDxe/TimerDxe.inf
|
||||
MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
|
||||
Nt32Pkg/WinNtOemHookStatusCodeHandlerDxe/WinNtOemHookStatusCodeHandlerDxe.inf
|
||||
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
|
||||
}
|
||||
!if $(SECURE_BOOT_ENABLE) == TRUE
|
||||
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
|
||||
!endif
|
||||
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
|
||||
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf {
|
||||
<LibraryClasses>
|
||||
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
||||
}
|
||||
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf {
|
||||
<LibraryClasses>
|
||||
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
||||
}
|
||||
MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf {
|
||||
<LibraryClasses>
|
||||
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
||||
}
|
||||
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
|
||||
<LibraryClasses>
|
||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||
}
|
||||
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
||||
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
||||
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
||||
FatPkg/EnhancedFatDxe/Fat.inf
|
||||
MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
|
||||
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
|
||||
MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf ##This driver follows UEFI specification definition
|
||||
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf ##This driver follows UEFI specification definition
|
||||
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
|
||||
Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriverDxe.inf {
|
||||
<LibraryClasses>
|
||||
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
||||
}
|
||||
Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIoDxe.inf
|
||||
Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIoDxe.inf
|
||||
Nt32Pkg/WinNtGopDxe/WinNtGopDxe.inf
|
||||
Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystemDxe.inf
|
||||
MdeModulePkg/Application/HelloWorld/HelloWorld.inf
|
||||
|
||||
#
|
||||
# Network SNP drivers
|
||||
# To test network drivers, need network Io driver(SnpNt32Io.dll), please refer to NETWORK-IO Subproject.
|
||||
#
|
||||
!include NetworkPkg/Network.dsc.inc
|
||||
Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.inf
|
||||
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
|
||||
MdeModulePkg/Application/UiApp/UiApp.inf{
|
||||
<LibraryClasses>
|
||||
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
|
||||
NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
|
||||
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
|
||||
}
|
||||
MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
|
||||
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
|
||||
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
|
||||
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
|
||||
MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
|
||||
MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf {
|
||||
<LibraryClasses>
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
}
|
||||
MdeModulePkg/Application/VariableInfo/VariableInfo.inf
|
||||
|
||||
MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf
|
||||
MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.inf
|
||||
MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf {
|
||||
<LibraryClasses>
|
||||
NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf
|
||||
}
|
||||
MdeModulePkg/Logo/LogoDxe.inf
|
||||
ShellPkg/Application/Shell/Shell.inf {
|
||||
<PcdsFixedAtBuild>
|
||||
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
|
||||
<LibraryClasses>
|
||||
NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf
|
||||
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
|
||||
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
|
||||
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
|
||||
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
|
||||
FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
|
||||
}
|
||||
|
||||
###################################################################################################
|
||||
#
|
||||
# BuildOptions Section - Define the module specific tool chain flags that should be used as
|
||||
# the default flags for a module. These flags are appended to any
|
||||
# standard flags that are defined by the build process. They can be
|
||||
# applied for any modules or only those modules with the specific
|
||||
# module style (EDK or EDKII) specified in [Components] section.
|
||||
#
|
||||
###################################################################################################
|
||||
[BuildOptions]
|
||||
DEBUG_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
|
||||
NOOPT_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
|
||||
RELEASE_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096
|
||||
|
|
@ -1,395 +0,0 @@
|
|||
## @file
|
||||
# This is NT32 FDF file with UEFI HII features enabled
|
||||
#
|
||||
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# FD Section
|
||||
# The [FD] Section is made up of the definition statements and a
|
||||
# description of what goes into the Flash Device Image. Each FD section
|
||||
# defines one flash "device" image. A flash device image may be one of
|
||||
# the following: Removable media bootable image (like a boot floppy
|
||||
# image,) an Option ROM image (that would be "flashed" into an add-in
|
||||
# card,) a System "Flash" image (that would be burned into a system's
|
||||
# flash) or an Update ("Capsule") image that will be used to update and
|
||||
# existing system flash.
|
||||
#
|
||||
################################################################################
|
||||
[FD.Nt32]
|
||||
BaseAddress = 0x0|gEfiNt32PkgTokenSpaceGuid.PcdWinNtFdBaseAddress #The base address of the FLASH Device.
|
||||
Size = 0x00480000|gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareFdSize #The size in bytes of the FLASH Device
|
||||
ErasePolarity = 1
|
||||
BlockSize = 0x10000
|
||||
NumBlocks = 0x48
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Following are lists of FD Region layout which correspond to the locations of different
|
||||
# images within the flash device.
|
||||
#
|
||||
# Regions must be defined in ascending order and may not overlap.
|
||||
#
|
||||
# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
|
||||
# the pipe "|" character, followed by the size of the region, also in hex with the leading
|
||||
# "0x" characters. Like:
|
||||
# Offset|Size
|
||||
# PcdOffsetCName|PcdSizeCName
|
||||
# RegionType <FV, DATA, or FILE>
|
||||
#
|
||||
################################################################################
|
||||
0x00000000|0x00460000
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashFvRecoveryBase|gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashFvRecoverySize
|
||||
FV = FvRecovery
|
||||
|
||||
0x00460000|0x0000c000
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
|
||||
#NV_VARIABLE_STORE
|
||||
DATA = {
|
||||
## This is the EFI_FIRMWARE_VOLUME_HEADER
|
||||
# ZeroVector []
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
# FileSystemGuid: gEfiSystemNvDataFvGuid =
|
||||
# { 0xFFF12B8D, 0x7696, 0x4C8B, { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }}
|
||||
0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C,
|
||||
0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50,
|
||||
# FvLength: 0x20000
|
||||
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
#Signature "_FVH" #Attributes
|
||||
0x5f, 0x46, 0x56, 0x48, 0xff, 0xfe, 0x04, 0x00,
|
||||
#HeaderLength #CheckSum #ExtHeaderOffset #Reserved #Revision
|
||||
0x48, 0x00, 0x36, 0x09, 0x00, 0x00, 0x00, 0x02,
|
||||
#Blockmap[0]: 2 Blocks * 0x10000 Bytes / Block
|
||||
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
|
||||
#Blockmap[1]: End
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
## This is the VARIABLE_STORE_HEADER
|
||||
!if $(SECURE_BOOT_ENABLE) == TRUE
|
||||
#Signature: gEfiAuthenticatedVariableGuid =
|
||||
# { 0xaaf32c78, 0x947b, 0x439a, { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 }}
|
||||
0x78, 0x2c, 0xf3, 0xaa, 0x7b, 0x94, 0x9a, 0x43,
|
||||
0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92,
|
||||
!else
|
||||
#Signature: gEfiVariableGuid =
|
||||
# { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d }}
|
||||
0x16, 0x36, 0xcf, 0xdd, 0x75, 0x32, 0x64, 0x41,
|
||||
0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d,
|
||||
!endif
|
||||
#Size: 0xc000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize) - 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) = 0xBFB8
|
||||
# This can speed up the Variable Dispatch a bit.
|
||||
0xB8, 0xBF, 0x00, 0x00,
|
||||
#FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32
|
||||
0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}
|
||||
|
||||
0x0046c000|0x00002000
|
||||
#NV_EVENT_LOG
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageEventLogBase|gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageEventLogSize
|
||||
|
||||
0x0046e000|0x00002000
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
|
||||
#NV_FTW_WORKING
|
||||
DATA = {
|
||||
# EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature = gEdkiiWorkingBlockSignatureGuid =
|
||||
# { 0x9e58292b, 0x7c68, 0x497d, { 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95 }}
|
||||
0x2b, 0x29, 0x58, 0x9e, 0x68, 0x7c, 0x7d, 0x49,
|
||||
0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95,
|
||||
# Crc:UINT32 #WorkingBlockValid:1, WorkingBlockInvalid:1, Reserved
|
||||
0xE2, 0x33, 0xF2, 0x03, 0xFE, 0xFF, 0xFF, 0xFF,
|
||||
# WriteQueueSize: UINT64
|
||||
0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}
|
||||
|
||||
0x00470000|0x00010000
|
||||
#NV_FTW_SPARE
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# FV Section
|
||||
#
|
||||
# [FV] section is used to define what components or modules are placed within a flash
|
||||
# device file. This section also defines order the components and modules are positioned
|
||||
# within the image. The [FV] section consists of define statements, set statements and
|
||||
# module statements.
|
||||
#
|
||||
################################################################################
|
||||
[FV.FvRecovery]
|
||||
FvAlignment = 16 #FV alignment and FV attributes setting.
|
||||
ERASE_POLARITY = 1
|
||||
MEMORY_MAPPED = TRUE
|
||||
STICKY_WRITE = TRUE
|
||||
LOCK_CAP = TRUE
|
||||
LOCK_STATUS = TRUE
|
||||
WRITE_DISABLED_CAP = TRUE
|
||||
WRITE_ENABLED_CAP = TRUE
|
||||
WRITE_STATUS = TRUE
|
||||
WRITE_LOCK_CAP = TRUE
|
||||
WRITE_LOCK_STATUS = TRUE
|
||||
READ_DISABLED_CAP = TRUE
|
||||
READ_ENABLED_CAP = TRUE
|
||||
READ_STATUS = TRUE
|
||||
READ_LOCK_CAP = TRUE
|
||||
READ_LOCK_STATUS = TRUE
|
||||
FvNameGuid = 6D99E806-3D38-42c2-A095-5F4300BFD7DC
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# The INF statements point to EDK component and EDK II module INF files, which will be placed into this FV image.
|
||||
# Parsing tools will scan the INF file to determine the type of component or module.
|
||||
# The component or module type is used to reference the standard rules
|
||||
# defined elsewhere in the FDF file.
|
||||
#
|
||||
# The format for INF statements is:
|
||||
# INF $(PathAndInfFileName)
|
||||
#
|
||||
################################################################################
|
||||
##
|
||||
# PEI Phase modules
|
||||
##
|
||||
##
|
||||
# PEI Apriori file example, more PEIM module added later.
|
||||
##
|
||||
APRIORI PEI {
|
||||
INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
|
||||
INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf
|
||||
INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
|
||||
INF Nt32Pkg/WinNtOemHookStatusCodeHandlerPei/WinNtOemHookStatusCodeHandlerPei.inf
|
||||
}
|
||||
APRIORI DXE {
|
||||
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
|
||||
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||
INF Nt32Pkg/MetronomeDxe/MetronomeDxe.inf
|
||||
INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
|
||||
INF Nt32Pkg/WinNtOemHookStatusCodeHandlerDxe/WinNtOemHookStatusCodeHandlerDxe.inf
|
||||
}
|
||||
|
||||
INF MdeModulePkg/Core/Pei/PeiMain.inf
|
||||
INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
|
||||
INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf
|
||||
INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
|
||||
INF Nt32Pkg/WinNtOemHookStatusCodeHandlerPei/WinNtOemHookStatusCodeHandlerPei.inf
|
||||
INF Nt32Pkg/BootModePei/BootModePei.inf
|
||||
INF Nt32Pkg/StallPei/StallPei.inf
|
||||
INF Nt32Pkg/WinNtFlashMapPei/WinNtFlashMapPei.inf
|
||||
INF Nt32Pkg/WinNtAutoScanPei/WinNtAutoScanPei.inf
|
||||
INF Nt32Pkg/WinNtFirmwareVolumePei/WinNtFirmwareVolumePei.inf
|
||||
|
||||
INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
|
||||
INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
||||
|
||||
INF Nt32Pkg/WinNtThunkPPIToProtocolPei/WinNtThunkPPIToProtocolPei.inf
|
||||
INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
|
||||
|
||||
##
|
||||
# DXE Phase modules
|
||||
##
|
||||
INF MdeModulePkg/Core/Dxe/DxeMain.inf
|
||||
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||
INF Nt32Pkg/MetronomeDxe/MetronomeDxe.inf
|
||||
INF Nt32Pkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
||||
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||
INF Nt32Pkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||
INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
||||
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||
INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
|
||||
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
|
||||
INF Nt32Pkg/WinNtThunkDxe/WinNtThunkDxe.inf
|
||||
INF Nt32Pkg/CpuRuntimeDxe/CpuRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
|
||||
INF MdeModulePkg/Application/UiApp/UiApp.inf
|
||||
INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
|
||||
INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
|
||||
INF Nt32Pkg/MiscSubClassPlatformDxe/MiscSubClassPlatformDxe.inf
|
||||
INF Nt32Pkg/TimerDxe/TimerDxe.inf
|
||||
INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
|
||||
INF Nt32Pkg/WinNtOemHookStatusCodeHandlerDxe/WinNtOemHookStatusCodeHandlerDxe.inf
|
||||
INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
|
||||
!if $(SECURE_BOOT_ENABLE) == TRUE
|
||||
INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
|
||||
!endif
|
||||
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||
INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
|
||||
INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
|
||||
INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
|
||||
INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
||||
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
|
||||
INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
||||
INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
||||
INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
|
||||
INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
|
||||
INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
|
||||
INF RuleOverride = TIANOCOMPRESSED MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
||||
INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
|
||||
INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
|
||||
INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
|
||||
INF IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
|
||||
INF Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriverDxe.inf
|
||||
INF Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIoDxe.inf
|
||||
INF Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIoDxe.inf
|
||||
INF Nt32Pkg/WinNtGopDxe/WinNtGopDxe.inf
|
||||
INF Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystemDxe.inf
|
||||
INF MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf
|
||||
INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
|
||||
|
||||
INF Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.inf
|
||||
!include NetworkPkg/Network.fdf.inc
|
||||
|
||||
INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
|
||||
################################################################################
|
||||
#
|
||||
# FILE statements are provided so that a platform integrator can include
|
||||
# complete EFI FFS files, as well as a method for constructing FFS files
|
||||
# using curly "{}" brace scoping. The following three FILEs are
|
||||
# for binary shell, binary fat and logo module.
|
||||
#
|
||||
################################################################################
|
||||
INF ShellPkg/Application/Shell/Shell.inf
|
||||
|
||||
INF FatPkg/EnhancedFatDxe/Fat.inf
|
||||
INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
|
||||
|
||||
INF MdeModulePkg/Logo/LogoDxe.inf
|
||||
INF MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.inf
|
||||
################################################################################
|
||||
#
|
||||
# Rules are use with the [FV] section's module INF type to define
|
||||
# how an FFS file is created for a given INF file. The following Rule are the default
|
||||
# rules for the different module type. User can add the customized rules to define the
|
||||
# content of the FFS file.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
|
||||
############################################################################
|
||||
# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
|
||||
############################################################################
|
||||
#
|
||||
#[Rule.Common.DXE_DRIVER]
|
||||
# FILE DRIVER = $(NAMED_GUID) {
|
||||
# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
|
||||
# COMPRESS PI_STD {
|
||||
# GUIDED {
|
||||
# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
# UI STRING="$(MODULE_NAME)" Optional
|
||||
# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#
|
||||
############################################################################
|
||||
|
||||
[Rule.Common.PEI_CORE]
|
||||
FILE PEI_CORE = $(NAMED_GUID) {
|
||||
PE32 PE32 Align=4K $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING ="$(MODULE_NAME)" Optional
|
||||
VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
|
||||
[Rule.Common.PEIM]
|
||||
FILE PEIM = $(NAMED_GUID) {
|
||||
PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
|
||||
PE32 PE32 Align=4K $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
|
||||
[Rule.Common.DXE_CORE]
|
||||
FILE DXE_CORE = $(NAMED_GUID) {
|
||||
COMPRESS PI_STD {
|
||||
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
}
|
||||
|
||||
[Rule.Common.UEFI_DRIVER]
|
||||
FILE DRIVER = $(NAMED_GUID) {
|
||||
DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
|
||||
COMPRESS PI_STD {
|
||||
GUIDED {
|
||||
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Rule.Common.UEFI_DRIVER.TIANOCOMPRESSED]
|
||||
FILE DRIVER = $(NAMED_GUID) {
|
||||
DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
|
||||
GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
|
||||
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
}
|
||||
|
||||
[Rule.Common.DXE_DRIVER]
|
||||
FILE DRIVER = $(NAMED_GUID) {
|
||||
DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
|
||||
COMPRESS PI_STD {
|
||||
GUIDED {
|
||||
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Rule.Common.DXE_RUNTIME_DRIVER]
|
||||
FILE DRIVER = $(NAMED_GUID) {
|
||||
DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
|
||||
COMPRESS PI_STD {
|
||||
GUIDED {
|
||||
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Rule.Common.UEFI_APPLICATION]
|
||||
FILE APPLICATION = $(NAMED_GUID) {
|
||||
COMPRESS PI_STD {
|
||||
GUIDED {
|
||||
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Rule.Common.UEFI_APPLICATION.BINARY]
|
||||
FILE APPLICATION = $(NAMED_GUID) {
|
||||
COMPRESS PI_STD {
|
||||
GUIDED {
|
||||
PE32 PE32 |.efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Rule.Common.UEFI_DRIVER.BINARY]
|
||||
FILE DRIVER = $(NAMED_GUID) {
|
||||
DXE_DEPEX DXE_DEPEX Optional |.depex
|
||||
COMPRESS PI_STD {
|
||||
GUIDED {
|
||||
PE32 PE32 |.efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,391 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
RealTimeClock.c
|
||||
|
||||
Abstract:
|
||||
|
||||
NT Emulation Architectural Protocol Driver as defined in Tiano
|
||||
|
||||
**/
|
||||
|
||||
#include <Uefi.h>
|
||||
#include <WinNtDxe.h>
|
||||
#include <Protocol/RealTimeClock.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/WinNtLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
|
||||
|
||||
BOOLEAN
|
||||
DayValid (
|
||||
IN EFI_TIME *Time
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
IsLeapYear (
|
||||
IN EFI_TIME *Time
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
RtcTimeFieldsValid (
|
||||
IN EFI_TIME *Time
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeRealTimeClock (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtGetTime (
|
||||
OUT EFI_TIME *Time,
|
||||
OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Service routine for RealTimeClockInstance->GetTime
|
||||
|
||||
Arguments:
|
||||
|
||||
Time - A pointer to storage that will receive a snapshot of the current time.
|
||||
|
||||
Capabilities - A pointer to storage that will receive the capabilities of the real time clock
|
||||
in the platform. This includes the real time clock's resolution and accuracy.
|
||||
All reported device capabilities are rounded up. This is an OPTIONAL argument.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - The underlying GetSystemTime call occurred and returned
|
||||
Note that in the NT32 emulation, the GetSystemTime call has no return value
|
||||
thus you will always receive a EFI_SUCCESS on this.
|
||||
|
||||
--*/
|
||||
// TODO: EFI_INVALID_PARAMETER - add return value to function comment
|
||||
{
|
||||
SYSTEMTIME SystemTime;
|
||||
TIME_ZONE_INFORMATION TimeZone;
|
||||
|
||||
//
|
||||
// Check parameter for null pointer
|
||||
//
|
||||
if (Time == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
||||
}
|
||||
|
||||
gWinNt->GetLocalTime (&SystemTime);
|
||||
gWinNt->GetTimeZoneInformation (&TimeZone);
|
||||
|
||||
Time->Year = (UINT16) SystemTime.wYear;
|
||||
Time->Month = (UINT8) SystemTime.wMonth;
|
||||
Time->Day = (UINT8) SystemTime.wDay;
|
||||
Time->Hour = (UINT8) SystemTime.wHour;
|
||||
Time->Minute = (UINT8) SystemTime.wMinute;
|
||||
Time->Second = (UINT8) SystemTime.wSecond;
|
||||
Time->Nanosecond = (UINT32) (SystemTime.wMilliseconds * 1000000);
|
||||
Time->TimeZone = (INT16) TimeZone.Bias;
|
||||
|
||||
if (Capabilities != NULL) {
|
||||
Capabilities->Resolution = 1;
|
||||
Capabilities->Accuracy = 50000000;
|
||||
Capabilities->SetsToZero = FALSE;
|
||||
}
|
||||
|
||||
Time->Daylight = 0;
|
||||
if (TimeZone.StandardDate.wMonth) {
|
||||
Time->Daylight = (UINT8) TimeZone.StandardDate.wMonth;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSetTime (
|
||||
IN EFI_TIME *Time
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Service routine for RealTimeClockInstance->SetTime
|
||||
|
||||
Arguments:
|
||||
|
||||
Time - A pointer to storage containing the time and date information to
|
||||
program into the real time clock.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - The operation completed successfully.
|
||||
|
||||
EFI_INVALID_PARAMETER - One of the fields in Time is out of range.
|
||||
|
||||
EFI_DEVICE_ERROR - The operation could not be complete due to a device error.
|
||||
|
||||
--*/
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
TIME_ZONE_INFORMATION TimeZone;
|
||||
EFI_STATUS Status;
|
||||
SYSTEMTIME SystemTime;
|
||||
BOOL Flag;
|
||||
|
||||
if (Time == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
//
|
||||
// Make sure that the time fields are valid
|
||||
//
|
||||
Status = RtcTimeFieldsValid (Time);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Set Daylight savings time information and Time Zone
|
||||
//
|
||||
gWinNt->GetTimeZoneInformation (&TimeZone);
|
||||
TimeZone.StandardDate.wMonth = Time->Daylight;
|
||||
TimeZone.Bias = Time->TimeZone;
|
||||
Flag = gWinNt->SetTimeZoneInformation (&TimeZone);
|
||||
if (!Flag) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
SystemTime.wYear = Time->Year;
|
||||
SystemTime.wMonth = Time->Month;
|
||||
SystemTime.wDay = Time->Day;
|
||||
SystemTime.wHour = Time->Hour;
|
||||
SystemTime.wMinute = Time->Minute;
|
||||
SystemTime.wSecond = Time->Second;
|
||||
SystemTime.wMilliseconds = (INT16) (Time->Nanosecond / 1000000);
|
||||
|
||||
Flag = gWinNt->SetLocalTime (&SystemTime);
|
||||
|
||||
if (!Flag) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
} else {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtGetWakeupTime (
|
||||
OUT BOOLEAN *Enabled,
|
||||
OUT BOOLEAN *Pending,
|
||||
OUT EFI_TIME *Time
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Service routine for RealTimeClockInstance->GetWakeupTime
|
||||
|
||||
Arguments:
|
||||
This - Indicates the protocol instance structure.
|
||||
|
||||
Enabled - Indicates if the alarm is currently enabled or disabled.
|
||||
|
||||
Pending - Indicates if the alarm signal is pending and requires
|
||||
acknowledgement.
|
||||
|
||||
Time - The current alarm setting.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - The operation completed successfully.
|
||||
|
||||
EFI_DEVICE_ERROR - The operation could not be complete due to a device error.
|
||||
|
||||
EFI_UNSUPPORTED - The operation is not supported on this platform.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSetWakeupTime (
|
||||
IN BOOLEAN Enable,
|
||||
OUT EFI_TIME *Time
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Service routine for RealTimeClockInstance->SetWakeupTime
|
||||
|
||||
Arguments:
|
||||
|
||||
Enabled - Enable or disable the wakeup alarm.
|
||||
|
||||
Time - If enable is TRUE, the time to set the wakup alarm for.
|
||||
If enable is FALSE, then this parameter is optional, and
|
||||
may be NULL.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - The operation completed successfully.
|
||||
|
||||
EFI_DEVICE_ERROR - The operation could not be complete due to a device error.
|
||||
|
||||
EFI_INVALID_PARAMETER - A field in Time is out of range.
|
||||
|
||||
EFI_UNSUPPORTED - The operation is not supported on this platform.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeRealTimeClock (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Install Real Time Clock Protocol
|
||||
|
||||
Arguments:
|
||||
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - Real Time Clock Services are installed into the Runtime Services Table
|
||||
|
||||
--*/
|
||||
// TODO: ImageHandle - add argument and description to function comment
|
||||
// TODO: SystemTable - add argument and description to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
|
||||
SystemTable->RuntimeServices->GetTime = WinNtGetTime;
|
||||
SystemTable->RuntimeServices->SetTime = WinNtSetTime;
|
||||
SystemTable->RuntimeServices->GetWakeupTime = WinNtGetWakeupTime;
|
||||
SystemTable->RuntimeServices->SetWakeupTime = WinNtSetWakeupTime;
|
||||
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Handle,
|
||||
&gEfiRealTimeClockArchProtocolGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
RtcTimeFieldsValid (
|
||||
IN EFI_TIME *Time
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
--*/
|
||||
// TODO: Time - add argument and description to function comment
|
||||
// TODO: EFI_INVALID_PARAMETER - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
if (Time->Year < 1998 ||
|
||||
Time->Year > 2099 ||
|
||||
Time->Month < 1 ||
|
||||
Time->Month > 12 ||
|
||||
(!DayValid (Time)) ||
|
||||
Time->Hour > 23 ||
|
||||
Time->Minute > 59 ||
|
||||
Time->Second > 59 ||
|
||||
Time->Nanosecond > 999999999 ||
|
||||
(!(Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE || (Time->TimeZone >= -1440 && Time->TimeZone <= 1440))) ||
|
||||
(Time->Daylight & (~(EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT)))
|
||||
) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
DayValid (
|
||||
IN EFI_TIME *Time
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Time - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
{
|
||||
|
||||
INTN DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
|
||||
if (Time->Day < 1 ||
|
||||
Time->Day > DayOfMonth[Time->Month - 1] ||
|
||||
(Time->Month == 2 && (!IsLeapYear (Time) && Time->Day > 28))
|
||||
) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsLeapYear (
|
||||
IN EFI_TIME *Time
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Time - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
{
|
||||
if (Time->Year % 4 == 0) {
|
||||
if (Time->Year % 100 == 0) {
|
||||
if (Time->Year % 400 == 0) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
return TRUE;
|
||||
}
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
## @file
|
||||
# NT Emulation Real time clock Architectural Protocol Driver as defined in TIANO
|
||||
#
|
||||
# This real time clock module simulates virtual device by time WinAPI.
|
||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = RealTimeClock
|
||||
FILE_GUID = 27F05AF5-1644-4EF4-8944-48C4F75675A0
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = InitializeRealTimeClock
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
|
||||
[Sources]
|
||||
RealTimeClock.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
UefiBootServicesTableLib
|
||||
WinNtLib
|
||||
UefiDriverEntryPoint
|
||||
DebugLib
|
||||
|
||||
[Protocols]
|
||||
gEfiRealTimeClockArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||
|
||||
[depex]
|
||||
TRUE
|
||||
|
|
@ -1,308 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
FwVol.c
|
||||
|
||||
Abstract:
|
||||
A simple FV stack so the SEC can extract the SEC Core from an
|
||||
FV.
|
||||
|
||||
**/
|
||||
|
||||
#include "SecMain.h"
|
||||
|
||||
#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
|
||||
(ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))
|
||||
|
||||
EFI_FFS_FILE_STATE
|
||||
GetFileState (
|
||||
IN UINT8 ErasePolarity,
|
||||
IN EFI_FFS_FILE_HEADER *FfsHeader
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Returns the highest bit set of the State field
|
||||
|
||||
Arguments:
|
||||
ErasePolarity - Erase Polarity as defined by EFI_FVB_ERASE_POLARITY
|
||||
in the Attributes field.
|
||||
FfsHeader - Pointer to FFS File Header.
|
||||
|
||||
Returns:
|
||||
Returns the highest bit in the State field
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_FFS_FILE_STATE FileState;
|
||||
EFI_FFS_FILE_STATE HighestBit;
|
||||
|
||||
FileState = FfsHeader->State;
|
||||
|
||||
if (ErasePolarity != 0) {
|
||||
FileState = (EFI_FFS_FILE_STATE)~FileState;
|
||||
}
|
||||
|
||||
HighestBit = 0x80;
|
||||
while (HighestBit != 0 && (HighestBit & FileState) == 0) {
|
||||
HighestBit >>= 1;
|
||||
}
|
||||
|
||||
return HighestBit;
|
||||
}
|
||||
|
||||
UINT8
|
||||
CalculateHeaderChecksum (
|
||||
IN EFI_FFS_FILE_HEADER *FileHeader
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Calculates the checksum of the header of a file.
|
||||
|
||||
Arguments:
|
||||
FileHeader - Pointer to FFS File Header.
|
||||
|
||||
Returns:
|
||||
Checksum of the header.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT8 *ptr;
|
||||
UINTN Index;
|
||||
UINT8 Sum;
|
||||
|
||||
Sum = 0;
|
||||
ptr = (UINT8 *) FileHeader;
|
||||
|
||||
for (Index = 0; Index < sizeof (EFI_FFS_FILE_HEADER) - 3; Index += 4) {
|
||||
Sum = (UINT8) (Sum + ptr[Index]);
|
||||
Sum = (UINT8) (Sum + ptr[Index + 1]);
|
||||
Sum = (UINT8) (Sum + ptr[Index + 2]);
|
||||
Sum = (UINT8) (Sum + ptr[Index + 3]);
|
||||
}
|
||||
|
||||
for (; Index < sizeof (EFI_FFS_FILE_HEADER); Index++) {
|
||||
Sum = (UINT8) (Sum + ptr[Index]);
|
||||
}
|
||||
//
|
||||
// State field (since this indicates the different state of file).
|
||||
//
|
||||
Sum = (UINT8) (Sum - FileHeader->State);
|
||||
//
|
||||
// Checksum field of the file is not part of the header checksum.
|
||||
//
|
||||
Sum = (UINT8) (Sum - FileHeader->IntegrityCheck.Checksum.File);
|
||||
|
||||
return Sum;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
SecFfsFindNextFile (
|
||||
IN EFI_FV_FILETYPE SearchType,
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
IN OUT EFI_FFS_FILE_HEADER **FileHeader
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Given the input file pointer, search for the next matching file in the
|
||||
FFS volume as defined by SearchType. The search starts from FileHeader inside
|
||||
the Firmware Volume defined by FwVolHeader.
|
||||
|
||||
Arguments:
|
||||
SearchType - Filter to find only files of this type.
|
||||
Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
|
||||
FwVolHeader - Pointer to the FV header of the volume to search.
|
||||
This parameter must point to a valid FFS volume.
|
||||
FileHeader - Pointer to the current file from which to begin searching.
|
||||
This pointer will be updated upon return to reflect the file
|
||||
found.
|
||||
|
||||
Returns:
|
||||
EFI_NOT_FOUND - No files matching the search criteria were found
|
||||
EFI_SUCCESS
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_FFS_FILE_HEADER *FfsFileHeader;
|
||||
UINT32 FileLength;
|
||||
UINT32 FileOccupiedSize;
|
||||
UINT32 FileOffset;
|
||||
UINT64 FvLength;
|
||||
UINT8 ErasePolarity;
|
||||
UINT8 FileState;
|
||||
|
||||
FvLength = FwVolHeader->FvLength;
|
||||
if (FwVolHeader->Attributes & EFI_FVB2_ERASE_POLARITY) {
|
||||
ErasePolarity = 1;
|
||||
} else {
|
||||
ErasePolarity = 0;
|
||||
}
|
||||
//
|
||||
// If FileHeader is not specified (NULL) start with the first file in the
|
||||
// firmware volume. Otherwise, start from the FileHeader.
|
||||
//
|
||||
if (*FileHeader == NULL) {
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FwVolHeader + FwVolHeader->HeaderLength);
|
||||
} else {
|
||||
//
|
||||
// Length is 24 bits wide so mask upper 8 bits
|
||||
// FileLength is adjusted to FileOccupiedSize as it is 8 byte aligned.
|
||||
//
|
||||
FileLength = *(UINT32 *) (*FileHeader)->Size & 0x00FFFFFF;
|
||||
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) *FileHeader + FileOccupiedSize);
|
||||
}
|
||||
|
||||
FileOffset = (UINT32) ((UINT8 *) FfsFileHeader - (UINT8 *) FwVolHeader);
|
||||
|
||||
while (FileOffset < (FvLength - sizeof (EFI_FFS_FILE_HEADER))) {
|
||||
//
|
||||
// Get FileState which is the highest bit of the State
|
||||
//
|
||||
FileState = GetFileState (ErasePolarity, FfsFileHeader);
|
||||
|
||||
switch (FileState) {
|
||||
|
||||
case EFI_FILE_HEADER_INVALID:
|
||||
FileOffset += sizeof (EFI_FFS_FILE_HEADER);
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + sizeof (EFI_FFS_FILE_HEADER));
|
||||
break;
|
||||
|
||||
case EFI_FILE_DATA_VALID:
|
||||
case EFI_FILE_MARKED_FOR_UPDATE:
|
||||
if (CalculateHeaderChecksum (FfsFileHeader) == 0) {
|
||||
FileLength = *(UINT32 *) (FfsFileHeader->Size) & 0x00FFFFFF;
|
||||
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
|
||||
|
||||
if ((SearchType == FfsFileHeader->Type) || (SearchType == EFI_FV_FILETYPE_ALL)) {
|
||||
|
||||
*FileHeader = FfsFileHeader;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
FileOffset += FileOccupiedSize;
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + FileOccupiedSize);
|
||||
} else {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_FILE_DELETED:
|
||||
FileLength = *(UINT32 *) (FfsFileHeader->Size) & 0x00FFFFFF;
|
||||
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
|
||||
FileOffset += FileOccupiedSize;
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + FileOccupiedSize);
|
||||
break;
|
||||
|
||||
default:
|
||||
return EFI_NOT_FOUND;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
SecFfsFindSectionData (
|
||||
IN EFI_SECTION_TYPE SectionType,
|
||||
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
|
||||
IN OUT VOID **SectionData
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Given the input file pointer, search for the next matching section in the
|
||||
FFS volume.
|
||||
|
||||
Arguments:
|
||||
SearchType - Filter to find only sections of this type.
|
||||
FfsFileHeader - Pointer to the current file to search.
|
||||
SectionData - Pointer to the Section matching SectionType in FfsFileHeader.
|
||||
NULL if section not found
|
||||
|
||||
Returns:
|
||||
EFI_NOT_FOUND - No files matching the search criteria were found
|
||||
EFI_SUCCESS
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT32 FileSize;
|
||||
EFI_COMMON_SECTION_HEADER *Section;
|
||||
UINT32 SectionLength;
|
||||
UINT32 ParsedLength;
|
||||
|
||||
//
|
||||
// Size is 24 bits wide so mask upper 8 bits.
|
||||
// Does not include FfsFileHeader header size
|
||||
// FileSize is adjusted to FileOccupiedSize as it is 8 byte aligned.
|
||||
//
|
||||
Section = (EFI_COMMON_SECTION_HEADER *) (FfsFileHeader + 1);
|
||||
FileSize = *(UINT32 *) (FfsFileHeader->Size) & 0x00FFFFFF;
|
||||
FileSize -= sizeof (EFI_FFS_FILE_HEADER);
|
||||
|
||||
*SectionData = NULL;
|
||||
ParsedLength = 0;
|
||||
while (ParsedLength < FileSize) {
|
||||
if (Section->Type == SectionType) {
|
||||
*SectionData = (VOID *) (Section + 1);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
//
|
||||
// Size is 24 bits wide so mask upper 8 bits.
|
||||
// SectionLength is adjusted it is 4 byte aligned.
|
||||
// Go to the next section
|
||||
//
|
||||
SectionLength = *(UINT32 *) Section->Size & 0x00FFFFFF;
|
||||
SectionLength = GET_OCCUPIED_SIZE (SectionLength, 4);
|
||||
|
||||
ParsedLength += SectionLength;
|
||||
Section = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) Section + SectionLength);
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
SecFfsFindPeiCore (
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
OUT VOID **Pe32Data
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Given the pointer to the Firmware Volume Header find the SEC
|
||||
core and return it's PE32 image.
|
||||
|
||||
Arguments:
|
||||
FwVolHeader - Pointer to memory mapped FV
|
||||
Pe32Data - Pointer to SEC PE32 iamge.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Pe32Data is valid
|
||||
other - Failure
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_FFS_FILE_HEADER *FileHeader;
|
||||
EFI_FV_FILETYPE SearchType;
|
||||
|
||||
SearchType = EFI_FV_FILETYPE_PEI_CORE;
|
||||
FileHeader = NULL;
|
||||
do {
|
||||
Status = SecFfsFindNextFile (SearchType, FwVolHeader, &FileHeader);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = SecFfsFindSectionData (EFI_SECTION_PE32, FileHeader, Pe32Data);
|
||||
return Status;
|
||||
}
|
||||
} while (!EFI_ERROR (Status));
|
||||
|
||||
return Status;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,553 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
|
||||
Module Name:
|
||||
SecMain.h
|
||||
|
||||
Abstract:
|
||||
Include file for Windows API based SEC
|
||||
|
||||
**/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <PiPei.h>
|
||||
#include <WinNtPeim.h>
|
||||
#include <Guid/StatusCodeDataTypeDebug.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/PeCoffLib.h>
|
||||
#include <Ppi/NtPeiLoadFile.h>
|
||||
#include <Ppi/NtAutoscan.h>
|
||||
#include <Ppi/NtThunk.h>
|
||||
#include <Ppi/StatusCode.h>
|
||||
#include <Ppi/NtFwh.h>
|
||||
#include <Ppi/TemporaryRamSupport.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
|
||||
#include <IndustryStandard/PeImage.h>
|
||||
|
||||
#define STACK_SIZE 0x20000
|
||||
|
||||
typedef struct {
|
||||
EFI_PHYSICAL_ADDRESS Address;
|
||||
UINT64 Size;
|
||||
} NT_FD_INFO;
|
||||
|
||||
typedef struct {
|
||||
EFI_PHYSICAL_ADDRESS Memory;
|
||||
UINT64 Size;
|
||||
} NT_SYSTEM_MEMORY;
|
||||
|
||||
#define MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE 0x100
|
||||
|
||||
typedef struct {
|
||||
CHAR8 *PdbPointer;
|
||||
VOID *ModHandle;
|
||||
} PDB_NAME_TO_MOD_HANDLE;
|
||||
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecWinNtPeiLoadFile (
|
||||
VOID *Pe32Data, // TODO: add IN/OUT modifier to Pe32Data
|
||||
EFI_PHYSICAL_ADDRESS *ImageAddress, // TODO: add IN/OUT modifier to ImageAddress
|
||||
UINT64 *ImageSize, // TODO: add IN/OUT modifier to ImageSize
|
||||
EFI_PHYSICAL_ADDRESS *EntryPoint // TODO: add IN/OUT modifier to EntryPoint
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Pe32Data - TODO: add argument description
|
||||
ImageAddress - TODO: add argument description
|
||||
ImageSize - TODO: add argument description
|
||||
EntryPoint - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecWinNtPeiAutoScan (
|
||||
IN UINTN Index,
|
||||
OUT EFI_PHYSICAL_ADDRESS *MemoryBase,
|
||||
OUT UINT64 *MemorySize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Index - TODO: add argument description
|
||||
MemoryBase - TODO: add argument description
|
||||
MemorySize - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
VOID *
|
||||
EFIAPI
|
||||
SecWinNtWinNtThunkAddress (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
InterfaceSize - TODO: add argument description
|
||||
InterfaceBase - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecWinNtWinNtFwhAddress (
|
||||
IN OUT UINT64 *FwhSize,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *FwhBase
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
FwhSize - TODO: add argument description
|
||||
FwhBase - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecPeiReportStatusCode (
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices,
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
IN UINT32 Instance,
|
||||
IN CONST EFI_GUID * CallerId,
|
||||
IN CONST EFI_STATUS_CODE_DATA * Data OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PeiServices - TODO: add argument description
|
||||
CodeType - TODO: add argument description
|
||||
Value - TODO: add argument description
|
||||
Instance - TODO: add argument description
|
||||
CallerId - TODO: add argument description
|
||||
Data - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
INTN
|
||||
EFIAPI
|
||||
main (
|
||||
IN INTN Argc,
|
||||
IN CHAR8 **Argv,
|
||||
IN CHAR8 **Envp
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Argc - TODO: add argument description
|
||||
Argv - TODO: add argument description
|
||||
Envp - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
WinNtOpenFile (
|
||||
CHAR16 *FileName,
|
||||
UINT32 MapSize,
|
||||
DWORD CreationDispostion,
|
||||
EFI_PHYSICAL_ADDRESS *BaseAddress,
|
||||
UINT64 *Length
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
FileName - TODO: add argument description
|
||||
MapSize - TODO: add argument description
|
||||
CreationDispostion - TODO: add argument description
|
||||
BaseAddress - TODO: add argument description
|
||||
Length - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
VOID
|
||||
SecLoadFromCore (
|
||||
IN UINTN LargestRegion,
|
||||
IN UINTN LargestRegionSize,
|
||||
IN UINTN BootFirmwareVolumeBase,
|
||||
IN VOID *PeiCoreFile
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
LargestRegion - TODO: add argument description
|
||||
LargestRegionSize - TODO: add argument description
|
||||
BootFirmwareVolumeBase - TODO: add argument description
|
||||
PeiCoreFile - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SecLoadFile (
|
||||
IN VOID *Pe32Data,
|
||||
IN EFI_PHYSICAL_ADDRESS *ImageAddress,
|
||||
IN UINT64 *ImageSize,
|
||||
IN EFI_PHYSICAL_ADDRESS *EntryPoint
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Pe32Data - TODO: add argument description
|
||||
ImageAddress - TODO: add argument description
|
||||
ImageSize - TODO: add argument description
|
||||
EntryPoint - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SecFfsFindPeiCore (
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
OUT VOID **Pe32Data
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
FwVolHeader - TODO: add argument description
|
||||
Pe32Data - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SecFfsFindNextFile (
|
||||
IN EFI_FV_FILETYPE SearchType,
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
IN OUT EFI_FFS_FILE_HEADER **FileHeader
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
SearchType - TODO: add argument description
|
||||
FwVolHeader - TODO: add argument description
|
||||
FileHeader - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SecFfsFindSectionData (
|
||||
IN EFI_SECTION_TYPE SectionType,
|
||||
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
|
||||
IN OUT VOID **SectionData
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
SectionType - TODO: add argument description
|
||||
FfsFileHeader - TODO: add argument description
|
||||
SectionData - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecWinNtPeCoffLoaderLoadAsDll (
|
||||
IN CHAR8 *PdbFileName,
|
||||
IN VOID **ImageEntryPoint,
|
||||
OUT VOID **ModHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PdbFileName - TODO: add argument description
|
||||
ImageEntryPoint - TODO: add argument description
|
||||
ModHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecWinNtPeCoffLoaderFreeLibrary (
|
||||
OUT VOID *ModHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ModHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecWinNtFdAddress (
|
||||
IN UINTN Index,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *FdBase,
|
||||
IN OUT UINT64 *FdSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Index - TODO: add argument description
|
||||
FdBase - TODO: add argument description
|
||||
FdSize - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetImageReadFunction (
|
||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
|
||||
IN EFI_PHYSICAL_ADDRESS *TopOfMemory
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageContext - TODO: add argument description
|
||||
TopOfMemory - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecImageRead (
|
||||
IN VOID *FileHandle,
|
||||
IN UINTN FileOffset,
|
||||
IN OUT UINTN *ReadSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
FileHandle - TODO: add argument description
|
||||
FileOffset - TODO: add argument description
|
||||
ReadSize - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
CHAR16 *
|
||||
AsciiToUnicode (
|
||||
IN CHAR8 *Ascii,
|
||||
IN UINTN *StrLen OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Ascii - TODO: add argument description
|
||||
StrLen - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
UINTN
|
||||
CountSeparatorsInString (
|
||||
IN CONST CHAR16 *String,
|
||||
IN CHAR16 Separator
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
String - TODO: add argument description
|
||||
Separator - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecTemporaryRamSupport (
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices,
|
||||
IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
|
||||
IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
|
||||
IN UINTN CopySize
|
||||
);
|
||||
|
||||
|
||||
extern EFI_WIN_NT_THUNK_PROTOCOL *gWinNt;
|
|
@ -1,88 +0,0 @@
|
|||
## @file
|
||||
# Entry Point of NT32 Emulator
|
||||
#
|
||||
# Main executable file of NT32 Emulator that loads PEI core after initialization finished.
|
||||
#
|
||||
# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = SecMain
|
||||
FILE_GUID = 4b837b03-6587-4d19-b82b-edfad836c0a0
|
||||
MODULE_TYPE = USER_DEFINED
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
|
||||
[Sources]
|
||||
SecMain.h
|
||||
WinNtThunk.c
|
||||
FwVol.c
|
||||
SecMain.c
|
||||
|
||||
[Sources.ia32]
|
||||
Stack.asm
|
||||
|
||||
[Sources.x64]
|
||||
StackX64.asm
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
PcdLib
|
||||
PrintLib
|
||||
BaseMemoryLib
|
||||
BaseLib
|
||||
PeCoffLib
|
||||
ReportStatusCodeLib
|
||||
|
||||
[Ppis]
|
||||
gNtPeiLoadFilePpiGuid # PPI ALWAYS_PRODUCED
|
||||
gEfiPeiStatusCodePpiGuid # PPI ALWAYS_PRODUCED
|
||||
gNtFwhPpiGuid # PPI ALWAYS_PRODUCED
|
||||
gPeiNtAutoScanPpiGuid # PPI ALWAYS_PRODUCED
|
||||
gPeiNtThunkPpiGuid # PPI ALWAYS_PRODUCED
|
||||
gEfiTemporaryRamSupportPpiGuid
|
||||
|
||||
[Pcd]
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtBootMode
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareFdSize
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtMemorySizeForSecMain
|
||||
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareVolume
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdInitValueInTempStack
|
||||
|
||||
[BuildOptions]
|
||||
MSFT:*_*_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
|
||||
MSFT:*_VS2015_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
|
||||
MSFT:*_VS2015x86_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
|
||||
MSFT:*_VS2017_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"%VCToolsInstallDir%lib\x86" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
|
||||
MSFT:*_*_IA32_CC_FLAGS == /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE
|
||||
MSFT:*_*_IA32_PP_FLAGS == /nologo /E /TC /FIAutoGen.h
|
||||
MSFT:*_*_IA32_ASM_FLAGS == /nologo /W3 /WX /c /coff /Cx /Zd /W0 /Zi
|
||||
MSFT:*_*_IA32_ASMLINK_FLAGS == /link /nologo /tiny
|
||||
|
||||
MSFT:*_*_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
|
||||
MSFT:*_VS2015_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
|
||||
MSFT:*_VS2015x86_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
|
||||
MSFT:*_VS2017_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"%VCToolsInstallDir%lib\x64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
|
||||
MSFT:*_*_X64_CC_FLAGS == /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE
|
||||
MSFT:*_*_X64_PP_FLAGS == /nologo /E /TC /FIAutoGen.h
|
||||
MSFT:*_*_X64_ASM_FLAGS == /nologo /W3 /WX /c /Cx /Zd /W0 /Zi
|
||||
MSFT:*_*_X64_ASMLINK_FLAGS == /link /nologo
|
||||
|
||||
INTEL:*_*_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x10000000 /pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"C:\Program Files\Intel\Compiler\C++\9.1\IA32\Lib" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib
|
||||
INTEL:*_*_IA32_CC_FLAGS == /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE
|
||||
INTEL:*_*_IA32_PP_FLAGS == /nologo /E /TC /FIAutoGen.h
|
||||
INTEL:*_*_IA32_ASM_FLAGS == /nologo /W3 /WX /c /coff /Cx /Zd /W0 /Zi
|
||||
INTEL:*_*_IA32_ASMLINK_FLAGS == /link /nologo /tiny
|
|
@ -1,88 +0,0 @@
|
|||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
|
||||
; SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
;
|
||||
; Module Name:
|
||||
;
|
||||
; Stack.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; Switch the stack from temporary memory to permenent memory.
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.586p
|
||||
.model flat,C
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EFIAPI
|
||||
; SecSwitchStack (
|
||||
; UINT32 TemporaryMemoryBase,
|
||||
; UINT32 PermenentMemoryBase
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
SecSwitchStack PROC
|
||||
;
|
||||
; Save three register: eax, ebx, ecx
|
||||
;
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
|
||||
;
|
||||
; !!CAUTION!! this function address's is pushed into stack after
|
||||
; migration of whole temporary memory, so need save it to permenent
|
||||
; memory at first!
|
||||
;
|
||||
|
||||
mov ebx, [esp + 20] ; Save the first parameter
|
||||
mov ecx, [esp + 24] ; Save the second parameter
|
||||
|
||||
;
|
||||
; Save this function's return address into permenent memory at first.
|
||||
; Then, Fixup the esp point to permenent memory
|
||||
;
|
||||
mov eax, esp
|
||||
sub eax, ebx
|
||||
add eax, ecx
|
||||
mov edx, dword ptr [esp] ; copy pushed register's value to permenent memory
|
||||
mov dword ptr [eax], edx
|
||||
mov edx, dword ptr [esp + 4]
|
||||
mov dword ptr [eax + 4], edx
|
||||
mov edx, dword ptr [esp + 8]
|
||||
mov dword ptr [eax + 8], edx
|
||||
mov edx, dword ptr [esp + 12]
|
||||
mov dword ptr [eax + 12], edx
|
||||
mov edx, dword ptr [esp + 16] ; Update this function's return address into permenent memory
|
||||
mov dword ptr [eax + 16], edx
|
||||
mov esp, eax ; From now, esp is pointed to permenent memory
|
||||
|
||||
;
|
||||
; Fixup the ebp point to permenent memory
|
||||
;
|
||||
mov eax, ebp
|
||||
sub eax, ebx
|
||||
add eax, ecx
|
||||
mov ebp, eax ; From now, ebp is pointed to permenent memory
|
||||
|
||||
;
|
||||
; Fixup callee's ebp point for PeiDispatch
|
||||
;
|
||||
mov eax, dword ptr [ebp]
|
||||
sub eax, ebx
|
||||
add eax, ecx
|
||||
mov dword ptr [ebp], eax ; From now, Temporary's PPI caller's stack is in permenent memory
|
||||
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
ret
|
||||
SecSwitchStack ENDP
|
||||
|
||||
END
|
|
@ -1,104 +0,0 @@
|
|||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
|
||||
; SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
;
|
||||
; Module Name:
|
||||
;
|
||||
; Stack.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; Switch the stack from temporary memory to permenent memory.
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EFIAPI
|
||||
; SecSwitchStack (
|
||||
; UINT32 TemporaryMemoryBase,
|
||||
; UINT32 PermenentMemoryBase
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
SecSwitchStack PROC
|
||||
mov [rsp + 08h], rcx
|
||||
mov [rsp + 10h], rdx
|
||||
|
||||
;
|
||||
; Save three register: eax, ebx, ecx
|
||||
;
|
||||
push rax
|
||||
push rbx
|
||||
push rcx
|
||||
push rdx
|
||||
|
||||
;
|
||||
; !!CAUTION!! this function address's is pushed into stack after
|
||||
; migration of whole temporary memory, so need save it to permenent
|
||||
; memory at first!
|
||||
;
|
||||
|
||||
mov rbx, [rsp + 28h] ; Save the first parameter
|
||||
mov rcx, [rsp + 30h] ; Save the second parameter
|
||||
|
||||
;
|
||||
; Save this function's return address into permenent memory at first.
|
||||
; Then, Fixup the esp point to permenent memory
|
||||
;
|
||||
mov rax, rsp
|
||||
sub rax, rbx
|
||||
add rax, rcx
|
||||
mov rdx, qword ptr [rsp] ; copy pushed register's value to permenent memory
|
||||
mov qword ptr [rax], rdx
|
||||
mov rdx, qword ptr [rsp + 8]
|
||||
mov qword ptr [rax + 8], rdx
|
||||
mov rdx, qword ptr [rsp + 10h]
|
||||
mov qword ptr [rax + 10h], rdx
|
||||
mov rdx, qword ptr [rsp + 18h]
|
||||
mov qword ptr [rax + 18h], rdx
|
||||
mov rdx, qword ptr [rsp + 20h] ; Update this function's return address into permenent memory
|
||||
mov qword ptr [rax + 20h], rdx
|
||||
mov rsp, rax ; From now, esp is pointed to permenent memory
|
||||
|
||||
;
|
||||
; Fixup the ebp point to permenent memory
|
||||
;
|
||||
mov rax, rbp
|
||||
sub rax, rbx
|
||||
add rax, rcx
|
||||
mov rbp, rax ; From now, ebp is pointed to permenent memory
|
||||
|
||||
pop rdx
|
||||
pop rcx
|
||||
pop rbx
|
||||
pop rax
|
||||
ret
|
||||
SecSwitchStack ENDP
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EFIAPI
|
||||
; PeiSwitchStacks (
|
||||
; IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||
; IN VOID *Context1, OPTIONAL
|
||||
; IN VOID *Context2, OPTIONAL
|
||||
; IN VOID *Context3, OPTIONAL
|
||||
; IN VOID *NewStack
|
||||
; )
|
||||
;------------------------------------------------------------------------------
|
||||
PeiSwitchStacks PROC
|
||||
mov rax, rcx
|
||||
mov rcx, rdx
|
||||
mov rdx, r8
|
||||
mov r8, r9
|
||||
mov rsp, [rsp + 28h]
|
||||
sub rsp, 20h
|
||||
call rax
|
||||
jmp $
|
||||
ret
|
||||
PeiSwitchStacks ENDP
|
||||
|
||||
END
|
|
@ -1,181 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
WinNtThunk.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Since the SEC is the only windows program in our emulation we
|
||||
must use a Tiano mechanism to export Win32 APIs to other modules.
|
||||
This is the role of the EFI_WIN_NT_THUNK_PROTOCOL.
|
||||
|
||||
The mWinNtThunkTable exists so that a change to EFI_WIN_NT_THUNK_PROTOCOL
|
||||
will cause an error in initializing the array if all the member functions
|
||||
are not added. It looks like adding a element to end and not initializing
|
||||
it may cause the table to be initaliized with the members at the end being
|
||||
set to zero. This is bad as jumping to zero will case the NT32 to crash.
|
||||
|
||||
All the member functions in mWinNtThunkTable are Win32
|
||||
API calls, so please reference Microsoft documentation.
|
||||
|
||||
|
||||
gWinNt is a a public exported global that contains the initialized
|
||||
data.
|
||||
|
||||
**/
|
||||
|
||||
#include "SecMain.h"
|
||||
|
||||
//
|
||||
// This pragma is needed for all the DLL entry points to be asigned to the array.
|
||||
// if warning 4232 is not dissabled a warning will be generated as a DLL entry
|
||||
// point could be modified dynamically. The SEC does not do that, so we must
|
||||
// disable the warning so we can compile the SEC. The previous method was to
|
||||
// asign each element in code. The disadvantage to that approach is it's harder
|
||||
// to tell if all the elements have been initialized properly.
|
||||
//
|
||||
#pragma warning(disable : 4232)
|
||||
#pragma warning(disable : 4996)
|
||||
|
||||
#if __INTEL_COMPILER
|
||||
#pragma warning ( disable : 144 )
|
||||
#endif
|
||||
|
||||
EFI_WIN_NT_THUNK_PROTOCOL mWinNtThunkTable = {
|
||||
EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE,
|
||||
GetProcAddress,
|
||||
GetTickCount,
|
||||
LoadLibraryEx,
|
||||
FreeLibrary,
|
||||
SetPriorityClass,
|
||||
SetThreadPriority,
|
||||
Sleep,
|
||||
SuspendThread,
|
||||
GetCurrentThread,
|
||||
GetCurrentThreadId,
|
||||
GetCurrentProcess,
|
||||
CreateThread,
|
||||
TerminateThread,
|
||||
SendMessage,
|
||||
ExitThread,
|
||||
ResumeThread,
|
||||
DuplicateHandle,
|
||||
InitializeCriticalSection,
|
||||
EnterCriticalSection,
|
||||
LeaveCriticalSection,
|
||||
DeleteCriticalSection,
|
||||
TlsAlloc,
|
||||
TlsFree,
|
||||
TlsSetValue,
|
||||
TlsGetValue,
|
||||
CreateSemaphore,
|
||||
WaitForSingleObject,
|
||||
ReleaseSemaphore,
|
||||
CreateConsoleScreenBuffer,
|
||||
FillConsoleOutputAttribute,
|
||||
FillConsoleOutputCharacter,
|
||||
GetConsoleCursorInfo,
|
||||
GetNumberOfConsoleInputEvents,
|
||||
PeekConsoleInput,
|
||||
ScrollConsoleScreenBuffer,
|
||||
ReadConsoleInput,
|
||||
SetConsoleActiveScreenBuffer,
|
||||
SetConsoleCursorInfo,
|
||||
SetConsoleCursorPosition,
|
||||
SetConsoleScreenBufferSize,
|
||||
SetConsoleTitleW,
|
||||
WriteConsoleInput,
|
||||
WriteConsoleOutput,
|
||||
CreateFile,
|
||||
DeviceIoControl,
|
||||
CreateDirectory,
|
||||
RemoveDirectory,
|
||||
GetFileAttributes,
|
||||
SetFileAttributes,
|
||||
CreateFileMapping,
|
||||
CloseHandle,
|
||||
DeleteFile,
|
||||
FindFirstFile,
|
||||
FindNextFile,
|
||||
FindClose,
|
||||
FlushFileBuffers,
|
||||
GetEnvironmentVariable,
|
||||
GetLastError,
|
||||
SetErrorMode,
|
||||
GetStdHandle,
|
||||
MapViewOfFileEx,
|
||||
ReadFile,
|
||||
SetEndOfFile,
|
||||
SetFilePointer,
|
||||
WriteFile,
|
||||
GetFileInformationByHandle,
|
||||
GetDiskFreeSpace,
|
||||
GetDiskFreeSpaceEx,
|
||||
MoveFile,
|
||||
SetFileTime,
|
||||
SystemTimeToFileTime,
|
||||
LocalFileTimeToFileTime,
|
||||
FileTimeToLocalFileTime,
|
||||
FileTimeToSystemTime,
|
||||
GetSystemTime,
|
||||
SetSystemTime,
|
||||
GetLocalTime,
|
||||
SetLocalTime,
|
||||
GetTimeZoneInformation,
|
||||
SetTimeZoneInformation,
|
||||
timeSetEvent,
|
||||
timeKillEvent,
|
||||
ClearCommError,
|
||||
EscapeCommFunction,
|
||||
GetCommModemStatus,
|
||||
GetCommState,
|
||||
SetCommState,
|
||||
PurgeComm,
|
||||
SetCommTimeouts,
|
||||
ExitProcess,
|
||||
_snwprintf,
|
||||
GetDesktopWindow,
|
||||
GetForegroundWindow,
|
||||
CreateWindowEx,
|
||||
ShowWindow,
|
||||
UpdateWindow,
|
||||
DestroyWindow,
|
||||
InvalidateRect,
|
||||
GetWindowDC,
|
||||
GetClientRect,
|
||||
AdjustWindowRect,
|
||||
SetDIBitsToDevice,
|
||||
BitBlt,
|
||||
GetDC,
|
||||
ReleaseDC,
|
||||
RegisterClassEx,
|
||||
UnregisterClass,
|
||||
BeginPaint,
|
||||
EndPaint,
|
||||
PostQuitMessage,
|
||||
DefWindowProc,
|
||||
LoadIcon,
|
||||
LoadCursor,
|
||||
GetStockObject,
|
||||
SetViewportOrgEx,
|
||||
SetWindowOrgEx,
|
||||
MoveWindow,
|
||||
GetWindowRect,
|
||||
GetMessage,
|
||||
TranslateMessage,
|
||||
DispatchMessage,
|
||||
GetProcessHeap,
|
||||
HeapAlloc,
|
||||
HeapFree,
|
||||
QueryPerformanceCounter,
|
||||
QueryPerformanceFrequency
|
||||
};
|
||||
|
||||
#pragma warning(default : 4996)
|
||||
#pragma warning(default : 4232)
|
||||
|
||||
EFI_WIN_NT_THUNK_PROTOCOL *gWinNt = &mWinNtThunkTable;
|
|
@ -1,312 +0,0 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
ComponentName.c
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "SnpNt32.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
This function retrieves the user readable name of a driver in the form of a
|
||||
Unicode string. If the driver specified by This has a user readable name in
|
||||
the language specified by Language, then a pointer to the driver name is
|
||||
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
||||
by This does not support the language specified by Language,
|
||||
then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified
|
||||
in RFC 4646 or ISO 639-2 language code format.
|
||||
|
||||
@param DriverName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||
This and the language specified by Language was
|
||||
returned in DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SnpNt32DriverComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
|
||||
This function retrieves the user readable name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
||||
driver specified by This has a user readable name in the language specified by
|
||||
Language, then a pointer to the controller name is returned in ControllerName,
|
||||
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
||||
managing the controller specified by ControllerHandle and ChildHandle,
|
||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param ControllerHandle[in] The handle of a controller that the driver
|
||||
specified by This is managing. This handle
|
||||
specifies the controller whose name is to be
|
||||
returned.
|
||||
|
||||
@param ChildHandle[in] The handle of the child controller to retrieve
|
||||
the name of. This is an optional parameter that
|
||||
may be NULL. It will be NULL for device
|
||||
drivers. It will also be NULL for a bus drivers
|
||||
that wish to retrieve the name of the bus
|
||||
controller. It will not be NULL for a bus
|
||||
driver that wishes to retrieve the name of a
|
||||
child controller.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified in
|
||||
RFC 4646 or ISO 639-2 language code format.
|
||||
|
||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
controller specified by ControllerHandle and
|
||||
ChildHandle in the language specified by
|
||||
Language from the point of view of the driver
|
||||
specified by This.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
||||
the language specified by Language for the
|
||||
driver specified by This was returned in
|
||||
DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SnpNt32DriverComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gSnpNt32DriverComponentName = {
|
||||
SnpNt32DriverComponentNameGetDriverName,
|
||||
SnpNt32DriverComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
//
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gSnpNt32DriverComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) SnpNt32DriverComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) SnpNt32DriverComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mSnpNt32DriverNameTable[] = {
|
||||
{
|
||||
"eng;en",
|
||||
L"SNP NT32 Driver"
|
||||
},
|
||||
{
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
This function retrieves the user readable name of a driver in the form of a
|
||||
Unicode string. If the driver specified by This has a user readable name in
|
||||
the language specified by Language, then a pointer to the driver name is
|
||||
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
||||
by This does not support the language specified by Language,
|
||||
then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified
|
||||
in RFC 4646 or ISO 639-2 language code format.
|
||||
|
||||
@param DriverName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||
This and the language specified by Language was
|
||||
returned in DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SnpNt32DriverComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
{
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
This->SupportedLanguages,
|
||||
mSnpNt32DriverNameTable,
|
||||
DriverName,
|
||||
(BOOLEAN)(This == &gSnpNt32DriverComponentName)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
|
||||
This function retrieves the user readable name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
||||
driver specified by This has a user readable name in the language specified by
|
||||
Language, then a pointer to the controller name is returned in ControllerName,
|
||||
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
||||
managing the controller specified by ControllerHandle and ChildHandle,
|
||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param ControllerHandle[in] The handle of a controller that the driver
|
||||
specified by This is managing. This handle
|
||||
specifies the controller whose name is to be
|
||||
returned.
|
||||
|
||||
@param ChildHandle[in] The handle of the child controller to retrieve
|
||||
the name of. This is an optional parameter that
|
||||
may be NULL. It will be NULL for device
|
||||
drivers. It will also be NULL for a bus drivers
|
||||
that wish to retrieve the name of the bus
|
||||
controller. It will not be NULL for a bus
|
||||
driver that wishes to retrieve the name of a
|
||||
child controller.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified in
|
||||
RFC 4646 or ISO 639-2 language code format.
|
||||
|
||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
controller specified by ControllerHandle and
|
||||
ChildHandle in the language specified by
|
||||
Language from the point of view of the driver
|
||||
specified by This.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
||||
the language specified by Language for the
|
||||
driver specified by This was returned in
|
||||
DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SnpNt32DriverComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,343 +0,0 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
SnpNt32.h
|
||||
|
||||
Abstract:
|
||||
|
||||
-**/
|
||||
|
||||
#ifndef _SNP_NT32_H_
|
||||
#define _SNP_NT32_H_
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <Protocol/SimpleNetwork.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/WinNtThunk.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/NetLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
||||
typedef struct _SNPNT32_GLOBAL_DATA SNPNT32_GLOBAL_DATA;
|
||||
typedef struct _SNPNT32_INSTANCE_DATA SNPNT32_INSTANCE_DATA;
|
||||
|
||||
#define NETWORK_LIBRARY_NAME_U L"SnpNt32Io.dll"
|
||||
|
||||
#define NETWORK_LIBRARY_INITIALIZE "SnpInitialize"
|
||||
#define NETWORK_LIBRARY_FINALIZE "SnpFinalize"
|
||||
#define NETWORK_LIBRARY_SET_RCV_FILTER "SnpSetReceiveFilter"
|
||||
#define NETWORK_LIBRARY_RECEIVE "SnpReceive"
|
||||
#define NETWORK_LIBRARY_TRANSMIT "SnpTransmit"
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _NT_NET_INTERFACE_INFO {
|
||||
UINT32 InterfaceIndex;
|
||||
EFI_MAC_ADDRESS MacAddr;
|
||||
} NT_NET_INTERFACE_INFO;
|
||||
#pragma pack()
|
||||
|
||||
#define NET_ETHER_HEADER_SIZE 14
|
||||
|
||||
#define MAX_INTERFACE_INFO_NUMBER 16
|
||||
#define MAX_FILE_NAME_LENGTH 280
|
||||
|
||||
#define SNP_MAX_TX_BUFFER_NUM 65536
|
||||
#define SNP_TX_BUFFER_INCREASEMENT 32
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Functions in Net Library
|
||||
//
|
||||
typedef
|
||||
INT32
|
||||
(*NT_NET_INITIALIZE) (
|
||||
IN OUT UINT32 *InterfaceCount,
|
||||
IN OUT NT_NET_INTERFACE_INFO * InterfaceInfoBuffer
|
||||
);
|
||||
|
||||
typedef
|
||||
INT32
|
||||
(*NT_NET_FINALIZE) (
|
||||
VOID
|
||||
);
|
||||
|
||||
typedef
|
||||
INT32
|
||||
(*NT_NET_SET_RECEIVE_FILTER) (
|
||||
IN UINT32 Index,
|
||||
IN UINT32 EnableFilter,
|
||||
IN UINT32 MCastFilterCnt,
|
||||
IN EFI_MAC_ADDRESS * MCastFilter
|
||||
);
|
||||
|
||||
typedef
|
||||
INT32
|
||||
(*NT_NET_RECEIVE) (
|
||||
IN UINT32 Index,
|
||||
IN OUT UINT32 *BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
typedef
|
||||
INT32
|
||||
(*NT_NET_TRANSMIT) (
|
||||
IN UINT32 Index,
|
||||
IN UINT32 HeaderSize,
|
||||
IN UINT32 BufferSize,
|
||||
IN VOID *Buffer,
|
||||
IN EFI_MAC_ADDRESS * SrcAddr,
|
||||
IN EFI_MAC_ADDRESS * DestAddr,
|
||||
IN UINT16 *Protocol
|
||||
);
|
||||
|
||||
typedef struct _NT_NET_UTILITY_TABLE {
|
||||
NT_NET_INITIALIZE Initialize;
|
||||
NT_NET_FINALIZE Finalize;
|
||||
NT_NET_SET_RECEIVE_FILTER SetReceiveFilter;
|
||||
NT_NET_RECEIVE Receive;
|
||||
NT_NET_TRANSMIT Transmit;
|
||||
} NT_NET_UTILITY_TABLE;
|
||||
|
||||
//
|
||||
// Private functions
|
||||
//
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*SNPNT32_INITIALIZE_GLOBAL_DATA) (
|
||||
IN SNPNT32_GLOBAL_DATA * This
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*SNPNT32_INITIALIZE_INSTANCE_DATA) (
|
||||
IN SNPNT32_GLOBAL_DATA * This,
|
||||
IN SNPNT32_INSTANCE_DATA * Instance
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*SNPNT32_CLOSE_INSTANCE) (
|
||||
IN SNPNT32_GLOBAL_DATA * This,
|
||||
IN SNPNT32_INSTANCE_DATA * Instance
|
||||
);
|
||||
|
||||
//
|
||||
// Global data for this driver
|
||||
//
|
||||
#define SNP_NT32_DRIVER_SIGNATURE SIGNATURE_32 ('W', 'S', 'N', 'P')
|
||||
|
||||
struct _SNPNT32_GLOBAL_DATA {
|
||||
UINT32 Signature;
|
||||
|
||||
//
|
||||
// List for all the fake SNP instance
|
||||
//
|
||||
LIST_ENTRY InstanceList;
|
||||
|
||||
EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
|
||||
HMODULE NetworkLibraryHandle;
|
||||
|
||||
NT_NET_UTILITY_TABLE NtNetUtilityTable;
|
||||
|
||||
EFI_LOCK Lock;
|
||||
|
||||
//
|
||||
// Private functions
|
||||
//
|
||||
SNPNT32_INITIALIZE_GLOBAL_DATA InitializeGlobalData;
|
||||
SNPNT32_INITIALIZE_INSTANCE_DATA InitializeInstanceData;
|
||||
SNPNT32_CLOSE_INSTANCE CloseInstance;
|
||||
};
|
||||
|
||||
//
|
||||
// Instance data for each fake SNP instance
|
||||
//
|
||||
#define SNP_NT32_INSTANCE_SIGNATURE SIGNATURE_32 ('w', 'S', 'N', 'P')
|
||||
|
||||
struct _SNPNT32_INSTANCE_DATA {
|
||||
UINT32 Signature;
|
||||
|
||||
//
|
||||
// List entry use for linking with other instance
|
||||
//
|
||||
LIST_ENTRY Entry;
|
||||
|
||||
//
|
||||
// Array of the recycled transmit buffer address.
|
||||
//
|
||||
UINT64 *RecycledTxBuf;
|
||||
|
||||
//
|
||||
// Current number of recycled buffer pointers in RecycledTxBuf.
|
||||
//
|
||||
UINT32 RecycledTxBufCount;
|
||||
|
||||
//
|
||||
// The maximum number of recycled buffer pointers in RecycledTxBuf.
|
||||
//
|
||||
UINT32 MaxRecycledTxBuf;
|
||||
|
||||
SNPNT32_GLOBAL_DATA *GlobalData;
|
||||
|
||||
EFI_HANDLE DeviceHandle;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
EFI_SIMPLE_NETWORK_PROTOCOL Snp;
|
||||
EFI_SIMPLE_NETWORK_MODE Mode;
|
||||
|
||||
NT_NET_INTERFACE_INFO InterfaceInfo;
|
||||
|
||||
//
|
||||
// Private functions
|
||||
//
|
||||
};
|
||||
|
||||
#define SNP_NT32_INSTANCE_DATA_FROM_SNP_THIS(a) \
|
||||
CR ( \
|
||||
a, \
|
||||
SNPNT32_INSTANCE_DATA, \
|
||||
Snp, \
|
||||
SNP_NT32_INSTANCE_SIGNATURE \
|
||||
)
|
||||
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gSnpNt32DriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gSnpNt32DriverComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gSnpNt32DriverComponentName2;
|
||||
|
||||
/**
|
||||
Test to see if this driver supports ControllerHandle. This service
|
||||
is called by the EFI boot service ConnectController(). In
|
||||
order to make drivers as small as possible, there are a few calling
|
||||
restrictions for this service. ConnectController() must
|
||||
follow these calling restrictions. If any other agent wishes to call
|
||||
Supported() it must also follow these calling restrictions.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ControllerHandle Handle of device to test
|
||||
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||
device to start.
|
||||
|
||||
@retval EFI_SUCCESS This driver supports this device
|
||||
@retval EFI_UNSUPPORTED This driver does not support this device
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SnpNt32DriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL * This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Start this driver on ControllerHandle. This service is called by the
|
||||
EFI boot service ConnectController(). In order to make
|
||||
drivers as small as possible, there are a few calling restrictions for
|
||||
this service. ConnectController() must follow these
|
||||
calling restrictions. If any other agent wishes to call Start() it
|
||||
must also follow these calling restrictions.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ControllerHandle Handle of device to bind driver to
|
||||
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||
device to start.
|
||||
|
||||
@retval EFI_SUCCESS Always succeeds.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SnpNt32DriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL * This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Stop this driver on ControllerHandle. This service is called by the
|
||||
EFI boot service DisconnectController(). In order to
|
||||
make drivers as small as possible, there are a few calling
|
||||
restrictions for this service. DisconnectController()
|
||||
must follow these calling restrictions. If any other agent wishes
|
||||
to call Stop() it must also follow these calling restrictions.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ControllerHandle Handle of device to stop driver on
|
||||
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
|
||||
children is zero stop the entire bus driver.
|
||||
@param ChildHandleBuffer List of Child Handles to Stop.
|
||||
|
||||
@retval EFI_SUCCESS Always succeeds.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SnpNt32DriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize the driver's global data.
|
||||
|
||||
@param This Pointer to the global context data.
|
||||
|
||||
@retval EFI_SUCCESS The global data is initialized.
|
||||
@retval EFI_NOT_FOUND The required DLL is not found.
|
||||
@retval EFI_DEVICE_ERROR Error initialize network utility library.
|
||||
@retval EFI_OUT_OF_RESOURCES Out of resource.
|
||||
@retval other Other errors.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SnpNt32InitializeGlobalData (
|
||||
IN OUT SNPNT32_GLOBAL_DATA *This
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize the snpnt32 driver instance.
|
||||
|
||||
@param This Pointer to the SnpNt32 global data.
|
||||
@param Instance Pointer to the instance context data.
|
||||
|
||||
@retval EFI_SUCCESS The driver instance is initialized.
|
||||
@retval other Initialization errors.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SnpNt32InitializeInstanceData (
|
||||
IN SNPNT32_GLOBAL_DATA *This,
|
||||
IN OUT SNPNT32_INSTANCE_DATA *Instance
|
||||
);
|
||||
|
||||
/**
|
||||
Close the SnpNt32 driver instance.
|
||||
|
||||
@param This Pointer to the SnpNt32 global data.
|
||||
@param Instance Pointer to the instance context data.
|
||||
|
||||
@retval EFI_SUCCESS The instance is closed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SnpNt32CloseInstance (
|
||||
IN SNPNT32_GLOBAL_DATA *This,
|
||||
IN OUT SNPNT32_INSTANCE_DATA *Instance
|
||||
);
|
||||
|
||||
#endif
|
|
@ -1,48 +0,0 @@
|
|||
## @file
|
||||
# Component name for module SnpNt32Dxe
|
||||
#
|
||||
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = SnpNt32Dxe
|
||||
FILE_GUID = D0893F05-B06D-4161-B947-9BE9B85AC3A1
|
||||
MODULE_TYPE = UEFI_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = InitializeSnpNt32Driver
|
||||
UNLOAD_IMAGE = SnpNt32Unload
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 EBC
|
||||
#
|
||||
|
||||
[Sources]
|
||||
ComponentName.c
|
||||
SnpNt32.h
|
||||
SnpNt32.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DevicePathLib
|
||||
UefiLib
|
||||
UefiBootServicesTableLib
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
UefiDriverEntryPoint
|
||||
NetLib
|
||||
|
||||
[Protocols]
|
||||
gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiWinNtThunkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
|
@ -1,100 +0,0 @@
|
|||
/**@file
|
||||
EFI_PEI_STALL implementation for NT32 simulation environment.
|
||||
|
||||
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
#include "WinNtPeim.h"
|
||||
|
||||
#include <Ppi/NtThunk.h>
|
||||
#include <Ppi/Stall.h>
|
||||
#include <Library/DebugLib.h>
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Stall (
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices,
|
||||
IN CONST EFI_PEI_STALL_PPI *This,
|
||||
IN UINTN Microseconds
|
||||
);
|
||||
|
||||
EFI_PEI_STALL_PPI mStallPpi = {1000, Stall};
|
||||
|
||||
EFI_PEI_PPI_DESCRIPTOR mPpiListStall[1] = {
|
||||
{
|
||||
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||
&gEfiPeiStallPpiGuid,
|
||||
&mStallPpi
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
PEIM's entry point.
|
||||
|
||||
This routine installs the simulation instance of EFI_PEI_STALL_PPI based
|
||||
on Win API Sleep().
|
||||
|
||||
@param FileHandle Handle of the file being invoked.
|
||||
@param PeiServices Describes the list of possible PEI Services.
|
||||
|
||||
@retval EFI_SUCCESS The PEIM executed normally.
|
||||
@retval !EFI_SUCCESS The PEIM failed to execute normally.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeStall (
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
Status = (*PeiServices)->InstallPpi (PeiServices, &mPpiListStall[0]);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
The Stall() function provides a blocking stall for at least the number
|
||||
of microseconds stipulated in the final argument of the API.
|
||||
|
||||
@param PeiServices An indirect pointer to the PEI Services Table
|
||||
published by the PEI Foundation.
|
||||
@param This Pointer to the local data for the interface.
|
||||
@param Microseconds Number of microseconds for which to stall.
|
||||
|
||||
@retval EFI_SUCCESS The service provided at least the required delay.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Stall (
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices,
|
||||
IN CONST EFI_PEI_STALL_PPI *This,
|
||||
IN UINTN Microseconds
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
PEI_NT_THUNK_PPI *PeiNtService;
|
||||
EFI_WIN_NT_THUNK_PROTOCOL *NtThunk;
|
||||
|
||||
Status = (**PeiServices).LocatePpi (
|
||||
(const EFI_PEI_SERVICES **)PeiServices,
|
||||
&gPeiNtThunkPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID**)&PeiNtService
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Calculate the time to sleep. Win API smallest unit to sleep is 1 millisec
|
||||
// so micro second units need be divided by 1000 to convert to ms
|
||||
//
|
||||
NtThunk = (EFI_WIN_NT_THUNK_PROTOCOL*) PeiNtService->NtThunk();
|
||||
NtThunk->Sleep ((DWORD)((Microseconds + 999) / 1000));
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
## @file
|
||||
# EFI_PEI_STALL implementation for NT32 simulation environment.
|
||||
#
|
||||
# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = Stall
|
||||
FILE_GUID = 6807217E-E8DE-42d0-91D9-60AECED7420D
|
||||
MODULE_TYPE = PEIM
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = InitializeStall
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 EBC
|
||||
#
|
||||
|
||||
[Sources]
|
||||
Stall.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
PeimEntryPoint
|
||||
DebugLib
|
||||
|
||||
[Ppis]
|
||||
gEfiPeiStallPpiGuid ## PRODUCES
|
||||
gPeiNtThunkPpiGuid ## CONSUMES
|
||||
|
||||
[Depex]
|
||||
TRUE
|
||||
|
|
@ -1,601 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
Timer.c
|
||||
|
||||
Abstract:
|
||||
|
||||
NT Emulation Timer Architectural Protocol Driver as defined in DXE CIS
|
||||
|
||||
This Timer module uses an NT Thread to simulate the timer-tick driven
|
||||
timer service. In the future, the Thread creation should possibly be
|
||||
abstracted by the CPU architectural protocol
|
||||
|
||||
**/
|
||||
|
||||
#include "Timer.h"
|
||||
|
||||
//
|
||||
// Pointer to the CPU Architectural Protocol instance
|
||||
//
|
||||
EFI_CPU_ARCH_PROTOCOL *mCpu;
|
||||
|
||||
//
|
||||
// The Timer Architectural Protocol that this driver produces
|
||||
//
|
||||
EFI_TIMER_ARCH_PROTOCOL mTimer = {
|
||||
WinNtTimerDriverRegisterHandler,
|
||||
WinNtTimerDriverSetTimerPeriod,
|
||||
WinNtTimerDriverGetTimerPeriod,
|
||||
WinNtTimerDriverGenerateSoftInterrupt
|
||||
};
|
||||
|
||||
//
|
||||
// Define a global that we can use to shut down the NT timer thread when
|
||||
// the timer is canceled.
|
||||
//
|
||||
BOOLEAN mCancelTimerThread = FALSE;
|
||||
|
||||
//
|
||||
// The notification function to call on every timer interrupt
|
||||
//
|
||||
EFI_TIMER_NOTIFY mTimerNotifyFunction = NULL;
|
||||
|
||||
//
|
||||
// The current period of the timer interrupt
|
||||
//
|
||||
UINT64 mTimerPeriod;
|
||||
|
||||
//
|
||||
// The thread handle for this driver
|
||||
//
|
||||
HANDLE mNtMainThreadHandle;
|
||||
|
||||
//
|
||||
// The timer value from the last timer interrupt
|
||||
//
|
||||
UINT32 mNtLastTick;
|
||||
|
||||
//
|
||||
// Critical section used to update varibles shared between the main thread and
|
||||
// the timer interrupt thread.
|
||||
//
|
||||
CRITICAL_SECTION mNtCriticalSection;
|
||||
|
||||
//
|
||||
// Worker Functions
|
||||
//
|
||||
UINT mMMTimerThreadID = 0;
|
||||
|
||||
VOID
|
||||
CALLBACK
|
||||
MMTimerThread (
|
||||
UINT wTimerID,
|
||||
UINT msg,
|
||||
DWORD dwUser,
|
||||
DWORD dw1,
|
||||
DWORD dw2
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
wTimerID - TODO: add argument description
|
||||
msg - TODO: add argument description
|
||||
dwUser - TODO: add argument description
|
||||
dw1 - TODO: add argument description
|
||||
dw2 - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_TPL OriginalTPL;
|
||||
UINT32 CurrentTick;
|
||||
UINT32 Delta;
|
||||
EFI_TIMER_NOTIFY CallbackFunction;
|
||||
BOOLEAN InterruptState;
|
||||
|
||||
if (!mCancelTimerThread) {
|
||||
|
||||
//
|
||||
// Suspend the main thread until we are done.
|
||||
// Enter the critical section before suspending
|
||||
// and leave the critical section after resuming
|
||||
// to avoid deadlock between main and timer thread.
|
||||
//
|
||||
gWinNt->EnterCriticalSection (&mNtCriticalSection);
|
||||
gWinNt->SuspendThread (mNtMainThreadHandle);
|
||||
|
||||
//
|
||||
// If the timer thread is being canceled, then bail immediately.
|
||||
// We check again here because there's a small window of time from when
|
||||
// this thread was kicked off and when we suspended the main thread above.
|
||||
//
|
||||
if (mCancelTimerThread) {
|
||||
gWinNt->ResumeThread (mNtMainThreadHandle);
|
||||
gWinNt->LeaveCriticalSection (&mNtCriticalSection);
|
||||
gWinNt->timeKillEvent (wTimerID);
|
||||
mMMTimerThreadID = 0;
|
||||
return ;
|
||||
}
|
||||
|
||||
mCpu->GetInterruptState (mCpu, &InterruptState);
|
||||
while (!InterruptState) {
|
||||
//
|
||||
// Resume the main thread
|
||||
//
|
||||
gWinNt->ResumeThread (mNtMainThreadHandle);
|
||||
gWinNt->LeaveCriticalSection (&mNtCriticalSection);
|
||||
|
||||
//
|
||||
// Wait for interrupts to be enabled.
|
||||
//
|
||||
mCpu->GetInterruptState (mCpu, &InterruptState);
|
||||
while (!InterruptState) {
|
||||
gWinNt->Sleep (1);
|
||||
mCpu->GetInterruptState (mCpu, &InterruptState);
|
||||
}
|
||||
|
||||
//
|
||||
// Suspend the main thread until we are done
|
||||
//
|
||||
gWinNt->EnterCriticalSection (&mNtCriticalSection);
|
||||
gWinNt->SuspendThread (mNtMainThreadHandle);
|
||||
mCpu->GetInterruptState (mCpu, &InterruptState);
|
||||
}
|
||||
|
||||
//
|
||||
// Get the current system tick
|
||||
//
|
||||
CurrentTick = gWinNt->GetTickCount ();
|
||||
Delta = CurrentTick - mNtLastTick;
|
||||
mNtLastTick = CurrentTick;
|
||||
|
||||
//
|
||||
// If delay was more then 1 second, ignore it (probably debugging case)
|
||||
//
|
||||
if (Delta < 1000) {
|
||||
|
||||
OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||
|
||||
//
|
||||
// Inform the firmware of an "timer interrupt". The time
|
||||
// expired since the last call is 10,000 times the number
|
||||
// of ms. (or 100ns units)
|
||||
//
|
||||
CallbackFunction = mTimerNotifyFunction;
|
||||
|
||||
//
|
||||
// Only invoke the callback function if a Non-NULL handler has been
|
||||
// registered. Assume all other handlers are legal.
|
||||
//
|
||||
if (CallbackFunction != NULL) {
|
||||
CallbackFunction ((UINT64) (Delta * 10000));
|
||||
}
|
||||
|
||||
gBS->RestoreTPL (OriginalTPL);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Resume the main thread
|
||||
//
|
||||
gWinNt->ResumeThread (mNtMainThreadHandle);
|
||||
gWinNt->LeaveCriticalSection (&mNtCriticalSection);
|
||||
} else {
|
||||
gWinNt->timeKillEvent (wTimerID);
|
||||
mMMTimerThreadID = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UINT
|
||||
CreateNtTimer (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
It is used to emulate a platform
|
||||
timer-driver interrupt handler.
|
||||
|
||||
Returns:
|
||||
|
||||
Timer ID
|
||||
|
||||
--*/
|
||||
// TODO: function comment is missing 'Arguments:'
|
||||
{
|
||||
UINT32 SleepCount;
|
||||
|
||||
//
|
||||
// Set our thread priority higher than the "main" thread.
|
||||
//
|
||||
gWinNt->SetThreadPriority (
|
||||
gWinNt->GetCurrentThread (),
|
||||
THREAD_PRIORITY_HIGHEST
|
||||
);
|
||||
|
||||
//
|
||||
// Calc the appropriate interval
|
||||
//
|
||||
gWinNt->EnterCriticalSection (&mNtCriticalSection);
|
||||
SleepCount = (UINT32) (mTimerPeriod + 5000) / 10000;
|
||||
gWinNt->LeaveCriticalSection (&mNtCriticalSection);
|
||||
|
||||
return gWinNt->timeSetEvent (
|
||||
SleepCount,
|
||||
0,
|
||||
MMTimerThread,
|
||||
(DWORD_PTR) NULL,
|
||||
TIME_PERIODIC | TIME_KILL_SYNCHRONOUS | TIME_CALLBACK_FUNCTION
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtTimerDriverRegisterHandler (
|
||||
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
||||
IN EFI_TIMER_NOTIFY NotifyFunction
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function registers the handler NotifyFunction so it is called every time
|
||||
the timer interrupt fires. It also passes the amount of time since the last
|
||||
handler call to the NotifyFunction. If NotifyFunction is NULL, then the
|
||||
handler is unregistered. If the handler is registered, then EFI_SUCCESS is
|
||||
returned. If the CPU does not support registering a timer interrupt handler,
|
||||
then EFI_UNSUPPORTED is returned. If an attempt is made to register a handler
|
||||
when a handler is already registered, then EFI_ALREADY_STARTED is returned.
|
||||
If an attempt is made to unregister a handler when a handler is not registered,
|
||||
then EFI_INVALID_PARAMETER is returned. If an error occurs attempting to
|
||||
register the NotifyFunction with the timer interrupt, then EFI_DEVICE_ERROR
|
||||
is returned.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - The EFI_TIMER_ARCH_PROTOCOL instance.
|
||||
|
||||
NotifyFunction - The function to call when a timer interrupt fires. This
|
||||
function executes at TPL_HIGH_LEVEL. The DXE Core will
|
||||
register a handler for the timer interrupt, so it can know
|
||||
how much time has passed. This information is used to
|
||||
signal timer based events. NULL will unregister the handler.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The timer handler was registered.
|
||||
|
||||
EFI_UNSUPPORTED - The platform does not support timer interrupts.
|
||||
|
||||
EFI_ALREADY_STARTED - NotifyFunction is not NULL, and a handler is already
|
||||
registered.
|
||||
|
||||
EFI_INVALID_PARAMETER - NotifyFunction is NULL, and a handler was not
|
||||
previously registered.
|
||||
|
||||
EFI_DEVICE_ERROR - The timer handler could not be registered.
|
||||
|
||||
--*/
|
||||
{
|
||||
//
|
||||
// Check for invalid parameters
|
||||
//
|
||||
if (NotifyFunction == NULL && mTimerNotifyFunction == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (NotifyFunction != NULL && mTimerNotifyFunction != NULL) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Use Critical Section to update the notification function that is
|
||||
// used from the timer interrupt thread.
|
||||
//
|
||||
gWinNt->EnterCriticalSection (&mNtCriticalSection);
|
||||
|
||||
mTimerNotifyFunction = NotifyFunction;
|
||||
|
||||
gWinNt->LeaveCriticalSection (&mNtCriticalSection);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtTimerDriverSetTimerPeriod (
|
||||
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
||||
IN UINT64 TimerPeriod
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function adjusts the period of timer interrupts to the value specified
|
||||
by TimerPeriod. If the timer period is updated, then the selected timer
|
||||
period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If
|
||||
the timer hardware is not programmable, then EFI_UNSUPPORTED is returned.
|
||||
If an error occurs while attempting to update the timer period, then the
|
||||
timer hardware will be put back in its state prior to this call, and
|
||||
EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt
|
||||
is disabled. This is not the same as disabling the CPU's interrupts.
|
||||
Instead, it must either turn off the timer hardware, or it must adjust the
|
||||
interrupt controller so that a CPU interrupt is not generated when the timer
|
||||
interrupt fires.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - The EFI_TIMER_ARCH_PROTOCOL instance.
|
||||
|
||||
TimerPeriod - The rate to program the timer interrupt in 100 nS units. If
|
||||
the timer hardware is not programmable, then EFI_UNSUPPORTED is
|
||||
returned. If the timer is programmable, then the timer period
|
||||
will be rounded up to the nearest timer period that is supported
|
||||
by the timer hardware. If TimerPeriod is set to 0, then the
|
||||
timer interrupts will be disabled.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The timer period was changed.
|
||||
|
||||
EFI_UNSUPPORTED - The platform cannot change the period of the timer interrupt.
|
||||
|
||||
EFI_DEVICE_ERROR - The timer period could not be changed due to a device error.
|
||||
|
||||
--*/
|
||||
{
|
||||
|
||||
//
|
||||
// If TimerPeriod is 0, then the timer thread should be canceled
|
||||
//
|
||||
if (TimerPeriod == 0) {
|
||||
//
|
||||
// Cancel the timer thread
|
||||
//
|
||||
gWinNt->EnterCriticalSection (&mNtCriticalSection);
|
||||
|
||||
mCancelTimerThread = TRUE;
|
||||
|
||||
gWinNt->LeaveCriticalSection (&mNtCriticalSection);
|
||||
|
||||
//
|
||||
// Wait for the timer thread to exit
|
||||
//
|
||||
|
||||
if (mMMTimerThreadID) {
|
||||
gWinNt->timeKillEvent (mMMTimerThreadID);
|
||||
}
|
||||
|
||||
mMMTimerThreadID = 0;
|
||||
|
||||
//
|
||||
// Update the timer period
|
||||
//
|
||||
gWinNt->EnterCriticalSection (&mNtCriticalSection);
|
||||
|
||||
mTimerPeriod = TimerPeriod;
|
||||
|
||||
gWinNt->LeaveCriticalSection (&mNtCriticalSection);
|
||||
|
||||
//
|
||||
// NULL out the thread handle so it will be re-created if the timer is enabled again
|
||||
//
|
||||
|
||||
} else if ((TimerPeriod > TIMER_MINIMUM_VALUE) && (TimerPeriod < TIMER_MAXIMUM_VALUE)) {
|
||||
//
|
||||
// If the TimerPeriod is valid, then create and/or adjust the period of the timer thread
|
||||
//
|
||||
gWinNt->EnterCriticalSection (&mNtCriticalSection);
|
||||
|
||||
mTimerPeriod = TimerPeriod;
|
||||
|
||||
mCancelTimerThread = FALSE;
|
||||
|
||||
gWinNt->LeaveCriticalSection (&mNtCriticalSection);
|
||||
|
||||
//
|
||||
// Get the starting tick location if we are just starting the timer thread
|
||||
//
|
||||
mNtLastTick = gWinNt->GetTickCount ();
|
||||
|
||||
if (mMMTimerThreadID) {
|
||||
gWinNt->timeKillEvent (mMMTimerThreadID);
|
||||
}
|
||||
|
||||
mMMTimerThreadID = 0;
|
||||
|
||||
mMMTimerThreadID = CreateNtTimer ();
|
||||
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtTimerDriverGetTimerPeriod (
|
||||
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
||||
OUT UINT64 *TimerPeriod
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function retrieves the period of timer interrupts in 100 ns units,
|
||||
returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod
|
||||
is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is
|
||||
returned, then the timer is currently disabled.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - The EFI_TIMER_ARCH_PROTOCOL instance.
|
||||
|
||||
TimerPeriod - A pointer to the timer period to retrieve in 100 ns units. If
|
||||
0 is returned, then the timer is currently disabled.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The timer period was returned in TimerPeriod.
|
||||
|
||||
EFI_INVALID_PARAMETER - TimerPeriod is NULL.
|
||||
|
||||
--*/
|
||||
{
|
||||
if (TimerPeriod == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*TimerPeriod = mTimerPeriod;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtTimerDriverGenerateSoftInterrupt (
|
||||
IN EFI_TIMER_ARCH_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function generates a soft timer interrupt. If the platform does not support soft
|
||||
timer interrupts, then EFI_UNSUPPORTED is returned. Otherwise, EFI_SUCCESS is returned.
|
||||
If a handler has been registered through the EFI_TIMER_ARCH_PROTOCOL.RegisterHandler()
|
||||
service, then a soft timer interrupt will be generated. If the timer interrupt is
|
||||
enabled when this service is called, then the registered handler will be invoked. The
|
||||
registered handler should not be able to distinguish a hardware-generated timer
|
||||
interrupt from a software-generated timer interrupt.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - The EFI_TIMER_ARCH_PROTOCOL instance.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The soft timer interrupt was generated.
|
||||
|
||||
EFI_UNSUPPORTED - The platform does not support the generation of soft timer interrupts.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtTimerDriverInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize the Timer Architectural Protocol driver
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - ImageHandle of the loaded driver
|
||||
|
||||
SystemTable - Pointer to the System Table
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Timer Architectural Protocol created
|
||||
|
||||
EFI_OUT_OF_RESOURCES - Not enough resources available to initialize driver.
|
||||
|
||||
EFI_DEVICE_ERROR - A device error occured attempting to initialize the driver.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Result;
|
||||
EFI_HANDLE Handle;
|
||||
EFI_HANDLE hSourceProcessHandle;
|
||||
EFI_HANDLE hSourceHandle;
|
||||
EFI_HANDLE hTargetProcessHandle;
|
||||
//
|
||||
// Make sure the Timer Architectural Protocol is not already installed in the system
|
||||
//
|
||||
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiTimerArchProtocolGuid);
|
||||
|
||||
//
|
||||
// Get the CPU Architectural Protocol instance
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID**)&mCpu);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Get our handle so the timer tick thread can suspend
|
||||
//
|
||||
hSourceProcessHandle = gWinNt->GetCurrentProcess ();
|
||||
hSourceHandle = gWinNt->GetCurrentThread ();
|
||||
hTargetProcessHandle = gWinNt->GetCurrentProcess ();
|
||||
Result = gWinNt->DuplicateHandle (
|
||||
hSourceProcessHandle,
|
||||
hSourceHandle,
|
||||
hTargetProcessHandle,
|
||||
&mNtMainThreadHandle,
|
||||
0,
|
||||
FALSE,
|
||||
DUPLICATE_SAME_ACCESS
|
||||
);
|
||||
if (Result == 0) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize Critical Section used to update variables shared between the main
|
||||
// thread and the timer interrupt thread.
|
||||
//
|
||||
gWinNt->InitializeCriticalSection (&mNtCriticalSection);
|
||||
|
||||
//
|
||||
// Start the timer thread at the default timer period
|
||||
//
|
||||
Status = mTimer.SetTimerPeriod (&mTimer, DEFAULT_TIMER_TICK_DURATION);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gWinNt->DeleteCriticalSection (&mNtCriticalSection);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Install the Timer Architectural Protocol onto a new handle
|
||||
//
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&Handle,
|
||||
&gEfiTimerArchProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&mTimer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Cancel the timer
|
||||
//
|
||||
mTimer.SetTimerPeriod (&mTimer, 0);
|
||||
gWinNt->DeleteCriticalSection (&mNtCriticalSection);
|
||||
return Status;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
|
@ -1,164 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
|
||||
Timer.h
|
||||
|
||||
Abstract:
|
||||
|
||||
NT Emulation Architectural Protocol Driver as defined in Tiano.
|
||||
This Timer module uses an NT Thread to simulate the timer-tick driven
|
||||
timer service.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _TIMER_H_
|
||||
#define _TIMER_H_
|
||||
|
||||
|
||||
#include <Uefi.h>
|
||||
#include <WinNtDxe.h>
|
||||
#include <Protocol/Timer.h>
|
||||
#include <Protocol/Cpu.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/WinNtLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
|
||||
|
||||
//
|
||||
// Legal timer value range in 100 ns units
|
||||
//
|
||||
#define TIMER_MINIMUM_VALUE 0
|
||||
#define TIMER_MAXIMUM_VALUE (0x100000000 - 1)
|
||||
|
||||
//
|
||||
// Default timer value in 100 ns units (10 ms)
|
||||
//
|
||||
#define DEFAULT_TIMER_TICK_DURATION 100000
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtTimerDriverInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - TODO: add argument description
|
||||
SystemTable - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtTimerDriverRegisterHandler (
|
||||
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
||||
IN EFI_TIMER_NOTIFY NotifyFunction
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
NotifyFunction - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtTimerDriverSetTimerPeriod (
|
||||
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
||||
IN UINT64 TimerPeriod
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
TimerPeriod - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtTimerDriverGetTimerPeriod (
|
||||
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
||||
OUT UINT64 *TimerPeriod
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
TimerPeriod - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtTimerDriverGenerateSoftInterrupt (
|
||||
IN EFI_TIMER_ARCH_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
|
@ -1,49 +0,0 @@
|
|||
## @file
|
||||
# NT Emulation Timer Architectural Protocol Driver as defined in DXE CIS
|
||||
#
|
||||
# This Timer module uses an NT Thread to simulate the timer-tick driven
|
||||
# timer service. In the future, the Thread creation should possibly be
|
||||
# abstracted by the CPU architectural protocol
|
||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = Timer
|
||||
FILE_GUID = C3811036-710B-4E39-8CF1-0AF9BE3A8198
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = WinNtTimerDriverInitialize
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
|
||||
[Sources]
|
||||
Timer.c
|
||||
Timer.h
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
UefiBootServicesTableLib
|
||||
WinNtLib
|
||||
UefiDriverEntryPoint
|
||||
DebugLib
|
||||
|
||||
[Protocols]
|
||||
gEfiCpuArchProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiTimerArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||
|
||||
[Depex]
|
||||
gEfiCpuArchProtocolGuid
|
||||
|
|
@ -1,219 +0,0 @@
|
|||
/**@file
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
WinNtAutoscan.c
|
||||
|
||||
Abstract:
|
||||
This PEIM to abstract memory auto-scan in a Windows NT environment.
|
||||
|
||||
Revision History
|
||||
|
||||
**/
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <PiPei.h>
|
||||
#include <WinNtPeim.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Ppi/NtAutoscan.h>
|
||||
#include <Ppi/ReadOnlyVariable2.h>
|
||||
|
||||
#include <Guid/MemoryTypeInformation.h>
|
||||
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PeimEntryPoint.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
|
||||
EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] = {
|
||||
{ EfiReservedMemoryType, 0x0004 },
|
||||
{ EfiRuntimeServicesCode, 0x0040 },
|
||||
{ EfiRuntimeServicesData, 0x0040 },
|
||||
{ EfiBootServicesCode, 0x0300 },
|
||||
{ EfiBootServicesData, 0x1000 },
|
||||
{ EfiMaxMemoryType, 0 }
|
||||
};
|
||||
|
||||
/**
|
||||
Validate variable data for the MemoryTypeInformation.
|
||||
|
||||
@param MemoryData Variable data.
|
||||
@param MemoryDataSize Variable data length.
|
||||
|
||||
@return TRUE The variable data is valid.
|
||||
@return FALSE The variable data is invalid.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
ValidateMemoryTypeInfoVariable (
|
||||
IN EFI_MEMORY_TYPE_INFORMATION *MemoryData,
|
||||
IN UINTN MemoryDataSize
|
||||
)
|
||||
{
|
||||
UINTN Count;
|
||||
UINTN Index;
|
||||
|
||||
// Check the input parameter.
|
||||
if (MemoryData == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Get Count
|
||||
Count = MemoryDataSize / sizeof (*MemoryData);
|
||||
|
||||
// Check Size
|
||||
if (Count * sizeof(*MemoryData) != MemoryDataSize) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Check last entry type filed.
|
||||
if (MemoryData[Count - 1].Type != EfiMaxMemoryType) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Check the type filed.
|
||||
for (Index = 0; Index < Count - 1; Index++) {
|
||||
if (MemoryData[Index].Type >= EfiMaxMemoryType) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeimInitializeWinNtAutoScan (
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Perform a call-back into the SEC simulator to get a memory value
|
||||
|
||||
Arguments:
|
||||
FfsHeader - General purpose data available to every PEIM
|
||||
PeiServices - General purpose services available to every PEIM.
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
|
||||
PEI_NT_AUTOSCAN_PPI *PeiNtService;
|
||||
UINT64 MemorySize;
|
||||
EFI_PHYSICAL_ADDRESS MemoryBase;
|
||||
UINTN Index;
|
||||
EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;
|
||||
EFI_PEI_READ_ONLY_VARIABLE2_PPI *Variable;
|
||||
UINTN DataSize;
|
||||
EFI_MEMORY_TYPE_INFORMATION MemoryData [EfiMaxMemoryType + 1];
|
||||
|
||||
|
||||
DEBUG ((EFI_D_ERROR, "NT 32 Autoscan PEIM Loaded\n"));
|
||||
|
||||
//
|
||||
// Get the PEI NT Autoscan PPI
|
||||
//
|
||||
Status = PeiServicesLocatePpi (
|
||||
&gPeiNtAutoScanPpiGuid, // GUID
|
||||
0, // INSTANCE
|
||||
&PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
|
||||
(VOID**)&PeiNtService // PPI
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Index = 0;
|
||||
do {
|
||||
Status = PeiNtService->NtAutoScan (Index, &MemoryBase, &MemorySize);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Attributes =
|
||||
(
|
||||
EFI_RESOURCE_ATTRIBUTE_PRESENT |
|
||||
EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
|
||||
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
|
||||
EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
|
||||
EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
|
||||
EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
|
||||
);
|
||||
|
||||
if (Index == 0) {
|
||||
//
|
||||
// Register the memory with the PEI Core
|
||||
//
|
||||
Status = PeiServicesInstallPeiMemory (MemoryBase, MemorySize);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Attributes |= EFI_RESOURCE_ATTRIBUTE_TESTED;
|
||||
}
|
||||
|
||||
BuildResourceDescriptorHob (
|
||||
EFI_RESOURCE_SYSTEM_MEMORY,
|
||||
Attributes,
|
||||
MemoryBase,
|
||||
MemorySize
|
||||
);
|
||||
}
|
||||
Index++;
|
||||
} while (!EFI_ERROR (Status));
|
||||
|
||||
//
|
||||
// Build the CPU hob with 52-bit addressing and 16-bits of IO space.
|
||||
//
|
||||
BuildCpuHob (52, 16);
|
||||
|
||||
//
|
||||
// Build GUIDed Hob that contains the Memory Type Information array
|
||||
//
|
||||
Status = PeiServicesLocatePpi (
|
||||
&gEfiPeiReadOnlyVariable2PpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **)&Variable
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
DataSize = sizeof (MemoryData);
|
||||
Status = Variable->GetVariable (
|
||||
Variable,
|
||||
EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME,
|
||||
&gEfiMemoryTypeInformationGuid,
|
||||
NULL,
|
||||
&DataSize,
|
||||
&MemoryData
|
||||
);
|
||||
if (EFI_ERROR (Status) || !ValidateMemoryTypeInfoVariable(MemoryData, DataSize)) {
|
||||
//
|
||||
// Create Memory Type Information HOB
|
||||
//
|
||||
BuildGuidDataHob (
|
||||
&gEfiMemoryTypeInformationGuid,
|
||||
mDefaultMemoryTypeInformation,
|
||||
sizeof(mDefaultMemoryTypeInformation)
|
||||
);
|
||||
} else {
|
||||
//
|
||||
// Create Memory Type Information HOB
|
||||
//
|
||||
BuildGuidDataHob (
|
||||
&gEfiMemoryTypeInformationGuid,
|
||||
MemoryData,
|
||||
DataSize
|
||||
);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
## @file
|
||||
# Component description file for WinNtAutoScan module
|
||||
#
|
||||
# This module abstracts memory auto-scan in a Windows NT environment.
|
||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = WinNtAutoScan
|
||||
FILE_GUID = BE0FEABA-3443-4919-9F3A-2D4216329EA9
|
||||
MODULE_TYPE = PEIM
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = PeimInitializeWinNtAutoScan
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
|
||||
[Sources]
|
||||
WinNtAutoScan.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
HobLib
|
||||
PeimEntryPoint
|
||||
DebugLib
|
||||
PeiServicesLib
|
||||
|
||||
[Ppis]
|
||||
gPeiNtAutoScanPpiGuid # PPI ALWAYS_CONSUMED
|
||||
gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_CONSUMED
|
||||
|
||||
[Guids]
|
||||
gEfiMemoryTypeInformationGuid
|
||||
|
||||
[Depex]
|
||||
gPeiNtAutoScanPpiGuid AND gEfiPeiMasterBootModePpiGuid AND gEfiPeiReadOnlyVariable2PpiGuid
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue