EmulatorPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the EmulatorPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
e7108d0e96
commit
a550d468a6
@ -37,9 +37,9 @@ GetArg (
|
||||
Status = gBS->HandleProtocol (
|
||||
gImageHandle,
|
||||
&gEfiShellParametersProtocolGuid,
|
||||
(VOID**)&ShellParameters
|
||||
(VOID **)&ShellParameters
|
||||
);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -94,8 +94,8 @@ UefiMain (
|
||||
EFI_IPv4_ADDRESS RedfishServiceIpMask;
|
||||
UINTN RedfishServiceIpPort;
|
||||
|
||||
Status = GetArg();
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = GetArg ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -104,39 +104,41 @@ UefiMain (
|
||||
// RedfishPlatformConfig.efi -s HostIpAddress HostIpMask RedfishServiceIpAddress RedfishServiceIpMask RedfishServiceIpPort
|
||||
// RedfishPlatformConfig.efi -a RedfishServiceIpAddress RedfishServiceIpMask RedfishServiceIpPort
|
||||
//
|
||||
if (Argc != 7 && Argc != 5) {
|
||||
|
||||
PrintHelp();
|
||||
if ((Argc != 7) && (Argc != 5)) {
|
||||
PrintHelp ();
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (StrCmp(Argv[1], L"-s") == 0) {
|
||||
|
||||
if (StrCmp (Argv[1], L"-s") == 0) {
|
||||
HostIpAssignmentType = 1;
|
||||
|
||||
Status = NetLibStrToIp4 (Argv[2], &HostIpAddress);
|
||||
if (EFI_ERROR (Status)) {
|
||||
PrintHelp();
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = NetLibStrToIp4 (Argv[3], &HostIpMask);
|
||||
if (EFI_ERROR (Status)) {
|
||||
PrintHelp();
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = NetLibStrToIp4 (Argv[4], &RedfishServiceIpAddress);
|
||||
if (EFI_ERROR (Status)) {
|
||||
PrintHelp();
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = NetLibStrToIp4 (Argv[5], &RedfishServiceIpMask);
|
||||
if (EFI_ERROR (Status)) {
|
||||
PrintHelp();
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
ReturnStatus = StrDecimalToUintnS (Argv[6], NULL, &RedfishServiceIpPort);
|
||||
if (RETURN_ERROR (ReturnStatus)) {
|
||||
PrintHelp();
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -214,24 +216,24 @@ UefiMain (
|
||||
Print (L"RedfishServiceIpMask: %s has been set Successfully!\n", Argv[5]);
|
||||
Print (L"RedfishServiceIpPort: %s has been set Successfully!\n", Argv[6]);
|
||||
Print (L"Please Restart!\n");
|
||||
|
||||
} else if (StrCmp(Argv[1], L"-a") == 0) {
|
||||
|
||||
} else if (StrCmp (Argv[1], L"-a") == 0) {
|
||||
HostIpAssignmentType = 3;
|
||||
|
||||
Status = NetLibStrToIp4 (Argv[2], &RedfishServiceIpAddress);
|
||||
if (EFI_ERROR (Status)) {
|
||||
PrintHelp();
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = NetLibStrToIp4 (Argv[3], &RedfishServiceIpMask);
|
||||
if (EFI_ERROR (Status)) {
|
||||
PrintHelp();
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
ReturnStatus = StrDecimalToUintnS (Argv[4], NULL, &RedfishServiceIpPort);
|
||||
if (RETURN_ERROR (ReturnStatus)) {
|
||||
PrintHelp();
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -285,12 +287,10 @@ UefiMain (
|
||||
Print (L"RedfishServiceIpMask: %s has been set Successfully!\n", Argv[3]);
|
||||
Print (L"RedfishServiceIpPort: %s has been set Successfully!\n", Argv[4]);
|
||||
Print (L"Please Restart!\n");
|
||||
} else if (StrCmp(Argv[1], L"-h") == 0 || StrCmp(Argv[1], L"-help") == 0) {
|
||||
|
||||
PrintHelp();
|
||||
} else if ((StrCmp (Argv[1], L"-h") == 0) || (StrCmp (Argv[1], L"-help") == 0)) {
|
||||
PrintHelp ();
|
||||
} else {
|
||||
|
||||
PrintHelp();
|
||||
PrintHelp ();
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ PeimInitializeAutoScanPei (
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -46,7 +47,6 @@ Returns:
|
||||
UINTN Index;
|
||||
EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;
|
||||
|
||||
|
||||
DEBUG ((DEBUG_ERROR, "Emu Autoscan PEIM Loaded\n"));
|
||||
|
||||
//
|
||||
@ -91,6 +91,7 @@ Returns:
|
||||
MemorySize
|
||||
);
|
||||
}
|
||||
|
||||
Index++;
|
||||
} while (!EFI_ERROR (Status));
|
||||
|
||||
|
@ -6,8 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
@ -16,7 +14,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
|
||||
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
@ -28,7 +25,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PeimEntryPoint.h>
|
||||
|
||||
|
||||
//
|
||||
// Module globals
|
||||
//
|
||||
@ -50,6 +46,7 @@ InitializeBootMode (
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
@ -42,7 +42,7 @@ CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
|
||||
#define EFI_CPU_DATA_MAXIMUM_LENGTH 0x100
|
||||
|
||||
SMBIOS_TABLE_TYPE4 mCpuSmbiosType4 = {
|
||||
{ EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE4), 0},
|
||||
{ EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE4), 0 },
|
||||
1, // Socket String
|
||||
ProcessorOther, // ProcessorType; ///< The enumeration value from PROCESSOR_TYPE_DATA.
|
||||
ProcessorFamilyOther, // ProcessorFamily; ///< The enumeration value from PROCESSOR_FAMILY_DATA.
|
||||
@ -129,7 +129,6 @@ CHAR8 *mCpuSmbiosType4Strings[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Create SMBIOS record.
|
||||
|
||||
@ -190,10 +189,12 @@ LogSmbiosData (
|
||||
StringSize = AsciiStrSize (StringPack[Index]);
|
||||
Size += StringSize;
|
||||
}
|
||||
|
||||
if (StringPack[0] == NULL) {
|
||||
// At least a double null is required
|
||||
Size += 1;
|
||||
}
|
||||
|
||||
// Don't forget the terminating double null
|
||||
Size += 1;
|
||||
}
|
||||
@ -203,6 +204,7 @@ LogSmbiosData (
|
||||
if (Record == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
CopyMem (Record, Template, Template->Length);
|
||||
|
||||
// Append string pack
|
||||
@ -212,6 +214,7 @@ LogSmbiosData (
|
||||
CopyMem (Str, StringPack[Index], StringSize);
|
||||
Str += StringSize;
|
||||
}
|
||||
|
||||
*Str = 0;
|
||||
|
||||
SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
|
||||
@ -227,17 +230,14 @@ LogSmbiosData (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CpuUpdateSmbios (
|
||||
IN UINTN MaxCpus
|
||||
)
|
||||
{
|
||||
mCpuSmbiosType4.CoreCount = (UINT8) MaxCpus;
|
||||
mCpuSmbiosType4.EnabledCoreCount = (UINT8) MaxCpus;
|
||||
mCpuSmbiosType4.ThreadCount = (UINT8) MaxCpus;
|
||||
mCpuSmbiosType4.CoreCount = (UINT8)MaxCpus;
|
||||
mCpuSmbiosType4.EnabledCoreCount = (UINT8)MaxCpus;
|
||||
mCpuSmbiosType4.ThreadCount = (UINT8)MaxCpus;
|
||||
//
|
||||
// The value of 1234 is fake value for CPU frequency
|
||||
//
|
||||
@ -245,7 +245,6 @@ CpuUpdateSmbios (
|
||||
LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mCpuSmbiosType4, mCpuSmbiosType4Strings);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Service routines for the driver
|
||||
//
|
||||
@ -265,6 +264,7 @@ EmuFlushCpuDataCache (
|
||||
//
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Other flush types are not supported by Emu emulator
|
||||
//
|
||||
@ -338,9 +338,10 @@ EmuRegisterInterruptHandler (
|
||||
//
|
||||
// Do parameter checking for EFI spec conformance
|
||||
//
|
||||
if (InterruptType < 0 || InterruptType > 0xff) {
|
||||
if ((InterruptType < 0) || (InterruptType > 0xff)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Do nothing for Emu emulation
|
||||
//
|
||||
@ -373,7 +374,6 @@ EmuGetTimerValue (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSetMemoryAttributes (
|
||||
@ -396,9 +396,6 @@ EmuSetMemoryAttributes (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Callback function for idle events.
|
||||
|
||||
@ -417,7 +414,6 @@ IdleLoopEventCallback (
|
||||
gEmuThunk->CpuSleep ();
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeCpu (
|
||||
@ -444,7 +440,6 @@ InitializeCpu (
|
||||
|
||||
CpuUpdateSmbios (MaxCpu);
|
||||
|
||||
|
||||
Status = gBS->CreateEventEx (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_NOTIFY,
|
||||
@ -455,11 +450,12 @@ InitializeCpu (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mCpuTemplate.Handle,
|
||||
&gEfiCpuArchProtocolGuid, &mCpuTemplate.Cpu,
|
||||
&gEfiCpuIo2ProtocolGuid, &mCpuTemplate.CpuIo,
|
||||
&gEfiCpuArchProtocolGuid,
|
||||
&mCpuTemplate.Cpu,
|
||||
&gEfiCpuIo2ProtocolGuid,
|
||||
&mCpuTemplate.CpuIo,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#ifndef _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
|
||||
#define _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
|
||||
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <IndustryStandard/SmBios.h>
|
||||
|
||||
@ -32,8 +31,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Data Structures
|
||||
//
|
||||
@ -50,7 +47,6 @@ typedef struct {
|
||||
// Local Data for CPU interface goes here
|
||||
//
|
||||
BOOLEAN InterruptState;
|
||||
|
||||
} CPU_ARCH_PROTOCOL_PRIVATE;
|
||||
|
||||
#define CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS(a) \
|
||||
@ -60,8 +56,6 @@ typedef struct {
|
||||
CPU_ARCH_PROT_PRIVATE_SIGNATURE \
|
||||
)
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
CPU_STATE_IDLE,
|
||||
CPU_STATE_BLOCKED,
|
||||
@ -70,7 +64,6 @@ typedef enum {
|
||||
CPU_STATE_FINISHED
|
||||
} PROCESSOR_STATE;
|
||||
|
||||
|
||||
//
|
||||
// Define Individual Processor Data block.
|
||||
//
|
||||
@ -84,7 +77,6 @@ typedef struct {
|
||||
EFI_EVENT CheckThisAPEvent;
|
||||
} PROCESSOR_DATA_BLOCK;
|
||||
|
||||
|
||||
//
|
||||
// Define MP data block which consumes individual processor block.
|
||||
//
|
||||
@ -106,10 +98,6 @@ typedef struct {
|
||||
BOOLEAN TimeoutActive;
|
||||
} MP_SYSTEM_DATA;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CpuMemoryServiceRead (
|
||||
@ -232,5 +220,4 @@ CpuMpServicesWhoAmI (
|
||||
|
||||
extern EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate;
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -47,6 +47,7 @@ CpuMemoryServiceRead (
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -101,6 +102,7 @@ CpuMemoryServiceWrite (
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -154,6 +156,7 @@ CpuIoServiceRead (
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *UserBuffer
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -186,7 +189,7 @@ Returns:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Address = (UINTN) UserAddress;
|
||||
Address = (UINTN)UserAddress;
|
||||
|
||||
if (Width >= EfiCpuIoWidthMaximum) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@ -212,6 +215,7 @@ CpuIoServiceWrite (
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *UserBuffer
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -248,7 +252,7 @@ Returns:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Address = (UINTN) UserAddress;
|
||||
Address = (UINTN)UserAddress;
|
||||
|
||||
if (Width >= EfiCpuIoWidthMaximum) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@ -265,7 +269,6 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -304,7 +307,7 @@ CpuIoCheckAddressRange (
|
||||
//
|
||||
// For FiFo type, the target address won't increase during the access, so treat count as 1
|
||||
//
|
||||
if (Width >= EfiCpuIoWidthFifoUint8 && Width <= EfiCpuIoWidthFifoUint64) {
|
||||
if ((Width >= EfiCpuIoWidthFifoUint8) && (Width <= EfiCpuIoWidthFifoUint64)) {
|
||||
Count = 1;
|
||||
}
|
||||
|
||||
@ -314,11 +317,9 @@ CpuIoCheckAddressRange (
|
||||
}
|
||||
|
||||
AlignMask = (1 << Width) - 1;
|
||||
if ((UINTN) Buffer & AlignMask) {
|
||||
if ((UINTN)Buffer & AlignMask) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,14 +37,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include "CpuDriver.h"
|
||||
|
||||
|
||||
MP_SYSTEM_DATA gMPSystem;
|
||||
EMU_THREAD_THUNK_PROTOCOL *gThread = NULL;
|
||||
EFI_EVENT gReadToBootEvent;
|
||||
BOOLEAN gReadToBoot = FALSE;
|
||||
UINTN gPollInterval;
|
||||
|
||||
|
||||
BOOLEAN
|
||||
IsBSP (
|
||||
VOID
|
||||
@ -61,7 +59,6 @@ IsBSP (
|
||||
return (gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) != 0;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
SetApProcedure (
|
||||
IN PROCESSOR_DATA_BLOCK *Processor,
|
||||
@ -75,7 +72,6 @@ SetApProcedure (
|
||||
gThread->MutexUnlock (Processor->ProcedureLock);
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
GetNextBlockedNumber (
|
||||
OUT UINTN *NextNumber
|
||||
@ -121,11 +117,12 @@ CalculateAndStallInterval (
|
||||
{
|
||||
UINTN StallTime;
|
||||
|
||||
if (Timeout < gPollInterval && Timeout != 0) {
|
||||
if ((Timeout < gPollInterval) && (Timeout != 0)) {
|
||||
StallTime = Timeout;
|
||||
} else {
|
||||
StallTime = gPollInterval;
|
||||
}
|
||||
|
||||
gBS->Stall (StallTime);
|
||||
|
||||
return StallTime;
|
||||
@ -188,8 +185,6 @@ CpuMpServicesGetNumberOfProcessors (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Gets detailed MP-related information on the requested processor at the
|
||||
instant this call is made. This service may only be called from the BSP.
|
||||
@ -240,7 +235,6 @@ CpuMpServicesGetProcessorInfo (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This service executes a caller provided function on all enabled APs. APs can
|
||||
run either simultaneously or one at a time in sequence. This service supports
|
||||
@ -397,7 +391,6 @@ CpuMpServicesStartupAllAps (
|
||||
PROCESSOR_STATE ProcessorState;
|
||||
UINTN Timeout;
|
||||
|
||||
|
||||
if (!IsBSP ()) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
@ -425,12 +418,14 @@ CpuMpServicesStartupAllAps (
|
||||
// Skip Disabled processors
|
||||
continue;
|
||||
}
|
||||
gThread->MutexLock(ProcessorData->StateLock);
|
||||
|
||||
gThread->MutexLock (ProcessorData->StateLock);
|
||||
if (ProcessorData->State != CPU_STATE_IDLE) {
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
gThread->MutexUnlock(ProcessorData->StateLock);
|
||||
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
}
|
||||
|
||||
if (FailedCpuList != NULL) {
|
||||
@ -438,6 +433,7 @@ CpuMpServicesStartupAllAps (
|
||||
if (gMPSystem.FailedList == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
SetMemN (gMPSystem.FailedList, (gMPSystem.NumberOfProcessors + 1) * sizeof (UINTN), END_OF_CPU_LIST);
|
||||
gMPSystem.FailedListIndex = 0;
|
||||
*FailedCpuList = gMPSystem.FailedList;
|
||||
@ -472,7 +468,7 @@ CpuMpServicesStartupAllAps (
|
||||
// state 1 by 1, until the previous 1 finished its task
|
||||
// if not "SingleThread", all APs are put to ready state from the beginning
|
||||
//
|
||||
gThread->MutexLock(ProcessorData->StateLock);
|
||||
gThread->MutexLock (ProcessorData->StateLock);
|
||||
ASSERT (ProcessorData->State == CPU_STATE_IDLE);
|
||||
ProcessorData->State = APInitialState;
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
@ -519,7 +515,6 @@ CpuMpServicesStartupAllAps (
|
||||
gPollInterval
|
||||
);
|
||||
return Status;
|
||||
|
||||
}
|
||||
|
||||
while (TRUE) {
|
||||
@ -590,7 +585,6 @@ Done:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This service lets the caller get one enabled AP to execute a caller-provided
|
||||
function. The caller can request the BSP to either wait for the completion
|
||||
@ -711,12 +705,13 @@ CpuMpServicesStartupThisAP (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
gThread->MutexLock(gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||
gThread->MutexLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||
if (gMPSystem.ProcessorData[ProcessorNumber].State != CPU_STATE_IDLE) {
|
||||
gThread->MutexUnlock(gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
gThread->MutexUnlock(gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||
|
||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||
|
||||
if ((WaitEvent != NULL) && gReadToBoot) {
|
||||
return EFI_UNSUPPORTED;
|
||||
@ -759,10 +754,8 @@ CpuMpServicesStartupThisAP (
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This service switches the requested AP to be the BSP from that point onward.
|
||||
This service changes the BSP for all purposes. This call can only be performed
|
||||
@ -829,6 +822,7 @@ CpuMpServicesSwitchBSP (
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT (Index != gMPSystem.NumberOfProcessors);
|
||||
|
||||
gThread->MutexLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||
@ -836,6 +830,7 @@ CpuMpServicesSwitchBSP (
|
||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
|
||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||
|
||||
// Skip for now as we need switch a bunch of stack stuff around and it's complex
|
||||
@ -843,7 +838,6 @@ CpuMpServicesSwitchBSP (
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This service lets the caller enable or disable an AP from this point onward.
|
||||
This service may only be called from the BSP.
|
||||
@ -911,17 +905,20 @@ CpuMpServicesEnableDisableAP (
|
||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||
|
||||
if (EnableAP) {
|
||||
if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0 ) {
|
||||
gMPSystem.NumberOfEnabledProcessors++;
|
||||
}
|
||||
|
||||
gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag |= PROCESSOR_ENABLED_BIT;
|
||||
} else {
|
||||
if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == PROCESSOR_ENABLED_BIT ) {
|
||||
gMPSystem.NumberOfEnabledProcessors--;
|
||||
}
|
||||
|
||||
gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag &= ~PROCESSOR_ENABLED_BIT;
|
||||
}
|
||||
|
||||
@ -933,7 +930,6 @@ CpuMpServicesEnableDisableAP (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This return the handle number for the calling processor. This service may be
|
||||
called from the BSP and APs.
|
||||
@ -983,8 +979,6 @@ CpuMpServicesWhoAmI (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate = {
|
||||
CpuMpServicesGetNumberOfProcessors,
|
||||
CpuMpServicesGetProcessorInfo,
|
||||
@ -995,8 +989,6 @@ EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate = {
|
||||
CpuMpServicesWhoAmI
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*++
|
||||
If timeout occurs in StartupAllAps(), a timer is set, which invokes this
|
||||
procedure periodically to check whether all APs have finished.
|
||||
@ -1041,9 +1033,10 @@ CpuCheckAllAPsStatus (
|
||||
// So, try lock it. If we can get it, cool, do our thing.
|
||||
// otherwise, just dump out & try again on the next iteration.
|
||||
Status = gThread->MutexTryLock (ProcessorData->StateLock);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessorState = ProcessorData->State;
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
|
||||
@ -1073,7 +1066,7 @@ CpuCheckAllAPsStatus (
|
||||
}
|
||||
}
|
||||
|
||||
if (gMPSystem.TimeoutActive && gMPSystem.Timeout == 0) {
|
||||
if (gMPSystem.TimeoutActive && (gMPSystem.Timeout == 0)) {
|
||||
//
|
||||
// Timeout
|
||||
//
|
||||
@ -1092,9 +1085,10 @@ CpuCheckAllAPsStatus (
|
||||
|
||||
// Mark the
|
||||
Status = gThread->MutexTryLock (ProcessorData->StateLock);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessorState = ProcessorData->State;
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
|
||||
@ -1104,17 +1098,20 @@ CpuCheckAllAPsStatus (
|
||||
if (gMPSystem.FailedList[Cpu] == END_OF_CPU_LIST) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (gMPSystem.FailedList[ProcessorNumber] == Cpu) {
|
||||
Found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Found) {
|
||||
gMPSystem.FailedList[gMPSystem.FailedListIndex++] = Cpu;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Force terminal exit
|
||||
gMPSystem.FinishCount = gMPSystem.StartCount;
|
||||
}
|
||||
@ -1138,7 +1135,7 @@ CpuCheckAllAPsStatus (
|
||||
|
||||
Status = gBS->SignalEvent (gMPSystem.WaitEvent);
|
||||
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
VOID
|
||||
@ -1152,7 +1149,7 @@ CpuCheckThisAPStatus (
|
||||
PROCESSOR_DATA_BLOCK *ProcessorData;
|
||||
PROCESSOR_STATE ProcessorState;
|
||||
|
||||
ProcessorData = (PROCESSOR_DATA_BLOCK *) Context;
|
||||
ProcessorData = (PROCESSOR_DATA_BLOCK *)Context;
|
||||
|
||||
//
|
||||
// This is an Interrupt Service routine.
|
||||
@ -1162,9 +1159,10 @@ CpuCheckThisAPStatus (
|
||||
// otherwise, just dump out & try again on the next iteration.
|
||||
//
|
||||
Status = gThread->MutexTryLock (ProcessorData->StateLock);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessorState = ProcessorData->State;
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
|
||||
@ -1180,10 +1178,9 @@ CpuCheckThisAPStatus (
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
}
|
||||
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
This function is called by all processors (both BSP and AP) once and collects MP related data
|
||||
|
||||
@ -1205,7 +1202,7 @@ FillInProcessorInformation (
|
||||
gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag |= PROCESSOR_AS_BSP_BIT;
|
||||
}
|
||||
|
||||
gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Package = (UINT32) ProcessorNumber;
|
||||
gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Package = (UINT32)ProcessorNumber;
|
||||
gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Core = 0;
|
||||
gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Thread = 0;
|
||||
gMPSystem.ProcessorData[ProcessorNumber].State = BSP ? CPU_STATE_BUSY : CPU_STATE_IDLE;
|
||||
@ -1267,7 +1264,6 @@ CpuDriverApIdolLoop (
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
InitializeMpSystemData (
|
||||
IN UINTN NumberOfProcessors
|
||||
@ -1276,7 +1272,6 @@ InitializeMpSystemData (
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
|
||||
|
||||
//
|
||||
// Clear the data structure area first.
|
||||
//
|
||||
@ -1302,7 +1297,6 @@ InitializeMpSystemData (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
for (Index = 0; Index < gMPSystem.NumberOfProcessors; Index++) {
|
||||
if ((gMPSystem.ProcessorData[Index].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
|
||||
// Skip BSP
|
||||
@ -1318,12 +1312,11 @@ InitializeMpSystemData (
|
||||
(VOID *)Index
|
||||
);
|
||||
|
||||
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_TIMER | EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
CpuCheckThisAPStatus,
|
||||
(VOID *) &gMPSystem.ProcessorData[Index],
|
||||
(VOID *)&gMPSystem.ProcessorData[Index],
|
||||
&gMPSystem.ProcessorData[Index].CheckThisAPEvent
|
||||
);
|
||||
}
|
||||
@ -1331,8 +1324,6 @@ InitializeMpSystemData (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Invoke a notification event
|
||||
|
||||
@ -1351,8 +1342,6 @@ CpuReadToBootFunction (
|
||||
gReadToBoot = TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
CpuMpServicesInit (
|
||||
OUT UINTN *MaxCpus
|
||||
@ -1379,7 +1368,7 @@ CpuMpServicesInit (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
gPollInterval = (UINTN) PcdGet64 (PcdEmuMpServicesPollingInterval);
|
||||
gPollInterval = (UINTN)PcdGet64 (PcdEmuMpServicesPollingInterval);
|
||||
|
||||
Status = InitializeMpSystemData (*MaxCpus);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -1395,10 +1384,9 @@ CpuMpServicesInit (
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Handle,
|
||||
&gEfiMpServiceProtocolGuid, &mMpServicesTemplate,
|
||||
&gEfiMpServiceProtocolGuid,
|
||||
&mMpServicesTemplate,
|
||||
NULL
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@ Abstract:
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
@ -63,7 +64,6 @@ EmuBlockIoComponentNameGetDriverName (
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
@ -155,15 +155,14 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gEmuBlockIoCompon
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuBlockIoComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmuBlockIoComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmuBlockIoComponentNameGetControllerName,
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)EmuBlockIoComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)EmuBlockIoComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
EFI_UNICODE_STRING_TABLE mEmuBlockIoDriverNameTable[] = {
|
||||
{ "eng;en", L"Emu Block I/O Driver" },
|
||||
{ NULL , NULL }
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -310,6 +309,7 @@ EmuBlockIoComponentNameGetControllerName (
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Make sure this driver is currently managing ControllerHandle
|
||||
//
|
||||
@ -321,6 +321,7 @@ EmuBlockIoComponentNameGetControllerName (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Get our context back
|
||||
//
|
||||
|
@ -129,7 +129,7 @@ EmuBlockIoDriverConfigurationSetOptions (
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (ActionRequired == NULL || ControllerHandle == NULL) {
|
||||
if ((ActionRequired == NULL) || (ControllerHandle == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ EmuBlockIoDriverConfigurationForceDefaults (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (ActionRequired == NULL || ControllerHandle == NULL) {
|
||||
if ((ActionRequired == NULL) || (ControllerHandle == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ EFI_DRIVER_DIAGNOSTICS_PROTOCOL gEmuBlockIoDriverDiagnostics = {
|
||||
// EFI Driver Diagnostics 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_DRIVER_DIAGNOSTICS2_PROTOCOL gEmuBlockIoDriverDiagnostics2 = {
|
||||
(EFI_DRIVER_DIAGNOSTICS2_RUN_DIAGNOSTICS) EmuBlockIoDriverDiagnosticsRunDiagnostics,
|
||||
(EFI_DRIVER_DIAGNOSTICS2_RUN_DIAGNOSTICS)EmuBlockIoDriverDiagnosticsRunDiagnostics,
|
||||
"en"
|
||||
};
|
||||
|
||||
@ -57,6 +57,7 @@ EmuBlockIoDriverDiagnosticsRunDiagnostics (
|
||||
OUT UINTN *BufferSize,
|
||||
OUT CHAR16 **Buffer
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -124,12 +125,12 @@ EmuBlockIoDriverDiagnosticsRunDiagnostics (
|
||||
BOOLEAN Found;
|
||||
UINTN Index;
|
||||
|
||||
if (Language == NULL ||
|
||||
ErrorType == NULL ||
|
||||
Buffer == NULL ||
|
||||
ControllerHandle == NULL ||
|
||||
BufferSize == NULL) {
|
||||
|
||||
if ((Language == NULL) ||
|
||||
(ErrorType == NULL) ||
|
||||
(Buffer == NULL) ||
|
||||
(ControllerHandle == NULL) ||
|
||||
(BufferSize == NULL))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -145,17 +146,23 @@ EmuBlockIoDriverDiagnosticsRunDiagnostics (
|
||||
Found = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
SupportedLanguages += 3;
|
||||
} else {
|
||||
for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);
|
||||
if ((AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) && (Language[Index] == 0)) {
|
||||
for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++) {
|
||||
}
|
||||
|
||||
if ((AsciiStrnCmp (SupportedLanguages, Language, Index) == 0) && (Language[Index] == 0)) {
|
||||
Found = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
SupportedLanguages += Index;
|
||||
for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);
|
||||
for ( ; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED
|
||||
//
|
||||
@ -168,7 +175,7 @@ EmuBlockIoDriverDiagnosticsRunDiagnostics (
|
||||
if (DiagnosticType != EfiDriverDiagnosticTypeStandard) {
|
||||
*ErrorType = &gEfiBlockIoProtocolGuid;
|
||||
*BufferSize = 0x60;
|
||||
Buffer = AllocatePool ((UINTN) (*BufferSize));
|
||||
Buffer = AllocatePool ((UINTN)(*BufferSize));
|
||||
CopyMem (*Buffer, L"Windows Block I/O Driver Diagnostics Failed\n", *BufferSize);
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ bbe
|
||||
|
||||
#include "EmuBlockIo.h"
|
||||
|
||||
|
||||
/**
|
||||
Reset the block device hardware.
|
||||
|
||||
@ -100,7 +99,6 @@ EmuBlockIo2ReadBlocksEx (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Write BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@ -157,8 +155,6 @@ EmuBlockIo2WriteBlocksEx (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Flush the Block Device.
|
||||
|
||||
@ -202,8 +198,6 @@ EmuBlockIo2Flush (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Reset the Block Device.
|
||||
|
||||
@ -236,7 +230,6 @@ EmuBlockIoReset (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@ -282,7 +275,6 @@ EmuBlockIoReadBlocks (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Write BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@ -361,8 +353,6 @@ EmuBlockIoFlushBlocks (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Tests to see if this driver supports a given controller. If a child device is provided,
|
||||
it further tests to see if this driver supports creating a handle for the specified child device.
|
||||
@ -451,7 +441,6 @@ EmuBlockIoDriverBindingSupported (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Starts a device controller or a bus controller.
|
||||
|
||||
@ -573,8 +562,10 @@ EmuBlockIoDriverBindingStart (
|
||||
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Handle,
|
||||
&gEfiBlockIoProtocolGuid, &Private->BlockIo,
|
||||
&gEfiBlockIo2ProtocolGuid, &Private->BlockIo2,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
&Private->BlockIo,
|
||||
&gEfiBlockIo2ProtocolGuid,
|
||||
&Private->BlockIo2,
|
||||
NULL
|
||||
);
|
||||
|
||||
@ -586,7 +577,6 @@ Done:
|
||||
}
|
||||
|
||||
gBS->FreePool (Private);
|
||||
|
||||
}
|
||||
|
||||
gBS->CloseProtocol (
|
||||
@ -600,7 +590,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Stops a device controller or a bus controller.
|
||||
|
||||
@ -659,8 +648,10 @@ EmuBlockIoDriverBindingStop (
|
||||
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
Private->EfiHandle,
|
||||
&gEfiBlockIoProtocolGuid, &Private->BlockIo,
|
||||
&gEfiBlockIo2ProtocolGuid, &Private->BlockIo2,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
&Private->BlockIo,
|
||||
&gEfiBlockIo2ProtocolGuid,
|
||||
&Private->BlockIo2,
|
||||
NULL
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
@ -686,10 +677,6 @@ EmuBlockIoDriverBindingStop (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gEmuBlockIoDriverBinding = {
|
||||
EmuBlockIoDriverBindingSupported,
|
||||
EmuBlockIoDriverBindingStart,
|
||||
@ -699,9 +686,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuBlockIoDriverBinding = {
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
The user Entry Point for module EmuBlockIo . The user code starts with this function.
|
||||
|
||||
@ -735,9 +719,5 @@ InitializeEmuBlockIo (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -38,7 +38,6 @@ Abstract:
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
|
||||
|
||||
//
|
||||
// Language supported for driverconfiguration protocol
|
||||
//
|
||||
@ -55,7 +54,6 @@ typedef struct {
|
||||
EFI_BLOCK_IO_MEDIA Media;
|
||||
|
||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||
|
||||
} EMU_BLOCK_IO_PRIVATE;
|
||||
|
||||
#define EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
|
||||
@ -64,7 +62,6 @@ typedef struct {
|
||||
#define EMU_BLOCK_IO2_PRIVATE_DATA_FROM_THIS(a) \
|
||||
CR(a, EMU_BLOCK_IO_PRIVATE, BlockIo2, EMU_BLOCK_IO_PRIVATE_SIGNATURE)
|
||||
|
||||
|
||||
//
|
||||
// Block I/O Global Variables
|
||||
//
|
||||
|
@ -41,14 +41,14 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gEmuBusDriverCompo
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuBusDriverComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmuBusDriverComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmuBusDriverComponentNameGetControllerName,
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)EmuBusDriverComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)EmuBusDriverComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mEmuBusDriverNameTable[] = {
|
||||
{ "eng", L"Emu Bus Driver" },
|
||||
{ NULL , NULL }
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -223,7 +223,7 @@ EmuBusDriverComponentNameGetControllerName (
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandle,
|
||||
&gEmuIoThunkProtocolGuid,
|
||||
(VOID**)&EmuIo,
|
||||
(VOID **)&EmuIo,
|
||||
gEmuBusDriverBinding.DriverBindingHandle,
|
||||
ChildHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
|
@ -10,8 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include "EmuBusDriverDxe.h"
|
||||
|
||||
|
||||
|
||||
//
|
||||
// DriverBinding protocol global
|
||||
//
|
||||
@ -24,8 +22,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuBusDriverBinding = {
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuBusDriverBindingSupported (
|
||||
@ -52,9 +48,10 @@ EmuBusDriverBindingSupported (
|
||||
// If RemainingDevicePath isn't the End of Device Path Node,
|
||||
// check its validation
|
||||
//
|
||||
if (RemainingDevicePath->Type != HARDWARE_DEVICE_PATH ||
|
||||
RemainingDevicePath->SubType != HW_VENDOR_DP ||
|
||||
DevicePathNodeLength(RemainingDevicePath) != sizeof(EMU_VENDOR_DEVICE_PATH_NODE)) {
|
||||
if ((RemainingDevicePath->Type != HARDWARE_DEVICE_PATH) ||
|
||||
(RemainingDevicePath->SubType != HW_VENDOR_DP) ||
|
||||
(DevicePathNodeLength (RemainingDevicePath) != sizeof (EMU_VENDOR_DEVICE_PATH_NODE)))
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
@ -66,7 +63,7 @@ EmuBusDriverBindingSupported (
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEmuThunkProtocolGuid,
|
||||
(VOID **)&EmuThunk ,
|
||||
(VOID **)&EmuThunk,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
@ -108,7 +105,6 @@ EmuBusDriverBindingSupported (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Close protocol, don't use device path protocol in the Support() function
|
||||
//
|
||||
@ -122,7 +118,6 @@ EmuBusDriverBindingSupported (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuBusDriverBindingStart (
|
||||
@ -156,7 +151,7 @@ EmuBusDriverBindingStart (
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
|
||||
if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -168,7 +163,7 @@ EmuBusDriverBindingStart (
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
|
||||
if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -196,10 +191,10 @@ EmuBusDriverBindingStart (
|
||||
FALSE
|
||||
);
|
||||
|
||||
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&ControllerHandle,
|
||||
&gEfiCallerIdGuid, EmuBusDevice,
|
||||
&gEfiCallerIdGuid,
|
||||
EmuBusDevice,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -209,7 +204,6 @@ EmuBusDriverBindingStart (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (Status = EFI_SUCCESS, EmuIoThunk = NULL; !EFI_ERROR (Status); ) {
|
||||
Status = EmuThunk->GetNextProtocol (TRUE, &EmuIoThunk);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -228,12 +222,13 @@ EmuBusDriverBindingStart (
|
||||
// If RemainingDevicePath isn't the End of Device Path Node,
|
||||
// check its validation
|
||||
//
|
||||
Node = (EMU_VENDOR_DEVICE_PATH_NODE *) RemainingDevicePath;
|
||||
if (Node->VendorDevicePath.Header.Type == HARDWARE_DEVICE_PATH &&
|
||||
Node->VendorDevicePath.Header.SubType == HW_VENDOR_DP &&
|
||||
DevicePathNodeLength (&Node->VendorDevicePath.Header) == sizeof (EMU_VENDOR_DEVICE_PATH_NODE)
|
||||
) {
|
||||
if (CompareGuid (&Node->VendorDevicePath.Guid, EmuIoThunk->Protocol) && Node->Instance == EmuIoThunk->Instance) {
|
||||
Node = (EMU_VENDOR_DEVICE_PATH_NODE *)RemainingDevicePath;
|
||||
if ((Node->VendorDevicePath.Header.Type == HARDWARE_DEVICE_PATH) &&
|
||||
(Node->VendorDevicePath.Header.SubType == HW_VENDOR_DP) &&
|
||||
(DevicePathNodeLength (&Node->VendorDevicePath.Header) == sizeof (EMU_VENDOR_DEVICE_PATH_NODE))
|
||||
)
|
||||
{
|
||||
if (CompareGuid (&Node->VendorDevicePath.Guid, EmuIoThunk->Protocol) && (Node->Instance == EmuIoThunk->Instance)) {
|
||||
CreateDevice = TRUE;
|
||||
}
|
||||
}
|
||||
@ -284,8 +279,10 @@ EmuBusDriverBindingStart (
|
||||
|
||||
InstallStatus = gBS->InstallMultipleProtocolInterfaces (
|
||||
&EmuDevice->Handle,
|
||||
&gEfiDevicePathProtocolGuid, EmuDevice->DevicePath,
|
||||
&gEmuIoThunkProtocolGuid, &EmuDevice->EmuIoThunk,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
EmuDevice->DevicePath,
|
||||
&gEmuIoThunkProtocolGuid,
|
||||
&EmuDevice->EmuIoThunk,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (InstallStatus)) {
|
||||
@ -298,7 +295,7 @@ EmuBusDriverBindingStart (
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEmuThunkProtocolGuid,
|
||||
(VOID **)&EmuThunk ,
|
||||
(VOID **)&EmuThunk,
|
||||
This->DriverBindingHandle,
|
||||
EmuDevice->Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
@ -313,7 +310,6 @@ EmuBusDriverBindingStart (
|
||||
return InstallStatus;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuBusDriverBindingStop (
|
||||
@ -354,7 +350,8 @@ EmuBusDriverBindingStop (
|
||||
|
||||
gBS->UninstallMultipleProtocolInterfaces (
|
||||
ControllerHandle,
|
||||
&gEfiCallerIdGuid, EmuBusDevice,
|
||||
&gEfiCallerIdGuid,
|
||||
EmuBusDevice,
|
||||
NULL
|
||||
);
|
||||
|
||||
@ -381,7 +378,6 @@ EmuBusDriverBindingStop (
|
||||
AllChildrenStopped = TRUE;
|
||||
|
||||
for (Index = 0; Index < NumberOfChildren; Index++) {
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandleBuffer[Index],
|
||||
&gEmuIoThunkProtocolGuid,
|
||||
@ -402,8 +398,10 @@ EmuBusDriverBindingStop (
|
||||
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
EmuDevice->Handle,
|
||||
&gEfiDevicePathProtocolGuid, EmuDevice->DevicePath,
|
||||
&gEmuIoThunkProtocolGuid, &EmuDevice->EmuIoThunk,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
EmuDevice->DevicePath,
|
||||
&gEmuIoThunkProtocolGuid,
|
||||
&EmuDevice->EmuIoThunk,
|
||||
NULL
|
||||
);
|
||||
|
||||
@ -411,7 +409,7 @@ EmuBusDriverBindingStop (
|
||||
gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEmuThunkProtocolGuid,
|
||||
(VOID **) &EmuThunk ,
|
||||
(VOID **)&EmuThunk,
|
||||
This->DriverBindingHandle,
|
||||
EmuDevice->Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
@ -437,7 +435,6 @@ EmuBusDriverBindingStop (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -483,12 +480,10 @@ EmuBusCreateDevicePath (
|
||||
|
||||
return AppendDevicePathNode (
|
||||
RootDevicePath,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &DevicePath
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&DevicePath
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
The user Entry Point for module EmuBusDriver. The user code starts with this function.
|
||||
|
||||
@ -519,10 +514,5 @@ InitializeEmuBusDriver (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -29,7 +29,6 @@ extern EFI_DRIVER_BINDING_PROTOCOL gEmuBusDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gEmuBusDriverComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gEmuBusDriverComponentName2;
|
||||
|
||||
|
||||
//
|
||||
// Unix Bus Controller Structure
|
||||
//
|
||||
@ -58,14 +57,11 @@ typedef struct {
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
|
||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||
|
||||
} EMU_IO_DEVICE;
|
||||
|
||||
#define EMU_IO_DEVICE_FROM_THIS(a) \
|
||||
CR(a, EMU_IO_DEVICE, EmuIoThunk, EMU_IO_DEVICE_SIGNATURE)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Driver Binding Protocol function prototypes
|
||||
//
|
||||
@ -77,7 +73,6 @@ EmuBusDriverBindingSupported (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuBusDriverBindingStart (
|
||||
@ -86,7 +81,6 @@ EmuBusDriverBindingStart (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuBusDriverBindingStop (
|
||||
@ -106,5 +100,4 @@ EmuBusCreateDevicePath (
|
||||
IN UINT16 InstanceNumber
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -48,18 +48,16 @@ EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName = {
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmuGopComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmuGopComponentNameGetControllerName,
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)EmuGopComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)EmuGopComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
EFI_UNICODE_STRING_TABLE mEmuGopDriverNameTable[] = {
|
||||
{ "eng", L"Emulator GOP Driver" },
|
||||
{ NULL , NULL }
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
@ -116,7 +114,6 @@ EmuGopComponentNameGetDriverName (
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
@ -217,6 +214,7 @@ EmuGopComponentNameGetControllerName (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Get our context back
|
||||
//
|
||||
|
@ -29,7 +29,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/KeyMapLib.h>
|
||||
|
||||
|
||||
#define MAX_Q 256
|
||||
|
||||
typedef struct {
|
||||
@ -58,8 +57,6 @@ typedef struct {
|
||||
UINT32 RefreshRate;
|
||||
} GOP_MODE_DATA;
|
||||
|
||||
|
||||
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName;
|
||||
|
||||
@ -85,7 +82,6 @@ typedef struct {
|
||||
//
|
||||
GOP_MODE_DATA *ModeData;
|
||||
|
||||
|
||||
//
|
||||
// UGA Private Data knowing when to start hardware
|
||||
//
|
||||
@ -100,7 +96,6 @@ typedef struct {
|
||||
LIST_ENTRY NotifyList;
|
||||
} GOP_PRIVATE_DATA;
|
||||
|
||||
|
||||
#define GOP_PRIVATE_DATA_FROM_THIS(a) \
|
||||
CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
|
||||
|
||||
@ -113,7 +108,6 @@ typedef struct {
|
||||
#define GOP_PRIVATE_DATA_FROM_POINTER_MODE_THIS(a) \
|
||||
CR(a, GOP_PRIVATE_DATA, SimplePointer, GOP_PRIVATE_DATA_SIGNATURE)
|
||||
|
||||
|
||||
//
|
||||
// Global Protocol Variables
|
||||
//
|
||||
@ -139,7 +133,6 @@ EmuGopDestructor (
|
||||
IN GOP_PRIVATE_DATA *Private
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
GopPrivateAddQ (
|
||||
IN GOP_PRIVATE_DATA *Private,
|
||||
|
@ -9,11 +9,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include "Gop.h"
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
FreeNotifyList (
|
||||
IN OUT LIST_ENTRY *ListHead
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -34,6 +34,7 @@ Returns:
|
||||
if (ListHead == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
while (!IsListEmpty (ListHead)) {
|
||||
NotifyNode = CR (
|
||||
ListHead->ForwardLink,
|
||||
@ -48,7 +49,6 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Tests to see if this driver supports a given controller. If a child device is provided,
|
||||
it further tests to see if this driver supports creating a handle for the specified child device.
|
||||
@ -132,7 +132,6 @@ EmuGopDriverBindingSupported (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Starts a device controller or a bus controller.
|
||||
|
||||
@ -207,6 +206,7 @@ EmuGopDriverBindingStart (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
// Set up context record
|
||||
//
|
||||
@ -234,21 +234,25 @@ EmuGopDriverBindingStart (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
// Publish the Gop interface to the world
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Private->Handle,
|
||||
&gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput,
|
||||
&gEfiSimpleTextInProtocolGuid, &Private->SimpleTextIn,
|
||||
&gEfiSimplePointerProtocolGuid, &Private->SimplePointer,
|
||||
&gEfiSimpleTextInputExProtocolGuid, &Private->SimpleTextInEx,
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
&Private->GraphicsOutput,
|
||||
&gEfiSimpleTextInProtocolGuid,
|
||||
&Private->SimpleTextIn,
|
||||
&gEfiSimplePointerProtocolGuid,
|
||||
&Private->SimplePointer,
|
||||
&gEfiSimpleTextInputExProtocolGuid,
|
||||
&Private->SimpleTextInEx,
|
||||
NULL
|
||||
);
|
||||
|
||||
Done:
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
||||
gBS->CloseProtocol (
|
||||
Handle,
|
||||
&gEmuIoThunkProtocolGuid,
|
||||
@ -263,12 +267,15 @@ Done:
|
||||
if (Private->ControllerNameTable != NULL) {
|
||||
FreeUnicodeStringTable (Private->ControllerNameTable);
|
||||
}
|
||||
|
||||
if (Private->SimpleTextIn.WaitForKey != NULL) {
|
||||
gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
|
||||
}
|
||||
|
||||
if (Private->SimpleTextInEx.WaitForKeyEx != NULL) {
|
||||
gBS->CloseEvent (Private->SimpleTextInEx.WaitForKeyEx);
|
||||
}
|
||||
|
||||
FreeNotifyList (&Private->NotifyList);
|
||||
|
||||
gBS->FreePool (Private);
|
||||
@ -278,8 +285,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Stops a device controller or a bus controller.
|
||||
|
||||
@ -344,10 +349,14 @@ EmuGopDriverBindingStop (
|
||||
//
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
Private->Handle,
|
||||
&gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput,
|
||||
&gEfiSimpleTextInProtocolGuid, &Private->SimpleTextIn,
|
||||
&gEfiSimplePointerProtocolGuid, &Private->SimplePointer,
|
||||
&gEfiSimpleTextInputExProtocolGuid, &Private->SimpleTextInEx,
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
&Private->GraphicsOutput,
|
||||
&gEfiSimpleTextInProtocolGuid,
|
||||
&Private->SimpleTextIn,
|
||||
&gEfiSimplePointerProtocolGuid,
|
||||
&Private->SimplePointer,
|
||||
&gEfiSimpleTextInputExProtocolGuid,
|
||||
&Private->SimpleTextInEx,
|
||||
NULL
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
@ -380,13 +389,11 @@ EmuGopDriverBindingStop (
|
||||
FreeNotifyList (&Private->NotifyList);
|
||||
|
||||
gBS->FreePool (Private);
|
||||
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// This protocol provides the services required to determine if a driver supports a given controller.
|
||||
/// If a controller is supported, then it also provides routines to start and stop the controller.
|
||||
@ -400,8 +407,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding = {
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
The user Entry Point for module EmuGop. The user code starts with this function.
|
||||
|
||||
@ -431,7 +436,5 @@ InitializeEmuGop (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include "Gop.h"
|
||||
|
||||
|
||||
BOOLEAN
|
||||
GopPrivateIsKeyRegistered (
|
||||
IN EFI_KEY_DATA *RegsiteredData,
|
||||
IN EFI_KEY_DATA *InputData
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -35,27 +35,29 @@ Returns:
|
||||
ASSERT (RegsiteredData != NULL && InputData != NULL);
|
||||
|
||||
if ((RegsiteredData->Key.ScanCode != InputData->Key.ScanCode) ||
|
||||
(RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar)) {
|
||||
(RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// Assume KeyShiftState/KeyToggleState = 0 in Registered key data means these state could be ignored.
|
||||
//
|
||||
if (RegsiteredData->KeyState.KeyShiftState != 0 &&
|
||||
RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState) {
|
||||
if ((RegsiteredData->KeyState.KeyShiftState != 0) &&
|
||||
(RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (RegsiteredData->KeyState.KeyToggleState != 0 &&
|
||||
RegsiteredData->KeyState.KeyToggleState != InputData->KeyState.KeyToggleState) {
|
||||
|
||||
if ((RegsiteredData->KeyState.KeyToggleState != 0) &&
|
||||
(RegsiteredData->KeyState.KeyToggleState != InputData->KeyState.KeyToggleState))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GopPrivateMakeCallbackFunction (
|
||||
@ -84,7 +86,6 @@ GopPrivateMakeCallbackFunction (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GopPrivateBreakCallbackFunction (
|
||||
@ -95,8 +96,6 @@ GopPrivateBreakCallbackFunction (
|
||||
KeyMapBreak (KeyData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Simple Text In implementation.
|
||||
//
|
||||
@ -135,8 +134,8 @@ EmuGopSimpleTextInReset (
|
||||
//
|
||||
// A reset is draining the Queue
|
||||
//
|
||||
while (Private->EmuGraphicsWindow->GetKey (Private->EmuGraphicsWindow, &KeyData) == EFI_SUCCESS)
|
||||
;
|
||||
while (Private->EmuGraphicsWindow->GetKey (Private->EmuGraphicsWindow, &KeyData) == EFI_SUCCESS) {
|
||||
}
|
||||
|
||||
//
|
||||
// Leave critical section and return
|
||||
@ -145,7 +144,6 @@ EmuGopSimpleTextInReset (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reads the next keystroke from the input device. The WaitForKey Event can
|
||||
be used to test for existence of a keystroke via WaitForEvent () call.
|
||||
@ -200,8 +198,6 @@ EmuGopSimpleTextInReadKeyStroke (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
SimpleTextIn and SimpleTextInEx Notify Wait Event
|
||||
|
||||
@ -220,7 +216,7 @@ EmuGopSimpleTextInWaitForKey (
|
||||
EFI_STATUS Status;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
Private = (GOP_PRIVATE_DATA *) Context;
|
||||
Private = (GOP_PRIVATE_DATA *)Context;
|
||||
if (Private->EmuGraphicsWindow == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -237,18 +233,17 @@ EmuGopSimpleTextInWaitForKey (
|
||||
//
|
||||
gBS->SignalEvent (Event);
|
||||
}
|
||||
|
||||
//
|
||||
// Leave critical section and return
|
||||
//
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Simple Text Input Ex protocol functions
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
The Reset() function resets the input device hardware. As part
|
||||
of initialization process, the firmware/device will make a quick
|
||||
@ -280,6 +275,7 @@ EmuGopSimpleTextInExResetEx (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -297,8 +293,6 @@ EmuGopSimpleTextInExResetEx (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
The function reads the next keystroke from the input device. If
|
||||
there is no pending keystroke the function returns
|
||||
@ -354,6 +348,7 @@ EmuGopSimpleTextInExReadKeyStrokeEx (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||
OUT EFI_KEY_DATA *KeyData
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -378,7 +373,6 @@ EmuGopSimpleTextInExReadKeyStrokeEx (
|
||||
GOP_PRIVATE_DATA *Private;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
|
||||
if (KeyData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
@ -393,7 +387,7 @@ EmuGopSimpleTextInExReadKeyStrokeEx (
|
||||
//
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
|
||||
Status = Private->EmuGraphicsWindow->GetKey(Private->EmuGraphicsWindow, KeyData);
|
||||
Status = Private->EmuGraphicsWindow->GetKey (Private->EmuGraphicsWindow, KeyData);
|
||||
|
||||
//
|
||||
// Leave critical section and return
|
||||
@ -403,8 +397,6 @@ EmuGopSimpleTextInExReadKeyStrokeEx (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
The SetState() function allows the input device hardware to
|
||||
have state settings adjusted.
|
||||
@ -446,7 +438,8 @@ EmuGopSimpleTextInExSetState (
|
||||
}
|
||||
|
||||
if (((Private->KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID) ||
|
||||
((*KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID)) {
|
||||
((*KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID))
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@ -464,7 +457,6 @@ EmuGopSimpleTextInExSetState (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
SimpleTextIn and SimpleTextInEx Notify Wait Event
|
||||
|
||||
@ -484,8 +476,6 @@ EmuGopRegisterKeyCallback (
|
||||
ExNotify->KeyNotificationFn (&ExNotify->KeyData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
The RegisterKeystrokeNotify() function registers a function
|
||||
which will be called when a specified keystroke will occur.
|
||||
@ -526,7 +516,7 @@ EmuGopSimpleTextInExRegisterKeyNotify (
|
||||
LIST_ENTRY *Link;
|
||||
EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NewNotify;
|
||||
|
||||
if (KeyData == NULL || KeyNotificationFunction == NULL || NotifyHandle == NULL) {
|
||||
if ((KeyData == NULL) || (KeyNotificationFunction == NULL) || (NotifyHandle == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -553,14 +543,14 @@ EmuGopSimpleTextInExRegisterKeyNotify (
|
||||
//
|
||||
// Allocate resource to save the notification function
|
||||
//
|
||||
NewNotify = (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *) AllocateZeroPool (sizeof (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY));
|
||||
NewNotify = (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *)AllocateZeroPool (sizeof (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY));
|
||||
if (NewNotify == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
NewNotify->Signature = EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE;
|
||||
NewNotify->KeyNotificationFn = KeyNotificationFunction;
|
||||
NewNotify->NotifyHandle = (EFI_HANDLE) NewNotify;
|
||||
NewNotify->NotifyHandle = (EFI_HANDLE)NewNotify;
|
||||
CopyMem (&NewNotify->KeyData, KeyData, sizeof (KeyData));
|
||||
InsertTailList (&Private->NotifyList, &NewNotify->NotifyEntry);
|
||||
|
||||
@ -573,14 +563,11 @@ EmuGopSimpleTextInExRegisterKeyNotify (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
*NotifyHandle = NewNotify->NotifyHandle;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
The UnregisterKeystrokeNotify() function removes the
|
||||
notification which was previously registered.
|
||||
@ -602,6 +589,7 @@ EmuGopSimpleTextInExUnregisterKeyNotify (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||
IN VOID *NotificationHandle
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -625,7 +613,7 @@ EmuGopSimpleTextInExUnregisterKeyNotify (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (((EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *) NotificationHandle)->Signature != EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE) {
|
||||
if (((EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *)NotificationHandle)->Signature != EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -657,8 +645,6 @@ EmuGopSimpleTextInExUnregisterKeyNotify (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Initialize SimplelTextIn and SimpleTextInEx protocols in the Private
|
||||
context structure.
|
||||
@ -690,7 +676,6 @@ EmuGopInitializeSimpleTextInForWindow (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
//
|
||||
// Initialize Simple Text In Ex
|
||||
//
|
||||
@ -714,21 +699,13 @@ EmuGopInitializeSimpleTextInForWindow (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Simple Pointer implementation.
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
Resets the pointer device hardware.
|
||||
|
||||
@ -765,8 +742,8 @@ EmuGopSimplePointerReset (
|
||||
//
|
||||
// A reset is draining the Queue
|
||||
//
|
||||
while (Private->EmuGraphicsWindow->GetPointerState (Private->EmuGraphicsWindow, &State) == EFI_SUCCESS)
|
||||
;
|
||||
while (Private->EmuGraphicsWindow->GetPointerState (Private->EmuGraphicsWindow, &State) == EFI_SUCCESS) {
|
||||
}
|
||||
|
||||
//
|
||||
// Leave critical section and return
|
||||
@ -775,7 +752,6 @@ EmuGopSimplePointerReset (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves the current state of a pointer device.
|
||||
|
||||
@ -820,7 +796,6 @@ EmuGopSimplePointerGetState (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
SimplePointer Notify Wait Event
|
||||
|
||||
@ -839,7 +814,7 @@ EmuGopSimplePointerWaitForInput (
|
||||
EFI_STATUS Status;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
Private = (GOP_PRIVATE_DATA *) Context;
|
||||
Private = (GOP_PRIVATE_DATA *)Context;
|
||||
if (Private->EmuGraphicsWindow == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -856,13 +831,13 @@ EmuGopSimplePointerWaitForInput (
|
||||
//
|
||||
gBS->SignalEvent (Event);
|
||||
}
|
||||
|
||||
//
|
||||
// Leave critical section and return
|
||||
//
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
SimplePointer constructor
|
||||
|
||||
|
@ -18,17 +18,15 @@ Abstract:
|
||||
|
||||
#include "Gop.h"
|
||||
|
||||
|
||||
EFI_EVENT mGopScreenExitBootServicesEvent;
|
||||
|
||||
GOP_MODE_DATA mGopModeData[] = {
|
||||
{ 800, 600, 0, 0 },
|
||||
{ 640, 480, 0, 0 },
|
||||
{ 720, 400, 0, 0 },
|
||||
{1024, 768, 0, 0 },
|
||||
{1280, 1024, 0, 0 }
|
||||
};
|
||||
|
||||
{ 1024, 768, 0, 0 },
|
||||
{ 1280, 1024, 0, 0 }
|
||||
};
|
||||
|
||||
/**
|
||||
Returns information for an available graphics mode that the graphics device
|
||||
@ -59,7 +57,7 @@ EmuGopQuerytMode (
|
||||
|
||||
Private = GOP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
if (Info == NULL || SizeOfInfo == NULL || (UINTN) ModeNumber >= This->Mode->MaxMode) {
|
||||
if ((Info == NULL) || (SizeOfInfo == NULL) || ((UINTN)ModeNumber >= This->Mode->MaxMode)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -79,8 +77,6 @@ EmuGopQuerytMode (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Set the video device into the specified mode and clears the visible portions of
|
||||
the output display to black.
|
||||
@ -132,14 +128,12 @@ EmuGopSetMode (
|
||||
Private->HardwareNeedsStarting = FALSE;
|
||||
}
|
||||
|
||||
|
||||
Status = Private->EmuGraphicsWindow->Size(
|
||||
Status = Private->EmuGraphicsWindow->Size (
|
||||
Private->EmuGraphicsWindow,
|
||||
ModeData->HorizontalResolution,
|
||||
ModeData->VerticalResolution
|
||||
);
|
||||
|
||||
|
||||
Fill.Red = 0;
|
||||
Fill.Green = 0;
|
||||
Fill.Blue = 0;
|
||||
@ -158,8 +152,6 @@ EmuGopSetMode (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.
|
||||
|
||||
@ -206,9 +198,10 @@ EmuGopBlt (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Width == 0 || Height == 0) {
|
||||
if ((Width == 0) || (Height == 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// If Delta is zero, then the entire BltBuffer is being used, so Delta
|
||||
// is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size,
|
||||
@ -248,7 +241,6 @@ EmuGopBlt (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Construction and Destruction functions
|
||||
//
|
||||
@ -270,7 +262,6 @@ EmuGopSupported (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuGopStartWindow (
|
||||
IN GOP_PRIVATE_DATA *Private,
|
||||
@ -306,6 +297,7 @@ EmuGopStartWindow (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -327,12 +319,13 @@ EmuGopConstructor (
|
||||
if (Private->GraphicsOutput.Mode == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Private->GraphicsOutput.Mode->Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
|
||||
if (Private->GraphicsOutput.Mode->Info == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Private->GraphicsOutput.Mode->MaxMode = sizeof(mGopModeData) / sizeof(GOP_MODE_DATA);
|
||||
Private->GraphicsOutput.Mode->MaxMode = sizeof (mGopModeData) / sizeof (GOP_MODE_DATA);
|
||||
//
|
||||
// Till now, we have no idea about the window size.
|
||||
//
|
||||
@ -342,7 +335,7 @@ EmuGopConstructor (
|
||||
Private->GraphicsOutput.Mode->Info->VerticalResolution = 0;
|
||||
Private->GraphicsOutput.Mode->Info->PixelFormat = PixelBltOnly;
|
||||
Private->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
|
||||
Private->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL;
|
||||
Private->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS)(UINTN)NULL;
|
||||
Private->GraphicsOutput.Mode->FrameBufferSize = 0;
|
||||
|
||||
Private->HardwareNeedsStarting = TRUE;
|
||||
@ -355,8 +348,6 @@ EmuGopConstructor (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuGopDestructor (
|
||||
GOP_PRIVATE_DATA *Private
|
||||
@ -374,19 +365,20 @@ EmuGopDestructor (
|
||||
if (Private->GraphicsOutput.Mode->Info != NULL) {
|
||||
FreePool (Private->GraphicsOutput.Mode->Info);
|
||||
}
|
||||
|
||||
FreePool (Private->GraphicsOutput.Mode);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
ShutdownGopEvent (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
@ -110,7 +110,6 @@ EmuSimpleFileSystemComponentNameGetDriverName (
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
@ -211,13 +210,14 @@ EmuSimpleFileSystemComponentNameGetControllerName (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Get our context back
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleFileSystemProtocolGuid,
|
||||
(VOID**)&SimpleFileSystem,
|
||||
(VOID **)&SimpleFileSystem,
|
||||
gEmuSimpleFileSystemDriverBinding.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
|
@ -12,9 +12,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include "EmuSimpleFileSystem.h"
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Opens a new file relative to the source file's location.
|
||||
|
||||
@ -53,7 +50,7 @@ EmuSimpleFileSystemOpen (
|
||||
//
|
||||
// Check for obvious invalid parameters.
|
||||
//
|
||||
if (This == NULL || NewHandle == NULL || FileName == NULL) {
|
||||
if ((This == NULL) || (NewHandle == NULL) || (FileName == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -88,7 +85,6 @@ EmuSimpleFileSystemOpen (
|
||||
goto Done;
|
||||
}
|
||||
|
||||
|
||||
Status = PrivateFile->Io->Open (PrivateFile->Io, &NewPrivateFile->Io, FileName, OpenMode, Attributes);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
*NewHandle = &NewPrivateFile->EfiFile;
|
||||
@ -103,8 +99,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Close the file handle
|
||||
|
||||
@ -141,7 +135,6 @@ EmuSimpleFileSystemClose (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Close and delete the file handle.
|
||||
|
||||
@ -179,7 +172,6 @@ EmuSimpleFileSystemDelete (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read data from the file.
|
||||
|
||||
@ -206,7 +198,7 @@ EmuSimpleFileSystemRead (
|
||||
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
if (This == NULL || BufferSize == NULL) {
|
||||
if ((This == NULL) || (BufferSize == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -225,7 +217,6 @@ EmuSimpleFileSystemRead (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Write data to a file.
|
||||
|
||||
@ -256,7 +247,7 @@ EmuSimpleFileSystemWrite (
|
||||
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
if (This == NULL || BufferSize == NULL || Buffer == NULL) {
|
||||
if ((This == NULL) || (BufferSize == NULL) || (Buffer == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -270,7 +261,6 @@ EmuSimpleFileSystemWrite (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get a file's current position
|
||||
|
||||
@ -292,7 +282,7 @@ EmuSimpleFileSystemGetPosition (
|
||||
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
if (This == NULL || Position == NULL) {
|
||||
if ((This == NULL) || (Position == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -306,8 +296,6 @@ EmuSimpleFileSystemGetPosition (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Set file's current position
|
||||
|
||||
@ -343,7 +331,6 @@ EmuSimpleFileSystemSetPosition (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get information about a file.
|
||||
|
||||
@ -375,7 +362,7 @@ EmuSimpleFileSystemGetInfo (
|
||||
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
if (This == NULL || InformationType == NULL || BufferSize == NULL) {
|
||||
if ((This == NULL) || (InformationType == NULL) || (BufferSize == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -389,7 +376,6 @@ EmuSimpleFileSystemGetInfo (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set information about a file
|
||||
|
||||
@ -410,7 +396,7 @@ EmuSimpleFileSystemGetInfo (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSimpleFileSystemSetInfo (
|
||||
IN EFI_FILE_PROTOCOL*This,
|
||||
IN EFI_FILE_PROTOCOL *This,
|
||||
IN EFI_GUID *InformationType,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
@ -423,7 +409,7 @@ EmuSimpleFileSystemSetInfo (
|
||||
//
|
||||
// Check for invalid parameters.
|
||||
//
|
||||
if (This == NULL || InformationType == NULL || BufferSize == 0 || Buffer == NULL) {
|
||||
if ((This == NULL) || (InformationType == NULL) || (BufferSize == 0) || (Buffer == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -437,7 +423,6 @@ EmuSimpleFileSystemSetInfo (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Flush data back for the file handle.
|
||||
|
||||
@ -477,8 +462,6 @@ EmuSimpleFileSystemFlush (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Open the root directory on a volume.
|
||||
|
||||
@ -508,7 +491,7 @@ EmuSimpleFileSystemOpenVolume (
|
||||
|
||||
Status = EFI_UNSUPPORTED;
|
||||
|
||||
if (This == NULL || Root == NULL) {
|
||||
if ((This == NULL) || (Root == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -562,7 +545,6 @@ EmuSimpleFileSystemOpenVolume (
|
||||
FALSE
|
||||
);
|
||||
|
||||
|
||||
Done:
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (PrivateFile) {
|
||||
@ -666,8 +648,6 @@ EmuSimpleFileSystemDriverBindingSupported (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Starts a device controller or a bus controller.
|
||||
|
||||
@ -778,7 +758,8 @@ EmuSimpleFileSystemDriverBindingStart (
|
||||
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&ControllerHandle,
|
||||
&gEfiSimpleFileSystemProtocolGuid, &Private->SimpleFileSystem,
|
||||
&gEfiSimpleFileSystemProtocolGuid,
|
||||
&Private->SimpleFileSystem,
|
||||
NULL
|
||||
);
|
||||
|
||||
@ -790,7 +771,6 @@ Done:
|
||||
}
|
||||
|
||||
gBS->FreePool (Private);
|
||||
|
||||
}
|
||||
|
||||
gBS->CloseProtocol (
|
||||
@ -804,7 +784,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Stops a device controller or a bus controller.
|
||||
|
||||
@ -866,7 +845,8 @@ EmuSimpleFileSystemDriverBindingStop (
|
||||
//
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleFileSystemProtocolGuid, &Private->SimpleFileSystem,
|
||||
&gEfiSimpleFileSystemProtocolGuid,
|
||||
&Private->SimpleFileSystem,
|
||||
NULL
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
@ -892,7 +872,6 @@ EmuSimpleFileSystemDriverBindingStop (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gEmuSimpleFileSystemDriverBinding = {
|
||||
EmuSimpleFileSystemDriverBindingSupported,
|
||||
EmuSimpleFileSystemDriverBindingStart,
|
||||
@ -902,9 +881,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuSimpleFileSystemDriverBinding = {
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
The user Entry Point for module EmuSimpleFileSystem. The user code starts with this function.
|
||||
|
||||
@ -917,7 +893,7 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuSimpleFileSystemDriverBinding = {
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeEmuSimpleFileSystem(
|
||||
InitializeEmuSimpleFileSystem (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
|
@ -30,7 +30,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
|
||||
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gEmuSimpleFileSystemDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gEmuSimpleFileSystemComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gEmuSimpleFileSystemComponentName2;
|
||||
@ -69,6 +68,4 @@ typedef struct {
|
||||
EMU_EFI_FILE_PRIVATE_SIGNATURE \
|
||||
)
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -17,6 +17,7 @@ Abstract:
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
@ -64,7 +65,6 @@ EmuSnpDriverComponentNameGetDriverName (
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
@ -143,7 +143,6 @@ EmuSnpDriverComponentNameGetControllerName (
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
@ -157,12 +156,11 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gEmuSnpDriverComponen
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuSnpDriverComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmuSnpDriverComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmuSnpDriverComponentNameGetControllerName,
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)EmuSnpDriverComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)EmuSnpDriverComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mEmuSnpDriverNameTable[] = {
|
||||
{
|
||||
"eng;en",
|
||||
|
@ -15,8 +15,6 @@ Abstract:
|
||||
|
||||
#include "EmuSnpDxe.h"
|
||||
|
||||
|
||||
|
||||
EFI_SIMPLE_NETWORK_PROTOCOL gEmuSnpTemplate = {
|
||||
EFI_SIMPLE_NETWORK_PROTOCOL_REVISION,
|
||||
EmuSnpStart,
|
||||
@ -34,7 +32,7 @@ EFI_SIMPLE_NETWORK_PROTOCOL gEmuSnpTemplate = {
|
||||
EmuSnpReceive,
|
||||
NULL, // WaitForPacket
|
||||
NULL // Mode
|
||||
};
|
||||
};
|
||||
|
||||
EFI_SIMPLE_NETWORK_MODE gEmuSnpModeTemplate = {
|
||||
EfiSimpleNetworkStopped, // State
|
||||
@ -48,7 +46,9 @@ EFI_SIMPLE_NETWORK_MODE gEmuSnpModeTemplate = {
|
||||
MAX_MCAST_FILTER_CNT, // MaxMCastFilterCount
|
||||
0, // MCastFilterCount
|
||||
{
|
||||
{ { 0 } }
|
||||
{
|
||||
{ 0 }
|
||||
}
|
||||
}, // MCastFilter
|
||||
{
|
||||
{ 0 }
|
||||
@ -66,7 +66,6 @@ EFI_SIMPLE_NETWORK_MODE gEmuSnpModeTemplate = {
|
||||
TRUE // MediaPresent
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Changes the state of a network interface from "stopped" to "started".
|
||||
|
||||
@ -77,7 +76,7 @@ EFI_SIMPLE_NETWORK_MODE gEmuSnpModeTemplate = {
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpStart(
|
||||
EmuSnpStart (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This
|
||||
)
|
||||
{
|
||||
@ -90,7 +89,6 @@ EmuSnpStart(
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Changes the state of a network interface from "started" to "stopped".
|
||||
|
||||
@ -114,7 +112,6 @@ EmuSnpStop (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Resets a network adapter and allocates the transmit and receive buffers
|
||||
required by the network interface; optionally, also requests allocation
|
||||
@ -354,7 +351,6 @@ EmuSnpMcastIptoMac (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Performs read and write operations on the NVRAM device attached to a
|
||||
network interface.
|
||||
@ -390,7 +386,6 @@ EmuSnpNvdata (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reads the current interrupt status and recycled transmit buffer status from
|
||||
a network interface.
|
||||
@ -429,7 +424,6 @@ EmuSnpGetStatus (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Places a packet in the transmit queue of a network interface.
|
||||
|
||||
@ -466,7 +460,7 @@ EmuSnpTransmit (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
|
||||
IN UINTN HeaderSize,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID* Buffer,
|
||||
IN VOID *Buffer,
|
||||
IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
|
||||
IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,
|
||||
IN UINT16 *Protocol OPTIONAL
|
||||
@ -548,8 +542,6 @@ EmuSnpReceive (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Test to see if this driver supports ControllerHandle. This service
|
||||
is called by the EFI boot service ConnectController(). In
|
||||
@ -583,15 +575,15 @@ EmuSnpDriverBindingSupported (
|
||||
if (RemainingDevicePath != NULL) {
|
||||
if (!IsDevicePathEnd (RemainingDevicePath)) {
|
||||
Node = (MAC_ADDR_DEVICE_PATH *)RemainingDevicePath;
|
||||
if (Node->Header.Type != MESSAGING_DEVICE_PATH ||
|
||||
Node->Header.SubType != MSG_MAC_ADDR_DP) {
|
||||
if ((Node->Header.Type != MESSAGING_DEVICE_PATH) ||
|
||||
(Node->Header.SubType != MSG_MAC_ADDR_DP))
|
||||
{
|
||||
// If the remaining device path does not match we don't support the request
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Open the IO Abstraction(s) needed to perform the supported test
|
||||
//
|
||||
@ -617,14 +609,13 @@ EmuSnpDriverBindingSupported (
|
||||
ControllerHandle
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Open the EFI Device Path protocol needed to perform the supported test
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &ParentDevicePath,
|
||||
(VOID **)&ParentDevicePath,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
@ -658,7 +649,6 @@ EmuSnpDriverBindingSupported (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Start this driver on ControllerHandle. This service is called by the
|
||||
EFI boot service ConnectController(). In order to make
|
||||
@ -694,10 +684,10 @@ EmuSnpDriverBindingStart (
|
||||
//
|
||||
// Grab the protocols we need
|
||||
//
|
||||
Status = gBS->OpenProtocol(
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
( VOID ** ) &ParentDevicePath,
|
||||
(VOID **)&ParentDevicePath,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
@ -747,7 +737,6 @@ EmuSnpDriverBindingStart (
|
||||
Private->Snp.Mode = &Private->Mode;
|
||||
Private->ControllerNameTable = NULL;
|
||||
|
||||
|
||||
Status = Private->Io->CreateMapping (Private->Io, &Private->Mode);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
@ -763,7 +752,7 @@ EmuSnpDriverBindingStart (
|
||||
Node.Header.SubType = MSG_MAC_ADDR_DP;
|
||||
Node.IfType = Private->Mode.IfType;
|
||||
|
||||
SetDevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL * )&Node, sizeof (MAC_ADDR_DEVICE_PATH));
|
||||
SetDevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *)&Node, sizeof (MAC_ADDR_DEVICE_PATH));
|
||||
|
||||
CopyMem (&Node.MacAddress, &Private->Mode.CurrentAddress, sizeof (EFI_MAC_ADDRESS));
|
||||
|
||||
@ -795,10 +784,12 @@ EmuSnpDriverBindingStart (
|
||||
//
|
||||
// Create Child Handle
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces(
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Private->DeviceHandle,
|
||||
&gEfiSimpleNetworkProtocolGuid, &Private->Snp,
|
||||
&gEfiDevicePathProtocolGuid, Private->DevicePath,
|
||||
&gEfiSimpleNetworkProtocolGuid,
|
||||
&Private->Snp,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
Private->DevicePath,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -822,8 +813,9 @@ Done:
|
||||
if (Private != NULL) {
|
||||
FreePool (Private);
|
||||
}
|
||||
|
||||
if (ParentDevicePath != NULL) {
|
||||
gBS->CloseProtocol(
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
@ -892,14 +884,13 @@ EmuSnpDriverBindingStop (
|
||||
|
||||
ASSERT (NumberOfChildren == 1);
|
||||
|
||||
|
||||
//
|
||||
// Get our context back.
|
||||
//
|
||||
Status = gBS->OpenProtocol(
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandleBuffer[0],
|
||||
&gEfiSimpleNetworkProtocolGuid,
|
||||
( VOID ** ) &Snp,
|
||||
(VOID **)&Snp,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@ -912,7 +903,7 @@ EmuSnpDriverBindingStop (
|
||||
ASSERT (Private->DeviceHandle == ChildHandleBuffer[0]);
|
||||
ASSERT (Private->EfiHandle == ControllerHandle);
|
||||
|
||||
Status = gBS->CloseProtocol(
|
||||
Status = gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEmuIoThunkProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
@ -920,10 +911,12 @@ EmuSnpDriverBindingStop (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces(
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
Private->DeviceHandle,
|
||||
&gEfiSimpleNetworkProtocolGuid, &Private->Snp,
|
||||
&gEfiDevicePathProtocolGuid, Private->DevicePath,
|
||||
&gEfiSimpleNetworkProtocolGuid,
|
||||
&Private->Snp,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
Private->DevicePath,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -947,7 +940,6 @@ EmuSnpDriverBindingStop (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gEmuSnpDriverBinding = {
|
||||
EmuSnpDriverBindingSupported,
|
||||
EmuSnpDriverBindingStart,
|
||||
@ -957,8 +949,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuSnpDriverBinding = {
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
This is the declaration of an EFI image entry point. This entry point is
|
||||
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
|
||||
@ -983,7 +973,7 @@ InitializeEmuSnpDriver (
|
||||
//
|
||||
// Install the Driver Protocols
|
||||
//
|
||||
Status = EfiLibInstallDriverBindingComponentName2(
|
||||
Status = EfiLibInstallDriverBindingComponentName2 (
|
||||
ImageHandle,
|
||||
SystemTable,
|
||||
&gEmuSnpDriverBinding,
|
||||
|
@ -22,7 +22,6 @@ Abstract:
|
||||
#include <Protocol/EmuIoThunk.h>
|
||||
#include <Protocol/EmuSnp.h>
|
||||
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
@ -52,7 +51,6 @@ typedef struct {
|
||||
EFI_SIMPLE_NETWORK_MODE Mode;
|
||||
|
||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||
|
||||
} EMU_SNP_PRIVATE_DATA;
|
||||
|
||||
#define EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS(a) \
|
||||
@ -82,9 +80,9 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gEmuSnpDriverComponentName2;
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL * This,
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@ -106,9 +104,9 @@ EmuSnpDriverBindingSupported (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL * This,
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@ -147,8 +145,8 @@ EmuSnpDriverBindingStop (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpStart(
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL* This
|
||||
EmuSnpStart (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This
|
||||
);
|
||||
|
||||
/**
|
||||
@ -161,8 +159,8 @@ EmuSnpStart(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpStop(
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL* This
|
||||
EmuSnpStop (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This
|
||||
);
|
||||
|
||||
/**
|
||||
@ -187,8 +185,8 @@ EmuSnpStop(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpInitialize(
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
|
||||
EmuSnpInitialize (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
|
||||
IN UINTN ExtraRxBufferSize OPTIONAL,
|
||||
IN UINTN ExtraTxBufferSize OPTIONAL
|
||||
);
|
||||
@ -207,8 +205,8 @@ EmuSnpInitialize(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpReset(
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
|
||||
EmuSnpReset (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
@ -223,8 +221,8 @@ EmuSnpReset(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpShutdown(
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL* This
|
||||
EmuSnpShutdown (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This
|
||||
);
|
||||
|
||||
/**
|
||||
@ -250,13 +248,13 @@ EmuSnpShutdown(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpReceiveFilters(
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
|
||||
EmuSnpReceiveFilters (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
|
||||
IN UINT32 EnableBits,
|
||||
IN UINT32 DisableBits,
|
||||
IN BOOLEAN ResetMcastFilter,
|
||||
IN UINTN McastFilterCount OPTIONAL,
|
||||
IN EFI_MAC_ADDRESS* McastFilter OPTIONAL
|
||||
IN EFI_MAC_ADDRESS *McastFilter OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@ -272,10 +270,10 @@ EmuSnpReceiveFilters(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpStationAddress(
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
|
||||
EmuSnpStationAddress (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
|
||||
IN BOOLEAN Reset,
|
||||
IN EFI_MAC_ADDRESS* NewMacAddr OPTIONAL
|
||||
IN EFI_MAC_ADDRESS *NewMacAddr OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@ -299,11 +297,11 @@ EmuSnpStationAddress(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpStatistics(
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
|
||||
EmuSnpStatistics (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
|
||||
IN BOOLEAN Reset,
|
||||
IN OUT UINTN* StatisticsSize OPTIONAL,
|
||||
OUT EFI_NETWORK_STATISTICS* StatisticsTable OPTIONAL
|
||||
IN OUT UINTN *StatisticsSize OPTIONAL,
|
||||
OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@ -327,11 +325,11 @@ EmuSnpStatistics(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpMcastIptoMac(
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
|
||||
EmuSnpMcastIptoMac (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
|
||||
IN BOOLEAN Ipv6,
|
||||
IN EFI_IP_ADDRESS* Ip,
|
||||
OUT EFI_MAC_ADDRESS* Mac
|
||||
IN EFI_IP_ADDRESS *Ip,
|
||||
OUT EFI_MAC_ADDRESS *Mac
|
||||
);
|
||||
|
||||
/**
|
||||
@ -352,12 +350,12 @@ EmuSnpMcastIptoMac(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpNvdata(
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
|
||||
EmuSnpNvdata (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
|
||||
IN BOOLEAN ReadOrWrite,
|
||||
IN UINTN Offset,
|
||||
IN UINTN BufferSize,
|
||||
IN OUT VOID* Buffer
|
||||
IN OUT VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
@ -383,10 +381,10 @@ EmuSnpNvdata(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpGetStatus(
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
|
||||
OUT UINT32* InterruptStatus,
|
||||
OUT VOID** TxBuffer
|
||||
EmuSnpGetStatus (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
|
||||
OUT UINT32 *InterruptStatus,
|
||||
OUT VOID **TxBuffer
|
||||
);
|
||||
|
||||
/**
|
||||
@ -420,14 +418,14 @@ EmuSnpGetStatus(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpTransmit(
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
|
||||
EmuSnpTransmit (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
|
||||
IN UINTN HeaderSize,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID* Buffer,
|
||||
IN EFI_MAC_ADDRESS* SrcAddr OPTIONAL,
|
||||
IN EFI_MAC_ADDRESS* DestAddr OPTIONAL,
|
||||
IN UINT16* Protocol OPTIONAL
|
||||
IN VOID *Buffer,
|
||||
IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
|
||||
IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,
|
||||
IN UINT16 *Protocol OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@ -462,21 +460,21 @@ EmuSnpTransmit(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuSnpReceive(
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
|
||||
OUT UINTN* HeaderSize OPTIONAL,
|
||||
IN OUT UINTN* BuffSize,
|
||||
OUT VOID* Buffer,
|
||||
OUT EFI_MAC_ADDRESS* SourceAddr OPTIONAL,
|
||||
OUT EFI_MAC_ADDRESS* DestinationAddr OPTIONAL,
|
||||
OUT UINT16* Protocol OPTIONAL
|
||||
EmuSnpReceive (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
|
||||
OUT UINTN *HeaderSize OPTIONAL,
|
||||
IN OUT UINTN *BuffSize,
|
||||
OUT VOID *Buffer,
|
||||
OUT EFI_MAC_ADDRESS *SourceAddr OPTIONAL,
|
||||
OUT EFI_MAC_ADDRESS *DestinationAddr OPTIONAL,
|
||||
OUT UINT16 *Protocol OPTIONAL
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
EmuSnpWaitForPacketNotify(
|
||||
EmuSnpWaitForPacketNotify (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID* Private
|
||||
IN VOID *Private
|
||||
);
|
||||
|
||||
#endif // _EMU_SNP_H_
|
||||
|
@ -29,8 +29,8 @@ EMU_THUNK_DEVICE_PATH mEmuThunkDevicePath = {
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
{
|
||||
(UINT8) (sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8) ((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
|
||||
(UINT8)(sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8)((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
|
||||
}
|
||||
},
|
||||
EMU_THUNK_PROTOCOL_GUID
|
||||
@ -47,13 +47,13 @@ EMU_THUNK_DEVICE_PATH mEmuThunkDevicePath = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeEmuThunk (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -74,8 +74,10 @@ Returns:
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Handle,
|
||||
&gEmuThunkProtocolGuid, gEmuThunk,
|
||||
&gEfiDevicePathProtocolGuid, &mEmuThunkDevicePath,
|
||||
&gEmuThunkProtocolGuid,
|
||||
gEmuThunk,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
&mEmuThunkDevicePath,
|
||||
NULL
|
||||
);
|
||||
|
||||
|
@ -21,6 +21,7 @@ PeimInitializeFirmwareVolumePei (
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -67,7 +68,7 @@ Returns:
|
||||
//
|
||||
// Assume the FD starts with an FV header
|
||||
//
|
||||
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) FdBase;
|
||||
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)FdBase;
|
||||
|
||||
//
|
||||
// Make an FV Hob for the first FV in the FD
|
||||
|
@ -7,7 +7,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "PiPei.h"
|
||||
|
||||
#include <Guid/SystemNvDataGuid.h>
|
||||
@ -27,6 +26,7 @@ PeimInitializeFlashMap (
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
@ -67,14 +67,13 @@ EFI_FW_VOL_BLOCK_DEVICE mFvbDeviceTemplate = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
FvbVirtualddressChangeEvent (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -100,7 +99,7 @@ Returns:
|
||||
EFI_FW_VOL_INSTANCE *FwhInstance;
|
||||
UINTN Index;
|
||||
|
||||
EfiConvertPointer (0x0, (VOID **) &mFvbModuleGlobal->FvInstance[FVB_VIRTUAL]);
|
||||
EfiConvertPointer (0x0, (VOID **)&mFvbModuleGlobal->FvInstance[FVB_VIRTUAL]);
|
||||
|
||||
//
|
||||
// Convert the base address of all the instances
|
||||
@ -108,16 +107,16 @@ Returns:
|
||||
Index = 0;
|
||||
FwhInstance = mFvbModuleGlobal->FvInstance[FVB_PHYSICAL];
|
||||
while (Index < mFvbModuleGlobal->NumFv) {
|
||||
EfiConvertPointer (0x0, (VOID **) &FwhInstance->FvBase[FVB_VIRTUAL]);
|
||||
EfiConvertPointer (0x0, (VOID **)&FwhInstance->FvBase[FVB_VIRTUAL]);
|
||||
FwhInstance = (EFI_FW_VOL_INSTANCE *)
|
||||
(
|
||||
(UINTN) ((UINT8 *) FwhInstance) + FwhInstance->VolumeHeader.HeaderLength +
|
||||
(UINTN)((UINT8 *)FwhInstance) + FwhInstance->VolumeHeader.HeaderLength +
|
||||
(sizeof (EFI_FW_VOL_INSTANCE) - sizeof (EFI_FIRMWARE_VOLUME_HEADER))
|
||||
);
|
||||
Index++;
|
||||
}
|
||||
|
||||
EfiConvertPointer (0x0, (VOID **) &mFvbModuleGlobal);
|
||||
EfiConvertPointer (0x0, (VOID **)&mFvbModuleGlobal);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
@ -127,6 +126,7 @@ GetFvbInstance (
|
||||
OUT EFI_FW_VOL_INSTANCE **FwhInstance,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -151,6 +151,7 @@ Returns:
|
||||
if (Instance >= Global->NumFv) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Find the right instance of the FVB private data
|
||||
//
|
||||
@ -158,7 +159,7 @@ Returns:
|
||||
while (Instance > 0) {
|
||||
FwhRecord = (EFI_FW_VOL_INSTANCE *)
|
||||
(
|
||||
(UINTN) ((UINT8 *) FwhRecord) + FwhRecord->VolumeHeader.HeaderLength +
|
||||
(UINTN)((UINT8 *)FwhRecord) + FwhRecord->VolumeHeader.HeaderLength +
|
||||
(sizeof (EFI_FW_VOL_INSTANCE) - sizeof (EFI_FIRMWARE_VOLUME_HEADER))
|
||||
);
|
||||
Instance--;
|
||||
@ -176,6 +177,7 @@ FvbGetPhysicalAddress (
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -217,6 +219,7 @@ FvbGetVolumeAttributes (
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -260,6 +263,7 @@ FvbGetLbaAddress (
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -311,7 +315,7 @@ Returns:
|
||||
NumBlocks = BlockMap->NumBlocks;
|
||||
BlockLength = BlockMap->Length;
|
||||
|
||||
if (NumBlocks == 0 || BlockLength == 0) {
|
||||
if ((NumBlocks == 0) || (BlockLength == 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -320,8 +324,8 @@ Returns:
|
||||
//
|
||||
// The map entry found
|
||||
//
|
||||
if (Lba >= StartLba && Lba < NextLba) {
|
||||
Offset = Offset + (UINTN) MultU64x32 ((Lba - StartLba), BlockLength);
|
||||
if ((Lba >= StartLba) && (Lba < NextLba)) {
|
||||
Offset = Offset + (UINTN)MultU64x32 ((Lba - StartLba), BlockLength);
|
||||
if (LbaAddress != NULL) {
|
||||
*LbaAddress = FwhInstance->FvBase[Virtual] + Offset;
|
||||
}
|
||||
@ -331,7 +335,7 @@ Returns:
|
||||
}
|
||||
|
||||
if (NumOfBlocks != NULL) {
|
||||
*NumOfBlocks = (UINTN) (NextLba - Lba);
|
||||
*NumOfBlocks = (UINTN)(NextLba - Lba);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@ -353,6 +357,7 @@ FvbReadBlock (
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -404,6 +409,7 @@ Returns:
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the FV is read enabled
|
||||
//
|
||||
@ -412,6 +418,7 @@ Returns:
|
||||
if ((Attributes & EFI_FVB2_READ_STATUS) == 0) {
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
//
|
||||
// Perform boundary checks and adjust NumBytes
|
||||
//
|
||||
@ -420,11 +427,11 @@ Returns:
|
||||
}
|
||||
|
||||
if (LbaLength < (*NumBytes + BlockOffset)) {
|
||||
*NumBytes = (UINT32) (LbaLength - BlockOffset);
|
||||
*NumBytes = (UINT32)(LbaLength - BlockOffset);
|
||||
Status = EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
CopyMem (Buffer, (UINT8 *) (LbaAddress + BlockOffset), (UINTN) (*NumBytes));
|
||||
CopyMem (Buffer, (UINT8 *)(LbaAddress + BlockOffset), (UINTN)(*NumBytes));
|
||||
|
||||
return Status;
|
||||
}
|
||||
@ -439,6 +446,7 @@ FvbWriteBlock (
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -489,6 +497,7 @@ Returns:
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the FV is write enabled
|
||||
//
|
||||
@ -497,6 +506,7 @@ Returns:
|
||||
if ((Attributes & EFI_FVB2_WRITE_STATUS) == 0) {
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
//
|
||||
// Perform boundary checks and adjust NumBytes
|
||||
//
|
||||
@ -505,13 +515,14 @@ Returns:
|
||||
}
|
||||
|
||||
if (LbaLength < (*NumBytes + BlockOffset)) {
|
||||
*NumBytes = (UINT32) (LbaLength - BlockOffset);
|
||||
*NumBytes = (UINT32)(LbaLength - BlockOffset);
|
||||
Status = EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
//
|
||||
// Write data
|
||||
//
|
||||
CopyMem ((UINT8 *) (LbaAddress + BlockOffset), Buffer, (UINTN) (*NumBytes));
|
||||
CopyMem ((UINT8 *)(LbaAddress + BlockOffset), Buffer, (UINTN)(*NumBytes));
|
||||
|
||||
return Status;
|
||||
}
|
||||
@ -523,6 +534,7 @@ FvbEraseBlock (
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -545,7 +557,6 @@ Returns:
|
||||
|
||||
**/
|
||||
{
|
||||
|
||||
EFI_FVB_ATTRIBUTES_2 Attributes;
|
||||
UINTN LbaAddress;
|
||||
UINTN LbaLength;
|
||||
@ -560,6 +571,7 @@ Returns:
|
||||
if ((Attributes & EFI_FVB2_WRITE_STATUS) == 0) {
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the starting address of the block for erase.
|
||||
//
|
||||
@ -575,7 +587,7 @@ Returns:
|
||||
Data = 0x0;
|
||||
}
|
||||
|
||||
SetMem ((UINT8 *) LbaAddress, LbaLength, Data);
|
||||
SetMem ((UINT8 *)LbaAddress, LbaLength, Data);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@ -587,6 +599,7 @@ FvbSetVolumeAttributes (
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -622,14 +635,13 @@ Returns:
|
||||
EFI_STATUS Status;
|
||||
EFI_FVB_ATTRIBUTES_2 UnchangedAttributes;
|
||||
|
||||
|
||||
//
|
||||
// Find the right instance of the FVB private data
|
||||
//
|
||||
Status = GetFvbInstance (Instance, Global, &FwhInstance, Virtual);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
AttribPtr = (EFI_FVB_ATTRIBUTES_2 *) &(FwhInstance->VolumeHeader.Attributes);
|
||||
AttribPtr = (EFI_FVB_ATTRIBUTES_2 *)&(FwhInstance->VolumeHeader.Attributes);
|
||||
OldAttributes = *AttribPtr;
|
||||
Capabilities = OldAttributes & (EFI_FVB2_READ_DISABLED_CAP | \
|
||||
EFI_FVB2_READ_ENABLED_CAP | \
|
||||
@ -667,6 +679,7 @@ Returns:
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Test read disable
|
||||
//
|
||||
@ -675,6 +688,7 @@ Returns:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Test read enable
|
||||
//
|
||||
@ -683,6 +697,7 @@ Returns:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Test write disable
|
||||
//
|
||||
@ -691,6 +706,7 @@ Returns:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Test write enable
|
||||
//
|
||||
@ -699,6 +715,7 @@ Returns:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Test lock
|
||||
//
|
||||
@ -714,6 +731,7 @@ Returns:
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// FVB protocol APIs
|
||||
//
|
||||
@ -723,6 +741,7 @@ FvbProtocolGetPhysicalAddress (
|
||||
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
OUT EFI_PHYSICAL_ADDRESS *Address
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -756,6 +775,7 @@ FvbProtocolGetBlockSize (
|
||||
OUT UINTN *BlockSize,
|
||||
OUT UINTN *NumOfBlocks
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -798,6 +818,7 @@ FvbProtocolGetAttributes (
|
||||
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
OUT EFI_FVB_ATTRIBUTES_2 *Attributes
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -825,6 +846,7 @@ FvbProtocolSetAttributes (
|
||||
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -852,6 +874,7 @@ FvbProtocolEraseBlocks (
|
||||
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||
...
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -905,7 +928,7 @@ Returns:
|
||||
//
|
||||
// Check input parameters
|
||||
//
|
||||
if (NumOfLba == 0 || (StartingLba + NumOfLba) > NumOfBlocks) {
|
||||
if ((NumOfLba == 0) || ((StartingLba + NumOfLba) > NumOfBlocks)) {
|
||||
VA_END (args);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
@ -932,7 +955,6 @@ Returns:
|
||||
StartingLba++;
|
||||
NumOfLba--;
|
||||
}
|
||||
|
||||
} while (1);
|
||||
|
||||
VA_END (args);
|
||||
@ -949,6 +971,7 @@ FvbProtocolWrite (
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN UINT8 *Buffer
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -980,7 +1003,6 @@ Returns:
|
||||
|
||||
**/
|
||||
{
|
||||
|
||||
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
|
||||
|
||||
FvbDevice = FVB_DEVICE_FROM_THIS (This);
|
||||
@ -997,6 +1019,7 @@ FvbProtocolRead (
|
||||
IN OUT UINTN *NumBytes,
|
||||
IN UINT8 *Buffer
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -1029,17 +1052,18 @@ Returns:
|
||||
|
||||
**/
|
||||
{
|
||||
|
||||
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
|
||||
|
||||
FvbDevice = FVB_DEVICE_FROM_THIS (This);
|
||||
|
||||
return FvbReadBlock (FvbDevice->Instance, Lba, Offset, NumBytes, Buffer, mFvbModuleGlobal, EfiGoneVirtual ());
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ValidateFvHeader (
|
||||
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -1065,16 +1089,18 @@ Returns:
|
||||
//
|
||||
if ((FwVolHeader->Revision != EFI_FVH_REVISION) ||
|
||||
(FwVolHeader->Signature != EFI_FVH_SIGNATURE) ||
|
||||
(FwVolHeader->FvLength == ((UINTN) -1)) ||
|
||||
(FwVolHeader->FvLength == ((UINTN)-1)) ||
|
||||
((FwVolHeader->HeaderLength & 0x01) != 0)
|
||||
) {
|
||||
)
|
||||
{
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// Verify the header checksum
|
||||
//
|
||||
HeaderLength = (UINT16) (FwVolHeader->HeaderLength / 2);
|
||||
Ptr = (UINT16 *) FwVolHeader;
|
||||
HeaderLength = (UINT16)(FwVolHeader->HeaderLength / 2);
|
||||
Ptr = (UINT16 *)FwVolHeader;
|
||||
Checksum = 0;
|
||||
while (HeaderLength > 0) {
|
||||
Checksum = Checksum + (*Ptr);
|
||||
@ -1095,6 +1121,7 @@ FvbInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -1136,7 +1163,7 @@ Returns:
|
||||
Status = gBS->AllocatePool (
|
||||
EfiRuntimeServicesData,
|
||||
sizeof (ESAL_FWB_GLOBAL),
|
||||
(VOID**) &mFvbModuleGlobal
|
||||
(VOID **)&mFvbModuleGlobal
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -1165,7 +1192,7 @@ Returns:
|
||||
continue;
|
||||
}
|
||||
|
||||
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
|
||||
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)BaseAddress;
|
||||
Status = ValidateFvHeader (FwVolHeader);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
@ -1190,7 +1217,7 @@ Returns:
|
||||
Status = gBS->AllocatePool (
|
||||
EfiRuntimeServicesData,
|
||||
BufferSize,
|
||||
(VOID**) &mFvbModuleGlobal->FvInstance[FVB_PHYSICAL]
|
||||
(VOID **)&mFvbModuleGlobal->FvInstance[FVB_PHYSICAL]
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -1223,7 +1250,7 @@ Returns:
|
||||
continue;
|
||||
}
|
||||
|
||||
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
|
||||
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)BaseAddress;
|
||||
Status = ValidateFvHeader (FwVolHeader);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
@ -1234,20 +1261,21 @@ Returns:
|
||||
FvHob.Raw = GET_NEXT_HOB (FvHob);
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Write healthy FV header back.
|
||||
//
|
||||
CopyMem (
|
||||
(VOID *) (UINTN) BaseAddress,
|
||||
(VOID *) FwVolHeader,
|
||||
(VOID *)(UINTN)BaseAddress,
|
||||
(VOID *)FwVolHeader,
|
||||
FwVolHeader->HeaderLength
|
||||
);
|
||||
}
|
||||
|
||||
FwhInstance->FvBase[FVB_PHYSICAL] = (UINTN) BaseAddress;
|
||||
FwhInstance->FvBase[FVB_VIRTUAL] = (UINTN) BaseAddress;
|
||||
FwhInstance->FvBase[FVB_PHYSICAL] = (UINTN)BaseAddress;
|
||||
FwhInstance->FvBase[FVB_VIRTUAL] = (UINTN)BaseAddress;
|
||||
|
||||
CopyMem ((UINTN *) &(FwhInstance->VolumeHeader), (UINTN *) FwVolHeader, FwVolHeader->HeaderLength);
|
||||
CopyMem ((UINTN *)&(FwhInstance->VolumeHeader), (UINTN *)FwVolHeader, FwVolHeader->HeaderLength);
|
||||
FwVolHeader = &(FwhInstance->VolumeHeader);
|
||||
EfiInitializeLock (&(FwhInstance->FvbDevLock), TPL_HIGH_LEVEL);
|
||||
|
||||
@ -1265,6 +1293,7 @@ Returns:
|
||||
|
||||
NumOfBlocks = NumOfBlocks + PtrBlockMapEntry->NumBlocks;
|
||||
}
|
||||
|
||||
//
|
||||
// The total number of blocks in the FV.
|
||||
//
|
||||
@ -1276,7 +1305,7 @@ Returns:
|
||||
Status = gBS->AllocatePool (
|
||||
EfiRuntimeServicesData,
|
||||
sizeof (EFI_FW_VOL_BLOCK_DEVICE),
|
||||
(VOID**) &FvbDevice
|
||||
(VOID **)&FvbDevice
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -1294,7 +1323,7 @@ Returns:
|
||||
//
|
||||
// Find a handle with a matching device path that has supports FW Block protocol
|
||||
//
|
||||
TempFwbDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) &TempFvbDevicePathData;
|
||||
TempFwbDevicePath = (EFI_DEVICE_PATH_PROTOCOL *)&TempFvbDevicePathData;
|
||||
CopyMem (TempFwbDevicePath, &FvbDevice->DevicePath, sizeof (FV_DEVICE_PATH));
|
||||
Status = gBS->LocateDevicePath (&gEfiFirmwareVolumeBlockProtocolGuid, &TempFwbDevicePath, &FwbHandle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -1318,7 +1347,7 @@ Returns:
|
||||
Status = gBS->HandleProtocol (
|
||||
FwbHandle,
|
||||
&gEfiFirmwareVolumeBlockProtocolGuid,
|
||||
(VOID**)&OldFwbInterface
|
||||
(VOID **)&OldFwbInterface
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -1329,7 +1358,6 @@ Returns:
|
||||
&FvbDevice->FwVolBlockInstance
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
} else {
|
||||
//
|
||||
// There was a FVB protocol on an End Device Path node
|
||||
@ -1339,7 +1367,7 @@ Returns:
|
||||
|
||||
FwhInstance = (EFI_FW_VOL_INSTANCE *)
|
||||
(
|
||||
(UINTN) ((UINT8 *) FwhInstance) + FwVolHeader->HeaderLength +
|
||||
(UINTN)((UINT8 *)FwhInstance) + FwVolHeader->HeaderLength +
|
||||
(sizeof (EFI_FW_VOL_INSTANCE) - sizeof (EFI_FIRMWARE_VOLUME_HEADER))
|
||||
);
|
||||
|
||||
|
@ -31,7 +31,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINT64 FvLength;
|
||||
EFI_FIRMWARE_VOLUME_HEADER FvbInfo;
|
||||
|
@ -122,7 +122,6 @@ FvbInitialize (
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
FvbClassAddressChangeEvent (
|
||||
|
@ -13,7 +13,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#define EFI_EMU_SYSTEM_CONFIG_GUID \
|
||||
{ 0x9C4FB516, 0x3A1E, 0xD847, { 0xA1, 0xA1, 0x70, 0x58, 0xB6, 0x98, 0x67, 0x32 } }
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
//
|
||||
@ -24,7 +23,6 @@ typedef struct {
|
||||
} EMU_SYSTEM_CONFIGURATION;
|
||||
#pragma pack()
|
||||
|
||||
|
||||
extern EFI_GUID gEmuSystemConfigGuid;
|
||||
|
||||
#endif
|
||||
|
@ -10,10 +10,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include <Protocol/EmuThunk.h>
|
||||
|
||||
|
||||
extern EMU_THUNK_PROTOCOL *gEmuThunk;
|
||||
|
||||
|
||||
/**
|
||||
Serach the EMU IO Thunk database for a matching EMU IO Thunk
|
||||
Protocol instance.
|
||||
@ -32,5 +30,4 @@ GetIoThunkInstance (
|
||||
IN UINTN Instance
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -7,7 +7,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include <Protocol/SimpleTextInEx.h>
|
||||
|
||||
|
||||
/**
|
||||
KeyMapMake gets called on key presses.
|
||||
|
||||
|
@ -8,8 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#ifndef __PPI_LIST_LIB_H__
|
||||
#define __PPI_LIST_LIB_H__
|
||||
|
||||
|
||||
extern CONST EFI_PEI_PPI_DESCRIPTOR *gPpiList;
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -15,13 +15,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <IndustryStandard/SmBios.h>
|
||||
#include <Protocol/Smbios.h>
|
||||
|
||||
|
||||
///
|
||||
/// Cache copy of the SMBIOS Protocol pointer
|
||||
///
|
||||
extern EFI_SMBIOS_PROTOCOL *gSmbios;
|
||||
|
||||
|
||||
///
|
||||
/// Template for SMBIOS table initialization.
|
||||
/// The SMBIOS_TABLE_STRING types in the formated area must match the
|
||||
@ -38,7 +36,6 @@ typedef struct {
|
||||
CHAR8 **StringArray;
|
||||
} SMBIOS_TEMPLATE_ENTRY;
|
||||
|
||||
|
||||
/**
|
||||
Create an initial SMBIOS Table from an array of SMBIOS_TEMPLATE_ENTRY
|
||||
entries. SMBIOS_TEMPLATE_ENTRY.NULL indicates the end of the table.
|
||||
@ -54,8 +51,6 @@ SmbiosLibInitializeFromTemplate (
|
||||
IN SMBIOS_TEMPLATE_ENTRY *Template
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Create SMBIOS record.
|
||||
|
||||
@ -92,7 +87,6 @@ SmbiosLibCreateEntry (
|
||||
IN CHAR8 **StringArray
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Update the string associated with an existing SMBIOS record.
|
||||
|
||||
@ -155,7 +149,6 @@ SmbiosLibReadString (
|
||||
IN EFI_SMBIOS_STRING StringNumber
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Allow the caller to discover a specific SMBIOS entry, and patch it if necissary.
|
||||
|
||||
@ -190,7 +183,4 @@ SmbiosLibRemove (
|
||||
OUT EFI_SMBIOS_HANDLE SmbiosHandle
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -9,13 +9,11 @@
|
||||
|
||||
#include <PiPei.h>
|
||||
|
||||
|
||||
EFI_PEI_PPI_DESCRIPTOR *
|
||||
GetThunkPpiList (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AddThunkPpi (
|
||||
@ -23,5 +21,3 @@ AddThunkPpi (
|
||||
IN EFI_GUID *Guid,
|
||||
IN VOID *Ppi
|
||||
);
|
||||
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <Uefi.h>
|
||||
#include <Protocol/EmuIoThunk.h>
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AddThunkProtocol (
|
||||
@ -25,5 +24,3 @@ GetNextThunkProtocol (
|
||||
IN BOOLEAN EmuBusDriver,
|
||||
OUT EMU_IO_THUNK_PROTOCOL **Instance
|
||||
);
|
||||
|
||||
|
||||
|
@ -13,8 +13,6 @@
|
||||
#define EMU_THUNK_PPI_GUID \
|
||||
{ 0xB958B78C, 0x1D3E, 0xEE40, { 0x8B, 0xF4, 0xF0, 0x63, 0x2D, 0x06, 0x39, 0x16 } }
|
||||
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -33,13 +31,12 @@ Returns:
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_PEI_AUTOSCAN) (
|
||||
(EFIAPI *EMU_PEI_AUTOSCAN)(
|
||||
IN UINTN Index,
|
||||
OUT EFI_PHYSICAL_ADDRESS *MemoryBase,
|
||||
OUT UINT64 *MemorySize
|
||||
);
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -59,14 +56,13 @@ Returns:
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_PEI_FD_INFORMATION) (
|
||||
(EFIAPI *EMU_PEI_FD_INFORMATION)(
|
||||
IN UINTN Index,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *FdBase,
|
||||
IN OUT UINT64 *FdSize,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *FixUp
|
||||
);
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -78,12 +74,10 @@ Returns:
|
||||
**/
|
||||
typedef
|
||||
VOID *
|
||||
(EFIAPI *EMU_PEI_THUNK_INTERFACE) (
|
||||
(EFIAPI *EMU_PEI_THUNK_INTERFACE)(
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -102,14 +96,13 @@ Returns:
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_PEI_LOAD_FILE) (
|
||||
(EFIAPI *EMU_PEI_LOAD_FILE)(
|
||||
VOID *Pe32Data,
|
||||
EFI_PHYSICAL_ADDRESS *ImageAddress,
|
||||
UINT64 *ImageSize,
|
||||
EFI_PHYSICAL_ADDRESS *EntryPoint
|
||||
);
|
||||
|
||||
|
||||
typedef struct {
|
||||
EMU_PEI_AUTOSCAN MemoryAutoScan;
|
||||
EMU_PEI_FD_INFORMATION FirmwareDevices;
|
||||
|
@ -21,8 +21,6 @@
|
||||
|
||||
typedef struct _EMU_BLOCK_IO_PROTOCOL EMU_BLOCK_IO_PROTOCOL;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Reset the block device hardware.
|
||||
|
||||
@ -38,7 +36,7 @@ typedef struct _EMU_BLOCK_IO_PROTOCOL EMU_BLOCK_IO_PROTOCOL;
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_BLOCK_RESET) (
|
||||
(EFIAPI *EMU_BLOCK_RESET)(
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
@ -78,7 +76,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_BLOCK_READ) (
|
||||
(EFIAPI *EMU_BLOCK_READ)(
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA LBA,
|
||||
@ -120,7 +118,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_BLOCK_WRITE) (
|
||||
(EFIAPI *EMU_BLOCK_WRITE)(
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA LBA,
|
||||
@ -153,20 +151,18 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_BLOCK_FLUSH) (
|
||||
(EFIAPI *EMU_BLOCK_FLUSH)(
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_BLOCK_CREATE_MAPPING) (
|
||||
(EFIAPI *EMU_BLOCK_CREATE_MAPPING)(
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN EFI_BLOCK_IO_MEDIA *Media
|
||||
);
|
||||
|
||||
|
||||
///
|
||||
/// The Block I/O2 protocol defines an extension to the Block I/O protocol which
|
||||
/// enables the ability to read and write data at a block level in a non-blocking
|
||||
@ -183,4 +179,3 @@ struct _EMU_BLOCK_IO_PROTOCOL {
|
||||
extern EFI_GUID gEmuBlockIoProtocolGuid;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -55,28 +55,26 @@ EFI_STATUS
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOWS_KEY_SET_STATE) (
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOWS_KEY_SET_STATE)(
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
|
||||
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK) (
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK)(
|
||||
IN VOID *Context,
|
||||
IN EFI_KEY_DATA *KeyData
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOWS_REGISTER_KEY_NOTIFY) (
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOWS_REGISTER_KEY_NOTIFY)(
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
|
||||
IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK CallBack,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINTN SourceX;
|
||||
UINTN SourceY;
|
||||
@ -98,7 +96,7 @@ EFI_STATUS
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOWS_IS_KEY_PRESSED) (
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOWS_IS_KEY_PRESSED)(
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
|
||||
IN EFI_KEY_DATA *KeyData
|
||||
);
|
||||
@ -128,7 +126,6 @@ struct _EMU_GRAPHICS_WINDOW_PROTOCOL {
|
||||
EMU_GRAPHICS_WINDOWS_GET_POINTER_STATE GetPointerState;
|
||||
};
|
||||
|
||||
|
||||
extern EFI_GUID gEmuGraphicsWindowProtocolGuid;
|
||||
|
||||
#endif
|
||||
|
@ -48,29 +48,27 @@ EFI_STATUS
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOWS_KEY_SET_STATE) (
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOWS_KEY_SET_STATE)(
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
|
||||
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK) (
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK)(
|
||||
IN VOID *Context,
|
||||
IN EFI_KEY_DATA *KeyData
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOWS_REGISTER_KEY_NOTIFY) (
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOWS_REGISTER_KEY_NOTIFY)(
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
|
||||
IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK MakeCallBack,
|
||||
IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK BreakCallBack,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINTN SourceX;
|
||||
UINTN SourceY;
|
||||
@ -92,7 +90,7 @@ EFI_STATUS
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOWS_IS_KEY_PRESSED) (
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOWS_IS_KEY_PRESSED)(
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
|
||||
IN EFI_KEY_DATA *KeyData
|
||||
);
|
||||
@ -122,7 +120,6 @@ struct _EMU_GRAPHICS_WINDOW_PROTOCOL {
|
||||
EMU_GRAPHICS_WINDOWS_GET_POINTER_STATE GetPointerState;
|
||||
};
|
||||
|
||||
|
||||
extern EFI_GUID gEmuGraphicsWindowProtocolGuid;
|
||||
|
||||
#endif
|
||||
|
@ -10,23 +10,20 @@
|
||||
#ifndef __EMU_IO_THUNK__
|
||||
#define __EMU_IO_THUNK__
|
||||
|
||||
|
||||
#define EMU_IO_THUNK_PROTOCO_GUID \
|
||||
{ 0x453368F6, 0x7C85, 0x434A, { 0xA9, 0x8A, 0x72, 0xD1, 0xB7, 0xFF, 0xA9, 0x26 } }
|
||||
|
||||
|
||||
typedef struct _EMU_IO_THUNK_PROTOCOL EMU_IO_THUNK_PROTOCOL;
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_IO_THUNK_PROTOCOL_CLOSE_OPEN) (
|
||||
(EFIAPI *EMU_IO_THUNK_PROTOCOL_CLOSE_OPEN)(
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_IO_THUNK_PROTOCOL_CLOSE_CLOSE) (
|
||||
(EFIAPI *EMU_IO_THUNK_PROTOCOL_CLOSE_CLOSE)(
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
);
|
||||
|
||||
|
@ -19,7 +19,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
typedef struct _EMU_SNP_PROTOCOL EMU_SNP_PROTOCOL;
|
||||
|
||||
|
||||
/**
|
||||
Register storage for SNP Mode.
|
||||
|
||||
@ -37,7 +36,6 @@ EFI_STATUS
|
||||
IN EFI_SIMPLE_NETWORK_MODE *Mode
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Changes the state of a network interface from "stopped" to "started".
|
||||
|
||||
|
@ -11,55 +11,47 @@
|
||||
#ifndef __EMU_THREAD_THUNK__
|
||||
#define __EMU_THREAD_THUNK__
|
||||
|
||||
|
||||
typedef struct _EMU_THREAD_THUNK_PROTOCOL EMU_THREAD_THUNK_PROTOCOL;
|
||||
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_LOCK) (
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_LOCK)(
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_UNLOCK) (
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_UNLOCK)(
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_TRY_LOCK) (
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_TRY_LOCK)(
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
VOID *
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_INIT) (
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_INIT)(
|
||||
IN VOID
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_DISTROY) (
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_DISTROY)(
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
|
||||
typedef
|
||||
VOID *
|
||||
(EFIAPI *THREAD_THUNK_THREAD_ENTRY) (
|
||||
(EFIAPI *THREAD_THUNK_THREAD_ENTRY)(
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *THREAD_THUNK_CREATE_THREAD) (
|
||||
(EFIAPI *THREAD_THUNK_CREATE_THREAD)(
|
||||
IN VOID *Thread,
|
||||
IN VOID *Attribute,
|
||||
IN THREAD_THUNK_THREAD_ENTRY Start,
|
||||
@ -68,18 +60,16 @@ UINTN
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *THREAD_THUNK_EXIT_THREAD) (
|
||||
(EFIAPI *THREAD_THUNK_EXIT_THREAD)(
|
||||
IN VOID *ValuePtr
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *THREAD_THUNK_SELF) (
|
||||
(EFIAPI *THREAD_THUNK_SELF)(
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
struct _EMU_THREAD_THUNK_PROTOCOL {
|
||||
THREAD_THUNK_MUTEX_LOCK MutexLock;
|
||||
THREAD_THUNK_MUTEX_UNLOCK MutexUnlock;
|
||||
@ -94,4 +84,3 @@ struct _EMU_THREAD_THUNK_PROTOCOL {
|
||||
extern EFI_GUID gEmuThreadThunkProtocolGuid;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <Protocol/EmuIoThunk.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH VendorDevicePath;
|
||||
UINT32 Instance;
|
||||
@ -32,155 +31,146 @@ typedef struct {
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} EMU_THUNK_DEVICE_PATH;
|
||||
|
||||
|
||||
|
||||
typedef struct _EMU_THUNK_PROTOCOL EMU_THUNK_PROTOCOL;
|
||||
|
||||
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *EMU_WRITE_STD_ERROR) (
|
||||
(EFIAPI *EMU_WRITE_STD_ERROR)(
|
||||
IN UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_CONFIG_STD_IN) (
|
||||
(EFIAPI *EMU_CONFIG_STD_IN)(
|
||||
VOID
|
||||
);
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *EMU_WRITE_STD_OUT) (
|
||||
(EFIAPI *EMU_WRITE_STD_OUT)(
|
||||
IN UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
);
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *EMU_READ_STD_IN) (
|
||||
(EFIAPI *EMU_READ_STD_IN)(
|
||||
OUT UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EMU_POLL_STD_IN) (
|
||||
(EFIAPI *EMU_POLL_STD_IN)(
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
VOID *
|
||||
(EFIAPI *EMU_OS_MALLOC) (
|
||||
(EFIAPI *EMU_OS_MALLOC)(
|
||||
IN UINTN Size
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID *
|
||||
(EFIAPI *EMU_OS_VMALLOC) (
|
||||
(EFIAPI *EMU_OS_VMALLOC)(
|
||||
IN UINTN Size
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EMU_OS_FREE) (
|
||||
(EFIAPI *EMU_OS_FREE)(
|
||||
IN VOID *Ptr
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_PE_COFF_GET_ENTRY_POINT) (
|
||||
(EFIAPI *EMU_PE_COFF_GET_ENTRY_POINT)(
|
||||
IN VOID *Pe32Data,
|
||||
IN OUT VOID **EntryPoint
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_PE_COFF_RELOCATE_EXTRA_ACTION) (
|
||||
(EFIAPI *EMU_PE_COFF_RELOCATE_EXTRA_ACTION)(
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_PE_COFF_UNLOAD_EXTRA_ACTION) (
|
||||
(EFIAPI *EMU_PE_COFF_UNLOAD_EXTRA_ACTION)(
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_ENABLE_INERRUPTS) (
|
||||
(EFIAPI *EMU_ENABLE_INERRUPTS)(
|
||||
VOID
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_DISABLE_INERRUPTS) (
|
||||
(EFIAPI *EMU_DISABLE_INERRUPTS)(
|
||||
VOID
|
||||
);
|
||||
|
||||
typedef
|
||||
UINT64
|
||||
(EFIAPI *EMU_QUERY_PERFORMANCE_FREQENCY) (
|
||||
(EFIAPI *EMU_QUERY_PERFORMANCE_FREQENCY)(
|
||||
VOID
|
||||
);
|
||||
|
||||
typedef
|
||||
UINT64
|
||||
(EFIAPI *EMU_QUERY_PERFORMANCE_COUNTER) (
|
||||
(EFIAPI *EMU_QUERY_PERFORMANCE_COUNTER)(
|
||||
VOID
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_SLEEP) (
|
||||
(EFIAPI *EMU_SLEEP)(
|
||||
IN UINT64 Milliseconds
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_CPU_SLEEP) (
|
||||
(EFIAPI *EMU_CPU_SLEEP)(
|
||||
VOID
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_EXIT) (
|
||||
(EFIAPI *EMU_EXIT)(
|
||||
IN UINTN Status
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_GET_TIME) (
|
||||
(EFIAPI *EMU_GET_TIME)(
|
||||
OUT EFI_TIME *Time,
|
||||
OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_SET_TIME) (
|
||||
(EFIAPI *EMU_SET_TIME)(
|
||||
IN EFI_TIME *Time
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI EMU_SET_TIMER_CALLBACK) (
|
||||
(EFIAPI EMU_SET_TIMER_CALLBACK)(
|
||||
IN UINT64 DeltaMs
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_SET_TIMER) (
|
||||
(EFIAPI *EMU_SET_TIMER)(
|
||||
IN UINT64 PeriodMs,
|
||||
IN EMU_SET_TIMER_CALLBACK CallBack
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Enumerates the current set of protocol instances that abstract OS services from EFI.
|
||||
|
||||
@ -203,12 +193,11 @@ VOID
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_GET_NEXT_PROTOCOL) (
|
||||
(EFIAPI *EMU_GET_NEXT_PROTOCOL)(
|
||||
IN BOOLEAN EmuBusDriver,
|
||||
OUT EMU_IO_THUNK_PROTOCOL **Instance OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
struct _EMU_THUNK_PROTOCOL {
|
||||
// Used for early debug printing
|
||||
EMU_WRITE_STD_ERROR WriteStdErr;
|
||||
@ -224,7 +213,6 @@ struct _EMU_THUNK_PROTOCOL {
|
||||
EMU_OS_VMALLOC Valloc;
|
||||
EMU_OS_FREE Free;
|
||||
|
||||
|
||||
///
|
||||
/// PE/COFF loader hooks to get symbols loaded
|
||||
///
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
|
||||
|
||||
/**
|
||||
Converts a Vendor device path structure to its string representative.
|
||||
|
||||
@ -52,18 +51,22 @@ DevPathToTextVendorLib (
|
||||
CatPrint (Str, L"EmuThunk()");
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuGraphicsWindowProtocolGuid)) {
|
||||
CatPrint (Str, L"EmuGraphics(%d)", Vendor->Instance);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEfiSimpleFileSystemProtocolGuid)) {
|
||||
CatPrint (Str, L"EmuFs(%d)", Vendor->Instance);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuBlockIoProtocolGuid)) {
|
||||
CatPrint (Str, L"EmuBlk(%d)", Vendor->Instance);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuThreadThunkProtocolGuid)) {
|
||||
CatPrint (Str, L"EmuThread()");
|
||||
return EFI_SUCCESS;
|
||||
@ -89,13 +92,13 @@ DevPathFromTextEmuThunk (
|
||||
VENDOR_DEVICE_PATH *Vendor;
|
||||
|
||||
Str = GetNextParamStr (&TextDeviceNode);
|
||||
Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
|
||||
Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode (
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT16) sizeof (VENDOR_DEVICE_PATH)
|
||||
(UINT16)sizeof (VENDOR_DEVICE_PATH)
|
||||
);
|
||||
CopyGuid (&Vendor->Guid, &gEmuThunkProtocolGuid);
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,13 +118,13 @@ DevPathFromTextEmuThread (
|
||||
VENDOR_DEVICE_PATH *Vendor;
|
||||
|
||||
Str = GetNextParamStr (&TextDeviceNode);
|
||||
Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
|
||||
Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode (
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT16) sizeof (VENDOR_DEVICE_PATH)
|
||||
(UINT16)sizeof (VENDOR_DEVICE_PATH)
|
||||
);
|
||||
CopyGuid (&Vendor->Guid, &gEmuThreadThunkProtocolGuid);
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,15 +144,15 @@ DevPathFromTextEmuFs (
|
||||
EMU_VENDOR_DEVICE_PATH_NODE *Vendor;
|
||||
|
||||
Str = GetNextParamStr (&TextDeviceNode);
|
||||
Vendor = (EMU_VENDOR_DEVICE_PATH_NODE *) CreateDeviceNode (
|
||||
Vendor = (EMU_VENDOR_DEVICE_PATH_NODE *)CreateDeviceNode (
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT16) sizeof (EMU_VENDOR_DEVICE_PATH_NODE)
|
||||
(UINT16)sizeof (EMU_VENDOR_DEVICE_PATH_NODE)
|
||||
);
|
||||
CopyGuid (&Vendor->VendorDevicePath.Guid, &gEfiSimpleFileSystemProtocolGuid);
|
||||
Vendor->Instance = (UINT32) StrDecimalToUintn (Str);
|
||||
Vendor->Instance = (UINT32)StrDecimalToUintn (Str);
|
||||
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)Vendor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,8 +16,6 @@
|
||||
|
||||
#include <Protocol/Timer.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Stalls the CPU for at least the given number of microseconds.
|
||||
|
||||
@ -37,7 +35,6 @@ MicroSecondDelay (
|
||||
return NanoSecondDelay (MicroSeconds * 1000);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Stalls the CPU for at least the given number of nanoseconds.
|
||||
|
||||
@ -58,7 +55,6 @@ NanoSecondDelay (
|
||||
return NanoSeconds;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves the current value of a 64-bit free running performance counter.
|
||||
|
||||
@ -109,10 +105,10 @@ GetPerformanceCounterProperties (
|
||||
OUT UINT64 *EndValue OPTIONAL
|
||||
)
|
||||
{
|
||||
|
||||
if (StartValue != NULL) {
|
||||
*StartValue = 0ULL;
|
||||
}
|
||||
|
||||
if (EndValue != NULL) {
|
||||
*EndValue = (UINT64)-1LL;
|
||||
}
|
||||
@ -157,8 +153,8 @@ GetTimeInNanoSecond (
|
||||
// i.e. highest bit set in Remainder should <= 33.
|
||||
//
|
||||
Shift = MAX (0, HighBitSet64 (Remainder) - 33);
|
||||
Remainder = RShiftU64 (Remainder, (UINTN) Shift);
|
||||
Frequency = RShiftU64 (Frequency, (UINTN) Shift);
|
||||
Remainder = RShiftU64 (Remainder, (UINTN)Shift);
|
||||
Frequency = RShiftU64 (Frequency, (UINTN)Shift);
|
||||
NanoSeconds += DivU64x64Remainder (MultU64x32 (Remainder, 1000000000u), Frequency, NULL);
|
||||
|
||||
return NanoSeconds;
|
||||
|
@ -15,7 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
EMU_THUNK_PROTOCOL *gEmuThunk = NULL;
|
||||
|
||||
|
||||
/**
|
||||
The constructor function caches the pointer of EMU Thunk protocol.
|
||||
|
||||
@ -43,7 +42,6 @@ DxeEmuLibConstructor (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Serach the EMU IO Thunk database for a matching EMU IO Thunk
|
||||
Protocol instance.
|
||||
|
@ -25,7 +25,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
EMU_THUNK_PROTOCOL *mThunk = NULL;
|
||||
|
||||
|
||||
/**
|
||||
The constructor function gets the pointer of the WinNT thunk functions
|
||||
It will ASSERT() if Unix thunk protocol is not installed.
|
||||
@ -73,8 +72,6 @@ PeCoffLoaderRelocateImageExtraAction (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Performs additional actions just before a PE/COFF image is unloaded. Any resources
|
||||
that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.
|
||||
|
@ -8,14 +8,10 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <Library/SerialPortLib.h>
|
||||
#include <Library/EmuThunkLib.h>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Initialize the serial device hardware.
|
||||
|
||||
@ -63,7 +59,6 @@ SerialPortWrite (
|
||||
return gEmuThunk->WriteStdOut (Buffer, NumberOfBytes);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read data from serial device and save the datas in buffer.
|
||||
|
||||
@ -149,6 +144,7 @@ SerialPortGetControl (
|
||||
if (!SerialPortPoll ()) {
|
||||
*Control = EFI_SERIAL_INPUT_BUFFER_EMPTY;
|
||||
}
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
@ -198,4 +194,3 @@ SerialPortSetAttributes (
|
||||
{
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
@ -8,14 +8,10 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <Library/SerialPortLib.h>
|
||||
#include <Library/EmuThunkLib.h>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Initialize the serial device hardware.
|
||||
|
||||
@ -67,7 +63,6 @@ SerialPortWrite (
|
||||
return gEmuThunk->WriteStdErr (Buffer, NumberOfBytes);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read data from serial device and save the datas in buffer.
|
||||
|
||||
@ -113,5 +108,3 @@ SerialPortPoll (
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <Protocol/Timer.h>
|
||||
|
||||
|
||||
STATIC UINT64 gTimerPeriod = 0;
|
||||
STATIC EFI_TIMER_ARCH_PROTOCOL *gTimerAp = NULL;
|
||||
STATIC EFI_EVENT gTimerEvent = NULL;
|
||||
@ -46,8 +45,6 @@ RegisterTimerArchProtocol (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Stalls the CPU for at least the given number of microseconds.
|
||||
|
||||
@ -67,7 +64,6 @@ MicroSecondDelay (
|
||||
return NanoSecondDelay (MicroSeconds * 1000);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Stalls the CPU for at least the given number of nanoseconds.
|
||||
|
||||
@ -90,7 +86,8 @@ NanoSecondDelay (
|
||||
|
||||
if ((gTimerPeriod != 0) &&
|
||||
((UINT64)NanoSeconds > gTimerPeriod) &&
|
||||
(EfiGetCurrentTpl () == TPL_APPLICATION)) {
|
||||
(EfiGetCurrentTpl () == TPL_APPLICATION))
|
||||
{
|
||||
//
|
||||
// This stall is long, so use gBS->WaitForEvent () to yield CPU to DXE Core
|
||||
//
|
||||
@ -101,14 +98,13 @@ NanoSecondDelay (
|
||||
|
||||
Status = gBS->WaitForEvent (sizeof (gTimerEvent)/sizeof (EFI_EVENT), &gTimerEvent, &Index);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
} else {
|
||||
gEmuThunk->Sleep (NanoSeconds);
|
||||
}
|
||||
|
||||
return NanoSeconds;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves the current value of a 64-bit free running performance counter.
|
||||
|
||||
@ -159,10 +155,10 @@ GetPerformanceCounterProperties (
|
||||
OUT UINT64 *EndValue OPTIONAL
|
||||
)
|
||||
{
|
||||
|
||||
if (StartValue != NULL) {
|
||||
*StartValue = 0ULL;
|
||||
}
|
||||
|
||||
if (EndValue != NULL) {
|
||||
*EndValue = (UINT64)-1LL;
|
||||
}
|
||||
@ -170,7 +166,6 @@ GetPerformanceCounterProperties (
|
||||
return gEmuThunk->QueryPerformanceFrequency ();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Register for the Timer AP protocol.
|
||||
|
||||
@ -235,8 +230,8 @@ GetTimeInNanoSecond (
|
||||
// i.e. highest bit set in Remainder should <= 33.
|
||||
//
|
||||
Shift = MAX (0, HighBitSet64 (Remainder) - 33);
|
||||
Remainder = RShiftU64 (Remainder, (UINTN) Shift);
|
||||
Frequency = RShiftU64 (Frequency, (UINTN) Shift);
|
||||
Remainder = RShiftU64 (Remainder, (UINTN)Shift);
|
||||
Frequency = RShiftU64 (Frequency, (UINTN)Shift);
|
||||
NanoSeconds += DivU64x64Remainder (MultU64x32 (Remainder, 1000000000u), Frequency, NULL);
|
||||
|
||||
return NanoSeconds;
|
||||
|
@ -15,10 +15,8 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
@ -151,7 +149,7 @@ FreePages (
|
||||
// The Free thunk will not free memory allocated in emulated EFI memory.
|
||||
// The assmuption is this was allocated directly by EFI. We need this as some
|
||||
// times protocols or EFI BootServices can return dynamically allocated buffers.
|
||||
Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages);
|
||||
Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
}
|
||||
@ -195,6 +193,7 @@ InternalAllocateAlignedPages (
|
||||
if (Pages == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (Alignment > EFI_PAGE_SIZE) {
|
||||
//
|
||||
// Caculate the total number of pages since alignment is larger than page size.
|
||||
@ -210,15 +209,17 @@ InternalAllocateAlignedPages (
|
||||
if (Memory != NULL) {
|
||||
return NULL;
|
||||
}
|
||||
AlignedMemory = ((UINTN) Memory + AlignmentMask) & ~AlignmentMask;
|
||||
UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN) Memory);
|
||||
|
||||
AlignedMemory = ((UINTN)Memory + AlignmentMask) & ~AlignmentMask;
|
||||
UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN)Memory);
|
||||
if (UnalignedPages > 0) {
|
||||
//
|
||||
// Free first unaligned page(s).
|
||||
//
|
||||
FreePages (Memory, UnalignedPages);
|
||||
}
|
||||
Memory = (VOID *) (AlignedMemory + EFI_PAGES_TO_SIZE (Pages));
|
||||
|
||||
Memory = (VOID *)(AlignedMemory + EFI_PAGES_TO_SIZE (Pages));
|
||||
UnalignedPages = RealPages - Pages - UnalignedPages;
|
||||
if (UnalignedPages > 0) {
|
||||
//
|
||||
@ -234,9 +235,11 @@ InternalAllocateAlignedPages (
|
||||
if (Memory != NULL) {
|
||||
return NULL;
|
||||
}
|
||||
AlignedMemory = (UINTN) Memory;
|
||||
|
||||
AlignedMemory = (UINTN)Memory;
|
||||
}
|
||||
return (VOID *) AlignedMemory;
|
||||
|
||||
return (VOID *)AlignedMemory;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -458,6 +461,7 @@ InternalAllocateZeroPool (
|
||||
if (Memory != NULL) {
|
||||
Memory = ZeroMem (Memory, AllocationSize);
|
||||
}
|
||||
|
||||
return Memory;
|
||||
}
|
||||
|
||||
@ -554,12 +558,13 @@ InternalAllocateCopyPool (
|
||||
VOID *Memory;
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
|
||||
ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN)Buffer + 1));
|
||||
|
||||
Memory = InternalAllocatePool (PoolType, AllocationSize);
|
||||
if (Memory != NULL) {
|
||||
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
||||
}
|
||||
|
||||
return Memory;
|
||||
}
|
||||
|
||||
@ -677,10 +682,11 @@ InternalReallocatePool (
|
||||
VOID *NewBuffer;
|
||||
|
||||
NewBuffer = InternalAllocateZeroPool (PoolType, NewSize);
|
||||
if (NewBuffer != NULL && OldBuffer != NULL) {
|
||||
if ((NewBuffer != NULL) && (OldBuffer != NULL)) {
|
||||
CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
|
||||
FreePool (OldBuffer);
|
||||
}
|
||||
|
||||
return NewBuffer;
|
||||
}
|
||||
|
||||
@ -810,4 +816,3 @@ FreePool (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Uefi.h>
|
||||
#include <Protocol/SimpleTextInEx.h>
|
||||
|
||||
|
||||
/**
|
||||
KeyMapMake gets called on key presses.
|
||||
|
||||
|
@ -29,7 +29,7 @@ CONST EFI_PEI_SERVICES **gPeiServices;
|
||||
VOID
|
||||
EFIAPI
|
||||
SetPeiServicesTablePointer (
|
||||
IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
|
||||
IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer
|
||||
)
|
||||
{
|
||||
ASSERT (PeiServicesTablePointer != NULL);
|
||||
@ -58,7 +58,6 @@ GetPeiServicesTablePointer (
|
||||
return gPeiServices;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
The constructor function caches the pointer to PEI services.
|
||||
|
||||
@ -108,4 +107,3 @@ MigratePeiServicesTablePointer (
|
||||
//
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@ EmuPeCoffGetThunkStucture (
|
||||
EMU_THUNK_PPI *ThunkPpi;
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
//
|
||||
// Locate Unix ThunkPpi for retrieving standard output handle
|
||||
//
|
||||
@ -47,11 +46,11 @@ EmuPeCoffGetThunkStucture (
|
||||
&gEmuThunkPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **) &ThunkPpi
|
||||
(VOID **)&ThunkPpi
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
EMU_MAGIC_PAGE()->Thunk = (EMU_THUNK_PROTOCOL *) ThunkPpi->Thunk ();
|
||||
EMU_MAGIC_PAGE ()->Thunk = (EMU_THUNK_PROTOCOL *)ThunkPpi->Thunk ();
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@ -71,12 +70,12 @@ PeCoffLoaderRelocateImageExtraAction (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
{
|
||||
if (EMU_MAGIC_PAGE()->Thunk == NULL) {
|
||||
if (EMU_MAGIC_PAGE ()->Thunk == NULL) {
|
||||
EmuPeCoffGetThunkStucture ();
|
||||
}
|
||||
EMU_MAGIC_PAGE()->Thunk->PeCoffRelocateImageExtraAction (ImageContext);
|
||||
}
|
||||
|
||||
EMU_MAGIC_PAGE ()->Thunk->PeCoffRelocateImageExtraAction (ImageContext);
|
||||
}
|
||||
|
||||
/**
|
||||
Performs additional actions just before a PE/COFF image is unloaded. Any resources
|
||||
@ -94,8 +93,9 @@ PeCoffLoaderUnloadImageExtraAction (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
{
|
||||
if (EMU_MAGIC_PAGE()->Thunk == NULL) {
|
||||
if (EMU_MAGIC_PAGE ()->Thunk == NULL) {
|
||||
EmuPeCoffGetThunkStucture ();
|
||||
}
|
||||
EMU_MAGIC_PAGE()->Thunk->PeCoffUnloadImageExtraAction (ImageContext);
|
||||
|
||||
EMU_MAGIC_PAGE ()->Thunk->PeCoffUnloadImageExtraAction (ImageContext);
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Ppi/EmuThunk.h>
|
||||
#include <Protocol/EmuThunk.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Retrieves and returns a pointer to the entry point to a PE/COFF image that has been loaded
|
||||
into system memory with the PE/COFF Loader Library functions.
|
||||
@ -52,7 +50,7 @@ PeCoffLoaderGetEntryPoint (
|
||||
&gEmuThunkPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **) &ThunkPpi
|
||||
(VOID **)&ThunkPpi
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -86,8 +84,7 @@ PeCoffLoaderGetMachineType (
|
||||
|
||||
DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
|
||||
if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
|
||||
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
|
||||
|
||||
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + (UINTN)((DosHdr->e_lfanew) & 0x0ffff));
|
||||
} else {
|
||||
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(Pe32Data);
|
||||
}
|
||||
@ -148,7 +145,7 @@ PeCoffLoaderGetPdbPointer (
|
||||
//
|
||||
// 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));
|
||||
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.
|
||||
@ -160,7 +157,7 @@ PeCoffLoaderGetPdbPointer (
|
||||
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 +
|
||||
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN)Hdr.Te +
|
||||
Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress +
|
||||
TEImageAdjust);
|
||||
}
|
||||
@ -197,14 +194,14 @@ PeCoffLoaderGetPdbPointer (
|
||||
//
|
||||
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);
|
||||
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);
|
||||
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN)Pe32Data + DirectoryEntry->VirtualAddress);
|
||||
}
|
||||
|
||||
if (NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
|
||||
@ -215,21 +212,21 @@ PeCoffLoaderGetPdbPointer (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (DebugEntry == NULL || DirectoryEntry == 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) {
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
return (VOID *)((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -240,7 +237,6 @@ PeCoffLoaderGetPdbPointer (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns the size of the PE/COFF headers
|
||||
|
||||
@ -270,7 +266,7 @@ PeCoffGetSizeOfHeaders (
|
||||
//
|
||||
// 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));
|
||||
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.
|
||||
@ -286,6 +282,5 @@ PeCoffGetSizeOfHeaders (
|
||||
SizeOfHeaders = 0;
|
||||
}
|
||||
|
||||
return (UINT32) SizeOfHeaders;
|
||||
return (UINT32)SizeOfHeaders;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <PiPei.h>
|
||||
#include <Library/SerialPortLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
@ -17,8 +16,6 @@
|
||||
#include <Ppi/EmuThunk.h>
|
||||
#include <Protocol/EmuThunk.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Initialize the serial device hardware.
|
||||
|
||||
@ -74,7 +71,7 @@ SerialPortWrite (
|
||||
&gEmuThunkPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **) &ThunkPpi
|
||||
(VOID **)&ThunkPpi
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Thunk = (EMU_THUNK_PROTOCOL *)ThunkPpi->Thunk ();
|
||||
@ -84,7 +81,6 @@ SerialPortWrite (
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read data from serial device and save the datas in buffer.
|
||||
|
||||
@ -130,4 +126,3 @@ SerialPortPoll (
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <Ppi/MemoryDiscovered.h>
|
||||
|
||||
|
||||
CONST EFI_PEI_SERVICES **gPeiServices = NULL;
|
||||
|
||||
/**
|
||||
@ -33,7 +32,7 @@ CONST EFI_PEI_SERVICES **gPeiServices = NULL;
|
||||
VOID
|
||||
EFIAPI
|
||||
SetPeiServicesTablePointer (
|
||||
IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
|
||||
IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer
|
||||
)
|
||||
{
|
||||
ASSERT (PeiServicesTablePointer != NULL);
|
||||
@ -64,8 +63,6 @@ GetPeiServicesTablePointer (
|
||||
return gPeiServices;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Notification service to be called when gEmuThunkPpiGuid is installed.
|
||||
|
||||
@ -91,14 +88,12 @@ PeiServicesTablePointerNotifyCallback (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_PEI_NOTIFY_DESCRIPTOR mNotifyOnThunkList = {
|
||||
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||
&gEfiPeiMemoryDiscoveredPpiGuid,
|
||||
PeiServicesTablePointerNotifyCallback
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Constructor register notification on when PPI updates. If PPI is
|
||||
alreay installed registering the notify will cause the handle to
|
||||
@ -153,4 +148,3 @@ MigratePeiServicesTablePointer (
|
||||
//
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/EmuMagicPageLib.h>
|
||||
|
||||
|
||||
/**
|
||||
Caches a pointer PEI Services Table.
|
||||
|
||||
@ -31,12 +30,12 @@
|
||||
VOID
|
||||
EFIAPI
|
||||
SetPeiServicesTablePointer (
|
||||
IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
|
||||
IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer
|
||||
)
|
||||
{
|
||||
ASSERT (PeiServicesTablePointer != NULL);
|
||||
ASSERT (*PeiServicesTablePointer != NULL);
|
||||
EMU_MAGIC_PAGE()->PeiServicesTablePointer = PeiServicesTablePointer;
|
||||
EMU_MAGIC_PAGE ()->PeiServicesTablePointer = PeiServicesTablePointer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,7 +58,7 @@ GetPeiServicesTablePointer (
|
||||
{
|
||||
CONST EFI_PEI_SERVICES **PeiServicesTablePointer;
|
||||
|
||||
PeiServicesTablePointer = EMU_MAGIC_PAGE()->PeiServicesTablePointer;
|
||||
PeiServicesTablePointer = EMU_MAGIC_PAGE ()->PeiServicesTablePointer;
|
||||
ASSERT (PeiServicesTablePointer != NULL);
|
||||
ASSERT (*PeiServicesTablePointer != NULL);
|
||||
return PeiServicesTablePointer;
|
||||
@ -91,5 +90,3 @@ MigratePeiServicesTablePointer (
|
||||
//
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ NanoSecondDelay (
|
||||
&gEmuThunkPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **) &ThunkPpi
|
||||
(VOID **)&ThunkPpi
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Thunk = (EMU_THUNK_PROTOCOL *)ThunkPpi->Thunk ();
|
||||
@ -100,7 +100,7 @@ GetPerformanceCounter (
|
||||
&gEmuThunkPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **) &ThunkPpi
|
||||
(VOID **)&ThunkPpi
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Thunk = (EMU_THUNK_PROTOCOL *)ThunkPpi->Thunk ();
|
||||
@ -151,12 +151,13 @@ GetPerformanceCounterProperties (
|
||||
&gEmuThunkPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **) &ThunkPpi
|
||||
(VOID **)&ThunkPpi
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if (StartValue != NULL) {
|
||||
*StartValue = 0ULL;
|
||||
}
|
||||
|
||||
if (EndValue != NULL) {
|
||||
*EndValue = (UINT64)-1LL;
|
||||
}
|
||||
@ -205,8 +206,8 @@ GetTimeInNanoSecond (
|
||||
// i.e. highest bit set in Remainder should <= 33.
|
||||
//
|
||||
Shift = MAX (0, HighBitSet64 (Remainder) - 33);
|
||||
Remainder = RShiftU64 (Remainder, (UINTN) Shift);
|
||||
Frequency = RShiftU64 (Frequency, (UINTN) Shift);
|
||||
Remainder = RShiftU64 (Remainder, (UINTN)Shift);
|
||||
Frequency = RShiftU64 (Frequency, (UINTN)Shift);
|
||||
NanoSeconds += DivU64x64Remainder (MultU64x32 (Remainder, 1000000000u), Frequency, NULL);
|
||||
|
||||
return NanoSeconds;
|
||||
|
@ -30,7 +30,7 @@ SetupVariableInit (
|
||||
&gEmuSystemConfigGuid,
|
||||
NULL,
|
||||
&Size,
|
||||
(VOID *) &SystemConfigData
|
||||
(VOID *)&SystemConfigData
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -45,7 +45,7 @@ SetupVariableInit (
|
||||
&gEmuSystemConfigGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
sizeof (SystemConfigData),
|
||||
(VOID *) &SystemConfigData
|
||||
(VOID *)&SystemConfigData
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "Failed to save Setup Variable to non-volatile storage, Status = %r\n", Status));
|
||||
@ -58,7 +58,6 @@ FvFilePath (
|
||||
EFI_GUID *FileGuid
|
||||
)
|
||||
{
|
||||
|
||||
EFI_STATUS Status;
|
||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;
|
||||
@ -68,12 +67,12 @@ FvFilePath (
|
||||
Status = gBS->HandleProtocol (
|
||||
gImageHandle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
(VOID **) &LoadedImage
|
||||
(VOID **)&LoadedImage
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return AppendDevicePathNode (
|
||||
DevicePathFromHandle (LoadedImage->DeviceHandle),
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &FileNode
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&FileNode
|
||||
);
|
||||
}
|
||||
|
||||
@ -137,7 +136,7 @@ RegisterBootManagerMenuAppBootOption (
|
||||
BOOLEAN
|
||||
IsBootManagerMenuAppFilePath (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_HANDLE FvHandle;
|
||||
VOID *NameGuid;
|
||||
@ -145,7 +144,7 @@ IsBootManagerMenuAppFilePath (
|
||||
|
||||
Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid, &DevicePath, &FvHandle);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) DevicePath);
|
||||
NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)DevicePath);
|
||||
if (NameGuid != NULL) {
|
||||
return CompareGuid (NameGuid, &mBootMenuFile);
|
||||
}
|
||||
@ -189,7 +188,7 @@ GetBootManagerMenuAppOption (
|
||||
//
|
||||
// If not found the BootManagerMenuApp, create it.
|
||||
//
|
||||
OptionNumber = (UINT16) RegisterBootManagerMenuAppBootOption (&mBootMenuFile, L"UEFI BootManagerMenuApp", (UINTN) -1, FALSE);
|
||||
OptionNumber = (UINT16)RegisterBootManagerMenuAppBootOption (&mBootMenuFile, L"UEFI BootManagerMenuApp", (UINTN)-1, FALSE);
|
||||
}
|
||||
|
||||
return OptionNumber;
|
||||
@ -317,7 +316,7 @@ PlatformBdsRegisterStaticBootOptions (
|
||||
F2.ScanCode = SCAN_F2;
|
||||
F2.UnicodeChar = CHAR_NULL;
|
||||
EfiBootManagerGetBootManagerMenu (&BootOption);
|
||||
EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 0, &F2, NULL);
|
||||
EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumber, 0, &F2, NULL);
|
||||
|
||||
//
|
||||
// 3. Boot Device List menu
|
||||
@ -348,6 +347,7 @@ BootOptionPriority (
|
||||
if (StrCmp (BootOption->Description, L"UEFI Shell") == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 100;
|
||||
}
|
||||
|
||||
@ -377,13 +377,11 @@ PlatformBootManagerAfterConsole (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
|
||||
//
|
||||
// Go the different platform policy with different boot mode
|
||||
// Notes: this part code can be change with the table policy
|
||||
//
|
||||
switch (GetBootModeHob ()) {
|
||||
|
||||
case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
|
||||
case BOOT_WITH_MINIMAL_CONFIGURATION:
|
||||
PlatformBdsDiagnostics (IGNORE, TRUE);
|
||||
@ -456,4 +454,3 @@ PlatformBootManagerUnableToBoot (
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -56,14 +56,12 @@ extern BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
|
||||
}\
|
||||
}
|
||||
|
||||
|
||||
typedef struct {
|
||||
EMU_VENDOR_DEVICE_PATH_NODE EmuBus;
|
||||
EMU_VENDOR_DEVICE_PATH_NODE EmuGraphicsWindow;
|
||||
EFI_DEVICE_PATH_PROTOCOL End;
|
||||
} EMU_PLATFORM_UGA_DEVICE_PATH;
|
||||
|
||||
|
||||
//
|
||||
// Platform BDS Functions
|
||||
//
|
||||
@ -83,7 +81,6 @@ PlatformBootManagerMemoryTest (
|
||||
IN EXTENDMEM_COVERAGE_LEVEL Level
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
PlatformBdsConnectSequence (
|
||||
VOID
|
||||
|
@ -8,8 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include "PlatformBm.h"
|
||||
|
||||
|
||||
|
||||
EMU_PLATFORM_UGA_DEVICE_PATH gGopDevicePath = {
|
||||
{
|
||||
{
|
||||
@ -17,8 +15,8 @@ EMU_PLATFORM_UGA_DEVICE_PATH gGopDevicePath = {
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
{
|
||||
(UINT8) (sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8) ((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
|
||||
(UINT8)(sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8)((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
|
||||
}
|
||||
},
|
||||
EMU_THUNK_PROTOCOL_GUID
|
||||
@ -31,8 +29,8 @@ EMU_PLATFORM_UGA_DEVICE_PATH gGopDevicePath = {
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
{
|
||||
(UINT8) (sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8) ((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
|
||||
(UINT8)(sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8)((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
|
||||
},
|
||||
},
|
||||
EMU_GRAPHICS_WINDOW_PROTOCOL_GUID,
|
||||
@ -49,8 +47,8 @@ EMU_PLATFORM_UGA_DEVICE_PATH gGopDevicePath2 = {
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
{
|
||||
(UINT8) (sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8) ((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
|
||||
(UINT8)(sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8)((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
|
||||
}
|
||||
},
|
||||
EMU_THUNK_PROTOCOL_GUID
|
||||
@ -63,8 +61,8 @@ EMU_PLATFORM_UGA_DEVICE_PATH gGopDevicePath2 = {
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
{
|
||||
(UINT8) (sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8) ((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
|
||||
(UINT8)(sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8)((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
|
||||
},
|
||||
},
|
||||
EMU_GRAPHICS_WINDOW_PROTOCOL_GUID,
|
||||
@ -79,11 +77,11 @@ EMU_PLATFORM_UGA_DEVICE_PATH gGopDevicePath2 = {
|
||||
//
|
||||
BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = {
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &gGopDevicePath,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&gGopDevicePath,
|
||||
(CONSOLE_OUT | CONSOLE_IN)
|
||||
},
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &gGopDevicePath2,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *)&gGopDevicePath2,
|
||||
(CONSOLE_OUT | CONSOLE_IN)
|
||||
},
|
||||
{
|
||||
@ -91,4 +89,3 @@ BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = {
|
||||
0
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -52,7 +52,7 @@ PlatformBootManagerMemoryTest (
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiGenericMemTestProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &GenMemoryTest
|
||||
(VOID **)&GenMemoryTest
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_SUCCESS;
|
||||
@ -88,7 +88,6 @@ PlatformBootManagerMemoryTest (
|
||||
ASSERT (0);
|
||||
}
|
||||
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Perform memory test (ESC to skip).\n"));
|
||||
|
||||
if (!PcdGetBool (PcdConInConnectOnDemand)) {
|
||||
|
@ -26,7 +26,7 @@ EFIAPI
|
||||
LibStopRedfishService (
|
||||
IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This,
|
||||
IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE ServiceStopType
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
Return the credential for accessing to Redfish servcice.
|
||||
@ -44,7 +44,7 @@ GetRedfishCredential (
|
||||
OUT EDKII_REDFISH_AUTH_METHOD *AuthMethod,
|
||||
OUT CHAR8 **UserId,
|
||||
OUT CHAR8 **Password
|
||||
)
|
||||
)
|
||||
{
|
||||
UINTN UserIdSize;
|
||||
UINTN PasswordSize;
|
||||
@ -59,14 +59,16 @@ GetRedfishCredential (
|
||||
//
|
||||
UserIdSize = AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdRedfishServieUserId));
|
||||
PasswordSize = AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdRedfishServiePassword));
|
||||
if (UserIdSize == 0 || PasswordSize == 0) {
|
||||
if ((UserIdSize == 0) || (PasswordSize == 0)) {
|
||||
DEBUG ((DEBUG_ERROR, "Incorrect string of UserID or Password for REdfish service.\n"));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*UserId = AllocateZeroPool (UserIdSize);
|
||||
if (*UserId == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
CopyMem (*UserId, (CHAR8 *)PcdGetPtr (PcdRedfishServieUserId), UserIdSize);
|
||||
|
||||
*Password = AllocateZeroPool (PasswordSize);
|
||||
@ -110,11 +112,11 @@ LibCredentialGetAuthInfo (
|
||||
OUT EDKII_REDFISH_AUTH_METHOD *AuthMethod,
|
||||
OUT CHAR8 **UserId,
|
||||
OUT CHAR8 **Password
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (This == NULL || AuthMethod == NULL || UserId == NULL || Password == NULL) {
|
||||
if ((This == NULL) || (AuthMethod == NULL) || (UserId == NULL) || (Password == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -124,7 +126,7 @@ LibCredentialGetAuthInfo (
|
||||
|
||||
if (mSecureBootDisabled) {
|
||||
Status = LibStopRedfishService (This, ServiceStopTypeSecureBootDisabled);
|
||||
if (EFI_ERROR (Status) && Status != EFI_UNSUPPORTED) {
|
||||
if (EFI_ERROR (Status) && (Status != EFI_UNSUPPORTED)) {
|
||||
DEBUG ((DEBUG_ERROR, "SecureBoot has been disabled, but failed to stop RedfishService - %r\n", Status));
|
||||
return Status;
|
||||
}
|
||||
@ -161,7 +163,7 @@ EFIAPI
|
||||
LibStopRedfishService (
|
||||
IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This,
|
||||
IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE ServiceStopType
|
||||
)
|
||||
)
|
||||
{
|
||||
if (ServiceStopType >= ServiceStopTypeMax) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@ -193,8 +195,10 @@ LibStopRedfishService (
|
||||
mStopRedfishService = TRUE;
|
||||
DEBUG ((DEBUG_INFO, "EFI Redfish service is stopped without Redfish service stop type!!\n"));
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Notification of Exit Boot Service.
|
||||
|
||||
@ -204,7 +208,7 @@ VOID
|
||||
EFIAPI
|
||||
LibCredentialExitBootServicesNotify (
|
||||
IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This
|
||||
)
|
||||
)
|
||||
{
|
||||
LibStopRedfishService (This, ServiceStopTypeExitBootService);
|
||||
}
|
||||
@ -218,7 +222,7 @@ VOID
|
||||
EFIAPI
|
||||
LibCredentialEndOfDxeNotify (
|
||||
IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT8 *SecureBootVar;
|
||||
@ -226,7 +230,7 @@ LibCredentialEndOfDxeNotify (
|
||||
//
|
||||
// Check Secure Boot status and lock Redfish service if Secure Boot is disabled.
|
||||
//
|
||||
Status = GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid, (VOID**)&SecureBootVar, NULL);
|
||||
Status = GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid, (VOID **)&SecureBootVar, NULL);
|
||||
if (EFI_ERROR (Status) || (*SecureBootVar != SECURE_BOOT_MODE_ENABLE)) {
|
||||
//
|
||||
// Secure Boot is disabled
|
||||
|
@ -50,10 +50,11 @@ GetMacAddressInformation (
|
||||
RestExServiceDevicePathData = NULL;
|
||||
RestExServiceDevicePath = NULL;
|
||||
|
||||
RestExServiceDevicePathData = (REST_EX_SERVICE_DEVICE_PATH_DATA *)PcdGetPtr(PcdRedfishRestExServiceDevicePath);
|
||||
if (RestExServiceDevicePathData == NULL ||
|
||||
RestExServiceDevicePathData->DevicePathNum == 0 ||
|
||||
!IsDevicePathValid (RestExServiceDevicePathData->DevicePath, 0)) {
|
||||
RestExServiceDevicePathData = (REST_EX_SERVICE_DEVICE_PATH_DATA *)PcdGetPtr (PcdRedfishRestExServiceDevicePath);
|
||||
if ((RestExServiceDevicePathData == NULL) ||
|
||||
(RestExServiceDevicePathData->DevicePathNum == 0) ||
|
||||
!IsDevicePathValid (RestExServiceDevicePathData->DevicePath, 0))
|
||||
{
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@ -67,7 +68,8 @@ GetMacAddressInformation (
|
||||
//
|
||||
while (!IsDevicePathEnd (RestExServiceDevicePath) &&
|
||||
((DevicePathType (RestExServiceDevicePath) != MESSAGING_DEVICE_PATH) ||
|
||||
(DevicePathSubType (RestExServiceDevicePath) != MSG_MAC_ADDR_DP))) {
|
||||
(DevicePathSubType (RestExServiceDevicePath) != MSG_MAC_ADDR_DP)))
|
||||
{
|
||||
RestExServiceDevicePath = NextDevicePathNode (RestExServiceDevicePath);
|
||||
}
|
||||
|
||||
@ -76,6 +78,7 @@ GetMacAddressInformation (
|
||||
CopyMem ((VOID *)MacAddress, (VOID *)&MacAddressDevicePath->MacAddress, sizeof (EFI_MAC_ADDRESS));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@ -93,7 +96,7 @@ EFI_STATUS
|
||||
RedfishPlatformHostInterfaceDeviceDescriptor (
|
||||
OUT UINT8 *DeviceType,
|
||||
OUT REDFISH_INTERFACE_DATA **DeviceDescriptor
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_MAC_ADDRESS MacAddress;
|
||||
@ -104,6 +107,7 @@ RedfishPlatformHostInterfaceDeviceDescriptor (
|
||||
if (RedfishInterfaceData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
RedfishInterfaceData->DeviceType = REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2;
|
||||
//
|
||||
// Fill up device type information.
|
||||
@ -115,11 +119,13 @@ RedfishPlatformHostInterfaceDeviceDescriptor (
|
||||
FreePool (RedfishInterfaceData);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
CopyMem ((VOID *)&ThisDeviceDescriptor->MacAddress, (VOID *)&MacAddress, sizeof (ThisDeviceDescriptor->MacAddress));
|
||||
*DeviceType = REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2;
|
||||
*DeviceDescriptor = RedfishInterfaceData;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Get platform Redfish host interface protocol data.
|
||||
Caller should pass NULL in ProtocolRecord to retrive the first protocol record.
|
||||
@ -138,27 +144,30 @@ EFI_STATUS
|
||||
RedfishPlatformHostInterfaceProtocolData (
|
||||
OUT MC_HOST_INTERFACE_PROTOCOL_RECORD **ProtocolRecord,
|
||||
IN UINT8 IndexOfProtocolData
|
||||
)
|
||||
)
|
||||
{
|
||||
MC_HOST_INTERFACE_PROTOCOL_RECORD *ThisProtocolRecord;
|
||||
|
||||
if (mRedfishOverIpProtocolData == 0) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (IndexOfProtocolData == 0) {
|
||||
//
|
||||
// Return the first Redfish protocol data to caller. We only have
|
||||
// one protocol data in this case.
|
||||
//
|
||||
ThisProtocolRecord = (MC_HOST_INTERFACE_PROTOCOL_RECORD *) AllocatePool (mRedfishProtocolDataSize + sizeof (MC_HOST_INTERFACE_PROTOCOL_RECORD) - 1);
|
||||
ThisProtocolRecord = (MC_HOST_INTERFACE_PROTOCOL_RECORD *)AllocatePool (mRedfishProtocolDataSize + sizeof (MC_HOST_INTERFACE_PROTOCOL_RECORD) - 1);
|
||||
ThisProtocolRecord->ProtocolType = MCHostInterfaceProtocolTypeRedfishOverIP;
|
||||
ThisProtocolRecord->ProtocolTypeDataLen = mRedfishProtocolDataSize;
|
||||
CopyMem ((VOID *)&ThisProtocolRecord->ProtocolTypeData, (VOID *)mRedfishOverIpProtocolData, mRedfishProtocolDataSize);
|
||||
*ProtocolRecord = ThisProtocolRecord;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
/**
|
||||
Dump IPv4 address.
|
||||
|
||||
@ -180,6 +189,7 @@ InternalDumpIp4Addr (
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "\n"));
|
||||
}
|
||||
|
||||
/**
|
||||
Dump IPv6 address.
|
||||
|
||||
@ -196,6 +206,7 @@ InternalDumpIp6Addr (
|
||||
if (Ip->Addr[Index] != 0) {
|
||||
DEBUG ((DEBUG_VERBOSE, "%x", Ip->Addr[Index]));
|
||||
}
|
||||
|
||||
Index++;
|
||||
|
||||
if (Index > 15) {
|
||||
@ -205,14 +216,17 @@ InternalDumpIp6Addr (
|
||||
if (((Ip->Addr[Index] & 0xf0) == 0) && (Ip->Addr[Index - 1] != 0)) {
|
||||
DEBUG ((DEBUG_VERBOSE, "0"));
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "%x", Ip->Addr[Index]));
|
||||
|
||||
if (Index < 15) {
|
||||
DEBUG ((DEBUG_VERBOSE, ":"));
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "\n"));
|
||||
}
|
||||
|
||||
/**
|
||||
Dump data
|
||||
|
||||
@ -226,10 +240,12 @@ InternalDumpData (
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
for (Index = 0; Index < Size; Index++) {
|
||||
DEBUG ((DEBUG_VERBOSE, "%02x ", (UINTN)Data[Index]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Dump hex data
|
||||
|
||||
@ -260,6 +276,7 @@ InternalDumpHex (
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "\n"));
|
||||
}
|
||||
|
||||
/**
|
||||
Dump Redfish over IP protocol data
|
||||
|
||||
@ -275,7 +292,7 @@ DumpRedfishIpProtocolData (
|
||||
CHAR16 Hostname[16];
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "RedfishProtocolData: \n"));
|
||||
InternalDumpHex ((UINT8 *) RedfishProtocolData, RedfishProtocolDataSize);
|
||||
InternalDumpHex ((UINT8 *)RedfishProtocolData, RedfishProtocolDataSize);
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "Parsing as below: \n"));
|
||||
|
||||
@ -287,16 +304,16 @@ DumpRedfishIpProtocolData (
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "RedfishProtocolData->HostIpAddress: \n"));
|
||||
if (RedfishProtocolData->HostIpAddressFormat == 0x01) {
|
||||
InternalDumpIp4Addr ((EFI_IPv4_ADDRESS *) (RedfishProtocolData->HostIpAddress));
|
||||
InternalDumpIp4Addr ((EFI_IPv4_ADDRESS *)(RedfishProtocolData->HostIpAddress));
|
||||
} else {
|
||||
InternalDumpIp6Addr ((EFI_IPv6_ADDRESS *) (RedfishProtocolData->HostIpAddress));
|
||||
InternalDumpIp6Addr ((EFI_IPv6_ADDRESS *)(RedfishProtocolData->HostIpAddress));
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "RedfishProtocolData->HostIpMask: \n"));
|
||||
if (RedfishProtocolData->HostIpAddressFormat == 0x01) {
|
||||
InternalDumpIp4Addr ((EFI_IPv4_ADDRESS *) (RedfishProtocolData->HostIpMask));
|
||||
InternalDumpIp4Addr ((EFI_IPv4_ADDRESS *)(RedfishProtocolData->HostIpMask));
|
||||
} else {
|
||||
InternalDumpIp6Addr ((EFI_IPv6_ADDRESS *) (RedfishProtocolData->HostIpMask));
|
||||
InternalDumpIp6Addr ((EFI_IPv6_ADDRESS *)(RedfishProtocolData->HostIpMask));
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "RedfishProtocolData->RedfishServiceIpDiscoveryType - %d\n", RedfishProtocolData->RedfishServiceIpDiscoveryType));
|
||||
@ -305,16 +322,16 @@ DumpRedfishIpProtocolData (
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "RedfishProtocolData->RedfishServiceIpAddress: \n"));
|
||||
if (RedfishProtocolData->RedfishServiceIpAddressFormat == 0x01) {
|
||||
InternalDumpIp4Addr ((EFI_IPv4_ADDRESS *) (RedfishProtocolData->RedfishServiceIpAddress));
|
||||
InternalDumpIp4Addr ((EFI_IPv4_ADDRESS *)(RedfishProtocolData->RedfishServiceIpAddress));
|
||||
} else {
|
||||
InternalDumpIp6Addr ((EFI_IPv6_ADDRESS *) (RedfishProtocolData->RedfishServiceIpAddress));
|
||||
InternalDumpIp6Addr ((EFI_IPv6_ADDRESS *)(RedfishProtocolData->RedfishServiceIpAddress));
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "RedfishProtocolData->RedfishServiceIpMask: \n"));
|
||||
if (RedfishProtocolData->RedfishServiceIpAddressFormat == 0x01) {
|
||||
InternalDumpIp4Addr ((EFI_IPv4_ADDRESS *) (RedfishProtocolData->RedfishServiceIpMask));
|
||||
InternalDumpIp4Addr ((EFI_IPv4_ADDRESS *)(RedfishProtocolData->RedfishServiceIpMask));
|
||||
} else {
|
||||
InternalDumpIp6Addr ((EFI_IPv6_ADDRESS *) (RedfishProtocolData->RedfishServiceIpMask));
|
||||
InternalDumpIp6Addr ((EFI_IPv6_ADDRESS *)(RedfishProtocolData->RedfishServiceIpMask));
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "RedfishProtocolData->RedfishServiceIpPort - %d\n", RedfishProtocolData->RedfishServiceIpPort));
|
||||
@ -323,7 +340,7 @@ DumpRedfishIpProtocolData (
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "RedfishProtocolData->RedfishServiceHostnameLength - %d\n", RedfishProtocolData->RedfishServiceHostnameLength));
|
||||
|
||||
AsciiStrToUnicodeStrS((CHAR8 *) RedfishProtocolData->RedfishServiceHostname, Hostname, sizeof (Hostname) / sizeof (Hostname[0]));
|
||||
AsciiStrToUnicodeStrS ((CHAR8 *)RedfishProtocolData->RedfishServiceHostname, Hostname, sizeof (Hostname) / sizeof (Hostname[0]));
|
||||
DEBUG ((DEBUG_VERBOSE, "RedfishProtocolData->RedfishServiceHostname - %s\n", Hostname));
|
||||
}
|
||||
|
||||
@ -354,7 +371,7 @@ GetRedfishRecordFromVariable (
|
||||
UINT8 HostNameSize;
|
||||
CHAR8 RedfishHostName[20];
|
||||
|
||||
if (RedfishProtocolData == NULL || RedfishProtocolDataSize == NULL) {
|
||||
if ((RedfishProtocolData == NULL) || (RedfishProtocolDataSize == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -446,7 +463,7 @@ GetRedfishRecordFromVariable (
|
||||
RedfishServiceIpAddress.Addr[3]
|
||||
);
|
||||
|
||||
HostNameSize = (UINT8) AsciiStrLen (RedfishHostName) + 1;
|
||||
HostNameSize = (UINT8)AsciiStrLen (RedfishHostName) + 1;
|
||||
|
||||
//
|
||||
// 2. Protocol Data Size.
|
||||
@ -456,7 +473,7 @@ GetRedfishRecordFromVariable (
|
||||
//
|
||||
// 3. Protocol Data.
|
||||
//
|
||||
*RedfishProtocolData = (REDFISH_OVER_IP_PROTOCOL_DATA *) AllocateZeroPool (*RedfishProtocolDataSize);
|
||||
*RedfishProtocolData = (REDFISH_OVER_IP_PROTOCOL_DATA *)AllocateZeroPool (*RedfishProtocolDataSize);
|
||||
if (*RedfishProtocolData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@ -495,7 +512,7 @@ GetRedfishRecordFromVariable (
|
||||
(*RedfishProtocolData)->RedfishServiceVlanId = 0xffffffff;
|
||||
|
||||
(*RedfishProtocolData)->RedfishServiceHostnameLength = HostNameSize;
|
||||
AsciiStrCpyS ((CHAR8 *) ((*RedfishProtocolData)->RedfishServiceHostname), HostNameSize, RedfishHostName);
|
||||
AsciiStrCpyS ((CHAR8 *)((*RedfishProtocolData)->RedfishServiceHostname), HostNameSize, RedfishHostName);
|
||||
|
||||
return Status;
|
||||
}
|
||||
@ -515,7 +532,7 @@ EFIAPI
|
||||
RedfishPlatformHostInterfaceConstructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
@ -524,5 +541,6 @@ RedfishPlatformHostInterfaceConstructor (
|
||||
if (!EFI_ERROR (Status)) {
|
||||
DumpRedfishIpProtocolData (mRedfishOverIpProtocolData, mRedfishProtocolDataSize);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include <PiPei.h>
|
||||
|
||||
|
||||
#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
|
||||
(ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))
|
||||
|
||||
@ -18,6 +17,7 @@ GetFileState (
|
||||
IN UINT8 ErasePolarity,
|
||||
IN EFI_FFS_FILE_HEADER *FfsHeader
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -39,7 +39,7 @@ Returns:
|
||||
FileState = FfsHeader->State;
|
||||
|
||||
if (ErasePolarity != 0) {
|
||||
FileState = (EFI_FFS_FILE_STATE)~FileState;
|
||||
FileState = (EFI_FFS_FILE_STATE) ~FileState;
|
||||
}
|
||||
|
||||
HighestBit = 0x80;
|
||||
@ -54,6 +54,7 @@ UINT8
|
||||
CalculateHeaderChecksum (
|
||||
IN EFI_FFS_FILE_HEADER *FileHeader
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -72,26 +73,27 @@ Returns:
|
||||
UINT8 Sum;
|
||||
|
||||
Sum = 0;
|
||||
ptr = (UINT8 *) FileHeader;
|
||||
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]);
|
||||
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]);
|
||||
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);
|
||||
Sum = (UINT8)(Sum - FileHeader->State);
|
||||
//
|
||||
// Checksum field of the file is not part of the header checksum.
|
||||
//
|
||||
Sum = (UINT8) (Sum - FileHeader->IntegrityCheck.Checksum.File);
|
||||
Sum = (UINT8)(Sum - FileHeader->IntegrityCheck.Checksum.File);
|
||||
|
||||
return Sum;
|
||||
}
|
||||
@ -102,6 +104,7 @@ SecFfsFindNextFile (
|
||||
IN EFI_PEI_FV_HANDLE FvHandle,
|
||||
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -137,7 +140,7 @@ Returns:
|
||||
//
|
||||
// Convert the handle of FV to FV header for memory-mapped firmware volume
|
||||
//
|
||||
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) FvHandle;
|
||||
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)FvHandle;
|
||||
FileHeader = (EFI_FFS_FILE_HEADER **)FileHandle;
|
||||
|
||||
FvLength = FwVolHeader->FvLength;
|
||||
@ -146,23 +149,24 @@ Returns:
|
||||
} 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);
|
||||
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;
|
||||
FileLength = *(UINT32 *)(*FileHeader)->Size & 0x00FFFFFF;
|
||||
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) *FileHeader + FileOccupiedSize);
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)*FileHeader + FileOccupiedSize);
|
||||
}
|
||||
|
||||
FileOffset = (UINT32) ((UINT8 *) FfsFileHeader - (UINT8 *) FwVolHeader);
|
||||
FileOffset = (UINT32)((UINT8 *)FfsFileHeader - (UINT8 *)FwVolHeader);
|
||||
|
||||
while (FileOffset < (FvLength - sizeof (EFI_FFS_FILE_HEADER))) {
|
||||
//
|
||||
@ -171,42 +175,40 @@ Returns:
|
||||
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));
|
||||
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;
|
||||
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);
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FfsFileHeader + FileOccupiedSize);
|
||||
} else {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case EFI_FILE_DELETED:
|
||||
FileLength = *(UINT32 *) (FfsFileHeader->Size) & 0x00FFFFFF;
|
||||
FileLength = *(UINT32 *)(FfsFileHeader->Size) & 0x00FFFFFF;
|
||||
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
|
||||
FileOffset += FileOccupiedSize;
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + FileOccupiedSize);
|
||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FfsFileHeader + FileOccupiedSize);
|
||||
break;
|
||||
|
||||
default:
|
||||
return EFI_NOT_FOUND;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,6 +221,7 @@ SecFfsFindSectionData (
|
||||
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
|
||||
IN OUT VOID **SectionData
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -247,29 +250,29 @@ Returns:
|
||||
// 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;
|
||||
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);
|
||||
*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 = *(UINT32 *)Section->Size & 0x00FFFFFF;
|
||||
SectionLength = GET_OCCUPIED_SIZE (SectionLength, 4);
|
||||
|
||||
ParsedLength += SectionLength;
|
||||
Section = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) Section + SectionLength);
|
||||
Section = (EFI_COMMON_SECTION_HEADER *)((UINT8 *)Section + SectionLength);
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -6,15 +6,12 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <PiPei.h>
|
||||
#include <Library/EmuMagicPageLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
SecFfsFindNextFile (
|
||||
IN EFI_FV_FILETYPE SearchType,
|
||||
@ -29,7 +26,6 @@ SecFfsFindSectionData (
|
||||
OUT VOID **SectionData
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
This service enables a given PEIM to register an interface into the PEI Foundation.
|
||||
|
||||
@ -109,14 +105,16 @@ PeiServicesLocatePpi (
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
for (PpiList = EMU_MAGIC_PAGE()->PpiList; ; PpiList++) {
|
||||
for (PpiList = EMU_MAGIC_PAGE ()->PpiList; ; PpiList++) {
|
||||
if (CompareGuid (PpiList->Guid, Guid)) {
|
||||
if (PpiDescriptor != NULL) {
|
||||
*PpiDescriptor = PpiList;
|
||||
}
|
||||
|
||||
if (Ppi != NULL) {
|
||||
*Ppi = PpiList->Ppi;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -125,7 +123,6 @@ PeiServicesLocatePpi (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@ -451,7 +448,6 @@ PeiServicesFfsGetFileInfo (
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services
|
||||
Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
|
||||
@ -485,7 +481,6 @@ PeiServicesFfsFindFileByName (
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services
|
||||
Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
|
||||
|
@ -8,4 +8,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <PiPei.h>
|
||||
|
||||
CONST EFI_PEI_PPI_DESCRIPTOR *gPpiList = NULL;
|
||||
|
||||
|
@ -18,10 +18,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/SmbiosLib.h>
|
||||
|
||||
|
||||
EFI_SMBIOS_PROTOCOL *gSmbios = NULL;
|
||||
|
||||
|
||||
/**
|
||||
Create an initial SMBIOS Table from an array of SMBIOS_TEMPLATE_ENTRY
|
||||
entries. SMBIOS_TEMPLATE_ENTRY.NULL indicates the end of the table.
|
||||
@ -53,8 +51,6 @@ SmbiosLibInitializeFromTemplate (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Create SMBIOS record.
|
||||
|
||||
@ -108,6 +104,7 @@ SmbiosLibCreateEntry (
|
||||
StringSize = AsciiStrSize (StringArray[Index]);
|
||||
Size += StringSize;
|
||||
}
|
||||
|
||||
// Don't forget the terminating double null
|
||||
Size += 1;
|
||||
}
|
||||
@ -117,6 +114,7 @@ SmbiosLibCreateEntry (
|
||||
if (Record == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
CopyMem (Record, SmbiosEntry, SmbiosEntry->Length);
|
||||
|
||||
if (StringArray != NULL) {
|
||||
@ -127,6 +125,7 @@ SmbiosLibCreateEntry (
|
||||
CopyMem (Str, StringArray[Index], StringSize);
|
||||
Str += StringSize;
|
||||
}
|
||||
|
||||
*Str = 0;
|
||||
}
|
||||
|
||||
@ -142,8 +141,6 @@ SmbiosLibCreateEntry (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Update the string associated with an existing SMBIOS record.
|
||||
|
||||
@ -182,7 +179,6 @@ SmbiosLibUpdateString (
|
||||
return gSmbios->UpdateString (gSmbios, &SmbiosHandle, &StringIndex, String);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Update the string associated with an existing SMBIOS record.
|
||||
|
||||
@ -223,6 +219,7 @@ SmbiosLibUpdateUnicodeString (
|
||||
if (Ascii == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
UnicodeStrToAsciiStrS (String, Ascii, StrSize (String));
|
||||
|
||||
StringIndex = StringNumber;
|
||||
@ -232,7 +229,6 @@ SmbiosLibUpdateUnicodeString (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Allow caller to read a specific SMBIOS string
|
||||
|
||||
@ -253,10 +249,11 @@ SmbiosLibReadString (
|
||||
UINTN Match;
|
||||
|
||||
Data = (CHAR8 *)Header + Header->Length;
|
||||
for (Match = 1;!(*Data == 0 && *(Data+1) == 0); ) {
|
||||
for (Match = 1; !(*Data == 0 && *(Data+1) == 0); ) {
|
||||
if (StringNumber == Match) {
|
||||
return Data;
|
||||
}
|
||||
|
||||
Data++;
|
||||
if (*(Data - 1) == '\0') {
|
||||
Match++;
|
||||
@ -266,7 +263,6 @@ SmbiosLibReadString (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Allow the caller to discover a specific SMBIOS entry, and patch it if necissary.
|
||||
|
||||
@ -297,6 +293,7 @@ SmbiosLibGetRecord (
|
||||
if (Match == Instance) {
|
||||
return (SMBIOS_STRUCTURE *)Record;
|
||||
}
|
||||
|
||||
Match++;
|
||||
}
|
||||
} while (!EFI_ERROR (Status));
|
||||
@ -304,7 +301,6 @@ SmbiosLibGetRecord (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Remove an SMBIOS record.
|
||||
|
||||
@ -324,8 +320,6 @@ SmbiosLibRemove (
|
||||
return gSmbios->Remove (gSmbios, SmbiosHandle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@param ImageHandle ImageHandle of the loaded driver.
|
||||
@ -343,4 +337,3 @@ SmbiosLibConstructor (
|
||||
{
|
||||
return gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)&gSmbios);
|
||||
}
|
||||
|
||||
|
@ -12,12 +12,9 @@
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
||||
|
||||
UINTN gThunkPpiListSize = 0;
|
||||
EFI_PEI_PPI_DESCRIPTOR *gThunkPpiList = NULL;
|
||||
|
||||
|
||||
|
||||
EFI_PEI_PPI_DESCRIPTOR *
|
||||
GetThunkPpiList (
|
||||
VOID
|
||||
@ -35,7 +32,6 @@ GetThunkPpiList (
|
||||
return gThunkPpiList;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AddThunkPpi (
|
||||
@ -63,8 +59,3 @@ AddThunkPpi (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <Protocol/EmuIoThunk.h>
|
||||
|
||||
|
||||
#define EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE SIGNATURE_32('E','m','u','T')
|
||||
|
||||
typedef struct {
|
||||
@ -28,7 +27,6 @@ typedef struct {
|
||||
|
||||
LIST_ENTRY mThunkList = INITIALIZE_LIST_HEAD_VARIABLE (mThunkList);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AddThunkProtocol (
|
||||
@ -53,9 +51,9 @@ AddThunkProtocol (
|
||||
if (StartString == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
StrCpyS (StartString, Size / sizeof (CHAR16), ConfigString);
|
||||
while (*StartString != '\0') {
|
||||
|
||||
//
|
||||
// Find the end of the sub string
|
||||
//
|
||||
@ -77,6 +75,7 @@ AddThunkProtocol (
|
||||
if (Private == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Private->Signature = EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE;
|
||||
Private->EmuBusDriver = EmuBusDriver;
|
||||
|
||||
@ -95,7 +94,6 @@ AddThunkProtocol (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetNextThunkProtocol (
|
||||
@ -125,13 +123,12 @@ GetNextThunkProtocol (
|
||||
if (Link == &mThunkList) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
Private = CR (Link, EMU_IO_THUNK_PROTOCOL_DATA, Link, EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE);
|
||||
*Instance = &Private->Data;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
extern SMBIOS_TEMPLATE_ENTRY gSmbiosTemplate[];
|
||||
|
||||
|
||||
|
||||
SMBIOS_TABLE_TYPE19 gSmbiosType19Template = {
|
||||
{ EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, sizeof (SMBIOS_TABLE_TYPE19), 0 },
|
||||
0xffffffff, // StartingAddress;
|
||||
@ -66,11 +64,11 @@ CreatePlatformSmbiosMemoryRecords (
|
||||
|
||||
SmbiosLibCreateEntry ((SMBIOS_STRUCTURE *)&gSmbiosType19Template, NULL);
|
||||
}
|
||||
|
||||
HobPtr.Raw = GET_NEXT_HOB (HobPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Main entry for this driver.
|
||||
|
||||
@ -108,12 +106,12 @@ PlatformSmbiosDriverEntryPoint (
|
||||
SmbiosLibUpdateUnicodeString (
|
||||
SmbiosHandle,
|
||||
Smbios.Type0->BiosVersion,
|
||||
(CHAR16 *) PcdGetPtr (PcdFirmwareVersionString)
|
||||
(CHAR16 *)PcdGetPtr (PcdFirmwareVersionString)
|
||||
);
|
||||
SmbiosLibUpdateUnicodeString (
|
||||
SmbiosHandle,
|
||||
Smbios.Type0->BiosReleaseDate,
|
||||
(CHAR16 *) PcdGetPtr (PcdFirmwareReleaseDateString)
|
||||
(CHAR16 *)PcdGetPtr (PcdFirmwareReleaseDateString)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <Protocol/Smbios.h>
|
||||
#include <Library/SmbiosLib.h>
|
||||
|
||||
|
||||
SMBIOS_TABLE_TYPE0 gSmbiosType0Template = {
|
||||
{ EFI_SMBIOS_TYPE_BIOS_INFORMATION, sizeof (SMBIOS_TABLE_TYPE0), 0 },
|
||||
1, // Vendor String
|
||||
@ -101,7 +100,8 @@ SMBIOS_TABLE_TYPE1 gSmbiosType1Template = {
|
||||
2, // ProductName String
|
||||
3, // Version String
|
||||
4, // SerialNumber String
|
||||
{ 0x25EF0280, 0xEC82, 0x42B0, { 0x8F, 0xB6, 0x10, 0xAD, 0xCC, 0xC6, 0x7C, 0x02 } },
|
||||
{ 0x25EF0280, 0xEC82, 0x42B0, { 0x8F, 0xB6, 0x10, 0xAD, 0xCC, 0xC6, 0x7C, 0x02}
|
||||
},
|
||||
SystemWakeupTypePowerSwitch,
|
||||
5, // SKUNumber String
|
||||
6, // Family String
|
||||
@ -157,13 +157,15 @@ SMBIOS_TABLE_TYPE3 gSmbiosType3Template = {
|
||||
ChassisStateSafe, // BootupState;
|
||||
ChassisStateSafe, // PowerSupplyState;
|
||||
ChassisStateSafe, // ThermalState;
|
||||
ChassisSecurityStatusNone,// SecurityStatus;
|
||||
{ 0, 0, 0, 0 }, // OemDefined[4];
|
||||
ChassisSecurityStatusNone, // SecurityStatus;
|
||||
{ 0, 0, 0, 0}, // OemDefined[4];
|
||||
0, // Height;
|
||||
0, // NumberofPowerCords;
|
||||
0, // ContainedElementCount;
|
||||
0, // ContainedElementRecordLength;
|
||||
{ { 0 } }, // ContainedElements[1];
|
||||
{
|
||||
{ 0 }
|
||||
}, // ContainedElements[1];
|
||||
};
|
||||
CHAR8 *gSmbiosType3Strings[] = {
|
||||
"http://www.tianocore.org/edk2/",
|
||||
@ -199,7 +201,6 @@ CHAR8 *gSmbiosType8Strings2[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
SMBIOS_TABLE_TYPE8 gSmbiosType8Template3 = {
|
||||
{ EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE8), 0 },
|
||||
0, // InternalReferenceDesignator String
|
||||
@ -333,7 +334,6 @@ CHAR8 *gSmbiosType11Strings[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
SMBIOS_TABLE_TYPE12 gSmbiosType12Template = {
|
||||
{ EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 },
|
||||
1 // StringCount
|
||||
@ -411,12 +411,10 @@ SMBIOS_TABLE_TYPE23 gSmbiosType23Template = {
|
||||
|
||||
SMBIOS_TABLE_TYPE32 gSmbiosType32Template = {
|
||||
{ EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION, sizeof (SMBIOS_TABLE_TYPE32), 0 },
|
||||
{ 0, 0, 0, 0, 0, 0 }, // Reserved[6];
|
||||
{ 0, 0, 0, 0, 0, 0}, // Reserved[6];
|
||||
BootInformationStatusNoError // BootStatus
|
||||
};
|
||||
|
||||
|
||||
|
||||
SMBIOS_TEMPLATE_ENTRY gSmbiosTemplate[] = {
|
||||
{ (SMBIOS_STRUCTURE *)&gSmbiosType0Template, gSmbiosType0Strings },
|
||||
{ (SMBIOS_STRUCTURE *)&gSmbiosType1Template, gSmbiosType1Strings },
|
||||
|
@ -43,9 +43,10 @@ InitializeRealTimeClock (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EmuGetTime (
|
||||
OUT EFI_TIME * Time,
|
||||
OUT EFI_TIME_CAPABILITIES * Capabilities OPTIONAL
|
||||
OUT EFI_TIME *Time,
|
||||
OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -67,13 +68,11 @@ Returns:
|
||||
|
||||
**/
|
||||
{
|
||||
|
||||
//
|
||||
// Check parameter for null pointer
|
||||
//
|
||||
if (Time == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
||||
}
|
||||
|
||||
gEmuThunk->GetTime (Time, Capabilities);
|
||||
@ -86,6 +85,7 @@ EFIAPI
|
||||
EmuSetTime (
|
||||
IN EFI_TIME *Time
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -111,6 +111,7 @@ Returns:
|
||||
if (Time == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Make sure that the time fields are valid
|
||||
//
|
||||
@ -118,6 +119,7 @@ Returns:
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@ -128,6 +130,7 @@ EmuGetWakeupTime (
|
||||
OUT BOOLEAN *Pending,
|
||||
OUT EFI_TIME *Time
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -162,6 +165,7 @@ EmuSetWakeupTime (
|
||||
IN BOOLEAN Enable,
|
||||
OUT EFI_TIME *Time
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -196,6 +200,7 @@ InitializeRealTimeClock (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -233,6 +238,7 @@ EFI_STATUS
|
||||
RtcTimeFieldsValid (
|
||||
IN EFI_TIME *Time
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -242,18 +248,19 @@ Routine Description:
|
||||
Returns:
|
||||
**/
|
||||
{
|
||||
if (Time->Year < 1998 ||
|
||||
Time->Year > 2099 ||
|
||||
Time->Month < 1 ||
|
||||
Time->Month > 12 ||
|
||||
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->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;
|
||||
}
|
||||
|
||||
@ -265,13 +272,13 @@ DayValid (
|
||||
IN EFI_TIME *Time
|
||||
)
|
||||
{
|
||||
|
||||
STATIC const 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))
|
||||
) {
|
||||
if ((Time->Day < 1) ||
|
||||
(Time->Day > DayOfMonth[Time->Month - 1]) ||
|
||||
((Time->Month == 2) && (!IsLeapYear (Time) && (Time->Day > 28)))
|
||||
)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include <Protocol/Reset.h>
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
EmuResetSystem (
|
||||
@ -52,7 +51,6 @@ EmuResetSystem (
|
||||
gBS->FreePool (HandleBuffer);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Discard ResetType, always return 0 as exit code
|
||||
//
|
||||
@ -66,14 +64,13 @@ EmuResetSystem (
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeEmuReset (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -105,4 +102,3 @@ Returns:
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ SecSwitchStack (
|
||||
UINT32 PermenentMemoryBase
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecTemporaryRamSupport (
|
||||
@ -33,8 +32,8 @@ SecTemporaryRamSupport (
|
||||
// Migrate the whole temporary memory to permanent memory.
|
||||
//
|
||||
CopyMem (
|
||||
(VOID*)(UINTN)PermanentMemoryBase,
|
||||
(VOID*)(UINTN)TemporaryMemoryBase,
|
||||
(VOID *)(UINTN)PermanentMemoryBase,
|
||||
(VOID *)(UINTN)TemporaryMemoryBase,
|
||||
CopySize
|
||||
);
|
||||
|
||||
@ -43,7 +42,7 @@ SecTemporaryRamSupport (
|
||||
// immediately, also we need fixup the stack change caused by new call into
|
||||
// permanent memory.
|
||||
//
|
||||
SecSwitchStack ((UINT32) TemporaryMemoryBase, (UINT32) PermanentMemoryBase);
|
||||
SecSwitchStack ((UINT32)TemporaryMemoryBase, (UINT32)PermanentMemoryBase);
|
||||
|
||||
//
|
||||
// We need *not* fix the return address because currently,
|
||||
@ -53,7 +52,7 @@ SecTemporaryRamSupport (
|
||||
//
|
||||
// Simulate to invalid temporary memory, terminate temporary memory
|
||||
//
|
||||
//ZeroMem ((VOID*)(UINTN)TemporaryMemoryBase, CopySize);
|
||||
// ZeroMem ((VOID*)(UINTN)TemporaryMemoryBase, CopySize);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -10,13 +10,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include "Sec.h"
|
||||
|
||||
|
||||
|
||||
EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mSecTemporaryRamSupportPpi = {
|
||||
SecTemporaryRamSupport
|
||||
};
|
||||
|
||||
|
||||
EFI_PEI_PPI_DESCRIPTOR gPrivateDispatchTable[] = {
|
||||
{
|
||||
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
|
||||
@ -25,8 +22,6 @@ EFI_PEI_PPI_DESCRIPTOR gPrivateDispatchTable[] = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
The entry point of PE/COFF Image for the PEI Core, that has been hijacked by this
|
||||
SEC that sits on top of an OS application. So the entry and exit of this module
|
||||
@ -77,7 +72,7 @@ _ModuleEntryPoint (
|
||||
UINTN Index;
|
||||
EFI_PEI_PPI_DESCRIPTOR PpiArray[10];
|
||||
|
||||
EMU_MAGIC_PAGE()->PpiList = PpiList;
|
||||
EMU_MAGIC_PAGE ()->PpiList = PpiList;
|
||||
ProcessLibraryConstructorList ();
|
||||
|
||||
DEBUG ((DEBUG_ERROR, "SEC Has Started\n"));
|
||||
@ -99,12 +94,12 @@ _ModuleEntryPoint (
|
||||
// Keep everything on a good alignment
|
||||
SecReseveredMemorySize = ALIGN_VALUE (SecReseveredMemorySize, CPU_STACK_ALIGNMENT);
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
// Tell the PEI Core to not use our buffer in temp RAM
|
||||
SecPpiList = (EFI_PEI_PPI_DESCRIPTOR *)SecCoreData->PeiTemporaryRamBase;
|
||||
SecCoreData->PeiTemporaryRamBase = (VOID *)((UINTN)SecCoreData->PeiTemporaryRamBase + SecReseveredMemorySize);
|
||||
SecCoreData->PeiTemporaryRamSize -= SecReseveredMemorySize;
|
||||
#else
|
||||
#else
|
||||
//
|
||||
// When I subtrack from SecCoreData->PeiTemporaryRamBase PEI Core crashes? Either there is a bug
|
||||
// or I don't understand temp RAM correctly?
|
||||
@ -112,7 +107,7 @@ _ModuleEntryPoint (
|
||||
|
||||
SecPpiList = &PpiArray[0];
|
||||
ASSERT (sizeof (PpiArray) >= SecReseveredMemorySize);
|
||||
#endif
|
||||
#endif
|
||||
// Copy existing list, and append our entries.
|
||||
CopyMem (SecPpiList, PpiList, sizeof (EFI_PEI_PPI_DESCRIPTOR) * Index);
|
||||
CopyMem (&SecPpiList[Index], gPrivateDispatchTable, sizeof (gPrivateDispatchTable));
|
||||
|
@ -11,7 +11,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#ifndef __SEC_H___
|
||||
#define __SEC_H___
|
||||
|
||||
|
||||
#include <PiPei.h>
|
||||
#include <Library/EmuMagicPageLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
@ -21,7 +20,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include <Ppi/TemporaryRamSupport.h>
|
||||
|
||||
|
||||
//
|
||||
// I think this should be defined in a MdePkg include file?
|
||||
//
|
||||
@ -40,6 +38,4 @@ SecTemporaryRamSupport (
|
||||
IN UINTN CopySize
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -18,14 +18,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Ppi/EmuThunk.h>
|
||||
#include <Protocol/EmuThunk.h>
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiInitialzeThunkPpiToProtocolPei (
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
@ -49,15 +49,15 @@ EFI_TIMER_NOTIFY mTimerNotifyFunction = NULL;
|
||||
//
|
||||
UINT64 mTimerPeriodMs;
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
TimerCallback (UINT64 DeltaMs)
|
||||
TimerCallback (
|
||||
UINT64 DeltaMs
|
||||
)
|
||||
{
|
||||
EFI_TPL OriginalTPL;
|
||||
EFI_TIMER_NOTIFY CallbackFunction;
|
||||
|
||||
|
||||
OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||
|
||||
if (OriginalTPL < TPL_HIGH_LEVEL) {
|
||||
@ -73,7 +73,6 @@ TimerCallback (UINT64 DeltaMs)
|
||||
}
|
||||
|
||||
gBS->RestoreTPL (OriginalTPL);
|
||||
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
@ -82,6 +81,7 @@ EmuTimerDriverRegisterHandler (
|
||||
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
||||
IN EFI_TIMER_NOTIFY NotifyFunction
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -127,11 +127,11 @@ Returns:
|
||||
//
|
||||
// Check for invalid parameters
|
||||
//
|
||||
if (NotifyFunction == NULL && mTimerNotifyFunction == NULL) {
|
||||
if ((NotifyFunction == NULL) && (mTimerNotifyFunction == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (NotifyFunction != NULL && mTimerNotifyFunction != NULL) {
|
||||
if ((NotifyFunction != NULL) && (mTimerNotifyFunction != NULL)) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
@ -142,6 +142,7 @@ Returns:
|
||||
/* Enable Timer. */
|
||||
gEmuThunk->SetTimer (mTimerPeriodMs, TimerCallback);
|
||||
}
|
||||
|
||||
mTimerNotifyFunction = NotifyFunction;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@ -153,6 +154,7 @@ EmuTimerDriverSetTimerPeriod (
|
||||
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
||||
IN UINT64 TimerPeriod
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -190,14 +192,14 @@ Returns:
|
||||
|
||||
**/
|
||||
{
|
||||
|
||||
//
|
||||
// If TimerPeriod is 0, then the timer thread should be canceled
|
||||
// If the TimerPeriod is valid, then create and/or adjust the period of the timer thread
|
||||
//
|
||||
if (TimerPeriod == 0
|
||||
|| ((TimerPeriod > TIMER_MINIMUM_VALUE)
|
||||
&& (TimerPeriod < TIMER_MAXIMUM_VALUE))) {
|
||||
if ( (TimerPeriod == 0)
|
||||
|| ( (TimerPeriod > TIMER_MINIMUM_VALUE)
|
||||
&& (TimerPeriod < TIMER_MAXIMUM_VALUE)))
|
||||
{
|
||||
mTimerPeriodMs = DivU64x32 (TimerPeriod + 5000, 10000);
|
||||
|
||||
gEmuThunk->SetTimer (mTimerPeriodMs, TimerCallback);
|
||||
@ -212,6 +214,7 @@ EmuTimerDriverGetTimerPeriod (
|
||||
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
||||
OUT UINT64 *TimerPeriod
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -250,6 +253,7 @@ EFIAPI
|
||||
EmuTimerDriverGenerateSoftInterrupt (
|
||||
IN EFI_TIMER_ARCH_PROTOCOL *This
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -283,6 +287,7 @@ EmuTimerDriverInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -341,6 +346,5 @@ Returns:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -13,9 +13,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#ifndef _TIMER_H_
|
||||
#define _TIMER_H_
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Legal timer value range in 100 ns units
|
||||
//
|
||||
|
@ -11,14 +11,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "Host.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
|
||||
#include <Library/NetLib.h>
|
||||
|
||||
#include <Library/NetLib.h>
|
||||
|
||||
#define EMU_SNP_PRIVATE_SIGNATURE SIGNATURE_32('E', 'M', 's', 'n')
|
||||
typedef struct {
|
||||
@ -43,13 +40,11 @@ typedef struct {
|
||||
|
||||
UINT32 ReceivedPackets;
|
||||
UINT32 DroppedPackets;
|
||||
|
||||
} EMU_SNP_PRIVATE;
|
||||
|
||||
#define EMU_SNP_PRIVATE_DATA_FROM_THIS(a) \
|
||||
CR(a, EMU_SNP_PRIVATE, EmuSnp, EMU_SNP_PRIVATE_SIGNATURE)
|
||||
|
||||
|
||||
//
|
||||
// Strange, but there doesn't appear to be any structure for the Ethernet header in edk2...
|
||||
//
|
||||
@ -100,19 +95,18 @@ EmuSnpCreateMapping (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static struct bpf_insn mFilterInstructionTemplate[] = {
|
||||
// Load 4 bytes from the destination MAC address.
|
||||
BPF_STMT (BPF_LD + BPF_W + BPF_ABS, OFFSET_OF (ETHERNET_HEADER, DstAddr[0])),
|
||||
|
||||
// Compare to first 4 bytes of fake MAC address.
|
||||
BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, 0x12345678, 0, 3 ),
|
||||
BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, 0x12345678, 0, 3),
|
||||
|
||||
// Load remaining 2 bytes from the destination MAC address.
|
||||
BPF_STMT (BPF_LD + BPF_H + BPF_ABS, OFFSET_OF( ETHERNET_HEADER, DstAddr[4])),
|
||||
BPF_STMT (BPF_LD + BPF_H + BPF_ABS, OFFSET_OF (ETHERNET_HEADER, DstAddr[4])),
|
||||
|
||||
// Compare to remaining 2 bytes of fake MAC address.
|
||||
BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, 0x9ABC, 5, 0 ),
|
||||
BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, 0x9ABC, 5, 0),
|
||||
|
||||
// Load 4 bytes from the destination MAC address.
|
||||
BPF_STMT (BPF_LD + BPF_W + BPF_ABS, OFFSET_OF (ETHERNET_HEADER, DstAddr[0])),
|
||||
@ -121,7 +115,7 @@ static struct bpf_insn mFilterInstructionTemplate[] = {
|
||||
BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, 0xFFFFFFFF, 0, 2),
|
||||
|
||||
// Load remaining 2 bytes from the destination MAC address.
|
||||
BPF_STMT (BPF_LD + BPF_H + BPF_ABS, OFFSET_OF( ETHERNET_HEADER, DstAddr[4])),
|
||||
BPF_STMT (BPF_LD + BPF_H + BPF_ABS, OFFSET_OF (ETHERNET_HEADER, DstAddr[4])),
|
||||
|
||||
// Compare to remaining 2 bytes of broadcast MAC address.
|
||||
BPF_JUMP (BPF_JMP + BPF_JEQ + BPF_K, 0xFFFF, 1, 0),
|
||||
@ -133,7 +127,6 @@ static struct bpf_insn mFilterInstructionTemplate[] = {
|
||||
BPF_STMT (BPF_RET + BPF_K, -1)
|
||||
};
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
OpenBpfFileDescriptor (
|
||||
IN EMU_SNP_PRIVATE *Private,
|
||||
@ -171,7 +164,6 @@ OpenBpfFileDescriptor (
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Changes the state of a network interface from "stopped" to "started".
|
||||
|
||||
@ -293,7 +285,7 @@ EmuSnpStart (
|
||||
// Install our packet filter: successful reads should only produce broadcast or unicast
|
||||
// packets directed to our fake MAC address.
|
||||
//
|
||||
FilterProgram = malloc (sizeof (mFilterInstructionTemplate)) ;
|
||||
FilterProgram = malloc (sizeof (mFilterInstructionTemplate));
|
||||
if ( FilterProgram == NULL ) {
|
||||
goto ErrorExit;
|
||||
}
|
||||
@ -324,7 +316,6 @@ EmuSnpStart (
|
||||
goto DeviceErrorExit;
|
||||
}
|
||||
|
||||
|
||||
Private->Mode->State = EfiSimpleNetworkStarted;
|
||||
}
|
||||
|
||||
@ -337,10 +328,10 @@ ErrorExit:
|
||||
free (Private->ReadBuffer);
|
||||
Private->ReadBuffer = NULL;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Changes the state of a network interface from "started" to "stopped".
|
||||
|
||||
@ -381,7 +372,7 @@ EmuSnpStop (
|
||||
}
|
||||
|
||||
if (Private->ReadBuffer != NULL) {
|
||||
free (Private->ReadBuffer );
|
||||
free (Private->ReadBuffer);
|
||||
Private->CurrentReadPointer = Private->EndReadPointer = Private->ReadBuffer = NULL;
|
||||
}
|
||||
|
||||
@ -390,7 +381,6 @@ EmuSnpStop (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Resets a network adapter and allocates the transmit and receive buffers
|
||||
required by the network interface; optionally, also requests allocation
|
||||
@ -450,7 +440,6 @@ EmuSnpInitialize (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Resets a network adapter and re-initializes it with the parameters that were
|
||||
provided in the previous call to Initialize().
|
||||
@ -493,7 +482,6 @@ EmuSnpReset (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Resets a network adapter and leaves it in a state that is safe for
|
||||
another driver to initialize.
|
||||
@ -590,7 +578,6 @@ EmuSnpReceiveFilters (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Modifies or resets the current station address, if supported.
|
||||
|
||||
@ -620,7 +607,6 @@ EmuSnpStationAddress (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Resets or collects the statistics on a network interface.
|
||||
|
||||
@ -657,7 +643,6 @@ EmuSnpStatistics (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Converts a multicast IP address to a multicast HW MAC address.
|
||||
|
||||
@ -694,7 +679,6 @@ EmuSnpMCastIpToMac (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Performs read and write operations on the NVRAM device attached to a
|
||||
network interface.
|
||||
@ -774,7 +758,6 @@ EmuSnpGetStatus (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Places a packet in the transmit queue of a network interface.
|
||||
|
||||
@ -837,12 +820,12 @@ EmuSnpTransmit (
|
||||
SrcAddr = &Private->Mode->CurrentAddress;
|
||||
}
|
||||
|
||||
EnetHeader = (ETHERNET_HEADER *) Buffer;
|
||||
EnetHeader = (ETHERNET_HEADER *)Buffer;
|
||||
|
||||
CopyMem (EnetHeader->DstAddr, DestAddr, NET_ETHER_ADDR_LEN);
|
||||
CopyMem (EnetHeader->SrcAddr, SrcAddr, NET_ETHER_ADDR_LEN);
|
||||
|
||||
EnetHeader->Type = HTONS(*Protocol);
|
||||
EnetHeader->Type = HTONS (*Protocol);
|
||||
}
|
||||
|
||||
if (write (Private->BpfFd, Buffer, BufferSize) < 0) {
|
||||
@ -907,7 +890,7 @@ EmuSnpReceive (
|
||||
return EFI_NOT_STARTED;
|
||||
}
|
||||
|
||||
ZeroMem (&BpfStats, sizeof( BpfStats));
|
||||
ZeroMem (&BpfStats, sizeof (BpfStats));
|
||||
|
||||
if (ioctl (Private->BpfFd, BIOCGSTATS, &BpfStats) == 0) {
|
||||
Private->ReceivedPackets += BpfStats.bs_recv;
|
||||
@ -972,7 +955,6 @@ EmuSnpReceive (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EMU_SNP_PROTOCOL gEmuSnpProtocol = {
|
||||
GasketSnpCreateMapping,
|
||||
GasketSnpStart,
|
||||
@ -1025,7 +1007,7 @@ GetInterfaceMacAddr (
|
||||
IfSdl = (struct sockaddr_dl *)If->ifa_addr;
|
||||
|
||||
if (IfSdl->sdl_family == AF_LINK) {
|
||||
if (!AsciiStrCmp( Private->InterfaceName, If->ifa_name)) {
|
||||
if (!AsciiStrCmp (Private->InterfaceName, If->ifa_name)) {
|
||||
CopyMem (&Private->MacAddress, LLADDR (IfSdl), NET_ETHER_ADDR_LEN);
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
@ -1041,7 +1023,6 @@ Exit:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuSnpThunkOpen (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
@ -1062,7 +1043,6 @@ EmuSnpThunkOpen (
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
Private->Signature = EMU_SNP_PRIVATE_SIGNATURE;
|
||||
Private->Thunk = This;
|
||||
CopyMem (&Private->EmuSnp, &gEmuSnpProtocol, sizeof (gEmuSnpProtocol));
|
||||
@ -1073,7 +1053,6 @@ EmuSnpThunkOpen (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuSnpThunkClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
@ -1091,8 +1070,6 @@ EmuSnpThunkClose (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL gSnpThunkIo = {
|
||||
&gEmuSnpProtocolGuid,
|
||||
NULL,
|
||||
|
@ -27,21 +27,17 @@ typedef struct {
|
||||
|
||||
EMU_BLOCK_IO_PROTOCOL EmuBlockIo;
|
||||
EFI_BLOCK_IO_MEDIA *Media;
|
||||
|
||||
} EMU_BLOCK_IO_PRIVATE;
|
||||
|
||||
#define EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
|
||||
CR(a, EMU_BLOCK_IO_PRIVATE, EmuBlockIo, EMU_BLOCK_IO_PRIVATE_SIGNATURE)
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuBlockIoReset (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
This function extends the capability of SetFilePointer to accept 64 bit parameters
|
||||
@ -72,7 +68,6 @@ SetFilePointer64 (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuBlockIoOpenDevice (
|
||||
IN EMU_BLOCK_IO_PRIVATE *Private
|
||||
@ -82,7 +77,6 @@ EmuBlockIoOpenDevice (
|
||||
UINT64 FileSize;
|
||||
struct statfs buf;
|
||||
|
||||
|
||||
//
|
||||
// If the device is already opened, close it
|
||||
//
|
||||
@ -95,7 +89,7 @@ EmuBlockIoOpenDevice (
|
||||
//
|
||||
Private->fd = open (Private->Filename, Private->Mode, 0644);
|
||||
if (Private->fd < 0) {
|
||||
printf ("EmuOpenBlock: Could not open %s: %s\n", Private->Filename, strerror(errno));
|
||||
printf ("EmuOpenBlock: Could not open %s: %s\n", Private->Filename, strerror (errno));
|
||||
Private->Media->MediaPresent = FALSE;
|
||||
Status = EFI_NO_MEDIA;
|
||||
goto Done;
|
||||
@ -120,13 +114,14 @@ EmuBlockIoOpenDevice (
|
||||
|
||||
if (FileSize == 0) {
|
||||
// lseek fails on a real device. ioctl calls are OS specific
|
||||
#if __APPLE__
|
||||
#if __APPLE__
|
||||
{
|
||||
UINT32 BlockSize;
|
||||
|
||||
if (ioctl (Private->fd, DKIOCGETBLOCKSIZE, &BlockSize) == 0) {
|
||||
Private->Media->BlockSize = BlockSize;
|
||||
}
|
||||
|
||||
if (ioctl (Private->fd, DKIOCGETBLOCKCOUNT, &Private->NumberOfBlocks) == 0) {
|
||||
if ((Private->NumberOfBlocks == 0) && (BlockSize == 0x800)) {
|
||||
// A DVD is ~ 4.37 GB so make up a number
|
||||
@ -135,9 +130,10 @@ EmuBlockIoOpenDevice (
|
||||
Private->Media->LastBlock = Private->NumberOfBlocks - 1;
|
||||
}
|
||||
}
|
||||
|
||||
ioctl (Private->fd, DKIOCGETMAXBLOCKCOUNTWRITE, &Private->Media->OptimalTransferLengthGranularity);
|
||||
}
|
||||
#else
|
||||
#else
|
||||
{
|
||||
size_t BlockSize;
|
||||
UINT64 DiskSize;
|
||||
@ -145,24 +141,24 @@ EmuBlockIoOpenDevice (
|
||||
if (ioctl (Private->fd, BLKSSZGET, &BlockSize) == 0) {
|
||||
Private->Media->BlockSize = BlockSize;
|
||||
}
|
||||
|
||||
if (ioctl (Private->fd, BLKGETSIZE64, &DiskSize) == 0) {
|
||||
Private->NumberOfBlocks = DivU64x32 (DiskSize, (UINT32)BlockSize);
|
||||
Private->Media->LastBlock = Private->NumberOfBlocks - 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
} else {
|
||||
Private->Media->BlockSize = Private->BlockSize;
|
||||
Private->NumberOfBlocks = DivU64x32 (FileSize, Private->Media->BlockSize);
|
||||
Private->Media->LastBlock = Private->NumberOfBlocks - 1;
|
||||
|
||||
if (fstatfs (Private->fd, &buf) == 0) {
|
||||
#if __APPLE__
|
||||
#if __APPLE__
|
||||
Private->Media->OptimalTransferLengthGranularity = buf.f_iosize/buf.f_bsize;
|
||||
#else
|
||||
#else
|
||||
Private->Media->OptimalTransferLengthGranularity = buf.f_bsize/buf.f_bsize;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,7 +175,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuBlockIoCreateMapping (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
@ -206,17 +201,14 @@ EmuBlockIoCreateMapping (
|
||||
Media->LowestAlignedLba = 0;
|
||||
Media->LogicalBlocksPerPhysicalBlock = 0;
|
||||
|
||||
|
||||
// EFI_BLOCK_IO_PROTOCOL_REVISION3
|
||||
Media->OptimalTransferLengthGranularity = 0;
|
||||
|
||||
Status = EmuBlockIoOpenDevice (Private);
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuBlockIoError (
|
||||
IN EMU_BLOCK_IO_PRIVATE *Private
|
||||
@ -225,9 +217,7 @@ EmuBlockIoError (
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN ReinstallBlockIoFlag;
|
||||
|
||||
|
||||
switch (errno) {
|
||||
|
||||
case EAGAIN:
|
||||
Status = EFI_NO_MEDIA;
|
||||
Private->Media->ReadOnly = FALSE;
|
||||
@ -254,10 +244,10 @@ EmuBlockIoError (
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuBlockIoReadWriteCommon (
|
||||
IN EMU_BLOCK_IO_PRIVATE *Private,
|
||||
@ -290,7 +280,7 @@ EmuBlockIoReadWriteCommon (
|
||||
return EFI_MEDIA_CHANGED;
|
||||
}
|
||||
|
||||
if ((UINTN) Buffer % Private->Media->IoAlign != 0) {
|
||||
if ((UINTN)Buffer % Private->Media->IoAlign != 0) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -313,6 +303,7 @@ EmuBlockIoReadWriteCommon (
|
||||
DEBUG ((DEBUG_INIT, "ReadBlocks: Attempted to read off end of device\n"));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Seek to End of File
|
||||
//
|
||||
@ -327,7 +318,6 @@ EmuBlockIoReadWriteCommon (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@ -403,10 +393,10 @@ Done:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Write BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@ -452,7 +442,6 @@ EmuBlockIoWriteBlocks (
|
||||
ssize_t len;
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
Status = EmuBlockIoReadWriteCommon (Private, MediaId, LBA, BufferSize, Buffer, "UnixWriteBlocks");
|
||||
@ -486,7 +475,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Flush the Block Device.
|
||||
|
||||
@ -521,12 +509,11 @@ EmuBlockIoFlushBlocks (
|
||||
|
||||
if (Private->fd >= 0) {
|
||||
fsync (Private->fd);
|
||||
#if __APPLE__
|
||||
#if __APPLE__
|
||||
fcntl (Private->fd, F_FULLFSYNC);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (Token != NULL) {
|
||||
if (Token->Event != NULL) {
|
||||
// Caller is responsible for signaling EFI Event
|
||||
@ -538,7 +525,6 @@ EmuBlockIoFlushBlocks (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reset the block device hardware.
|
||||
|
||||
@ -570,7 +556,6 @@ EmuBlockIoReset (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
StdDupUnicodeToAscii (
|
||||
IN CHAR16 *Str
|
||||
@ -589,12 +574,12 @@ StdDupUnicodeToAscii (
|
||||
for (Ptr = Ascii; *Str != '\0'; Ptr++, Str++) {
|
||||
*Ptr = *Str;
|
||||
}
|
||||
|
||||
*Ptr = 0;
|
||||
|
||||
return Ascii;
|
||||
}
|
||||
|
||||
|
||||
EMU_BLOCK_IO_PROTOCOL gEmuBlockIoProtocol = {
|
||||
GasketEmuBlockIoReset,
|
||||
GasketEmuBlockIoReadBlocks,
|
||||
@ -624,7 +609,6 @@ EmuBlockIoThunkOpen (
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
Private->Signature = EMU_BLOCK_IO_PRIVATE_SIGNATURE;
|
||||
Private->Thunk = This;
|
||||
CopyMem (&Private->EmuBlockIo, &gEmuBlockIoProtocol, sizeof (gEmuBlockIoProtocol));
|
||||
@ -642,12 +626,14 @@ EmuBlockIoThunkOpen (
|
||||
Private->WriteProtected = FALSE;
|
||||
} else {
|
||||
for (*Str++ = '\0'; *Str != 0; Str++) {
|
||||
if (*Str == 'R' || *Str == 'F') {
|
||||
Private->RemovableMedia = (BOOLEAN) (*Str == 'R');
|
||||
if ((*Str == 'R') || (*Str == 'F')) {
|
||||
Private->RemovableMedia = (BOOLEAN)(*Str == 'R');
|
||||
}
|
||||
if (*Str == 'O' || *Str == 'W') {
|
||||
Private->WriteProtected = (BOOLEAN) (*Str == 'O');
|
||||
|
||||
if ((*Str == 'O') || (*Str == 'W')) {
|
||||
Private->WriteProtected = (BOOLEAN)(*Str == 'O');
|
||||
}
|
||||
|
||||
if (*Str == ':') {
|
||||
Private->BlockSize = strtol (++Str, NULL, 0);
|
||||
break;
|
||||
@ -662,7 +648,6 @@ EmuBlockIoThunkOpen (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuBlockIoThunkClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
@ -680,6 +665,7 @@ EmuBlockIoThunkClose (
|
||||
if (Private->Filename != NULL) {
|
||||
free (Private->Filename);
|
||||
}
|
||||
|
||||
free (This->Private);
|
||||
This->Private = NULL;
|
||||
}
|
||||
@ -687,8 +673,6 @@ EmuBlockIoThunkClose (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL gBlockIoThunkIo = {
|
||||
&gEmuBlockIoProtocolGuid,
|
||||
NULL,
|
||||
|
@ -20,12 +20,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#ifdef __APPLE__
|
||||
#define DebugAssert _Mangle__DebugAssert
|
||||
|
||||
#include <assert.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include <mach/mach.h>
|
||||
#include <mach/mach_time.h>
|
||||
#include <assert.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include <mach/mach.h>
|
||||
#include <mach/mach_time.h>
|
||||
|
||||
#undef DebugAssert
|
||||
#undef DebugAssert
|
||||
#endif
|
||||
|
||||
int settimer_initialized;
|
||||
@ -34,7 +34,6 @@ UINTN settimer_callback = 0;
|
||||
|
||||
BOOLEAN gEmulatorInterruptEnabled = FALSE;
|
||||
|
||||
|
||||
UINTN
|
||||
SecWriteStdErr (
|
||||
IN UINT8 *Buffer,
|
||||
@ -48,7 +47,6 @@ SecWriteStdErr (
|
||||
return (Return == -1) ? 0 : Return;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
SecConfigStdIn (
|
||||
VOID
|
||||
@ -63,7 +61,7 @@ SecConfigStdIn (
|
||||
tty.c_lflag &= ~(ICANON | ECHO);
|
||||
tcsetattr (STDIN_FILENO, TCSANOW, &tty);
|
||||
|
||||
// setvbuf (STDIN_FILENO, NULL, _IONBF, 0);
|
||||
// setvbuf (STDIN_FILENO, NULL, _IONBF, 0);
|
||||
|
||||
// now ioctl FIONREAD will do what we need
|
||||
return EFI_SUCCESS;
|
||||
@ -111,7 +109,6 @@ SecPollStdIn (
|
||||
return (BOOLEAN)(Bytes > 0);
|
||||
}
|
||||
|
||||
|
||||
VOID *
|
||||
SecMalloc (
|
||||
IN UINTN Size
|
||||
@ -143,9 +140,10 @@ SecFree (
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
settimer_handler (int sig)
|
||||
settimer_handler (
|
||||
int sig
|
||||
)
|
||||
{
|
||||
struct timeval timeval;
|
||||
UINT64 delta;
|
||||
@ -181,23 +179,25 @@ SecSetTimer (
|
||||
if (sigaction (SIGALRM, &act, NULL) != 0) {
|
||||
printf ("SetTimer: sigaction error %s\n", strerror (errno));
|
||||
}
|
||||
|
||||
if (gettimeofday (&settimer_timeval, NULL) != 0) {
|
||||
printf ("SetTimer: gettimeofday error %s\n", strerror (errno));
|
||||
}
|
||||
}
|
||||
timerval.it_value.tv_sec = DivU64x32(PeriodMs, 1000);
|
||||
DivU64x32Remainder(PeriodMs, 1000, &remainder);
|
||||
|
||||
timerval.it_value.tv_sec = DivU64x32 (PeriodMs, 1000);
|
||||
DivU64x32Remainder (PeriodMs, 1000, &remainder);
|
||||
timerval.it_value.tv_usec = remainder * 1000;
|
||||
timerval.it_value.tv_sec = DivU64x32(PeriodMs, 1000);
|
||||
timerval.it_value.tv_sec = DivU64x32 (PeriodMs, 1000);
|
||||
timerval.it_interval = timerval.it_value;
|
||||
|
||||
if (setitimer (ITIMER_REAL, &timerval, NULL) != 0) {
|
||||
printf ("SetTimer: setitimer error %s\n", strerror (errno));
|
||||
}
|
||||
|
||||
settimer_callback = (UINTN)CallBack;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
SecEnableInterrupt (
|
||||
VOID
|
||||
@ -213,7 +213,6 @@ SecEnableInterrupt (
|
||||
pthread_sigmask (SIG_UNBLOCK, &sigset, NULL);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
SecDisableInterrupt (
|
||||
VOID
|
||||
@ -229,14 +228,14 @@ SecDisableInterrupt (
|
||||
gEmulatorInterruptEnabled = FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
SecInterruptEanbled (void)
|
||||
SecInterruptEanbled (
|
||||
void
|
||||
)
|
||||
{
|
||||
return gEmulatorInterruptEnabled;
|
||||
}
|
||||
|
||||
|
||||
UINT64
|
||||
QueryPerformanceFrequency (
|
||||
VOID
|
||||
@ -251,11 +250,10 @@ QueryPerformanceCounter (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
#if __APPLE__
|
||||
#if __APPLE__
|
||||
UINT64 Start;
|
||||
static mach_timebase_info_data_t sTimebaseInfo;
|
||||
|
||||
|
||||
Start = mach_absolute_time ();
|
||||
|
||||
// Convert to nanoseconds.
|
||||
@ -266,21 +264,19 @@ QueryPerformanceCounter (
|
||||
// denominator is a fraction.
|
||||
|
||||
if ( sTimebaseInfo.denom == 0 ) {
|
||||
(void) mach_timebase_info(&sTimebaseInfo);
|
||||
(void)mach_timebase_info (&sTimebaseInfo);
|
||||
}
|
||||
|
||||
// Do the maths. We hope that the multiplication doesn't
|
||||
// overflow; the price you pay for working in fixed point.
|
||||
|
||||
return (Start * sTimebaseInfo.numer) / sTimebaseInfo.denom;
|
||||
#else
|
||||
#else
|
||||
// Need to figure out what to do for Linux?
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
SecSleep (
|
||||
IN UINT64 Nanoseconds
|
||||
@ -309,17 +305,20 @@ SecSleep (
|
||||
if (errno != EINTR) {
|
||||
break;
|
||||
}
|
||||
|
||||
gettimeofday (&start, NULL);
|
||||
if (start.tv_sec > end.tv_sec) {
|
||||
break;
|
||||
} if ((start.tv_sec == end.tv_sec) && (start.tv_usec > end.tv_usec)) {
|
||||
}
|
||||
|
||||
if ((start.tv_sec == end.tv_sec) && (start.tv_usec > end.tv_usec)) {
|
||||
break;
|
||||
}
|
||||
|
||||
rq = rm;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
SecCpuSleep (
|
||||
VOID
|
||||
@ -334,7 +333,6 @@ SecCpuSleep (
|
||||
nanosleep (&rq, &rm);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
SecExit (
|
||||
UINTN Status
|
||||
@ -343,7 +341,6 @@ SecExit (
|
||||
exit (Status);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
SecGetTime (
|
||||
OUT EFI_TIME *Time,
|
||||
@ -374,8 +371,6 @@ SecGetTime (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
SecSetTime (
|
||||
IN EFI_TIME *Time
|
||||
@ -386,7 +381,6 @@ SecSetTime (
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
SecGetNextProtocol (
|
||||
IN BOOLEAN EmuBusDriver,
|
||||
@ -396,7 +390,6 @@ SecGetNextProtocol (
|
||||
return GetNextThunkProtocol (EmuBusDriver, Instance);
|
||||
}
|
||||
|
||||
|
||||
EMU_THUNK_PROTOCOL gEmuThunkProtocol = {
|
||||
GasketSecWriteStdErr,
|
||||
GasketSecConfigStdIn,
|
||||
@ -422,7 +415,6 @@ EMU_THUNK_PROTOCOL gEmuThunkProtocol = {
|
||||
GasketSecGetNextProtocol
|
||||
};
|
||||
|
||||
|
||||
VOID
|
||||
SecInitThunkProtocol (
|
||||
VOID
|
||||
@ -431,4 +423,3 @@ SecInitThunkProtocol (
|
||||
// timezone and daylight lib globals depend on tzset be called 1st.
|
||||
tzset ();
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,6 @@ GasketSecFree (
|
||||
IN VOID *Ptr
|
||||
);
|
||||
|
||||
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
GasketSecPeCoffGetEntryPoint (
|
||||
@ -116,7 +115,6 @@ GasketQueryPerformanceCounter (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GasketSecSleep (
|
||||
@ -155,10 +153,8 @@ GasketSecGetNextProtocol (
|
||||
OUT EMU_IO_THUNK_PROTOCOL **Instance OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
// PPIs produced by SEC
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSecUnixPeiAutoScan (
|
||||
@ -173,7 +169,6 @@ GasketSecEmuThunkAddress (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSecUnixUnixFwhAddress (
|
||||
@ -181,15 +176,13 @@ GasketSecUnixUnixFwhAddress (
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *FwhBase
|
||||
);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Reverse (UNIX to EFIAPI) gaskets
|
||||
//
|
||||
|
||||
typedef
|
||||
void
|
||||
(EFIAPI *CALL_BACK) (
|
||||
(EFIAPI *CALL_BACK)(
|
||||
UINT64 Delta
|
||||
);
|
||||
|
||||
@ -210,7 +203,6 @@ ReverseGasketUint64Uint64 (
|
||||
// Gasket functions for EFI_EMU_UGA_IO_PROTOCOL
|
||||
//
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketX11Size (
|
||||
@ -248,7 +240,6 @@ GasketX11RegisterKeyNotify (
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketX11Blt (
|
||||
@ -291,36 +282,30 @@ GasketPthreadMutexLock (
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketPthreadMutexUnLock (
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketPthreadMutexTryLock (
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
VOID *
|
||||
EFIAPI
|
||||
GasketPthreadMutexInit (
|
||||
IN VOID
|
||||
);
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketPthreadMutexDestroy (
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketPthreadCreate (
|
||||
@ -336,7 +321,6 @@ GasketPthreadExit (
|
||||
IN VOID *ValuePtr
|
||||
);
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketPthreadSelf (
|
||||
@ -355,7 +339,6 @@ GasketPthreadClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
);
|
||||
|
||||
|
||||
// PosixFileSystem
|
||||
|
||||
EFI_STATUS
|
||||
@ -639,7 +622,4 @@ GasketSnpReceive (
|
||||
OUT UINT16 *Protocol OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -12,7 +12,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#define MAP_ANONYMOUS MAP_ANON
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
@ -26,7 +25,6 @@ EMU_THUNK_PPI mSecEmuThunkPpi = {
|
||||
char *gGdbWorkingFileName = NULL;
|
||||
unsigned int mScriptSymbolChangesCount = 0;
|
||||
|
||||
|
||||
//
|
||||
// Default information about where the FD is located.
|
||||
// This array gets filled in with information from EFI_FIRMWARE_VOLUMES
|
||||
@ -46,17 +44,13 @@ EMU_FD_INFO *gFdInfo;
|
||||
UINTN gSystemMemoryCount = 0;
|
||||
EMU_SYSTEM_MEMORY *gSystemMemory;
|
||||
|
||||
|
||||
|
||||
UINTN mImageContextModHandleArraySize = 0;
|
||||
IMAGE_CONTEXT_TO_MOD_HANDLE *mImageContextModHandleArray = NULL;
|
||||
|
||||
EFI_PEI_PPI_DESCRIPTOR *gPpiList;
|
||||
|
||||
|
||||
int gInXcode = 0;
|
||||
|
||||
|
||||
/*++
|
||||
Breakpoint target for Xcode project. Set in the Xcode XML
|
||||
|
||||
@ -71,8 +65,6 @@ SecGdbConfigBreak (
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -122,7 +114,7 @@ main (
|
||||
// symbols to be loaded.
|
||||
//
|
||||
Index = strlen (*Argv);
|
||||
gGdbWorkingFileName = AllocatePool (Index + strlen(".gdb") + 1);
|
||||
gGdbWorkingFileName = AllocatePool (Index + strlen (".gdb") + 1);
|
||||
strcpy (gGdbWorkingFileName, *Argv);
|
||||
strcat (gGdbWorkingFileName, ".gdb");
|
||||
|
||||
@ -139,8 +131,8 @@ main (
|
||||
setbuf (stdout, 0);
|
||||
setbuf (stderr, 0);
|
||||
|
||||
MemorySizeStr = (CHAR16 *) PcdGetPtr (PcdEmuMemorySize);
|
||||
FirmwareVolumesStr = (CHAR16 *) PcdGetPtr (PcdEmuFirmwareVolume);
|
||||
MemorySizeStr = (CHAR16 *)PcdGetPtr (PcdEmuMemorySize);
|
||||
FirmwareVolumesStr = (CHAR16 *)PcdGetPtr (PcdEmuFirmwareVolume);
|
||||
|
||||
//
|
||||
// PPIs pased into PEI_CORE
|
||||
@ -175,6 +167,7 @@ main (
|
||||
printf ("ERROR : Can not allocate memory for system. Exiting.\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
//
|
||||
// Allocate space for gSystemMemory Array
|
||||
//
|
||||
@ -194,29 +187,33 @@ main (
|
||||
//
|
||||
InitialStackMemorySize = STACK_SIZE;
|
||||
InitialStackMemory = (UINTN)MapMemory (
|
||||
0, (UINT32) InitialStackMemorySize,
|
||||
PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE
|
||||
0,
|
||||
(UINT32)InitialStackMemorySize,
|
||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||
MAP_ANONYMOUS | MAP_PRIVATE
|
||||
);
|
||||
if (InitialStackMemory == 0) {
|
||||
printf ("ERROR : Can not open SecStack Exiting\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
printf (" OS Emulator passing in %u KB of temp RAM at 0x%08lx to SEC\n",
|
||||
printf (
|
||||
" OS Emulator passing in %u KB of temp RAM at 0x%08lx to SEC\n",
|
||||
(unsigned int)(InitialStackMemorySize / 1024),
|
||||
(unsigned long)InitialStackMemory
|
||||
);
|
||||
|
||||
for (StackPointer = (UINTN*) (UINTN) InitialStackMemory;
|
||||
StackPointer < (UINTN*)(UINTN)((UINTN) InitialStackMemory + (UINT64) InitialStackMemorySize);
|
||||
StackPointer ++) {
|
||||
for (StackPointer = (UINTN *)(UINTN)InitialStackMemory;
|
||||
StackPointer < (UINTN *)(UINTN)((UINTN)InitialStackMemory + (UINT64)InitialStackMemorySize);
|
||||
StackPointer++)
|
||||
{
|
||||
*StackPointer = 0x5AA55AA5;
|
||||
}
|
||||
|
||||
//
|
||||
// Open All the firmware volumes and remember the info in the gFdInfo global
|
||||
//
|
||||
FileName = (CHAR8 *) AllocatePool (StrLen (FirmwareVolumesStr) + 1);
|
||||
FileName = (CHAR8 *)AllocatePool (StrLen (FirmwareVolumesStr) + 1);
|
||||
if (FileName == NULL) {
|
||||
printf ("ERROR : Can not allocate memory for firmware volume string\n");
|
||||
exit (1);
|
||||
@ -225,13 +222,16 @@ main (
|
||||
Index2 = 0;
|
||||
for (Done = FALSE, Index = 0, PeiIndex = 0, SecFile = NULL;
|
||||
FirmwareVolumesStr[Index2] != 0;
|
||||
Index++) {
|
||||
Index++)
|
||||
{
|
||||
for (Index1 = 0; (FirmwareVolumesStr[Index2] != '!') && (FirmwareVolumesStr[Index2] != 0); Index2++) {
|
||||
FileName[Index1++] = FirmwareVolumesStr[Index2];
|
||||
}
|
||||
|
||||
if (FirmwareVolumesStr[Index2] == '!') {
|
||||
Index2++;
|
||||
}
|
||||
|
||||
FileName[Index1] = '\0';
|
||||
|
||||
if (Index == 0) {
|
||||
@ -252,12 +252,13 @@ main (
|
||||
&gFdInfo[Index].Size
|
||||
);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
printf ("ERROR : Can not open Firmware Device File %s (%x). Exiting.\n", FileName, (unsigned int)Status);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
printf (" FD loaded from %s at 0x%08lx",FileName, (unsigned long)gFdInfo[Index].Address);
|
||||
printf (" FD loaded from %s at 0x%08lx", FileName, (unsigned long)gFdInfo[Index].Address);
|
||||
|
||||
if (SecFile == NULL) {
|
||||
//
|
||||
@ -303,10 +304,12 @@ main (
|
||||
val = val * 10 + MemorySizeStr[Index1] - '0';
|
||||
Index1++;
|
||||
}
|
||||
|
||||
gSystemMemory[Index++].Size = val * 0x100000;
|
||||
if (MemorySizeStr[Index1] == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
Index1++;
|
||||
}
|
||||
|
||||
@ -315,7 +318,7 @@ main (
|
||||
//
|
||||
// Hand off to SEC
|
||||
//
|
||||
SecLoadFromCore ((UINTN) InitialStackMemory, (UINTN) InitialStackMemorySize, (UINTN) gFdInfo[0].Address, SecFile);
|
||||
SecLoadFromCore ((UINTN)InitialStackMemory, (UINTN)InitialStackMemorySize, (UINTN)gFdInfo[0].Address, SecFile);
|
||||
|
||||
//
|
||||
// If we get here, then the SEC Core returned. This is an error as SEC should
|
||||
@ -325,7 +328,6 @@ main (
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
||||
EFI_PHYSICAL_ADDRESS *
|
||||
MapMemory (
|
||||
IN INTN fd,
|
||||
@ -343,22 +345,23 @@ MapMemory (
|
||||
// Try to get an aligned block somewhere in the address space of this
|
||||
// process.
|
||||
//
|
||||
while((!isAligned) && (base != 0)) {
|
||||
while ((!isAligned) && (base != 0)) {
|
||||
res = mmap ((void *)base, length, prot, flags, fd, 0);
|
||||
if (res == MAP_FAILED) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((((UINTN)res) & ~(align-1)) == (UINTN)res) {
|
||||
isAligned=1;
|
||||
isAligned = 1;
|
||||
} else {
|
||||
munmap(res, length);
|
||||
munmap (res, length);
|
||||
base += align;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -397,8 +400,8 @@ MapFile (
|
||||
if (fd < 0) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
FileSize = lseek (fd, 0, SEEK_END);
|
||||
|
||||
FileSize = lseek (fd, 0, SEEK_END);
|
||||
|
||||
res = MapMemory (fd, FileSize, PROT_READ | PROT_EXEC, MAP_PRIVATE);
|
||||
|
||||
@ -409,8 +412,8 @@ MapFile (
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
*Length = (UINT64) FileSize;
|
||||
*BaseAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) res;
|
||||
*Length = (UINT64)FileSize;
|
||||
*BaseAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)res;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@ -432,6 +435,7 @@ MapFd0 (
|
||||
if (fd < 0) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
FileSize = lseek (fd, 0, SEEK_END);
|
||||
|
||||
FvSize = FixedPcdGet64 (PcdEmuFlashFvRecoverySize);
|
||||
@ -504,13 +508,12 @@ MapFd0 (
|
||||
}
|
||||
}
|
||||
|
||||
*Length = (UINT64) FileSize;
|
||||
*BaseAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) res;
|
||||
*Length = (UINT64)FileSize;
|
||||
*BaseAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)res;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -545,7 +548,7 @@ SecLoadFromCore (
|
||||
// Compute Top Of Memory for Stack and PEI Core Allocations
|
||||
//
|
||||
TopOfMemory = LargestRegion + LargestRegionSize;
|
||||
PeiStackSize = (UINTN)RShiftU64((UINT64)STACK_SIZE,1);
|
||||
PeiStackSize = (UINTN)RShiftU64 ((UINT64)STACK_SIZE, 1);
|
||||
|
||||
//
|
||||
// |-----------| <---- TemporaryRamBase + TemporaryRamSize
|
||||
@ -565,19 +568,18 @@ SecLoadFromCore (
|
||||
TopOfStack = (VOID *)((UINTN)TopOfStack - sizeof (EFI_SEC_PEI_HAND_OFF) - CPU_STACK_ALIGNMENT);
|
||||
TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
|
||||
|
||||
|
||||
//
|
||||
// Bind this information into the SEC hand-off state
|
||||
//
|
||||
SecCoreData = (EFI_SEC_PEI_HAND_OFF*)(UINTN) TopOfStack;
|
||||
SecCoreData->DataSize = sizeof(EFI_SEC_PEI_HAND_OFF);
|
||||
SecCoreData->BootFirmwareVolumeBase = (VOID*)BootFirmwareVolumeBase;
|
||||
SecCoreData = (EFI_SEC_PEI_HAND_OFF *)(UINTN)TopOfStack;
|
||||
SecCoreData->DataSize = sizeof (EFI_SEC_PEI_HAND_OFF);
|
||||
SecCoreData->BootFirmwareVolumeBase = (VOID *)BootFirmwareVolumeBase;
|
||||
SecCoreData->BootFirmwareVolumeSize = PcdGet32 (PcdEmuFirmwareFdSize);
|
||||
SecCoreData->TemporaryRamBase = (VOID*)(UINTN)LargestRegion;
|
||||
SecCoreData->TemporaryRamBase = (VOID *)(UINTN)LargestRegion;
|
||||
SecCoreData->TemporaryRamSize = STACK_SIZE;
|
||||
SecCoreData->StackBase = SecCoreData->TemporaryRamBase;
|
||||
SecCoreData->StackSize = PeiStackSize;
|
||||
SecCoreData->PeiTemporaryRamBase = (VOID*) ((UINTN) SecCoreData->TemporaryRamBase + PeiStackSize);
|
||||
SecCoreData->PeiTemporaryRamBase = (VOID *)((UINTN)SecCoreData->TemporaryRamBase + PeiStackSize);
|
||||
SecCoreData->PeiTemporaryRamSize = STACK_SIZE - PeiStackSize;
|
||||
|
||||
//
|
||||
@ -585,14 +587,14 @@ SecLoadFromCore (
|
||||
//
|
||||
Status = SecPeCoffGetEntryPoint (PeiCorePe32File, (VOID **)&PeiCoreEntryPoint);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Transfer control to the SEC Core
|
||||
//
|
||||
PeiSwitchStacks (
|
||||
(SWITCH_STACK_ENTRY_POINT) (UINTN) PeiCoreEntryPoint,
|
||||
(SWITCH_STACK_ENTRY_POINT)(UINTN)PeiCoreEntryPoint,
|
||||
SecCoreData,
|
||||
(VOID *)gPpiList,
|
||||
TopOfStack
|
||||
@ -600,10 +602,9 @@ SecLoadFromCore (
|
||||
//
|
||||
// If we get here, then the SEC Core returned. This is an error
|
||||
//
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -639,13 +640,15 @@ SecUnixPeiAutoScan (
|
||||
|
||||
*MemoryBase = 0;
|
||||
res = MapMemory (
|
||||
0, gSystemMemory[Index].Size,
|
||||
0,
|
||||
gSystemMemory[Index].Size,
|
||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS
|
||||
);
|
||||
if (res == MAP_FAILED) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
*MemorySize = gSystemMemory[Index].Size;
|
||||
*MemoryBase = (UINTN)res;
|
||||
gSystemMemory[Index].Memory = *MemoryBase;
|
||||
@ -653,7 +656,6 @@ SecUnixPeiAutoScan (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -684,7 +686,8 @@ EfiSystemMemoryRange (
|
||||
MemoryBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MemoryAddress;
|
||||
for (Index = 0; Index < gSystemMemoryCount; Index++) {
|
||||
if ((MemoryBase >= gSystemMemory[Index].Memory) &&
|
||||
(MemoryBase < (gSystemMemory[Index].Memory + gSystemMemory[Index].Size)) ) {
|
||||
(MemoryBase < (gSystemMemory[Index].Memory + gSystemMemory[Index].Size)))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -692,7 +695,6 @@ EfiSystemMemoryRange (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -715,8 +717,6 @@ SecEmuThunkAddress (
|
||||
return &gEmuThunkProtocol;
|
||||
}
|
||||
|
||||
|
||||
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SecPeCoffGetEntryPoint (
|
||||
@ -729,7 +729,7 @@ SecPeCoffGetEntryPoint (
|
||||
|
||||
ZeroMem (&ImageContext, sizeof (ImageContext));
|
||||
ImageContext.Handle = Pe32Data;
|
||||
ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) SecImageRead;
|
||||
ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE)SecImageRead;
|
||||
|
||||
Status = PeCoffLoaderGetImageInfo (&ImageContext);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -759,6 +759,7 @@ SecPeCoffGetEntryPoint (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
ImageContext.EntryPoint = (UINTN)*EntryPoint;
|
||||
}
|
||||
|
||||
@ -769,8 +770,6 @@ SecPeCoffGetEntryPoint (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -804,7 +803,7 @@ SecUnixFdAddress (
|
||||
*FdSize = gFdInfo[Index].Size;
|
||||
*FixUp = 0;
|
||||
|
||||
if (*FdBase == 0 && *FdSize == 0) {
|
||||
if ((*FdBase == 0) && (*FdSize == 0)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@ -820,7 +819,6 @@ SecUnixFdAddress (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -851,7 +849,6 @@ CountSeparatorsInString (
|
||||
return Count;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecImageRead (
|
||||
@ -860,6 +857,7 @@ SecImageRead (
|
||||
IN OUT UINTN *ReadSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -881,7 +879,7 @@ Returns:
|
||||
UINTN Length;
|
||||
|
||||
Destination8 = Buffer;
|
||||
Source8 = (CHAR8 *) ((UINTN) FileHandle + FileOffset);
|
||||
Source8 = (CHAR8 *)((UINTN)FileHandle + FileOffset);
|
||||
Length = *ReadSize;
|
||||
while (Length--) {
|
||||
*(Destination8++) = *(Source8++);
|
||||
@ -890,7 +888,6 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -917,7 +914,6 @@ AddHandle (
|
||||
IMAGE_CONTEXT_TO_MOD_HANDLE *Array;
|
||||
UINTN PreviousSize;
|
||||
|
||||
|
||||
Array = mImageContextModHandleArray;
|
||||
for (Index = 0; Index < mImageContextModHandleArraySize; Index++, Array++) {
|
||||
if (Array->ImageContext == NULL) {
|
||||
@ -954,7 +950,6 @@ AddHandle (
|
||||
return AddHandle (ImageContext, ModHandle);
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -998,8 +993,6 @@ RemoveHandle (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
IsPdbFile (
|
||||
IN CHAR8 *PdbFileName
|
||||
@ -1012,20 +1005,20 @@ IsPdbFile (
|
||||
}
|
||||
|
||||
Len = strlen (PdbFileName);
|
||||
if ((Len < 5)|| (PdbFileName[Len - 4] != '.')) {
|
||||
if ((Len < 5) || (PdbFileName[Len - 4] != '.')) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((PdbFileName[Len - 3] == 'P' || PdbFileName[Len - 3] == 'p') &&
|
||||
(PdbFileName[Len - 2] == 'D' || PdbFileName[Len - 2] == 'd') &&
|
||||
(PdbFileName[Len - 1] == 'B' || PdbFileName[Len - 1] == 'b')) {
|
||||
if (((PdbFileName[Len - 3] == 'P') || (PdbFileName[Len - 3] == 'p')) &&
|
||||
((PdbFileName[Len - 2] == 'D') || (PdbFileName[Len - 2] == 'd')) &&
|
||||
((PdbFileName[Len - 1] == 'B') || (PdbFileName[Len - 1] == 'b')))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
#define MAX_SPRINT_BUFFER_SIZE 0x200
|
||||
|
||||
void
|
||||
@ -1034,24 +1027,26 @@ PrintLoadAddress (
|
||||
)
|
||||
{
|
||||
if (ImageContext->PdbPointer == NULL) {
|
||||
fprintf (stderr,
|
||||
fprintf (
|
||||
stderr,
|
||||
"0x%08lx Loading NO DEBUG with entry point 0x%08lx\n",
|
||||
(unsigned long)(ImageContext->ImageAddress),
|
||||
(unsigned long)ImageContext->EntryPoint
|
||||
);
|
||||
} else {
|
||||
fprintf (stderr,
|
||||
fprintf (
|
||||
stderr,
|
||||
"0x%08lx Loading %s with entry point 0x%08lx\n",
|
||||
(unsigned long)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders),
|
||||
ImageContext->PdbPointer,
|
||||
(unsigned long)ImageContext->EntryPoint
|
||||
);
|
||||
}
|
||||
|
||||
// Keep output synced up
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Loads the image using dlopen so symbols will be automatically
|
||||
loaded by gdb.
|
||||
@ -1067,12 +1062,11 @@ DlLoadImage (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
{
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifdef __APPLE__
|
||||
|
||||
return FALSE;
|
||||
|
||||
#else
|
||||
#else
|
||||
|
||||
void *Handle = NULL;
|
||||
void *Entry = NULL;
|
||||
@ -1098,7 +1092,7 @@ DlLoadImage (
|
||||
Entry = dlsym (Handle, "_ModuleEntryPoint");
|
||||
AddHandle (ImageContext, Handle);
|
||||
} else {
|
||||
printf("%s\n", dlerror());
|
||||
printf ("%s\n", dlerror ());
|
||||
}
|
||||
|
||||
if (Entry != NULL) {
|
||||
@ -1109,12 +1103,11 @@ DlLoadImage (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
__attribute__((noinline))
|
||||
__attribute__ ((noinline))
|
||||
#endif
|
||||
VOID
|
||||
SecGdbScriptBreak (
|
||||
@ -1127,7 +1120,6 @@ SecGdbScriptBreak (
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Adds the image to a gdb script so its symbols can be loaded.
|
||||
The AddFirmwareSymbolFile helper macro is used.
|
||||
@ -1140,10 +1132,9 @@ GdbScriptAddImage (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
{
|
||||
|
||||
PrintLoadAddress (ImageContext);
|
||||
|
||||
if (ImageContext->PdbPointer != NULL && !IsPdbFile (ImageContext->PdbPointer)) {
|
||||
if ((ImageContext->PdbPointer != NULL) && !IsPdbFile (ImageContext->PdbPointer)) {
|
||||
FILE *GdbTempFile;
|
||||
if (FeaturePcdGet (PcdEmulatorLazyLoadSymbols)) {
|
||||
GdbTempFile = fopen (gGdbWorkingFileName, "a");
|
||||
@ -1188,7 +1179,6 @@ GdbScriptAddImage (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
SecPeCoffRelocateImageExtraAction (
|
||||
@ -1200,7 +1190,6 @@ SecPeCoffRelocateImageExtraAction (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Adds the image to a gdb script so its symbols can be unloaded.
|
||||
The RemoveFirmwareSymbolFile helper macro is used.
|
||||
@ -1257,7 +1246,6 @@ GdbScriptRemoveImage (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
SecPeCoffUnloadImageExtraAction (
|
||||
@ -1271,13 +1259,11 @@ SecPeCoffUnloadImageExtraAction (
|
||||
//
|
||||
Handle = RemoveHandle (ImageContext);
|
||||
if (Handle != NULL) {
|
||||
#ifndef __APPLE__
|
||||
#ifndef __APPLE__
|
||||
dlclose (Handle);
|
||||
#endif
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
GdbScriptRemoveImage (ImageContext);
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,9 +30,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <sys/time.h>
|
||||
|
||||
#if __CYGWIN__
|
||||
#include <sys/dirent.h>
|
||||
#include <sys/dirent.h>
|
||||
#else
|
||||
#include <sys/dir.h>
|
||||
#include <sys/dir.h>
|
||||
#endif
|
||||
|
||||
#include <sys/mman.h>
|
||||
@ -56,19 +56,19 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <ifaddrs.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <net/if_dl.h>
|
||||
#include <net/bpf.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/disk.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/bpf.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/disk.h>
|
||||
#define _XOPEN_SOURCE
|
||||
#ifndef _Bool
|
||||
#define _Bool char // for clang debug
|
||||
#endif
|
||||
#ifndef _Bool
|
||||
#define _Bool char // for clang debug
|
||||
#endif
|
||||
#else
|
||||
#include <termio.h>
|
||||
#include <sys/vfs.h>
|
||||
#include <linux/fs.h>
|
||||
#include <termio.h>
|
||||
#include <sys/vfs.h>
|
||||
#include <linux/fs.h>
|
||||
#endif
|
||||
|
||||
#include <utime.h>
|
||||
@ -120,10 +120,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Guid/FileSystemInfo.h>
|
||||
#include <Guid/FileSystemVolumeLabelInfo.h>
|
||||
|
||||
|
||||
#include "Gasket.h"
|
||||
|
||||
|
||||
#define STACK_SIZE 0x20000
|
||||
|
||||
typedef struct {
|
||||
@ -136,7 +134,6 @@ typedef struct {
|
||||
UINT64 Size;
|
||||
} EMU_SYSTEM_MEMORY;
|
||||
|
||||
|
||||
#define MAX_IMAGE_CONTEXT_TO_MOD_HANDLE_ARRAY_SIZE 0x100
|
||||
|
||||
typedef struct {
|
||||
@ -144,7 +141,6 @@ typedef struct {
|
||||
VOID *ModHandle;
|
||||
} IMAGE_CONTEXT_TO_MOD_HANDLE;
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecUnixPeiLoadFile (
|
||||
@ -230,7 +226,6 @@ GasketSecUnixFdAddress (
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
GetImageReadFunction (
|
||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
|
||||
@ -276,7 +271,6 @@ GasketSecTemporaryRamSupport (
|
||||
IN UINTN CopySize
|
||||
);
|
||||
|
||||
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SecPeCoffGetEntryPoint (
|
||||
@ -296,7 +290,6 @@ SecPeCoffLoaderUnloadImageExtraAction (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
PeiSwitchStacks (
|
||||
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||
@ -310,13 +303,13 @@ SecInitThunkProtocol (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
EFI_PHYSICAL_ADDRESS *
|
||||
MapMemory (
|
||||
INTN fd,
|
||||
UINT64 length,
|
||||
INTN prot,
|
||||
INTN flags);
|
||||
INTN flags
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
MapFile (
|
||||
@ -337,12 +330,25 @@ EfiSystemMemoryRange (
|
||||
IN VOID *MemoryAddress
|
||||
);
|
||||
|
||||
VOID
|
||||
SecSleep (
|
||||
UINT64 Nanoseconds
|
||||
);
|
||||
|
||||
VOID SecSleep (UINT64 Nanoseconds);
|
||||
VOID SecEnableInterrupt (VOID);
|
||||
VOID SecDisableInterrupt (VOID);
|
||||
BOOLEAN SecInterruptEanbled (VOID);
|
||||
VOID
|
||||
SecEnableInterrupt (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
SecDisableInterrupt (
|
||||
VOID
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
SecInterruptEanbled (
|
||||
VOID
|
||||
);
|
||||
|
||||
extern EMU_THUNK_PROTOCOL gEmuThunkProtocol;
|
||||
extern EMU_IO_THUNK_PROTOCOL gX11ThunkIo;
|
||||
|
@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include "Host.h"
|
||||
|
||||
|
||||
/**
|
||||
Transfers control to a function starting with a new stack.
|
||||
|
||||
@ -50,14 +49,13 @@ PeiSwitchStacks (
|
||||
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
|
||||
|
||||
JumpBuffer.Eip = (UINTN)EntryPoint;
|
||||
JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*);
|
||||
JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID *);
|
||||
JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2);
|
||||
((VOID**)JumpBuffer.Esp)[1] = Context1;
|
||||
((VOID**)JumpBuffer.Esp)[2] = Context2;
|
||||
((VOID **)JumpBuffer.Esp)[1] = Context1;
|
||||
((VOID **)JumpBuffer.Esp)[2] = Context2;
|
||||
|
||||
LongJump (&JumpBuffer, (UINTN)-1);
|
||||
|
||||
|
||||
//
|
||||
// PeiSwitchStacks () will never return
|
||||
//
|
||||
|
@ -12,7 +12,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "Host.h"
|
||||
|
||||
#ifndef __APPLE__
|
||||
@ -23,10 +22,8 @@ typedef struct {
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL *Thunk;
|
||||
|
||||
|
||||
EMU_SNP_PROTOCOL EmuSnp;
|
||||
EFI_SIMPLE_NETWORK_MODE *Mode;
|
||||
|
||||
} EMU_SNP_PRIVATE;
|
||||
|
||||
#define EMU_SNP_PRIVATE_DATA_FROM_THIS(a) \
|
||||
@ -517,7 +514,6 @@ EmuSnpReceive (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
EMU_SNP_PROTOCOL gEmuSnpProtocol = {
|
||||
GasketSnpCreateMapping,
|
||||
GasketSnpStart,
|
||||
@ -555,7 +551,6 @@ EmuSnpThunkOpen (
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
Private->Signature = EMU_SNP_PRIVATE_SIGNATURE;
|
||||
Private->Thunk = This;
|
||||
CopyMem (&Private->EmuSnp, &gEmuSnpProtocol, sizeof (gEmuSnpProtocol));
|
||||
@ -565,7 +560,6 @@ EmuSnpThunkOpen (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuSnpThunkClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
@ -583,8 +577,6 @@ EmuSnpThunkClose (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL gSnpThunkIo = {
|
||||
&gEmuSnpProtocolGuid,
|
||||
NULL,
|
||||
|
@ -30,10 +30,9 @@ AllocatePool (
|
||||
IN UINTN AllocationSize
|
||||
)
|
||||
{
|
||||
return (VOID*) malloc (AllocationSize);
|
||||
return (VOID *)malloc (AllocationSize);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Allocates and zeros a buffer of type EfiBootServicesData.
|
||||
|
||||
@ -65,7 +64,6 @@ AllocateZeroPool (
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reallocates a buffer of type EfiBootServicesData.
|
||||
|
||||
@ -113,7 +111,6 @@ ReallocatePool (
|
||||
return NewBuffer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Frees a buffer that was previously allocated with one of the pool allocation functions in the
|
||||
Memory Allocation Library.
|
||||
@ -134,6 +131,5 @@ FreePool (
|
||||
IN VOID *Buffer
|
||||
)
|
||||
{
|
||||
free ((void *) Buffer);
|
||||
free ((void *)Buffer);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include "Host.h"
|
||||
|
||||
|
||||
#define EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'P', 'f', 's')
|
||||
|
||||
typedef struct {
|
||||
@ -29,7 +28,6 @@ typedef struct {
|
||||
EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \
|
||||
)
|
||||
|
||||
|
||||
#define EMU_EFI_FILE_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'P', 'f', 'i')
|
||||
|
||||
typedef struct {
|
||||
@ -69,7 +67,6 @@ PosixFileSetInfo (
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
EFI_FILE_PROTOCOL gPosixFileProtocol = {
|
||||
EFI_FILE_REVISION,
|
||||
GasketPosixFileOpen,
|
||||
@ -89,7 +86,6 @@ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL gPosixFileSystemProtocol = {
|
||||
GasketPosixOpenVolume,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Open the root directory on a volume.
|
||||
|
||||
@ -127,6 +123,7 @@ PosixOpenVolume (
|
||||
if (PrivateFile->FileName == NULL) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
AsciiStrCpyS (
|
||||
PrivateFile->FileName,
|
||||
AsciiStrSize (Private->FilePath),
|
||||
@ -171,9 +168,9 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
ErrnoToEfiStatus ()
|
||||
ErrnoToEfiStatus (
|
||||
)
|
||||
{
|
||||
switch (errno) {
|
||||
case EACCES:
|
||||
@ -207,7 +204,6 @@ CutPrefix (
|
||||
*Pointer = *(Pointer + Count);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
PosixSystemTimeToEfiTime (
|
||||
IN time_t SystemTime,
|
||||
@ -229,7 +225,6 @@ PosixSystemTimeToEfiTime (
|
||||
Time->Daylight = (daylight ? EFI_TIME_ADJUST_DAYLIGHT : 0) | (tm->tm_isdst > 0 ? EFI_TIME_IN_DAYLIGHT : 0);
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
UnixSimpleFileSystemFileInfo (
|
||||
EMU_EFI_FILE_PRIVATE *PrivateFile,
|
||||
@ -273,7 +268,8 @@ UnixSimpleFileSystemFileInfo (
|
||||
*BufferSize = ResultSize;
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
if (stat (FileName == NULL ? PrivateFile->FileName : FileName, &buf) < 0) {
|
||||
|
||||
if (stat ((FileName == NULL) ? PrivateFile->FileName : FileName, &buf) < 0) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@ -294,15 +290,15 @@ UnixSimpleFileSystemFileInfo (
|
||||
Info->Attribute |= EFI_FILE_READ_ONLY;
|
||||
}
|
||||
|
||||
if (S_ISDIR(buf.st_mode)) {
|
||||
if (S_ISDIR (buf.st_mode)) {
|
||||
Info->Attribute |= EFI_FILE_DIRECTORY;
|
||||
}
|
||||
|
||||
|
||||
BufferFileName = (CHAR16 *)((CHAR8 *) Buffer + Size);
|
||||
BufferFileName = (CHAR16 *)((CHAR8 *)Buffer + Size);
|
||||
while (*RealFileName) {
|
||||
*BufferFileName++ = *RealFileName++;
|
||||
}
|
||||
|
||||
*BufferFileName = 0;
|
||||
|
||||
*BufferSize = ResultSize;
|
||||
@ -315,16 +311,16 @@ IsZero (
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
if (Buffer == NULL || Length == 0) {
|
||||
if ((Buffer == NULL) || (Length == 0)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (*(UINT8 *) Buffer != 0) {
|
||||
if (*(UINT8 *)Buffer != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (Length > 1) {
|
||||
if (!CompareMem (Buffer, (UINT8 *) Buffer + 1, Length - 1)) {
|
||||
if (!CompareMem (Buffer, (UINT8 *)Buffer + 1, Length - 1)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -332,8 +328,6 @@ IsZero (
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Opens a new file relative to the source file's location.
|
||||
|
||||
@ -394,7 +388,8 @@ PosixFileOpen (
|
||||
//
|
||||
TrailingDash = FALSE;
|
||||
if ((StrCmp (FileName, L"\\") == 0) ||
|
||||
(StrCmp (FileName, L".") == 0 && PrivateFile->IsRootDirectory)) {
|
||||
((StrCmp (FileName, L".") == 0) && PrivateFile->IsRootDirectory))
|
||||
{
|
||||
OpenRoot:
|
||||
Status = PosixOpenVolume (PrivateFile->SimpleFileSystem, &Root);
|
||||
NewPrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (Root);
|
||||
@ -430,6 +425,7 @@ OpenRoot:
|
||||
AsciiStrCpyS (NewPrivateFile->FileName, Size, PrivateFile->FileName);
|
||||
Src = FileName;
|
||||
}
|
||||
|
||||
Dst = NewPrivateFile->FileName + AsciiStrLen (NewPrivateFile->FileName);
|
||||
GuardPointer = NewPrivateFile->FileName + AsciiStrLen (PrivateRoot->FilePath);
|
||||
*Dst++ = '/';
|
||||
@ -440,10 +436,11 @@ OpenRoot:
|
||||
} else {
|
||||
*Dst++ = *Src;
|
||||
}
|
||||
|
||||
Src++;
|
||||
}
|
||||
*Dst = 0;
|
||||
|
||||
*Dst = 0;
|
||||
|
||||
//
|
||||
// Get rid of . and .., except leading . or ..
|
||||
@ -458,11 +455,11 @@ OpenRoot:
|
||||
LoopFinish = TRUE;
|
||||
|
||||
for (ParseFileName = GuardPointer; *ParseFileName; ParseFileName++) {
|
||||
if (*ParseFileName == '.' &&
|
||||
(*(ParseFileName + 1) == 0 || *(ParseFileName + 1) == '/') &&
|
||||
*(ParseFileName - 1) == '/'
|
||||
) {
|
||||
|
||||
if ((*ParseFileName == '.') &&
|
||||
((*(ParseFileName + 1) == 0) || (*(ParseFileName + 1) == '/')) &&
|
||||
(*(ParseFileName - 1) == '/')
|
||||
)
|
||||
{
|
||||
//
|
||||
// cut /.
|
||||
//
|
||||
@ -471,12 +468,12 @@ OpenRoot:
|
||||
break;
|
||||
}
|
||||
|
||||
if (*ParseFileName == '.' &&
|
||||
*(ParseFileName + 1) == '.' &&
|
||||
(*(ParseFileName + 2) == 0 || *(ParseFileName + 2) == '/') &&
|
||||
*(ParseFileName - 1) == '/'
|
||||
) {
|
||||
|
||||
if ((*ParseFileName == '.') &&
|
||||
(*(ParseFileName + 1) == '.') &&
|
||||
((*(ParseFileName + 2) == 0) || (*(ParseFileName + 2) == '/')) &&
|
||||
(*(ParseFileName - 1) == '/')
|
||||
)
|
||||
{
|
||||
ParseFileName--;
|
||||
Count = 3;
|
||||
|
||||
@ -505,7 +502,7 @@ OpenRoot:
|
||||
goto OpenRoot;
|
||||
}
|
||||
|
||||
RealFileName = NewPrivateFile->FileName + AsciiStrLen(NewPrivateFile->FileName) - 1;
|
||||
RealFileName = NewPrivateFile->FileName + AsciiStrLen (NewPrivateFile->FileName) - 1;
|
||||
while (RealFileName > NewPrivateFile->FileName && *RealFileName != '/') {
|
||||
RealFileName--;
|
||||
}
|
||||
@ -514,7 +511,6 @@ OpenRoot:
|
||||
*(RealFileName - 1) = 0;
|
||||
*(RealFileName - 1) = TempChar;
|
||||
|
||||
|
||||
//
|
||||
// Test whether file or directory
|
||||
//
|
||||
@ -529,7 +525,7 @@ OpenRoot:
|
||||
}
|
||||
} else {
|
||||
res = stat (NewPrivateFile->FileName, &finfo);
|
||||
if (res == 0 && S_ISDIR(finfo.st_mode)) {
|
||||
if ((res == 0) && S_ISDIR (finfo.st_mode)) {
|
||||
NewPrivateFile->IsDirectoryPath = TRUE;
|
||||
} else {
|
||||
NewPrivateFile->IsDirectoryPath = FALSE;
|
||||
@ -554,7 +550,7 @@ OpenRoot:
|
||||
//
|
||||
if (mkdir (NewPrivateFile->FileName, 0777) != 0) {
|
||||
if (errno != EEXIST) {
|
||||
//free (TempFileName);
|
||||
// free (TempFileName);
|
||||
Status = EFI_ACCESS_DENIED;
|
||||
goto Done;
|
||||
}
|
||||
@ -571,7 +567,6 @@ OpenRoot:
|
||||
|
||||
goto Done;
|
||||
}
|
||||
|
||||
} else {
|
||||
//
|
||||
// deal with file
|
||||
@ -590,7 +585,7 @@ OpenRoot:
|
||||
}
|
||||
}
|
||||
|
||||
if ((OpenMode & EFI_FILE_MODE_CREATE) && Status == EFI_SUCCESS) {
|
||||
if ((OpenMode & EFI_FILE_MODE_CREATE) && (Status == EFI_SUCCESS)) {
|
||||
//
|
||||
// Set the attribute
|
||||
//
|
||||
@ -618,7 +613,7 @@ OpenRoot:
|
||||
free (Info);
|
||||
}
|
||||
|
||||
Done: ;
|
||||
Done:;
|
||||
if (TrailingDash) {
|
||||
FileName[StrLen (FileName) + 1] = 0;
|
||||
FileName[StrLen (FileName)] = L'\\';
|
||||
@ -639,8 +634,6 @@ Done: ;
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Close the file handle
|
||||
|
||||
@ -661,6 +654,7 @@ PosixFileCLose (
|
||||
if (PrivateFile->fd >= 0) {
|
||||
close (PrivateFile->fd);
|
||||
}
|
||||
|
||||
if (PrivateFile->Dir != NULL) {
|
||||
closedir (PrivateFile->Dir);
|
||||
}
|
||||
@ -677,7 +671,6 @@ PosixFileCLose (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Close and delete the file handle.
|
||||
|
||||
@ -724,7 +717,6 @@ PosixFileDelete (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read data from the file.
|
||||
|
||||
@ -768,6 +760,7 @@ PosixFileRead (
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
*BufferSize = Res;
|
||||
Status = EFI_SUCCESS;
|
||||
goto Done;
|
||||
@ -799,11 +792,12 @@ PosixFileRead (
|
||||
Status = EFI_BUFFER_TOO_SMALL;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
*BufferSize = ResultSize;
|
||||
|
||||
FullFileNameSize = AsciiStrLen(PrivateFile->FileName) + 1 + NameSize;
|
||||
FullFileNameSize = AsciiStrLen (PrivateFile->FileName) + 1 + NameSize;
|
||||
FullFileName = malloc (FullFileNameSize);
|
||||
if (FullFileName == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
@ -827,8 +821,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Write data to a file.
|
||||
|
||||
@ -857,7 +849,6 @@ PosixFileWrite (
|
||||
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
||||
int Res;
|
||||
|
||||
|
||||
PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
if (PrivateFile->fd < 0) {
|
||||
@ -881,8 +872,6 @@ PosixFileWrite (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Set a files current position
|
||||
|
||||
@ -912,23 +901,24 @@ PosixFileSetPossition (
|
||||
if (PrivateFile->Dir == NULL) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
rewinddir (PrivateFile->Dir);
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
if (Position == (UINT64) -1) {
|
||||
if (Position == (UINT64)-1) {
|
||||
Pos = lseek (PrivateFile->fd, 0, SEEK_END);
|
||||
} else {
|
||||
Pos = lseek (PrivateFile->fd, Position, SEEK_SET);
|
||||
}
|
||||
|
||||
if (Pos == (off_t)-1) {
|
||||
return ErrnoToEfiStatus ();
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Get a file's current position
|
||||
|
||||
@ -954,13 +944,12 @@ PosixFileGetPossition (
|
||||
Status = EFI_UNSUPPORTED;
|
||||
} else {
|
||||
*Position = (UINT64)lseek (PrivateFile->fd, 0, SEEK_CUR);
|
||||
Status = (*Position == (UINT64) -1) ? ErrnoToEfiStatus () : EFI_SUCCESS;
|
||||
Status = (*Position == (UINT64)-1) ? ErrnoToEfiStatus () : EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get information about a file.
|
||||
|
||||
@ -1011,7 +1000,7 @@ PosixFileGetInfo (
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
FileSystemInfoBuffer = (EFI_FILE_SYSTEM_INFO *) Buffer;
|
||||
FileSystemInfoBuffer = (EFI_FILE_SYSTEM_INFO *)Buffer;
|
||||
FileSystemInfoBuffer->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
|
||||
FileSystemInfoBuffer->ReadOnly = FALSE;
|
||||
|
||||
@ -1022,14 +1011,12 @@ PosixFileGetInfo (
|
||||
FileSystemInfoBuffer->FreeSpace = MultU64x32 (buf.f_bavail, buf.f_bsize);
|
||||
FileSystemInfoBuffer->BlockSize = buf.f_bsize;
|
||||
|
||||
|
||||
StrCpyS (
|
||||
(CHAR16 *) FileSystemInfoBuffer->VolumeLabel,
|
||||
(CHAR16 *)FileSystemInfoBuffer->VolumeLabel,
|
||||
(*BufferSize - SIZE_OF_EFI_FILE_SYSTEM_INFO) / sizeof (CHAR16),
|
||||
PrivateRoot->VolumeLabel
|
||||
);
|
||||
*BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
|
||||
|
||||
} else if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
|
||||
if (*BufferSize < StrSize (PrivateRoot->VolumeLabel)) {
|
||||
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
|
||||
@ -1037,18 +1024,16 @@ PosixFileGetInfo (
|
||||
}
|
||||
|
||||
StrCpyS (
|
||||
(CHAR16 *) Buffer,
|
||||
(CHAR16 *)Buffer,
|
||||
*BufferSize / sizeof (CHAR16),
|
||||
PrivateRoot->VolumeLabel
|
||||
);
|
||||
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
|
||||
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set information about a file
|
||||
|
||||
@ -1115,7 +1100,7 @@ PosixFileSetInfo (
|
||||
goto Done;
|
||||
}
|
||||
|
||||
NewFileSystemInfo = (EFI_FILE_SYSTEM_INFO *) Buffer;
|
||||
NewFileSystemInfo = (EFI_FILE_SYSTEM_INFO *)Buffer;
|
||||
|
||||
free (PrivateRoot->VolumeLabel);
|
||||
|
||||
@ -1146,7 +1131,7 @@ PosixFileSetInfo (
|
||||
StrCpyS (
|
||||
PrivateRoot->VolumeLabel,
|
||||
StrSize (PrivateRoot->VolumeLabel) / sizeof (CHAR16),
|
||||
(CHAR16 *) Buffer
|
||||
(CHAR16 *)Buffer
|
||||
);
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
@ -1170,11 +1155,12 @@ PosixFileSetInfo (
|
||||
//
|
||||
// Check for invalid set file information parameters.
|
||||
//
|
||||
NewFileInfo = (EFI_FILE_INFO *) Buffer;
|
||||
if (NewFileInfo->Size <= sizeof (EFI_FILE_INFO) ||
|
||||
NewFileInfo = (EFI_FILE_INFO *)Buffer;
|
||||
if ((NewFileInfo->Size <= sizeof (EFI_FILE_INFO)) ||
|
||||
(NewFileInfo->Attribute &~(EFI_FILE_VALID_ATTR)) ||
|
||||
(sizeof (UINTN) == 4 && NewFileInfo->Size > 0xFFFFFFFF)
|
||||
) {
|
||||
((sizeof (UINTN) == 4) && (NewFileInfo->Size > 0xFFFFFFFF))
|
||||
)
|
||||
{
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
}
|
||||
@ -1222,9 +1208,9 @@ PosixFileSetInfo (
|
||||
}
|
||||
|
||||
AsciiStrCpyS (NewFileName, Size, PrivateRoot->FilePath);
|
||||
AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
|
||||
AsciiFilePtr = NewFileName + AsciiStrLen (NewFileName);
|
||||
UnicodeFilePtr = NewFileInfo->FileName + 1;
|
||||
*AsciiFilePtr++ ='/';
|
||||
*AsciiFilePtr++ = '/';
|
||||
} else {
|
||||
Size = AsciiStrLen (PrivateFile->FileName) + 2 + StrLen (NewFileInfo->FileName) + 1;
|
||||
NewFileName = malloc (Size);
|
||||
@ -1233,19 +1219,22 @@ PosixFileSetInfo (
|
||||
}
|
||||
|
||||
AsciiStrCpyS (NewFileName, Size, PrivateRoot->FilePath);
|
||||
AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
|
||||
AsciiFilePtr = NewFileName + AsciiStrLen (NewFileName);
|
||||
if ((AsciiFilePtr[-1] != '/') && (NewFileInfo->FileName[0] != '/')) {
|
||||
// make sure there is a / between Root FilePath and NewFileInfo Filename
|
||||
AsciiFilePtr[0] = '/';
|
||||
AsciiFilePtr[1] = '\0';
|
||||
AsciiFilePtr++;
|
||||
}
|
||||
|
||||
UnicodeFilePtr = NewFileInfo->FileName;
|
||||
}
|
||||
|
||||
// Convert to ascii.
|
||||
while (*UnicodeFilePtr) {
|
||||
*AsciiFilePtr++ = *UnicodeFilePtr++;
|
||||
}
|
||||
|
||||
*AsciiFilePtr = 0;
|
||||
|
||||
//
|
||||
@ -1280,15 +1269,18 @@ PosixFileSetInfo (
|
||||
//
|
||||
if (!IsZero (&NewFileInfo->CreateTime, sizeof (EFI_TIME)) &&
|
||||
CompareMem (&NewFileInfo->CreateTime, &OldFileInfo->CreateTime, sizeof (EFI_TIME))
|
||||
) {
|
||||
)
|
||||
{
|
||||
TimeChangeFlag = TRUE;
|
||||
} else if (!IsZero (&NewFileInfo->LastAccessTime, sizeof (EFI_TIME)) &&
|
||||
CompareMem (&NewFileInfo->LastAccessTime, &OldFileInfo->LastAccessTime, sizeof (EFI_TIME))
|
||||
) {
|
||||
)
|
||||
{
|
||||
TimeChangeFlag = TRUE;
|
||||
} else if (!IsZero (&NewFileInfo->ModificationTime, sizeof (EFI_TIME)) &&
|
||||
CompareMem (&NewFileInfo->ModificationTime, &OldFileInfo->ModificationTime, sizeof (EFI_TIME))
|
||||
) {
|
||||
)
|
||||
{
|
||||
TimeChangeFlag = TRUE;
|
||||
}
|
||||
|
||||
@ -1369,7 +1361,6 @@ PosixFileSetInfo (
|
||||
Status = ErrnoToEfiStatus ();
|
||||
goto Done;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@ -1396,7 +1387,7 @@ PosixFileSetInfo (
|
||||
|
||||
Utime.modtime = mktime (&NewLastWriteSystemTime);
|
||||
|
||||
if (Utime.actime == (time_t)-1 || Utime.modtime == (time_t)-1) {
|
||||
if ((Utime.actime == (time_t)-1) || (Utime.modtime == (time_t)-1)) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
@ -1438,7 +1429,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Flush data back for the file handle.
|
||||
|
||||
@ -1461,7 +1451,6 @@ PosixFileFlush (
|
||||
{
|
||||
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
||||
|
||||
|
||||
PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
if (PrivateFile->IsDirectoryPath) {
|
||||
@ -1483,8 +1472,6 @@ PosixFileFlush (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
PosixFileSystmeThunkOpen (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
@ -1516,8 +1503,8 @@ PosixFileSystmeThunkOpen (
|
||||
for (i = 0; This->ConfigString[i] != 0; i++) {
|
||||
Private->FilePath[i] = This->ConfigString[i];
|
||||
}
|
||||
Private->FilePath[i] = 0;
|
||||
|
||||
Private->FilePath[i] = 0;
|
||||
|
||||
Private->VolumeLabel = malloc (StrSize (L"EFI_EMULATED"));
|
||||
if (Private->VolumeLabel == NULL) {
|
||||
@ -1525,6 +1512,7 @@ PosixFileSystmeThunkOpen (
|
||||
free (Private);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
StrCpyS (
|
||||
Private->VolumeLabel,
|
||||
StrSize (L"EFI_EMULATED") / sizeof (CHAR16),
|
||||
@ -1541,7 +1529,6 @@ PosixFileSystmeThunkOpen (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
PosixFileSystmeThunkClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
@ -1566,6 +1553,7 @@ PosixFileSystmeThunkClose (
|
||||
if (Private->VolumeLabel != NULL) {
|
||||
free (Private->VolumeLabel);
|
||||
}
|
||||
|
||||
free (This->Private);
|
||||
This->Private = NULL;
|
||||
}
|
||||
@ -1573,7 +1561,6 @@ PosixFileSystmeThunkClose (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL gPosixFileSystemThunkIo = {
|
||||
&gEfiSimpleFileSystemProtocolGuid,
|
||||
NULL,
|
||||
@ -1583,5 +1570,3 @@ EMU_IO_THUNK_PROTOCOL gPosixFileSystemThunkIo = {
|
||||
GasketPosixFileSystmeThunkClose,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
@ -12,7 +12,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include "Host.h"
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
PthreadMutexLock (
|
||||
@ -22,8 +21,6 @@ PthreadMutexLock (
|
||||
return (UINTN)pthread_mutex_lock ((pthread_mutex_t *)Mutex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
PthreadMutexUnLock (
|
||||
@ -33,7 +30,6 @@ PthreadMutexUnLock (
|
||||
return (UINTN)pthread_mutex_unlock ((pthread_mutex_t *)Mutex);
|
||||
}
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
PthreadMutexTryLock (
|
||||
@ -43,7 +39,6 @@ PthreadMutexTryLock (
|
||||
return (UINTN)pthread_mutex_trylock ((pthread_mutex_t *)Mutex);
|
||||
}
|
||||
|
||||
|
||||
VOID *
|
||||
PthreadMutexInit (
|
||||
IN VOID
|
||||
@ -61,7 +56,6 @@ PthreadMutexInit (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
UINTN
|
||||
PthreadMutexDestroy (
|
||||
IN VOID *Mutex
|
||||
@ -151,7 +145,6 @@ PthreadCreate (
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
PthreadExit (
|
||||
IN VOID *ValuePtr
|
||||
@ -161,7 +154,6 @@ PthreadExit (
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
UINTN
|
||||
PthreadSelf (
|
||||
VOID
|
||||
@ -173,7 +165,6 @@ PthreadSelf (
|
||||
return (UINTN)pthread_self ();
|
||||
}
|
||||
|
||||
|
||||
EMU_THREAD_THUNK_PROTOCOL gPthreadThunk = {
|
||||
GasketPthreadMutexLock,
|
||||
GasketPthreadMutexUnLock,
|
||||
@ -185,7 +176,6 @@ EMU_THREAD_THUNK_PROTOCOL gPthreadThunk = {
|
||||
GasketPthreadSelf
|
||||
};
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
PthreadOpen (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
@ -206,7 +196,6 @@ PthreadOpen (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
PthreadClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
@ -215,7 +204,6 @@ PthreadClose (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL gPthreadThunkIo = {
|
||||
&gEmuThreadThunkProtocolGuid,
|
||||
NULL,
|
||||
@ -225,5 +213,3 @@ EMU_IO_THUNK_PROTOCOL gPthreadThunkIo = {
|
||||
GasketPthreadClose,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
@ -22,7 +22,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#define KEYSYM_LOWER 0
|
||||
#define KEYSYM_UPPER 1
|
||||
|
||||
|
||||
struct uga_drv_shift_mask {
|
||||
unsigned char shift;
|
||||
unsigned char size;
|
||||
@ -71,7 +70,7 @@ typedef struct {
|
||||
} GRAPHICS_IO_PRIVATE;
|
||||
|
||||
void
|
||||
HandleEvents(
|
||||
HandleEvents (
|
||||
IN GRAPHICS_IO_PRIVATE *Drv
|
||||
);
|
||||
|
||||
@ -87,10 +86,12 @@ fill_shift_mask (
|
||||
mask >>= 1;
|
||||
sm->shift++;
|
||||
}
|
||||
|
||||
while (mask & 1) {
|
||||
sm->size++;
|
||||
mask >>= 1;
|
||||
}
|
||||
|
||||
sm->csize = 8 - sm->size;
|
||||
}
|
||||
|
||||
@ -100,9 +101,14 @@ TryCreateShmImage (
|
||||
)
|
||||
{
|
||||
Drv->image = XShmCreateImage (
|
||||
Drv->display, Drv->visual,
|
||||
Drv->depth, ZPixmap, NULL, &Drv->xshm_info,
|
||||
Drv->width, Drv->height
|
||||
Drv->display,
|
||||
Drv->visual,
|
||||
Drv->depth,
|
||||
ZPixmap,
|
||||
NULL,
|
||||
&Drv->xshm_info,
|
||||
Drv->width,
|
||||
Drv->height
|
||||
);
|
||||
if (Drv->image == NULL) {
|
||||
return 0;
|
||||
@ -121,41 +127,42 @@ TryCreateShmImage (
|
||||
}
|
||||
|
||||
Drv->xshm_info.shmid = shmget (
|
||||
IPC_PRIVATE, Drv->image->bytes_per_line * Drv->image->height,
|
||||
IPC_PRIVATE,
|
||||
Drv->image->bytes_per_line * Drv->image->height,
|
||||
IPC_CREAT | 0777
|
||||
);
|
||||
if (Drv->xshm_info.shmid < 0) {
|
||||
XDestroyImage(Drv->image);
|
||||
XDestroyImage (Drv->image);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Drv->image_data = shmat (Drv->xshm_info.shmid, NULL, 0);
|
||||
if(!Drv->image_data) {
|
||||
if (!Drv->image_data) {
|
||||
shmctl (Drv->xshm_info.shmid, IPC_RMID, NULL);
|
||||
XDestroyImage(Drv->image);
|
||||
XDestroyImage (Drv->image);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef __APPLE__
|
||||
#ifndef __APPLE__
|
||||
//
|
||||
// This closes shared memory in real time on OS X. Only closes after folks quit using
|
||||
// it on Linux.
|
||||
//
|
||||
shmctl (Drv->xshm_info.shmid, IPC_RMID, NULL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Drv->xshm_info.shmaddr = (char*)Drv->image_data;
|
||||
Drv->image->data = (char*)Drv->image_data;
|
||||
Drv->xshm_info.shmaddr = (char *)Drv->image_data;
|
||||
Drv->image->data = (char *)Drv->image_data;
|
||||
|
||||
if (!XShmAttach (Drv->display, &Drv->xshm_info)) {
|
||||
shmdt (Drv->image_data);
|
||||
XDestroyImage(Drv->image);
|
||||
XDestroyImage (Drv->image);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
X11Size (
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||
@ -185,7 +192,7 @@ X11Size (
|
||||
XResizeWindow (Drv->display, Drv->win, Width, Height);
|
||||
|
||||
// Allocate image.
|
||||
if (XShmQueryExtension(Drv->display) && TryCreateShmImage(Drv)) {
|
||||
if (XShmQueryExtension (Drv->display) && TryCreateShmImage (Drv)) {
|
||||
Drv->use_shm = 1;
|
||||
} else {
|
||||
Drv->use_shm = 0;
|
||||
@ -199,10 +206,16 @@ X11Size (
|
||||
|
||||
Drv->image_data = malloc ((Drv->width * Drv->height) << Drv->pixel_shift);
|
||||
Drv->image = XCreateImage (
|
||||
Drv->display, Drv->visual, Drv->depth,
|
||||
ZPixmap, 0, (char *)Drv->image_data,
|
||||
Drv->width, Drv->height,
|
||||
8 << Drv->pixel_shift, 0
|
||||
Drv->display,
|
||||
Drv->visual,
|
||||
Drv->depth,
|
||||
ZPixmap,
|
||||
0,
|
||||
(char *)Drv->image_data,
|
||||
Drv->width,
|
||||
Drv->height,
|
||||
8 << Drv->pixel_shift,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
@ -274,6 +287,7 @@ handleKeyEvent (
|
||||
} else {
|
||||
Drv->KeyState.KeyShiftState &= ~EFI_RIGHT_CONTROL_PRESSED;
|
||||
}
|
||||
|
||||
break;
|
||||
case XK_Control_L:
|
||||
if (Make) {
|
||||
@ -281,6 +295,7 @@ handleKeyEvent (
|
||||
} else {
|
||||
Drv->KeyState.KeyShiftState &= ~EFI_LEFT_CONTROL_PRESSED;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case XK_Shift_R:
|
||||
@ -289,6 +304,7 @@ handleKeyEvent (
|
||||
} else {
|
||||
Drv->KeyState.KeyShiftState &= ~EFI_RIGHT_SHIFT_PRESSED;
|
||||
}
|
||||
|
||||
break;
|
||||
case XK_Shift_L:
|
||||
if (Make) {
|
||||
@ -296,6 +312,7 @@ handleKeyEvent (
|
||||
} else {
|
||||
Drv->KeyState.KeyShiftState &= ~EFI_LEFT_SHIFT_PRESSED;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case XK_Mode_switch:
|
||||
@ -304,6 +321,7 @@ handleKeyEvent (
|
||||
} else {
|
||||
Drv->KeyState.KeyShiftState &= ~EFI_LEFT_ALT_PRESSED;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case XK_Meta_R:
|
||||
@ -312,6 +330,7 @@ handleKeyEvent (
|
||||
} else {
|
||||
Drv->KeyState.KeyShiftState &= ~EFI_RIGHT_LOGO_PRESSED;
|
||||
}
|
||||
|
||||
break;
|
||||
case XK_Meta_L:
|
||||
if (Make) {
|
||||
@ -319,122 +338,180 @@ handleKeyEvent (
|
||||
} else {
|
||||
Drv->KeyState.KeyShiftState &= ~EFI_LEFT_LOGO_PRESSED;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case XK_KP_Home:
|
||||
case XK_Home: KeyData.Key.ScanCode = SCAN_HOME; break;
|
||||
case XK_Home: KeyData.Key.ScanCode = SCAN_HOME;
|
||||
break;
|
||||
|
||||
case XK_KP_End:
|
||||
case XK_End: KeyData.Key.ScanCode = SCAN_END; break;
|
||||
case XK_End: KeyData.Key.ScanCode = SCAN_END;
|
||||
break;
|
||||
|
||||
case XK_KP_Left:
|
||||
case XK_Left: KeyData.Key.ScanCode = SCAN_LEFT; break;
|
||||
case XK_Left: KeyData.Key.ScanCode = SCAN_LEFT;
|
||||
break;
|
||||
|
||||
case XK_KP_Right:
|
||||
case XK_Right: KeyData.Key.ScanCode = SCAN_RIGHT; break;
|
||||
case XK_Right: KeyData.Key.ScanCode = SCAN_RIGHT;
|
||||
break;
|
||||
|
||||
case XK_KP_Up:
|
||||
case XK_Up: KeyData.Key.ScanCode = SCAN_UP; break;
|
||||
case XK_Up: KeyData.Key.ScanCode = SCAN_UP;
|
||||
break;
|
||||
|
||||
case XK_KP_Down:
|
||||
case XK_Down: KeyData.Key.ScanCode = SCAN_DOWN; break;
|
||||
case XK_Down: KeyData.Key.ScanCode = SCAN_DOWN;
|
||||
break;
|
||||
|
||||
case XK_KP_Delete:
|
||||
case XK_Delete: KeyData.Key.ScanCode = SCAN_DELETE; break;
|
||||
case XK_Delete: KeyData.Key.ScanCode = SCAN_DELETE;
|
||||
break;
|
||||
|
||||
case XK_KP_Insert:
|
||||
case XK_Insert: KeyData.Key.ScanCode = SCAN_INSERT; break;
|
||||
case XK_Insert: KeyData.Key.ScanCode = SCAN_INSERT;
|
||||
break;
|
||||
|
||||
case XK_KP_Page_Up:
|
||||
case XK_Page_Up: KeyData.Key.ScanCode = SCAN_PAGE_UP; break;
|
||||
case XK_Page_Up: KeyData.Key.ScanCode = SCAN_PAGE_UP;
|
||||
break;
|
||||
|
||||
case XK_KP_Page_Down:
|
||||
case XK_Page_Down: KeyData.Key.ScanCode = SCAN_PAGE_DOWN; break;
|
||||
case XK_Page_Down: KeyData.Key.ScanCode = SCAN_PAGE_DOWN;
|
||||
break;
|
||||
|
||||
case XK_Escape: KeyData.Key.ScanCode = SCAN_ESC; break;
|
||||
case XK_Escape: KeyData.Key.ScanCode = SCAN_ESC;
|
||||
break;
|
||||
|
||||
case XK_Pause: KeyData.Key.ScanCode = SCAN_PAUSE; break;
|
||||
case XK_Pause: KeyData.Key.ScanCode = SCAN_PAUSE;
|
||||
break;
|
||||
|
||||
case XK_KP_F1:
|
||||
case XK_F1: KeyData.Key.ScanCode = SCAN_F1; break;
|
||||
case XK_F1: KeyData.Key.ScanCode = SCAN_F1;
|
||||
break;
|
||||
|
||||
case XK_KP_F2:
|
||||
case XK_F2: KeyData.Key.ScanCode = SCAN_F2; break;
|
||||
case XK_F2: KeyData.Key.ScanCode = SCAN_F2;
|
||||
break;
|
||||
|
||||
case XK_KP_F3:
|
||||
case XK_F3: KeyData.Key.ScanCode = SCAN_F3; break;
|
||||
case XK_F3: KeyData.Key.ScanCode = SCAN_F3;
|
||||
break;
|
||||
|
||||
case XK_KP_F4:
|
||||
case XK_F4: KeyData.Key.ScanCode = SCAN_F4; break;
|
||||
case XK_F4: KeyData.Key.ScanCode = SCAN_F4;
|
||||
break;
|
||||
|
||||
case XK_F5: KeyData.Key.ScanCode = SCAN_F5; break;
|
||||
case XK_F6: KeyData.Key.ScanCode = SCAN_F6; break;
|
||||
case XK_F7: KeyData.Key.ScanCode = SCAN_F7; break;
|
||||
case XK_F5: KeyData.Key.ScanCode = SCAN_F5;
|
||||
break;
|
||||
case XK_F6: KeyData.Key.ScanCode = SCAN_F6;
|
||||
break;
|
||||
case XK_F7: KeyData.Key.ScanCode = SCAN_F7;
|
||||
break;
|
||||
|
||||
// Don't map into X11 by default on a Mac
|
||||
// System Preferences->Keyboard->Keyboard Shortcuts can be configured
|
||||
// to not use higher function keys as shortcuts and the will show up
|
||||
// in X11.
|
||||
case XK_F8: KeyData.Key.ScanCode = SCAN_F8; break;
|
||||
case XK_F9: KeyData.Key.ScanCode = SCAN_F9; break;
|
||||
case XK_F10: KeyData.Key.ScanCode = SCAN_F10; break;
|
||||
case XK_F8: KeyData.Key.ScanCode = SCAN_F8;
|
||||
break;
|
||||
case XK_F9: KeyData.Key.ScanCode = SCAN_F9;
|
||||
break;
|
||||
case XK_F10: KeyData.Key.ScanCode = SCAN_F10;
|
||||
break;
|
||||
|
||||
case XK_F11: KeyData.Key.ScanCode = SCAN_F11; break;
|
||||
case XK_F12: KeyData.Key.ScanCode = SCAN_F12; break;
|
||||
case XK_F11: KeyData.Key.ScanCode = SCAN_F11;
|
||||
break;
|
||||
case XK_F12: KeyData.Key.ScanCode = SCAN_F12;
|
||||
break;
|
||||
|
||||
case XK_F13: KeyData.Key.ScanCode = SCAN_F13; break;
|
||||
case XK_F14: KeyData.Key.ScanCode = SCAN_F14; break;
|
||||
case XK_F15: KeyData.Key.ScanCode = SCAN_F15; break;
|
||||
case XK_F16: KeyData.Key.ScanCode = SCAN_F16; break;
|
||||
case XK_F17: KeyData.Key.ScanCode = SCAN_F17; break;
|
||||
case XK_F18: KeyData.Key.ScanCode = SCAN_F18; break;
|
||||
case XK_F19: KeyData.Key.ScanCode = SCAN_F19; break;
|
||||
case XK_F20: KeyData.Key.ScanCode = SCAN_F20; break;
|
||||
case XK_F21: KeyData.Key.ScanCode = SCAN_F21; break;
|
||||
case XK_F22: KeyData.Key.ScanCode = SCAN_F22; break;
|
||||
case XK_F23: KeyData.Key.ScanCode = SCAN_F23; break;
|
||||
case XK_F24: KeyData.Key.ScanCode = SCAN_F24; break;
|
||||
case XK_F13: KeyData.Key.ScanCode = SCAN_F13;
|
||||
break;
|
||||
case XK_F14: KeyData.Key.ScanCode = SCAN_F14;
|
||||
break;
|
||||
case XK_F15: KeyData.Key.ScanCode = SCAN_F15;
|
||||
break;
|
||||
case XK_F16: KeyData.Key.ScanCode = SCAN_F16;
|
||||
break;
|
||||
case XK_F17: KeyData.Key.ScanCode = SCAN_F17;
|
||||
break;
|
||||
case XK_F18: KeyData.Key.ScanCode = SCAN_F18;
|
||||
break;
|
||||
case XK_F19: KeyData.Key.ScanCode = SCAN_F19;
|
||||
break;
|
||||
case XK_F20: KeyData.Key.ScanCode = SCAN_F20;
|
||||
break;
|
||||
case XK_F21: KeyData.Key.ScanCode = SCAN_F21;
|
||||
break;
|
||||
case XK_F22: KeyData.Key.ScanCode = SCAN_F22;
|
||||
break;
|
||||
case XK_F23: KeyData.Key.ScanCode = SCAN_F23;
|
||||
break;
|
||||
case XK_F24: KeyData.Key.ScanCode = SCAN_F24;
|
||||
break;
|
||||
|
||||
// No mapping in X11
|
||||
//case XK_: KeyData.Key.ScanCode = SCAN_MUTE; break;
|
||||
//case XK_: KeyData.Key.ScanCode = SCAN_VOLUME_UP; break;
|
||||
//case XK_: KeyData.Key.ScanCode = SCAN_VOLUME_DOWN; break;
|
||||
//case XK_: KeyData.Key.ScanCode = SCAN_BRIGHTNESS_UP; break;
|
||||
//case XK_: KeyData.Key.ScanCode = SCAN_BRIGHTNESS_DOWN; break;
|
||||
//case XK_: KeyData.Key.ScanCode = SCAN_SUSPEND; break;
|
||||
//case XK_: KeyData.Key.ScanCode = SCAN_HIBERNATE; break;
|
||||
//case XK_: KeyData.Key.ScanCode = SCAN_TOGGLE_DISPLAY; break;
|
||||
//case XK_: KeyData.Key.ScanCode = SCAN_RECOVERY; break;
|
||||
//case XK_: KeyData.Key.ScanCode = SCAN_EJECT; break;
|
||||
// case XK_: KeyData.Key.ScanCode = SCAN_MUTE; break;
|
||||
// case XK_: KeyData.Key.ScanCode = SCAN_VOLUME_UP; break;
|
||||
// case XK_: KeyData.Key.ScanCode = SCAN_VOLUME_DOWN; break;
|
||||
// case XK_: KeyData.Key.ScanCode = SCAN_BRIGHTNESS_UP; break;
|
||||
// case XK_: KeyData.Key.ScanCode = SCAN_BRIGHTNESS_DOWN; break;
|
||||
// case XK_: KeyData.Key.ScanCode = SCAN_SUSPEND; break;
|
||||
// case XK_: KeyData.Key.ScanCode = SCAN_HIBERNATE; break;
|
||||
// case XK_: KeyData.Key.ScanCode = SCAN_TOGGLE_DISPLAY; break;
|
||||
// case XK_: KeyData.Key.ScanCode = SCAN_RECOVERY; break;
|
||||
// case XK_: KeyData.Key.ScanCode = SCAN_EJECT; break;
|
||||
|
||||
case XK_BackSpace: KeyData.Key.UnicodeChar = 0x0008; break;
|
||||
case XK_BackSpace: KeyData.Key.UnicodeChar = 0x0008;
|
||||
break;
|
||||
|
||||
case XK_KP_Tab:
|
||||
case XK_Tab: KeyData.Key.UnicodeChar = 0x0009; break;
|
||||
case XK_Tab: KeyData.Key.UnicodeChar = 0x0009;
|
||||
break;
|
||||
|
||||
case XK_Linefeed: KeyData.Key.UnicodeChar = 0x000a; break;
|
||||
case XK_Linefeed: KeyData.Key.UnicodeChar = 0x000a;
|
||||
break;
|
||||
|
||||
case XK_KP_Enter:
|
||||
case XK_Return: KeyData.Key.UnicodeChar = 0x000d; break;
|
||||
case XK_Return: KeyData.Key.UnicodeChar = 0x000d;
|
||||
break;
|
||||
|
||||
case XK_KP_Equal : KeyData.Key.UnicodeChar = L'='; break;
|
||||
case XK_KP_Multiply : KeyData.Key.UnicodeChar = L'*'; break;
|
||||
case XK_KP_Add : KeyData.Key.UnicodeChar = L'+'; break;
|
||||
case XK_KP_Separator : KeyData.Key.UnicodeChar = L'~'; break;
|
||||
case XK_KP_Subtract : KeyData.Key.UnicodeChar = L'-'; break;
|
||||
case XK_KP_Decimal : KeyData.Key.UnicodeChar = L'.'; break;
|
||||
case XK_KP_Divide : KeyData.Key.UnicodeChar = L'/'; break;
|
||||
case XK_KP_Equal: KeyData.Key.UnicodeChar = L'=';
|
||||
break;
|
||||
case XK_KP_Multiply: KeyData.Key.UnicodeChar = L'*';
|
||||
break;
|
||||
case XK_KP_Add: KeyData.Key.UnicodeChar = L'+';
|
||||
break;
|
||||
case XK_KP_Separator: KeyData.Key.UnicodeChar = L'~';
|
||||
break;
|
||||
case XK_KP_Subtract: KeyData.Key.UnicodeChar = L'-';
|
||||
break;
|
||||
case XK_KP_Decimal: KeyData.Key.UnicodeChar = L'.';
|
||||
break;
|
||||
case XK_KP_Divide: KeyData.Key.UnicodeChar = L'/';
|
||||
break;
|
||||
|
||||
case XK_KP_0 : KeyData.Key.UnicodeChar = L'0'; break;
|
||||
case XK_KP_1 : KeyData.Key.UnicodeChar = L'1'; break;
|
||||
case XK_KP_2 : KeyData.Key.UnicodeChar = L'2'; break;
|
||||
case XK_KP_3 : KeyData.Key.UnicodeChar = L'3'; break;
|
||||
case XK_KP_4 : KeyData.Key.UnicodeChar = L'4'; break;
|
||||
case XK_KP_5 : KeyData.Key.UnicodeChar = L'5'; break;
|
||||
case XK_KP_6 : KeyData.Key.UnicodeChar = L'6'; break;
|
||||
case XK_KP_7 : KeyData.Key.UnicodeChar = L'7'; break;
|
||||
case XK_KP_8 : KeyData.Key.UnicodeChar = L'8'; break;
|
||||
case XK_KP_9 : KeyData.Key.UnicodeChar = L'9'; break;
|
||||
case XK_KP_0: KeyData.Key.UnicodeChar = L'0';
|
||||
break;
|
||||
case XK_KP_1: KeyData.Key.UnicodeChar = L'1';
|
||||
break;
|
||||
case XK_KP_2: KeyData.Key.UnicodeChar = L'2';
|
||||
break;
|
||||
case XK_KP_3: KeyData.Key.UnicodeChar = L'3';
|
||||
break;
|
||||
case XK_KP_4: KeyData.Key.UnicodeChar = L'4';
|
||||
break;
|
||||
case XK_KP_5: KeyData.Key.UnicodeChar = L'5';
|
||||
break;
|
||||
case XK_KP_6: KeyData.Key.UnicodeChar = L'6';
|
||||
break;
|
||||
case XK_KP_7: KeyData.Key.UnicodeChar = L'7';
|
||||
break;
|
||||
case XK_KP_8: KeyData.Key.UnicodeChar = L'8';
|
||||
break;
|
||||
case XK_KP_9: KeyData.Key.UnicodeChar = L'9';
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
@ -446,8 +523,8 @@ handleKeyEvent (
|
||||
|
||||
if (*KeySym < XK_BackSpace) {
|
||||
if (((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | EFI_RIGHT_SHIFT_PRESSED)) != 0) ||
|
||||
((Drv->KeyState.KeyToggleState & EFI_CAPS_LOCK_ACTIVE) != 0) ) {
|
||||
|
||||
((Drv->KeyState.KeyToggleState & EFI_CAPS_LOCK_ACTIVE) != 0))
|
||||
{
|
||||
KeyData.Key.UnicodeChar = (CHAR16)KeySym[KEYSYM_UPPER];
|
||||
|
||||
// Per UEFI spec since we converted the Unicode clear the shift bits we pass up
|
||||
@ -457,7 +534,6 @@ handleKeyEvent (
|
||||
}
|
||||
} else {
|
||||
// XK_BackSpace is the start of XK_MISCELLANY. These are the XK_? keys we process in this file
|
||||
;
|
||||
}
|
||||
|
||||
if (Make) {
|
||||
@ -465,30 +541,29 @@ handleKeyEvent (
|
||||
Drv->key_wr = (Drv->key_wr + 1) % NBR_KEYS;
|
||||
Drv->key_count++;
|
||||
if (Drv->MakeRegisterdKeyCallback != NULL) {
|
||||
ReverseGasketUint64Uint64 (Drv->MakeRegisterdKeyCallback ,Drv->RegisterdKeyCallbackContext, &KeyData);
|
||||
ReverseGasketUint64Uint64 (Drv->MakeRegisterdKeyCallback, Drv->RegisterdKeyCallbackContext, &KeyData);
|
||||
}
|
||||
} else {
|
||||
if (Drv->BreakRegisterdKeyCallback != NULL) {
|
||||
ReverseGasketUint64Uint64 (Drv->BreakRegisterdKeyCallback ,Drv->RegisterdKeyCallbackContext, &KeyData);
|
||||
ReverseGasketUint64Uint64 (Drv->BreakRegisterdKeyCallback, Drv->RegisterdKeyCallbackContext, &KeyData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
handleMouseMoved(
|
||||
handleMouseMoved (
|
||||
IN GRAPHICS_IO_PRIVATE *Drv,
|
||||
IN XEvent *ev
|
||||
)
|
||||
{
|
||||
if (ev->xmotion.x != Drv->previous_x) {
|
||||
Drv->pointer_state.RelativeMovementX += ( ev->xmotion.x - Drv->previous_x );
|
||||
Drv->pointer_state.RelativeMovementX += (ev->xmotion.x - Drv->previous_x);
|
||||
Drv->previous_x = ev->xmotion.x;
|
||||
Drv->pointer_state_changed = 1;
|
||||
}
|
||||
|
||||
if (ev->xmotion.y != Drv->previous_y) {
|
||||
Drv->pointer_state.RelativeMovementY += ( ev->xmotion.y - Drv->previous_y );
|
||||
Drv->pointer_state.RelativeMovementY += (ev->xmotion.y - Drv->previous_y);
|
||||
Drv->previous_y = ev->xmotion.y;
|
||||
Drv->pointer_state_changed = 1;
|
||||
}
|
||||
@ -507,6 +582,7 @@ handleMouseDown (
|
||||
Drv->pointer_state_changed = (Drv->pointer_state.LeftButton != Pressed);
|
||||
Drv->pointer_state.LeftButton = Pressed;
|
||||
}
|
||||
|
||||
if ( ev->xbutton.button == Button2 ) {
|
||||
Drv->pointer_state_changed = (Drv->pointer_state.RightButton != Pressed);
|
||||
Drv->pointer_state.RightButton = Pressed;
|
||||
@ -524,27 +600,60 @@ Redraw (
|
||||
{
|
||||
if (Drv->use_shm) {
|
||||
XShmPutImage (
|
||||
Drv->display, Drv->win, Drv->gc, Drv->image, X, Y, X, Y, Width, Height, False
|
||||
Drv->display,
|
||||
Drv->win,
|
||||
Drv->gc,
|
||||
Drv->image,
|
||||
X,
|
||||
Y,
|
||||
X,
|
||||
Y,
|
||||
Width,
|
||||
Height,
|
||||
False
|
||||
);
|
||||
} else {
|
||||
XPutImage (
|
||||
Drv->display, Drv->win, Drv->gc, Drv->image, X, Y, X, Y, Width, Height
|
||||
Drv->display,
|
||||
Drv->win,
|
||||
Drv->gc,
|
||||
Drv->image,
|
||||
X,
|
||||
Y,
|
||||
X,
|
||||
Y,
|
||||
Width,
|
||||
Height
|
||||
);
|
||||
}
|
||||
XFlush(Drv->display);
|
||||
|
||||
XFlush (Drv->display);
|
||||
}
|
||||
|
||||
void
|
||||
HandleEvent(GRAPHICS_IO_PRIVATE *Drv, XEvent *ev)
|
||||
HandleEvent (
|
||||
GRAPHICS_IO_PRIVATE *Drv,
|
||||
XEvent *ev
|
||||
)
|
||||
{
|
||||
switch (ev->type) {
|
||||
case Expose:
|
||||
Redraw (Drv, ev->xexpose.x, ev->xexpose.y,
|
||||
ev->xexpose.width, ev->xexpose.height);
|
||||
Redraw (
|
||||
Drv,
|
||||
ev->xexpose.x,
|
||||
ev->xexpose.y,
|
||||
ev->xexpose.width,
|
||||
ev->xexpose.height
|
||||
);
|
||||
break;
|
||||
case GraphicsExpose:
|
||||
Redraw (Drv, ev->xgraphicsexpose.x, ev->xgraphicsexpose.y,
|
||||
ev->xgraphicsexpose.width, ev->xgraphicsexpose.height);
|
||||
Redraw (
|
||||
Drv,
|
||||
ev->xgraphicsexpose.x,
|
||||
ev->xgraphicsexpose.y,
|
||||
ev->xgraphicsexpose.width,
|
||||
ev->xgraphicsexpose.height
|
||||
);
|
||||
break;
|
||||
case KeyPress:
|
||||
handleKeyEvent (Drv, ev, TRUE);
|
||||
@ -564,12 +673,12 @@ HandleEvent(GRAPHICS_IO_PRIVATE *Drv, XEvent *ev)
|
||||
case ButtonRelease:
|
||||
handleMouseDown (Drv, ev, FALSE);
|
||||
break;
|
||||
#if 0
|
||||
#if 0
|
||||
case DestroyNotify:
|
||||
XCloseDisplay (Drv->display);
|
||||
exit (1);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
case NoExpose:
|
||||
default:
|
||||
break;
|
||||
@ -618,7 +727,6 @@ X11ColorToPixel (
|
||||
return Pixel;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
X11CheckKey (
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo
|
||||
@ -660,7 +768,6 @@ X11GetKey (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
X11KeySetState (
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||
@ -684,7 +791,6 @@ X11KeySetState (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
X11RegisterKeyNotify (
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||
@ -704,7 +810,6 @@ X11RegisterKeyNotify (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
X11Blt (
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||
@ -728,12 +833,12 @@ X11Blt (
|
||||
|
||||
Private = (GRAPHICS_IO_PRIVATE *)GraphicsIo;
|
||||
|
||||
|
||||
//
|
||||
// Check bounds
|
||||
//
|
||||
if (BltOperation == EfiUgaVideoToBltBuffer
|
||||
|| BltOperation == EfiUgaVideoToVideo) {
|
||||
if ( (BltOperation == EfiUgaVideoToBltBuffer)
|
||||
|| (BltOperation == EfiUgaVideoToVideo))
|
||||
{
|
||||
//
|
||||
// Source is Video.
|
||||
//
|
||||
@ -746,9 +851,10 @@ X11Blt (
|
||||
}
|
||||
}
|
||||
|
||||
if (BltOperation == EfiUgaBltBufferToVideo
|
||||
|| BltOperation == EfiUgaVideoToVideo
|
||||
|| BltOperation == EfiUgaVideoFill) {
|
||||
if ( (BltOperation == EfiUgaBltBufferToVideo)
|
||||
|| (BltOperation == EfiUgaVideoToVideo)
|
||||
|| (BltOperation == EfiUgaVideoFill))
|
||||
{
|
||||
//
|
||||
// Destination is Video
|
||||
//
|
||||
@ -769,19 +875,23 @@ X11Blt (
|
||||
for (SrcX = Args->SourceX; SrcX < (Args->Width + Args->SourceX); SrcX++) {
|
||||
*Blt++ = X11ColorToPixel (Private, XGetPixel (Private->image, SrcX, SrcY));
|
||||
}
|
||||
Blt = (EFI_UGA_PIXEL *) ((UINT8 *) Blt + Args->Delta);
|
||||
|
||||
Blt = (EFI_UGA_PIXEL *)((UINT8 *)Blt + Args->Delta);
|
||||
}
|
||||
|
||||
break;
|
||||
case EfiUgaBltBufferToVideo:
|
||||
Blt = (EFI_UGA_PIXEL *)((UINT8 *)BltBuffer + (Args->SourceY * Args->Delta) + Args->SourceX * sizeof (EFI_UGA_PIXEL));
|
||||
Args->Delta -= Args->Width * sizeof (EFI_UGA_PIXEL);
|
||||
for (DstY = Args->DestinationY; DstY < (Args->Height + Args->DestinationY); DstY++) {
|
||||
for (DstX = Args->DestinationX; DstX < (Args->Width + Args->DestinationX); DstX++) {
|
||||
XPutPixel(Private->image, DstX, DstY, X11PixelToColor(Private, *Blt));
|
||||
XPutPixel (Private->image, DstX, DstY, X11PixelToColor (Private, *Blt));
|
||||
Blt++;
|
||||
}
|
||||
Blt = (EFI_UGA_PIXEL *) ((UINT8 *) Blt + Args->Delta);
|
||||
|
||||
Blt = (EFI_UGA_PIXEL *)((UINT8 *)Blt + Args->Delta);
|
||||
}
|
||||
|
||||
break;
|
||||
case EfiUgaVideoToVideo:
|
||||
Dst = Private->image_data + (Args->DestinationX << Private->pixel_shift)
|
||||
@ -808,14 +918,16 @@ X11Blt (
|
||||
Src -= Private->line_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case EfiUgaVideoFill:
|
||||
Color = X11PixelToColor(Private, *BltBuffer);
|
||||
Color = X11PixelToColor (Private, *BltBuffer);
|
||||
for (DstY = Args->DestinationY; DstY < (Args->Height + Args->DestinationY); DstY++) {
|
||||
for (DstX = Args->DestinationX; DstX < (Args->Width + Args->DestinationX); DstX++) {
|
||||
XPutPixel(Private->image, DstX, DstY, Color);
|
||||
XPutPixel (Private->image, DstX, DstY, Color);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@ -826,26 +938,39 @@ X11Blt (
|
||||
//
|
||||
switch (BltOperation) {
|
||||
case EfiUgaVideoToVideo:
|
||||
XCopyArea(
|
||||
Private->display, Private->win, Private->win, Private->gc,
|
||||
Args->SourceX, Args->SourceY, Args->Width, Args->Height,
|
||||
Args->DestinationX, Args->DestinationY
|
||||
XCopyArea (
|
||||
Private->display,
|
||||
Private->win,
|
||||
Private->win,
|
||||
Private->gc,
|
||||
Args->SourceX,
|
||||
Args->SourceY,
|
||||
Args->Width,
|
||||
Args->Height,
|
||||
Args->DestinationX,
|
||||
Args->DestinationY
|
||||
);
|
||||
|
||||
while (1) {
|
||||
XNextEvent (Private->display, &ev);
|
||||
HandleEvent (Private, &ev);
|
||||
if (ev.type == NoExpose || ev.type == GraphicsExpose) {
|
||||
if ((ev.type == NoExpose) || (ev.type == GraphicsExpose)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case EfiUgaVideoFill:
|
||||
Color = X11PixelToColor (Private, *BltBuffer);
|
||||
XSetForeground (Private->display, Private->gc, Color);
|
||||
XFillRectangle (
|
||||
Private->display, Private->win, Private->gc,
|
||||
Args->DestinationX, Args->DestinationY, Args->Width, Args->Height
|
||||
Private->display,
|
||||
Private->win,
|
||||
Private->gc,
|
||||
Args->DestinationX,
|
||||
Args->DestinationY,
|
||||
Args->Width,
|
||||
Args->Height
|
||||
);
|
||||
XFlush (Private->display);
|
||||
break;
|
||||
@ -855,10 +980,10 @@ X11Blt (
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
X11CheckPointer (
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo
|
||||
@ -876,7 +1001,6 @@ X11CheckPointer (
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
X11GetPointerState (
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||
@ -902,8 +1026,6 @@ X11GetPointerState (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
X11GraphicsWindowOpen (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
@ -927,7 +1049,6 @@ X11GraphicsWindowOpen (
|
||||
Drv->GraphicsIo.CheckPointer = GasketX11CheckPointer;
|
||||
Drv->GraphicsIo.GetPointerState = GasketX11GetPointerState;
|
||||
|
||||
|
||||
Drv->key_count = 0;
|
||||
Drv->key_rd = 0;
|
||||
Drv->key_wr = 0;
|
||||
@ -937,18 +1058,23 @@ X11GraphicsWindowOpen (
|
||||
Drv->BreakRegisterdKeyCallback = NULL;
|
||||
Drv->RegisterdKeyCallbackContext = NULL;
|
||||
|
||||
|
||||
Drv->display = XOpenDisplay (display_name);
|
||||
if (Drv->display == NULL) {
|
||||
fprintf (stderr, "uga: cannot connect to X server %s\n", XDisplayName (display_name));
|
||||
free (Drv);
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
Drv->screen = DefaultScreen (Drv->display);
|
||||
Drv->visual = DefaultVisual (Drv->display, Drv->screen);
|
||||
Drv->win = XCreateSimpleWindow (
|
||||
Drv->display, RootWindow (Drv->display, Drv->screen),
|
||||
0, 0, 4, 4, border_width,
|
||||
Drv->display,
|
||||
RootWindow (Drv->display, Drv->screen),
|
||||
0,
|
||||
0,
|
||||
4,
|
||||
4,
|
||||
border_width,
|
||||
WhitePixel (Drv->display, Drv->screen),
|
||||
BlackPixel (Drv->display, Drv->screen)
|
||||
);
|
||||
@ -960,9 +1086,10 @@ X11GraphicsWindowOpen (
|
||||
UnicodeStrToAsciiStrS (This->ConfigString, Drv->Title, StrSize (This->ConfigString));
|
||||
XStoreName (Drv->display, Drv->win, Drv->Title);
|
||||
|
||||
// XAutoRepeatOff (Drv->display);
|
||||
// XAutoRepeatOff (Drv->display);
|
||||
XSelectInput (
|
||||
Drv->display, Drv->win,
|
||||
Drv->display,
|
||||
Drv->win,
|
||||
ExposureMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask
|
||||
);
|
||||
Drv->gc = DefaultGC (Drv->display, Drv->screen);
|
||||
@ -972,7 +1099,6 @@ X11GraphicsWindowOpen (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
X11GraphicsWindowClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
@ -987,7 +1113,7 @@ X11GraphicsWindowClose (
|
||||
}
|
||||
|
||||
if (Drv->image != NULL) {
|
||||
XDestroyImage(Drv->image);
|
||||
XDestroyImage (Drv->image);
|
||||
|
||||
if (Drv->use_shm) {
|
||||
shmdt (Drv->image_data);
|
||||
@ -996,19 +1122,19 @@ X11GraphicsWindowClose (
|
||||
Drv->image_data = NULL;
|
||||
Drv->image = NULL;
|
||||
}
|
||||
|
||||
XDestroyWindow (Drv->display, Drv->win);
|
||||
XCloseDisplay (Drv->display);
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifdef __APPLE__
|
||||
// Free up the shared memory
|
||||
shmctl (Drv->xshm_info.shmid, IPC_RMID, NULL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
free (Drv);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL gX11ThunkIo = {
|
||||
&gEmuGraphicsWindowProtocolGuid,
|
||||
NULL,
|
||||
@ -1018,5 +1144,3 @@ EMU_IO_THUNK_PROTOCOL gX11ThunkIo = {
|
||||
GasketX11GraphicsWindowClose,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
@ -27,23 +27,20 @@ typedef struct {
|
||||
#define WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
|
||||
CR(a, WIN_NT_BLOCK_IO_PRIVATE, EmuBlockIo, WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE)
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
WinNtBlockIoReset (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
SetFilePointer64 (
|
||||
IN WIN_NT_BLOCK_IO_PRIVATE *Private,
|
||||
IN INT64 DistanceToMove,
|
||||
OUT UINT64 *NewFilePointer,
|
||||
IN DWORD MoveMethod
|
||||
)
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
This function extends the capability of SetFilePointer to accept 64 bit parameters
|
||||
@ -63,7 +60,7 @@ This function extends the capability of SetFilePointer to accept 64 bit paramete
|
||||
MoveMethod
|
||||
);
|
||||
|
||||
if (LargeInt.LowPart == -1 && GetLastError () != NO_ERROR) {
|
||||
if ((LargeInt.LowPart == -1) && (GetLastError () != NO_ERROR)) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -74,8 +71,6 @@ This function extends the capability of SetFilePointer to accept 64 bit paramete
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
WinNtBlockIoOpenDevice (
|
||||
IN WIN_NT_BLOCK_IO_PRIVATE *Private,
|
||||
@ -138,7 +133,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtBlockIoCreateMapping (
|
||||
@ -164,7 +158,6 @@ WinNtBlockIoCreateMapping (
|
||||
Media->LowestAlignedLba = 0;
|
||||
Media->LogicalBlocksPerPhysicalBlock = 0;
|
||||
|
||||
|
||||
// EFI_BLOCK_IO_PROTOCOL_REVISION3
|
||||
Media->OptimalTransferLengthGranularity = 0;
|
||||
|
||||
@ -175,12 +168,11 @@ WinNtBlockIoCreateMapping (
|
||||
return WinNtBlockIoOpenDevice (Private, Media);
|
||||
}
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
WinNtBlockIoError (
|
||||
IN WIN_NT_BLOCK_IO_PRIVATE *Private
|
||||
)
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -203,7 +195,6 @@ Returns:
|
||||
Media = Private->Media;
|
||||
|
||||
switch (GetLastError ()) {
|
||||
|
||||
case ERROR_NOT_READY:
|
||||
Media->ReadOnly = FALSE;
|
||||
Media->MediaPresent = FALSE;
|
||||
@ -227,19 +218,18 @@ Returns:
|
||||
break;
|
||||
}
|
||||
|
||||
if (Status == EFI_NO_MEDIA || Status == EFI_MEDIA_CHANGED) {
|
||||
if ((Status == EFI_NO_MEDIA) || (Status == EFI_MEDIA_CHANGED)) {
|
||||
WinNtBlockIoReset (&Private->EmuBlockIo, FALSE);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
WinNtSignalToken (
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
|
||||
IN EFI_STATUS Status
|
||||
)
|
||||
)
|
||||
{
|
||||
if (Token != NULL) {
|
||||
if (Token->Event != NULL) {
|
||||
@ -248,6 +238,7 @@ WinNtSignalToken (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -323,7 +314,6 @@ WinNtBlockIoReadBlocks (
|
||||
return WinNtSignalToken (Token, EFI_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Write BufferSize bytes from Lba into Buffer.
|
||||
|
||||
@ -429,7 +419,6 @@ WinNtBlockIoFlushBlocks (
|
||||
return WinNtSignalToken (Token, EFI_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reset the block device hardware.
|
||||
|
||||
@ -493,6 +482,7 @@ WinNtBlockIoThunkOpen (
|
||||
if (Private->FileName == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// Parse ConfigString
|
||||
// <ConfigString> := <FileName> ':' [RF][OW] ':' <BlockSize>
|
||||
@ -503,12 +493,14 @@ WinNtBlockIoThunkOpen (
|
||||
Private->Readonly = FALSE;
|
||||
} else {
|
||||
for (*Str++ = L'\0'; *Str != L'\0'; Str++) {
|
||||
if (*Str == 'R' || *Str == 'F') {
|
||||
Private->Removable = (BOOLEAN) (*Str == L'R');
|
||||
if ((*Str == 'R') || (*Str == 'F')) {
|
||||
Private->Removable = (BOOLEAN)(*Str == L'R');
|
||||
}
|
||||
if (*Str == 'O' || *Str == 'W') {
|
||||
Private->Readonly = (BOOLEAN) (*Str == L'O');
|
||||
|
||||
if ((*Str == 'O') || (*Str == 'W')) {
|
||||
Private->Readonly = (BOOLEAN)(*Str == L'O');
|
||||
}
|
||||
|
||||
if (*Str == ':') {
|
||||
Private->BlockSize = wcstol (++Str, NULL, 0);
|
||||
break;
|
||||
@ -521,7 +513,6 @@ WinNtBlockIoThunkOpen (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtBlockIoThunkClose (
|
||||
@ -536,14 +527,13 @@ WinNtBlockIoThunkClose (
|
||||
if (Private->FileName != NULL) {
|
||||
FreePool (Private->FileName);
|
||||
}
|
||||
|
||||
FreePool (Private);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL mWinNtBlockIoThunkIo = {
|
||||
&gEmuBlockIoProtocolGuid,
|
||||
NULL,
|
||||
|
@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include "WinHost.h"
|
||||
|
||||
|
||||
#define WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE SIGNATURE_32 ('N', 'T', 'f', 's')
|
||||
|
||||
typedef struct {
|
||||
@ -27,7 +26,6 @@ typedef struct {
|
||||
WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \
|
||||
)
|
||||
|
||||
|
||||
#define WIN_NT_EFI_FILE_PRIVATE_SIGNATURE SIGNATURE_32 ('l', 'o', 'f', 's')
|
||||
|
||||
typedef struct {
|
||||
@ -72,13 +70,12 @@ WinNtFileSetInfo (
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
|
||||
CHAR16 *
|
||||
EfiStrChr (
|
||||
IN CHAR16 *Str,
|
||||
IN CHAR16 Chr
|
||||
)
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -109,24 +106,22 @@ Returns:
|
||||
return (*Str == Chr) ? Str : NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
IsZero (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
if (Buffer == NULL || Length == 0) {
|
||||
if ((Buffer == NULL) || (Length == 0)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (*(UINT8 *) Buffer != 0) {
|
||||
if (*(UINT8 *)Buffer != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (Length > 1) {
|
||||
if (!CompareMem (Buffer, (UINT8 *) Buffer + 1, Length - 1)) {
|
||||
if (!CompareMem (Buffer, (UINT8 *)Buffer + 1, Length - 1)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -154,6 +149,7 @@ CutPrefix (
|
||||
*Pointer = *(Pointer + Count);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Open the root directory on a volume.
|
||||
|
||||
@ -181,7 +177,7 @@ WinNtOpenVolume (
|
||||
CHAR16 *TempFileName;
|
||||
UINTN Size;
|
||||
|
||||
if (This == NULL || Root == NULL) {
|
||||
if ((This == NULL) || (Root == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -205,11 +201,13 @@ WinNtOpenVolume (
|
||||
goto Done;
|
||||
}
|
||||
|
||||
StrCpyS (PrivateFile->FilePath,
|
||||
StrCpyS (
|
||||
PrivateFile->FilePath,
|
||||
StrSize (Private->FilePath) / sizeof (CHAR16),
|
||||
Private->FilePath
|
||||
);
|
||||
StrCpyS (PrivateFile->FileName,
|
||||
StrCpyS (
|
||||
PrivateFile->FileName,
|
||||
StrSize (Private->FilePath) / sizeof (CHAR16),
|
||||
PrivateFile->FilePath
|
||||
);
|
||||
@ -249,6 +247,7 @@ WinNtOpenVolume (
|
||||
if (TempFileName == NULL) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
StrCpyS (TempFileName, Size / sizeof (CHAR16), PrivateFile->FilePath);
|
||||
StrCatS (TempFileName, Size / sizeof (CHAR16), L"\\*");
|
||||
|
||||
@ -260,6 +259,7 @@ WinNtOpenVolume (
|
||||
} else {
|
||||
PrivateFile->IsValidFindBuf = TRUE;
|
||||
}
|
||||
|
||||
*Root = &PrivateFile->EfiFile;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
@ -292,8 +292,8 @@ Done:
|
||||
**/
|
||||
UINTN
|
||||
CountLeadingDots (
|
||||
IN CONST CHAR16 * FileNameToken
|
||||
)
|
||||
IN CONST CHAR16 *FileNameToken
|
||||
)
|
||||
{
|
||||
UINTN Num;
|
||||
|
||||
@ -306,13 +306,13 @@ CountLeadingDots (
|
||||
return Num;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
IsFileNameTokenValid (
|
||||
IN CONST CHAR16 * FileNameToken
|
||||
)
|
||||
IN CONST CHAR16 *FileNameToken
|
||||
)
|
||||
{
|
||||
UINTN Num;
|
||||
|
||||
if (StrStr (FileNameToken, L"/") != NULL) {
|
||||
//
|
||||
// No L'/' in file name.
|
||||
@ -337,7 +337,6 @@ IsFileNameTokenValid (
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Return the first string token found in the indirect pointer a String named by FileName.
|
||||
|
||||
@ -352,12 +351,13 @@ IsFileNameTokenValid (
|
||||
**/
|
||||
CHAR16 *
|
||||
GetNextFileNameToken (
|
||||
IN OUT CONST CHAR16 ** FileName
|
||||
)
|
||||
IN OUT CONST CHAR16 **FileName
|
||||
)
|
||||
{
|
||||
CHAR16 *SlashPos;
|
||||
CHAR16 *Token;
|
||||
UINTN Offset;
|
||||
|
||||
ASSERT (**FileName != L'\\');
|
||||
ASSERT (**FileName != L'\0');
|
||||
|
||||
@ -384,7 +384,6 @@ GetNextFileNameToken (
|
||||
return Token;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check if a FileName contains only Valid Characters.
|
||||
|
||||
@ -400,7 +399,6 @@ GetNextFileNameToken (
|
||||
@return FALSE FileName contains at least one invalid character.
|
||||
|
||||
**/
|
||||
|
||||
BOOLEAN
|
||||
IsFileNameValid (
|
||||
IN CONST CHAR16 *FileName
|
||||
@ -415,6 +413,7 @@ IsFileNameValid (
|
||||
if (StrCmp (FileName, L"\\") == 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// We don't support two or more adjacent L'\'.
|
||||
//
|
||||
@ -425,7 +424,7 @@ IsFileNameValid (
|
||||
//
|
||||
// Is FileName has a leading L"\", skip to next character.
|
||||
//
|
||||
if (FileName [0] == L'\\') {
|
||||
if (FileName[0] == L'\\') {
|
||||
FileName++;
|
||||
}
|
||||
|
||||
@ -434,14 +433,14 @@ IsFileNameValid (
|
||||
Valid = IsFileNameTokenValid (Token);
|
||||
FreePool (Token);
|
||||
|
||||
if (!Valid)
|
||||
if (!Valid) {
|
||||
return FALSE;
|
||||
}
|
||||
} while (FileName != NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Opens a new file relative to the source file's location.
|
||||
|
||||
@ -487,7 +486,6 @@ WinNtFileOpen (
|
||||
EFI_FILE_INFO *Info;
|
||||
UINTN Size;
|
||||
|
||||
|
||||
//
|
||||
// Init local variables
|
||||
//
|
||||
@ -502,6 +500,7 @@ WinNtFileOpen (
|
||||
if (TempFileName == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
StrCpyS (TempFileName, StrSize (FileName) / sizeof (CHAR16), FileName);
|
||||
FileName = TempFileName;
|
||||
|
||||
@ -513,26 +512,30 @@ WinNtFileOpen (
|
||||
// If file name does not equal to "." or ".." and not trailed with "\..",
|
||||
// then we trim the leading/trailing blanks and trailing dots
|
||||
//
|
||||
if (StrCmp (FileName, L".") != 0 && StrCmp (FileName, L"..") != 0 &&
|
||||
((StrLen (FileName) >= 3) ? (StrCmp (&FileName[StrLen (FileName) - 3], L"\\..") != 0) : TRUE)) {
|
||||
if ((StrCmp (FileName, L".") != 0) && (StrCmp (FileName, L"..") != 0) &&
|
||||
((StrLen (FileName) >= 3) ? (StrCmp (&FileName[StrLen (FileName) - 3], L"\\..") != 0) : TRUE))
|
||||
{
|
||||
//
|
||||
// Trim leading blanks
|
||||
//
|
||||
Count = 0;
|
||||
for (TempFileName = FileName;
|
||||
*TempFileName != 0 && *TempFileName == L' ';
|
||||
TempFileName++) {
|
||||
TempFileName++)
|
||||
{
|
||||
Count++;
|
||||
}
|
||||
|
||||
CutPrefix (FileName, Count);
|
||||
//
|
||||
// Trim trailing blanks
|
||||
//
|
||||
for (TempFileName = FileName + StrLen (FileName) - 1;
|
||||
TempFileName >= FileName && (*TempFileName == L' ');
|
||||
TempFileName--) {
|
||||
;
|
||||
TempFileName--)
|
||||
{
|
||||
}
|
||||
|
||||
*(TempFileName + 1) = 0;
|
||||
}
|
||||
|
||||
@ -608,15 +611,14 @@ WinNtFileOpen (
|
||||
LoopFinish = FALSE;
|
||||
|
||||
while (!LoopFinish) {
|
||||
|
||||
LoopFinish = TRUE;
|
||||
|
||||
for (ParseFileName = GuardPointer; *ParseFileName; ParseFileName++) {
|
||||
if (*ParseFileName == L'.' &&
|
||||
(*(ParseFileName + 1) == 0 || *(ParseFileName + 1) == L'\\') &&
|
||||
*(ParseFileName - 1) == L'\\'
|
||||
) {
|
||||
|
||||
if ((*ParseFileName == L'.') &&
|
||||
((*(ParseFileName + 1) == 0) || (*(ParseFileName + 1) == L'\\')) &&
|
||||
(*(ParseFileName - 1) == L'\\')
|
||||
)
|
||||
{
|
||||
//
|
||||
// cut \.
|
||||
//
|
||||
@ -625,12 +627,12 @@ WinNtFileOpen (
|
||||
break;
|
||||
}
|
||||
|
||||
if (*ParseFileName == L'.' &&
|
||||
*(ParseFileName + 1) == L'.' &&
|
||||
(*(ParseFileName + 2) == 0 || *(ParseFileName + 2) == L'\\') &&
|
||||
*(ParseFileName - 1) == L'\\'
|
||||
) {
|
||||
|
||||
if ((*ParseFileName == L'.') &&
|
||||
(*(ParseFileName + 1) == L'.') &&
|
||||
((*(ParseFileName + 2) == 0) || (*(ParseFileName + 2) == L'\\')) &&
|
||||
(*(ParseFileName - 1) == L'\\')
|
||||
)
|
||||
{
|
||||
ParseFileName--;
|
||||
Count = 3;
|
||||
|
||||
@ -724,7 +726,6 @@ WinNtFileOpen (
|
||||
// deal with directory
|
||||
//
|
||||
if (NewPrivateFile->IsDirectoryPath) {
|
||||
|
||||
Size = StrSize (NewPrivateFile->FileName);
|
||||
Size += StrSize (L"\\*");
|
||||
TempFileName = AllocatePool (Size);
|
||||
@ -740,7 +741,6 @@ WinNtFileOpen (
|
||||
// Create a directory
|
||||
//
|
||||
if (!CreateDirectory (TempFileName, NULL)) {
|
||||
|
||||
LastError = GetLastError ();
|
||||
if (LastError != ERROR_ALREADY_EXISTS) {
|
||||
FreePool (TempFileName);
|
||||
@ -761,7 +761,6 @@ WinNtFileOpen (
|
||||
);
|
||||
|
||||
if (NewPrivateFile->DirHandle == INVALID_HANDLE_VALUE) {
|
||||
|
||||
NewPrivateFile->DirHandle = CreateFile (
|
||||
TempFileName,
|
||||
GENERIC_READ,
|
||||
@ -847,7 +846,7 @@ WinNtFileOpen (
|
||||
}
|
||||
}
|
||||
|
||||
if ((OpenMode & EFI_FILE_MODE_CREATE) && Status == EFI_SUCCESS) {
|
||||
if ((OpenMode & EFI_FILE_MODE_CREATE) && (Status == EFI_SUCCESS)) {
|
||||
//
|
||||
// Set the attribute
|
||||
//
|
||||
@ -905,8 +904,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Close the file handle
|
||||
|
||||
@ -934,7 +931,7 @@ WinNtFileClose (
|
||||
PrivateFile->LHandle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
if (PrivateFile->IsDirectoryPath && PrivateFile->DirHandle != INVALID_HANDLE_VALUE) {
|
||||
if (PrivateFile->IsDirectoryPath && (PrivateFile->DirHandle != INVALID_HANDLE_VALUE)) {
|
||||
CloseHandle (PrivateFile->DirHandle);
|
||||
PrivateFile->DirHandle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
@ -950,10 +947,8 @@ WinNtFileClose (
|
||||
FreePool (PrivateFile);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Close and delete the file handle.
|
||||
|
||||
@ -1011,7 +1006,8 @@ WinNtSystemTimeToEfiTime (
|
||||
IN SYSTEMTIME *SystemTime,
|
||||
IN TIME_ZONE_INFORMATION *TimeZone,
|
||||
OUT EFI_TIME *Time
|
||||
)
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -1058,7 +1054,7 @@ WinNtFileTimeToEfiTime (
|
||||
IN TIME_ZONE_INFORMATION *TimeZone,
|
||||
IN CONST FILETIME *FileTime,
|
||||
OUT EFI_TIME *EfiTime
|
||||
)
|
||||
)
|
||||
{
|
||||
FILETIME TempFileTime;
|
||||
SYSTEMTIME SystemTime;
|
||||
@ -1068,7 +1064,6 @@ WinNtFileTimeToEfiTime (
|
||||
WinNtSystemTimeToEfiTime (&SystemTime, TimeZone, EfiTime);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read data from the file.
|
||||
|
||||
@ -1112,7 +1107,6 @@ WinNtFileRead (
|
||||
}
|
||||
|
||||
if (!PrivateFile->IsDirectoryPath) {
|
||||
|
||||
if (This->GetPosition (This, &Pos) != EFI_SUCCESS) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Done;
|
||||
@ -1244,8 +1238,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Write data to a file.
|
||||
|
||||
@ -1307,8 +1299,6 @@ Done:
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Set a files current position
|
||||
|
||||
@ -1382,8 +1372,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Get a file's current position
|
||||
|
||||
@ -1411,12 +1399,9 @@ WinNtFileGetPossition (
|
||||
PosHigh64 = 0;
|
||||
|
||||
if (PrivateFile->IsDirectoryPath) {
|
||||
|
||||
Status = EFI_UNSUPPORTED;
|
||||
goto Done;
|
||||
|
||||
} else {
|
||||
|
||||
PositionHigh = 0;
|
||||
*Position = SetFilePointer (
|
||||
PrivateFile->LHandle,
|
||||
@ -1438,13 +1423,13 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
WinNtSimpleFileSystemFileInfo (
|
||||
IN WIN_NT_EFI_FILE_PRIVATE *PrivateFile,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -1484,6 +1469,7 @@ Returns:
|
||||
|
||||
TempPointer++;
|
||||
}
|
||||
|
||||
NameSize = StrSize (RealFileName);
|
||||
|
||||
ResultSize = Size + NameSize;
|
||||
@ -1583,7 +1569,7 @@ WinNtFileGetInfo (
|
||||
UINTN Index;
|
||||
WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
|
||||
|
||||
if (This == NULL || InformationType == NULL || BufferSize == NULL) {
|
||||
if ((This == NULL) || (InformationType == NULL) || (BufferSize == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -1623,22 +1609,19 @@ WinNtFileGetInfo (
|
||||
PrivateFile->FilePath
|
||||
);
|
||||
for (Index = 0; DriveName[Index] != 0 && DriveName[Index] != ':'; Index++) {
|
||||
;
|
||||
}
|
||||
|
||||
if (DriveName[Index] == ':') {
|
||||
DriveName[Index + 1] = '\\';
|
||||
DriveName[Index + 2] = 0;
|
||||
DriveNameFound = TRUE;
|
||||
} else if (DriveName[0] == '\\' && DriveName[1] == '\\') {
|
||||
} else if ((DriveName[0] == '\\') && (DriveName[1] == '\\')) {
|
||||
for (Index = 2; DriveName[Index] != 0 && DriveName[Index] != '\\'; Index++) {
|
||||
;
|
||||
}
|
||||
|
||||
if (DriveName[Index] == '\\') {
|
||||
DriveNameFound = TRUE;
|
||||
for (Index++; DriveName[Index] != 0 && DriveName[Index] != '\\'; Index++) {
|
||||
;
|
||||
}
|
||||
|
||||
DriveName[Index] = '\\';
|
||||
@ -1668,7 +1651,6 @@ WinNtFileGetInfo (
|
||||
FileSystemInfoBuffer->VolumeSize = MultU64x32 (TotalClusters, BytesPerCluster);
|
||||
FileSystemInfoBuffer->FreeSpace = MultU64x32 (FreeClusters, BytesPerCluster);
|
||||
FileSystemInfoBuffer->BlockSize = BytesPerCluster;
|
||||
|
||||
} else {
|
||||
//
|
||||
// try GetDiskFreeSpaceEx then
|
||||
@ -1715,7 +1697,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set information about a file
|
||||
|
||||
@ -1790,7 +1771,6 @@ WinNtFileSetInfo (
|
||||
goto Done;
|
||||
}
|
||||
|
||||
|
||||
FreePool (PrivateRoot->VolumeLabel);
|
||||
PrivateRoot->VolumeLabel = AllocatePool (StrSize (NewFileSystemInfo->VolumeLabel));
|
||||
if (PrivateRoot->VolumeLabel == NULL) {
|
||||
@ -1848,8 +1828,9 @@ WinNtFileSetInfo (
|
||||
|
||||
if ((NewFileInfo->Size <= SIZE_OF_EFI_FILE_INFO) ||
|
||||
(NewFileInfo->Attribute &~(EFI_FILE_VALID_ATTR)) ||
|
||||
(sizeof (UINTN) == 4 && NewFileInfo->Size > 0xFFFFFFFF)
|
||||
) {
|
||||
((sizeof (UINTN) == 4) && (NewFileInfo->Size > 0xFFFFFFFF))
|
||||
)
|
||||
{
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
}
|
||||
@ -1959,15 +1940,18 @@ WinNtFileSetInfo (
|
||||
//
|
||||
if (!IsZero (&NewFileInfo->CreateTime, sizeof (EFI_TIME)) &&
|
||||
CompareMem (&NewFileInfo->CreateTime, &OldFileInfo->CreateTime, sizeof (EFI_TIME))
|
||||
) {
|
||||
)
|
||||
{
|
||||
TimeChangeFlag = TRUE;
|
||||
} else if (!IsZero (&NewFileInfo->LastAccessTime, sizeof (EFI_TIME)) &&
|
||||
CompareMem (&NewFileInfo->LastAccessTime, &OldFileInfo->LastAccessTime, sizeof (EFI_TIME))
|
||||
) {
|
||||
)
|
||||
{
|
||||
TimeChangeFlag = TRUE;
|
||||
} else if (!IsZero (&NewFileInfo->ModificationTime, sizeof (EFI_TIME)) &&
|
||||
CompareMem (&NewFileInfo->ModificationTime, &OldFileInfo->ModificationTime, sizeof (EFI_TIME))
|
||||
) {
|
||||
)
|
||||
{
|
||||
TimeChangeFlag = TRUE;
|
||||
}
|
||||
|
||||
@ -2013,7 +1997,7 @@ WinNtFileSetInfo (
|
||||
}
|
||||
}
|
||||
|
||||
if (PrivateFile->IsDirectoryPath && PrivateFile->DirHandle != INVALID_HANDLE_VALUE) {
|
||||
if (PrivateFile->IsDirectoryPath && (PrivateFile->DirHandle != INVALID_HANDLE_VALUE)) {
|
||||
CloseHandle (PrivateFile->DirHandle);
|
||||
PrivateFile->DirHandle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
@ -2078,7 +2062,7 @@ WinNtFileSetInfo (
|
||||
}
|
||||
} else {
|
||||
Status = EFI_ACCESS_DENIED;
|
||||
Reopen:;
|
||||
Reopen:;
|
||||
|
||||
NtStatus = SetFileAttributes (OldFileName, OldAttr);
|
||||
|
||||
@ -2120,7 +2104,6 @@ WinNtFileSetInfo (
|
||||
FreePool (TempFileName);
|
||||
|
||||
goto Done;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2163,7 +2146,6 @@ WinNtFileSetInfo (
|
||||
// Time change
|
||||
//
|
||||
if (TimeChangeFlag) {
|
||||
|
||||
NewCreationSystemTime.wYear = NewFileInfo->CreateTime.Year;
|
||||
NewCreationSystemTime.wMonth = NewFileInfo->CreateTime.Month;
|
||||
NewCreationSystemTime.wDay = NewFileInfo->CreateTime.Day;
|
||||
@ -2175,14 +2157,16 @@ WinNtFileSetInfo (
|
||||
if (!SystemTimeToFileTime (
|
||||
&NewCreationSystemTime,
|
||||
&NewCreationFileTime
|
||||
)) {
|
||||
))
|
||||
{
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if (!LocalFileTimeToFileTime (
|
||||
&NewCreationFileTime,
|
||||
&NewCreationFileTime
|
||||
)) {
|
||||
))
|
||||
{
|
||||
goto Done;
|
||||
}
|
||||
|
||||
@ -2197,14 +2181,16 @@ WinNtFileSetInfo (
|
||||
if (!SystemTimeToFileTime (
|
||||
&NewLastAccessSystemTime,
|
||||
&NewLastAccessFileTime
|
||||
)) {
|
||||
))
|
||||
{
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if (!LocalFileTimeToFileTime (
|
||||
&NewLastAccessFileTime,
|
||||
&NewLastAccessFileTime
|
||||
)) {
|
||||
))
|
||||
{
|
||||
goto Done;
|
||||
}
|
||||
|
||||
@ -2219,14 +2205,16 @@ WinNtFileSetInfo (
|
||||
if (!SystemTimeToFileTime (
|
||||
&NewLastWriteSystemTime,
|
||||
&NewLastWriteFileTime
|
||||
)) {
|
||||
))
|
||||
{
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if (!LocalFileTimeToFileTime (
|
||||
&NewLastWriteFileTime,
|
||||
&NewLastWriteFileTime
|
||||
)) {
|
||||
))
|
||||
{
|
||||
goto Done;
|
||||
}
|
||||
|
||||
@ -2235,11 +2223,11 @@ WinNtFileSetInfo (
|
||||
&NewCreationFileTime,
|
||||
&NewLastAccessFileTime,
|
||||
&NewLastWriteFileTime
|
||||
)) {
|
||||
))
|
||||
{
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@ -2295,7 +2283,6 @@ Done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Flush data back for the file handle.
|
||||
|
||||
@ -2351,11 +2338,8 @@ Done:
|
||||
//
|
||||
// bugbug: - Use Windows error reporting.
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
WinNtFileSystmeThunkOpen (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
@ -2390,7 +2374,6 @@ WinNtFileSystmeThunkOpen (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
WinNtFileSystmeThunkClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
@ -2404,14 +2387,15 @@ WinNtFileSystmeThunkClose (
|
||||
if (Private->VolumeLabel != NULL) {
|
||||
FreePool (Private->VolumeLabel);
|
||||
}
|
||||
|
||||
if (Private->FilePath != NULL) {
|
||||
FreePool (Private->FilePath);
|
||||
}
|
||||
|
||||
FreePool (Private);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_FILE_PROTOCOL gWinNtFileProtocol = {
|
||||
EFI_FILE_REVISION,
|
||||
WinNtFileOpen,
|
||||
@ -2431,7 +2415,6 @@ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL gWinNtFileSystemProtocol = {
|
||||
WinNtOpenVolume
|
||||
};
|
||||
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL mWinNtFileSystemThunkIo = {
|
||||
&gEfiSimpleFileSystemProtocolGuid,
|
||||
NULL,
|
||||
@ -2441,5 +2424,3 @@ EMU_IO_THUNK_PROTOCOL mWinNtFileSystemThunkIo = {
|
||||
WinNtFileSystmeThunkClose,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
@ -17,7 +17,6 @@ Abstract:
|
||||
#ifndef _WIN_GOP_H_
|
||||
#define _WIN_GOP_H_
|
||||
|
||||
|
||||
#include "WinHost.h"
|
||||
|
||||
#include <Protocol/EmuIoThunk.h>
|
||||
@ -55,7 +54,6 @@ typedef struct {
|
||||
|
||||
#define WIN_NT_GOP_CLASS_NAME L"WinNtGopWindow"
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINT64 Signature;
|
||||
EMU_GRAPHICS_WINDOW_PROTOCOL GraphicsWindowIo;
|
||||
@ -119,7 +117,6 @@ typedef struct {
|
||||
#define GRAPHICS_PRIVATE_DATA_FROM_THIS(a) \
|
||||
CR(a, GRAPHICS_PRIVATE_DATA, GraphicsWindowIo, GRAPHICS_PRIVATE_DATA_SIGNATURE)
|
||||
|
||||
|
||||
//
|
||||
// Gop Hardware abstraction internal worker functions
|
||||
//
|
||||
@ -180,13 +177,13 @@ WinNtWndGetPointerState (
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||
IN EFI_SIMPLE_POINTER_STATE *State
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
GopPrivateCreateQ (
|
||||
IN GRAPHICS_PRIVATE_DATA *Private,
|
||||
IN GOP_QUEUE_FIXED *Queue
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@ -200,5 +197,5 @@ GopPrivateDestroyQ (
|
||||
IN GRAPHICS_PRIVATE_DATA *Private,
|
||||
IN GOP_QUEUE_FIXED *Queue
|
||||
);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user