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
@ -104,14 +104,12 @@ UefiMain (
|
||||
// RedfishPlatformConfig.efi -s HostIpAddress HostIpMask RedfishServiceIpAddress RedfishServiceIpMask RedfishServiceIpPort
|
||||
// RedfishPlatformConfig.efi -a RedfishServiceIpAddress RedfishServiceIpMask RedfishServiceIpPort
|
||||
//
|
||||
if (Argc != 7 && Argc != 5) {
|
||||
|
||||
if ((Argc != 7) && (Argc != 5)) {
|
||||
PrintHelp ();
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (StrCmp (Argv[1], L"-s") == 0) {
|
||||
|
||||
HostIpAssignmentType = 1;
|
||||
|
||||
Status = NetLibStrToIp4 (Argv[2], &HostIpAddress);
|
||||
@ -119,21 +117,25 @@ UefiMain (
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = NetLibStrToIp4 (Argv[3], &HostIpMask);
|
||||
if (EFI_ERROR (Status)) {
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = NetLibStrToIp4 (Argv[4], &RedfishServiceIpAddress);
|
||||
if (EFI_ERROR (Status)) {
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = NetLibStrToIp4 (Argv[5], &RedfishServiceIpMask);
|
||||
if (EFI_ERROR (Status)) {
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
ReturnStatus = StrDecimalToUintnS (Argv[6], NULL, &RedfishServiceIpPort);
|
||||
if (RETURN_ERROR (ReturnStatus)) {
|
||||
PrintHelp ();
|
||||
@ -214,9 +216,7 @@ 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) {
|
||||
|
||||
HostIpAssignmentType = 3;
|
||||
|
||||
Status = NetLibStrToIp4 (Argv[2], &RedfishServiceIpAddress);
|
||||
@ -224,11 +224,13 @@ UefiMain (
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = NetLibStrToIp4 (Argv[3], &RedfishServiceIpMask);
|
||||
if (EFI_ERROR (Status)) {
|
||||
PrintHelp ();
|
||||
return Status;
|
||||
}
|
||||
|
||||
ReturnStatus = StrDecimalToUintnS (Argv[4], NULL, &RedfishServiceIpPort);
|
||||
if (RETURN_ERROR (ReturnStatus)) {
|
||||
PrintHelp ();
|
||||
@ -285,11 +287,9 @@ 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) {
|
||||
|
||||
} else if ((StrCmp (Argv[1], L"-h") == 0) || (StrCmp (Argv[1], L"-help") == 0)) {
|
||||
PrintHelp ();
|
||||
} else {
|
||||
|
||||
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:
|
||||
|
@ -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,9 +230,6 @@ LogSmbiosData (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CpuUpdateSmbios (
|
||||
IN UINTN MaxCpus
|
||||
@ -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:
|
||||
@ -212,6 +215,7 @@ CpuIoServiceWrite (
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *UserBuffer
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -320,5 +323,3 @@ CpuIoCheckAddressRange (
|
||||
|
||||
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,11 +418,13 @@ CpuMpServicesStartupAllAps (
|
||||
// Skip Disabled processors
|
||||
continue;
|
||||
}
|
||||
|
||||
gThread->MutexLock (ProcessorData->StateLock);
|
||||
if (ProcessorData->State != CPU_STATE_IDLE) {
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -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
|
||||
@ -716,6 +710,7 @@ CpuMpServicesStartupThisAP (
|
||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
|
||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||
|
||||
if ((WaitEvent != NULL) && gReadToBoot) {
|
||||
@ -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.
|
||||
@ -1044,6 +1036,7 @@ CpuCheckAllAPsStatus (
|
||||
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
|
||||
//
|
||||
@ -1095,6 +1088,7 @@ CpuCheckAllAPsStatus (
|
||||
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;
|
||||
}
|
||||
@ -1165,6 +1162,7 @@ CpuCheckThisAPStatus (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessorState = ProcessorData->State;
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
|
||||
@ -1183,7 +1181,6 @@ CpuCheckThisAPStatus (
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
This function is called by all processors (both BSP and AP) once and collects MP related data
|
||||
|
||||
@ -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,7 +1312,6 @@ InitializeMpSystemData (
|
||||
(VOID *)Index
|
||||
);
|
||||
|
||||
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_TIMER | EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -160,7 +160,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuBlockIoComponentN
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
EFI_UNICODE_STRING_TABLE mEmuBlockIoDriverNameTable[] = {
|
||||
{ "eng;en", L"Emu Block I/O Driver" },
|
||||
{ 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;
|
||||
}
|
||||
|
||||
|
@ -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++);
|
||||
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
|
||||
//
|
||||
|
@ -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
|
||||
//
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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)) {
|
||||
@ -229,11 +223,12 @@ EmuBusDriverBindingStart (
|
||||
// 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) {
|
||||
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)) {
|
||||
@ -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
|
||||
);
|
||||
|
||||
@ -437,7 +435,6 @@ EmuBusDriverBindingStop (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -487,8 +484,6 @@ EmuBusCreateDevicePath (
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
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
|
||||
|
@ -53,13 +53,11 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponentName2
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
EFI_UNICODE_STRING_TABLE mEmuGopDriverNameTable[] = {
|
||||
{ "eng", L"Emulator GOP Driver" },
|
||||
{ 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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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:
|
||||
@ -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
|
||||
|
||||
@ -856,13 +831,13 @@ EmuGopSimplePointerWaitForInput (
|
||||
//
|
||||
gBS->SignalEvent (Event);
|
||||
}
|
||||
|
||||
//
|
||||
// Leave critical section and return
|
||||
//
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
SimplePointer constructor
|
||||
|
||||
|
@ -18,7 +18,6 @@ Abstract:
|
||||
|
||||
#include "Gop.h"
|
||||
|
||||
|
||||
EFI_EVENT mGopScreenExitBootServicesEvent;
|
||||
|
||||
GOP_MODE_DATA mGopModeData[] = {
|
||||
@ -29,7 +28,6 @@ GOP_MODE_DATA mGopModeData[] = {
|
||||
{ 1280, 1024, 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Returns information for an available graphics mode that the graphics device
|
||||
and the set of active video output devices supports.
|
||||
@ -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 (
|
||||
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,6 +319,7 @@ 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;
|
||||
@ -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,6 +210,7 @@ EmuSimpleFileSystemComponentNameGetControllerName (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Get our context back
|
||||
//
|
||||
|
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
|
@ -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
|
||||
//
|
||||
@ -162,7 +161,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuSnpDriverComponen
|
||||
"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,
|
||||
@ -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".
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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,7 +609,6 @@ EmuSnpDriverBindingSupported (
|
||||
ControllerHandle
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Open the EFI Device Path protocol needed to perform the supported test
|
||||
//
|
||||
@ -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
|
||||
@ -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;
|
||||
@ -797,8 +786,10 @@ EmuSnpDriverBindingStart (
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Private->DeviceHandle,
|
||||
&gEfiSimpleNetworkProtocolGuid, &Private->Snp,
|
||||
&gEfiDevicePathProtocolGuid, Private->DevicePath,
|
||||
&gEfiSimpleNetworkProtocolGuid,
|
||||
&Private->Snp,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
Private->DevicePath,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -822,6 +813,7 @@ Done:
|
||||
if (Private != NULL) {
|
||||
FreePool (Private);
|
||||
}
|
||||
|
||||
if (ParentDevicePath != NULL) {
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
@ -892,7 +884,6 @@ EmuSnpDriverBindingStop (
|
||||
|
||||
ASSERT (NumberOfChildren == 1);
|
||||
|
||||
|
||||
//
|
||||
// Get our context back.
|
||||
//
|
||||
@ -922,8 +913,10 @@ EmuSnpDriverBindingStop (
|
||||
|
||||
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
|
||||
|
@ -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) \
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
@ -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
|
||||
//
|
||||
@ -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,7 +324,7 @@ Returns:
|
||||
//
|
||||
// The map entry found
|
||||
//
|
||||
if (Lba >= StartLba && Lba < NextLba) {
|
||||
if ((Lba >= StartLba) && (Lba < NextLba)) {
|
||||
Offset = Offset + (UINTN)MultU64x32 ((Lba - StartLba), BlockLength);
|
||||
if (LbaAddress != NULL) {
|
||||
*LbaAddress = FwhInstance->FvBase[Virtual] + Offset;
|
||||
@ -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
|
||||
//
|
||||
@ -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
|
||||
//
|
||||
@ -508,6 +518,7 @@ Returns:
|
||||
*NumBytes = (UINT32)(LbaLength - BlockOffset);
|
||||
Status = EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
//
|
||||
// Write data
|
||||
//
|
||||
@ -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.
|
||||
//
|
||||
@ -587,6 +599,7 @@ FvbSetVolumeAttributes (
|
||||
IN ESAL_FWB_GLOBAL *Global,
|
||||
IN BOOLEAN Virtual
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -622,7 +635,6 @@ Returns:
|
||||
EFI_STATUS Status;
|
||||
EFI_FVB_ATTRIBUTES_2 UnchangedAttributes;
|
||||
|
||||
|
||||
//
|
||||
// Find the right instance of the FVB private data
|
||||
//
|
||||
@ -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:
|
||||
@ -1067,9 +1091,11 @@ Returns:
|
||||
(FwVolHeader->Signature != EFI_FVH_SIGNATURE) ||
|
||||
(FwVolHeader->FvLength == ((UINTN)-1)) ||
|
||||
((FwVolHeader->HeaderLength & 0x01) != 0)
|
||||
) {
|
||||
)
|
||||
{
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// Verify the header checksum
|
||||
//
|
||||
@ -1095,6 +1121,7 @@ FvbInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -1234,6 +1261,7 @@ Returns:
|
||||
FvHob.Raw = GET_NEXT_HOB (FvHob);
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Write healthy FV header back.
|
||||
//
|
||||
@ -1265,6 +1293,7 @@ Returns:
|
||||
|
||||
NumOfBlocks = NumOfBlocks + PtrBlockMapEntry->NumBlocks;
|
||||
}
|
||||
|
||||
//
|
||||
// The total number of blocks in the FV.
|
||||
//
|
||||
@ -1329,7 +1358,6 @@ Returns:
|
||||
&FvbDevice->FwVolBlockInstance
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
} else {
|
||||
//
|
||||
// There was a FVB protocol on an End Device Path node
|
||||
|
@ -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:
|
||||
@ -39,7 +37,6 @@ EFI_STATUS
|
||||
OUT UINT64 *MemorySize
|
||||
);
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -66,7 +63,6 @@ EFI_STATUS
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *FixUp
|
||||
);
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -82,8 +78,6 @@ VOID *
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -109,7 +103,6 @@ EFI_STATUS
|
||||
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.
|
||||
|
||||
@ -158,7 +156,6 @@ EFI_STATUS
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_BLOCK_CREATE_MAPPING)(
|
||||
@ -166,7 +163,6 @@ EFI_STATUS
|
||||
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
|
||||
|
||||
|
@ -60,7 +60,6 @@ EFI_STATUS
|
||||
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK)(
|
||||
@ -76,7 +75,6 @@ EFI_STATUS
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINTN SourceX;
|
||||
UINTN SourceY;
|
||||
@ -128,7 +126,6 @@ struct _EMU_GRAPHICS_WINDOW_PROTOCOL {
|
||||
EMU_GRAPHICS_WINDOWS_GET_POINTER_STATE GetPointerState;
|
||||
};
|
||||
|
||||
|
||||
extern EFI_GUID gEmuGraphicsWindowProtocolGuid;
|
||||
|
||||
#endif
|
||||
|
@ -53,7 +53,6 @@ EFI_STATUS
|
||||
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK)(
|
||||
@ -70,7 +69,6 @@ EFI_STATUS
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINTN SourceX;
|
||||
UINTN SourceY;
|
||||
@ -122,7 +120,6 @@ struct _EMU_GRAPHICS_WINDOW_PROTOCOL {
|
||||
EMU_GRAPHICS_WINDOWS_GET_POINTER_STATE GetPointerState;
|
||||
};
|
||||
|
||||
|
||||
extern EFI_GUID gEmuGraphicsWindowProtocolGuid;
|
||||
|
||||
#endif
|
||||
|
@ -10,14 +10,11 @@
|
||||
#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)(
|
||||
|
@ -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,46 +11,38 @@
|
||||
#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)(
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_UNLOCK)(
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_TRY_LOCK)(
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
VOID *
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_INIT)(
|
||||
IN VOID
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *THREAD_THUNK_MUTEX_DISTROY)(
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
|
||||
typedef
|
||||
VOID *
|
||||
(EFIAPI *THREAD_THUNK_THREAD_ENTRY)(
|
||||
@ -72,14 +64,12 @@ VOID
|
||||
IN VOID *ValuePtr
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(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,12 +31,8 @@ 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)(
|
||||
@ -71,7 +66,6 @@ BOOLEAN
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
VOID *
|
||||
(EFIAPI *EMU_OS_MALLOC)(
|
||||
@ -90,7 +84,6 @@ BOOLEAN
|
||||
IN VOID *Ptr
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EMU_PE_COFF_GET_ENTRY_POINT)(
|
||||
@ -165,7 +158,6 @@ VOID
|
||||
IN EFI_TIME *Time
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI EMU_SET_TIMER_CALLBACK)(
|
||||
@ -179,8 +171,6 @@ VOID
|
||||
IN EMU_SET_TIMER_CALLBACK CallBack
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Enumerates the current set of protocol instances that abstract OS services from EFI.
|
||||
|
||||
@ -208,7 +198,6 @@ EFI_STATUS
|
||||
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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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.
|
||||
|
||||
|
@ -15,10 +15,8 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
@ -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,6 +209,7 @@ InternalAllocateAlignedPages (
|
||||
if (Memory != NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AlignedMemory = ((UINTN)Memory + AlignmentMask) & ~AlignmentMask;
|
||||
UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN)Memory);
|
||||
if (UnalignedPages > 0) {
|
||||
@ -218,6 +218,7 @@ InternalAllocateAlignedPages (
|
||||
//
|
||||
FreePages (Memory, UnalignedPages);
|
||||
}
|
||||
|
||||
Memory = (VOID *)(AlignedMemory + EFI_PAGES_TO_SIZE (Pages));
|
||||
UnalignedPages = RealPages - Pages - UnalignedPages;
|
||||
if (UnalignedPages > 0) {
|
||||
@ -234,8 +235,10 @@ InternalAllocateAlignedPages (
|
||||
if (Memory != NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AlignedMemory = (UINTN)Memory;
|
||||
}
|
||||
|
||||
return (VOID *)AlignedMemory;
|
||||
}
|
||||
|
||||
@ -458,6 +461,7 @@ InternalAllocateZeroPool (
|
||||
if (Memory != NULL) {
|
||||
Memory = ZeroMem (Memory, AllocationSize);
|
||||
}
|
||||
|
||||
return Memory;
|
||||
}
|
||||
|
||||
@ -560,6 +564,7 @@ InternalAllocateCopyPool (
|
||||
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.
|
||||
|
||||
|
@ -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
|
||||
//
|
||||
@ -74,10 +73,10 @@ PeCoffLoaderRelocateImageExtraAction (
|
||||
if (EMU_MAGIC_PAGE ()->Thunk == NULL) {
|
||||
EmuPeCoffGetThunkStucture ();
|
||||
}
|
||||
|
||||
EMU_MAGIC_PAGE ()->Thunk->PeCoffRelocateImageExtraAction (ImageContext);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Performs additional actions just before a PE/COFF image is unloaded. Any resources
|
||||
that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.
|
||||
@ -97,5 +96,6 @@ PeCoffLoaderUnloadImageExtraAction (
|
||||
if (EMU_MAGIC_PAGE ()->Thunk == NULL) {
|
||||
EmuPeCoffGetThunkStucture ();
|
||||
}
|
||||
|
||||
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.
|
||||
@ -87,7 +85,6 @@ 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));
|
||||
|
||||
} else {
|
||||
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(Pe32Data);
|
||||
}
|
||||
@ -215,7 +212,7 @@ PeCoffLoaderGetPdbPointer (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (DebugEntry == NULL || DirectoryEntry == NULL) {
|
||||
if ((DebugEntry == NULL) || (DirectoryEntry == NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -240,7 +237,6 @@ PeCoffLoaderGetPdbPointer (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns the size of the PE/COFF headers
|
||||
|
||||
@ -288,4 +284,3 @@ PeCoffGetSizeOfHeaders (
|
||||
|
||||
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.
|
||||
|
||||
@ -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;
|
||||
|
||||
/**
|
||||
@ -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.
|
||||
|
||||
@ -91,5 +90,3 @@ MigratePeiServicesTablePointer (
|
||||
//
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -157,6 +157,7 @@ GetPerformanceCounterProperties (
|
||||
if (StartValue != NULL) {
|
||||
*StartValue = 0ULL;
|
||||
}
|
||||
|
||||
if (EndValue != NULL) {
|
||||
*EndValue = (UINT64)-1LL;
|
||||
}
|
||||
|
@ -58,7 +58,6 @@ FvFilePath (
|
||||
EFI_GUID *FileGuid
|
||||
)
|
||||
{
|
||||
|
||||
EFI_STATUS Status;
|
||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;
|
||||
@ -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 = {
|
||||
{
|
||||
{
|
||||
@ -91,4 +89,3 @@ BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = {
|
||||
0
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -88,7 +88,6 @@ PlatformBootManagerMemoryTest (
|
||||
ASSERT (0);
|
||||
}
|
||||
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Perform memory test (ESC to skip).\n"));
|
||||
|
||||
if (!PcdGetBool (PcdConInConnectOnDemand)) {
|
||||
|
@ -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);
|
||||
@ -114,7 +116,7 @@ LibCredentialGetAuthInfo (
|
||||
{
|
||||
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;
|
||||
}
|
||||
@ -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.
|
||||
|
||||
|
@ -51,9 +51,10 @@ GetMacAddressInformation (
|
||||
RestExServiceDevicePath = NULL;
|
||||
|
||||
RestExServiceDevicePathData = (REST_EX_SERVICE_DEVICE_PATH_DATA *)PcdGetPtr (PcdRedfishRestExServiceDevicePath);
|
||||
if (RestExServiceDevicePathData == NULL ||
|
||||
RestExServiceDevicePathData->DevicePathNum == 0 ||
|
||||
!IsDevicePathValid (RestExServiceDevicePathData->DevicePath, 0)) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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.
|
||||
@ -145,6 +151,7 @@ RedfishPlatformHostInterfaceProtocolData (
|
||||
if (mRedfishOverIpProtocolData == 0) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (IndexOfProtocolData == 0) {
|
||||
//
|
||||
// Return the first Redfish protocol data to caller. We only have
|
||||
@ -157,8 +164,10 @@ RedfishPlatformHostInterfaceProtocolData (
|
||||
*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
|
||||
|
||||
@ -354,7 +371,7 @@ GetRedfishRecordFromVariable (
|
||||
UINT8 HostNameSize;
|
||||
CHAR8 RedfishHostName[20];
|
||||
|
||||
if (RedfishProtocolData == NULL || RedfishProtocolDataSize == NULL) {
|
||||
if ((RedfishProtocolData == NULL) || (RedfishProtocolDataSize == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -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:
|
||||
@ -54,6 +54,7 @@ UINT8
|
||||
CalculateHeaderChecksum (
|
||||
IN EFI_FFS_FILE_HEADER *FileHeader
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -84,6 +85,7 @@ Returns:
|
||||
for ( ; Index < sizeof (EFI_FFS_FILE_HEADER); Index++) {
|
||||
Sum = (UINT8)(Sum + ptr[Index]);
|
||||
}
|
||||
|
||||
//
|
||||
// State field (since this indicates the different state of file).
|
||||
//
|
||||
@ -102,6 +104,7 @@ SecFfsFindNextFile (
|
||||
IN EFI_PEI_FV_HANDLE FvHandle,
|
||||
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -146,6 +149,7 @@ Returns:
|
||||
} else {
|
||||
ErasePolarity = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// If FileHeader is not specified (NULL) start with the first file in the
|
||||
// firmware volume. Otherwise, start from the FileHeader.
|
||||
@ -171,7 +175,6 @@ 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));
|
||||
@ -184,7 +187,6 @@ Returns:
|
||||
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
|
||||
|
||||
if ((SearchType == FfsFileHeader->Type) || (SearchType == EFI_FV_FILETYPE_ALL)) {
|
||||
|
||||
*FileHeader = FfsFileHeader;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@ -195,6 +197,7 @@ Returns:
|
||||
} else {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case EFI_FILE_DELETED:
|
||||
@ -206,7 +209,6 @@ Returns:
|
||||
|
||||
default:
|
||||
return EFI_NOT_FOUND;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,6 +221,7 @@ SecFfsFindSectionData (
|
||||
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
|
||||
IN OUT VOID **SectionData
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -258,6 +261,7 @@ Returns:
|
||||
*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.
|
||||
@ -272,4 +276,3 @@ Returns:
|
||||
|
||||
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.
|
||||
|
||||
@ -114,9 +110,11 @@ PeiServicesLocatePpi (
|
||||
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
|
||||
|
||||
@ -257,6 +253,7 @@ SmbiosLibReadString (
|
||||
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.
|
||||
|
||||
|
@ -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
|
||||
@ -163,7 +163,9 @@ SMBIOS_TABLE_TYPE3 gSmbiosType3Template = {
|
||||
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
|
||||
@ -415,8 +415,6 @@ SMBIOS_TABLE_TYPE32 gSmbiosType32Template = {
|
||||
BootInformationStatusNoError // BootStatus
|
||||
};
|
||||
|
||||
|
||||
|
||||
SMBIOS_TEMPLATE_ENTRY gSmbiosTemplate[] = {
|
||||
{ (SMBIOS_STRUCTURE *)&gSmbiosType0Template, gSmbiosType0Strings },
|
||||
{ (SMBIOS_STRUCTURE *)&gSmbiosType1Template, gSmbiosType1Strings },
|
||||
|
@ -46,6 +46,7 @@ EmuGetTime (
|
||||
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 (
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
if ( (TimerPeriod == 0)
|
||||
|| ( (TimerPeriod > TIMER_MINIMUM_VALUE)
|
||||
&& (TimerPeriod < TIMER_MAXIMUM_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,15 +11,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "Host.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
|
||||
#include <Library/NetLib.h>
|
||||
|
||||
|
||||
#define EMU_SNP_PRIVATE_SIGNATURE SIGNATURE_32('E', 'M', 's', 'n')
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
@ -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,7 +95,6 @@ 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])),
|
||||
@ -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".
|
||||
|
||||
@ -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".
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -972,7 +955,6 @@ EmuSnpReceive (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EMU_SNP_PROTOCOL gEmuSnpProtocol = {
|
||||
GasketSnpCreateMapping,
|
||||
GasketSnpStart,
|
||||
@ -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
|
||||
//
|
||||
@ -127,6 +121,7 @@ EmuBlockIoOpenDevice (
|
||||
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,6 +130,7 @@ EmuBlockIoOpenDevice (
|
||||
Private->Media->LastBlock = Private->NumberOfBlocks - 1;
|
||||
}
|
||||
}
|
||||
|
||||
ioctl (Private->fd, DKIOCGETMAXBLOCKCOUNTWRITE, &Private->Media->OptimalTransferLengthGranularity);
|
||||
}
|
||||
#else
|
||||
@ -145,13 +141,13 @@ 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
|
||||
|
||||
} else {
|
||||
Private->Media->BlockSize = Private->BlockSize;
|
||||
Private->NumberOfBlocks = DivU64x32 (FileSize, Private->Media->BlockSize);
|
||||
@ -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,
|
||||
@ -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.
|
||||
|
||||
@ -526,7 +514,6 @@ EmuBlockIoFlushBlocks (
|
||||
#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') {
|
||||
if ((*Str == 'R') || (*Str == 'F')) {
|
||||
Private->RemovableMedia = (BOOLEAN)(*Str == 'R');
|
||||
}
|
||||
if (*Str == 'O' || *Str == 'W') {
|
||||
|
||||
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,
|
||||
|
@ -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
|
||||
@ -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,10 +179,12 @@ 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_usec = remainder * 1000;
|
||||
@ -194,10 +194,10 @@ SecSetTimer (
|
||||
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
|
||||
@ -255,7 +254,6 @@ QueryPerformanceCounter (
|
||||
UINT64 Start;
|
||||
static mach_timebase_info_data_t sTimebaseInfo;
|
||||
|
||||
|
||||
Start = mach_absolute_time ();
|
||||
|
||||
// Convert to nanoseconds.
|
||||
@ -279,8 +277,6 @@ QueryPerformanceCounter (
|
||||
#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,8 +176,6 @@ GasketSecUnixUnixFwhAddress (
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *FwhBase
|
||||
);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Reverse (UNIX to EFIAPI) gaskets
|
||||
//
|
||||
@ -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:
|
||||
@ -175,6 +167,7 @@ main (
|
||||
printf ("ERROR : Can not allocate memory for system. Exiting.\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
//
|
||||
// Allocate space for gSystemMemory Array
|
||||
//
|
||||
@ -194,22 +187,26 @@ 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 ++) {
|
||||
StackPointer++)
|
||||
{
|
||||
*StackPointer = 0x5AA55AA5;
|
||||
}
|
||||
|
||||
@ -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,6 +252,7 @@ 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);
|
||||
@ -303,10 +304,12 @@ main (
|
||||
val = val * 10 + MemorySizeStr[Index1] - '0';
|
||||
Index1++;
|
||||
}
|
||||
|
||||
gSystemMemory[Index++].Size = val * 0x100000;
|
||||
if (MemorySizeStr[Index1] == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
Index1++;
|
||||
}
|
||||
|
||||
@ -325,7 +328,6 @@ main (
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
||||
EFI_PHYSICAL_ADDRESS *
|
||||
MapMemory (
|
||||
IN INTN fd,
|
||||
@ -348,6 +350,7 @@ MapMemory (
|
||||
if (res == MAP_FAILED) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((((UINTN)res) & ~(align-1)) == (UINTN)res) {
|
||||
isAligned = 1;
|
||||
} else {
|
||||
@ -355,10 +358,10 @@ MapMemory (
|
||||
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);
|
||||
|
||||
@ -432,6 +435,7 @@ MapFd0 (
|
||||
if (fd < 0) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
FileSize = lseek (fd, 0, SEEK_END);
|
||||
|
||||
FvSize = FixedPcdGet64 (PcdEmuFlashFvRecoverySize);
|
||||
@ -510,7 +514,6 @@ MapFd0 (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -565,7 +568,6 @@ 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
|
||||
//
|
||||
@ -603,7 +605,6 @@ SecLoadFromCore (
|
||||
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 (
|
||||
@ -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:
|
||||
@ -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
|
||||
@ -1016,16 +1009,16 @@ IsPdbFile (
|
||||
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,7 +1062,6 @@ DlLoadImage (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
{
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
return FALSE;
|
||||
@ -1112,7 +1106,6 @@ DlLoadImage (
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
__attribute__ ((noinline))
|
||||
#endif
|
||||
@ -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 (
|
||||
@ -1279,5 +1267,3 @@ SecPeCoffUnloadImageExtraAction (
|
||||
|
||||
GdbScriptRemoveImage (ImageContext);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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.
|
||||
|
||||
@ -57,7 +56,6 @@ PeiSwitchStacks (
|
||||
|
||||
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,
|
||||
|
@ -33,7 +33,6 @@ AllocatePool (
|
||||
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.
|
||||
@ -136,4 +133,3 @@ FreePool (
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@ -298,11 +294,11 @@ UnixSimpleFileSystemFileInfo (
|
||||
Info->Attribute |= EFI_FILE_DIRECTORY;
|
||||
}
|
||||
|
||||
|
||||
BufferFileName = (CHAR16 *)((CHAR8 *)Buffer + Size);
|
||||
while (*RealFileName) {
|
||||
*BufferFileName++ = *RealFileName++;
|
||||
}
|
||||
|
||||
*BufferFileName = 0;
|
||||
|
||||
*BufferSize = ResultSize;
|
||||
@ -315,7 +311,7 @@ IsZero (
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
if (Buffer == NULL || Length == 0) {
|
||||
if ((Buffer == NULL) || (Length == 0)) {
|
||||
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;
|
||||
|
||||
@ -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;
|
||||
@ -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
|
||||
//
|
||||
@ -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,6 +792,7 @@ PosixFileRead (
|
||||
Status = EFI_BUFFER_TOO_SMALL;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
*BufferSize = ResultSize;
|
||||
@ -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,6 +901,7 @@ PosixFileSetPossition (
|
||||
if (PrivateFile->Dir == NULL) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
rewinddir (PrivateFile->Dir);
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
@ -920,15 +910,15 @@ PosixFileSetPossition (
|
||||
} else {
|
||||
Pos = lseek (PrivateFile->fd, Position, SEEK_SET);
|
||||
}
|
||||
|
||||
if (Pos == (off_t)-1) {
|
||||
return ErrnoToEfiStatus ();
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Get a file's current position
|
||||
|
||||
@ -960,7 +950,6 @@ PosixFileGetPossition (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get information about a file.
|
||||
|
||||
@ -1022,14 +1011,12 @@ PosixFileGetInfo (
|
||||
FileSystemInfoBuffer->FreeSpace = MultU64x32 (buf.f_bavail, buf.f_bsize);
|
||||
FileSystemInfoBuffer->BlockSize = buf.f_bsize;
|
||||
|
||||
|
||||
StrCpyS (
|
||||
(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);
|
||||
@ -1042,13 +1029,11 @@ PosixFileGetInfo (
|
||||
PrivateRoot->VolumeLabel
|
||||
);
|
||||
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
|
||||
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set information about a file
|
||||
|
||||
@ -1171,10 +1156,11 @@ PosixFileSetInfo (
|
||||
// Check for invalid set file information parameters.
|
||||
//
|
||||
NewFileInfo = (EFI_FILE_INFO *)Buffer;
|
||||
if (NewFileInfo->Size <= sizeof (EFI_FILE_INFO) ||
|
||||
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;
|
||||
}
|
||||
@ -1240,12 +1226,15 @@ PosixFileSetInfo (
|
||||
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;
|
||||
@ -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,7 +127,8 @@ 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) {
|
||||
@ -152,10 +159,10 @@ TryCreateShmImage (
|
||||
XDestroyImage (Drv->image);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
X11Size (
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||
@ -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,81 +338,118 @@ 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;
|
||||
@ -407,34 +463,55 @@ handleKeyEvent (
|
||||
// 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) {
|
||||
@ -474,7 +550,6 @@ handleKeyEvent (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
handleMouseMoved (
|
||||
IN GRAPHICS_IO_PRIVATE *Drv,
|
||||
@ -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);
|
||||
}
|
||||
|
||||
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);
|
||||
@ -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,8 +875,10 @@ 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);
|
||||
}
|
||||
|
||||
break;
|
||||
case EfiUgaBltBufferToVideo:
|
||||
Blt = (EFI_UGA_PIXEL *)((UINT8 *)BltBuffer + (Args->SourceY * Args->Delta) + Args->SourceX * sizeof (EFI_UGA_PIXEL));
|
||||
@ -780,8 +888,10 @@ X11Blt (
|
||||
XPutPixel (Private->image, DstX, DstY, X11PixelToColor (Private, *Blt));
|
||||
Blt++;
|
||||
}
|
||||
|
||||
Blt = (EFI_UGA_PIXEL *)((UINT8 *)Blt + Args->Delta);
|
||||
}
|
||||
|
||||
break;
|
||||
case EfiUgaVideoToVideo:
|
||||
Dst = Private->image_data + (Args->DestinationX << Private->pixel_shift)
|
||||
@ -808,6 +918,7 @@ X11Blt (
|
||||
Src -= Private->line_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case EfiUgaVideoFill:
|
||||
Color = X11PixelToColor (Private, *BltBuffer);
|
||||
@ -816,6 +927,7 @@ X11Blt (
|
||||
XPutPixel (Private->image, DstX, DstY, Color);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@ -827,25 +939,38 @@ 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
|
||||
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)
|
||||
);
|
||||
@ -962,7 +1088,8 @@ X11GraphicsWindowOpen (
|
||||
|
||||
// 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
|
||||
@ -996,6 +1122,7 @@ X11GraphicsWindowClose (
|
||||
Drv->image_data = NULL;
|
||||
Drv->image = NULL;
|
||||
}
|
||||
|
||||
XDestroyWindow (Drv->display, Drv->win);
|
||||
XCloseDisplay (Drv->display);
|
||||
|
||||
@ -1008,7 +1135,6 @@ X11GraphicsWindowClose (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL gX11ThunkIo = {
|
||||
&gEmuGraphicsWindowProtocolGuid,
|
||||
NULL,
|
||||
@ -1018,5 +1144,3 @@ EMU_IO_THUNK_PROTOCOL gX11ThunkIo = {
|
||||
GasketX11GraphicsWindowClose,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
@ -27,16 +27,12 @@ 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,
|
||||
@ -44,6 +40,7 @@ SetFilePointer64 (
|
||||
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,14 +218,13 @@ 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,
|
||||
@ -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') {
|
||||
if ((*Str == 'R') || (*Str == 'F')) {
|
||||
Private->Removable = (BOOLEAN)(*Str == L'R');
|
||||
}
|
||||
if (*Str == 'O' || *Str == 'W') {
|
||||
|
||||
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,15 +106,13 @@ 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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -306,13 +306,13 @@ CountLeadingDots (
|
||||
return Num;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
IsFileNameTokenValid (
|
||||
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.
|
||||
|
||||
@ -358,6 +357,7 @@ GetNextFileNameToken (
|
||||
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'\'.
|
||||
//
|
||||
@ -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.
|
||||
|
||||
@ -1012,6 +1007,7 @@ WinNtSystemTimeToEfiTime (
|
||||
IN TIME_ZONE_INFORMATION *TimeZone,
|
||||
OUT EFI_TIME *Time
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -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;
|
||||
}
|
||||
@ -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
|
||||
|
@ -22,10 +22,8 @@ Abstract:
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "WinGop.h"
|
||||
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@ -46,7 +44,6 @@ GopPrivateCreateQ (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@ -67,7 +64,6 @@ GopPrivateDestroyQ (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@ -99,7 +95,6 @@ GopPrivateAddQ (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@ -127,7 +122,7 @@ GopPrivateDeleteQ (
|
||||
CopyMem (Key, &Queue->Q[Queue->Front], sizeof (EFI_KEY_DATA));
|
||||
Queue->Front = (Queue->Front + 1) % MAX_Q;
|
||||
|
||||
if (Key->Key.ScanCode == SCAN_NULL && Key->Key.UnicodeChar == CHAR_NULL) {
|
||||
if ((Key->Key.ScanCode == SCAN_NULL) && (Key->Key.UnicodeChar == CHAR_NULL)) {
|
||||
if (!Private->IsPartialKeySupport) {
|
||||
//
|
||||
// If partial keystrok is not enabled, don't return the partial keystroke.
|
||||
@ -137,11 +132,11 @@ GopPrivateDeleteQ (
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
}
|
||||
|
||||
LeaveCriticalSection (&Queue->Cs);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@ -184,42 +179,55 @@ InitializeKeyState (
|
||||
if (Private->LeftCtrl) {
|
||||
KeyState->KeyShiftState |= EFI_LEFT_CONTROL_PRESSED;
|
||||
}
|
||||
|
||||
if (Private->RightCtrl) {
|
||||
KeyState->KeyShiftState |= EFI_RIGHT_CONTROL_PRESSED;
|
||||
}
|
||||
|
||||
if (Private->LeftAlt) {
|
||||
KeyState->KeyShiftState |= EFI_LEFT_ALT_PRESSED;
|
||||
}
|
||||
|
||||
if (Private->RightAlt) {
|
||||
KeyState->KeyShiftState |= EFI_RIGHT_ALT_PRESSED;
|
||||
}
|
||||
|
||||
if (Private->LeftShift) {
|
||||
KeyState->KeyShiftState |= EFI_LEFT_SHIFT_PRESSED;
|
||||
}
|
||||
|
||||
if (Private->RightShift) {
|
||||
KeyState->KeyShiftState |= EFI_RIGHT_SHIFT_PRESSED;
|
||||
}
|
||||
|
||||
if (Private->LeftLogo) {
|
||||
KeyState->KeyShiftState |= EFI_LEFT_LOGO_PRESSED;
|
||||
}
|
||||
|
||||
if (Private->RightLogo) {
|
||||
KeyState->KeyShiftState |= EFI_RIGHT_LOGO_PRESSED;
|
||||
}
|
||||
|
||||
if (Private->Menu) {
|
||||
KeyState->KeyShiftState |= EFI_MENU_KEY_PRESSED;
|
||||
}
|
||||
|
||||
if (Private->SysReq) {
|
||||
KeyState->KeyShiftState |= EFI_SYS_REQ_PRESSED;
|
||||
}
|
||||
|
||||
if (Private->CapsLock) {
|
||||
KeyState->KeyToggleState |= EFI_CAPS_LOCK_ACTIVE;
|
||||
}
|
||||
|
||||
if (Private->NumLock) {
|
||||
KeyState->KeyToggleState |= EFI_NUM_LOCK_ACTIVE;
|
||||
}
|
||||
|
||||
if (Private->ScrollLock) {
|
||||
KeyState->KeyToggleState |= EFI_SCROLL_LOCK_ACTIVE;
|
||||
}
|
||||
|
||||
if (Private->IsPartialKeySupport) {
|
||||
KeyState->KeyToggleState |= EFI_KEY_STATE_EXPOSED;
|
||||
}
|
||||
@ -251,7 +259,8 @@ GopPrivateAddKey (
|
||||
//
|
||||
if ((Private->LeftCtrl || Private->RightCtrl) &&
|
||||
(KeyData.Key.UnicodeChar >= 1) && (KeyData.Key.UnicodeChar <= 26)
|
||||
) {
|
||||
)
|
||||
{
|
||||
if ((Private->LeftShift || Private->RightShift) == Private->CapsLock) {
|
||||
KeyData.Key.UnicodeChar = (CHAR16)(KeyData.Key.UnicodeChar + L'a' - 1);
|
||||
} else {
|
||||
@ -264,7 +273,8 @@ GopPrivateAddKey (
|
||||
//
|
||||
if (((KeyData.Key.UnicodeChar >= L'a') && (KeyData.Key.UnicodeChar <= L'z')) ||
|
||||
((KeyData.Key.UnicodeChar >= L'A') && (KeyData.Key.UnicodeChar <= L'Z'))
|
||||
) {
|
||||
)
|
||||
{
|
||||
KeyData.KeyState.KeyShiftState &= ~(EFI_LEFT_SHIFT_PRESSED | EFI_RIGHT_SHIFT_PRESSED);
|
||||
}
|
||||
|
||||
@ -276,7 +286,6 @@ GopPrivateAddKey (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtWndCheckKey (
|
||||
@ -288,14 +297,15 @@ WinNtWndCheckKey (
|
||||
Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
|
||||
|
||||
return GopPrivateCheckQ (&Private->QueueForRead);
|
||||
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtWndGetKey (
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||
IN EFI_KEY_DATA *KeyData
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -336,7 +346,7 @@ WinNtWndGetKey (
|
||||
// EFI_NOT_READY.
|
||||
//
|
||||
if (!Private->IsPartialKeySupport) {
|
||||
if (KeyData->Key.ScanCode == SCAN_NULL && KeyData->Key.UnicodeChar == CHAR_NULL) {
|
||||
if ((KeyData->Key.ScanCode == SCAN_NULL) && (KeyData->Key.UnicodeChar == CHAR_NULL)) {
|
||||
Status = EFI_NOT_READY;
|
||||
}
|
||||
}
|
||||
@ -344,7 +354,6 @@ WinNtWndGetKey (
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
@ -365,20 +374,23 @@ WinNtWndKeySetState (
|
||||
if ((*KeyToggleState & EFI_SCROLL_LOCK_ACTIVE) == EFI_SCROLL_LOCK_ACTIVE) {
|
||||
Private->ScrollLock = TRUE;
|
||||
}
|
||||
|
||||
if ((*KeyToggleState & EFI_NUM_LOCK_ACTIVE) == EFI_NUM_LOCK_ACTIVE) {
|
||||
Private->NumLock = TRUE;
|
||||
}
|
||||
|
||||
if ((*KeyToggleState & EFI_CAPS_LOCK_ACTIVE) == EFI_CAPS_LOCK_ACTIVE) {
|
||||
Private->CapsLock = TRUE;
|
||||
}
|
||||
|
||||
if ((*KeyToggleState & EFI_KEY_STATE_EXPOSED) == EFI_KEY_STATE_EXPOSED) {
|
||||
Private->IsPartialKeySupport = TRUE;
|
||||
}
|
||||
|
||||
Private->KeyState.KeyToggleState = *KeyToggleState;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtWndRegisterKeyNotify (
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user