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 -s HostIpAddress HostIpMask RedfishServiceIpAddress RedfishServiceIpMask RedfishServiceIpPort
|
||||||
// RedfishPlatformConfig.efi -a RedfishServiceIpAddress RedfishServiceIpMask RedfishServiceIpPort
|
// RedfishPlatformConfig.efi -a RedfishServiceIpAddress RedfishServiceIpMask RedfishServiceIpPort
|
||||||
//
|
//
|
||||||
if (Argc != 7 && Argc != 5) {
|
if ((Argc != 7) && (Argc != 5)) {
|
||||||
|
|
||||||
PrintHelp ();
|
PrintHelp ();
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrCmp (Argv[1], L"-s") == 0) {
|
if (StrCmp (Argv[1], L"-s") == 0) {
|
||||||
|
|
||||||
HostIpAssignmentType = 1;
|
HostIpAssignmentType = 1;
|
||||||
|
|
||||||
Status = NetLibStrToIp4 (Argv[2], &HostIpAddress);
|
Status = NetLibStrToIp4 (Argv[2], &HostIpAddress);
|
||||||
@ -119,21 +117,25 @@ UefiMain (
|
|||||||
PrintHelp ();
|
PrintHelp ();
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = NetLibStrToIp4 (Argv[3], &HostIpMask);
|
Status = NetLibStrToIp4 (Argv[3], &HostIpMask);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
PrintHelp ();
|
PrintHelp ();
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = NetLibStrToIp4 (Argv[4], &RedfishServiceIpAddress);
|
Status = NetLibStrToIp4 (Argv[4], &RedfishServiceIpAddress);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
PrintHelp ();
|
PrintHelp ();
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = NetLibStrToIp4 (Argv[5], &RedfishServiceIpMask);
|
Status = NetLibStrToIp4 (Argv[5], &RedfishServiceIpMask);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
PrintHelp ();
|
PrintHelp ();
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnStatus = StrDecimalToUintnS (Argv[6], NULL, &RedfishServiceIpPort);
|
ReturnStatus = StrDecimalToUintnS (Argv[6], NULL, &RedfishServiceIpPort);
|
||||||
if (RETURN_ERROR (ReturnStatus)) {
|
if (RETURN_ERROR (ReturnStatus)) {
|
||||||
PrintHelp ();
|
PrintHelp ();
|
||||||
@ -214,9 +216,7 @@ UefiMain (
|
|||||||
Print (L"RedfishServiceIpMask: %s has been set Successfully!\n", Argv[5]);
|
Print (L"RedfishServiceIpMask: %s has been set Successfully!\n", Argv[5]);
|
||||||
Print (L"RedfishServiceIpPort: %s has been set Successfully!\n", Argv[6]);
|
Print (L"RedfishServiceIpPort: %s has been set Successfully!\n", Argv[6]);
|
||||||
Print (L"Please Restart!\n");
|
Print (L"Please Restart!\n");
|
||||||
|
|
||||||
} else if (StrCmp (Argv[1], L"-a") == 0) {
|
} else if (StrCmp (Argv[1], L"-a") == 0) {
|
||||||
|
|
||||||
HostIpAssignmentType = 3;
|
HostIpAssignmentType = 3;
|
||||||
|
|
||||||
Status = NetLibStrToIp4 (Argv[2], &RedfishServiceIpAddress);
|
Status = NetLibStrToIp4 (Argv[2], &RedfishServiceIpAddress);
|
||||||
@ -224,11 +224,13 @@ UefiMain (
|
|||||||
PrintHelp ();
|
PrintHelp ();
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = NetLibStrToIp4 (Argv[3], &RedfishServiceIpMask);
|
Status = NetLibStrToIp4 (Argv[3], &RedfishServiceIpMask);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
PrintHelp ();
|
PrintHelp ();
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnStatus = StrDecimalToUintnS (Argv[4], NULL, &RedfishServiceIpPort);
|
ReturnStatus = StrDecimalToUintnS (Argv[4], NULL, &RedfishServiceIpPort);
|
||||||
if (RETURN_ERROR (ReturnStatus)) {
|
if (RETURN_ERROR (ReturnStatus)) {
|
||||||
PrintHelp ();
|
PrintHelp ();
|
||||||
@ -285,11 +287,9 @@ UefiMain (
|
|||||||
Print (L"RedfishServiceIpMask: %s has been set Successfully!\n", Argv[3]);
|
Print (L"RedfishServiceIpMask: %s has been set Successfully!\n", Argv[3]);
|
||||||
Print (L"RedfishServiceIpPort: %s has been set Successfully!\n", Argv[4]);
|
Print (L"RedfishServiceIpPort: %s has been set Successfully!\n", Argv[4]);
|
||||||
Print (L"Please Restart!\n");
|
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 ();
|
PrintHelp ();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
PrintHelp ();
|
PrintHelp ();
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ PeimInitializeAutoScanPei (
|
|||||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -46,7 +47,6 @@ Returns:
|
|||||||
UINTN Index;
|
UINTN Index;
|
||||||
EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;
|
EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;
|
||||||
|
|
||||||
|
|
||||||
DEBUG ((DEBUG_ERROR, "Emu Autoscan PEIM Loaded\n"));
|
DEBUG ((DEBUG_ERROR, "Emu Autoscan PEIM Loaded\n"));
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -91,6 +91,7 @@ Returns:
|
|||||||
MemorySize
|
MemorySize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Index++;
|
Index++;
|
||||||
} while (!EFI_ERROR (Status));
|
} while (!EFI_ERROR (Status));
|
||||||
|
|
||||||
|
@ -6,8 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The package level header files this module uses
|
// 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/PcdLib.h>
|
||||||
#include <Library/PeiServicesLib.h>
|
#include <Library/PeiServicesLib.h>
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The protocols, PPI and GUID defintions for this module
|
// 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/DebugLib.h>
|
||||||
#include <Library/PeimEntryPoint.h>
|
#include <Library/PeimEntryPoint.h>
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Module globals
|
// Module globals
|
||||||
//
|
//
|
||||||
@ -50,6 +46,7 @@ InitializeBootMode (
|
|||||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
@ -129,7 +129,6 @@ CHAR8 *mCpuSmbiosType4Strings[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create SMBIOS record.
|
Create SMBIOS record.
|
||||||
|
|
||||||
@ -190,10 +189,12 @@ LogSmbiosData (
|
|||||||
StringSize = AsciiStrSize (StringPack[Index]);
|
StringSize = AsciiStrSize (StringPack[Index]);
|
||||||
Size += StringSize;
|
Size += StringSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringPack[0] == NULL) {
|
if (StringPack[0] == NULL) {
|
||||||
// At least a double null is required
|
// At least a double null is required
|
||||||
Size += 1;
|
Size += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't forget the terminating double null
|
// Don't forget the terminating double null
|
||||||
Size += 1;
|
Size += 1;
|
||||||
}
|
}
|
||||||
@ -203,6 +204,7 @@ LogSmbiosData (
|
|||||||
if (Record == NULL) {
|
if (Record == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Record, Template, Template->Length);
|
CopyMem (Record, Template, Template->Length);
|
||||||
|
|
||||||
// Append string pack
|
// Append string pack
|
||||||
@ -212,6 +214,7 @@ LogSmbiosData (
|
|||||||
CopyMem (Str, StringPack[Index], StringSize);
|
CopyMem (Str, StringPack[Index], StringSize);
|
||||||
Str += StringSize;
|
Str += StringSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
*Str = 0;
|
*Str = 0;
|
||||||
|
|
||||||
SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
|
SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
|
||||||
@ -227,9 +230,6 @@ LogSmbiosData (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CpuUpdateSmbios (
|
CpuUpdateSmbios (
|
||||||
IN UINTN MaxCpus
|
IN UINTN MaxCpus
|
||||||
@ -245,7 +245,6 @@ CpuUpdateSmbios (
|
|||||||
LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mCpuSmbiosType4, mCpuSmbiosType4Strings);
|
LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mCpuSmbiosType4, mCpuSmbiosType4Strings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Service routines for the driver
|
// Service routines for the driver
|
||||||
//
|
//
|
||||||
@ -265,6 +264,7 @@ EmuFlushCpuDataCache (
|
|||||||
//
|
//
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Other flush types are not supported by Emu emulator
|
// Other flush types are not supported by Emu emulator
|
||||||
//
|
//
|
||||||
@ -338,9 +338,10 @@ EmuRegisterInterruptHandler (
|
|||||||
//
|
//
|
||||||
// Do parameter checking for EFI spec conformance
|
// Do parameter checking for EFI spec conformance
|
||||||
//
|
//
|
||||||
if (InterruptType < 0 || InterruptType > 0xff) {
|
if ((InterruptType < 0) || (InterruptType > 0xff)) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Do nothing for Emu emulation
|
// Do nothing for Emu emulation
|
||||||
//
|
//
|
||||||
@ -373,7 +374,6 @@ EmuGetTimerValue (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EmuSetMemoryAttributes (
|
EmuSetMemoryAttributes (
|
||||||
@ -396,9 +396,6 @@ EmuSetMemoryAttributes (
|
|||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Callback function for idle events.
|
Callback function for idle events.
|
||||||
|
|
||||||
@ -417,7 +414,6 @@ IdleLoopEventCallback (
|
|||||||
gEmuThunk->CpuSleep ();
|
gEmuThunk->CpuSleep ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InitializeCpu (
|
InitializeCpu (
|
||||||
@ -444,7 +440,6 @@ InitializeCpu (
|
|||||||
|
|
||||||
CpuUpdateSmbios (MaxCpu);
|
CpuUpdateSmbios (MaxCpu);
|
||||||
|
|
||||||
|
|
||||||
Status = gBS->CreateEventEx (
|
Status = gBS->CreateEventEx (
|
||||||
EVT_NOTIFY_SIGNAL,
|
EVT_NOTIFY_SIGNAL,
|
||||||
TPL_NOTIFY,
|
TPL_NOTIFY,
|
||||||
@ -455,11 +450,12 @@ InitializeCpu (
|
|||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&mCpuTemplate.Handle,
|
&mCpuTemplate.Handle,
|
||||||
&gEfiCpuArchProtocolGuid, &mCpuTemplate.Cpu,
|
&gEfiCpuArchProtocolGuid,
|
||||||
&gEfiCpuIo2ProtocolGuid, &mCpuTemplate.CpuIo,
|
&mCpuTemplate.Cpu,
|
||||||
|
&gEfiCpuIo2ProtocolGuid,
|
||||||
|
&mCpuTemplate.CpuIo,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#ifndef _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
|
#ifndef _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
|
||||||
#define _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
|
#define _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
|
||||||
|
|
||||||
|
|
||||||
#include <PiDxe.h>
|
#include <PiDxe.h>
|
||||||
#include <IndustryStandard/SmBios.h>
|
#include <IndustryStandard/SmBios.h>
|
||||||
|
|
||||||
@ -32,8 +31,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Data Structures
|
// Internal Data Structures
|
||||||
//
|
//
|
||||||
@ -50,7 +47,6 @@ typedef struct {
|
|||||||
// Local Data for CPU interface goes here
|
// Local Data for CPU interface goes here
|
||||||
//
|
//
|
||||||
BOOLEAN InterruptState;
|
BOOLEAN InterruptState;
|
||||||
|
|
||||||
} CPU_ARCH_PROTOCOL_PRIVATE;
|
} CPU_ARCH_PROTOCOL_PRIVATE;
|
||||||
|
|
||||||
#define CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS(a) \
|
#define CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS(a) \
|
||||||
@ -60,8 +56,6 @@ typedef struct {
|
|||||||
CPU_ARCH_PROT_PRIVATE_SIGNATURE \
|
CPU_ARCH_PROT_PRIVATE_SIGNATURE \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CPU_STATE_IDLE,
|
CPU_STATE_IDLE,
|
||||||
CPU_STATE_BLOCKED,
|
CPU_STATE_BLOCKED,
|
||||||
@ -70,7 +64,6 @@ typedef enum {
|
|||||||
CPU_STATE_FINISHED
|
CPU_STATE_FINISHED
|
||||||
} PROCESSOR_STATE;
|
} PROCESSOR_STATE;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Define Individual Processor Data block.
|
// Define Individual Processor Data block.
|
||||||
//
|
//
|
||||||
@ -84,7 +77,6 @@ typedef struct {
|
|||||||
EFI_EVENT CheckThisAPEvent;
|
EFI_EVENT CheckThisAPEvent;
|
||||||
} PROCESSOR_DATA_BLOCK;
|
} PROCESSOR_DATA_BLOCK;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Define MP data block which consumes individual processor block.
|
// Define MP data block which consumes individual processor block.
|
||||||
//
|
//
|
||||||
@ -106,10 +98,6 @@ typedef struct {
|
|||||||
BOOLEAN TimeoutActive;
|
BOOLEAN TimeoutActive;
|
||||||
} MP_SYSTEM_DATA;
|
} MP_SYSTEM_DATA;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
CpuMemoryServiceRead (
|
CpuMemoryServiceRead (
|
||||||
@ -232,5 +220,4 @@ CpuMpServicesWhoAmI (
|
|||||||
|
|
||||||
extern EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate;
|
extern EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate;
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,6 +47,7 @@ CpuMemoryServiceRead (
|
|||||||
IN UINTN Count,
|
IN UINTN Count,
|
||||||
IN OUT VOID *Buffer
|
IN OUT VOID *Buffer
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -101,6 +102,7 @@ CpuMemoryServiceWrite (
|
|||||||
IN UINTN Count,
|
IN UINTN Count,
|
||||||
IN OUT VOID *Buffer
|
IN OUT VOID *Buffer
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -154,6 +156,7 @@ CpuIoServiceRead (
|
|||||||
IN UINTN Count,
|
IN UINTN Count,
|
||||||
IN OUT VOID *UserBuffer
|
IN OUT VOID *UserBuffer
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -212,6 +215,7 @@ CpuIoServiceWrite (
|
|||||||
IN UINTN Count,
|
IN UINTN Count,
|
||||||
IN OUT VOID *UserBuffer
|
IN OUT VOID *UserBuffer
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -265,7 +269,6 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -304,7 +307,7 @@ CpuIoCheckAddressRange (
|
|||||||
//
|
//
|
||||||
// For FiFo type, the target address won't increase during the access, so treat count as 1
|
// 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;
|
Count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,5 +323,3 @@ CpuIoCheckAddressRange (
|
|||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,14 +37,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "CpuDriver.h"
|
#include "CpuDriver.h"
|
||||||
|
|
||||||
|
|
||||||
MP_SYSTEM_DATA gMPSystem;
|
MP_SYSTEM_DATA gMPSystem;
|
||||||
EMU_THREAD_THUNK_PROTOCOL *gThread = NULL;
|
EMU_THREAD_THUNK_PROTOCOL *gThread = NULL;
|
||||||
EFI_EVENT gReadToBootEvent;
|
EFI_EVENT gReadToBootEvent;
|
||||||
BOOLEAN gReadToBoot = FALSE;
|
BOOLEAN gReadToBoot = FALSE;
|
||||||
UINTN gPollInterval;
|
UINTN gPollInterval;
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsBSP (
|
IsBSP (
|
||||||
VOID
|
VOID
|
||||||
@ -61,7 +59,6 @@ IsBSP (
|
|||||||
return (gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) != 0;
|
return (gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
SetApProcedure (
|
SetApProcedure (
|
||||||
IN PROCESSOR_DATA_BLOCK *Processor,
|
IN PROCESSOR_DATA_BLOCK *Processor,
|
||||||
@ -75,7 +72,6 @@ SetApProcedure (
|
|||||||
gThread->MutexUnlock (Processor->ProcedureLock);
|
gThread->MutexUnlock (Processor->ProcedureLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetNextBlockedNumber (
|
GetNextBlockedNumber (
|
||||||
OUT UINTN *NextNumber
|
OUT UINTN *NextNumber
|
||||||
@ -121,11 +117,12 @@ CalculateAndStallInterval (
|
|||||||
{
|
{
|
||||||
UINTN StallTime;
|
UINTN StallTime;
|
||||||
|
|
||||||
if (Timeout < gPollInterval && Timeout != 0) {
|
if ((Timeout < gPollInterval) && (Timeout != 0)) {
|
||||||
StallTime = Timeout;
|
StallTime = Timeout;
|
||||||
} else {
|
} else {
|
||||||
StallTime = gPollInterval;
|
StallTime = gPollInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->Stall (StallTime);
|
gBS->Stall (StallTime);
|
||||||
|
|
||||||
return StallTime;
|
return StallTime;
|
||||||
@ -188,8 +185,6 @@ CpuMpServicesGetNumberOfProcessors (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets detailed MP-related information on the requested processor at the
|
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.
|
instant this call is made. This service may only be called from the BSP.
|
||||||
@ -240,7 +235,6 @@ CpuMpServicesGetProcessorInfo (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This service executes a caller provided function on all enabled APs. APs can
|
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
|
run either simultaneously or one at a time in sequence. This service supports
|
||||||
@ -397,7 +391,6 @@ CpuMpServicesStartupAllAps (
|
|||||||
PROCESSOR_STATE ProcessorState;
|
PROCESSOR_STATE ProcessorState;
|
||||||
UINTN Timeout;
|
UINTN Timeout;
|
||||||
|
|
||||||
|
|
||||||
if (!IsBSP ()) {
|
if (!IsBSP ()) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
@ -425,11 +418,13 @@ CpuMpServicesStartupAllAps (
|
|||||||
// Skip Disabled processors
|
// Skip Disabled processors
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
gThread->MutexLock (ProcessorData->StateLock);
|
gThread->MutexLock (ProcessorData->StateLock);
|
||||||
if (ProcessorData->State != CPU_STATE_IDLE) {
|
if (ProcessorData->State != CPU_STATE_IDLE) {
|
||||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||||
return EFI_NOT_READY;
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,6 +433,7 @@ CpuMpServicesStartupAllAps (
|
|||||||
if (gMPSystem.FailedList == NULL) {
|
if (gMPSystem.FailedList == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetMemN (gMPSystem.FailedList, (gMPSystem.NumberOfProcessors + 1) * sizeof (UINTN), END_OF_CPU_LIST);
|
SetMemN (gMPSystem.FailedList, (gMPSystem.NumberOfProcessors + 1) * sizeof (UINTN), END_OF_CPU_LIST);
|
||||||
gMPSystem.FailedListIndex = 0;
|
gMPSystem.FailedListIndex = 0;
|
||||||
*FailedCpuList = gMPSystem.FailedList;
|
*FailedCpuList = gMPSystem.FailedList;
|
||||||
@ -519,7 +515,6 @@ CpuMpServicesStartupAllAps (
|
|||||||
gPollInterval
|
gPollInterval
|
||||||
);
|
);
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
@ -590,7 +585,6 @@ Done:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This service lets the caller get one enabled AP to execute a caller-provided
|
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
|
function. The caller can request the BSP to either wait for the completion
|
||||||
@ -716,6 +710,7 @@ CpuMpServicesStartupThisAP (
|
|||||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
return EFI_NOT_READY;
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
|
|
||||||
if ((WaitEvent != NULL) && gReadToBoot) {
|
if ((WaitEvent != NULL) && gReadToBoot) {
|
||||||
@ -759,10 +754,8 @@ CpuMpServicesStartupThisAP (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This service switches the requested AP to be the BSP from that point onward.
|
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
|
This service changes the BSP for all purposes. This call can only be performed
|
||||||
@ -829,6 +822,7 @@ CpuMpServicesSwitchBSP (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (Index != gMPSystem.NumberOfProcessors);
|
ASSERT (Index != gMPSystem.NumberOfProcessors);
|
||||||
|
|
||||||
gThread->MutexLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
gThread->MutexLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
@ -836,6 +830,7 @@ CpuMpServicesSwitchBSP (
|
|||||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
return EFI_NOT_READY;
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
|
|
||||||
// Skip for now as we need switch a bunch of stack stuff around and it's complex
|
// 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;
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This service lets the caller enable or disable an AP from this point onward.
|
This service lets the caller enable or disable an AP from this point onward.
|
||||||
This service may only be called from the BSP.
|
This service may only be called from the BSP.
|
||||||
@ -911,17 +905,20 @@ CpuMpServicesEnableDisableAP (
|
|||||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
|
|
||||||
if (EnableAP) {
|
if (EnableAP) {
|
||||||
if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0 ) {
|
if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0 ) {
|
||||||
gMPSystem.NumberOfEnabledProcessors++;
|
gMPSystem.NumberOfEnabledProcessors++;
|
||||||
}
|
}
|
||||||
|
|
||||||
gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag |= PROCESSOR_ENABLED_BIT;
|
gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag |= PROCESSOR_ENABLED_BIT;
|
||||||
} else {
|
} else {
|
||||||
if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == PROCESSOR_ENABLED_BIT ) {
|
if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == PROCESSOR_ENABLED_BIT ) {
|
||||||
gMPSystem.NumberOfEnabledProcessors--;
|
gMPSystem.NumberOfEnabledProcessors--;
|
||||||
}
|
}
|
||||||
|
|
||||||
gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag &= ~PROCESSOR_ENABLED_BIT;
|
gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag &= ~PROCESSOR_ENABLED_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -933,7 +930,6 @@ CpuMpServicesEnableDisableAP (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This return the handle number for the calling processor. This service may be
|
This return the handle number for the calling processor. This service may be
|
||||||
called from the BSP and APs.
|
called from the BSP and APs.
|
||||||
@ -983,8 +979,6 @@ CpuMpServicesWhoAmI (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate = {
|
EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate = {
|
||||||
CpuMpServicesGetNumberOfProcessors,
|
CpuMpServicesGetNumberOfProcessors,
|
||||||
CpuMpServicesGetProcessorInfo,
|
CpuMpServicesGetProcessorInfo,
|
||||||
@ -995,8 +989,6 @@ EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate = {
|
|||||||
CpuMpServicesWhoAmI
|
CpuMpServicesWhoAmI
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
If timeout occurs in StartupAllAps(), a timer is set, which invokes this
|
If timeout occurs in StartupAllAps(), a timer is set, which invokes this
|
||||||
procedure periodically to check whether all APs have finished.
|
procedure periodically to check whether all APs have finished.
|
||||||
@ -1044,6 +1036,7 @@ CpuCheckAllAPsStatus (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessorState = ProcessorData->State;
|
ProcessorState = ProcessorData->State;
|
||||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||||
|
|
||||||
@ -1073,7 +1066,7 @@ CpuCheckAllAPsStatus (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMPSystem.TimeoutActive && gMPSystem.Timeout == 0) {
|
if (gMPSystem.TimeoutActive && (gMPSystem.Timeout == 0)) {
|
||||||
//
|
//
|
||||||
// Timeout
|
// Timeout
|
||||||
//
|
//
|
||||||
@ -1095,6 +1088,7 @@ CpuCheckAllAPsStatus (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessorState = ProcessorData->State;
|
ProcessorState = ProcessorData->State;
|
||||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||||
|
|
||||||
@ -1104,17 +1098,20 @@ CpuCheckAllAPsStatus (
|
|||||||
if (gMPSystem.FailedList[Cpu] == END_OF_CPU_LIST) {
|
if (gMPSystem.FailedList[Cpu] == END_OF_CPU_LIST) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMPSystem.FailedList[ProcessorNumber] == Cpu) {
|
if (gMPSystem.FailedList[ProcessorNumber] == Cpu) {
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Found) {
|
if (!Found) {
|
||||||
gMPSystem.FailedList[gMPSystem.FailedListIndex++] = Cpu;
|
gMPSystem.FailedList[gMPSystem.FailedListIndex++] = Cpu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force terminal exit
|
// Force terminal exit
|
||||||
gMPSystem.FinishCount = gMPSystem.StartCount;
|
gMPSystem.FinishCount = gMPSystem.StartCount;
|
||||||
}
|
}
|
||||||
@ -1165,6 +1162,7 @@ CpuCheckThisAPStatus (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessorState = ProcessorData->State;
|
ProcessorState = ProcessorData->State;
|
||||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||||
|
|
||||||
@ -1183,7 +1181,6 @@ CpuCheckThisAPStatus (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
This function is called by all processors (both BSP and AP) once and collects MP related data
|
This function is called by all processors (both BSP and AP) once and collects MP related data
|
||||||
|
|
||||||
@ -1267,7 +1264,6 @@ CpuDriverApIdolLoop (
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
InitializeMpSystemData (
|
InitializeMpSystemData (
|
||||||
IN UINTN NumberOfProcessors
|
IN UINTN NumberOfProcessors
|
||||||
@ -1276,7 +1272,6 @@ InitializeMpSystemData (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Clear the data structure area first.
|
// Clear the data structure area first.
|
||||||
//
|
//
|
||||||
@ -1302,7 +1297,6 @@ InitializeMpSystemData (
|
|||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
|
||||||
for (Index = 0; Index < gMPSystem.NumberOfProcessors; Index++) {
|
for (Index = 0; Index < gMPSystem.NumberOfProcessors; Index++) {
|
||||||
if ((gMPSystem.ProcessorData[Index].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
|
if ((gMPSystem.ProcessorData[Index].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
|
||||||
// Skip BSP
|
// Skip BSP
|
||||||
@ -1318,7 +1312,6 @@ InitializeMpSystemData (
|
|||||||
(VOID *)Index
|
(VOID *)Index
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
Status = gBS->CreateEvent (
|
Status = gBS->CreateEvent (
|
||||||
EVT_TIMER | EVT_NOTIFY_SIGNAL,
|
EVT_TIMER | EVT_NOTIFY_SIGNAL,
|
||||||
TPL_CALLBACK,
|
TPL_CALLBACK,
|
||||||
@ -1331,8 +1324,6 @@ InitializeMpSystemData (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Invoke a notification event
|
Invoke a notification event
|
||||||
|
|
||||||
@ -1351,8 +1342,6 @@ CpuReadToBootFunction (
|
|||||||
gReadToBoot = TRUE;
|
gReadToBoot = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
CpuMpServicesInit (
|
CpuMpServicesInit (
|
||||||
OUT UINTN *MaxCpus
|
OUT UINTN *MaxCpus
|
||||||
@ -1395,10 +1384,9 @@ CpuMpServicesInit (
|
|||||||
Handle = NULL;
|
Handle = NULL;
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&Handle,
|
&Handle,
|
||||||
&gEfiMpServiceProtocolGuid, &mMpServicesTemplate,
|
&gEfiMpServiceProtocolGuid,
|
||||||
|
&mMpServicesTemplate,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ Abstract:
|
|||||||
//
|
//
|
||||||
// EFI Component Name Functions
|
// EFI Component Name Functions
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the driver.
|
Retrieves a Unicode string that is the user readable name of the driver.
|
||||||
|
|
||||||
@ -63,7 +64,6 @@ EmuBlockIoComponentNameGetDriverName (
|
|||||||
OUT CHAR16 **DriverName
|
OUT CHAR16 **DriverName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the controller
|
Retrieves a Unicode string that is the user readable name of the controller
|
||||||
that is being managed by a driver.
|
that is being managed by a driver.
|
||||||
@ -160,7 +160,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuBlockIoComponentN
|
|||||||
"en"
|
"en"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
EFI_UNICODE_STRING_TABLE mEmuBlockIoDriverNameTable[] = {
|
EFI_UNICODE_STRING_TABLE mEmuBlockIoDriverNameTable[] = {
|
||||||
{ "eng;en", L"Emu Block I/O Driver" },
|
{ "eng;en", L"Emu Block I/O Driver" },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
@ -310,6 +309,7 @@ EmuBlockIoComponentNameGetControllerName (
|
|||||||
if (ChildHandle != NULL) {
|
if (ChildHandle != NULL) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure this driver is currently managing ControllerHandle
|
// Make sure this driver is currently managing ControllerHandle
|
||||||
//
|
//
|
||||||
@ -321,6 +321,7 @@ EmuBlockIoComponentNameGetControllerName (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get our context back
|
// Get our context back
|
||||||
//
|
//
|
||||||
|
@ -129,7 +129,7 @@ EmuBlockIoDriverConfigurationSetOptions (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ActionRequired == NULL || ControllerHandle == NULL) {
|
if ((ActionRequired == NULL) || (ControllerHandle == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ EmuBlockIoDriverConfigurationForceDefaults (
|
|||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ActionRequired == NULL || ControllerHandle == NULL) {
|
if ((ActionRequired == NULL) || (ControllerHandle == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ EmuBlockIoDriverDiagnosticsRunDiagnostics (
|
|||||||
OUT UINTN *BufferSize,
|
OUT UINTN *BufferSize,
|
||||||
OUT CHAR16 **Buffer
|
OUT CHAR16 **Buffer
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -124,12 +125,12 @@ EmuBlockIoDriverDiagnosticsRunDiagnostics (
|
|||||||
BOOLEAN Found;
|
BOOLEAN Found;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
if (Language == NULL ||
|
if ((Language == NULL) ||
|
||||||
ErrorType == NULL ||
|
(ErrorType == NULL) ||
|
||||||
Buffer == NULL ||
|
(Buffer == NULL) ||
|
||||||
ControllerHandle == NULL ||
|
(ControllerHandle == NULL) ||
|
||||||
BufferSize == NULL) {
|
(BufferSize == NULL))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,17 +146,23 @@ EmuBlockIoDriverDiagnosticsRunDiagnostics (
|
|||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SupportedLanguages += 3;
|
SupportedLanguages += 3;
|
||||||
} else {
|
} 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)) {
|
if ((AsciiStrnCmp (SupportedLanguages, Language, Index) == 0) && (Language[Index] == 0)) {
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SupportedLanguages += Index;
|
SupportedLanguages += Index;
|
||||||
for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);
|
for ( ; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED
|
// If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED
|
||||||
//
|
//
|
||||||
|
@ -7,7 +7,6 @@ bbe
|
|||||||
|
|
||||||
#include "EmuBlockIo.h"
|
#include "EmuBlockIo.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reset the block device hardware.
|
Reset the block device hardware.
|
||||||
|
|
||||||
@ -100,7 +99,6 @@ EmuBlockIo2ReadBlocksEx (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Write BufferSize bytes from Lba into Buffer.
|
Write BufferSize bytes from Lba into Buffer.
|
||||||
|
|
||||||
@ -157,8 +155,6 @@ EmuBlockIo2WriteBlocksEx (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Flush the Block Device.
|
Flush the Block Device.
|
||||||
|
|
||||||
@ -202,8 +198,6 @@ EmuBlockIo2Flush (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reset the Block Device.
|
Reset the Block Device.
|
||||||
|
|
||||||
@ -236,7 +230,6 @@ EmuBlockIoReset (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read BufferSize bytes from Lba into Buffer.
|
Read BufferSize bytes from Lba into Buffer.
|
||||||
|
|
||||||
@ -282,7 +275,6 @@ EmuBlockIoReadBlocks (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Write BufferSize bytes from Lba into Buffer.
|
Write BufferSize bytes from Lba into Buffer.
|
||||||
|
|
||||||
@ -361,8 +353,6 @@ EmuBlockIoFlushBlocks (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Tests to see if this driver supports a given controller. If a child device is provided,
|
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.
|
it further tests to see if this driver supports creating a handle for the specified child device.
|
||||||
@ -451,7 +441,6 @@ EmuBlockIoDriverBindingSupported (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Starts a device controller or a bus controller.
|
Starts a device controller or a bus controller.
|
||||||
|
|
||||||
@ -573,8 +562,10 @@ EmuBlockIoDriverBindingStart (
|
|||||||
|
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&Handle,
|
&Handle,
|
||||||
&gEfiBlockIoProtocolGuid, &Private->BlockIo,
|
&gEfiBlockIoProtocolGuid,
|
||||||
&gEfiBlockIo2ProtocolGuid, &Private->BlockIo2,
|
&Private->BlockIo,
|
||||||
|
&gEfiBlockIo2ProtocolGuid,
|
||||||
|
&Private->BlockIo2,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -586,7 +577,6 @@ Done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
gBS->FreePool (Private);
|
gBS->FreePool (Private);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
@ -600,7 +590,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stops a device controller or a bus controller.
|
Stops a device controller or a bus controller.
|
||||||
|
|
||||||
@ -659,8 +648,10 @@ EmuBlockIoDriverBindingStop (
|
|||||||
|
|
||||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
Private->EfiHandle,
|
Private->EfiHandle,
|
||||||
&gEfiBlockIoProtocolGuid, &Private->BlockIo,
|
&gEfiBlockIoProtocolGuid,
|
||||||
&gEfiBlockIo2ProtocolGuid, &Private->BlockIo2,
|
&Private->BlockIo,
|
||||||
|
&gEfiBlockIo2ProtocolGuid,
|
||||||
|
&Private->BlockIo2,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
@ -686,10 +677,6 @@ EmuBlockIoDriverBindingStop (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_DRIVER_BINDING_PROTOCOL gEmuBlockIoDriverBinding = {
|
EFI_DRIVER_BINDING_PROTOCOL gEmuBlockIoDriverBinding = {
|
||||||
EmuBlockIoDriverBindingSupported,
|
EmuBlockIoDriverBindingSupported,
|
||||||
EmuBlockIoDriverBindingStart,
|
EmuBlockIoDriverBindingStart,
|
||||||
@ -699,9 +686,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuBlockIoDriverBinding = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The user Entry Point for module EmuBlockIo . The user code starts with this function.
|
The user Entry Point for module EmuBlockIo . The user code starts with this function.
|
||||||
|
|
||||||
@ -735,9 +719,5 @@ InitializeEmuBlockIo (
|
|||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ Abstract:
|
|||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Language supported for driverconfiguration protocol
|
// Language supported for driverconfiguration protocol
|
||||||
//
|
//
|
||||||
@ -55,7 +54,6 @@ typedef struct {
|
|||||||
EFI_BLOCK_IO_MEDIA Media;
|
EFI_BLOCK_IO_MEDIA Media;
|
||||||
|
|
||||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||||
|
|
||||||
} EMU_BLOCK_IO_PRIVATE;
|
} EMU_BLOCK_IO_PRIVATE;
|
||||||
|
|
||||||
#define EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
|
#define EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
|
||||||
@ -64,7 +62,6 @@ typedef struct {
|
|||||||
#define EMU_BLOCK_IO2_PRIVATE_DATA_FROM_THIS(a) \
|
#define EMU_BLOCK_IO2_PRIVATE_DATA_FROM_THIS(a) \
|
||||||
CR(a, EMU_BLOCK_IO_PRIVATE, BlockIo2, EMU_BLOCK_IO_PRIVATE_SIGNATURE)
|
CR(a, EMU_BLOCK_IO_PRIVATE, BlockIo2, EMU_BLOCK_IO_PRIVATE_SIGNATURE)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block I/O Global Variables
|
// Block I/O Global Variables
|
||||||
//
|
//
|
||||||
|
@ -10,8 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "EmuBusDriverDxe.h"
|
#include "EmuBusDriverDxe.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// DriverBinding protocol global
|
// DriverBinding protocol global
|
||||||
//
|
//
|
||||||
@ -24,8 +22,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuBusDriverBinding = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EmuBusDriverBindingSupported (
|
EmuBusDriverBindingSupported (
|
||||||
@ -52,9 +48,10 @@ EmuBusDriverBindingSupported (
|
|||||||
// If RemainingDevicePath isn't the End of Device Path Node,
|
// If RemainingDevicePath isn't the End of Device Path Node,
|
||||||
// check its validation
|
// check its validation
|
||||||
//
|
//
|
||||||
if (RemainingDevicePath->Type != HARDWARE_DEVICE_PATH ||
|
if ((RemainingDevicePath->Type != HARDWARE_DEVICE_PATH) ||
|
||||||
RemainingDevicePath->SubType != HW_VENDOR_DP ||
|
(RemainingDevicePath->SubType != HW_VENDOR_DP) ||
|
||||||
DevicePathNodeLength(RemainingDevicePath) != sizeof(EMU_VENDOR_DEVICE_PATH_NODE)) {
|
(DevicePathNodeLength (RemainingDevicePath) != sizeof (EMU_VENDOR_DEVICE_PATH_NODE)))
|
||||||
|
{
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,7 +105,6 @@ EmuBusDriverBindingSupported (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Close protocol, don't use device path protocol in the Support() function
|
// Close protocol, don't use device path protocol in the Support() function
|
||||||
//
|
//
|
||||||
@ -122,7 +118,6 @@ EmuBusDriverBindingSupported (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EmuBusDriverBindingStart (
|
EmuBusDriverBindingStart (
|
||||||
@ -156,7 +151,7 @@ EmuBusDriverBindingStart (
|
|||||||
ControllerHandle,
|
ControllerHandle,
|
||||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
|
if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +163,7 @@ EmuBusDriverBindingStart (
|
|||||||
ControllerHandle,
|
ControllerHandle,
|
||||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
|
if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,10 +191,10 @@ EmuBusDriverBindingStart (
|
|||||||
FALSE
|
FALSE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&ControllerHandle,
|
&ControllerHandle,
|
||||||
&gEfiCallerIdGuid, EmuBusDevice,
|
&gEfiCallerIdGuid,
|
||||||
|
EmuBusDevice,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -209,7 +204,6 @@ EmuBusDriverBindingStart (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (Status = EFI_SUCCESS, EmuIoThunk = NULL; !EFI_ERROR (Status); ) {
|
for (Status = EFI_SUCCESS, EmuIoThunk = NULL; !EFI_ERROR (Status); ) {
|
||||||
Status = EmuThunk->GetNextProtocol (TRUE, &EmuIoThunk);
|
Status = EmuThunk->GetNextProtocol (TRUE, &EmuIoThunk);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -229,11 +223,12 @@ EmuBusDriverBindingStart (
|
|||||||
// check its validation
|
// check its validation
|
||||||
//
|
//
|
||||||
Node = (EMU_VENDOR_DEVICE_PATH_NODE *)RemainingDevicePath;
|
Node = (EMU_VENDOR_DEVICE_PATH_NODE *)RemainingDevicePath;
|
||||||
if (Node->VendorDevicePath.Header.Type == HARDWARE_DEVICE_PATH &&
|
if ((Node->VendorDevicePath.Header.Type == HARDWARE_DEVICE_PATH) &&
|
||||||
Node->VendorDevicePath.Header.SubType == HW_VENDOR_DP &&
|
(Node->VendorDevicePath.Header.SubType == HW_VENDOR_DP) &&
|
||||||
DevicePathNodeLength (&Node->VendorDevicePath.Header) == sizeof (EMU_VENDOR_DEVICE_PATH_NODE)
|
(DevicePathNodeLength (&Node->VendorDevicePath.Header) == sizeof (EMU_VENDOR_DEVICE_PATH_NODE))
|
||||||
) {
|
)
|
||||||
if (CompareGuid (&Node->VendorDevicePath.Guid, EmuIoThunk->Protocol) && Node->Instance == EmuIoThunk->Instance) {
|
{
|
||||||
|
if (CompareGuid (&Node->VendorDevicePath.Guid, EmuIoThunk->Protocol) && (Node->Instance == EmuIoThunk->Instance)) {
|
||||||
CreateDevice = TRUE;
|
CreateDevice = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -284,8 +279,10 @@ EmuBusDriverBindingStart (
|
|||||||
|
|
||||||
InstallStatus = gBS->InstallMultipleProtocolInterfaces (
|
InstallStatus = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&EmuDevice->Handle,
|
&EmuDevice->Handle,
|
||||||
&gEfiDevicePathProtocolGuid, EmuDevice->DevicePath,
|
&gEfiDevicePathProtocolGuid,
|
||||||
&gEmuIoThunkProtocolGuid, &EmuDevice->EmuIoThunk,
|
EmuDevice->DevicePath,
|
||||||
|
&gEmuIoThunkProtocolGuid,
|
||||||
|
&EmuDevice->EmuIoThunk,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (InstallStatus)) {
|
if (EFI_ERROR (InstallStatus)) {
|
||||||
@ -313,7 +310,6 @@ EmuBusDriverBindingStart (
|
|||||||
return InstallStatus;
|
return InstallStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EmuBusDriverBindingStop (
|
EmuBusDriverBindingStop (
|
||||||
@ -354,7 +350,8 @@ EmuBusDriverBindingStop (
|
|||||||
|
|
||||||
gBS->UninstallMultipleProtocolInterfaces (
|
gBS->UninstallMultipleProtocolInterfaces (
|
||||||
ControllerHandle,
|
ControllerHandle,
|
||||||
&gEfiCallerIdGuid, EmuBusDevice,
|
&gEfiCallerIdGuid,
|
||||||
|
EmuBusDevice,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -381,7 +378,6 @@ EmuBusDriverBindingStop (
|
|||||||
AllChildrenStopped = TRUE;
|
AllChildrenStopped = TRUE;
|
||||||
|
|
||||||
for (Index = 0; Index < NumberOfChildren; Index++) {
|
for (Index = 0; Index < NumberOfChildren; Index++) {
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
Status = gBS->OpenProtocol (
|
||||||
ChildHandleBuffer[Index],
|
ChildHandleBuffer[Index],
|
||||||
&gEmuIoThunkProtocolGuid,
|
&gEmuIoThunkProtocolGuid,
|
||||||
@ -402,8 +398,10 @@ EmuBusDriverBindingStop (
|
|||||||
|
|
||||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
EmuDevice->Handle,
|
EmuDevice->Handle,
|
||||||
&gEfiDevicePathProtocolGuid, EmuDevice->DevicePath,
|
&gEfiDevicePathProtocolGuid,
|
||||||
&gEmuIoThunkProtocolGuid, &EmuDevice->EmuIoThunk,
|
EmuDevice->DevicePath,
|
||||||
|
&gEmuIoThunkProtocolGuid,
|
||||||
|
&EmuDevice->EmuIoThunk,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -437,7 +435,6 @@ EmuBusDriverBindingStop (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -487,8 +484,6 @@ EmuBusCreateDevicePath (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The user Entry Point for module EmuBusDriver. The user code starts with this function.
|
The user Entry Point for module EmuBusDriver. The user code starts with this function.
|
||||||
|
|
||||||
@ -519,10 +514,5 @@ InitializeEmuBusDriver (
|
|||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ extern EFI_DRIVER_BINDING_PROTOCOL gEmuBusDriverBinding;
|
|||||||
extern EFI_COMPONENT_NAME_PROTOCOL gEmuBusDriverComponentName;
|
extern EFI_COMPONENT_NAME_PROTOCOL gEmuBusDriverComponentName;
|
||||||
extern EFI_COMPONENT_NAME2_PROTOCOL gEmuBusDriverComponentName2;
|
extern EFI_COMPONENT_NAME2_PROTOCOL gEmuBusDriverComponentName2;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Unix Bus Controller Structure
|
// Unix Bus Controller Structure
|
||||||
//
|
//
|
||||||
@ -58,14 +57,11 @@ typedef struct {
|
|||||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||||
|
|
||||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||||
|
|
||||||
} EMU_IO_DEVICE;
|
} EMU_IO_DEVICE;
|
||||||
|
|
||||||
#define EMU_IO_DEVICE_FROM_THIS(a) \
|
#define EMU_IO_DEVICE_FROM_THIS(a) \
|
||||||
CR(a, EMU_IO_DEVICE, EmuIoThunk, EMU_IO_DEVICE_SIGNATURE)
|
CR(a, EMU_IO_DEVICE, EmuIoThunk, EMU_IO_DEVICE_SIGNATURE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Driver Binding Protocol function prototypes
|
// Driver Binding Protocol function prototypes
|
||||||
//
|
//
|
||||||
@ -77,7 +73,6 @@ EmuBusDriverBindingSupported (
|
|||||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EmuBusDriverBindingStart (
|
EmuBusDriverBindingStart (
|
||||||
@ -86,7 +81,6 @@ EmuBusDriverBindingStart (
|
|||||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EmuBusDriverBindingStop (
|
EmuBusDriverBindingStop (
|
||||||
@ -106,5 +100,4 @@ EmuBusCreateDevicePath (
|
|||||||
IN UINT16 InstanceNumber
|
IN UINT16 InstanceNumber
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,13 +53,11 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponentName2
|
|||||||
"en"
|
"en"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
EFI_UNICODE_STRING_TABLE mEmuGopDriverNameTable[] = {
|
EFI_UNICODE_STRING_TABLE mEmuGopDriverNameTable[] = {
|
||||||
{ "eng", L"Emulator GOP Driver" },
|
{ "eng", L"Emulator GOP Driver" },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the driver.
|
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
|
Retrieves a Unicode string that is the user readable name of the controller
|
||||||
that is being managed by a driver.
|
that is being managed by a driver.
|
||||||
@ -217,6 +214,7 @@ EmuGopComponentNameGetControllerName (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get our context back
|
// Get our context back
|
||||||
//
|
//
|
||||||
|
@ -29,7 +29,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
#include <Library/KeyMapLib.h>
|
#include <Library/KeyMapLib.h>
|
||||||
|
|
||||||
|
|
||||||
#define MAX_Q 256
|
#define MAX_Q 256
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -58,8 +57,6 @@ typedef struct {
|
|||||||
UINT32 RefreshRate;
|
UINT32 RefreshRate;
|
||||||
} GOP_MODE_DATA;
|
} GOP_MODE_DATA;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding;
|
extern EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding;
|
||||||
extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName;
|
extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName;
|
||||||
|
|
||||||
@ -85,7 +82,6 @@ typedef struct {
|
|||||||
//
|
//
|
||||||
GOP_MODE_DATA *ModeData;
|
GOP_MODE_DATA *ModeData;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// UGA Private Data knowing when to start hardware
|
// UGA Private Data knowing when to start hardware
|
||||||
//
|
//
|
||||||
@ -100,7 +96,6 @@ typedef struct {
|
|||||||
LIST_ENTRY NotifyList;
|
LIST_ENTRY NotifyList;
|
||||||
} GOP_PRIVATE_DATA;
|
} GOP_PRIVATE_DATA;
|
||||||
|
|
||||||
|
|
||||||
#define GOP_PRIVATE_DATA_FROM_THIS(a) \
|
#define GOP_PRIVATE_DATA_FROM_THIS(a) \
|
||||||
CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
|
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) \
|
#define GOP_PRIVATE_DATA_FROM_POINTER_MODE_THIS(a) \
|
||||||
CR(a, GOP_PRIVATE_DATA, SimplePointer, GOP_PRIVATE_DATA_SIGNATURE)
|
CR(a, GOP_PRIVATE_DATA, SimplePointer, GOP_PRIVATE_DATA_SIGNATURE)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Global Protocol Variables
|
// Global Protocol Variables
|
||||||
//
|
//
|
||||||
@ -139,7 +133,6 @@ EmuGopDestructor (
|
|||||||
IN GOP_PRIVATE_DATA *Private
|
IN GOP_PRIVATE_DATA *Private
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GopPrivateAddQ (
|
GopPrivateAddQ (
|
||||||
IN GOP_PRIVATE_DATA *Private,
|
IN GOP_PRIVATE_DATA *Private,
|
||||||
|
@ -9,11 +9,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "Gop.h"
|
#include "Gop.h"
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
FreeNotifyList (
|
FreeNotifyList (
|
||||||
IN OUT LIST_ENTRY *ListHead
|
IN OUT LIST_ENTRY *ListHead
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -34,6 +34,7 @@ Returns:
|
|||||||
if (ListHead == NULL) {
|
if (ListHead == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!IsListEmpty (ListHead)) {
|
while (!IsListEmpty (ListHead)) {
|
||||||
NotifyNode = CR (
|
NotifyNode = CR (
|
||||||
ListHead->ForwardLink,
|
ListHead->ForwardLink,
|
||||||
@ -48,7 +49,6 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Tests to see if this driver supports a given controller. If a child device is provided,
|
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.
|
it further tests to see if this driver supports creating a handle for the specified child device.
|
||||||
@ -132,7 +132,6 @@ EmuGopDriverBindingSupported (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Starts a device controller or a bus controller.
|
Starts a device controller or a bus controller.
|
||||||
|
|
||||||
@ -207,6 +206,7 @@ EmuGopDriverBindingStart (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set up context record
|
// Set up context record
|
||||||
//
|
//
|
||||||
@ -234,21 +234,25 @@ EmuGopDriverBindingStart (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Publish the Gop interface to the world
|
// Publish the Gop interface to the world
|
||||||
//
|
//
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&Private->Handle,
|
&Private->Handle,
|
||||||
&gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput,
|
&gEfiGraphicsOutputProtocolGuid,
|
||||||
&gEfiSimpleTextInProtocolGuid, &Private->SimpleTextIn,
|
&Private->GraphicsOutput,
|
||||||
&gEfiSimplePointerProtocolGuid, &Private->SimplePointer,
|
&gEfiSimpleTextInProtocolGuid,
|
||||||
&gEfiSimpleTextInputExProtocolGuid, &Private->SimpleTextInEx,
|
&Private->SimpleTextIn,
|
||||||
|
&gEfiSimplePointerProtocolGuid,
|
||||||
|
&Private->SimplePointer,
|
||||||
|
&gEfiSimpleTextInputExProtocolGuid,
|
||||||
|
&Private->SimpleTextInEx,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
Handle,
|
Handle,
|
||||||
&gEmuIoThunkProtocolGuid,
|
&gEmuIoThunkProtocolGuid,
|
||||||
@ -263,12 +267,15 @@ Done:
|
|||||||
if (Private->ControllerNameTable != NULL) {
|
if (Private->ControllerNameTable != NULL) {
|
||||||
FreeUnicodeStringTable (Private->ControllerNameTable);
|
FreeUnicodeStringTable (Private->ControllerNameTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->SimpleTextIn.WaitForKey != NULL) {
|
if (Private->SimpleTextIn.WaitForKey != NULL) {
|
||||||
gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
|
gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->SimpleTextInEx.WaitForKeyEx != NULL) {
|
if (Private->SimpleTextInEx.WaitForKeyEx != NULL) {
|
||||||
gBS->CloseEvent (Private->SimpleTextInEx.WaitForKeyEx);
|
gBS->CloseEvent (Private->SimpleTextInEx.WaitForKeyEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeNotifyList (&Private->NotifyList);
|
FreeNotifyList (&Private->NotifyList);
|
||||||
|
|
||||||
gBS->FreePool (Private);
|
gBS->FreePool (Private);
|
||||||
@ -278,8 +285,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stops a device controller or a bus controller.
|
Stops a device controller or a bus controller.
|
||||||
|
|
||||||
@ -344,10 +349,14 @@ EmuGopDriverBindingStop (
|
|||||||
//
|
//
|
||||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
Private->Handle,
|
Private->Handle,
|
||||||
&gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput,
|
&gEfiGraphicsOutputProtocolGuid,
|
||||||
&gEfiSimpleTextInProtocolGuid, &Private->SimpleTextIn,
|
&Private->GraphicsOutput,
|
||||||
&gEfiSimplePointerProtocolGuid, &Private->SimplePointer,
|
&gEfiSimpleTextInProtocolGuid,
|
||||||
&gEfiSimpleTextInputExProtocolGuid, &Private->SimpleTextInEx,
|
&Private->SimpleTextIn,
|
||||||
|
&gEfiSimplePointerProtocolGuid,
|
||||||
|
&Private->SimplePointer,
|
||||||
|
&gEfiSimpleTextInputExProtocolGuid,
|
||||||
|
&Private->SimpleTextInEx,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
@ -380,13 +389,11 @@ EmuGopDriverBindingStop (
|
|||||||
FreeNotifyList (&Private->NotifyList);
|
FreeNotifyList (&Private->NotifyList);
|
||||||
|
|
||||||
gBS->FreePool (Private);
|
gBS->FreePool (Private);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// This protocol provides the services required to determine if a driver supports a given controller.
|
/// 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.
|
/// 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
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The user Entry Point for module EmuGop. The user code starts with this function.
|
The user Entry Point for module EmuGop. The user code starts with this function.
|
||||||
|
|
||||||
@ -431,7 +436,5 @@ InitializeEmuGop (
|
|||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,12 +9,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "Gop.h"
|
#include "Gop.h"
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
GopPrivateIsKeyRegistered (
|
GopPrivateIsKeyRegistered (
|
||||||
IN EFI_KEY_DATA *RegsiteredData,
|
IN EFI_KEY_DATA *RegsiteredData,
|
||||||
IN EFI_KEY_DATA *InputData
|
IN EFI_KEY_DATA *InputData
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -35,27 +35,29 @@ Returns:
|
|||||||
ASSERT (RegsiteredData != NULL && InputData != NULL);
|
ASSERT (RegsiteredData != NULL && InputData != NULL);
|
||||||
|
|
||||||
if ((RegsiteredData->Key.ScanCode != InputData->Key.ScanCode) ||
|
if ((RegsiteredData->Key.ScanCode != InputData->Key.ScanCode) ||
|
||||||
(RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar)) {
|
(RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar))
|
||||||
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Assume KeyShiftState/KeyToggleState = 0 in Registered key data means these state could be ignored.
|
// Assume KeyShiftState/KeyToggleState = 0 in Registered key data means these state could be ignored.
|
||||||
//
|
//
|
||||||
if (RegsiteredData->KeyState.KeyShiftState != 0 &&
|
if ((RegsiteredData->KeyState.KeyShiftState != 0) &&
|
||||||
RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState) {
|
(RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState))
|
||||||
|
{
|
||||||
return FALSE;
|
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 FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GopPrivateMakeCallbackFunction (
|
GopPrivateMakeCallbackFunction (
|
||||||
@ -84,7 +86,6 @@ GopPrivateMakeCallbackFunction (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GopPrivateBreakCallbackFunction (
|
GopPrivateBreakCallbackFunction (
|
||||||
@ -95,8 +96,6 @@ GopPrivateBreakCallbackFunction (
|
|||||||
KeyMapBreak (KeyData);
|
KeyMapBreak (KeyData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Simple Text In implementation.
|
// Simple Text In implementation.
|
||||||
//
|
//
|
||||||
@ -135,8 +134,8 @@ EmuGopSimpleTextInReset (
|
|||||||
//
|
//
|
||||||
// A reset is draining the Queue
|
// 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
|
// Leave critical section and return
|
||||||
@ -145,7 +144,6 @@ EmuGopSimpleTextInReset (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads the next keystroke from the input device. The WaitForKey Event can
|
Reads the next keystroke from the input device. The WaitForKey Event can
|
||||||
be used to test for existence of a keystroke via WaitForEvent () call.
|
be used to test for existence of a keystroke via WaitForEvent () call.
|
||||||
@ -200,8 +198,6 @@ EmuGopSimpleTextInReadKeyStroke (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
SimpleTextIn and SimpleTextInEx Notify Wait Event
|
SimpleTextIn and SimpleTextInEx Notify Wait Event
|
||||||
|
|
||||||
@ -237,18 +233,17 @@ EmuGopSimpleTextInWaitForKey (
|
|||||||
//
|
//
|
||||||
gBS->SignalEvent (Event);
|
gBS->SignalEvent (Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Leave critical section and return
|
// Leave critical section and return
|
||||||
//
|
//
|
||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Simple Text Input Ex protocol functions
|
// Simple Text Input Ex protocol functions
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The Reset() function resets the input device hardware. As part
|
The Reset() function resets the input device hardware. As part
|
||||||
of initialization process, the firmware/device will make a quick
|
of initialization process, the firmware/device will make a quick
|
||||||
@ -280,6 +275,7 @@ EmuGopSimpleTextInExResetEx (
|
|||||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||||
IN BOOLEAN ExtendedVerification
|
IN BOOLEAN ExtendedVerification
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -297,8 +293,6 @@ EmuGopSimpleTextInExResetEx (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The function reads the next keystroke from the input device. If
|
The function reads the next keystroke from the input device. If
|
||||||
there is no pending keystroke the function returns
|
there is no pending keystroke the function returns
|
||||||
@ -354,6 +348,7 @@ EmuGopSimpleTextInExReadKeyStrokeEx (
|
|||||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||||
OUT EFI_KEY_DATA *KeyData
|
OUT EFI_KEY_DATA *KeyData
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -378,7 +373,6 @@ EmuGopSimpleTextInExReadKeyStrokeEx (
|
|||||||
GOP_PRIVATE_DATA *Private;
|
GOP_PRIVATE_DATA *Private;
|
||||||
EFI_TPL OldTpl;
|
EFI_TPL OldTpl;
|
||||||
|
|
||||||
|
|
||||||
if (KeyData == NULL) {
|
if (KeyData == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
@ -403,8 +397,6 @@ EmuGopSimpleTextInExReadKeyStrokeEx (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The SetState() function allows the input device hardware to
|
The SetState() function allows the input device hardware to
|
||||||
have state settings adjusted.
|
have state settings adjusted.
|
||||||
@ -446,7 +438,8 @@ EmuGopSimpleTextInExSetState (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (((Private->KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID) ||
|
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;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,7 +457,6 @@ EmuGopSimpleTextInExSetState (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
SimpleTextIn and SimpleTextInEx Notify Wait Event
|
SimpleTextIn and SimpleTextInEx Notify Wait Event
|
||||||
|
|
||||||
@ -484,8 +476,6 @@ EmuGopRegisterKeyCallback (
|
|||||||
ExNotify->KeyNotificationFn (&ExNotify->KeyData);
|
ExNotify->KeyNotificationFn (&ExNotify->KeyData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The RegisterKeystrokeNotify() function registers a function
|
The RegisterKeystrokeNotify() function registers a function
|
||||||
which will be called when a specified keystroke will occur.
|
which will be called when a specified keystroke will occur.
|
||||||
@ -526,7 +516,7 @@ EmuGopSimpleTextInExRegisterKeyNotify (
|
|||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *Link;
|
||||||
EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NewNotify;
|
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;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,14 +563,11 @@ EmuGopSimpleTextInExRegisterKeyNotify (
|
|||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
|
||||||
*NotifyHandle = NewNotify->NotifyHandle;
|
*NotifyHandle = NewNotify->NotifyHandle;
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The UnregisterKeystrokeNotify() function removes the
|
The UnregisterKeystrokeNotify() function removes the
|
||||||
notification which was previously registered.
|
notification which was previously registered.
|
||||||
@ -602,6 +589,7 @@ EmuGopSimpleTextInExUnregisterKeyNotify (
|
|||||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||||
IN VOID *NotificationHandle
|
IN VOID *NotificationHandle
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -657,8 +645,6 @@ EmuGopSimpleTextInExUnregisterKeyNotify (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize SimplelTextIn and SimpleTextInEx protocols in the Private
|
Initialize SimplelTextIn and SimpleTextInEx protocols in the Private
|
||||||
context structure.
|
context structure.
|
||||||
@ -690,7 +676,6 @@ EmuGopInitializeSimpleTextInForWindow (
|
|||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize Simple Text In Ex
|
// Initialize Simple Text In Ex
|
||||||
//
|
//
|
||||||
@ -714,21 +699,13 @@ EmuGopInitializeSimpleTextInForWindow (
|
|||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Simple Pointer implementation.
|
// Simple Pointer implementation.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Resets the pointer device hardware.
|
Resets the pointer device hardware.
|
||||||
|
|
||||||
@ -765,8 +742,8 @@ EmuGopSimplePointerReset (
|
|||||||
//
|
//
|
||||||
// A reset is draining the Queue
|
// 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
|
// Leave critical section and return
|
||||||
@ -775,7 +752,6 @@ EmuGopSimplePointerReset (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves the current state of a pointer device.
|
Retrieves the current state of a pointer device.
|
||||||
|
|
||||||
@ -820,7 +796,6 @@ EmuGopSimplePointerGetState (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
SimplePointer Notify Wait Event
|
SimplePointer Notify Wait Event
|
||||||
|
|
||||||
@ -856,13 +831,13 @@ EmuGopSimplePointerWaitForInput (
|
|||||||
//
|
//
|
||||||
gBS->SignalEvent (Event);
|
gBS->SignalEvent (Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Leave critical section and return
|
// Leave critical section and return
|
||||||
//
|
//
|
||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
SimplePointer constructor
|
SimplePointer constructor
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ Abstract:
|
|||||||
|
|
||||||
#include "Gop.h"
|
#include "Gop.h"
|
||||||
|
|
||||||
|
|
||||||
EFI_EVENT mGopScreenExitBootServicesEvent;
|
EFI_EVENT mGopScreenExitBootServicesEvent;
|
||||||
|
|
||||||
GOP_MODE_DATA mGopModeData[] = {
|
GOP_MODE_DATA mGopModeData[] = {
|
||||||
@ -29,7 +28,6 @@ GOP_MODE_DATA mGopModeData[] = {
|
|||||||
{ 1280, 1024, 0, 0 }
|
{ 1280, 1024, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns information for an available graphics mode that the graphics device
|
Returns information for an available graphics mode that the graphics device
|
||||||
and the set of active video output devices supports.
|
and the set of active video output devices supports.
|
||||||
@ -59,7 +57,7 @@ EmuGopQuerytMode (
|
|||||||
|
|
||||||
Private = GOP_PRIVATE_DATA_FROM_THIS (This);
|
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;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,8 +77,6 @@ EmuGopQuerytMode (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the video device into the specified mode and clears the visible portions of
|
Set the video device into the specified mode and clears the visible portions of
|
||||||
the output display to black.
|
the output display to black.
|
||||||
@ -132,14 +128,12 @@ EmuGopSetMode (
|
|||||||
Private->HardwareNeedsStarting = FALSE;
|
Private->HardwareNeedsStarting = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Status = Private->EmuGraphicsWindow->Size (
|
Status = Private->EmuGraphicsWindow->Size (
|
||||||
Private->EmuGraphicsWindow,
|
Private->EmuGraphicsWindow,
|
||||||
ModeData->HorizontalResolution,
|
ModeData->HorizontalResolution,
|
||||||
ModeData->VerticalResolution
|
ModeData->VerticalResolution
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
Fill.Red = 0;
|
Fill.Red = 0;
|
||||||
Fill.Green = 0;
|
Fill.Green = 0;
|
||||||
Fill.Blue = 0;
|
Fill.Blue = 0;
|
||||||
@ -158,8 +152,6 @@ EmuGopSetMode (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.
|
Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.
|
||||||
|
|
||||||
@ -206,9 +198,10 @@ EmuGopBlt (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Width == 0 || Height == 0) {
|
if ((Width == 0) || (Height == 0)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If Delta is zero, then the entire BltBuffer is being used, so Delta
|
// 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,
|
// is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size,
|
||||||
@ -248,7 +241,6 @@ EmuGopBlt (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Construction and Destruction functions
|
// Construction and Destruction functions
|
||||||
//
|
//
|
||||||
@ -270,7 +262,6 @@ EmuGopSupported (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EmuGopStartWindow (
|
EmuGopStartWindow (
|
||||||
IN GOP_PRIVATE_DATA *Private,
|
IN GOP_PRIVATE_DATA *Private,
|
||||||
@ -306,6 +297,7 @@ EmuGopStartWindow (
|
|||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,6 +319,7 @@ EmuGopConstructor (
|
|||||||
if (Private->GraphicsOutput.Mode == NULL) {
|
if (Private->GraphicsOutput.Mode == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Private->GraphicsOutput.Mode->Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
|
Private->GraphicsOutput.Mode->Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
|
||||||
if (Private->GraphicsOutput.Mode->Info == NULL) {
|
if (Private->GraphicsOutput.Mode->Info == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
@ -355,8 +348,6 @@ EmuGopConstructor (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EmuGopDestructor (
|
EmuGopDestructor (
|
||||||
GOP_PRIVATE_DATA *Private
|
GOP_PRIVATE_DATA *Private
|
||||||
@ -374,19 +365,20 @@ EmuGopDestructor (
|
|||||||
if (Private->GraphicsOutput.Mode->Info != NULL) {
|
if (Private->GraphicsOutput.Mode->Info != NULL) {
|
||||||
FreePool (Private->GraphicsOutput.Mode->Info);
|
FreePool (Private->GraphicsOutput.Mode->Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Private->GraphicsOutput.Mode);
|
FreePool (Private->GraphicsOutput.Mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ShutdownGopEvent (
|
ShutdownGopEvent (
|
||||||
IN EFI_EVENT Event,
|
IN EFI_EVENT Event,
|
||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
@ -110,7 +110,6 @@ EmuSimpleFileSystemComponentNameGetDriverName (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the controller
|
Retrieves a Unicode string that is the user readable name of the controller
|
||||||
that is being managed by a driver.
|
that is being managed by a driver.
|
||||||
@ -211,6 +210,7 @@ EmuSimpleFileSystemComponentNameGetControllerName (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get our context back
|
// Get our context back
|
||||||
//
|
//
|
||||||
|
@ -12,9 +12,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "EmuSimpleFileSystem.h"
|
#include "EmuSimpleFileSystem.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Opens a new file relative to the source file's location.
|
Opens a new file relative to the source file's location.
|
||||||
|
|
||||||
@ -53,7 +50,7 @@ EmuSimpleFileSystemOpen (
|
|||||||
//
|
//
|
||||||
// Check for obvious invalid parameters.
|
// Check for obvious invalid parameters.
|
||||||
//
|
//
|
||||||
if (This == NULL || NewHandle == NULL || FileName == NULL) {
|
if ((This == NULL) || (NewHandle == NULL) || (FileName == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +85,6 @@ EmuSimpleFileSystemOpen (
|
|||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Status = PrivateFile->Io->Open (PrivateFile->Io, &NewPrivateFile->Io, FileName, OpenMode, Attributes);
|
Status = PrivateFile->Io->Open (PrivateFile->Io, &NewPrivateFile->Io, FileName, OpenMode, Attributes);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
*NewHandle = &NewPrivateFile->EfiFile;
|
*NewHandle = &NewPrivateFile->EfiFile;
|
||||||
@ -103,8 +99,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Close the file handle
|
Close the file handle
|
||||||
|
|
||||||
@ -141,7 +135,6 @@ EmuSimpleFileSystemClose (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Close and delete the file handle.
|
Close and delete the file handle.
|
||||||
|
|
||||||
@ -179,7 +172,6 @@ EmuSimpleFileSystemDelete (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read data from the file.
|
Read data from the file.
|
||||||
|
|
||||||
@ -206,7 +198,7 @@ EmuSimpleFileSystemRead (
|
|||||||
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
||||||
EFI_TPL OldTpl;
|
EFI_TPL OldTpl;
|
||||||
|
|
||||||
if (This == NULL || BufferSize == NULL) {
|
if ((This == NULL) || (BufferSize == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +217,6 @@ EmuSimpleFileSystemRead (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Write data to a file.
|
Write data to a file.
|
||||||
|
|
||||||
@ -256,7 +247,7 @@ EmuSimpleFileSystemWrite (
|
|||||||
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
||||||
EFI_TPL OldTpl;
|
EFI_TPL OldTpl;
|
||||||
|
|
||||||
if (This == NULL || BufferSize == NULL || Buffer == NULL) {
|
if ((This == NULL) || (BufferSize == NULL) || (Buffer == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,7 +261,6 @@ EmuSimpleFileSystemWrite (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get a file's current position
|
Get a file's current position
|
||||||
|
|
||||||
@ -292,7 +282,7 @@ EmuSimpleFileSystemGetPosition (
|
|||||||
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
||||||
EFI_TPL OldTpl;
|
EFI_TPL OldTpl;
|
||||||
|
|
||||||
if (This == NULL || Position == NULL) {
|
if ((This == NULL) || (Position == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,8 +296,6 @@ EmuSimpleFileSystemGetPosition (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set file's current position
|
Set file's current position
|
||||||
|
|
||||||
@ -343,7 +331,6 @@ EmuSimpleFileSystemSetPosition (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get information about a file.
|
Get information about a file.
|
||||||
|
|
||||||
@ -375,7 +362,7 @@ EmuSimpleFileSystemGetInfo (
|
|||||||
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
||||||
EFI_TPL OldTpl;
|
EFI_TPL OldTpl;
|
||||||
|
|
||||||
if (This == NULL || InformationType == NULL || BufferSize == NULL) {
|
if ((This == NULL) || (InformationType == NULL) || (BufferSize == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +376,6 @@ EmuSimpleFileSystemGetInfo (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set information about a file
|
Set information about a file
|
||||||
|
|
||||||
@ -423,7 +409,7 @@ EmuSimpleFileSystemSetInfo (
|
|||||||
//
|
//
|
||||||
// Check for invalid parameters.
|
// 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;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,7 +423,6 @@ EmuSimpleFileSystemSetInfo (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Flush data back for the file handle.
|
Flush data back for the file handle.
|
||||||
|
|
||||||
@ -477,8 +462,6 @@ EmuSimpleFileSystemFlush (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Open the root directory on a volume.
|
Open the root directory on a volume.
|
||||||
|
|
||||||
@ -508,7 +491,7 @@ EmuSimpleFileSystemOpenVolume (
|
|||||||
|
|
||||||
Status = EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
|
|
||||||
if (This == NULL || Root == NULL) {
|
if ((This == NULL) || (Root == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,7 +545,6 @@ EmuSimpleFileSystemOpenVolume (
|
|||||||
FALSE
|
FALSE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (PrivateFile) {
|
if (PrivateFile) {
|
||||||
@ -666,8 +648,6 @@ EmuSimpleFileSystemDriverBindingSupported (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Starts a device controller or a bus controller.
|
Starts a device controller or a bus controller.
|
||||||
|
|
||||||
@ -778,7 +758,8 @@ EmuSimpleFileSystemDriverBindingStart (
|
|||||||
|
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&ControllerHandle,
|
&ControllerHandle,
|
||||||
&gEfiSimpleFileSystemProtocolGuid, &Private->SimpleFileSystem,
|
&gEfiSimpleFileSystemProtocolGuid,
|
||||||
|
&Private->SimpleFileSystem,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -790,7 +771,6 @@ Done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
gBS->FreePool (Private);
|
gBS->FreePool (Private);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
@ -804,7 +784,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stops a device controller or a bus controller.
|
Stops a device controller or a bus controller.
|
||||||
|
|
||||||
@ -866,7 +845,8 @@ EmuSimpleFileSystemDriverBindingStop (
|
|||||||
//
|
//
|
||||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
ControllerHandle,
|
ControllerHandle,
|
||||||
&gEfiSimpleFileSystemProtocolGuid, &Private->SimpleFileSystem,
|
&gEfiSimpleFileSystemProtocolGuid,
|
||||||
|
&Private->SimpleFileSystem,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
@ -892,7 +872,6 @@ EmuSimpleFileSystemDriverBindingStop (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_DRIVER_BINDING_PROTOCOL gEmuSimpleFileSystemDriverBinding = {
|
EFI_DRIVER_BINDING_PROTOCOL gEmuSimpleFileSystemDriverBinding = {
|
||||||
EmuSimpleFileSystemDriverBindingSupported,
|
EmuSimpleFileSystemDriverBindingSupported,
|
||||||
EmuSimpleFileSystemDriverBindingStart,
|
EmuSimpleFileSystemDriverBindingStart,
|
||||||
@ -902,9 +881,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuSimpleFileSystemDriverBinding = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The user Entry Point for module EmuSimpleFileSystem. The user code starts with this function.
|
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/MemoryAllocationLib.h>
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
|
||||||
|
|
||||||
extern EFI_DRIVER_BINDING_PROTOCOL gEmuSimpleFileSystemDriverBinding;
|
extern EFI_DRIVER_BINDING_PROTOCOL gEmuSimpleFileSystemDriverBinding;
|
||||||
extern EFI_COMPONENT_NAME_PROTOCOL gEmuSimpleFileSystemComponentName;
|
extern EFI_COMPONENT_NAME_PROTOCOL gEmuSimpleFileSystemComponentName;
|
||||||
extern EFI_COMPONENT_NAME2_PROTOCOL gEmuSimpleFileSystemComponentName2;
|
extern EFI_COMPONENT_NAME2_PROTOCOL gEmuSimpleFileSystemComponentName2;
|
||||||
@ -69,6 +68,4 @@ typedef struct {
|
|||||||
EMU_EFI_FILE_PRIVATE_SIGNATURE \
|
EMU_EFI_FILE_PRIVATE_SIGNATURE \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,6 +17,7 @@ Abstract:
|
|||||||
//
|
//
|
||||||
// EFI Component Name Functions
|
// EFI Component Name Functions
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the driver.
|
Retrieves a Unicode string that is the user readable name of the driver.
|
||||||
|
|
||||||
@ -64,7 +65,6 @@ EmuSnpDriverComponentNameGetDriverName (
|
|||||||
OUT CHAR16 **DriverName
|
OUT CHAR16 **DriverName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the controller
|
Retrieves a Unicode string that is the user readable name of the controller
|
||||||
that is being managed by a driver.
|
that is being managed by a driver.
|
||||||
@ -143,7 +143,6 @@ EmuSnpDriverComponentNameGetControllerName (
|
|||||||
OUT CHAR16 **ControllerName
|
OUT CHAR16 **ControllerName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// EFI Component Name Protocol
|
// EFI Component Name Protocol
|
||||||
//
|
//
|
||||||
@ -162,7 +161,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuSnpDriverComponen
|
|||||||
"en"
|
"en"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mEmuSnpDriverNameTable[] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mEmuSnpDriverNameTable[] = {
|
||||||
{
|
{
|
||||||
"eng;en",
|
"eng;en",
|
||||||
|
@ -15,8 +15,6 @@ Abstract:
|
|||||||
|
|
||||||
#include "EmuSnpDxe.h"
|
#include "EmuSnpDxe.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_SIMPLE_NETWORK_PROTOCOL gEmuSnpTemplate = {
|
EFI_SIMPLE_NETWORK_PROTOCOL gEmuSnpTemplate = {
|
||||||
EFI_SIMPLE_NETWORK_PROTOCOL_REVISION,
|
EFI_SIMPLE_NETWORK_PROTOCOL_REVISION,
|
||||||
EmuSnpStart,
|
EmuSnpStart,
|
||||||
@ -48,7 +46,9 @@ EFI_SIMPLE_NETWORK_MODE gEmuSnpModeTemplate = {
|
|||||||
MAX_MCAST_FILTER_CNT, // MaxMCastFilterCount
|
MAX_MCAST_FILTER_CNT, // MaxMCastFilterCount
|
||||||
0, // MCastFilterCount
|
0, // MCastFilterCount
|
||||||
{
|
{
|
||||||
{ { 0 } }
|
{
|
||||||
|
{ 0 }
|
||||||
|
}
|
||||||
}, // MCastFilter
|
}, // MCastFilter
|
||||||
{
|
{
|
||||||
{ 0 }
|
{ 0 }
|
||||||
@ -66,7 +66,6 @@ EFI_SIMPLE_NETWORK_MODE gEmuSnpModeTemplate = {
|
|||||||
TRUE // MediaPresent
|
TRUE // MediaPresent
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Changes the state of a network interface from "stopped" to "started".
|
Changes the state of a network interface from "stopped" to "started".
|
||||||
|
|
||||||
@ -90,7 +89,6 @@ EmuSnpStart(
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Changes the state of a network interface from "started" to "stopped".
|
Changes the state of a network interface from "started" to "stopped".
|
||||||
|
|
||||||
@ -114,7 +112,6 @@ EmuSnpStop (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Resets a network adapter and allocates the transmit and receive buffers
|
Resets a network adapter and allocates the transmit and receive buffers
|
||||||
required by the network interface; optionally, also requests allocation
|
required by the network interface; optionally, also requests allocation
|
||||||
@ -354,7 +351,6 @@ EmuSnpMcastIptoMac (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs read and write operations on the NVRAM device attached to a
|
Performs read and write operations on the NVRAM device attached to a
|
||||||
network interface.
|
network interface.
|
||||||
@ -390,7 +386,6 @@ EmuSnpNvdata (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads the current interrupt status and recycled transmit buffer status from
|
Reads the current interrupt status and recycled transmit buffer status from
|
||||||
a network interface.
|
a network interface.
|
||||||
@ -429,7 +424,6 @@ EmuSnpGetStatus (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Places a packet in the transmit queue of a network interface.
|
Places a packet in the transmit queue of a network interface.
|
||||||
|
|
||||||
@ -548,8 +542,6 @@ EmuSnpReceive (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test to see if this driver supports ControllerHandle. This service
|
Test to see if this driver supports ControllerHandle. This service
|
||||||
is called by the EFI boot service ConnectController(). In
|
is called by the EFI boot service ConnectController(). In
|
||||||
@ -583,15 +575,15 @@ EmuSnpDriverBindingSupported (
|
|||||||
if (RemainingDevicePath != NULL) {
|
if (RemainingDevicePath != NULL) {
|
||||||
if (!IsDevicePathEnd (RemainingDevicePath)) {
|
if (!IsDevicePathEnd (RemainingDevicePath)) {
|
||||||
Node = (MAC_ADDR_DEVICE_PATH *)RemainingDevicePath;
|
Node = (MAC_ADDR_DEVICE_PATH *)RemainingDevicePath;
|
||||||
if (Node->Header.Type != MESSAGING_DEVICE_PATH ||
|
if ((Node->Header.Type != MESSAGING_DEVICE_PATH) ||
|
||||||
Node->Header.SubType != MSG_MAC_ADDR_DP) {
|
(Node->Header.SubType != MSG_MAC_ADDR_DP))
|
||||||
|
{
|
||||||
// If the remaining device path does not match we don't support the request
|
// If the remaining device path does not match we don't support the request
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Open the IO Abstraction(s) needed to perform the supported test
|
// Open the IO Abstraction(s) needed to perform the supported test
|
||||||
//
|
//
|
||||||
@ -617,7 +609,6 @@ EmuSnpDriverBindingSupported (
|
|||||||
ControllerHandle
|
ControllerHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Open the EFI Device Path protocol needed to perform the supported test
|
// Open the EFI Device Path protocol needed to perform the supported test
|
||||||
//
|
//
|
||||||
@ -658,7 +649,6 @@ EmuSnpDriverBindingSupported (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Start this driver on ControllerHandle. This service is called by the
|
Start this driver on ControllerHandle. This service is called by the
|
||||||
EFI boot service ConnectController(). In order to make
|
EFI boot service ConnectController(). In order to make
|
||||||
@ -747,7 +737,6 @@ EmuSnpDriverBindingStart (
|
|||||||
Private->Snp.Mode = &Private->Mode;
|
Private->Snp.Mode = &Private->Mode;
|
||||||
Private->ControllerNameTable = NULL;
|
Private->ControllerNameTable = NULL;
|
||||||
|
|
||||||
|
|
||||||
Status = Private->Io->CreateMapping (Private->Io, &Private->Mode);
|
Status = Private->Io->CreateMapping (Private->Io, &Private->Mode);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Done;
|
goto Done;
|
||||||
@ -797,8 +786,10 @@ EmuSnpDriverBindingStart (
|
|||||||
//
|
//
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&Private->DeviceHandle,
|
&Private->DeviceHandle,
|
||||||
&gEfiSimpleNetworkProtocolGuid, &Private->Snp,
|
&gEfiSimpleNetworkProtocolGuid,
|
||||||
&gEfiDevicePathProtocolGuid, Private->DevicePath,
|
&Private->Snp,
|
||||||
|
&gEfiDevicePathProtocolGuid,
|
||||||
|
Private->DevicePath,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -822,6 +813,7 @@ Done:
|
|||||||
if (Private != NULL) {
|
if (Private != NULL) {
|
||||||
FreePool (Private);
|
FreePool (Private);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ParentDevicePath != NULL) {
|
if (ParentDevicePath != NULL) {
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
ControllerHandle,
|
ControllerHandle,
|
||||||
@ -892,7 +884,6 @@ EmuSnpDriverBindingStop (
|
|||||||
|
|
||||||
ASSERT (NumberOfChildren == 1);
|
ASSERT (NumberOfChildren == 1);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get our context back.
|
// Get our context back.
|
||||||
//
|
//
|
||||||
@ -922,8 +913,10 @@ EmuSnpDriverBindingStop (
|
|||||||
|
|
||||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
Private->DeviceHandle,
|
Private->DeviceHandle,
|
||||||
&gEfiSimpleNetworkProtocolGuid, &Private->Snp,
|
&gEfiSimpleNetworkProtocolGuid,
|
||||||
&gEfiDevicePathProtocolGuid, Private->DevicePath,
|
&Private->Snp,
|
||||||
|
&gEfiDevicePathProtocolGuid,
|
||||||
|
Private->DevicePath,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -947,7 +940,6 @@ EmuSnpDriverBindingStop (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_DRIVER_BINDING_PROTOCOL gEmuSnpDriverBinding = {
|
EFI_DRIVER_BINDING_PROTOCOL gEmuSnpDriverBinding = {
|
||||||
EmuSnpDriverBindingSupported,
|
EmuSnpDriverBindingSupported,
|
||||||
EmuSnpDriverBindingStart,
|
EmuSnpDriverBindingStart,
|
||||||
@ -957,8 +949,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuSnpDriverBinding = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This is the declaration of an EFI image entry point. This entry point is
|
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
|
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
|
||||||
|
@ -22,7 +22,6 @@ Abstract:
|
|||||||
#include <Protocol/EmuIoThunk.h>
|
#include <Protocol/EmuIoThunk.h>
|
||||||
#include <Protocol/EmuSnp.h>
|
#include <Protocol/EmuSnp.h>
|
||||||
|
|
||||||
|
|
||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
@ -52,7 +51,6 @@ typedef struct {
|
|||||||
EFI_SIMPLE_NETWORK_MODE Mode;
|
EFI_SIMPLE_NETWORK_MODE Mode;
|
||||||
|
|
||||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||||
|
|
||||||
} EMU_SNP_PRIVATE_DATA;
|
} EMU_SNP_PRIVATE_DATA;
|
||||||
|
|
||||||
#define EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS(a) \
|
#define EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS(a) \
|
||||||
|
@ -47,13 +47,13 @@ EMU_THUNK_DEVICE_PATH mEmuThunkDevicePath = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InitializeEmuThunk (
|
InitializeEmuThunk (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -74,8 +74,10 @@ Returns:
|
|||||||
Handle = NULL;
|
Handle = NULL;
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&Handle,
|
&Handle,
|
||||||
&gEmuThunkProtocolGuid, gEmuThunk,
|
&gEmuThunkProtocolGuid,
|
||||||
&gEfiDevicePathProtocolGuid, &mEmuThunkDevicePath,
|
gEmuThunk,
|
||||||
|
&gEfiDevicePathProtocolGuid,
|
||||||
|
&mEmuThunkDevicePath,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ PeimInitializeFirmwareVolumePei (
|
|||||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
@ -7,7 +7,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "PiPei.h"
|
#include "PiPei.h"
|
||||||
|
|
||||||
#include <Guid/SystemNvDataGuid.h>
|
#include <Guid/SystemNvDataGuid.h>
|
||||||
@ -27,6 +26,7 @@ PeimInitializeFlashMap (
|
|||||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
@ -67,14 +67,13 @@ EFI_FW_VOL_BLOCK_DEVICE mFvbDeviceTemplate = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
FvbVirtualddressChangeEvent (
|
FvbVirtualddressChangeEvent (
|
||||||
IN EFI_EVENT Event,
|
IN EFI_EVENT Event,
|
||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -127,6 +126,7 @@ GetFvbInstance (
|
|||||||
OUT EFI_FW_VOL_INSTANCE **FwhInstance,
|
OUT EFI_FW_VOL_INSTANCE **FwhInstance,
|
||||||
IN BOOLEAN Virtual
|
IN BOOLEAN Virtual
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -151,6 +151,7 @@ Returns:
|
|||||||
if (Instance >= Global->NumFv) {
|
if (Instance >= Global->NumFv) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find the right instance of the FVB private data
|
// Find the right instance of the FVB private data
|
||||||
//
|
//
|
||||||
@ -176,6 +177,7 @@ FvbGetPhysicalAddress (
|
|||||||
IN ESAL_FWB_GLOBAL *Global,
|
IN ESAL_FWB_GLOBAL *Global,
|
||||||
IN BOOLEAN Virtual
|
IN BOOLEAN Virtual
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -217,6 +219,7 @@ FvbGetVolumeAttributes (
|
|||||||
IN ESAL_FWB_GLOBAL *Global,
|
IN ESAL_FWB_GLOBAL *Global,
|
||||||
IN BOOLEAN Virtual
|
IN BOOLEAN Virtual
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -260,6 +263,7 @@ FvbGetLbaAddress (
|
|||||||
IN ESAL_FWB_GLOBAL *Global,
|
IN ESAL_FWB_GLOBAL *Global,
|
||||||
IN BOOLEAN Virtual
|
IN BOOLEAN Virtual
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -311,7 +315,7 @@ Returns:
|
|||||||
NumBlocks = BlockMap->NumBlocks;
|
NumBlocks = BlockMap->NumBlocks;
|
||||||
BlockLength = BlockMap->Length;
|
BlockLength = BlockMap->Length;
|
||||||
|
|
||||||
if (NumBlocks == 0 || BlockLength == 0) {
|
if ((NumBlocks == 0) || (BlockLength == 0)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,7 +324,7 @@ Returns:
|
|||||||
//
|
//
|
||||||
// The map entry found
|
// The map entry found
|
||||||
//
|
//
|
||||||
if (Lba >= StartLba && Lba < NextLba) {
|
if ((Lba >= StartLba) && (Lba < NextLba)) {
|
||||||
Offset = Offset + (UINTN)MultU64x32 ((Lba - StartLba), BlockLength);
|
Offset = Offset + (UINTN)MultU64x32 ((Lba - StartLba), BlockLength);
|
||||||
if (LbaAddress != NULL) {
|
if (LbaAddress != NULL) {
|
||||||
*LbaAddress = FwhInstance->FvBase[Virtual] + Offset;
|
*LbaAddress = FwhInstance->FvBase[Virtual] + Offset;
|
||||||
@ -353,6 +357,7 @@ FvbReadBlock (
|
|||||||
IN ESAL_FWB_GLOBAL *Global,
|
IN ESAL_FWB_GLOBAL *Global,
|
||||||
IN BOOLEAN Virtual
|
IN BOOLEAN Virtual
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -404,6 +409,7 @@ Returns:
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check if the FV is read enabled
|
// Check if the FV is read enabled
|
||||||
//
|
//
|
||||||
@ -412,6 +418,7 @@ Returns:
|
|||||||
if ((Attributes & EFI_FVB2_READ_STATUS) == 0) {
|
if ((Attributes & EFI_FVB2_READ_STATUS) == 0) {
|
||||||
return EFI_ACCESS_DENIED;
|
return EFI_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Perform boundary checks and adjust NumBytes
|
// Perform boundary checks and adjust NumBytes
|
||||||
//
|
//
|
||||||
@ -439,6 +446,7 @@ FvbWriteBlock (
|
|||||||
IN ESAL_FWB_GLOBAL *Global,
|
IN ESAL_FWB_GLOBAL *Global,
|
||||||
IN BOOLEAN Virtual
|
IN BOOLEAN Virtual
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -489,6 +497,7 @@ Returns:
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check if the FV is write enabled
|
// Check if the FV is write enabled
|
||||||
//
|
//
|
||||||
@ -497,6 +506,7 @@ Returns:
|
|||||||
if ((Attributes & EFI_FVB2_WRITE_STATUS) == 0) {
|
if ((Attributes & EFI_FVB2_WRITE_STATUS) == 0) {
|
||||||
return EFI_ACCESS_DENIED;
|
return EFI_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Perform boundary checks and adjust NumBytes
|
// Perform boundary checks and adjust NumBytes
|
||||||
//
|
//
|
||||||
@ -508,6 +518,7 @@ Returns:
|
|||||||
*NumBytes = (UINT32)(LbaLength - BlockOffset);
|
*NumBytes = (UINT32)(LbaLength - BlockOffset);
|
||||||
Status = EFI_BAD_BUFFER_SIZE;
|
Status = EFI_BAD_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Write data
|
// Write data
|
||||||
//
|
//
|
||||||
@ -523,6 +534,7 @@ FvbEraseBlock (
|
|||||||
IN ESAL_FWB_GLOBAL *Global,
|
IN ESAL_FWB_GLOBAL *Global,
|
||||||
IN BOOLEAN Virtual
|
IN BOOLEAN Virtual
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -545,7 +557,6 @@ Returns:
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
{
|
{
|
||||||
|
|
||||||
EFI_FVB_ATTRIBUTES_2 Attributes;
|
EFI_FVB_ATTRIBUTES_2 Attributes;
|
||||||
UINTN LbaAddress;
|
UINTN LbaAddress;
|
||||||
UINTN LbaLength;
|
UINTN LbaLength;
|
||||||
@ -560,6 +571,7 @@ Returns:
|
|||||||
if ((Attributes & EFI_FVB2_WRITE_STATUS) == 0) {
|
if ((Attributes & EFI_FVB2_WRITE_STATUS) == 0) {
|
||||||
return EFI_ACCESS_DENIED;
|
return EFI_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the starting address of the block for erase.
|
// Get the starting address of the block for erase.
|
||||||
//
|
//
|
||||||
@ -587,6 +599,7 @@ FvbSetVolumeAttributes (
|
|||||||
IN ESAL_FWB_GLOBAL *Global,
|
IN ESAL_FWB_GLOBAL *Global,
|
||||||
IN BOOLEAN Virtual
|
IN BOOLEAN Virtual
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -622,7 +635,6 @@ Returns:
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_FVB_ATTRIBUTES_2 UnchangedAttributes;
|
EFI_FVB_ATTRIBUTES_2 UnchangedAttributes;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find the right instance of the FVB private data
|
// Find the right instance of the FVB private data
|
||||||
//
|
//
|
||||||
@ -667,6 +679,7 @@ Returns:
|
|||||||
return EFI_ACCESS_DENIED;
|
return EFI_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test read disable
|
// Test read disable
|
||||||
//
|
//
|
||||||
@ -675,6 +688,7 @@ Returns:
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test read enable
|
// Test read enable
|
||||||
//
|
//
|
||||||
@ -683,6 +697,7 @@ Returns:
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test write disable
|
// Test write disable
|
||||||
//
|
//
|
||||||
@ -691,6 +706,7 @@ Returns:
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test write enable
|
// Test write enable
|
||||||
//
|
//
|
||||||
@ -699,6 +715,7 @@ Returns:
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test lock
|
// Test lock
|
||||||
//
|
//
|
||||||
@ -714,6 +731,7 @@ Returns:
|
|||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// FVB protocol APIs
|
// FVB protocol APIs
|
||||||
//
|
//
|
||||||
@ -723,6 +741,7 @@ FvbProtocolGetPhysicalAddress (
|
|||||||
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||||
OUT EFI_PHYSICAL_ADDRESS *Address
|
OUT EFI_PHYSICAL_ADDRESS *Address
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -756,6 +775,7 @@ FvbProtocolGetBlockSize (
|
|||||||
OUT UINTN *BlockSize,
|
OUT UINTN *BlockSize,
|
||||||
OUT UINTN *NumOfBlocks
|
OUT UINTN *NumOfBlocks
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -798,6 +818,7 @@ FvbProtocolGetAttributes (
|
|||||||
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||||
OUT EFI_FVB_ATTRIBUTES_2 *Attributes
|
OUT EFI_FVB_ATTRIBUTES_2 *Attributes
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -825,6 +846,7 @@ FvbProtocolSetAttributes (
|
|||||||
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||||
IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
|
IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -852,6 +874,7 @@ FvbProtocolEraseBlocks (
|
|||||||
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -905,7 +928,7 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Check input parameters
|
// Check input parameters
|
||||||
//
|
//
|
||||||
if (NumOfLba == 0 || (StartingLba + NumOfLba) > NumOfBlocks) {
|
if ((NumOfLba == 0) || ((StartingLba + NumOfLba) > NumOfBlocks)) {
|
||||||
VA_END (args);
|
VA_END (args);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
@ -932,7 +955,6 @@ Returns:
|
|||||||
StartingLba++;
|
StartingLba++;
|
||||||
NumOfLba--;
|
NumOfLba--;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
VA_END (args);
|
VA_END (args);
|
||||||
@ -949,6 +971,7 @@ FvbProtocolWrite (
|
|||||||
IN OUT UINTN *NumBytes,
|
IN OUT UINTN *NumBytes,
|
||||||
IN UINT8 *Buffer
|
IN UINT8 *Buffer
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -980,7 +1003,6 @@ Returns:
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
{
|
{
|
||||||
|
|
||||||
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
|
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
|
||||||
|
|
||||||
FvbDevice = FVB_DEVICE_FROM_THIS (This);
|
FvbDevice = FVB_DEVICE_FROM_THIS (This);
|
||||||
@ -997,6 +1019,7 @@ FvbProtocolRead (
|
|||||||
IN OUT UINTN *NumBytes,
|
IN OUT UINTN *NumBytes,
|
||||||
IN UINT8 *Buffer
|
IN UINT8 *Buffer
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -1029,17 +1052,18 @@ Returns:
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
{
|
{
|
||||||
|
|
||||||
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
|
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
|
||||||
|
|
||||||
FvbDevice = FVB_DEVICE_FROM_THIS (This);
|
FvbDevice = FVB_DEVICE_FROM_THIS (This);
|
||||||
|
|
||||||
return FvbReadBlock (FvbDevice->Instance, Lba, Offset, NumBytes, Buffer, mFvbModuleGlobal, EfiGoneVirtual ());
|
return FvbReadBlock (FvbDevice->Instance, Lba, Offset, NumBytes, Buffer, mFvbModuleGlobal, EfiGoneVirtual ());
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ValidateFvHeader (
|
ValidateFvHeader (
|
||||||
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
|
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -1067,9 +1091,11 @@ Returns:
|
|||||||
(FwVolHeader->Signature != EFI_FVH_SIGNATURE) ||
|
(FwVolHeader->Signature != EFI_FVH_SIGNATURE) ||
|
||||||
(FwVolHeader->FvLength == ((UINTN)-1)) ||
|
(FwVolHeader->FvLength == ((UINTN)-1)) ||
|
||||||
((FwVolHeader->HeaderLength & 0x01) != 0)
|
((FwVolHeader->HeaderLength & 0x01) != 0)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Verify the header checksum
|
// Verify the header checksum
|
||||||
//
|
//
|
||||||
@ -1095,6 +1121,7 @@ FvbInitialize (
|
|||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -1234,6 +1261,7 @@ Returns:
|
|||||||
FvHob.Raw = GET_NEXT_HOB (FvHob);
|
FvHob.Raw = GET_NEXT_HOB (FvHob);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Write healthy FV header back.
|
// Write healthy FV header back.
|
||||||
//
|
//
|
||||||
@ -1265,6 +1293,7 @@ Returns:
|
|||||||
|
|
||||||
NumOfBlocks = NumOfBlocks + PtrBlockMapEntry->NumBlocks;
|
NumOfBlocks = NumOfBlocks + PtrBlockMapEntry->NumBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// The total number of blocks in the FV.
|
// The total number of blocks in the FV.
|
||||||
//
|
//
|
||||||
@ -1329,7 +1358,6 @@ Returns:
|
|||||||
&FvbDevice->FwVolBlockInstance
|
&FvbDevice->FwVolBlockInstance
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// There was a FVB protocol on an End Device Path node
|
// 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/PcdLib.h>
|
||||||
#include <Library/DevicePathLib.h>
|
#include <Library/DevicePathLib.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT64 FvLength;
|
UINT64 FvLength;
|
||||||
EFI_FIRMWARE_VOLUME_HEADER FvbInfo;
|
EFI_FIRMWARE_VOLUME_HEADER FvbInfo;
|
||||||
|
@ -122,7 +122,6 @@ FvbInitialize (
|
|||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
FvbClassAddressChangeEvent (
|
FvbClassAddressChangeEvent (
|
||||||
|
@ -13,7 +13,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#define EFI_EMU_SYSTEM_CONFIG_GUID \
|
#define EFI_EMU_SYSTEM_CONFIG_GUID \
|
||||||
{ 0x9C4FB516, 0x3A1E, 0xD847, { 0xA1, 0xA1, 0x70, 0x58, 0xB6, 0x98, 0x67, 0x32 } }
|
{ 0x9C4FB516, 0x3A1E, 0xD847, { 0xA1, 0xA1, 0x70, 0x58, 0xB6, 0x98, 0x67, 0x32 } }
|
||||||
|
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
//
|
//
|
||||||
@ -24,7 +23,6 @@ typedef struct {
|
|||||||
} EMU_SYSTEM_CONFIGURATION;
|
} EMU_SYSTEM_CONFIGURATION;
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
|
||||||
extern EFI_GUID gEmuSystemConfigGuid;
|
extern EFI_GUID gEmuSystemConfigGuid;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,10 +10,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include <Protocol/EmuThunk.h>
|
#include <Protocol/EmuThunk.h>
|
||||||
|
|
||||||
|
|
||||||
extern EMU_THUNK_PROTOCOL *gEmuThunk;
|
extern EMU_THUNK_PROTOCOL *gEmuThunk;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Serach the EMU IO Thunk database for a matching EMU IO Thunk
|
Serach the EMU IO Thunk database for a matching EMU IO Thunk
|
||||||
Protocol instance.
|
Protocol instance.
|
||||||
@ -32,5 +30,4 @@ GetIoThunkInstance (
|
|||||||
IN UINTN Instance
|
IN UINTN Instance
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,7 +7,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include <Protocol/SimpleTextInEx.h>
|
#include <Protocol/SimpleTextInEx.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
KeyMapMake gets called on key presses.
|
KeyMapMake gets called on key presses.
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#ifndef __PPI_LIST_LIB_H__
|
#ifndef __PPI_LIST_LIB_H__
|
||||||
#define __PPI_LIST_LIB_H__
|
#define __PPI_LIST_LIB_H__
|
||||||
|
|
||||||
|
|
||||||
extern CONST EFI_PEI_PPI_DESCRIPTOR *gPpiList;
|
extern CONST EFI_PEI_PPI_DESCRIPTOR *gPpiList;
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,13 +15,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <IndustryStandard/SmBios.h>
|
#include <IndustryStandard/SmBios.h>
|
||||||
#include <Protocol/Smbios.h>
|
#include <Protocol/Smbios.h>
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Cache copy of the SMBIOS Protocol pointer
|
/// Cache copy of the SMBIOS Protocol pointer
|
||||||
///
|
///
|
||||||
extern EFI_SMBIOS_PROTOCOL *gSmbios;
|
extern EFI_SMBIOS_PROTOCOL *gSmbios;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Template for SMBIOS table initialization.
|
/// Template for SMBIOS table initialization.
|
||||||
/// The SMBIOS_TABLE_STRING types in the formated area must match the
|
/// The SMBIOS_TABLE_STRING types in the formated area must match the
|
||||||
@ -38,7 +36,6 @@ typedef struct {
|
|||||||
CHAR8 **StringArray;
|
CHAR8 **StringArray;
|
||||||
} SMBIOS_TEMPLATE_ENTRY;
|
} SMBIOS_TEMPLATE_ENTRY;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create an initial SMBIOS Table from an array of 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.
|
entries. SMBIOS_TEMPLATE_ENTRY.NULL indicates the end of the table.
|
||||||
@ -54,8 +51,6 @@ SmbiosLibInitializeFromTemplate (
|
|||||||
IN SMBIOS_TEMPLATE_ENTRY *Template
|
IN SMBIOS_TEMPLATE_ENTRY *Template
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create SMBIOS record.
|
Create SMBIOS record.
|
||||||
|
|
||||||
@ -92,7 +87,6 @@ SmbiosLibCreateEntry (
|
|||||||
IN CHAR8 **StringArray
|
IN CHAR8 **StringArray
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Update the string associated with an existing SMBIOS record.
|
Update the string associated with an existing SMBIOS record.
|
||||||
|
|
||||||
@ -155,7 +149,6 @@ SmbiosLibReadString (
|
|||||||
IN EFI_SMBIOS_STRING StringNumber
|
IN EFI_SMBIOS_STRING StringNumber
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allow the caller to discover a specific SMBIOS entry, and patch it if necissary.
|
Allow the caller to discover a specific SMBIOS entry, and patch it if necissary.
|
||||||
|
|
||||||
@ -190,7 +183,4 @@ SmbiosLibRemove (
|
|||||||
OUT EFI_SMBIOS_HANDLE SmbiosHandle
|
OUT EFI_SMBIOS_HANDLE SmbiosHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,13 +9,11 @@
|
|||||||
|
|
||||||
#include <PiPei.h>
|
#include <PiPei.h>
|
||||||
|
|
||||||
|
|
||||||
EFI_PEI_PPI_DESCRIPTOR *
|
EFI_PEI_PPI_DESCRIPTOR *
|
||||||
GetThunkPpiList (
|
GetThunkPpiList (
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AddThunkPpi (
|
AddThunkPpi (
|
||||||
@ -23,5 +21,3 @@ AddThunkPpi (
|
|||||||
IN EFI_GUID *Guid,
|
IN EFI_GUID *Guid,
|
||||||
IN VOID *Ppi
|
IN VOID *Ppi
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
#include <Protocol/EmuIoThunk.h>
|
#include <Protocol/EmuIoThunk.h>
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AddThunkProtocol (
|
AddThunkProtocol (
|
||||||
@ -25,5 +24,3 @@ GetNextThunkProtocol (
|
|||||||
IN BOOLEAN EmuBusDriver,
|
IN BOOLEAN EmuBusDriver,
|
||||||
OUT EMU_IO_THUNK_PROTOCOL **Instance
|
OUT EMU_IO_THUNK_PROTOCOL **Instance
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
#define EMU_THUNK_PPI_GUID \
|
#define EMU_THUNK_PPI_GUID \
|
||||||
{ 0xB958B78C, 0x1D3E, 0xEE40, { 0x8B, 0xF4, 0xF0, 0x63, 0x2D, 0x06, 0x39, 0x16 } }
|
{ 0xB958B78C, 0x1D3E, 0xEE40, { 0x8B, 0xF4, 0xF0, 0x63, 0x2D, 0x06, 0x39, 0x16 } }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -39,7 +37,6 @@ EFI_STATUS
|
|||||||
OUT UINT64 *MemorySize
|
OUT UINT64 *MemorySize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -66,7 +63,6 @@ EFI_STATUS
|
|||||||
IN OUT EFI_PHYSICAL_ADDRESS *FixUp
|
IN OUT EFI_PHYSICAL_ADDRESS *FixUp
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -82,8 +78,6 @@ VOID *
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -109,7 +103,6 @@ EFI_STATUS
|
|||||||
EFI_PHYSICAL_ADDRESS *EntryPoint
|
EFI_PHYSICAL_ADDRESS *EntryPoint
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EMU_PEI_AUTOSCAN MemoryAutoScan;
|
EMU_PEI_AUTOSCAN MemoryAutoScan;
|
||||||
EMU_PEI_FD_INFORMATION FirmwareDevices;
|
EMU_PEI_FD_INFORMATION FirmwareDevices;
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
|
|
||||||
typedef struct _EMU_BLOCK_IO_PROTOCOL EMU_BLOCK_IO_PROTOCOL;
|
typedef struct _EMU_BLOCK_IO_PROTOCOL EMU_BLOCK_IO_PROTOCOL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reset the block device hardware.
|
Reset the block device hardware.
|
||||||
|
|
||||||
@ -158,7 +156,6 @@ EFI_STATUS
|
|||||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token
|
IN OUT EFI_BLOCK_IO2_TOKEN *Token
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
(EFIAPI *EMU_BLOCK_CREATE_MAPPING)(
|
(EFIAPI *EMU_BLOCK_CREATE_MAPPING)(
|
||||||
@ -166,7 +163,6 @@ EFI_STATUS
|
|||||||
IN EFI_BLOCK_IO_MEDIA *Media
|
IN EFI_BLOCK_IO_MEDIA *Media
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The Block I/O2 protocol defines an extension to the Block I/O protocol which
|
/// 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
|
/// 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;
|
extern EFI_GUID gEmuBlockIoProtocolGuid;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ EFI_STATUS
|
|||||||
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
VOID
|
VOID
|
||||||
(EFIAPI *EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK)(
|
(EFIAPI *EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK)(
|
||||||
@ -76,7 +75,6 @@ EFI_STATUS
|
|||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN SourceX;
|
UINTN SourceX;
|
||||||
UINTN SourceY;
|
UINTN SourceY;
|
||||||
@ -128,7 +126,6 @@ struct _EMU_GRAPHICS_WINDOW_PROTOCOL {
|
|||||||
EMU_GRAPHICS_WINDOWS_GET_POINTER_STATE GetPointerState;
|
EMU_GRAPHICS_WINDOWS_GET_POINTER_STATE GetPointerState;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern EFI_GUID gEmuGraphicsWindowProtocolGuid;
|
extern EFI_GUID gEmuGraphicsWindowProtocolGuid;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,7 +53,6 @@ EFI_STATUS
|
|||||||
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
VOID
|
VOID
|
||||||
(EFIAPI *EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK)(
|
(EFIAPI *EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK)(
|
||||||
@ -70,7 +69,6 @@ EFI_STATUS
|
|||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN SourceX;
|
UINTN SourceX;
|
||||||
UINTN SourceY;
|
UINTN SourceY;
|
||||||
@ -122,7 +120,6 @@ struct _EMU_GRAPHICS_WINDOW_PROTOCOL {
|
|||||||
EMU_GRAPHICS_WINDOWS_GET_POINTER_STATE GetPointerState;
|
EMU_GRAPHICS_WINDOWS_GET_POINTER_STATE GetPointerState;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern EFI_GUID gEmuGraphicsWindowProtocolGuid;
|
extern EFI_GUID gEmuGraphicsWindowProtocolGuid;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,14 +10,11 @@
|
|||||||
#ifndef __EMU_IO_THUNK__
|
#ifndef __EMU_IO_THUNK__
|
||||||
#define __EMU_IO_THUNK__
|
#define __EMU_IO_THUNK__
|
||||||
|
|
||||||
|
|
||||||
#define EMU_IO_THUNK_PROTOCO_GUID \
|
#define EMU_IO_THUNK_PROTOCO_GUID \
|
||||||
{ 0x453368F6, 0x7C85, 0x434A, { 0xA9, 0x8A, 0x72, 0xD1, 0xB7, 0xFF, 0xA9, 0x26 } }
|
{ 0x453368F6, 0x7C85, 0x434A, { 0xA9, 0x8A, 0x72, 0xD1, 0xB7, 0xFF, 0xA9, 0x26 } }
|
||||||
|
|
||||||
|
|
||||||
typedef struct _EMU_IO_THUNK_PROTOCOL EMU_IO_THUNK_PROTOCOL;
|
typedef struct _EMU_IO_THUNK_PROTOCOL EMU_IO_THUNK_PROTOCOL;
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
(EFIAPI *EMU_IO_THUNK_PROTOCOL_CLOSE_OPEN)(
|
(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;
|
typedef struct _EMU_SNP_PROTOCOL EMU_SNP_PROTOCOL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Register storage for SNP Mode.
|
Register storage for SNP Mode.
|
||||||
|
|
||||||
@ -37,7 +36,6 @@ EFI_STATUS
|
|||||||
IN EFI_SIMPLE_NETWORK_MODE *Mode
|
IN EFI_SIMPLE_NETWORK_MODE *Mode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Changes the state of a network interface from "stopped" to "started".
|
Changes the state of a network interface from "stopped" to "started".
|
||||||
|
|
||||||
|
@ -11,46 +11,38 @@
|
|||||||
#ifndef __EMU_THREAD_THUNK__
|
#ifndef __EMU_THREAD_THUNK__
|
||||||
#define __EMU_THREAD_THUNK__
|
#define __EMU_THREAD_THUNK__
|
||||||
|
|
||||||
|
|
||||||
typedef struct _EMU_THREAD_THUNK_PROTOCOL EMU_THREAD_THUNK_PROTOCOL;
|
typedef struct _EMU_THREAD_THUNK_PROTOCOL EMU_THREAD_THUNK_PROTOCOL;
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
UINTN
|
UINTN
|
||||||
(EFIAPI *THREAD_THUNK_MUTEX_LOCK)(
|
(EFIAPI *THREAD_THUNK_MUTEX_LOCK)(
|
||||||
IN VOID *Mutex
|
IN VOID *Mutex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
UINTN
|
UINTN
|
||||||
(EFIAPI *THREAD_THUNK_MUTEX_UNLOCK)(
|
(EFIAPI *THREAD_THUNK_MUTEX_UNLOCK)(
|
||||||
IN VOID *Mutex
|
IN VOID *Mutex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
UINTN
|
UINTN
|
||||||
(EFIAPI *THREAD_THUNK_MUTEX_TRY_LOCK)(
|
(EFIAPI *THREAD_THUNK_MUTEX_TRY_LOCK)(
|
||||||
IN VOID *Mutex
|
IN VOID *Mutex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
VOID *
|
VOID *
|
||||||
(EFIAPI *THREAD_THUNK_MUTEX_INIT)(
|
(EFIAPI *THREAD_THUNK_MUTEX_INIT)(
|
||||||
IN VOID
|
IN VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
UINTN
|
UINTN
|
||||||
(EFIAPI *THREAD_THUNK_MUTEX_DISTROY)(
|
(EFIAPI *THREAD_THUNK_MUTEX_DISTROY)(
|
||||||
IN VOID *Mutex
|
IN VOID *Mutex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
VOID *
|
VOID *
|
||||||
(EFIAPI *THREAD_THUNK_THREAD_ENTRY)(
|
(EFIAPI *THREAD_THUNK_THREAD_ENTRY)(
|
||||||
@ -72,14 +64,12 @@ VOID
|
|||||||
IN VOID *ValuePtr
|
IN VOID *ValuePtr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
UINTN
|
UINTN
|
||||||
(EFIAPI *THREAD_THUNK_SELF)(
|
(EFIAPI *THREAD_THUNK_SELF)(
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
struct _EMU_THREAD_THUNK_PROTOCOL {
|
struct _EMU_THREAD_THUNK_PROTOCOL {
|
||||||
THREAD_THUNK_MUTEX_LOCK MutexLock;
|
THREAD_THUNK_MUTEX_LOCK MutexLock;
|
||||||
THREAD_THUNK_MUTEX_UNLOCK MutexUnlock;
|
THREAD_THUNK_MUTEX_UNLOCK MutexUnlock;
|
||||||
@ -94,4 +84,3 @@ struct _EMU_THREAD_THUNK_PROTOCOL {
|
|||||||
extern EFI_GUID gEmuThreadThunkProtocolGuid;
|
extern EFI_GUID gEmuThreadThunkProtocolGuid;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include <Protocol/EmuIoThunk.h>
|
#include <Protocol/EmuIoThunk.h>
|
||||||
#include <Protocol/DevicePath.h>
|
#include <Protocol/DevicePath.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
VENDOR_DEVICE_PATH VendorDevicePath;
|
VENDOR_DEVICE_PATH VendorDevicePath;
|
||||||
UINT32 Instance;
|
UINT32 Instance;
|
||||||
@ -32,12 +31,8 @@ typedef struct {
|
|||||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||||
} EMU_THUNK_DEVICE_PATH;
|
} EMU_THUNK_DEVICE_PATH;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _EMU_THUNK_PROTOCOL EMU_THUNK_PROTOCOL;
|
typedef struct _EMU_THUNK_PROTOCOL EMU_THUNK_PROTOCOL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
UINTN
|
UINTN
|
||||||
(EFIAPI *EMU_WRITE_STD_ERROR)(
|
(EFIAPI *EMU_WRITE_STD_ERROR)(
|
||||||
@ -71,7 +66,6 @@ BOOLEAN
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
VOID *
|
VOID *
|
||||||
(EFIAPI *EMU_OS_MALLOC)(
|
(EFIAPI *EMU_OS_MALLOC)(
|
||||||
@ -90,7 +84,6 @@ BOOLEAN
|
|||||||
IN VOID *Ptr
|
IN VOID *Ptr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
(EFIAPI *EMU_PE_COFF_GET_ENTRY_POINT)(
|
(EFIAPI *EMU_PE_COFF_GET_ENTRY_POINT)(
|
||||||
@ -165,7 +158,6 @@ VOID
|
|||||||
IN EFI_TIME *Time
|
IN EFI_TIME *Time
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
VOID
|
VOID
|
||||||
(EFIAPI EMU_SET_TIMER_CALLBACK)(
|
(EFIAPI EMU_SET_TIMER_CALLBACK)(
|
||||||
@ -179,8 +171,6 @@ VOID
|
|||||||
IN EMU_SET_TIMER_CALLBACK CallBack
|
IN EMU_SET_TIMER_CALLBACK CallBack
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enumerates the current set of protocol instances that abstract OS services from EFI.
|
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
|
OUT EMU_IO_THUNK_PROTOCOL **Instance OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
struct _EMU_THUNK_PROTOCOL {
|
struct _EMU_THUNK_PROTOCOL {
|
||||||
// Used for early debug printing
|
// Used for early debug printing
|
||||||
EMU_WRITE_STD_ERROR WriteStdErr;
|
EMU_WRITE_STD_ERROR WriteStdErr;
|
||||||
@ -224,7 +213,6 @@ struct _EMU_THUNK_PROTOCOL {
|
|||||||
EMU_OS_VMALLOC Valloc;
|
EMU_OS_VMALLOC Valloc;
|
||||||
EMU_OS_FREE Free;
|
EMU_OS_FREE Free;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// PE/COFF loader hooks to get symbols loaded
|
/// PE/COFF loader hooks to get symbols loaded
|
||||||
///
|
///
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/DevicePathLib.h>
|
#include <Library/DevicePathLib.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts a Vendor device path structure to its string representative.
|
Converts a Vendor device path structure to its string representative.
|
||||||
|
|
||||||
@ -52,18 +51,22 @@ DevPathToTextVendorLib (
|
|||||||
CatPrint (Str, L"EmuThunk()");
|
CatPrint (Str, L"EmuThunk()");
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuGraphicsWindowProtocolGuid)) {
|
if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuGraphicsWindowProtocolGuid)) {
|
||||||
CatPrint (Str, L"EmuGraphics(%d)", Vendor->Instance);
|
CatPrint (Str, L"EmuGraphics(%d)", Vendor->Instance);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEfiSimpleFileSystemProtocolGuid)) {
|
if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEfiSimpleFileSystemProtocolGuid)) {
|
||||||
CatPrint (Str, L"EmuFs(%d)", Vendor->Instance);
|
CatPrint (Str, L"EmuFs(%d)", Vendor->Instance);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuBlockIoProtocolGuid)) {
|
if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuBlockIoProtocolGuid)) {
|
||||||
CatPrint (Str, L"EmuBlk(%d)", Vendor->Instance);
|
CatPrint (Str, L"EmuBlk(%d)", Vendor->Instance);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuThreadThunkProtocolGuid)) {
|
if (CompareGuid (&Vendor->VendorDevicePath.Guid, &gEmuThreadThunkProtocolGuid)) {
|
||||||
CatPrint (Str, L"EmuThread()");
|
CatPrint (Str, L"EmuThread()");
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
#include <Protocol/Timer.h>
|
#include <Protocol/Timer.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stalls the CPU for at least the given number of microseconds.
|
Stalls the CPU for at least the given number of microseconds.
|
||||||
|
|
||||||
@ -37,7 +35,6 @@ MicroSecondDelay (
|
|||||||
return NanoSecondDelay (MicroSeconds * 1000);
|
return NanoSecondDelay (MicroSeconds * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stalls the CPU for at least the given number of nanoseconds.
|
Stalls the CPU for at least the given number of nanoseconds.
|
||||||
|
|
||||||
@ -58,7 +55,6 @@ NanoSecondDelay (
|
|||||||
return NanoSeconds;
|
return NanoSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves the current value of a 64-bit free running performance counter.
|
Retrieves the current value of a 64-bit free running performance counter.
|
||||||
|
|
||||||
@ -109,10 +105,10 @@ GetPerformanceCounterProperties (
|
|||||||
OUT UINT64 *EndValue OPTIONAL
|
OUT UINT64 *EndValue OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (StartValue != NULL) {
|
if (StartValue != NULL) {
|
||||||
*StartValue = 0ULL;
|
*StartValue = 0ULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EndValue != NULL) {
|
if (EndValue != NULL) {
|
||||||
*EndValue = (UINT64)-1LL;
|
*EndValue = (UINT64)-1LL;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
EMU_THUNK_PROTOCOL *gEmuThunk = NULL;
|
EMU_THUNK_PROTOCOL *gEmuThunk = NULL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The constructor function caches the pointer of EMU Thunk protocol.
|
The constructor function caches the pointer of EMU Thunk protocol.
|
||||||
|
|
||||||
@ -43,7 +42,6 @@ DxeEmuLibConstructor (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Serach the EMU IO Thunk database for a matching EMU IO Thunk
|
Serach the EMU IO Thunk database for a matching EMU IO Thunk
|
||||||
Protocol instance.
|
Protocol instance.
|
||||||
|
@ -25,7 +25,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
//
|
//
|
||||||
EMU_THUNK_PROTOCOL *mThunk = NULL;
|
EMU_THUNK_PROTOCOL *mThunk = NULL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The constructor function gets the pointer of the WinNT thunk functions
|
The constructor function gets the pointer of the WinNT thunk functions
|
||||||
It will ASSERT() if Unix thunk protocol is not installed.
|
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
|
Performs additional actions just before a PE/COFF image is unloaded. Any resources
|
||||||
that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.
|
that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.
|
||||||
|
@ -8,14 +8,10 @@
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include <PiDxe.h>
|
#include <PiDxe.h>
|
||||||
#include <Library/SerialPortLib.h>
|
#include <Library/SerialPortLib.h>
|
||||||
#include <Library/EmuThunkLib.h>
|
#include <Library/EmuThunkLib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize the serial device hardware.
|
Initialize the serial device hardware.
|
||||||
|
|
||||||
@ -63,7 +59,6 @@ SerialPortWrite (
|
|||||||
return gEmuThunk->WriteStdOut (Buffer, NumberOfBytes);
|
return gEmuThunk->WriteStdOut (Buffer, NumberOfBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read data from serial device and save the datas in buffer.
|
Read data from serial device and save the datas in buffer.
|
||||||
|
|
||||||
@ -149,6 +144,7 @@ SerialPortGetControl (
|
|||||||
if (!SerialPortPoll ()) {
|
if (!SerialPortPoll ()) {
|
||||||
*Control = EFI_SERIAL_INPUT_BUFFER_EMPTY;
|
*Control = EFI_SERIAL_INPUT_BUFFER_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_SUCCESS;
|
return RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,4 +194,3 @@ SerialPortSetAttributes (
|
|||||||
{
|
{
|
||||||
return RETURN_UNSUPPORTED;
|
return RETURN_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,14 +8,10 @@
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include <PiDxe.h>
|
#include <PiDxe.h>
|
||||||
#include <Library/SerialPortLib.h>
|
#include <Library/SerialPortLib.h>
|
||||||
#include <Library/EmuThunkLib.h>
|
#include <Library/EmuThunkLib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize the serial device hardware.
|
Initialize the serial device hardware.
|
||||||
|
|
||||||
@ -67,7 +63,6 @@ SerialPortWrite (
|
|||||||
return gEmuThunk->WriteStdErr (Buffer, NumberOfBytes);
|
return gEmuThunk->WriteStdErr (Buffer, NumberOfBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read data from serial device and save the datas in buffer.
|
Read data from serial device and save the datas in buffer.
|
||||||
|
|
||||||
@ -113,5 +108,3 @@ SerialPortPoll (
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include <Protocol/Timer.h>
|
#include <Protocol/Timer.h>
|
||||||
|
|
||||||
|
|
||||||
STATIC UINT64 gTimerPeriod = 0;
|
STATIC UINT64 gTimerPeriod = 0;
|
||||||
STATIC EFI_TIMER_ARCH_PROTOCOL *gTimerAp = NULL;
|
STATIC EFI_TIMER_ARCH_PROTOCOL *gTimerAp = NULL;
|
||||||
STATIC EFI_EVENT gTimerEvent = NULL;
|
STATIC EFI_EVENT gTimerEvent = NULL;
|
||||||
@ -46,8 +45,6 @@ RegisterTimerArchProtocol (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stalls the CPU for at least the given number of microseconds.
|
Stalls the CPU for at least the given number of microseconds.
|
||||||
|
|
||||||
@ -67,7 +64,6 @@ MicroSecondDelay (
|
|||||||
return NanoSecondDelay (MicroSeconds * 1000);
|
return NanoSecondDelay (MicroSeconds * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stalls the CPU for at least the given number of nanoseconds.
|
Stalls the CPU for at least the given number of nanoseconds.
|
||||||
|
|
||||||
@ -90,7 +86,8 @@ NanoSecondDelay (
|
|||||||
|
|
||||||
if ((gTimerPeriod != 0) &&
|
if ((gTimerPeriod != 0) &&
|
||||||
((UINT64)NanoSeconds > gTimerPeriod) &&
|
((UINT64)NanoSeconds > gTimerPeriod) &&
|
||||||
(EfiGetCurrentTpl () == TPL_APPLICATION)) {
|
(EfiGetCurrentTpl () == TPL_APPLICATION))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// This stall is long, so use gBS->WaitForEvent () to yield CPU to DXE Core
|
// 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);
|
Status = gBS->WaitForEvent (sizeof (gTimerEvent)/sizeof (EFI_EVENT), &gTimerEvent, &Index);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
gEmuThunk->Sleep (NanoSeconds);
|
gEmuThunk->Sleep (NanoSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NanoSeconds;
|
return NanoSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves the current value of a 64-bit free running performance counter.
|
Retrieves the current value of a 64-bit free running performance counter.
|
||||||
|
|
||||||
@ -159,10 +155,10 @@ GetPerformanceCounterProperties (
|
|||||||
OUT UINT64 *EndValue OPTIONAL
|
OUT UINT64 *EndValue OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (StartValue != NULL) {
|
if (StartValue != NULL) {
|
||||||
*StartValue = 0ULL;
|
*StartValue = 0ULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EndValue != NULL) {
|
if (EndValue != NULL) {
|
||||||
*EndValue = (UINT64)-1LL;
|
*EndValue = (UINT64)-1LL;
|
||||||
}
|
}
|
||||||
@ -170,7 +166,6 @@ GetPerformanceCounterProperties (
|
|||||||
return gEmuThunk->QueryPerformanceFrequency ();
|
return gEmuThunk->QueryPerformanceFrequency ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Register for the Timer AP protocol.
|
Register for the Timer AP protocol.
|
||||||
|
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
|
|
||||||
|
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
@ -195,6 +193,7 @@ InternalAllocateAlignedPages (
|
|||||||
if (Pages == 0) {
|
if (Pages == 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Alignment > EFI_PAGE_SIZE) {
|
if (Alignment > EFI_PAGE_SIZE) {
|
||||||
//
|
//
|
||||||
// Caculate the total number of pages since alignment is larger than page size.
|
// Caculate the total number of pages since alignment is larger than page size.
|
||||||
@ -210,6 +209,7 @@ InternalAllocateAlignedPages (
|
|||||||
if (Memory != NULL) {
|
if (Memory != NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
AlignedMemory = ((UINTN)Memory + AlignmentMask) & ~AlignmentMask;
|
AlignedMemory = ((UINTN)Memory + AlignmentMask) & ~AlignmentMask;
|
||||||
UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN)Memory);
|
UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN)Memory);
|
||||||
if (UnalignedPages > 0) {
|
if (UnalignedPages > 0) {
|
||||||
@ -218,6 +218,7 @@ InternalAllocateAlignedPages (
|
|||||||
//
|
//
|
||||||
FreePages (Memory, UnalignedPages);
|
FreePages (Memory, UnalignedPages);
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory = (VOID *)(AlignedMemory + EFI_PAGES_TO_SIZE (Pages));
|
Memory = (VOID *)(AlignedMemory + EFI_PAGES_TO_SIZE (Pages));
|
||||||
UnalignedPages = RealPages - Pages - UnalignedPages;
|
UnalignedPages = RealPages - Pages - UnalignedPages;
|
||||||
if (UnalignedPages > 0) {
|
if (UnalignedPages > 0) {
|
||||||
@ -234,8 +235,10 @@ InternalAllocateAlignedPages (
|
|||||||
if (Memory != NULL) {
|
if (Memory != NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
AlignedMemory = (UINTN)Memory;
|
AlignedMemory = (UINTN)Memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (VOID *)AlignedMemory;
|
return (VOID *)AlignedMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,6 +461,7 @@ InternalAllocateZeroPool (
|
|||||||
if (Memory != NULL) {
|
if (Memory != NULL) {
|
||||||
Memory = ZeroMem (Memory, AllocationSize);
|
Memory = ZeroMem (Memory, AllocationSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Memory;
|
return Memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,6 +564,7 @@ InternalAllocateCopyPool (
|
|||||||
if (Memory != NULL) {
|
if (Memory != NULL) {
|
||||||
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Memory;
|
return Memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,10 +682,11 @@ InternalReallocatePool (
|
|||||||
VOID *NewBuffer;
|
VOID *NewBuffer;
|
||||||
|
|
||||||
NewBuffer = InternalAllocateZeroPool (PoolType, NewSize);
|
NewBuffer = InternalAllocateZeroPool (PoolType, NewSize);
|
||||||
if (NewBuffer != NULL && OldBuffer != NULL) {
|
if ((NewBuffer != NULL) && (OldBuffer != NULL)) {
|
||||||
CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
|
CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
|
||||||
FreePool (OldBuffer);
|
FreePool (OldBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewBuffer;
|
return NewBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,4 +816,3 @@ FreePool (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
#include <Protocol/SimpleTextInEx.h>
|
#include <Protocol/SimpleTextInEx.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
KeyMapMake gets called on key presses.
|
KeyMapMake gets called on key presses.
|
||||||
|
|
||||||
|
@ -58,7 +58,6 @@ GetPeiServicesTablePointer (
|
|||||||
return gPeiServices;
|
return gPeiServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The constructor function caches the pointer to PEI services.
|
The constructor function caches the pointer to PEI services.
|
||||||
|
|
||||||
@ -108,4 +107,3 @@ MigratePeiServicesTablePointer (
|
|||||||
//
|
//
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ EmuPeCoffGetThunkStucture (
|
|||||||
EMU_THUNK_PPI *ThunkPpi;
|
EMU_THUNK_PPI *ThunkPpi;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Locate Unix ThunkPpi for retrieving standard output handle
|
// Locate Unix ThunkPpi for retrieving standard output handle
|
||||||
//
|
//
|
||||||
@ -74,10 +73,10 @@ PeCoffLoaderRelocateImageExtraAction (
|
|||||||
if (EMU_MAGIC_PAGE ()->Thunk == NULL) {
|
if (EMU_MAGIC_PAGE ()->Thunk == NULL) {
|
||||||
EmuPeCoffGetThunkStucture ();
|
EmuPeCoffGetThunkStucture ();
|
||||||
}
|
}
|
||||||
|
|
||||||
EMU_MAGIC_PAGE ()->Thunk->PeCoffRelocateImageExtraAction (ImageContext);
|
EMU_MAGIC_PAGE ()->Thunk->PeCoffRelocateImageExtraAction (ImageContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs additional actions just before a PE/COFF image is unloaded. Any resources
|
Performs additional actions just before a PE/COFF image is unloaded. Any resources
|
||||||
that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.
|
that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.
|
||||||
@ -97,5 +96,6 @@ PeCoffLoaderUnloadImageExtraAction (
|
|||||||
if (EMU_MAGIC_PAGE ()->Thunk == NULL) {
|
if (EMU_MAGIC_PAGE ()->Thunk == NULL) {
|
||||||
EmuPeCoffGetThunkStucture ();
|
EmuPeCoffGetThunkStucture ();
|
||||||
}
|
}
|
||||||
|
|
||||||
EMU_MAGIC_PAGE ()->Thunk->PeCoffUnloadImageExtraAction (ImageContext);
|
EMU_MAGIC_PAGE ()->Thunk->PeCoffUnloadImageExtraAction (ImageContext);
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Ppi/EmuThunk.h>
|
#include <Ppi/EmuThunk.h>
|
||||||
#include <Protocol/EmuThunk.h>
|
#include <Protocol/EmuThunk.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves and returns a pointer to the entry point to a PE/COFF image that has been loaded
|
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.
|
into system memory with the PE/COFF Loader Library functions.
|
||||||
@ -87,7 +85,6 @@ PeCoffLoaderGetMachineType (
|
|||||||
DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
|
DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
|
||||||
if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
|
if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
|
||||||
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + (UINTN)((DosHdr->e_lfanew) & 0x0ffff));
|
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + (UINTN)((DosHdr->e_lfanew) & 0x0ffff));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(Pe32Data);
|
Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(Pe32Data);
|
||||||
}
|
}
|
||||||
@ -215,7 +212,7 @@ PeCoffLoaderGetPdbPointer (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DebugEntry == NULL || DirectoryEntry == NULL) {
|
if ((DebugEntry == NULL) || (DirectoryEntry == NULL)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +237,6 @@ PeCoffLoaderGetPdbPointer (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the size of the PE/COFF headers
|
Returns the size of the PE/COFF headers
|
||||||
|
|
||||||
@ -288,4 +284,3 @@ PeCoffGetSizeOfHeaders (
|
|||||||
|
|
||||||
return (UINT32)SizeOfHeaders;
|
return (UINT32)SizeOfHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include <PiPei.h>
|
#include <PiPei.h>
|
||||||
#include <Library/SerialPortLib.h>
|
#include <Library/SerialPortLib.h>
|
||||||
#include <Library/PeiServicesLib.h>
|
#include <Library/PeiServicesLib.h>
|
||||||
@ -17,8 +16,6 @@
|
|||||||
#include <Ppi/EmuThunk.h>
|
#include <Ppi/EmuThunk.h>
|
||||||
#include <Protocol/EmuThunk.h>
|
#include <Protocol/EmuThunk.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize the serial device hardware.
|
Initialize the serial device hardware.
|
||||||
|
|
||||||
@ -84,7 +81,6 @@ SerialPortWrite (
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read data from serial device and save the datas in buffer.
|
Read data from serial device and save the datas in buffer.
|
||||||
|
|
||||||
@ -130,4 +126,3 @@ SerialPortPoll (
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include <Ppi/MemoryDiscovered.h>
|
#include <Ppi/MemoryDiscovered.h>
|
||||||
|
|
||||||
|
|
||||||
CONST EFI_PEI_SERVICES **gPeiServices = NULL;
|
CONST EFI_PEI_SERVICES **gPeiServices = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,8 +63,6 @@ GetPeiServicesTablePointer (
|
|||||||
return gPeiServices;
|
return gPeiServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Notification service to be called when gEmuThunkPpiGuid is installed.
|
Notification service to be called when gEmuThunkPpiGuid is installed.
|
||||||
|
|
||||||
@ -91,14 +88,12 @@ PeiServicesTablePointerNotifyCallback (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_PEI_NOTIFY_DESCRIPTOR mNotifyOnThunkList = {
|
EFI_PEI_NOTIFY_DESCRIPTOR mNotifyOnThunkList = {
|
||||||
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||||
&gEfiPeiMemoryDiscoveredPpiGuid,
|
&gEfiPeiMemoryDiscoveredPpiGuid,
|
||||||
PeiServicesTablePointerNotifyCallback
|
PeiServicesTablePointerNotifyCallback
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructor register notification on when PPI updates. If PPI is
|
Constructor register notification on when PPI updates. If PPI is
|
||||||
alreay installed registering the notify will cause the handle to
|
alreay installed registering the notify will cause the handle to
|
||||||
@ -153,4 +148,3 @@ MigratePeiServicesTablePointer (
|
|||||||
//
|
//
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/EmuMagicPageLib.h>
|
#include <Library/EmuMagicPageLib.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Caches a pointer PEI Services Table.
|
Caches a pointer PEI Services Table.
|
||||||
|
|
||||||
@ -91,5 +90,3 @@ MigratePeiServicesTablePointer (
|
|||||||
//
|
//
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,6 +157,7 @@ GetPerformanceCounterProperties (
|
|||||||
if (StartValue != NULL) {
|
if (StartValue != NULL) {
|
||||||
*StartValue = 0ULL;
|
*StartValue = 0ULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EndValue != NULL) {
|
if (EndValue != NULL) {
|
||||||
*EndValue = (UINT64)-1LL;
|
*EndValue = (UINT64)-1LL;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,6 @@ FvFilePath (
|
|||||||
EFI_GUID *FileGuid
|
EFI_GUID *FileGuid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||||
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;
|
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;
|
||||||
@ -348,6 +347,7 @@ BootOptionPriority (
|
|||||||
if (StrCmp (BootOption->Description, L"UEFI Shell") == 0) {
|
if (StrCmp (BootOption->Description, L"UEFI Shell") == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,13 +377,11 @@ PlatformBootManagerAfterConsole (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
//
|
//
|
||||||
// Go the different platform policy with different boot mode
|
// Go the different platform policy with different boot mode
|
||||||
// Notes: this part code can be change with the table policy
|
// Notes: this part code can be change with the table policy
|
||||||
//
|
//
|
||||||
switch (GetBootModeHob ()) {
|
switch (GetBootModeHob ()) {
|
||||||
|
|
||||||
case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
|
case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
|
||||||
case BOOT_WITH_MINIMAL_CONFIGURATION:
|
case BOOT_WITH_MINIMAL_CONFIGURATION:
|
||||||
PlatformBdsDiagnostics (IGNORE, TRUE);
|
PlatformBdsDiagnostics (IGNORE, TRUE);
|
||||||
@ -456,4 +454,3 @@ PlatformBootManagerUnableToBoot (
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,14 +56,12 @@ extern BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
|
|||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EMU_VENDOR_DEVICE_PATH_NODE EmuBus;
|
EMU_VENDOR_DEVICE_PATH_NODE EmuBus;
|
||||||
EMU_VENDOR_DEVICE_PATH_NODE EmuGraphicsWindow;
|
EMU_VENDOR_DEVICE_PATH_NODE EmuGraphicsWindow;
|
||||||
EFI_DEVICE_PATH_PROTOCOL End;
|
EFI_DEVICE_PATH_PROTOCOL End;
|
||||||
} EMU_PLATFORM_UGA_DEVICE_PATH;
|
} EMU_PLATFORM_UGA_DEVICE_PATH;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Platform BDS Functions
|
// Platform BDS Functions
|
||||||
//
|
//
|
||||||
@ -83,7 +81,6 @@ PlatformBootManagerMemoryTest (
|
|||||||
IN EXTENDMEM_COVERAGE_LEVEL Level
|
IN EXTENDMEM_COVERAGE_LEVEL Level
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
PlatformBdsConnectSequence (
|
PlatformBdsConnectSequence (
|
||||||
VOID
|
VOID
|
||||||
|
@ -8,8 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "PlatformBm.h"
|
#include "PlatformBm.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EMU_PLATFORM_UGA_DEVICE_PATH gGopDevicePath = {
|
EMU_PLATFORM_UGA_DEVICE_PATH gGopDevicePath = {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -91,4 +89,3 @@ BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = {
|
|||||||
0
|
0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,7 +88,6 @@ PlatformBootManagerMemoryTest (
|
|||||||
ASSERT (0);
|
ASSERT (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "Perform memory test (ESC to skip).\n"));
|
DEBUG ((DEBUG_INFO, "Perform memory test (ESC to skip).\n"));
|
||||||
|
|
||||||
if (!PcdGetBool (PcdConInConnectOnDemand)) {
|
if (!PcdGetBool (PcdConInConnectOnDemand)) {
|
||||||
|
@ -59,14 +59,16 @@ GetRedfishCredential (
|
|||||||
//
|
//
|
||||||
UserIdSize = AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdRedfishServieUserId));
|
UserIdSize = AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdRedfishServieUserId));
|
||||||
PasswordSize = AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdRedfishServiePassword));
|
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"));
|
DEBUG ((DEBUG_ERROR, "Incorrect string of UserID or Password for REdfish service.\n"));
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
*UserId = AllocateZeroPool (UserIdSize);
|
*UserId = AllocateZeroPool (UserIdSize);
|
||||||
if (*UserId == NULL) {
|
if (*UserId == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (*UserId, (CHAR8 *)PcdGetPtr (PcdRedfishServieUserId), UserIdSize);
|
CopyMem (*UserId, (CHAR8 *)PcdGetPtr (PcdRedfishServieUserId), UserIdSize);
|
||||||
|
|
||||||
*Password = AllocateZeroPool (PasswordSize);
|
*Password = AllocateZeroPool (PasswordSize);
|
||||||
@ -114,7 +116,7 @@ LibCredentialGetAuthInfo (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
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;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +126,7 @@ LibCredentialGetAuthInfo (
|
|||||||
|
|
||||||
if (mSecureBootDisabled) {
|
if (mSecureBootDisabled) {
|
||||||
Status = LibStopRedfishService (This, ServiceStopTypeSecureBootDisabled);
|
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));
|
DEBUG ((DEBUG_ERROR, "SecureBoot has been disabled, but failed to stop RedfishService - %r\n", Status));
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -193,8 +195,10 @@ LibStopRedfishService (
|
|||||||
mStopRedfishService = TRUE;
|
mStopRedfishService = TRUE;
|
||||||
DEBUG ((DEBUG_INFO, "EFI Redfish service is stopped without Redfish service stop type!!\n"));
|
DEBUG ((DEBUG_INFO, "EFI Redfish service is stopped without Redfish service stop type!!\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Notification of Exit Boot Service.
|
Notification of Exit Boot Service.
|
||||||
|
|
||||||
|
@ -51,9 +51,10 @@ GetMacAddressInformation (
|
|||||||
RestExServiceDevicePath = NULL;
|
RestExServiceDevicePath = NULL;
|
||||||
|
|
||||||
RestExServiceDevicePathData = (REST_EX_SERVICE_DEVICE_PATH_DATA *)PcdGetPtr (PcdRedfishRestExServiceDevicePath);
|
RestExServiceDevicePathData = (REST_EX_SERVICE_DEVICE_PATH_DATA *)PcdGetPtr (PcdRedfishRestExServiceDevicePath);
|
||||||
if (RestExServiceDevicePathData == NULL ||
|
if ((RestExServiceDevicePathData == NULL) ||
|
||||||
RestExServiceDevicePathData->DevicePathNum == 0 ||
|
(RestExServiceDevicePathData->DevicePathNum == 0) ||
|
||||||
!IsDevicePathValid (RestExServiceDevicePathData->DevicePath, 0)) {
|
!IsDevicePathValid (RestExServiceDevicePathData->DevicePath, 0))
|
||||||
|
{
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +68,8 @@ GetMacAddressInformation (
|
|||||||
//
|
//
|
||||||
while (!IsDevicePathEnd (RestExServiceDevicePath) &&
|
while (!IsDevicePathEnd (RestExServiceDevicePath) &&
|
||||||
((DevicePathType (RestExServiceDevicePath) != MESSAGING_DEVICE_PATH) ||
|
((DevicePathType (RestExServiceDevicePath) != MESSAGING_DEVICE_PATH) ||
|
||||||
(DevicePathSubType (RestExServiceDevicePath) != MSG_MAC_ADDR_DP))) {
|
(DevicePathSubType (RestExServiceDevicePath) != MSG_MAC_ADDR_DP)))
|
||||||
|
{
|
||||||
RestExServiceDevicePath = NextDevicePathNode (RestExServiceDevicePath);
|
RestExServiceDevicePath = NextDevicePathNode (RestExServiceDevicePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +78,7 @@ GetMacAddressInformation (
|
|||||||
CopyMem ((VOID *)MacAddress, (VOID *)&MacAddressDevicePath->MacAddress, sizeof (EFI_MAC_ADDRESS));
|
CopyMem ((VOID *)MacAddress, (VOID *)&MacAddressDevicePath->MacAddress, sizeof (EFI_MAC_ADDRESS));
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,6 +107,7 @@ RedfishPlatformHostInterfaceDeviceDescriptor (
|
|||||||
if (RedfishInterfaceData == NULL) {
|
if (RedfishInterfaceData == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
RedfishInterfaceData->DeviceType = REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2;
|
RedfishInterfaceData->DeviceType = REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2;
|
||||||
//
|
//
|
||||||
// Fill up device type information.
|
// Fill up device type information.
|
||||||
@ -115,11 +119,13 @@ RedfishPlatformHostInterfaceDeviceDescriptor (
|
|||||||
FreePool (RedfishInterfaceData);
|
FreePool (RedfishInterfaceData);
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem ((VOID *)&ThisDeviceDescriptor->MacAddress, (VOID *)&MacAddress, sizeof (ThisDeviceDescriptor->MacAddress));
|
CopyMem ((VOID *)&ThisDeviceDescriptor->MacAddress, (VOID *)&MacAddress, sizeof (ThisDeviceDescriptor->MacAddress));
|
||||||
*DeviceType = REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2;
|
*DeviceType = REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2;
|
||||||
*DeviceDescriptor = RedfishInterfaceData;
|
*DeviceDescriptor = RedfishInterfaceData;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get platform Redfish host interface protocol data.
|
Get platform Redfish host interface protocol data.
|
||||||
Caller should pass NULL in ProtocolRecord to retrive the first protocol record.
|
Caller should pass NULL in ProtocolRecord to retrive the first protocol record.
|
||||||
@ -145,6 +151,7 @@ RedfishPlatformHostInterfaceProtocolData (
|
|||||||
if (mRedfishOverIpProtocolData == 0) {
|
if (mRedfishOverIpProtocolData == 0) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IndexOfProtocolData == 0) {
|
if (IndexOfProtocolData == 0) {
|
||||||
//
|
//
|
||||||
// Return the first Redfish protocol data to caller. We only have
|
// Return the first Redfish protocol data to caller. We only have
|
||||||
@ -157,8 +164,10 @@ RedfishPlatformHostInterfaceProtocolData (
|
|||||||
*ProtocolRecord = ThisProtocolRecord;
|
*ProtocolRecord = ThisProtocolRecord;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Dump IPv4 address.
|
Dump IPv4 address.
|
||||||
|
|
||||||
@ -180,6 +189,7 @@ InternalDumpIp4Addr (
|
|||||||
|
|
||||||
DEBUG ((DEBUG_VERBOSE, "\n"));
|
DEBUG ((DEBUG_VERBOSE, "\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Dump IPv6 address.
|
Dump IPv6 address.
|
||||||
|
|
||||||
@ -196,6 +206,7 @@ InternalDumpIp6Addr (
|
|||||||
if (Ip->Addr[Index] != 0) {
|
if (Ip->Addr[Index] != 0) {
|
||||||
DEBUG ((DEBUG_VERBOSE, "%x", Ip->Addr[Index]));
|
DEBUG ((DEBUG_VERBOSE, "%x", Ip->Addr[Index]));
|
||||||
}
|
}
|
||||||
|
|
||||||
Index++;
|
Index++;
|
||||||
|
|
||||||
if (Index > 15) {
|
if (Index > 15) {
|
||||||
@ -205,14 +216,17 @@ InternalDumpIp6Addr (
|
|||||||
if (((Ip->Addr[Index] & 0xf0) == 0) && (Ip->Addr[Index - 1] != 0)) {
|
if (((Ip->Addr[Index] & 0xf0) == 0) && (Ip->Addr[Index - 1] != 0)) {
|
||||||
DEBUG ((DEBUG_VERBOSE, "0"));
|
DEBUG ((DEBUG_VERBOSE, "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG ((DEBUG_VERBOSE, "%x", Ip->Addr[Index]));
|
DEBUG ((DEBUG_VERBOSE, "%x", Ip->Addr[Index]));
|
||||||
|
|
||||||
if (Index < 15) {
|
if (Index < 15) {
|
||||||
DEBUG ((DEBUG_VERBOSE, ":"));
|
DEBUG ((DEBUG_VERBOSE, ":"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG ((DEBUG_VERBOSE, "\n"));
|
DEBUG ((DEBUG_VERBOSE, "\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Dump data
|
Dump data
|
||||||
|
|
||||||
@ -226,10 +240,12 @@ InternalDumpData (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
for (Index = 0; Index < Size; Index++) {
|
for (Index = 0; Index < Size; Index++) {
|
||||||
DEBUG ((DEBUG_VERBOSE, "%02x ", (UINTN)Data[Index]));
|
DEBUG ((DEBUG_VERBOSE, "%02x ", (UINTN)Data[Index]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Dump hex data
|
Dump hex data
|
||||||
|
|
||||||
@ -260,6 +276,7 @@ InternalDumpHex (
|
|||||||
|
|
||||||
DEBUG ((DEBUG_VERBOSE, "\n"));
|
DEBUG ((DEBUG_VERBOSE, "\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Dump Redfish over IP protocol data
|
Dump Redfish over IP protocol data
|
||||||
|
|
||||||
@ -354,7 +371,7 @@ GetRedfishRecordFromVariable (
|
|||||||
UINT8 HostNameSize;
|
UINT8 HostNameSize;
|
||||||
CHAR8 RedfishHostName[20];
|
CHAR8 RedfishHostName[20];
|
||||||
|
|
||||||
if (RedfishProtocolData == NULL || RedfishProtocolDataSize == NULL) {
|
if ((RedfishProtocolData == NULL) || (RedfishProtocolDataSize == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,5 +541,6 @@ RedfishPlatformHostInterfaceConstructor (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
DumpRedfishIpProtocolData (mRedfishOverIpProtocolData, mRedfishProtocolDataSize);
|
DumpRedfishIpProtocolData (mRedfishOverIpProtocolData, mRedfishProtocolDataSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include <PiPei.h>
|
#include <PiPei.h>
|
||||||
|
|
||||||
|
|
||||||
#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
|
#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
|
||||||
(ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))
|
(ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))
|
||||||
|
|
||||||
@ -18,6 +17,7 @@ GetFileState (
|
|||||||
IN UINT8 ErasePolarity,
|
IN UINT8 ErasePolarity,
|
||||||
IN EFI_FFS_FILE_HEADER *FfsHeader
|
IN EFI_FFS_FILE_HEADER *FfsHeader
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -54,6 +54,7 @@ UINT8
|
|||||||
CalculateHeaderChecksum (
|
CalculateHeaderChecksum (
|
||||||
IN EFI_FFS_FILE_HEADER *FileHeader
|
IN EFI_FFS_FILE_HEADER *FileHeader
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -84,6 +85,7 @@ Returns:
|
|||||||
for ( ; Index < sizeof (EFI_FFS_FILE_HEADER); Index++) {
|
for ( ; Index < sizeof (EFI_FFS_FILE_HEADER); Index++) {
|
||||||
Sum = (UINT8)(Sum + ptr[Index]);
|
Sum = (UINT8)(Sum + ptr[Index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// State field (since this indicates the different state of file).
|
// State field (since this indicates the different state of file).
|
||||||
//
|
//
|
||||||
@ -102,6 +104,7 @@ SecFfsFindNextFile (
|
|||||||
IN EFI_PEI_FV_HANDLE FvHandle,
|
IN EFI_PEI_FV_HANDLE FvHandle,
|
||||||
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
|
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -146,6 +149,7 @@ Returns:
|
|||||||
} else {
|
} else {
|
||||||
ErasePolarity = 0;
|
ErasePolarity = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If FileHeader is not specified (NULL) start with the first file in the
|
// If FileHeader is not specified (NULL) start with the first file in the
|
||||||
// firmware volume. Otherwise, start from the FileHeader.
|
// firmware volume. Otherwise, start from the FileHeader.
|
||||||
@ -171,7 +175,6 @@ Returns:
|
|||||||
FileState = GetFileState (ErasePolarity, FfsFileHeader);
|
FileState = GetFileState (ErasePolarity, FfsFileHeader);
|
||||||
|
|
||||||
switch (FileState) {
|
switch (FileState) {
|
||||||
|
|
||||||
case EFI_FILE_HEADER_INVALID:
|
case EFI_FILE_HEADER_INVALID:
|
||||||
FileOffset += sizeof (EFI_FFS_FILE_HEADER);
|
FileOffset += sizeof (EFI_FFS_FILE_HEADER);
|
||||||
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FfsFileHeader + sizeof (EFI_FFS_FILE_HEADER));
|
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FfsFileHeader + sizeof (EFI_FFS_FILE_HEADER));
|
||||||
@ -184,7 +187,6 @@ Returns:
|
|||||||
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
|
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
|
||||||
|
|
||||||
if ((SearchType == FfsFileHeader->Type) || (SearchType == EFI_FV_FILETYPE_ALL)) {
|
if ((SearchType == FfsFileHeader->Type) || (SearchType == EFI_FV_FILETYPE_ALL)) {
|
||||||
|
|
||||||
*FileHeader = FfsFileHeader;
|
*FileHeader = FfsFileHeader;
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -195,6 +197,7 @@ Returns:
|
|||||||
} else {
|
} else {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EFI_FILE_DELETED:
|
case EFI_FILE_DELETED:
|
||||||
@ -206,7 +209,6 @@ Returns:
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,6 +221,7 @@ SecFfsFindSectionData (
|
|||||||
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
|
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
|
||||||
IN OUT VOID **SectionData
|
IN OUT VOID **SectionData
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -258,6 +261,7 @@ Returns:
|
|||||||
*SectionData = (VOID *)(Section + 1);
|
*SectionData = (VOID *)(Section + 1);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Size is 24 bits wide so mask upper 8 bits.
|
// Size is 24 bits wide so mask upper 8 bits.
|
||||||
// SectionLength is adjusted it is 4 byte aligned.
|
// SectionLength is adjusted it is 4 byte aligned.
|
||||||
@ -272,4 +276,3 @@ Returns:
|
|||||||
|
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,15 +6,12 @@
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include <PiPei.h>
|
#include <PiPei.h>
|
||||||
#include <Library/EmuMagicPageLib.h>
|
#include <Library/EmuMagicPageLib.h>
|
||||||
#include <Library/PeiServicesLib.h>
|
#include <Library/PeiServicesLib.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
SecFfsFindNextFile (
|
SecFfsFindNextFile (
|
||||||
IN EFI_FV_FILETYPE SearchType,
|
IN EFI_FV_FILETYPE SearchType,
|
||||||
@ -29,7 +26,6 @@ SecFfsFindSectionData (
|
|||||||
OUT VOID **SectionData
|
OUT VOID **SectionData
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This service enables a given PEIM to register an interface into the PEI Foundation.
|
This service enables a given PEIM to register an interface into the PEI Foundation.
|
||||||
|
|
||||||
@ -114,9 +110,11 @@ PeiServicesLocatePpi (
|
|||||||
if (PpiDescriptor != NULL) {
|
if (PpiDescriptor != NULL) {
|
||||||
*PpiDescriptor = PpiList;
|
*PpiDescriptor = PpiList;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ppi != NULL) {
|
if (Ppi != NULL) {
|
||||||
*Ppi = PpiList->Ppi;
|
*Ppi = PpiList->Ppi;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +123,6 @@ PeiServicesLocatePpi (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +448,6 @@ PeiServicesFfsGetFileInfo (
|
|||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services
|
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
|
Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
|
||||||
@ -485,7 +481,6 @@ PeiServicesFfsFindFileByName (
|
|||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services
|
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
|
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>
|
#include <PiPei.h>
|
||||||
|
|
||||||
CONST EFI_PEI_PPI_DESCRIPTOR *gPpiList = NULL;
|
CONST EFI_PEI_PPI_DESCRIPTOR *gPpiList = NULL;
|
||||||
|
|
||||||
|
@ -18,10 +18,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
#include <Library/SmbiosLib.h>
|
#include <Library/SmbiosLib.h>
|
||||||
|
|
||||||
|
|
||||||
EFI_SMBIOS_PROTOCOL *gSmbios = NULL;
|
EFI_SMBIOS_PROTOCOL *gSmbios = NULL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create an initial SMBIOS Table from an array of 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.
|
entries. SMBIOS_TEMPLATE_ENTRY.NULL indicates the end of the table.
|
||||||
@ -53,8 +51,6 @@ SmbiosLibInitializeFromTemplate (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create SMBIOS record.
|
Create SMBIOS record.
|
||||||
|
|
||||||
@ -108,6 +104,7 @@ SmbiosLibCreateEntry (
|
|||||||
StringSize = AsciiStrSize (StringArray[Index]);
|
StringSize = AsciiStrSize (StringArray[Index]);
|
||||||
Size += StringSize;
|
Size += StringSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't forget the terminating double null
|
// Don't forget the terminating double null
|
||||||
Size += 1;
|
Size += 1;
|
||||||
}
|
}
|
||||||
@ -117,6 +114,7 @@ SmbiosLibCreateEntry (
|
|||||||
if (Record == NULL) {
|
if (Record == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Record, SmbiosEntry, SmbiosEntry->Length);
|
CopyMem (Record, SmbiosEntry, SmbiosEntry->Length);
|
||||||
|
|
||||||
if (StringArray != NULL) {
|
if (StringArray != NULL) {
|
||||||
@ -127,6 +125,7 @@ SmbiosLibCreateEntry (
|
|||||||
CopyMem (Str, StringArray[Index], StringSize);
|
CopyMem (Str, StringArray[Index], StringSize);
|
||||||
Str += StringSize;
|
Str += StringSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
*Str = 0;
|
*Str = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,8 +141,6 @@ SmbiosLibCreateEntry (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Update the string associated with an existing SMBIOS record.
|
Update the string associated with an existing SMBIOS record.
|
||||||
|
|
||||||
@ -182,7 +179,6 @@ SmbiosLibUpdateString (
|
|||||||
return gSmbios->UpdateString (gSmbios, &SmbiosHandle, &StringIndex, String);
|
return gSmbios->UpdateString (gSmbios, &SmbiosHandle, &StringIndex, String);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Update the string associated with an existing SMBIOS record.
|
Update the string associated with an existing SMBIOS record.
|
||||||
|
|
||||||
@ -223,6 +219,7 @@ SmbiosLibUpdateUnicodeString (
|
|||||||
if (Ascii == NULL) {
|
if (Ascii == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnicodeStrToAsciiStrS (String, Ascii, StrSize (String));
|
UnicodeStrToAsciiStrS (String, Ascii, StrSize (String));
|
||||||
|
|
||||||
StringIndex = StringNumber;
|
StringIndex = StringNumber;
|
||||||
@ -232,7 +229,6 @@ SmbiosLibUpdateUnicodeString (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allow caller to read a specific SMBIOS string
|
Allow caller to read a specific SMBIOS string
|
||||||
|
|
||||||
@ -257,6 +253,7 @@ SmbiosLibReadString (
|
|||||||
if (StringNumber == Match) {
|
if (StringNumber == Match) {
|
||||||
return Data;
|
return Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Data++;
|
Data++;
|
||||||
if (*(Data - 1) == '\0') {
|
if (*(Data - 1) == '\0') {
|
||||||
Match++;
|
Match++;
|
||||||
@ -266,7 +263,6 @@ SmbiosLibReadString (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allow the caller to discover a specific SMBIOS entry, and patch it if necissary.
|
Allow the caller to discover a specific SMBIOS entry, and patch it if necissary.
|
||||||
|
|
||||||
@ -297,6 +293,7 @@ SmbiosLibGetRecord (
|
|||||||
if (Match == Instance) {
|
if (Match == Instance) {
|
||||||
return (SMBIOS_STRUCTURE *)Record;
|
return (SMBIOS_STRUCTURE *)Record;
|
||||||
}
|
}
|
||||||
|
|
||||||
Match++;
|
Match++;
|
||||||
}
|
}
|
||||||
} while (!EFI_ERROR (Status));
|
} while (!EFI_ERROR (Status));
|
||||||
@ -304,7 +301,6 @@ SmbiosLibGetRecord (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove an SMBIOS record.
|
Remove an SMBIOS record.
|
||||||
|
|
||||||
@ -324,8 +320,6 @@ SmbiosLibRemove (
|
|||||||
return gSmbios->Remove (gSmbios, SmbiosHandle);
|
return gSmbios->Remove (gSmbios, SmbiosHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@param ImageHandle ImageHandle of the loaded driver.
|
@param ImageHandle ImageHandle of the loaded driver.
|
||||||
@ -343,4 +337,3 @@ SmbiosLibConstructor (
|
|||||||
{
|
{
|
||||||
return gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)&gSmbios);
|
return gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)&gSmbios);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,12 +12,9 @@
|
|||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
|
|
||||||
|
|
||||||
UINTN gThunkPpiListSize = 0;
|
UINTN gThunkPpiListSize = 0;
|
||||||
EFI_PEI_PPI_DESCRIPTOR *gThunkPpiList = NULL;
|
EFI_PEI_PPI_DESCRIPTOR *gThunkPpiList = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_PEI_PPI_DESCRIPTOR *
|
EFI_PEI_PPI_DESCRIPTOR *
|
||||||
GetThunkPpiList (
|
GetThunkPpiList (
|
||||||
VOID
|
VOID
|
||||||
@ -35,7 +32,6 @@ GetThunkPpiList (
|
|||||||
return gThunkPpiList;
|
return gThunkPpiList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AddThunkPpi (
|
AddThunkPpi (
|
||||||
@ -63,8 +59,3 @@ AddThunkPpi (
|
|||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include <Protocol/EmuIoThunk.h>
|
#include <Protocol/EmuIoThunk.h>
|
||||||
|
|
||||||
|
|
||||||
#define EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE SIGNATURE_32('E','m','u','T')
|
#define EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE SIGNATURE_32('E','m','u','T')
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -28,7 +27,6 @@ typedef struct {
|
|||||||
|
|
||||||
LIST_ENTRY mThunkList = INITIALIZE_LIST_HEAD_VARIABLE (mThunkList);
|
LIST_ENTRY mThunkList = INITIALIZE_LIST_HEAD_VARIABLE (mThunkList);
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AddThunkProtocol (
|
AddThunkProtocol (
|
||||||
@ -53,9 +51,9 @@ AddThunkProtocol (
|
|||||||
if (StartString == NULL) {
|
if (StartString == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpyS (StartString, Size / sizeof (CHAR16), ConfigString);
|
StrCpyS (StartString, Size / sizeof (CHAR16), ConfigString);
|
||||||
while (*StartString != '\0') {
|
while (*StartString != '\0') {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find the end of the sub string
|
// Find the end of the sub string
|
||||||
//
|
//
|
||||||
@ -77,6 +75,7 @@ AddThunkProtocol (
|
|||||||
if (Private == NULL) {
|
if (Private == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Private->Signature = EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE;
|
Private->Signature = EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE;
|
||||||
Private->EmuBusDriver = EmuBusDriver;
|
Private->EmuBusDriver = EmuBusDriver;
|
||||||
|
|
||||||
@ -95,7 +94,6 @@ AddThunkProtocol (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GetNextThunkProtocol (
|
GetNextThunkProtocol (
|
||||||
@ -125,13 +123,12 @@ GetNextThunkProtocol (
|
|||||||
if (Link == &mThunkList) {
|
if (Link == &mThunkList) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
Private = CR (Link, EMU_IO_THUNK_PROTOCOL_DATA, Link, EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE);
|
Private = CR (Link, EMU_IO_THUNK_PROTOCOL_DATA, Link, EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE);
|
||||||
*Instance = &Private->Data;
|
*Instance = &Private->Data;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
extern SMBIOS_TEMPLATE_ENTRY gSmbiosTemplate[];
|
extern SMBIOS_TEMPLATE_ENTRY gSmbiosTemplate[];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SMBIOS_TABLE_TYPE19 gSmbiosType19Template = {
|
SMBIOS_TABLE_TYPE19 gSmbiosType19Template = {
|
||||||
{ EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, sizeof (SMBIOS_TABLE_TYPE19), 0 },
|
{ EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, sizeof (SMBIOS_TABLE_TYPE19), 0 },
|
||||||
0xffffffff, // StartingAddress;
|
0xffffffff, // StartingAddress;
|
||||||
@ -66,11 +64,11 @@ CreatePlatformSmbiosMemoryRecords (
|
|||||||
|
|
||||||
SmbiosLibCreateEntry ((SMBIOS_STRUCTURE *)&gSmbiosType19Template, NULL);
|
SmbiosLibCreateEntry ((SMBIOS_STRUCTURE *)&gSmbiosType19Template, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
HobPtr.Raw = GET_NEXT_HOB (HobPtr);
|
HobPtr.Raw = GET_NEXT_HOB (HobPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Main entry for this driver.
|
Main entry for this driver.
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include <Protocol/Smbios.h>
|
#include <Protocol/Smbios.h>
|
||||||
#include <Library/SmbiosLib.h>
|
#include <Library/SmbiosLib.h>
|
||||||
|
|
||||||
|
|
||||||
SMBIOS_TABLE_TYPE0 gSmbiosType0Template = {
|
SMBIOS_TABLE_TYPE0 gSmbiosType0Template = {
|
||||||
{ EFI_SMBIOS_TYPE_BIOS_INFORMATION, sizeof (SMBIOS_TABLE_TYPE0), 0 },
|
{ EFI_SMBIOS_TYPE_BIOS_INFORMATION, sizeof (SMBIOS_TABLE_TYPE0), 0 },
|
||||||
1, // Vendor String
|
1, // Vendor String
|
||||||
@ -101,7 +100,8 @@ SMBIOS_TABLE_TYPE1 gSmbiosType1Template = {
|
|||||||
2, // ProductName String
|
2, // ProductName String
|
||||||
3, // Version String
|
3, // Version String
|
||||||
4, // SerialNumber 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,
|
SystemWakeupTypePowerSwitch,
|
||||||
5, // SKUNumber String
|
5, // SKUNumber String
|
||||||
6, // Family String
|
6, // Family String
|
||||||
@ -163,7 +163,9 @@ SMBIOS_TABLE_TYPE3 gSmbiosType3Template = {
|
|||||||
0, // NumberofPowerCords;
|
0, // NumberofPowerCords;
|
||||||
0, // ContainedElementCount;
|
0, // ContainedElementCount;
|
||||||
0, // ContainedElementRecordLength;
|
0, // ContainedElementRecordLength;
|
||||||
{ { 0 } }, // ContainedElements[1];
|
{
|
||||||
|
{ 0 }
|
||||||
|
}, // ContainedElements[1];
|
||||||
};
|
};
|
||||||
CHAR8 *gSmbiosType3Strings[] = {
|
CHAR8 *gSmbiosType3Strings[] = {
|
||||||
"http://www.tianocore.org/edk2/",
|
"http://www.tianocore.org/edk2/",
|
||||||
@ -199,7 +201,6 @@ CHAR8 *gSmbiosType8Strings2[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SMBIOS_TABLE_TYPE8 gSmbiosType8Template3 = {
|
SMBIOS_TABLE_TYPE8 gSmbiosType8Template3 = {
|
||||||
{ EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE8), 0 },
|
{ EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE8), 0 },
|
||||||
0, // InternalReferenceDesignator String
|
0, // InternalReferenceDesignator String
|
||||||
@ -333,7 +334,6 @@ CHAR8 *gSmbiosType11Strings[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SMBIOS_TABLE_TYPE12 gSmbiosType12Template = {
|
SMBIOS_TABLE_TYPE12 gSmbiosType12Template = {
|
||||||
{ EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 },
|
{ EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 },
|
||||||
1 // StringCount
|
1 // StringCount
|
||||||
@ -415,8 +415,6 @@ SMBIOS_TABLE_TYPE32 gSmbiosType32Template = {
|
|||||||
BootInformationStatusNoError // BootStatus
|
BootInformationStatusNoError // BootStatus
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SMBIOS_TEMPLATE_ENTRY gSmbiosTemplate[] = {
|
SMBIOS_TEMPLATE_ENTRY gSmbiosTemplate[] = {
|
||||||
{ (SMBIOS_STRUCTURE *)&gSmbiosType0Template, gSmbiosType0Strings },
|
{ (SMBIOS_STRUCTURE *)&gSmbiosType0Template, gSmbiosType0Strings },
|
||||||
{ (SMBIOS_STRUCTURE *)&gSmbiosType1Template, gSmbiosType1Strings },
|
{ (SMBIOS_STRUCTURE *)&gSmbiosType1Template, gSmbiosType1Strings },
|
||||||
|
@ -46,6 +46,7 @@ EmuGetTime (
|
|||||||
OUT EFI_TIME *Time,
|
OUT EFI_TIME *Time,
|
||||||
OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
|
OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -67,13 +68,11 @@ Returns:
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
{
|
{
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check parameter for null pointer
|
// Check parameter for null pointer
|
||||||
//
|
//
|
||||||
if (Time == NULL) {
|
if (Time == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gEmuThunk->GetTime (Time, Capabilities);
|
gEmuThunk->GetTime (Time, Capabilities);
|
||||||
@ -86,6 +85,7 @@ EFIAPI
|
|||||||
EmuSetTime (
|
EmuSetTime (
|
||||||
IN EFI_TIME *Time
|
IN EFI_TIME *Time
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -111,6 +111,7 @@ Returns:
|
|||||||
if (Time == NULL) {
|
if (Time == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure that the time fields are valid
|
// Make sure that the time fields are valid
|
||||||
//
|
//
|
||||||
@ -118,6 +119,7 @@ Returns:
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +130,7 @@ EmuGetWakeupTime (
|
|||||||
OUT BOOLEAN *Pending,
|
OUT BOOLEAN *Pending,
|
||||||
OUT EFI_TIME *Time
|
OUT EFI_TIME *Time
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -162,6 +165,7 @@ EmuSetWakeupTime (
|
|||||||
IN BOOLEAN Enable,
|
IN BOOLEAN Enable,
|
||||||
OUT EFI_TIME *Time
|
OUT EFI_TIME *Time
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -196,6 +200,7 @@ InitializeRealTimeClock (
|
|||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -233,6 +238,7 @@ EFI_STATUS
|
|||||||
RtcTimeFieldsValid (
|
RtcTimeFieldsValid (
|
||||||
IN EFI_TIME *Time
|
IN EFI_TIME *Time
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -242,18 +248,19 @@ Routine Description:
|
|||||||
Returns:
|
Returns:
|
||||||
**/
|
**/
|
||||||
{
|
{
|
||||||
if (Time->Year < 1998 ||
|
if ((Time->Year < 1998) ||
|
||||||
Time->Year > 2099 ||
|
(Time->Year > 2099) ||
|
||||||
Time->Month < 1 ||
|
(Time->Month < 1) ||
|
||||||
Time->Month > 12 ||
|
(Time->Month > 12) ||
|
||||||
(!DayValid (Time)) ||
|
(!DayValid (Time)) ||
|
||||||
Time->Hour > 23 ||
|
(Time->Hour > 23) ||
|
||||||
Time->Minute > 59 ||
|
(Time->Minute > 59) ||
|
||||||
Time->Second > 59 ||
|
(Time->Second > 59) ||
|
||||||
Time->Nanosecond > 999999999 ||
|
(Time->Nanosecond > 999999999) ||
|
||||||
(!(Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE || (Time->TimeZone >= -1440 && Time->TimeZone <= 1440))) ||
|
(!((Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE) || ((Time->TimeZone >= -1440) && (Time->TimeZone <= 1440)))) ||
|
||||||
(Time->Daylight & (~(EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT)))
|
(Time->Daylight & (~(EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT)))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,13 +272,13 @@ DayValid (
|
|||||||
IN EFI_TIME *Time
|
IN EFI_TIME *Time
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
STATIC const INTN DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
STATIC const INTN DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||||
|
|
||||||
if (Time->Day < 1 ||
|
if ((Time->Day < 1) ||
|
||||||
Time->Day > DayOfMonth[Time->Month - 1] ||
|
(Time->Day > DayOfMonth[Time->Month - 1]) ||
|
||||||
(Time->Month == 2 && (!IsLeapYear (Time) && Time->Day > 28))
|
((Time->Month == 2) && (!IsLeapYear (Time) && (Time->Day > 28)))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include <Protocol/Reset.h>
|
#include <Protocol/Reset.h>
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EmuResetSystem (
|
EmuResetSystem (
|
||||||
@ -52,7 +51,6 @@ EmuResetSystem (
|
|||||||
gBS->FreePool (HandleBuffer);
|
gBS->FreePool (HandleBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Discard ResetType, always return 0 as exit code
|
// Discard ResetType, always return 0 as exit code
|
||||||
//
|
//
|
||||||
@ -66,14 +64,13 @@ EmuResetSystem (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InitializeEmuReset (
|
InitializeEmuReset (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -105,4 +102,3 @@ Returns:
|
|||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ SecSwitchStack (
|
|||||||
UINT32 PermenentMemoryBase
|
UINT32 PermenentMemoryBase
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SecTemporaryRamSupport (
|
SecTemporaryRamSupport (
|
||||||
|
@ -10,13 +10,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "Sec.h"
|
#include "Sec.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mSecTemporaryRamSupportPpi = {
|
EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mSecTemporaryRamSupportPpi = {
|
||||||
SecTemporaryRamSupport
|
SecTemporaryRamSupport
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
EFI_PEI_PPI_DESCRIPTOR gPrivateDispatchTable[] = {
|
EFI_PEI_PPI_DESCRIPTOR gPrivateDispatchTable[] = {
|
||||||
{
|
{
|
||||||
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
|
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
|
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
|
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___
|
#ifndef __SEC_H___
|
||||||
#define __SEC_H___
|
#define __SEC_H___
|
||||||
|
|
||||||
|
|
||||||
#include <PiPei.h>
|
#include <PiPei.h>
|
||||||
#include <Library/EmuMagicPageLib.h>
|
#include <Library/EmuMagicPageLib.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
@ -21,7 +20,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include <Ppi/TemporaryRamSupport.h>
|
#include <Ppi/TemporaryRamSupport.h>
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// I think this should be defined in a MdePkg include file?
|
// I think this should be defined in a MdePkg include file?
|
||||||
//
|
//
|
||||||
@ -40,6 +38,4 @@ SecTemporaryRamSupport (
|
|||||||
IN UINTN CopySize
|
IN UINTN CopySize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -18,14 +18,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Ppi/EmuThunk.h>
|
#include <Ppi/EmuThunk.h>
|
||||||
#include <Protocol/EmuThunk.h>
|
#include <Protocol/EmuThunk.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiInitialzeThunkPpiToProtocolPei (
|
PeiInitialzeThunkPpiToProtocolPei (
|
||||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
@ -49,15 +49,15 @@ EFI_TIMER_NOTIFY mTimerNotifyFunction = NULL;
|
|||||||
//
|
//
|
||||||
UINT64 mTimerPeriodMs;
|
UINT64 mTimerPeriodMs;
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
TimerCallback (UINT64 DeltaMs)
|
TimerCallback (
|
||||||
|
UINT64 DeltaMs
|
||||||
|
)
|
||||||
{
|
{
|
||||||
EFI_TPL OriginalTPL;
|
EFI_TPL OriginalTPL;
|
||||||
EFI_TIMER_NOTIFY CallbackFunction;
|
EFI_TIMER_NOTIFY CallbackFunction;
|
||||||
|
|
||||||
|
|
||||||
OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||||
|
|
||||||
if (OriginalTPL < TPL_HIGH_LEVEL) {
|
if (OriginalTPL < TPL_HIGH_LEVEL) {
|
||||||
@ -73,7 +73,6 @@ TimerCallback (UINT64 DeltaMs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gBS->RestoreTPL (OriginalTPL);
|
gBS->RestoreTPL (OriginalTPL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -82,6 +81,7 @@ EmuTimerDriverRegisterHandler (
|
|||||||
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
||||||
IN EFI_TIMER_NOTIFY NotifyFunction
|
IN EFI_TIMER_NOTIFY NotifyFunction
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -127,11 +127,11 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Check for invalid parameters
|
// Check for invalid parameters
|
||||||
//
|
//
|
||||||
if (NotifyFunction == NULL && mTimerNotifyFunction == NULL) {
|
if ((NotifyFunction == NULL) && (mTimerNotifyFunction == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NotifyFunction != NULL && mTimerNotifyFunction != NULL) {
|
if ((NotifyFunction != NULL) && (mTimerNotifyFunction != NULL)) {
|
||||||
return EFI_ALREADY_STARTED;
|
return EFI_ALREADY_STARTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,6 +142,7 @@ Returns:
|
|||||||
/* Enable Timer. */
|
/* Enable Timer. */
|
||||||
gEmuThunk->SetTimer (mTimerPeriodMs, TimerCallback);
|
gEmuThunk->SetTimer (mTimerPeriodMs, TimerCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
mTimerNotifyFunction = NotifyFunction;
|
mTimerNotifyFunction = NotifyFunction;
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -153,6 +154,7 @@ EmuTimerDriverSetTimerPeriod (
|
|||||||
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
||||||
IN UINT64 TimerPeriod
|
IN UINT64 TimerPeriod
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -190,14 +192,14 @@ Returns:
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
{
|
{
|
||||||
|
|
||||||
//
|
//
|
||||||
// If TimerPeriod is 0, then the timer thread should be canceled
|
// 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 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_MINIMUM_VALUE)
|
||||||
&& (TimerPeriod < TIMER_MAXIMUM_VALUE))) {
|
&& (TimerPeriod < TIMER_MAXIMUM_VALUE)))
|
||||||
|
{
|
||||||
mTimerPeriodMs = DivU64x32 (TimerPeriod + 5000, 10000);
|
mTimerPeriodMs = DivU64x32 (TimerPeriod + 5000, 10000);
|
||||||
|
|
||||||
gEmuThunk->SetTimer (mTimerPeriodMs, TimerCallback);
|
gEmuThunk->SetTimer (mTimerPeriodMs, TimerCallback);
|
||||||
@ -212,6 +214,7 @@ EmuTimerDriverGetTimerPeriod (
|
|||||||
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
IN EFI_TIMER_ARCH_PROTOCOL *This,
|
||||||
OUT UINT64 *TimerPeriod
|
OUT UINT64 *TimerPeriod
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -250,6 +253,7 @@ EFIAPI
|
|||||||
EmuTimerDriverGenerateSoftInterrupt (
|
EmuTimerDriverGenerateSoftInterrupt (
|
||||||
IN EFI_TIMER_ARCH_PROTOCOL *This
|
IN EFI_TIMER_ARCH_PROTOCOL *This
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -283,6 +287,7 @@ EmuTimerDriverInitialize (
|
|||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -341,6 +346,5 @@ Returns:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#ifndef _TIMER_H_
|
#ifndef _TIMER_H_
|
||||||
#define _TIMER_H_
|
#define _TIMER_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Legal timer value range in 100 ns units
|
// Legal timer value range in 100 ns units
|
||||||
//
|
//
|
||||||
|
@ -11,15 +11,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "Host.h"
|
#include "Host.h"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
||||||
|
|
||||||
#include <Library/NetLib.h>
|
#include <Library/NetLib.h>
|
||||||
|
|
||||||
|
|
||||||
#define EMU_SNP_PRIVATE_SIGNATURE SIGNATURE_32('E', 'M', 's', 'n')
|
#define EMU_SNP_PRIVATE_SIGNATURE SIGNATURE_32('E', 'M', 's', 'n')
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
@ -43,13 +40,11 @@ typedef struct {
|
|||||||
|
|
||||||
UINT32 ReceivedPackets;
|
UINT32 ReceivedPackets;
|
||||||
UINT32 DroppedPackets;
|
UINT32 DroppedPackets;
|
||||||
|
|
||||||
} EMU_SNP_PRIVATE;
|
} EMU_SNP_PRIVATE;
|
||||||
|
|
||||||
#define EMU_SNP_PRIVATE_DATA_FROM_THIS(a) \
|
#define EMU_SNP_PRIVATE_DATA_FROM_THIS(a) \
|
||||||
CR(a, EMU_SNP_PRIVATE, EmuSnp, EMU_SNP_PRIVATE_SIGNATURE)
|
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...
|
// Strange, but there doesn't appear to be any structure for the Ethernet header in edk2...
|
||||||
//
|
//
|
||||||
@ -100,7 +95,6 @@ EmuSnpCreateMapping (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct bpf_insn mFilterInstructionTemplate[] = {
|
static struct bpf_insn mFilterInstructionTemplate[] = {
|
||||||
// Load 4 bytes from the destination MAC address.
|
// Load 4 bytes from the destination MAC address.
|
||||||
BPF_STMT (BPF_LD + BPF_W + BPF_ABS, OFFSET_OF (ETHERNET_HEADER, DstAddr[0])),
|
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)
|
BPF_STMT (BPF_RET + BPF_K, -1)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
OpenBpfFileDescriptor (
|
OpenBpfFileDescriptor (
|
||||||
IN EMU_SNP_PRIVATE *Private,
|
IN EMU_SNP_PRIVATE *Private,
|
||||||
@ -171,7 +164,6 @@ OpenBpfFileDescriptor (
|
|||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Changes the state of a network interface from "stopped" to "started".
|
Changes the state of a network interface from "stopped" to "started".
|
||||||
|
|
||||||
@ -324,7 +316,6 @@ EmuSnpStart (
|
|||||||
goto DeviceErrorExit;
|
goto DeviceErrorExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Private->Mode->State = EfiSimpleNetworkStarted;
|
Private->Mode->State = EfiSimpleNetworkStarted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,10 +328,10 @@ ErrorExit:
|
|||||||
free (Private->ReadBuffer);
|
free (Private->ReadBuffer);
|
||||||
Private->ReadBuffer = NULL;
|
Private->ReadBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Changes the state of a network interface from "started" to "stopped".
|
Changes the state of a network interface from "started" to "stopped".
|
||||||
|
|
||||||
@ -390,7 +381,6 @@ EmuSnpStop (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Resets a network adapter and allocates the transmit and receive buffers
|
Resets a network adapter and allocates the transmit and receive buffers
|
||||||
required by the network interface; optionally, also requests allocation
|
required by the network interface; optionally, also requests allocation
|
||||||
@ -450,7 +440,6 @@ EmuSnpInitialize (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Resets a network adapter and re-initializes it with the parameters that were
|
Resets a network adapter and re-initializes it with the parameters that were
|
||||||
provided in the previous call to Initialize().
|
provided in the previous call to Initialize().
|
||||||
@ -493,7 +482,6 @@ EmuSnpReset (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Resets a network adapter and leaves it in a state that is safe for
|
Resets a network adapter and leaves it in a state that is safe for
|
||||||
another driver to initialize.
|
another driver to initialize.
|
||||||
@ -590,7 +578,6 @@ EmuSnpReceiveFilters (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Modifies or resets the current station address, if supported.
|
Modifies or resets the current station address, if supported.
|
||||||
|
|
||||||
@ -620,7 +607,6 @@ EmuSnpStationAddress (
|
|||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Resets or collects the statistics on a network interface.
|
Resets or collects the statistics on a network interface.
|
||||||
|
|
||||||
@ -657,7 +643,6 @@ EmuSnpStatistics (
|
|||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts a multicast IP address to a multicast HW MAC address.
|
Converts a multicast IP address to a multicast HW MAC address.
|
||||||
|
|
||||||
@ -694,7 +679,6 @@ EmuSnpMCastIpToMac (
|
|||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs read and write operations on the NVRAM device attached to a
|
Performs read and write operations on the NVRAM device attached to a
|
||||||
network interface.
|
network interface.
|
||||||
@ -774,7 +758,6 @@ EmuSnpGetStatus (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Places a packet in the transmit queue of a network interface.
|
Places a packet in the transmit queue of a network interface.
|
||||||
|
|
||||||
@ -972,7 +955,6 @@ EmuSnpReceive (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EMU_SNP_PROTOCOL gEmuSnpProtocol = {
|
EMU_SNP_PROTOCOL gEmuSnpProtocol = {
|
||||||
GasketSnpCreateMapping,
|
GasketSnpCreateMapping,
|
||||||
GasketSnpStart,
|
GasketSnpStart,
|
||||||
@ -1041,7 +1023,6 @@ Exit:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EmuSnpThunkOpen (
|
EmuSnpThunkOpen (
|
||||||
IN EMU_IO_THUNK_PROTOCOL *This
|
IN EMU_IO_THUNK_PROTOCOL *This
|
||||||
@ -1062,7 +1043,6 @@ EmuSnpThunkOpen (
|
|||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Private->Signature = EMU_SNP_PRIVATE_SIGNATURE;
|
Private->Signature = EMU_SNP_PRIVATE_SIGNATURE;
|
||||||
Private->Thunk = This;
|
Private->Thunk = This;
|
||||||
CopyMem (&Private->EmuSnp, &gEmuSnpProtocol, sizeof (gEmuSnpProtocol));
|
CopyMem (&Private->EmuSnp, &gEmuSnpProtocol, sizeof (gEmuSnpProtocol));
|
||||||
@ -1073,7 +1053,6 @@ EmuSnpThunkOpen (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EmuSnpThunkClose (
|
EmuSnpThunkClose (
|
||||||
IN EMU_IO_THUNK_PROTOCOL *This
|
IN EMU_IO_THUNK_PROTOCOL *This
|
||||||
@ -1091,8 +1070,6 @@ EmuSnpThunkClose (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EMU_IO_THUNK_PROTOCOL gSnpThunkIo = {
|
EMU_IO_THUNK_PROTOCOL gSnpThunkIo = {
|
||||||
&gEmuSnpProtocolGuid,
|
&gEmuSnpProtocolGuid,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -27,21 +27,17 @@ typedef struct {
|
|||||||
|
|
||||||
EMU_BLOCK_IO_PROTOCOL EmuBlockIo;
|
EMU_BLOCK_IO_PROTOCOL EmuBlockIo;
|
||||||
EFI_BLOCK_IO_MEDIA *Media;
|
EFI_BLOCK_IO_MEDIA *Media;
|
||||||
|
|
||||||
} EMU_BLOCK_IO_PRIVATE;
|
} EMU_BLOCK_IO_PRIVATE;
|
||||||
|
|
||||||
#define EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
|
#define EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
|
||||||
CR(a, EMU_BLOCK_IO_PRIVATE, EmuBlockIo, EMU_BLOCK_IO_PRIVATE_SIGNATURE)
|
CR(a, EMU_BLOCK_IO_PRIVATE, EmuBlockIo, EMU_BLOCK_IO_PRIVATE_SIGNATURE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EmuBlockIoReset (
|
EmuBlockIoReset (
|
||||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||||
IN BOOLEAN ExtendedVerification
|
IN BOOLEAN ExtendedVerification
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
This function extends the capability of SetFilePointer to accept 64 bit parameters
|
This function extends the capability of SetFilePointer to accept 64 bit parameters
|
||||||
@ -72,7 +68,6 @@ SetFilePointer64 (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EmuBlockIoOpenDevice (
|
EmuBlockIoOpenDevice (
|
||||||
IN EMU_BLOCK_IO_PRIVATE *Private
|
IN EMU_BLOCK_IO_PRIVATE *Private
|
||||||
@ -82,7 +77,6 @@ EmuBlockIoOpenDevice (
|
|||||||
UINT64 FileSize;
|
UINT64 FileSize;
|
||||||
struct statfs buf;
|
struct statfs buf;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the device is already opened, close it
|
// If the device is already opened, close it
|
||||||
//
|
//
|
||||||
@ -127,6 +121,7 @@ EmuBlockIoOpenDevice (
|
|||||||
if (ioctl (Private->fd, DKIOCGETBLOCKSIZE, &BlockSize) == 0) {
|
if (ioctl (Private->fd, DKIOCGETBLOCKSIZE, &BlockSize) == 0) {
|
||||||
Private->Media->BlockSize = BlockSize;
|
Private->Media->BlockSize = BlockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl (Private->fd, DKIOCGETBLOCKCOUNT, &Private->NumberOfBlocks) == 0) {
|
if (ioctl (Private->fd, DKIOCGETBLOCKCOUNT, &Private->NumberOfBlocks) == 0) {
|
||||||
if ((Private->NumberOfBlocks == 0) && (BlockSize == 0x800)) {
|
if ((Private->NumberOfBlocks == 0) && (BlockSize == 0x800)) {
|
||||||
// A DVD is ~ 4.37 GB so make up a number
|
// A DVD is ~ 4.37 GB so make up a number
|
||||||
@ -135,6 +130,7 @@ EmuBlockIoOpenDevice (
|
|||||||
Private->Media->LastBlock = Private->NumberOfBlocks - 1;
|
Private->Media->LastBlock = Private->NumberOfBlocks - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ioctl (Private->fd, DKIOCGETMAXBLOCKCOUNTWRITE, &Private->Media->OptimalTransferLengthGranularity);
|
ioctl (Private->fd, DKIOCGETMAXBLOCKCOUNTWRITE, &Private->Media->OptimalTransferLengthGranularity);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -145,13 +141,13 @@ EmuBlockIoOpenDevice (
|
|||||||
if (ioctl (Private->fd, BLKSSZGET, &BlockSize) == 0) {
|
if (ioctl (Private->fd, BLKSSZGET, &BlockSize) == 0) {
|
||||||
Private->Media->BlockSize = BlockSize;
|
Private->Media->BlockSize = BlockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl (Private->fd, BLKGETSIZE64, &DiskSize) == 0) {
|
if (ioctl (Private->fd, BLKGETSIZE64, &DiskSize) == 0) {
|
||||||
Private->NumberOfBlocks = DivU64x32 (DiskSize, (UINT32)BlockSize);
|
Private->NumberOfBlocks = DivU64x32 (DiskSize, (UINT32)BlockSize);
|
||||||
Private->Media->LastBlock = Private->NumberOfBlocks - 1;
|
Private->Media->LastBlock = Private->NumberOfBlocks - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Private->Media->BlockSize = Private->BlockSize;
|
Private->Media->BlockSize = Private->BlockSize;
|
||||||
Private->NumberOfBlocks = DivU64x32 (FileSize, Private->Media->BlockSize);
|
Private->NumberOfBlocks = DivU64x32 (FileSize, Private->Media->BlockSize);
|
||||||
@ -179,7 +175,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EmuBlockIoCreateMapping (
|
EmuBlockIoCreateMapping (
|
||||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||||
@ -206,17 +201,14 @@ EmuBlockIoCreateMapping (
|
|||||||
Media->LowestAlignedLba = 0;
|
Media->LowestAlignedLba = 0;
|
||||||
Media->LogicalBlocksPerPhysicalBlock = 0;
|
Media->LogicalBlocksPerPhysicalBlock = 0;
|
||||||
|
|
||||||
|
|
||||||
// EFI_BLOCK_IO_PROTOCOL_REVISION3
|
// EFI_BLOCK_IO_PROTOCOL_REVISION3
|
||||||
Media->OptimalTransferLengthGranularity = 0;
|
Media->OptimalTransferLengthGranularity = 0;
|
||||||
|
|
||||||
Status = EmuBlockIoOpenDevice (Private);
|
Status = EmuBlockIoOpenDevice (Private);
|
||||||
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EmuBlockIoError (
|
EmuBlockIoError (
|
||||||
IN EMU_BLOCK_IO_PRIVATE *Private
|
IN EMU_BLOCK_IO_PRIVATE *Private
|
||||||
@ -225,9 +217,7 @@ EmuBlockIoError (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
BOOLEAN ReinstallBlockIoFlag;
|
BOOLEAN ReinstallBlockIoFlag;
|
||||||
|
|
||||||
|
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
|
|
||||||
case EAGAIN:
|
case EAGAIN:
|
||||||
Status = EFI_NO_MEDIA;
|
Status = EFI_NO_MEDIA;
|
||||||
Private->Media->ReadOnly = FALSE;
|
Private->Media->ReadOnly = FALSE;
|
||||||
@ -254,10 +244,10 @@ EmuBlockIoError (
|
|||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EmuBlockIoReadWriteCommon (
|
EmuBlockIoReadWriteCommon (
|
||||||
IN EMU_BLOCK_IO_PRIVATE *Private,
|
IN EMU_BLOCK_IO_PRIVATE *Private,
|
||||||
@ -313,6 +303,7 @@ EmuBlockIoReadWriteCommon (
|
|||||||
DEBUG ((DEBUG_INIT, "ReadBlocks: Attempted to read off end of device\n"));
|
DEBUG ((DEBUG_INIT, "ReadBlocks: Attempted to read off end of device\n"));
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Seek to End of File
|
// Seek to End of File
|
||||||
//
|
//
|
||||||
@ -327,7 +318,6 @@ EmuBlockIoReadWriteCommon (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read BufferSize bytes from Lba into Buffer.
|
Read BufferSize bytes from Lba into Buffer.
|
||||||
|
|
||||||
@ -403,10 +393,10 @@ Done:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Write BufferSize bytes from Lba into Buffer.
|
Write BufferSize bytes from Lba into Buffer.
|
||||||
|
|
||||||
@ -452,7 +442,6 @@ EmuBlockIoWriteBlocks (
|
|||||||
ssize_t len;
|
ssize_t len;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
|
||||||
Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
|
Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
|
||||||
|
|
||||||
Status = EmuBlockIoReadWriteCommon (Private, MediaId, LBA, BufferSize, Buffer, "UnixWriteBlocks");
|
Status = EmuBlockIoReadWriteCommon (Private, MediaId, LBA, BufferSize, Buffer, "UnixWriteBlocks");
|
||||||
@ -486,7 +475,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Flush the Block Device.
|
Flush the Block Device.
|
||||||
|
|
||||||
@ -526,7 +514,6 @@ EmuBlockIoFlushBlocks (
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Token != NULL) {
|
if (Token != NULL) {
|
||||||
if (Token->Event != NULL) {
|
if (Token->Event != NULL) {
|
||||||
// Caller is responsible for signaling EFI Event
|
// Caller is responsible for signaling EFI Event
|
||||||
@ -538,7 +525,6 @@ EmuBlockIoFlushBlocks (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reset the block device hardware.
|
Reset the block device hardware.
|
||||||
|
|
||||||
@ -570,7 +556,6 @@ EmuBlockIoReset (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
StdDupUnicodeToAscii (
|
StdDupUnicodeToAscii (
|
||||||
IN CHAR16 *Str
|
IN CHAR16 *Str
|
||||||
@ -589,12 +574,12 @@ StdDupUnicodeToAscii (
|
|||||||
for (Ptr = Ascii; *Str != '\0'; Ptr++, Str++) {
|
for (Ptr = Ascii; *Str != '\0'; Ptr++, Str++) {
|
||||||
*Ptr = *Str;
|
*Ptr = *Str;
|
||||||
}
|
}
|
||||||
|
|
||||||
*Ptr = 0;
|
*Ptr = 0;
|
||||||
|
|
||||||
return Ascii;
|
return Ascii;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EMU_BLOCK_IO_PROTOCOL gEmuBlockIoProtocol = {
|
EMU_BLOCK_IO_PROTOCOL gEmuBlockIoProtocol = {
|
||||||
GasketEmuBlockIoReset,
|
GasketEmuBlockIoReset,
|
||||||
GasketEmuBlockIoReadBlocks,
|
GasketEmuBlockIoReadBlocks,
|
||||||
@ -624,7 +609,6 @@ EmuBlockIoThunkOpen (
|
|||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Private->Signature = EMU_BLOCK_IO_PRIVATE_SIGNATURE;
|
Private->Signature = EMU_BLOCK_IO_PRIVATE_SIGNATURE;
|
||||||
Private->Thunk = This;
|
Private->Thunk = This;
|
||||||
CopyMem (&Private->EmuBlockIo, &gEmuBlockIoProtocol, sizeof (gEmuBlockIoProtocol));
|
CopyMem (&Private->EmuBlockIo, &gEmuBlockIoProtocol, sizeof (gEmuBlockIoProtocol));
|
||||||
@ -642,12 +626,14 @@ EmuBlockIoThunkOpen (
|
|||||||
Private->WriteProtected = FALSE;
|
Private->WriteProtected = FALSE;
|
||||||
} else {
|
} else {
|
||||||
for (*Str++ = '\0'; *Str != 0; Str++) {
|
for (*Str++ = '\0'; *Str != 0; Str++) {
|
||||||
if (*Str == 'R' || *Str == 'F') {
|
if ((*Str == 'R') || (*Str == 'F')) {
|
||||||
Private->RemovableMedia = (BOOLEAN)(*Str == 'R');
|
Private->RemovableMedia = (BOOLEAN)(*Str == 'R');
|
||||||
}
|
}
|
||||||
if (*Str == 'O' || *Str == 'W') {
|
|
||||||
|
if ((*Str == 'O') || (*Str == 'W')) {
|
||||||
Private->WriteProtected = (BOOLEAN)(*Str == 'O');
|
Private->WriteProtected = (BOOLEAN)(*Str == 'O');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*Str == ':') {
|
if (*Str == ':') {
|
||||||
Private->BlockSize = strtol (++Str, NULL, 0);
|
Private->BlockSize = strtol (++Str, NULL, 0);
|
||||||
break;
|
break;
|
||||||
@ -662,7 +648,6 @@ EmuBlockIoThunkOpen (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EmuBlockIoThunkClose (
|
EmuBlockIoThunkClose (
|
||||||
IN EMU_IO_THUNK_PROTOCOL *This
|
IN EMU_IO_THUNK_PROTOCOL *This
|
||||||
@ -680,6 +665,7 @@ EmuBlockIoThunkClose (
|
|||||||
if (Private->Filename != NULL) {
|
if (Private->Filename != NULL) {
|
||||||
free (Private->Filename);
|
free (Private->Filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
free (This->Private);
|
free (This->Private);
|
||||||
This->Private = NULL;
|
This->Private = NULL;
|
||||||
}
|
}
|
||||||
@ -687,8 +673,6 @@ EmuBlockIoThunkClose (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EMU_IO_THUNK_PROTOCOL gBlockIoThunkIo = {
|
EMU_IO_THUNK_PROTOCOL gBlockIoThunkIo = {
|
||||||
&gEmuBlockIoProtocolGuid,
|
&gEmuBlockIoProtocolGuid,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -34,7 +34,6 @@ UINTN settimer_callback = 0;
|
|||||||
|
|
||||||
BOOLEAN gEmulatorInterruptEnabled = FALSE;
|
BOOLEAN gEmulatorInterruptEnabled = FALSE;
|
||||||
|
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
SecWriteStdErr (
|
SecWriteStdErr (
|
||||||
IN UINT8 *Buffer,
|
IN UINT8 *Buffer,
|
||||||
@ -48,7 +47,6 @@ SecWriteStdErr (
|
|||||||
return (Return == -1) ? 0 : Return;
|
return (Return == -1) ? 0 : Return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
SecConfigStdIn (
|
SecConfigStdIn (
|
||||||
VOID
|
VOID
|
||||||
@ -111,7 +109,6 @@ SecPollStdIn (
|
|||||||
return (BOOLEAN)(Bytes > 0);
|
return (BOOLEAN)(Bytes > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID *
|
VOID *
|
||||||
SecMalloc (
|
SecMalloc (
|
||||||
IN UINTN Size
|
IN UINTN Size
|
||||||
@ -143,9 +140,10 @@ SecFree (
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
settimer_handler (int sig)
|
settimer_handler (
|
||||||
|
int sig
|
||||||
|
)
|
||||||
{
|
{
|
||||||
struct timeval timeval;
|
struct timeval timeval;
|
||||||
UINT64 delta;
|
UINT64 delta;
|
||||||
@ -181,10 +179,12 @@ SecSetTimer (
|
|||||||
if (sigaction (SIGALRM, &act, NULL) != 0) {
|
if (sigaction (SIGALRM, &act, NULL) != 0) {
|
||||||
printf ("SetTimer: sigaction error %s\n", strerror (errno));
|
printf ("SetTimer: sigaction error %s\n", strerror (errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gettimeofday (&settimer_timeval, NULL) != 0) {
|
if (gettimeofday (&settimer_timeval, NULL) != 0) {
|
||||||
printf ("SetTimer: gettimeofday error %s\n", strerror (errno));
|
printf ("SetTimer: gettimeofday error %s\n", strerror (errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
timerval.it_value.tv_sec = DivU64x32 (PeriodMs, 1000);
|
timerval.it_value.tv_sec = DivU64x32 (PeriodMs, 1000);
|
||||||
DivU64x32Remainder (PeriodMs, 1000, &remainder);
|
DivU64x32Remainder (PeriodMs, 1000, &remainder);
|
||||||
timerval.it_value.tv_usec = remainder * 1000;
|
timerval.it_value.tv_usec = remainder * 1000;
|
||||||
@ -194,10 +194,10 @@ SecSetTimer (
|
|||||||
if (setitimer (ITIMER_REAL, &timerval, NULL) != 0) {
|
if (setitimer (ITIMER_REAL, &timerval, NULL) != 0) {
|
||||||
printf ("SetTimer: setitimer error %s\n", strerror (errno));
|
printf ("SetTimer: setitimer error %s\n", strerror (errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
settimer_callback = (UINTN)CallBack;
|
settimer_callback = (UINTN)CallBack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
SecEnableInterrupt (
|
SecEnableInterrupt (
|
||||||
VOID
|
VOID
|
||||||
@ -213,7 +213,6 @@ SecEnableInterrupt (
|
|||||||
pthread_sigmask (SIG_UNBLOCK, &sigset, NULL);
|
pthread_sigmask (SIG_UNBLOCK, &sigset, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
SecDisableInterrupt (
|
SecDisableInterrupt (
|
||||||
VOID
|
VOID
|
||||||
@ -229,14 +228,14 @@ SecDisableInterrupt (
|
|||||||
gEmulatorInterruptEnabled = FALSE;
|
gEmulatorInterruptEnabled = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
SecInterruptEanbled (void)
|
SecInterruptEanbled (
|
||||||
|
void
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return gEmulatorInterruptEnabled;
|
return gEmulatorInterruptEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UINT64
|
UINT64
|
||||||
QueryPerformanceFrequency (
|
QueryPerformanceFrequency (
|
||||||
VOID
|
VOID
|
||||||
@ -255,7 +254,6 @@ QueryPerformanceCounter (
|
|||||||
UINT64 Start;
|
UINT64 Start;
|
||||||
static mach_timebase_info_data_t sTimebaseInfo;
|
static mach_timebase_info_data_t sTimebaseInfo;
|
||||||
|
|
||||||
|
|
||||||
Start = mach_absolute_time ();
|
Start = mach_absolute_time ();
|
||||||
|
|
||||||
// Convert to nanoseconds.
|
// Convert to nanoseconds.
|
||||||
@ -279,8 +277,6 @@ QueryPerformanceCounter (
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
SecSleep (
|
SecSleep (
|
||||||
IN UINT64 Nanoseconds
|
IN UINT64 Nanoseconds
|
||||||
@ -309,17 +305,20 @@ SecSleep (
|
|||||||
if (errno != EINTR) {
|
if (errno != EINTR) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gettimeofday (&start, NULL);
|
gettimeofday (&start, NULL);
|
||||||
if (start.tv_sec > end.tv_sec) {
|
if (start.tv_sec > end.tv_sec) {
|
||||||
break;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rq = rm;
|
rq = rm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
SecCpuSleep (
|
SecCpuSleep (
|
||||||
VOID
|
VOID
|
||||||
@ -334,7 +333,6 @@ SecCpuSleep (
|
|||||||
nanosleep (&rq, &rm);
|
nanosleep (&rq, &rm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
SecExit (
|
SecExit (
|
||||||
UINTN Status
|
UINTN Status
|
||||||
@ -343,7 +341,6 @@ SecExit (
|
|||||||
exit (Status);
|
exit (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
SecGetTime (
|
SecGetTime (
|
||||||
OUT EFI_TIME *Time,
|
OUT EFI_TIME *Time,
|
||||||
@ -374,8 +371,6 @@ SecGetTime (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
SecSetTime (
|
SecSetTime (
|
||||||
IN EFI_TIME *Time
|
IN EFI_TIME *Time
|
||||||
@ -386,7 +381,6 @@ SecSetTime (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
SecGetNextProtocol (
|
SecGetNextProtocol (
|
||||||
IN BOOLEAN EmuBusDriver,
|
IN BOOLEAN EmuBusDriver,
|
||||||
@ -396,7 +390,6 @@ SecGetNextProtocol (
|
|||||||
return GetNextThunkProtocol (EmuBusDriver, Instance);
|
return GetNextThunkProtocol (EmuBusDriver, Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EMU_THUNK_PROTOCOL gEmuThunkProtocol = {
|
EMU_THUNK_PROTOCOL gEmuThunkProtocol = {
|
||||||
GasketSecWriteStdErr,
|
GasketSecWriteStdErr,
|
||||||
GasketSecConfigStdIn,
|
GasketSecConfigStdIn,
|
||||||
@ -422,7 +415,6 @@ EMU_THUNK_PROTOCOL gEmuThunkProtocol = {
|
|||||||
GasketSecGetNextProtocol
|
GasketSecGetNextProtocol
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
SecInitThunkProtocol (
|
SecInitThunkProtocol (
|
||||||
VOID
|
VOID
|
||||||
@ -431,4 +423,3 @@ SecInitThunkProtocol (
|
|||||||
// timezone and daylight lib globals depend on tzset be called 1st.
|
// timezone and daylight lib globals depend on tzset be called 1st.
|
||||||
tzset ();
|
tzset ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,6 @@ GasketSecFree (
|
|||||||
IN VOID *Ptr
|
IN VOID *Ptr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GasketSecPeCoffGetEntryPoint (
|
GasketSecPeCoffGetEntryPoint (
|
||||||
@ -116,7 +115,6 @@ GasketQueryPerformanceCounter (
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GasketSecSleep (
|
GasketSecSleep (
|
||||||
@ -155,10 +153,8 @@ GasketSecGetNextProtocol (
|
|||||||
OUT EMU_IO_THUNK_PROTOCOL **Instance OPTIONAL
|
OUT EMU_IO_THUNK_PROTOCOL **Instance OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// PPIs produced by SEC
|
// PPIs produced by SEC
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GasketSecUnixPeiAutoScan (
|
GasketSecUnixPeiAutoScan (
|
||||||
@ -173,7 +169,6 @@ GasketSecEmuThunkAddress (
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GasketSecUnixUnixFwhAddress (
|
GasketSecUnixUnixFwhAddress (
|
||||||
@ -181,8 +176,6 @@ GasketSecUnixUnixFwhAddress (
|
|||||||
IN OUT EFI_PHYSICAL_ADDRESS *FwhBase
|
IN OUT EFI_PHYSICAL_ADDRESS *FwhBase
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Reverse (UNIX to EFIAPI) gaskets
|
// Reverse (UNIX to EFIAPI) gaskets
|
||||||
//
|
//
|
||||||
@ -210,7 +203,6 @@ ReverseGasketUint64Uint64 (
|
|||||||
// Gasket functions for EFI_EMU_UGA_IO_PROTOCOL
|
// Gasket functions for EFI_EMU_UGA_IO_PROTOCOL
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GasketX11Size (
|
GasketX11Size (
|
||||||
@ -248,7 +240,6 @@ GasketX11RegisterKeyNotify (
|
|||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GasketX11Blt (
|
GasketX11Blt (
|
||||||
@ -291,36 +282,30 @@ GasketPthreadMutexLock (
|
|||||||
IN VOID *Mutex
|
IN VOID *Mutex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GasketPthreadMutexUnLock (
|
GasketPthreadMutexUnLock (
|
||||||
IN VOID *Mutex
|
IN VOID *Mutex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GasketPthreadMutexTryLock (
|
GasketPthreadMutexTryLock (
|
||||||
IN VOID *Mutex
|
IN VOID *Mutex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
VOID *
|
VOID *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GasketPthreadMutexInit (
|
GasketPthreadMutexInit (
|
||||||
IN VOID
|
IN VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GasketPthreadMutexDestroy (
|
GasketPthreadMutexDestroy (
|
||||||
IN VOID *Mutex
|
IN VOID *Mutex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GasketPthreadCreate (
|
GasketPthreadCreate (
|
||||||
@ -336,7 +321,6 @@ GasketPthreadExit (
|
|||||||
IN VOID *ValuePtr
|
IN VOID *ValuePtr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GasketPthreadSelf (
|
GasketPthreadSelf (
|
||||||
@ -355,7 +339,6 @@ GasketPthreadClose (
|
|||||||
IN EMU_IO_THUNK_PROTOCOL *This
|
IN EMU_IO_THUNK_PROTOCOL *This
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// PosixFileSystem
|
// PosixFileSystem
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -639,7 +622,4 @@ GasketSnpReceive (
|
|||||||
OUT UINT16 *Protocol OPTIONAL
|
OUT UINT16 *Protocol OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#define MAP_ANONYMOUS MAP_ANON
|
#define MAP_ANONYMOUS MAP_ANON
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Globals
|
// Globals
|
||||||
//
|
//
|
||||||
@ -26,7 +25,6 @@ EMU_THUNK_PPI mSecEmuThunkPpi = {
|
|||||||
char *gGdbWorkingFileName = NULL;
|
char *gGdbWorkingFileName = NULL;
|
||||||
unsigned int mScriptSymbolChangesCount = 0;
|
unsigned int mScriptSymbolChangesCount = 0;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Default information about where the FD is located.
|
// Default information about where the FD is located.
|
||||||
// This array gets filled in with information from EFI_FIRMWARE_VOLUMES
|
// This array gets filled in with information from EFI_FIRMWARE_VOLUMES
|
||||||
@ -46,17 +44,13 @@ EMU_FD_INFO *gFdInfo;
|
|||||||
UINTN gSystemMemoryCount = 0;
|
UINTN gSystemMemoryCount = 0;
|
||||||
EMU_SYSTEM_MEMORY *gSystemMemory;
|
EMU_SYSTEM_MEMORY *gSystemMemory;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UINTN mImageContextModHandleArraySize = 0;
|
UINTN mImageContextModHandleArraySize = 0;
|
||||||
IMAGE_CONTEXT_TO_MOD_HANDLE *mImageContextModHandleArray = NULL;
|
IMAGE_CONTEXT_TO_MOD_HANDLE *mImageContextModHandleArray = NULL;
|
||||||
|
|
||||||
EFI_PEI_PPI_DESCRIPTOR *gPpiList;
|
EFI_PEI_PPI_DESCRIPTOR *gPpiList;
|
||||||
|
|
||||||
|
|
||||||
int gInXcode = 0;
|
int gInXcode = 0;
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
Breakpoint target for Xcode project. Set in the Xcode XML
|
Breakpoint target for Xcode project. Set in the Xcode XML
|
||||||
|
|
||||||
@ -71,8 +65,6 @@ SecGdbConfigBreak (
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -175,6 +167,7 @@ main (
|
|||||||
printf ("ERROR : Can not allocate memory for system. Exiting.\n");
|
printf ("ERROR : Can not allocate memory for system. Exiting.\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate space for gSystemMemory Array
|
// Allocate space for gSystemMemory Array
|
||||||
//
|
//
|
||||||
@ -194,22 +187,26 @@ main (
|
|||||||
//
|
//
|
||||||
InitialStackMemorySize = STACK_SIZE;
|
InitialStackMemorySize = STACK_SIZE;
|
||||||
InitialStackMemory = (UINTN)MapMemory (
|
InitialStackMemory = (UINTN)MapMemory (
|
||||||
0, (UINT32) InitialStackMemorySize,
|
0,
|
||||||
PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE
|
(UINT32)InitialStackMemorySize,
|
||||||
|
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||||
|
MAP_ANONYMOUS | MAP_PRIVATE
|
||||||
);
|
);
|
||||||
if (InitialStackMemory == 0) {
|
if (InitialStackMemory == 0) {
|
||||||
printf ("ERROR : Can not open SecStack Exiting\n");
|
printf ("ERROR : Can not open SecStack Exiting\n");
|
||||||
exit (1);
|
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 int)(InitialStackMemorySize / 1024),
|
||||||
(unsigned long)InitialStackMemory
|
(unsigned long)InitialStackMemory
|
||||||
);
|
);
|
||||||
|
|
||||||
for (StackPointer = (UINTN *)(UINTN)InitialStackMemory;
|
for (StackPointer = (UINTN *)(UINTN)InitialStackMemory;
|
||||||
StackPointer < (UINTN *)(UINTN)((UINTN)InitialStackMemory + (UINT64)InitialStackMemorySize);
|
StackPointer < (UINTN *)(UINTN)((UINTN)InitialStackMemory + (UINT64)InitialStackMemorySize);
|
||||||
StackPointer ++) {
|
StackPointer++)
|
||||||
|
{
|
||||||
*StackPointer = 0x5AA55AA5;
|
*StackPointer = 0x5AA55AA5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,13 +222,16 @@ main (
|
|||||||
Index2 = 0;
|
Index2 = 0;
|
||||||
for (Done = FALSE, Index = 0, PeiIndex = 0, SecFile = NULL;
|
for (Done = FALSE, Index = 0, PeiIndex = 0, SecFile = NULL;
|
||||||
FirmwareVolumesStr[Index2] != 0;
|
FirmwareVolumesStr[Index2] != 0;
|
||||||
Index++) {
|
Index++)
|
||||||
|
{
|
||||||
for (Index1 = 0; (FirmwareVolumesStr[Index2] != '!') && (FirmwareVolumesStr[Index2] != 0); Index2++) {
|
for (Index1 = 0; (FirmwareVolumesStr[Index2] != '!') && (FirmwareVolumesStr[Index2] != 0); Index2++) {
|
||||||
FileName[Index1++] = FirmwareVolumesStr[Index2];
|
FileName[Index1++] = FirmwareVolumesStr[Index2];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FirmwareVolumesStr[Index2] == '!') {
|
if (FirmwareVolumesStr[Index2] == '!') {
|
||||||
Index2++;
|
Index2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName[Index1] = '\0';
|
FileName[Index1] = '\0';
|
||||||
|
|
||||||
if (Index == 0) {
|
if (Index == 0) {
|
||||||
@ -252,6 +252,7 @@ main (
|
|||||||
&gFdInfo[Index].Size
|
&gFdInfo[Index].Size
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
printf ("ERROR : Can not open Firmware Device File %s (%x). Exiting.\n", FileName, (unsigned int)Status);
|
printf ("ERROR : Can not open Firmware Device File %s (%x). Exiting.\n", FileName, (unsigned int)Status);
|
||||||
exit (1);
|
exit (1);
|
||||||
@ -303,10 +304,12 @@ main (
|
|||||||
val = val * 10 + MemorySizeStr[Index1] - '0';
|
val = val * 10 + MemorySizeStr[Index1] - '0';
|
||||||
Index1++;
|
Index1++;
|
||||||
}
|
}
|
||||||
|
|
||||||
gSystemMemory[Index++].Size = val * 0x100000;
|
gSystemMemory[Index++].Size = val * 0x100000;
|
||||||
if (MemorySizeStr[Index1] == 0) {
|
if (MemorySizeStr[Index1] == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Index1++;
|
Index1++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +328,6 @@ main (
|
|||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_PHYSICAL_ADDRESS *
|
EFI_PHYSICAL_ADDRESS *
|
||||||
MapMemory (
|
MapMemory (
|
||||||
IN INTN fd,
|
IN INTN fd,
|
||||||
@ -348,6 +350,7 @@ MapMemory (
|
|||||||
if (res == MAP_FAILED) {
|
if (res == MAP_FAILED) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((((UINTN)res) & ~(align-1)) == (UINTN)res) {
|
if ((((UINTN)res) & ~(align-1)) == (UINTN)res) {
|
||||||
isAligned = 1;
|
isAligned = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -355,10 +358,10 @@ MapMemory (
|
|||||||
base += align;
|
base += align;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -397,8 +400,8 @@ MapFile (
|
|||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
return EFI_NOT_FOUND;
|
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);
|
res = MapMemory (fd, FileSize, PROT_READ | PROT_EXEC, MAP_PRIVATE);
|
||||||
|
|
||||||
@ -432,6 +435,7 @@ MapFd0 (
|
|||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSize = lseek (fd, 0, SEEK_END);
|
FileSize = lseek (fd, 0, SEEK_END);
|
||||||
|
|
||||||
FvSize = FixedPcdGet64 (PcdEmuFlashFvRecoverySize);
|
FvSize = FixedPcdGet64 (PcdEmuFlashFvRecoverySize);
|
||||||
@ -510,7 +514,6 @@ MapFd0 (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -565,7 +568,6 @@ SecLoadFromCore (
|
|||||||
TopOfStack = (VOID *)((UINTN)TopOfStack - sizeof (EFI_SEC_PEI_HAND_OFF) - CPU_STACK_ALIGNMENT);
|
TopOfStack = (VOID *)((UINTN)TopOfStack - sizeof (EFI_SEC_PEI_HAND_OFF) - CPU_STACK_ALIGNMENT);
|
||||||
TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
|
TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Bind this information into the SEC hand-off state
|
// Bind this information into the SEC hand-off state
|
||||||
//
|
//
|
||||||
@ -603,7 +605,6 @@ SecLoadFromCore (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -639,13 +640,15 @@ SecUnixPeiAutoScan (
|
|||||||
|
|
||||||
*MemoryBase = 0;
|
*MemoryBase = 0;
|
||||||
res = MapMemory (
|
res = MapMemory (
|
||||||
0, gSystemMemory[Index].Size,
|
0,
|
||||||
|
gSystemMemory[Index].Size,
|
||||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||||
MAP_PRIVATE | MAP_ANONYMOUS
|
MAP_PRIVATE | MAP_ANONYMOUS
|
||||||
);
|
);
|
||||||
if (res == MAP_FAILED) {
|
if (res == MAP_FAILED) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
*MemorySize = gSystemMemory[Index].Size;
|
*MemorySize = gSystemMemory[Index].Size;
|
||||||
*MemoryBase = (UINTN)res;
|
*MemoryBase = (UINTN)res;
|
||||||
gSystemMemory[Index].Memory = *MemoryBase;
|
gSystemMemory[Index].Memory = *MemoryBase;
|
||||||
@ -653,7 +656,6 @@ SecUnixPeiAutoScan (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -684,7 +686,8 @@ EfiSystemMemoryRange (
|
|||||||
MemoryBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MemoryAddress;
|
MemoryBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MemoryAddress;
|
||||||
for (Index = 0; Index < gSystemMemoryCount; Index++) {
|
for (Index = 0; Index < gSystemMemoryCount; Index++) {
|
||||||
if ((MemoryBase >= gSystemMemory[Index].Memory) &&
|
if ((MemoryBase >= gSystemMemory[Index].Memory) &&
|
||||||
(MemoryBase < (gSystemMemory[Index].Memory + gSystemMemory[Index].Size)) ) {
|
(MemoryBase < (gSystemMemory[Index].Memory + gSystemMemory[Index].Size)))
|
||||||
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -692,7 +695,6 @@ EfiSystemMemoryRange (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -715,8 +717,6 @@ SecEmuThunkAddress (
|
|||||||
return &gEmuThunkProtocol;
|
return &gEmuThunkProtocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SecPeCoffGetEntryPoint (
|
SecPeCoffGetEntryPoint (
|
||||||
@ -759,6 +759,7 @@ SecPeCoffGetEntryPoint (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageContext.EntryPoint = (UINTN)*EntryPoint;
|
ImageContext.EntryPoint = (UINTN)*EntryPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,8 +770,6 @@ SecPeCoffGetEntryPoint (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -804,7 +803,7 @@ SecUnixFdAddress (
|
|||||||
*FdSize = gFdInfo[Index].Size;
|
*FdSize = gFdInfo[Index].Size;
|
||||||
*FixUp = 0;
|
*FixUp = 0;
|
||||||
|
|
||||||
if (*FdBase == 0 && *FdSize == 0) {
|
if ((*FdBase == 0) && (*FdSize == 0)) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -820,7 +819,6 @@ SecUnixFdAddress (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -851,7 +849,6 @@ CountSeparatorsInString (
|
|||||||
return Count;
|
return Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SecImageRead (
|
SecImageRead (
|
||||||
@ -860,6 +857,7 @@ SecImageRead (
|
|||||||
IN OUT UINTN *ReadSize,
|
IN OUT UINTN *ReadSize,
|
||||||
OUT VOID *Buffer
|
OUT VOID *Buffer
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -890,7 +888,6 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -917,7 +914,6 @@ AddHandle (
|
|||||||
IMAGE_CONTEXT_TO_MOD_HANDLE *Array;
|
IMAGE_CONTEXT_TO_MOD_HANDLE *Array;
|
||||||
UINTN PreviousSize;
|
UINTN PreviousSize;
|
||||||
|
|
||||||
|
|
||||||
Array = mImageContextModHandleArray;
|
Array = mImageContextModHandleArray;
|
||||||
for (Index = 0; Index < mImageContextModHandleArraySize; Index++, Array++) {
|
for (Index = 0; Index < mImageContextModHandleArraySize; Index++, Array++) {
|
||||||
if (Array->ImageContext == NULL) {
|
if (Array->ImageContext == NULL) {
|
||||||
@ -954,7 +950,6 @@ AddHandle (
|
|||||||
return AddHandle (ImageContext, ModHandle);
|
return AddHandle (ImageContext, ModHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -998,8 +993,6 @@ RemoveHandle (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsPdbFile (
|
IsPdbFile (
|
||||||
IN CHAR8 *PdbFileName
|
IN CHAR8 *PdbFileName
|
||||||
@ -1016,16 +1009,16 @@ IsPdbFile (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((PdbFileName[Len - 3] == 'P' || PdbFileName[Len - 3] == 'p') &&
|
if (((PdbFileName[Len - 3] == 'P') || (PdbFileName[Len - 3] == 'p')) &&
|
||||||
(PdbFileName[Len - 2] == 'D' || PdbFileName[Len - 2] == 'd') &&
|
((PdbFileName[Len - 2] == 'D') || (PdbFileName[Len - 2] == 'd')) &&
|
||||||
(PdbFileName[Len - 1] == 'B' || PdbFileName[Len - 1] == 'b')) {
|
((PdbFileName[Len - 1] == 'B') || (PdbFileName[Len - 1] == 'b')))
|
||||||
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define MAX_SPRINT_BUFFER_SIZE 0x200
|
#define MAX_SPRINT_BUFFER_SIZE 0x200
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1034,24 +1027,26 @@ PrintLoadAddress (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (ImageContext->PdbPointer == NULL) {
|
if (ImageContext->PdbPointer == NULL) {
|
||||||
fprintf (stderr,
|
fprintf (
|
||||||
|
stderr,
|
||||||
"0x%08lx Loading NO DEBUG with entry point 0x%08lx\n",
|
"0x%08lx Loading NO DEBUG with entry point 0x%08lx\n",
|
||||||
(unsigned long)(ImageContext->ImageAddress),
|
(unsigned long)(ImageContext->ImageAddress),
|
||||||
(unsigned long)ImageContext->EntryPoint
|
(unsigned long)ImageContext->EntryPoint
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr,
|
fprintf (
|
||||||
|
stderr,
|
||||||
"0x%08lx Loading %s with entry point 0x%08lx\n",
|
"0x%08lx Loading %s with entry point 0x%08lx\n",
|
||||||
(unsigned long)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders),
|
(unsigned long)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders),
|
||||||
ImageContext->PdbPointer,
|
ImageContext->PdbPointer,
|
||||||
(unsigned long)ImageContext->EntryPoint
|
(unsigned long)ImageContext->EntryPoint
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep output synced up
|
// Keep output synced up
|
||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Loads the image using dlopen so symbols will be automatically
|
Loads the image using dlopen so symbols will be automatically
|
||||||
loaded by gdb.
|
loaded by gdb.
|
||||||
@ -1067,7 +1062,6 @@ DlLoadImage (
|
|||||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1112,7 +1106,6 @@ DlLoadImage (
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
__attribute__ ((noinline))
|
__attribute__ ((noinline))
|
||||||
#endif
|
#endif
|
||||||
@ -1127,7 +1120,6 @@ SecGdbScriptBreak (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Adds the image to a gdb script so its symbols can be loaded.
|
Adds the image to a gdb script so its symbols can be loaded.
|
||||||
The AddFirmwareSymbolFile helper macro is used.
|
The AddFirmwareSymbolFile helper macro is used.
|
||||||
@ -1140,10 +1132,9 @@ GdbScriptAddImage (
|
|||||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
PrintLoadAddress (ImageContext);
|
PrintLoadAddress (ImageContext);
|
||||||
|
|
||||||
if (ImageContext->PdbPointer != NULL && !IsPdbFile (ImageContext->PdbPointer)) {
|
if ((ImageContext->PdbPointer != NULL) && !IsPdbFile (ImageContext->PdbPointer)) {
|
||||||
FILE *GdbTempFile;
|
FILE *GdbTempFile;
|
||||||
if (FeaturePcdGet (PcdEmulatorLazyLoadSymbols)) {
|
if (FeaturePcdGet (PcdEmulatorLazyLoadSymbols)) {
|
||||||
GdbTempFile = fopen (gGdbWorkingFileName, "a");
|
GdbTempFile = fopen (gGdbWorkingFileName, "a");
|
||||||
@ -1188,7 +1179,6 @@ GdbScriptAddImage (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SecPeCoffRelocateImageExtraAction (
|
SecPeCoffRelocateImageExtraAction (
|
||||||
@ -1200,7 +1190,6 @@ SecPeCoffRelocateImageExtraAction (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Adds the image to a gdb script so its symbols can be unloaded.
|
Adds the image to a gdb script so its symbols can be unloaded.
|
||||||
The RemoveFirmwareSymbolFile helper macro is used.
|
The RemoveFirmwareSymbolFile helper macro is used.
|
||||||
@ -1257,7 +1246,6 @@ GdbScriptRemoveImage (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SecPeCoffUnloadImageExtraAction (
|
SecPeCoffUnloadImageExtraAction (
|
||||||
@ -1279,5 +1267,3 @@ SecPeCoffUnloadImageExtraAction (
|
|||||||
|
|
||||||
GdbScriptRemoveImage (ImageContext);
|
GdbScriptRemoveImage (ImageContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,10 +120,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Guid/FileSystemInfo.h>
|
#include <Guid/FileSystemInfo.h>
|
||||||
#include <Guid/FileSystemVolumeLabelInfo.h>
|
#include <Guid/FileSystemVolumeLabelInfo.h>
|
||||||
|
|
||||||
|
|
||||||
#include "Gasket.h"
|
#include "Gasket.h"
|
||||||
|
|
||||||
|
|
||||||
#define STACK_SIZE 0x20000
|
#define STACK_SIZE 0x20000
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -136,7 +134,6 @@ typedef struct {
|
|||||||
UINT64 Size;
|
UINT64 Size;
|
||||||
} EMU_SYSTEM_MEMORY;
|
} EMU_SYSTEM_MEMORY;
|
||||||
|
|
||||||
|
|
||||||
#define MAX_IMAGE_CONTEXT_TO_MOD_HANDLE_ARRAY_SIZE 0x100
|
#define MAX_IMAGE_CONTEXT_TO_MOD_HANDLE_ARRAY_SIZE 0x100
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -144,7 +141,6 @@ typedef struct {
|
|||||||
VOID *ModHandle;
|
VOID *ModHandle;
|
||||||
} IMAGE_CONTEXT_TO_MOD_HANDLE;
|
} IMAGE_CONTEXT_TO_MOD_HANDLE;
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SecUnixPeiLoadFile (
|
SecUnixPeiLoadFile (
|
||||||
@ -230,7 +226,6 @@ GasketSecUnixFdAddress (
|
|||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetImageReadFunction (
|
GetImageReadFunction (
|
||||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
|
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
|
||||||
@ -276,7 +271,6 @@ GasketSecTemporaryRamSupport (
|
|||||||
IN UINTN CopySize
|
IN UINTN CopySize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SecPeCoffGetEntryPoint (
|
SecPeCoffGetEntryPoint (
|
||||||
@ -296,7 +290,6 @@ SecPeCoffLoaderUnloadImageExtraAction (
|
|||||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
PeiSwitchStacks (
|
PeiSwitchStacks (
|
||||||
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
@ -310,13 +303,13 @@ SecInitThunkProtocol (
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
EFI_PHYSICAL_ADDRESS *
|
EFI_PHYSICAL_ADDRESS *
|
||||||
MapMemory (
|
MapMemory (
|
||||||
INTN fd,
|
INTN fd,
|
||||||
UINT64 length,
|
UINT64 length,
|
||||||
INTN prot,
|
INTN prot,
|
||||||
INTN flags);
|
INTN flags
|
||||||
|
);
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
MapFile (
|
MapFile (
|
||||||
@ -337,12 +330,25 @@ EfiSystemMemoryRange (
|
|||||||
IN VOID *MemoryAddress
|
IN VOID *MemoryAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SecSleep (
|
||||||
|
UINT64 Nanoseconds
|
||||||
|
);
|
||||||
|
|
||||||
VOID SecSleep (UINT64 Nanoseconds);
|
VOID
|
||||||
VOID SecEnableInterrupt (VOID);
|
SecEnableInterrupt (
|
||||||
VOID SecDisableInterrupt (VOID);
|
VOID
|
||||||
BOOLEAN SecInterruptEanbled (VOID);
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SecDisableInterrupt (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
SecInterruptEanbled (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
extern EMU_THUNK_PROTOCOL gEmuThunkProtocol;
|
extern EMU_THUNK_PROTOCOL gEmuThunkProtocol;
|
||||||
extern EMU_IO_THUNK_PROTOCOL gX11ThunkIo;
|
extern EMU_IO_THUNK_PROTOCOL gX11ThunkIo;
|
||||||
|
@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "Host.h"
|
#include "Host.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Transfers control to a function starting with a new stack.
|
Transfers control to a function starting with a new stack.
|
||||||
|
|
||||||
@ -57,7 +56,6 @@ PeiSwitchStacks (
|
|||||||
|
|
||||||
LongJump (&JumpBuffer, (UINTN)-1);
|
LongJump (&JumpBuffer, (UINTN)-1);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// PeiSwitchStacks () will never return
|
// PeiSwitchStacks () will never return
|
||||||
//
|
//
|
||||||
|
@ -12,7 +12,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "Host.h"
|
#include "Host.h"
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
@ -23,10 +22,8 @@ typedef struct {
|
|||||||
|
|
||||||
EMU_IO_THUNK_PROTOCOL *Thunk;
|
EMU_IO_THUNK_PROTOCOL *Thunk;
|
||||||
|
|
||||||
|
|
||||||
EMU_SNP_PROTOCOL EmuSnp;
|
EMU_SNP_PROTOCOL EmuSnp;
|
||||||
EFI_SIMPLE_NETWORK_MODE *Mode;
|
EFI_SIMPLE_NETWORK_MODE *Mode;
|
||||||
|
|
||||||
} EMU_SNP_PRIVATE;
|
} EMU_SNP_PRIVATE;
|
||||||
|
|
||||||
#define EMU_SNP_PRIVATE_DATA_FROM_THIS(a) \
|
#define EMU_SNP_PRIVATE_DATA_FROM_THIS(a) \
|
||||||
@ -517,7 +514,6 @@ EmuSnpReceive (
|
|||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EMU_SNP_PROTOCOL gEmuSnpProtocol = {
|
EMU_SNP_PROTOCOL gEmuSnpProtocol = {
|
||||||
GasketSnpCreateMapping,
|
GasketSnpCreateMapping,
|
||||||
GasketSnpStart,
|
GasketSnpStart,
|
||||||
@ -555,7 +551,6 @@ EmuSnpThunkOpen (
|
|||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Private->Signature = EMU_SNP_PRIVATE_SIGNATURE;
|
Private->Signature = EMU_SNP_PRIVATE_SIGNATURE;
|
||||||
Private->Thunk = This;
|
Private->Thunk = This;
|
||||||
CopyMem (&Private->EmuSnp, &gEmuSnpProtocol, sizeof (gEmuSnpProtocol));
|
CopyMem (&Private->EmuSnp, &gEmuSnpProtocol, sizeof (gEmuSnpProtocol));
|
||||||
@ -565,7 +560,6 @@ EmuSnpThunkOpen (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EmuSnpThunkClose (
|
EmuSnpThunkClose (
|
||||||
IN EMU_IO_THUNK_PROTOCOL *This
|
IN EMU_IO_THUNK_PROTOCOL *This
|
||||||
@ -583,8 +577,6 @@ EmuSnpThunkClose (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EMU_IO_THUNK_PROTOCOL gSnpThunkIo = {
|
EMU_IO_THUNK_PROTOCOL gSnpThunkIo = {
|
||||||
&gEmuSnpProtocolGuid,
|
&gEmuSnpProtocolGuid,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -33,7 +33,6 @@ AllocatePool (
|
|||||||
return (VOID *)malloc (AllocationSize);
|
return (VOID *)malloc (AllocationSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allocates and zeros a buffer of type EfiBootServicesData.
|
Allocates and zeros a buffer of type EfiBootServicesData.
|
||||||
|
|
||||||
@ -65,7 +64,6 @@ AllocateZeroPool (
|
|||||||
return Buffer;
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reallocates a buffer of type EfiBootServicesData.
|
Reallocates a buffer of type EfiBootServicesData.
|
||||||
|
|
||||||
@ -113,7 +111,6 @@ ReallocatePool (
|
|||||||
return NewBuffer;
|
return NewBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Frees a buffer that was previously allocated with one of the pool allocation functions in the
|
Frees a buffer that was previously allocated with one of the pool allocation functions in the
|
||||||
Memory Allocation Library.
|
Memory Allocation Library.
|
||||||
@ -136,4 +133,3 @@ FreePool (
|
|||||||
{
|
{
|
||||||
free ((void *)Buffer);
|
free ((void *)Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "Host.h"
|
#include "Host.h"
|
||||||
|
|
||||||
|
|
||||||
#define EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'P', 'f', 's')
|
#define EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'P', 'f', 's')
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -29,7 +28,6 @@ typedef struct {
|
|||||||
EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \
|
EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
#define EMU_EFI_FILE_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'P', 'f', 'i')
|
#define EMU_EFI_FILE_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'P', 'f', 'i')
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -69,7 +67,6 @@ PosixFileSetInfo (
|
|||||||
IN VOID *Buffer
|
IN VOID *Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
EFI_FILE_PROTOCOL gPosixFileProtocol = {
|
EFI_FILE_PROTOCOL gPosixFileProtocol = {
|
||||||
EFI_FILE_REVISION,
|
EFI_FILE_REVISION,
|
||||||
GasketPosixFileOpen,
|
GasketPosixFileOpen,
|
||||||
@ -89,7 +86,6 @@ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL gPosixFileSystemProtocol = {
|
|||||||
GasketPosixOpenVolume,
|
GasketPosixOpenVolume,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Open the root directory on a volume.
|
Open the root directory on a volume.
|
||||||
|
|
||||||
@ -127,6 +123,7 @@ PosixOpenVolume (
|
|||||||
if (PrivateFile->FileName == NULL) {
|
if (PrivateFile->FileName == NULL) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrCpyS (
|
AsciiStrCpyS (
|
||||||
PrivateFile->FileName,
|
PrivateFile->FileName,
|
||||||
AsciiStrSize (Private->FilePath),
|
AsciiStrSize (Private->FilePath),
|
||||||
@ -171,9 +168,9 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ErrnoToEfiStatus ()
|
ErrnoToEfiStatus (
|
||||||
|
)
|
||||||
{
|
{
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case EACCES:
|
case EACCES:
|
||||||
@ -207,7 +204,6 @@ CutPrefix (
|
|||||||
*Pointer = *(Pointer + Count);
|
*Pointer = *(Pointer + Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
PosixSystemTimeToEfiTime (
|
PosixSystemTimeToEfiTime (
|
||||||
IN time_t SystemTime,
|
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);
|
Time->Daylight = (daylight ? EFI_TIME_ADJUST_DAYLIGHT : 0) | (tm->tm_isdst > 0 ? EFI_TIME_IN_DAYLIGHT : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
UnixSimpleFileSystemFileInfo (
|
UnixSimpleFileSystemFileInfo (
|
||||||
EMU_EFI_FILE_PRIVATE *PrivateFile,
|
EMU_EFI_FILE_PRIVATE *PrivateFile,
|
||||||
@ -273,7 +268,8 @@ UnixSimpleFileSystemFileInfo (
|
|||||||
*BufferSize = ResultSize;
|
*BufferSize = ResultSize;
|
||||||
return EFI_BUFFER_TOO_SMALL;
|
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;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,11 +294,11 @@ UnixSimpleFileSystemFileInfo (
|
|||||||
Info->Attribute |= EFI_FILE_DIRECTORY;
|
Info->Attribute |= EFI_FILE_DIRECTORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BufferFileName = (CHAR16 *)((CHAR8 *)Buffer + Size);
|
BufferFileName = (CHAR16 *)((CHAR8 *)Buffer + Size);
|
||||||
while (*RealFileName) {
|
while (*RealFileName) {
|
||||||
*BufferFileName++ = *RealFileName++;
|
*BufferFileName++ = *RealFileName++;
|
||||||
}
|
}
|
||||||
|
|
||||||
*BufferFileName = 0;
|
*BufferFileName = 0;
|
||||||
|
|
||||||
*BufferSize = ResultSize;
|
*BufferSize = ResultSize;
|
||||||
@ -315,7 +311,7 @@ IsZero (
|
|||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Buffer == NULL || Length == 0) {
|
if ((Buffer == NULL) || (Length == 0)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,8 +328,6 @@ IsZero (
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Opens a new file relative to the source file's location.
|
Opens a new file relative to the source file's location.
|
||||||
|
|
||||||
@ -394,7 +388,8 @@ PosixFileOpen (
|
|||||||
//
|
//
|
||||||
TrailingDash = FALSE;
|
TrailingDash = FALSE;
|
||||||
if ((StrCmp (FileName, L"\\") == 0) ||
|
if ((StrCmp (FileName, L"\\") == 0) ||
|
||||||
(StrCmp (FileName, L".") == 0 && PrivateFile->IsRootDirectory)) {
|
((StrCmp (FileName, L".") == 0) && PrivateFile->IsRootDirectory))
|
||||||
|
{
|
||||||
OpenRoot:
|
OpenRoot:
|
||||||
Status = PosixOpenVolume (PrivateFile->SimpleFileSystem, &Root);
|
Status = PosixOpenVolume (PrivateFile->SimpleFileSystem, &Root);
|
||||||
NewPrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (Root);
|
NewPrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (Root);
|
||||||
@ -430,6 +425,7 @@ OpenRoot:
|
|||||||
AsciiStrCpyS (NewPrivateFile->FileName, Size, PrivateFile->FileName);
|
AsciiStrCpyS (NewPrivateFile->FileName, Size, PrivateFile->FileName);
|
||||||
Src = FileName;
|
Src = FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dst = NewPrivateFile->FileName + AsciiStrLen (NewPrivateFile->FileName);
|
Dst = NewPrivateFile->FileName + AsciiStrLen (NewPrivateFile->FileName);
|
||||||
GuardPointer = NewPrivateFile->FileName + AsciiStrLen (PrivateRoot->FilePath);
|
GuardPointer = NewPrivateFile->FileName + AsciiStrLen (PrivateRoot->FilePath);
|
||||||
*Dst++ = '/';
|
*Dst++ = '/';
|
||||||
@ -440,10 +436,11 @@ OpenRoot:
|
|||||||
} else {
|
} else {
|
||||||
*Dst++ = *Src;
|
*Dst++ = *Src;
|
||||||
}
|
}
|
||||||
|
|
||||||
Src++;
|
Src++;
|
||||||
}
|
}
|
||||||
*Dst = 0;
|
|
||||||
|
|
||||||
|
*Dst = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get rid of . and .., except leading . or ..
|
// Get rid of . and .., except leading . or ..
|
||||||
@ -458,11 +455,11 @@ OpenRoot:
|
|||||||
LoopFinish = TRUE;
|
LoopFinish = TRUE;
|
||||||
|
|
||||||
for (ParseFileName = GuardPointer; *ParseFileName; ParseFileName++) {
|
for (ParseFileName = GuardPointer; *ParseFileName; ParseFileName++) {
|
||||||
if (*ParseFileName == '.' &&
|
if ((*ParseFileName == '.') &&
|
||||||
(*(ParseFileName + 1) == 0 || *(ParseFileName + 1) == '/') &&
|
((*(ParseFileName + 1) == 0) || (*(ParseFileName + 1) == '/')) &&
|
||||||
*(ParseFileName - 1) == '/'
|
(*(ParseFileName - 1) == '/')
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// cut /.
|
// cut /.
|
||||||
//
|
//
|
||||||
@ -471,12 +468,12 @@ OpenRoot:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*ParseFileName == '.' &&
|
if ((*ParseFileName == '.') &&
|
||||||
*(ParseFileName + 1) == '.' &&
|
(*(ParseFileName + 1) == '.') &&
|
||||||
(*(ParseFileName + 2) == 0 || *(ParseFileName + 2) == '/') &&
|
((*(ParseFileName + 2) == 0) || (*(ParseFileName + 2) == '/')) &&
|
||||||
*(ParseFileName - 1) == '/'
|
(*(ParseFileName - 1) == '/')
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
ParseFileName--;
|
ParseFileName--;
|
||||||
Count = 3;
|
Count = 3;
|
||||||
|
|
||||||
@ -514,7 +511,6 @@ OpenRoot:
|
|||||||
*(RealFileName - 1) = 0;
|
*(RealFileName - 1) = 0;
|
||||||
*(RealFileName - 1) = TempChar;
|
*(RealFileName - 1) = TempChar;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test whether file or directory
|
// Test whether file or directory
|
||||||
//
|
//
|
||||||
@ -529,7 +525,7 @@ OpenRoot:
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
res = stat (NewPrivateFile->FileName, &finfo);
|
res = stat (NewPrivateFile->FileName, &finfo);
|
||||||
if (res == 0 && S_ISDIR(finfo.st_mode)) {
|
if ((res == 0) && S_ISDIR (finfo.st_mode)) {
|
||||||
NewPrivateFile->IsDirectoryPath = TRUE;
|
NewPrivateFile->IsDirectoryPath = TRUE;
|
||||||
} else {
|
} else {
|
||||||
NewPrivateFile->IsDirectoryPath = FALSE;
|
NewPrivateFile->IsDirectoryPath = FALSE;
|
||||||
@ -571,7 +567,6 @@ OpenRoot:
|
|||||||
|
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// deal with file
|
// 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
|
// Set the attribute
|
||||||
//
|
//
|
||||||
@ -639,8 +634,6 @@ Done: ;
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Close the file handle
|
Close the file handle
|
||||||
|
|
||||||
@ -661,6 +654,7 @@ PosixFileCLose (
|
|||||||
if (PrivateFile->fd >= 0) {
|
if (PrivateFile->fd >= 0) {
|
||||||
close (PrivateFile->fd);
|
close (PrivateFile->fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivateFile->Dir != NULL) {
|
if (PrivateFile->Dir != NULL) {
|
||||||
closedir (PrivateFile->Dir);
|
closedir (PrivateFile->Dir);
|
||||||
}
|
}
|
||||||
@ -677,7 +671,6 @@ PosixFileCLose (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Close and delete the file handle.
|
Close and delete the file handle.
|
||||||
|
|
||||||
@ -724,7 +717,6 @@ PosixFileDelete (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read data from the file.
|
Read data from the file.
|
||||||
|
|
||||||
@ -768,6 +760,7 @@ PosixFileRead (
|
|||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
*BufferSize = Res;
|
*BufferSize = Res;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
goto Done;
|
goto Done;
|
||||||
@ -799,6 +792,7 @@ PosixFileRead (
|
|||||||
Status = EFI_BUFFER_TOO_SMALL;
|
Status = EFI_BUFFER_TOO_SMALL;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
*BufferSize = ResultSize;
|
*BufferSize = ResultSize;
|
||||||
@ -827,8 +821,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Write data to a file.
|
Write data to a file.
|
||||||
|
|
||||||
@ -857,7 +849,6 @@ PosixFileWrite (
|
|||||||
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
||||||
int Res;
|
int Res;
|
||||||
|
|
||||||
|
|
||||||
PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
||||||
|
|
||||||
if (PrivateFile->fd < 0) {
|
if (PrivateFile->fd < 0) {
|
||||||
@ -881,8 +872,6 @@ PosixFileWrite (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set a files current position
|
Set a files current position
|
||||||
|
|
||||||
@ -912,6 +901,7 @@ PosixFileSetPossition (
|
|||||||
if (PrivateFile->Dir == NULL) {
|
if (PrivateFile->Dir == NULL) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
rewinddir (PrivateFile->Dir);
|
rewinddir (PrivateFile->Dir);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
@ -920,15 +910,15 @@ PosixFileSetPossition (
|
|||||||
} else {
|
} else {
|
||||||
Pos = lseek (PrivateFile->fd, Position, SEEK_SET);
|
Pos = lseek (PrivateFile->fd, Position, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pos == (off_t)-1) {
|
if (Pos == (off_t)-1) {
|
||||||
return ErrnoToEfiStatus ();
|
return ErrnoToEfiStatus ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get a file's current position
|
Get a file's current position
|
||||||
|
|
||||||
@ -960,7 +950,6 @@ PosixFileGetPossition (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get information about a file.
|
Get information about a file.
|
||||||
|
|
||||||
@ -1022,14 +1011,12 @@ PosixFileGetInfo (
|
|||||||
FileSystemInfoBuffer->FreeSpace = MultU64x32 (buf.f_bavail, buf.f_bsize);
|
FileSystemInfoBuffer->FreeSpace = MultU64x32 (buf.f_bavail, buf.f_bsize);
|
||||||
FileSystemInfoBuffer->BlockSize = buf.f_bsize;
|
FileSystemInfoBuffer->BlockSize = buf.f_bsize;
|
||||||
|
|
||||||
|
|
||||||
StrCpyS (
|
StrCpyS (
|
||||||
(CHAR16 *)FileSystemInfoBuffer->VolumeLabel,
|
(CHAR16 *)FileSystemInfoBuffer->VolumeLabel,
|
||||||
(*BufferSize - SIZE_OF_EFI_FILE_SYSTEM_INFO) / sizeof (CHAR16),
|
(*BufferSize - SIZE_OF_EFI_FILE_SYSTEM_INFO) / sizeof (CHAR16),
|
||||||
PrivateRoot->VolumeLabel
|
PrivateRoot->VolumeLabel
|
||||||
);
|
);
|
||||||
*BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
|
*BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
|
||||||
|
|
||||||
} else if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
|
} else if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
|
||||||
if (*BufferSize < StrSize (PrivateRoot->VolumeLabel)) {
|
if (*BufferSize < StrSize (PrivateRoot->VolumeLabel)) {
|
||||||
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
|
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
|
||||||
@ -1042,13 +1029,11 @@ PosixFileGetInfo (
|
|||||||
PrivateRoot->VolumeLabel
|
PrivateRoot->VolumeLabel
|
||||||
);
|
);
|
||||||
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
|
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set information about a file
|
Set information about a file
|
||||||
|
|
||||||
@ -1171,10 +1156,11 @@ PosixFileSetInfo (
|
|||||||
// Check for invalid set file information parameters.
|
// Check for invalid set file information parameters.
|
||||||
//
|
//
|
||||||
NewFileInfo = (EFI_FILE_INFO *)Buffer;
|
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)) ||
|
(NewFileInfo->Attribute &~(EFI_FILE_VALID_ATTR)) ||
|
||||||
(sizeof (UINTN) == 4 && NewFileInfo->Size > 0xFFFFFFFF)
|
((sizeof (UINTN) == 4) && (NewFileInfo->Size > 0xFFFFFFFF))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
@ -1240,12 +1226,15 @@ PosixFileSetInfo (
|
|||||||
AsciiFilePtr[1] = '\0';
|
AsciiFilePtr[1] = '\0';
|
||||||
AsciiFilePtr++;
|
AsciiFilePtr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnicodeFilePtr = NewFileInfo->FileName;
|
UnicodeFilePtr = NewFileInfo->FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert to ascii.
|
// Convert to ascii.
|
||||||
while (*UnicodeFilePtr) {
|
while (*UnicodeFilePtr) {
|
||||||
*AsciiFilePtr++ = *UnicodeFilePtr++;
|
*AsciiFilePtr++ = *UnicodeFilePtr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
*AsciiFilePtr = 0;
|
*AsciiFilePtr = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1280,15 +1269,18 @@ PosixFileSetInfo (
|
|||||||
//
|
//
|
||||||
if (!IsZero (&NewFileInfo->CreateTime, sizeof (EFI_TIME)) &&
|
if (!IsZero (&NewFileInfo->CreateTime, sizeof (EFI_TIME)) &&
|
||||||
CompareMem (&NewFileInfo->CreateTime, &OldFileInfo->CreateTime, sizeof (EFI_TIME))
|
CompareMem (&NewFileInfo->CreateTime, &OldFileInfo->CreateTime, sizeof (EFI_TIME))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
TimeChangeFlag = TRUE;
|
TimeChangeFlag = TRUE;
|
||||||
} else if (!IsZero (&NewFileInfo->LastAccessTime, sizeof (EFI_TIME)) &&
|
} else if (!IsZero (&NewFileInfo->LastAccessTime, sizeof (EFI_TIME)) &&
|
||||||
CompareMem (&NewFileInfo->LastAccessTime, &OldFileInfo->LastAccessTime, sizeof (EFI_TIME))
|
CompareMem (&NewFileInfo->LastAccessTime, &OldFileInfo->LastAccessTime, sizeof (EFI_TIME))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
TimeChangeFlag = TRUE;
|
TimeChangeFlag = TRUE;
|
||||||
} else if (!IsZero (&NewFileInfo->ModificationTime, sizeof (EFI_TIME)) &&
|
} else if (!IsZero (&NewFileInfo->ModificationTime, sizeof (EFI_TIME)) &&
|
||||||
CompareMem (&NewFileInfo->ModificationTime, &OldFileInfo->ModificationTime, sizeof (EFI_TIME))
|
CompareMem (&NewFileInfo->ModificationTime, &OldFileInfo->ModificationTime, sizeof (EFI_TIME))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
TimeChangeFlag = TRUE;
|
TimeChangeFlag = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1369,7 +1361,6 @@ PosixFileSetInfo (
|
|||||||
Status = ErrnoToEfiStatus ();
|
Status = ErrnoToEfiStatus ();
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1396,7 +1387,7 @@ PosixFileSetInfo (
|
|||||||
|
|
||||||
Utime.modtime = mktime (&NewLastWriteSystemTime);
|
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;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1438,7 +1429,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Flush data back for the file handle.
|
Flush data back for the file handle.
|
||||||
|
|
||||||
@ -1461,7 +1451,6 @@ PosixFileFlush (
|
|||||||
{
|
{
|
||||||
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
EMU_EFI_FILE_PRIVATE *PrivateFile;
|
||||||
|
|
||||||
|
|
||||||
PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
||||||
|
|
||||||
if (PrivateFile->IsDirectoryPath) {
|
if (PrivateFile->IsDirectoryPath) {
|
||||||
@ -1483,8 +1472,6 @@ PosixFileFlush (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PosixFileSystmeThunkOpen (
|
PosixFileSystmeThunkOpen (
|
||||||
IN EMU_IO_THUNK_PROTOCOL *This
|
IN EMU_IO_THUNK_PROTOCOL *This
|
||||||
@ -1516,8 +1503,8 @@ PosixFileSystmeThunkOpen (
|
|||||||
for (i = 0; This->ConfigString[i] != 0; i++) {
|
for (i = 0; This->ConfigString[i] != 0; i++) {
|
||||||
Private->FilePath[i] = This->ConfigString[i];
|
Private->FilePath[i] = This->ConfigString[i];
|
||||||
}
|
}
|
||||||
Private->FilePath[i] = 0;
|
|
||||||
|
|
||||||
|
Private->FilePath[i] = 0;
|
||||||
|
|
||||||
Private->VolumeLabel = malloc (StrSize (L"EFI_EMULATED"));
|
Private->VolumeLabel = malloc (StrSize (L"EFI_EMULATED"));
|
||||||
if (Private->VolumeLabel == NULL) {
|
if (Private->VolumeLabel == NULL) {
|
||||||
@ -1525,6 +1512,7 @@ PosixFileSystmeThunkOpen (
|
|||||||
free (Private);
|
free (Private);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpyS (
|
StrCpyS (
|
||||||
Private->VolumeLabel,
|
Private->VolumeLabel,
|
||||||
StrSize (L"EFI_EMULATED") / sizeof (CHAR16),
|
StrSize (L"EFI_EMULATED") / sizeof (CHAR16),
|
||||||
@ -1541,7 +1529,6 @@ PosixFileSystmeThunkOpen (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PosixFileSystmeThunkClose (
|
PosixFileSystmeThunkClose (
|
||||||
IN EMU_IO_THUNK_PROTOCOL *This
|
IN EMU_IO_THUNK_PROTOCOL *This
|
||||||
@ -1566,6 +1553,7 @@ PosixFileSystmeThunkClose (
|
|||||||
if (Private->VolumeLabel != NULL) {
|
if (Private->VolumeLabel != NULL) {
|
||||||
free (Private->VolumeLabel);
|
free (Private->VolumeLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
free (This->Private);
|
free (This->Private);
|
||||||
This->Private = NULL;
|
This->Private = NULL;
|
||||||
}
|
}
|
||||||
@ -1573,7 +1561,6 @@ PosixFileSystmeThunkClose (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EMU_IO_THUNK_PROTOCOL gPosixFileSystemThunkIo = {
|
EMU_IO_THUNK_PROTOCOL gPosixFileSystemThunkIo = {
|
||||||
&gEfiSimpleFileSystemProtocolGuid,
|
&gEfiSimpleFileSystemProtocolGuid,
|
||||||
NULL,
|
NULL,
|
||||||
@ -1583,5 +1570,3 @@ EMU_IO_THUNK_PROTOCOL gPosixFileSystemThunkIo = {
|
|||||||
GasketPosixFileSystmeThunkClose,
|
GasketPosixFileSystmeThunkClose,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include "Host.h"
|
#include "Host.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PthreadMutexLock (
|
PthreadMutexLock (
|
||||||
@ -22,8 +21,6 @@ PthreadMutexLock (
|
|||||||
return (UINTN)pthread_mutex_lock ((pthread_mutex_t *)Mutex);
|
return (UINTN)pthread_mutex_lock ((pthread_mutex_t *)Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PthreadMutexUnLock (
|
PthreadMutexUnLock (
|
||||||
@ -33,7 +30,6 @@ PthreadMutexUnLock (
|
|||||||
return (UINTN)pthread_mutex_unlock ((pthread_mutex_t *)Mutex);
|
return (UINTN)pthread_mutex_unlock ((pthread_mutex_t *)Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PthreadMutexTryLock (
|
PthreadMutexTryLock (
|
||||||
@ -43,7 +39,6 @@ PthreadMutexTryLock (
|
|||||||
return (UINTN)pthread_mutex_trylock ((pthread_mutex_t *)Mutex);
|
return (UINTN)pthread_mutex_trylock ((pthread_mutex_t *)Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID *
|
VOID *
|
||||||
PthreadMutexInit (
|
PthreadMutexInit (
|
||||||
IN VOID
|
IN VOID
|
||||||
@ -61,7 +56,6 @@ PthreadMutexInit (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
PthreadMutexDestroy (
|
PthreadMutexDestroy (
|
||||||
IN VOID *Mutex
|
IN VOID *Mutex
|
||||||
@ -151,7 +145,6 @@ PthreadCreate (
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
PthreadExit (
|
PthreadExit (
|
||||||
IN VOID *ValuePtr
|
IN VOID *ValuePtr
|
||||||
@ -161,7 +154,6 @@ PthreadExit (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
PthreadSelf (
|
PthreadSelf (
|
||||||
VOID
|
VOID
|
||||||
@ -173,7 +165,6 @@ PthreadSelf (
|
|||||||
return (UINTN)pthread_self ();
|
return (UINTN)pthread_self ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EMU_THREAD_THUNK_PROTOCOL gPthreadThunk = {
|
EMU_THREAD_THUNK_PROTOCOL gPthreadThunk = {
|
||||||
GasketPthreadMutexLock,
|
GasketPthreadMutexLock,
|
||||||
GasketPthreadMutexUnLock,
|
GasketPthreadMutexUnLock,
|
||||||
@ -185,7 +176,6 @@ EMU_THREAD_THUNK_PROTOCOL gPthreadThunk = {
|
|||||||
GasketPthreadSelf
|
GasketPthreadSelf
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PthreadOpen (
|
PthreadOpen (
|
||||||
IN EMU_IO_THUNK_PROTOCOL *This
|
IN EMU_IO_THUNK_PROTOCOL *This
|
||||||
@ -206,7 +196,6 @@ PthreadOpen (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PthreadClose (
|
PthreadClose (
|
||||||
IN EMU_IO_THUNK_PROTOCOL *This
|
IN EMU_IO_THUNK_PROTOCOL *This
|
||||||
@ -215,7 +204,6 @@ PthreadClose (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EMU_IO_THUNK_PROTOCOL gPthreadThunkIo = {
|
EMU_IO_THUNK_PROTOCOL gPthreadThunkIo = {
|
||||||
&gEmuThreadThunkProtocolGuid,
|
&gEmuThreadThunkProtocolGuid,
|
||||||
NULL,
|
NULL,
|
||||||
@ -225,5 +213,3 @@ EMU_IO_THUNK_PROTOCOL gPthreadThunkIo = {
|
|||||||
GasketPthreadClose,
|
GasketPthreadClose,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#define KEYSYM_LOWER 0
|
#define KEYSYM_LOWER 0
|
||||||
#define KEYSYM_UPPER 1
|
#define KEYSYM_UPPER 1
|
||||||
|
|
||||||
|
|
||||||
struct uga_drv_shift_mask {
|
struct uga_drv_shift_mask {
|
||||||
unsigned char shift;
|
unsigned char shift;
|
||||||
unsigned char size;
|
unsigned char size;
|
||||||
@ -87,10 +86,12 @@ fill_shift_mask (
|
|||||||
mask >>= 1;
|
mask >>= 1;
|
||||||
sm->shift++;
|
sm->shift++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (mask & 1) {
|
while (mask & 1) {
|
||||||
sm->size++;
|
sm->size++;
|
||||||
mask >>= 1;
|
mask >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sm->csize = 8 - sm->size;
|
sm->csize = 8 - sm->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,9 +101,14 @@ TryCreateShmImage (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
Drv->image = XShmCreateImage (
|
Drv->image = XShmCreateImage (
|
||||||
Drv->display, Drv->visual,
|
Drv->display,
|
||||||
Drv->depth, ZPixmap, NULL, &Drv->xshm_info,
|
Drv->visual,
|
||||||
Drv->width, Drv->height
|
Drv->depth,
|
||||||
|
ZPixmap,
|
||||||
|
NULL,
|
||||||
|
&Drv->xshm_info,
|
||||||
|
Drv->width,
|
||||||
|
Drv->height
|
||||||
);
|
);
|
||||||
if (Drv->image == NULL) {
|
if (Drv->image == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -121,7 +127,8 @@ TryCreateShmImage (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Drv->xshm_info.shmid = shmget (
|
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
|
IPC_CREAT | 0777
|
||||||
);
|
);
|
||||||
if (Drv->xshm_info.shmid < 0) {
|
if (Drv->xshm_info.shmid < 0) {
|
||||||
@ -152,10 +159,10 @@ TryCreateShmImage (
|
|||||||
XDestroyImage (Drv->image);
|
XDestroyImage (Drv->image);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
X11Size (
|
X11Size (
|
||||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||||
@ -199,10 +206,16 @@ X11Size (
|
|||||||
|
|
||||||
Drv->image_data = malloc ((Drv->width * Drv->height) << Drv->pixel_shift);
|
Drv->image_data = malloc ((Drv->width * Drv->height) << Drv->pixel_shift);
|
||||||
Drv->image = XCreateImage (
|
Drv->image = XCreateImage (
|
||||||
Drv->display, Drv->visual, Drv->depth,
|
Drv->display,
|
||||||
ZPixmap, 0, (char *)Drv->image_data,
|
Drv->visual,
|
||||||
Drv->width, Drv->height,
|
Drv->depth,
|
||||||
8 << Drv->pixel_shift, 0
|
ZPixmap,
|
||||||
|
0,
|
||||||
|
(char *)Drv->image_data,
|
||||||
|
Drv->width,
|
||||||
|
Drv->height,
|
||||||
|
8 << Drv->pixel_shift,
|
||||||
|
0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,6 +287,7 @@ handleKeyEvent (
|
|||||||
} else {
|
} else {
|
||||||
Drv->KeyState.KeyShiftState &= ~EFI_RIGHT_CONTROL_PRESSED;
|
Drv->KeyState.KeyShiftState &= ~EFI_RIGHT_CONTROL_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case XK_Control_L:
|
case XK_Control_L:
|
||||||
if (Make) {
|
if (Make) {
|
||||||
@ -281,6 +295,7 @@ handleKeyEvent (
|
|||||||
} else {
|
} else {
|
||||||
Drv->KeyState.KeyShiftState &= ~EFI_LEFT_CONTROL_PRESSED;
|
Drv->KeyState.KeyShiftState &= ~EFI_LEFT_CONTROL_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XK_Shift_R:
|
case XK_Shift_R:
|
||||||
@ -289,6 +304,7 @@ handleKeyEvent (
|
|||||||
} else {
|
} else {
|
||||||
Drv->KeyState.KeyShiftState &= ~EFI_RIGHT_SHIFT_PRESSED;
|
Drv->KeyState.KeyShiftState &= ~EFI_RIGHT_SHIFT_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case XK_Shift_L:
|
case XK_Shift_L:
|
||||||
if (Make) {
|
if (Make) {
|
||||||
@ -296,6 +312,7 @@ handleKeyEvent (
|
|||||||
} else {
|
} else {
|
||||||
Drv->KeyState.KeyShiftState &= ~EFI_LEFT_SHIFT_PRESSED;
|
Drv->KeyState.KeyShiftState &= ~EFI_LEFT_SHIFT_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XK_Mode_switch:
|
case XK_Mode_switch:
|
||||||
@ -304,6 +321,7 @@ handleKeyEvent (
|
|||||||
} else {
|
} else {
|
||||||
Drv->KeyState.KeyShiftState &= ~EFI_LEFT_ALT_PRESSED;
|
Drv->KeyState.KeyShiftState &= ~EFI_LEFT_ALT_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XK_Meta_R:
|
case XK_Meta_R:
|
||||||
@ -312,6 +330,7 @@ handleKeyEvent (
|
|||||||
} else {
|
} else {
|
||||||
Drv->KeyState.KeyShiftState &= ~EFI_RIGHT_LOGO_PRESSED;
|
Drv->KeyState.KeyShiftState &= ~EFI_RIGHT_LOGO_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case XK_Meta_L:
|
case XK_Meta_L:
|
||||||
if (Make) {
|
if (Make) {
|
||||||
@ -319,81 +338,118 @@ handleKeyEvent (
|
|||||||
} else {
|
} else {
|
||||||
Drv->KeyState.KeyShiftState &= ~EFI_LEFT_LOGO_PRESSED;
|
Drv->KeyState.KeyShiftState &= ~EFI_LEFT_LOGO_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XK_KP_Home:
|
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_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_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_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_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_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_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_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_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_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_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_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_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_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_F5: KeyData.Key.ScanCode = SCAN_F5;
|
||||||
case XK_F6: KeyData.Key.ScanCode = SCAN_F6; break;
|
break;
|
||||||
case XK_F7: KeyData.Key.ScanCode = SCAN_F7; 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
|
// Don't map into X11 by default on a Mac
|
||||||
// System Preferences->Keyboard->Keyboard Shortcuts can be configured
|
// System Preferences->Keyboard->Keyboard Shortcuts can be configured
|
||||||
// to not use higher function keys as shortcuts and the will show up
|
// to not use higher function keys as shortcuts and the will show up
|
||||||
// in X11.
|
// in X11.
|
||||||
case XK_F8: KeyData.Key.ScanCode = SCAN_F8; break;
|
case XK_F8: KeyData.Key.ScanCode = SCAN_F8;
|
||||||
case XK_F9: KeyData.Key.ScanCode = SCAN_F9; break;
|
break;
|
||||||
case XK_F10: KeyData.Key.ScanCode = SCAN_F10; 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_F11: KeyData.Key.ScanCode = SCAN_F11;
|
||||||
case XK_F12: KeyData.Key.ScanCode = SCAN_F12; break;
|
break;
|
||||||
|
case XK_F12: KeyData.Key.ScanCode = SCAN_F12;
|
||||||
|
break;
|
||||||
|
|
||||||
case XK_F13: KeyData.Key.ScanCode = SCAN_F13; break;
|
case XK_F13: KeyData.Key.ScanCode = SCAN_F13;
|
||||||
case XK_F14: KeyData.Key.ScanCode = SCAN_F14; break;
|
break;
|
||||||
case XK_F15: KeyData.Key.ScanCode = SCAN_F15; break;
|
case XK_F14: KeyData.Key.ScanCode = SCAN_F14;
|
||||||
case XK_F16: KeyData.Key.ScanCode = SCAN_F16; break;
|
break;
|
||||||
case XK_F17: KeyData.Key.ScanCode = SCAN_F17; break;
|
case XK_F15: KeyData.Key.ScanCode = SCAN_F15;
|
||||||
case XK_F18: KeyData.Key.ScanCode = SCAN_F18; break;
|
break;
|
||||||
case XK_F19: KeyData.Key.ScanCode = SCAN_F19; break;
|
case XK_F16: KeyData.Key.ScanCode = SCAN_F16;
|
||||||
case XK_F20: KeyData.Key.ScanCode = SCAN_F20; break;
|
break;
|
||||||
case XK_F21: KeyData.Key.ScanCode = SCAN_F21; break;
|
case XK_F17: KeyData.Key.ScanCode = SCAN_F17;
|
||||||
case XK_F22: KeyData.Key.ScanCode = SCAN_F22; break;
|
break;
|
||||||
case XK_F23: KeyData.Key.ScanCode = SCAN_F23; break;
|
case XK_F18: KeyData.Key.ScanCode = SCAN_F18;
|
||||||
case XK_F24: KeyData.Key.ScanCode = SCAN_F24; break;
|
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
|
// No mapping in X11
|
||||||
// case XK_: KeyData.Key.ScanCode = SCAN_MUTE; break;
|
// 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_RECOVERY; break;
|
||||||
// case XK_: KeyData.Key.ScanCode = SCAN_EJECT; 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_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_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_Equal: KeyData.Key.UnicodeChar = L'=';
|
||||||
case XK_KP_Multiply : KeyData.Key.UnicodeChar = L'*'; break;
|
break;
|
||||||
case XK_KP_Add : KeyData.Key.UnicodeChar = L'+'; break;
|
case XK_KP_Multiply: KeyData.Key.UnicodeChar = L'*';
|
||||||
case XK_KP_Separator : KeyData.Key.UnicodeChar = L'~'; break;
|
break;
|
||||||
case XK_KP_Subtract : KeyData.Key.UnicodeChar = L'-'; break;
|
case XK_KP_Add: KeyData.Key.UnicodeChar = L'+';
|
||||||
case XK_KP_Decimal : KeyData.Key.UnicodeChar = L'.'; break;
|
break;
|
||||||
case XK_KP_Divide : 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_0: KeyData.Key.UnicodeChar = L'0';
|
||||||
case XK_KP_1 : KeyData.Key.UnicodeChar = L'1'; break;
|
break;
|
||||||
case XK_KP_2 : KeyData.Key.UnicodeChar = L'2'; break;
|
case XK_KP_1: KeyData.Key.UnicodeChar = L'1';
|
||||||
case XK_KP_3 : KeyData.Key.UnicodeChar = L'3'; break;
|
break;
|
||||||
case XK_KP_4 : KeyData.Key.UnicodeChar = L'4'; break;
|
case XK_KP_2: KeyData.Key.UnicodeChar = L'2';
|
||||||
case XK_KP_5 : KeyData.Key.UnicodeChar = L'5'; break;
|
break;
|
||||||
case XK_KP_6 : KeyData.Key.UnicodeChar = L'6'; break;
|
case XK_KP_3: KeyData.Key.UnicodeChar = L'3';
|
||||||
case XK_KP_7 : KeyData.Key.UnicodeChar = L'7'; break;
|
break;
|
||||||
case XK_KP_8 : KeyData.Key.UnicodeChar = L'8'; break;
|
case XK_KP_4: KeyData.Key.UnicodeChar = L'4';
|
||||||
case XK_KP_9 : KeyData.Key.UnicodeChar = L'9'; break;
|
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:
|
default:
|
||||||
;
|
;
|
||||||
@ -446,8 +523,8 @@ handleKeyEvent (
|
|||||||
|
|
||||||
if (*KeySym < XK_BackSpace) {
|
if (*KeySym < XK_BackSpace) {
|
||||||
if (((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | EFI_RIGHT_SHIFT_PRESSED)) != 0) ||
|
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];
|
KeyData.Key.UnicodeChar = (CHAR16)KeySym[KEYSYM_UPPER];
|
||||||
|
|
||||||
// Per UEFI spec since we converted the Unicode clear the shift bits we pass up
|
// Per UEFI spec since we converted the Unicode clear the shift bits we pass up
|
||||||
@ -457,7 +534,6 @@ handleKeyEvent (
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// XK_BackSpace is the start of XK_MISCELLANY. These are the XK_? keys we process in this file
|
// XK_BackSpace is the start of XK_MISCELLANY. These are the XK_? keys we process in this file
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Make) {
|
if (Make) {
|
||||||
@ -474,7 +550,6 @@ handleKeyEvent (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
handleMouseMoved (
|
handleMouseMoved (
|
||||||
IN GRAPHICS_IO_PRIVATE *Drv,
|
IN GRAPHICS_IO_PRIVATE *Drv,
|
||||||
@ -507,6 +582,7 @@ handleMouseDown (
|
|||||||
Drv->pointer_state_changed = (Drv->pointer_state.LeftButton != Pressed);
|
Drv->pointer_state_changed = (Drv->pointer_state.LeftButton != Pressed);
|
||||||
Drv->pointer_state.LeftButton = Pressed;
|
Drv->pointer_state.LeftButton = Pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ev->xbutton.button == Button2 ) {
|
if ( ev->xbutton.button == Button2 ) {
|
||||||
Drv->pointer_state_changed = (Drv->pointer_state.RightButton != Pressed);
|
Drv->pointer_state_changed = (Drv->pointer_state.RightButton != Pressed);
|
||||||
Drv->pointer_state.RightButton = Pressed;
|
Drv->pointer_state.RightButton = Pressed;
|
||||||
@ -524,27 +600,60 @@ Redraw (
|
|||||||
{
|
{
|
||||||
if (Drv->use_shm) {
|
if (Drv->use_shm) {
|
||||||
XShmPutImage (
|
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 {
|
} else {
|
||||||
XPutImage (
|
XPutImage (
|
||||||
Drv->display, Drv->win, Drv->gc, Drv->image, X, Y, X, Y, Width, Height
|
Drv->display,
|
||||||
|
Drv->win,
|
||||||
|
Drv->gc,
|
||||||
|
Drv->image,
|
||||||
|
X,
|
||||||
|
Y,
|
||||||
|
X,
|
||||||
|
Y,
|
||||||
|
Width,
|
||||||
|
Height
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
XFlush (Drv->display);
|
XFlush (Drv->display);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HandleEvent(GRAPHICS_IO_PRIVATE *Drv, XEvent *ev)
|
HandleEvent (
|
||||||
|
GRAPHICS_IO_PRIVATE *Drv,
|
||||||
|
XEvent *ev
|
||||||
|
)
|
||||||
{
|
{
|
||||||
switch (ev->type) {
|
switch (ev->type) {
|
||||||
case Expose:
|
case Expose:
|
||||||
Redraw (Drv, ev->xexpose.x, ev->xexpose.y,
|
Redraw (
|
||||||
ev->xexpose.width, ev->xexpose.height);
|
Drv,
|
||||||
|
ev->xexpose.x,
|
||||||
|
ev->xexpose.y,
|
||||||
|
ev->xexpose.width,
|
||||||
|
ev->xexpose.height
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case GraphicsExpose:
|
case GraphicsExpose:
|
||||||
Redraw (Drv, ev->xgraphicsexpose.x, ev->xgraphicsexpose.y,
|
Redraw (
|
||||||
ev->xgraphicsexpose.width, ev->xgraphicsexpose.height);
|
Drv,
|
||||||
|
ev->xgraphicsexpose.x,
|
||||||
|
ev->xgraphicsexpose.y,
|
||||||
|
ev->xgraphicsexpose.width,
|
||||||
|
ev->xgraphicsexpose.height
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
handleKeyEvent (Drv, ev, TRUE);
|
handleKeyEvent (Drv, ev, TRUE);
|
||||||
@ -618,7 +727,6 @@ X11ColorToPixel (
|
|||||||
return Pixel;
|
return Pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
X11CheckKey (
|
X11CheckKey (
|
||||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo
|
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo
|
||||||
@ -660,7 +768,6 @@ X11GetKey (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
X11KeySetState (
|
X11KeySetState (
|
||||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||||
@ -684,7 +791,6 @@ X11KeySetState (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
X11RegisterKeyNotify (
|
X11RegisterKeyNotify (
|
||||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||||
@ -704,7 +810,6 @@ X11RegisterKeyNotify (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
X11Blt (
|
X11Blt (
|
||||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||||
@ -728,12 +833,12 @@ X11Blt (
|
|||||||
|
|
||||||
Private = (GRAPHICS_IO_PRIVATE *)GraphicsIo;
|
Private = (GRAPHICS_IO_PRIVATE *)GraphicsIo;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check bounds
|
// Check bounds
|
||||||
//
|
//
|
||||||
if (BltOperation == EfiUgaVideoToBltBuffer
|
if ( (BltOperation == EfiUgaVideoToBltBuffer)
|
||||||
|| BltOperation == EfiUgaVideoToVideo) {
|
|| (BltOperation == EfiUgaVideoToVideo))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Source is Video.
|
// Source is Video.
|
||||||
//
|
//
|
||||||
@ -746,9 +851,10 @@ X11Blt (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BltOperation == EfiUgaBltBufferToVideo
|
if ( (BltOperation == EfiUgaBltBufferToVideo)
|
||||||
|| BltOperation == EfiUgaVideoToVideo
|
|| (BltOperation == EfiUgaVideoToVideo)
|
||||||
|| BltOperation == EfiUgaVideoFill) {
|
|| (BltOperation == EfiUgaVideoFill))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Destination is Video
|
// Destination is Video
|
||||||
//
|
//
|
||||||
@ -769,8 +875,10 @@ X11Blt (
|
|||||||
for (SrcX = Args->SourceX; SrcX < (Args->Width + Args->SourceX); SrcX++) {
|
for (SrcX = Args->SourceX; SrcX < (Args->Width + Args->SourceX); SrcX++) {
|
||||||
*Blt++ = X11ColorToPixel (Private, XGetPixel (Private->image, SrcX, SrcY));
|
*Blt++ = X11ColorToPixel (Private, XGetPixel (Private->image, SrcX, SrcY));
|
||||||
}
|
}
|
||||||
|
|
||||||
Blt = (EFI_UGA_PIXEL *)((UINT8 *)Blt + Args->Delta);
|
Blt = (EFI_UGA_PIXEL *)((UINT8 *)Blt + Args->Delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EfiUgaBltBufferToVideo:
|
case EfiUgaBltBufferToVideo:
|
||||||
Blt = (EFI_UGA_PIXEL *)((UINT8 *)BltBuffer + (Args->SourceY * Args->Delta) + Args->SourceX * sizeof (EFI_UGA_PIXEL));
|
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));
|
XPutPixel (Private->image, DstX, DstY, X11PixelToColor (Private, *Blt));
|
||||||
Blt++;
|
Blt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Blt = (EFI_UGA_PIXEL *)((UINT8 *)Blt + Args->Delta);
|
Blt = (EFI_UGA_PIXEL *)((UINT8 *)Blt + Args->Delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EfiUgaVideoToVideo:
|
case EfiUgaVideoToVideo:
|
||||||
Dst = Private->image_data + (Args->DestinationX << Private->pixel_shift)
|
Dst = Private->image_data + (Args->DestinationX << Private->pixel_shift)
|
||||||
@ -808,6 +918,7 @@ X11Blt (
|
|||||||
Src -= Private->line_bytes;
|
Src -= Private->line_bytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EfiUgaVideoFill:
|
case EfiUgaVideoFill:
|
||||||
Color = X11PixelToColor (Private, *BltBuffer);
|
Color = X11PixelToColor (Private, *BltBuffer);
|
||||||
@ -816,6 +927,7 @@ X11Blt (
|
|||||||
XPutPixel (Private->image, DstX, DstY, Color);
|
XPutPixel (Private->image, DstX, DstY, Color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
@ -827,25 +939,38 @@ X11Blt (
|
|||||||
switch (BltOperation) {
|
switch (BltOperation) {
|
||||||
case EfiUgaVideoToVideo:
|
case EfiUgaVideoToVideo:
|
||||||
XCopyArea (
|
XCopyArea (
|
||||||
Private->display, Private->win, Private->win, Private->gc,
|
Private->display,
|
||||||
Args->SourceX, Args->SourceY, Args->Width, Args->Height,
|
Private->win,
|
||||||
Args->DestinationX, Args->DestinationY
|
Private->win,
|
||||||
|
Private->gc,
|
||||||
|
Args->SourceX,
|
||||||
|
Args->SourceY,
|
||||||
|
Args->Width,
|
||||||
|
Args->Height,
|
||||||
|
Args->DestinationX,
|
||||||
|
Args->DestinationY
|
||||||
);
|
);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
XNextEvent (Private->display, &ev);
|
XNextEvent (Private->display, &ev);
|
||||||
HandleEvent (Private, &ev);
|
HandleEvent (Private, &ev);
|
||||||
if (ev.type == NoExpose || ev.type == GraphicsExpose) {
|
if ((ev.type == NoExpose) || (ev.type == GraphicsExpose)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EfiUgaVideoFill:
|
case EfiUgaVideoFill:
|
||||||
Color = X11PixelToColor (Private, *BltBuffer);
|
Color = X11PixelToColor (Private, *BltBuffer);
|
||||||
XSetForeground (Private->display, Private->gc, Color);
|
XSetForeground (Private->display, Private->gc, Color);
|
||||||
XFillRectangle (
|
XFillRectangle (
|
||||||
Private->display, Private->win, Private->gc,
|
Private->display,
|
||||||
Args->DestinationX, Args->DestinationY, Args->Width, Args->Height
|
Private->win,
|
||||||
|
Private->gc,
|
||||||
|
Args->DestinationX,
|
||||||
|
Args->DestinationY,
|
||||||
|
Args->Width,
|
||||||
|
Args->Height
|
||||||
);
|
);
|
||||||
XFlush (Private->display);
|
XFlush (Private->display);
|
||||||
break;
|
break;
|
||||||
@ -855,10 +980,10 @@ X11Blt (
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
X11CheckPointer (
|
X11CheckPointer (
|
||||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo
|
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo
|
||||||
@ -876,7 +1001,6 @@ X11CheckPointer (
|
|||||||
return EFI_NOT_READY;
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
X11GetPointerState (
|
X11GetPointerState (
|
||||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||||
@ -902,8 +1026,6 @@ X11GetPointerState (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
X11GraphicsWindowOpen (
|
X11GraphicsWindowOpen (
|
||||||
IN EMU_IO_THUNK_PROTOCOL *This
|
IN EMU_IO_THUNK_PROTOCOL *This
|
||||||
@ -927,7 +1049,6 @@ X11GraphicsWindowOpen (
|
|||||||
Drv->GraphicsIo.CheckPointer = GasketX11CheckPointer;
|
Drv->GraphicsIo.CheckPointer = GasketX11CheckPointer;
|
||||||
Drv->GraphicsIo.GetPointerState = GasketX11GetPointerState;
|
Drv->GraphicsIo.GetPointerState = GasketX11GetPointerState;
|
||||||
|
|
||||||
|
|
||||||
Drv->key_count = 0;
|
Drv->key_count = 0;
|
||||||
Drv->key_rd = 0;
|
Drv->key_rd = 0;
|
||||||
Drv->key_wr = 0;
|
Drv->key_wr = 0;
|
||||||
@ -937,18 +1058,23 @@ X11GraphicsWindowOpen (
|
|||||||
Drv->BreakRegisterdKeyCallback = NULL;
|
Drv->BreakRegisterdKeyCallback = NULL;
|
||||||
Drv->RegisterdKeyCallbackContext = NULL;
|
Drv->RegisterdKeyCallbackContext = NULL;
|
||||||
|
|
||||||
|
|
||||||
Drv->display = XOpenDisplay (display_name);
|
Drv->display = XOpenDisplay (display_name);
|
||||||
if (Drv->display == NULL) {
|
if (Drv->display == NULL) {
|
||||||
fprintf (stderr, "uga: cannot connect to X server %s\n", XDisplayName (display_name));
|
fprintf (stderr, "uga: cannot connect to X server %s\n", XDisplayName (display_name));
|
||||||
free (Drv);
|
free (Drv);
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Drv->screen = DefaultScreen (Drv->display);
|
Drv->screen = DefaultScreen (Drv->display);
|
||||||
Drv->visual = DefaultVisual (Drv->display, Drv->screen);
|
Drv->visual = DefaultVisual (Drv->display, Drv->screen);
|
||||||
Drv->win = XCreateSimpleWindow (
|
Drv->win = XCreateSimpleWindow (
|
||||||
Drv->display, RootWindow (Drv->display, Drv->screen),
|
Drv->display,
|
||||||
0, 0, 4, 4, border_width,
|
RootWindow (Drv->display, Drv->screen),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
border_width,
|
||||||
WhitePixel (Drv->display, Drv->screen),
|
WhitePixel (Drv->display, Drv->screen),
|
||||||
BlackPixel (Drv->display, Drv->screen)
|
BlackPixel (Drv->display, Drv->screen)
|
||||||
);
|
);
|
||||||
@ -962,7 +1088,8 @@ X11GraphicsWindowOpen (
|
|||||||
|
|
||||||
// XAutoRepeatOff (Drv->display);
|
// XAutoRepeatOff (Drv->display);
|
||||||
XSelectInput (
|
XSelectInput (
|
||||||
Drv->display, Drv->win,
|
Drv->display,
|
||||||
|
Drv->win,
|
||||||
ExposureMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask
|
ExposureMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask
|
||||||
);
|
);
|
||||||
Drv->gc = DefaultGC (Drv->display, Drv->screen);
|
Drv->gc = DefaultGC (Drv->display, Drv->screen);
|
||||||
@ -972,7 +1099,6 @@ X11GraphicsWindowOpen (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
X11GraphicsWindowClose (
|
X11GraphicsWindowClose (
|
||||||
IN EMU_IO_THUNK_PROTOCOL *This
|
IN EMU_IO_THUNK_PROTOCOL *This
|
||||||
@ -996,6 +1122,7 @@ X11GraphicsWindowClose (
|
|||||||
Drv->image_data = NULL;
|
Drv->image_data = NULL;
|
||||||
Drv->image = NULL;
|
Drv->image = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
XDestroyWindow (Drv->display, Drv->win);
|
XDestroyWindow (Drv->display, Drv->win);
|
||||||
XCloseDisplay (Drv->display);
|
XCloseDisplay (Drv->display);
|
||||||
|
|
||||||
@ -1008,7 +1135,6 @@ X11GraphicsWindowClose (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EMU_IO_THUNK_PROTOCOL gX11ThunkIo = {
|
EMU_IO_THUNK_PROTOCOL gX11ThunkIo = {
|
||||||
&gEmuGraphicsWindowProtocolGuid,
|
&gEmuGraphicsWindowProtocolGuid,
|
||||||
NULL,
|
NULL,
|
||||||
@ -1018,5 +1144,3 @@ EMU_IO_THUNK_PROTOCOL gX11ThunkIo = {
|
|||||||
GasketX11GraphicsWindowClose,
|
GasketX11GraphicsWindowClose,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,16 +27,12 @@ typedef struct {
|
|||||||
#define WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
|
#define WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
|
||||||
CR(a, WIN_NT_BLOCK_IO_PRIVATE, EmuBlockIo, WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE)
|
CR(a, WIN_NT_BLOCK_IO_PRIVATE, EmuBlockIo, WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE)
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
WinNtBlockIoReset (
|
WinNtBlockIoReset (
|
||||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||||
IN BOOLEAN ExtendedVerification
|
IN BOOLEAN ExtendedVerification
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
SetFilePointer64 (
|
SetFilePointer64 (
|
||||||
IN WIN_NT_BLOCK_IO_PRIVATE *Private,
|
IN WIN_NT_BLOCK_IO_PRIVATE *Private,
|
||||||
@ -44,6 +40,7 @@ SetFilePointer64 (
|
|||||||
OUT UINT64 *NewFilePointer,
|
OUT UINT64 *NewFilePointer,
|
||||||
IN DWORD MoveMethod
|
IN DWORD MoveMethod
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
This function extends the capability of SetFilePointer to accept 64 bit parameters
|
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
|
MoveMethod
|
||||||
);
|
);
|
||||||
|
|
||||||
if (LargeInt.LowPart == -1 && GetLastError () != NO_ERROR) {
|
if ((LargeInt.LowPart == -1) && (GetLastError () != NO_ERROR)) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,8 +71,6 @@ This function extends the capability of SetFilePointer to accept 64 bit paramete
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
WinNtBlockIoOpenDevice (
|
WinNtBlockIoOpenDevice (
|
||||||
IN WIN_NT_BLOCK_IO_PRIVATE *Private,
|
IN WIN_NT_BLOCK_IO_PRIVATE *Private,
|
||||||
@ -138,7 +133,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
WinNtBlockIoCreateMapping (
|
WinNtBlockIoCreateMapping (
|
||||||
@ -164,7 +158,6 @@ WinNtBlockIoCreateMapping (
|
|||||||
Media->LowestAlignedLba = 0;
|
Media->LowestAlignedLba = 0;
|
||||||
Media->LogicalBlocksPerPhysicalBlock = 0;
|
Media->LogicalBlocksPerPhysicalBlock = 0;
|
||||||
|
|
||||||
|
|
||||||
// EFI_BLOCK_IO_PROTOCOL_REVISION3
|
// EFI_BLOCK_IO_PROTOCOL_REVISION3
|
||||||
Media->OptimalTransferLengthGranularity = 0;
|
Media->OptimalTransferLengthGranularity = 0;
|
||||||
|
|
||||||
@ -175,12 +168,11 @@ WinNtBlockIoCreateMapping (
|
|||||||
return WinNtBlockIoOpenDevice (Private, Media);
|
return WinNtBlockIoOpenDevice (Private, Media);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
WinNtBlockIoError (
|
WinNtBlockIoError (
|
||||||
IN WIN_NT_BLOCK_IO_PRIVATE *Private
|
IN WIN_NT_BLOCK_IO_PRIVATE *Private
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -203,7 +195,6 @@ Returns:
|
|||||||
Media = Private->Media;
|
Media = Private->Media;
|
||||||
|
|
||||||
switch (GetLastError ()) {
|
switch (GetLastError ()) {
|
||||||
|
|
||||||
case ERROR_NOT_READY:
|
case ERROR_NOT_READY:
|
||||||
Media->ReadOnly = FALSE;
|
Media->ReadOnly = FALSE;
|
||||||
Media->MediaPresent = FALSE;
|
Media->MediaPresent = FALSE;
|
||||||
@ -227,14 +218,13 @@ Returns:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Status == EFI_NO_MEDIA || Status == EFI_MEDIA_CHANGED) {
|
if ((Status == EFI_NO_MEDIA) || (Status == EFI_MEDIA_CHANGED)) {
|
||||||
WinNtBlockIoReset (&Private->EmuBlockIo, FALSE);
|
WinNtBlockIoReset (&Private->EmuBlockIo, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
WinNtSignalToken (
|
WinNtSignalToken (
|
||||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
|
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
|
||||||
@ -248,6 +238,7 @@ WinNtSignalToken (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,7 +314,6 @@ WinNtBlockIoReadBlocks (
|
|||||||
return WinNtSignalToken (Token, EFI_SUCCESS);
|
return WinNtSignalToken (Token, EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Write BufferSize bytes from Lba into Buffer.
|
Write BufferSize bytes from Lba into Buffer.
|
||||||
|
|
||||||
@ -429,7 +419,6 @@ WinNtBlockIoFlushBlocks (
|
|||||||
return WinNtSignalToken (Token, EFI_SUCCESS);
|
return WinNtSignalToken (Token, EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reset the block device hardware.
|
Reset the block device hardware.
|
||||||
|
|
||||||
@ -493,6 +482,7 @@ WinNtBlockIoThunkOpen (
|
|||||||
if (Private->FileName == NULL) {
|
if (Private->FileName == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Parse ConfigString
|
// Parse ConfigString
|
||||||
// <ConfigString> := <FileName> ':' [RF][OW] ':' <BlockSize>
|
// <ConfigString> := <FileName> ':' [RF][OW] ':' <BlockSize>
|
||||||
@ -503,12 +493,14 @@ WinNtBlockIoThunkOpen (
|
|||||||
Private->Readonly = FALSE;
|
Private->Readonly = FALSE;
|
||||||
} else {
|
} else {
|
||||||
for (*Str++ = L'\0'; *Str != L'\0'; Str++) {
|
for (*Str++ = L'\0'; *Str != L'\0'; Str++) {
|
||||||
if (*Str == 'R' || *Str == 'F') {
|
if ((*Str == 'R') || (*Str == 'F')) {
|
||||||
Private->Removable = (BOOLEAN)(*Str == L'R');
|
Private->Removable = (BOOLEAN)(*Str == L'R');
|
||||||
}
|
}
|
||||||
if (*Str == 'O' || *Str == 'W') {
|
|
||||||
|
if ((*Str == 'O') || (*Str == 'W')) {
|
||||||
Private->Readonly = (BOOLEAN)(*Str == L'O');
|
Private->Readonly = (BOOLEAN)(*Str == L'O');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*Str == ':') {
|
if (*Str == ':') {
|
||||||
Private->BlockSize = wcstol (++Str, NULL, 0);
|
Private->BlockSize = wcstol (++Str, NULL, 0);
|
||||||
break;
|
break;
|
||||||
@ -521,7 +513,6 @@ WinNtBlockIoThunkOpen (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
WinNtBlockIoThunkClose (
|
WinNtBlockIoThunkClose (
|
||||||
@ -536,14 +527,13 @@ WinNtBlockIoThunkClose (
|
|||||||
if (Private->FileName != NULL) {
|
if (Private->FileName != NULL) {
|
||||||
FreePool (Private->FileName);
|
FreePool (Private->FileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Private);
|
FreePool (Private);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EMU_IO_THUNK_PROTOCOL mWinNtBlockIoThunkIo = {
|
EMU_IO_THUNK_PROTOCOL mWinNtBlockIoThunkIo = {
|
||||||
&gEmuBlockIoProtocolGuid,
|
&gEmuBlockIoProtocolGuid,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "WinHost.h"
|
#include "WinHost.h"
|
||||||
|
|
||||||
|
|
||||||
#define WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE SIGNATURE_32 ('N', 'T', 'f', 's')
|
#define WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE SIGNATURE_32 ('N', 'T', 'f', 's')
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -27,7 +26,6 @@ typedef struct {
|
|||||||
WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \
|
WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
#define WIN_NT_EFI_FILE_PRIVATE_SIGNATURE SIGNATURE_32 ('l', 'o', 'f', 's')
|
#define WIN_NT_EFI_FILE_PRIVATE_SIGNATURE SIGNATURE_32 ('l', 'o', 'f', 's')
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -72,13 +70,12 @@ WinNtFileSetInfo (
|
|||||||
IN VOID *Buffer
|
IN VOID *Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CHAR16 *
|
CHAR16 *
|
||||||
EfiStrChr (
|
EfiStrChr (
|
||||||
IN CHAR16 *Str,
|
IN CHAR16 *Str,
|
||||||
IN CHAR16 Chr
|
IN CHAR16 Chr
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -109,15 +106,13 @@ Returns:
|
|||||||
return (*Str == Chr) ? Str : NULL;
|
return (*Str == Chr) ? Str : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsZero (
|
IsZero (
|
||||||
IN VOID *Buffer,
|
IN VOID *Buffer,
|
||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Buffer == NULL || Length == 0) {
|
if ((Buffer == NULL) || (Length == 0)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +149,7 @@ CutPrefix (
|
|||||||
*Pointer = *(Pointer + Count);
|
*Pointer = *(Pointer + Count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Open the root directory on a volume.
|
Open the root directory on a volume.
|
||||||
|
|
||||||
@ -181,7 +177,7 @@ WinNtOpenVolume (
|
|||||||
CHAR16 *TempFileName;
|
CHAR16 *TempFileName;
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
|
|
||||||
if (This == NULL || Root == NULL) {
|
if ((This == NULL) || (Root == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,11 +201,13 @@ WinNtOpenVolume (
|
|||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpyS (PrivateFile->FilePath,
|
StrCpyS (
|
||||||
|
PrivateFile->FilePath,
|
||||||
StrSize (Private->FilePath) / sizeof (CHAR16),
|
StrSize (Private->FilePath) / sizeof (CHAR16),
|
||||||
Private->FilePath
|
Private->FilePath
|
||||||
);
|
);
|
||||||
StrCpyS (PrivateFile->FileName,
|
StrCpyS (
|
||||||
|
PrivateFile->FileName,
|
||||||
StrSize (Private->FilePath) / sizeof (CHAR16),
|
StrSize (Private->FilePath) / sizeof (CHAR16),
|
||||||
PrivateFile->FilePath
|
PrivateFile->FilePath
|
||||||
);
|
);
|
||||||
@ -249,6 +247,7 @@ WinNtOpenVolume (
|
|||||||
if (TempFileName == NULL) {
|
if (TempFileName == NULL) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpyS (TempFileName, Size / sizeof (CHAR16), PrivateFile->FilePath);
|
StrCpyS (TempFileName, Size / sizeof (CHAR16), PrivateFile->FilePath);
|
||||||
StrCatS (TempFileName, Size / sizeof (CHAR16), L"\\*");
|
StrCatS (TempFileName, Size / sizeof (CHAR16), L"\\*");
|
||||||
|
|
||||||
@ -260,6 +259,7 @@ WinNtOpenVolume (
|
|||||||
} else {
|
} else {
|
||||||
PrivateFile->IsValidFindBuf = TRUE;
|
PrivateFile->IsValidFindBuf = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
*Root = &PrivateFile->EfiFile;
|
*Root = &PrivateFile->EfiFile;
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
@ -306,13 +306,13 @@ CountLeadingDots (
|
|||||||
return Num;
|
return Num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsFileNameTokenValid (
|
IsFileNameTokenValid (
|
||||||
IN CONST CHAR16 *FileNameToken
|
IN CONST CHAR16 *FileNameToken
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Num;
|
UINTN Num;
|
||||||
|
|
||||||
if (StrStr (FileNameToken, L"/") != NULL) {
|
if (StrStr (FileNameToken, L"/") != NULL) {
|
||||||
//
|
//
|
||||||
// No L'/' in file name.
|
// No L'/' in file name.
|
||||||
@ -337,7 +337,6 @@ IsFileNameTokenValid (
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the first string token found in the indirect pointer a String named by FileName.
|
Return the first string token found in the indirect pointer a String named by FileName.
|
||||||
|
|
||||||
@ -358,6 +357,7 @@ GetNextFileNameToken (
|
|||||||
CHAR16 *SlashPos;
|
CHAR16 *SlashPos;
|
||||||
CHAR16 *Token;
|
CHAR16 *Token;
|
||||||
UINTN Offset;
|
UINTN Offset;
|
||||||
|
|
||||||
ASSERT (**FileName != L'\\');
|
ASSERT (**FileName != L'\\');
|
||||||
ASSERT (**FileName != L'\0');
|
ASSERT (**FileName != L'\0');
|
||||||
|
|
||||||
@ -384,7 +384,6 @@ GetNextFileNameToken (
|
|||||||
return Token;
|
return Token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check if a FileName contains only Valid Characters.
|
Check if a FileName contains only Valid Characters.
|
||||||
|
|
||||||
@ -400,7 +399,6 @@ GetNextFileNameToken (
|
|||||||
@return FALSE FileName contains at least one invalid character.
|
@return FALSE FileName contains at least one invalid character.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsFileNameValid (
|
IsFileNameValid (
|
||||||
IN CONST CHAR16 *FileName
|
IN CONST CHAR16 *FileName
|
||||||
@ -415,6 +413,7 @@ IsFileNameValid (
|
|||||||
if (StrCmp (FileName, L"\\") == 0) {
|
if (StrCmp (FileName, L"\\") == 0) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We don't support two or more adjacent L'\'.
|
// We don't support two or more adjacent L'\'.
|
||||||
//
|
//
|
||||||
@ -434,14 +433,14 @@ IsFileNameValid (
|
|||||||
Valid = IsFileNameTokenValid (Token);
|
Valid = IsFileNameTokenValid (Token);
|
||||||
FreePool (Token);
|
FreePool (Token);
|
||||||
|
|
||||||
if (!Valid)
|
if (!Valid) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
} while (FileName != NULL);
|
} while (FileName != NULL);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Opens a new file relative to the source file's location.
|
Opens a new file relative to the source file's location.
|
||||||
|
|
||||||
@ -487,7 +486,6 @@ WinNtFileOpen (
|
|||||||
EFI_FILE_INFO *Info;
|
EFI_FILE_INFO *Info;
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Init local variables
|
// Init local variables
|
||||||
//
|
//
|
||||||
@ -502,6 +500,7 @@ WinNtFileOpen (
|
|||||||
if (TempFileName == NULL) {
|
if (TempFileName == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpyS (TempFileName, StrSize (FileName) / sizeof (CHAR16), FileName);
|
StrCpyS (TempFileName, StrSize (FileName) / sizeof (CHAR16), FileName);
|
||||||
FileName = TempFileName;
|
FileName = TempFileName;
|
||||||
|
|
||||||
@ -513,26 +512,30 @@ WinNtFileOpen (
|
|||||||
// If file name does not equal to "." or ".." and not trailed with "\..",
|
// If file name does not equal to "." or ".." and not trailed with "\..",
|
||||||
// then we trim the leading/trailing blanks and trailing dots
|
// then we trim the leading/trailing blanks and trailing dots
|
||||||
//
|
//
|
||||||
if (StrCmp (FileName, L".") != 0 && StrCmp (FileName, L"..") != 0 &&
|
if ((StrCmp (FileName, L".") != 0) && (StrCmp (FileName, L"..") != 0) &&
|
||||||
((StrLen (FileName) >= 3) ? (StrCmp (&FileName[StrLen (FileName) - 3], L"\\..") != 0) : TRUE)) {
|
((StrLen (FileName) >= 3) ? (StrCmp (&FileName[StrLen (FileName) - 3], L"\\..") != 0) : TRUE))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Trim leading blanks
|
// Trim leading blanks
|
||||||
//
|
//
|
||||||
Count = 0;
|
Count = 0;
|
||||||
for (TempFileName = FileName;
|
for (TempFileName = FileName;
|
||||||
*TempFileName != 0 && *TempFileName == L' ';
|
*TempFileName != 0 && *TempFileName == L' ';
|
||||||
TempFileName++) {
|
TempFileName++)
|
||||||
|
{
|
||||||
Count++;
|
Count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
CutPrefix (FileName, Count);
|
CutPrefix (FileName, Count);
|
||||||
//
|
//
|
||||||
// Trim trailing blanks
|
// Trim trailing blanks
|
||||||
//
|
//
|
||||||
for (TempFileName = FileName + StrLen (FileName) - 1;
|
for (TempFileName = FileName + StrLen (FileName) - 1;
|
||||||
TempFileName >= FileName && (*TempFileName == L' ');
|
TempFileName >= FileName && (*TempFileName == L' ');
|
||||||
TempFileName--) {
|
TempFileName--)
|
||||||
;
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
*(TempFileName + 1) = 0;
|
*(TempFileName + 1) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,15 +611,14 @@ WinNtFileOpen (
|
|||||||
LoopFinish = FALSE;
|
LoopFinish = FALSE;
|
||||||
|
|
||||||
while (!LoopFinish) {
|
while (!LoopFinish) {
|
||||||
|
|
||||||
LoopFinish = TRUE;
|
LoopFinish = TRUE;
|
||||||
|
|
||||||
for (ParseFileName = GuardPointer; *ParseFileName; ParseFileName++) {
|
for (ParseFileName = GuardPointer; *ParseFileName; ParseFileName++) {
|
||||||
if (*ParseFileName == L'.' &&
|
if ((*ParseFileName == L'.') &&
|
||||||
(*(ParseFileName + 1) == 0 || *(ParseFileName + 1) == L'\\') &&
|
((*(ParseFileName + 1) == 0) || (*(ParseFileName + 1) == L'\\')) &&
|
||||||
*(ParseFileName - 1) == L'\\'
|
(*(ParseFileName - 1) == L'\\')
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// cut \.
|
// cut \.
|
||||||
//
|
//
|
||||||
@ -625,12 +627,12 @@ WinNtFileOpen (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*ParseFileName == L'.' &&
|
if ((*ParseFileName == L'.') &&
|
||||||
*(ParseFileName + 1) == L'.' &&
|
(*(ParseFileName + 1) == L'.') &&
|
||||||
(*(ParseFileName + 2) == 0 || *(ParseFileName + 2) == L'\\') &&
|
((*(ParseFileName + 2) == 0) || (*(ParseFileName + 2) == L'\\')) &&
|
||||||
*(ParseFileName - 1) == L'\\'
|
(*(ParseFileName - 1) == L'\\')
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
ParseFileName--;
|
ParseFileName--;
|
||||||
Count = 3;
|
Count = 3;
|
||||||
|
|
||||||
@ -724,7 +726,6 @@ WinNtFileOpen (
|
|||||||
// deal with directory
|
// deal with directory
|
||||||
//
|
//
|
||||||
if (NewPrivateFile->IsDirectoryPath) {
|
if (NewPrivateFile->IsDirectoryPath) {
|
||||||
|
|
||||||
Size = StrSize (NewPrivateFile->FileName);
|
Size = StrSize (NewPrivateFile->FileName);
|
||||||
Size += StrSize (L"\\*");
|
Size += StrSize (L"\\*");
|
||||||
TempFileName = AllocatePool (Size);
|
TempFileName = AllocatePool (Size);
|
||||||
@ -740,7 +741,6 @@ WinNtFileOpen (
|
|||||||
// Create a directory
|
// Create a directory
|
||||||
//
|
//
|
||||||
if (!CreateDirectory (TempFileName, NULL)) {
|
if (!CreateDirectory (TempFileName, NULL)) {
|
||||||
|
|
||||||
LastError = GetLastError ();
|
LastError = GetLastError ();
|
||||||
if (LastError != ERROR_ALREADY_EXISTS) {
|
if (LastError != ERROR_ALREADY_EXISTS) {
|
||||||
FreePool (TempFileName);
|
FreePool (TempFileName);
|
||||||
@ -761,7 +761,6 @@ WinNtFileOpen (
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (NewPrivateFile->DirHandle == INVALID_HANDLE_VALUE) {
|
if (NewPrivateFile->DirHandle == INVALID_HANDLE_VALUE) {
|
||||||
|
|
||||||
NewPrivateFile->DirHandle = CreateFile (
|
NewPrivateFile->DirHandle = CreateFile (
|
||||||
TempFileName,
|
TempFileName,
|
||||||
GENERIC_READ,
|
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
|
// Set the attribute
|
||||||
//
|
//
|
||||||
@ -905,8 +904,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Close the file handle
|
Close the file handle
|
||||||
|
|
||||||
@ -934,7 +931,7 @@ WinNtFileClose (
|
|||||||
PrivateFile->LHandle = INVALID_HANDLE_VALUE;
|
PrivateFile->LHandle = INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivateFile->IsDirectoryPath && PrivateFile->DirHandle != INVALID_HANDLE_VALUE) {
|
if (PrivateFile->IsDirectoryPath && (PrivateFile->DirHandle != INVALID_HANDLE_VALUE)) {
|
||||||
CloseHandle (PrivateFile->DirHandle);
|
CloseHandle (PrivateFile->DirHandle);
|
||||||
PrivateFile->DirHandle = INVALID_HANDLE_VALUE;
|
PrivateFile->DirHandle = INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
@ -950,10 +947,8 @@ WinNtFileClose (
|
|||||||
FreePool (PrivateFile);
|
FreePool (PrivateFile);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Close and delete the file handle.
|
Close and delete the file handle.
|
||||||
|
|
||||||
@ -1012,6 +1007,7 @@ WinNtSystemTimeToEfiTime (
|
|||||||
IN TIME_ZONE_INFORMATION *TimeZone,
|
IN TIME_ZONE_INFORMATION *TimeZone,
|
||||||
OUT EFI_TIME *Time
|
OUT EFI_TIME *Time
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -1068,7 +1064,6 @@ WinNtFileTimeToEfiTime (
|
|||||||
WinNtSystemTimeToEfiTime (&SystemTime, TimeZone, EfiTime);
|
WinNtSystemTimeToEfiTime (&SystemTime, TimeZone, EfiTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read data from the file.
|
Read data from the file.
|
||||||
|
|
||||||
@ -1112,7 +1107,6 @@ WinNtFileRead (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!PrivateFile->IsDirectoryPath) {
|
if (!PrivateFile->IsDirectoryPath) {
|
||||||
|
|
||||||
if (This->GetPosition (This, &Pos) != EFI_SUCCESS) {
|
if (This->GetPosition (This, &Pos) != EFI_SUCCESS) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Done;
|
goto Done;
|
||||||
@ -1244,8 +1238,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Write data to a file.
|
Write data to a file.
|
||||||
|
|
||||||
@ -1307,8 +1299,6 @@ Done:
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set a files current position
|
Set a files current position
|
||||||
|
|
||||||
@ -1382,8 +1372,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get a file's current position
|
Get a file's current position
|
||||||
|
|
||||||
@ -1411,12 +1399,9 @@ WinNtFileGetPossition (
|
|||||||
PosHigh64 = 0;
|
PosHigh64 = 0;
|
||||||
|
|
||||||
if (PrivateFile->IsDirectoryPath) {
|
if (PrivateFile->IsDirectoryPath) {
|
||||||
|
|
||||||
Status = EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
goto Done;
|
goto Done;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
PositionHigh = 0;
|
PositionHigh = 0;
|
||||||
*Position = SetFilePointer (
|
*Position = SetFilePointer (
|
||||||
PrivateFile->LHandle,
|
PrivateFile->LHandle,
|
||||||
@ -1438,13 +1423,13 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
WinNtSimpleFileSystemFileInfo (
|
WinNtSimpleFileSystemFileInfo (
|
||||||
IN WIN_NT_EFI_FILE_PRIVATE *PrivateFile,
|
IN WIN_NT_EFI_FILE_PRIVATE *PrivateFile,
|
||||||
IN OUT UINTN *BufferSize,
|
IN OUT UINTN *BufferSize,
|
||||||
OUT VOID *Buffer
|
OUT VOID *Buffer
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -1484,6 +1469,7 @@ Returns:
|
|||||||
|
|
||||||
TempPointer++;
|
TempPointer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
NameSize = StrSize (RealFileName);
|
NameSize = StrSize (RealFileName);
|
||||||
|
|
||||||
ResultSize = Size + NameSize;
|
ResultSize = Size + NameSize;
|
||||||
@ -1583,7 +1569,7 @@ WinNtFileGetInfo (
|
|||||||
UINTN Index;
|
UINTN Index;
|
||||||
WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
|
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;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1623,22 +1609,19 @@ WinNtFileGetInfo (
|
|||||||
PrivateFile->FilePath
|
PrivateFile->FilePath
|
||||||
);
|
);
|
||||||
for (Index = 0; DriveName[Index] != 0 && DriveName[Index] != ':'; Index++) {
|
for (Index = 0; DriveName[Index] != 0 && DriveName[Index] != ':'; Index++) {
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DriveName[Index] == ':') {
|
if (DriveName[Index] == ':') {
|
||||||
DriveName[Index + 1] = '\\';
|
DriveName[Index + 1] = '\\';
|
||||||
DriveName[Index + 2] = 0;
|
DriveName[Index + 2] = 0;
|
||||||
DriveNameFound = TRUE;
|
DriveNameFound = TRUE;
|
||||||
} else if (DriveName[0] == '\\' && DriveName[1] == '\\') {
|
} else if ((DriveName[0] == '\\') && (DriveName[1] == '\\')) {
|
||||||
for (Index = 2; DriveName[Index] != 0 && DriveName[Index] != '\\'; Index++) {
|
for (Index = 2; DriveName[Index] != 0 && DriveName[Index] != '\\'; Index++) {
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DriveName[Index] == '\\') {
|
if (DriveName[Index] == '\\') {
|
||||||
DriveNameFound = TRUE;
|
DriveNameFound = TRUE;
|
||||||
for (Index++; DriveName[Index] != 0 && DriveName[Index] != '\\'; Index++) {
|
for (Index++; DriveName[Index] != 0 && DriveName[Index] != '\\'; Index++) {
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DriveName[Index] = '\\';
|
DriveName[Index] = '\\';
|
||||||
@ -1668,7 +1651,6 @@ WinNtFileGetInfo (
|
|||||||
FileSystemInfoBuffer->VolumeSize = MultU64x32 (TotalClusters, BytesPerCluster);
|
FileSystemInfoBuffer->VolumeSize = MultU64x32 (TotalClusters, BytesPerCluster);
|
||||||
FileSystemInfoBuffer->FreeSpace = MultU64x32 (FreeClusters, BytesPerCluster);
|
FileSystemInfoBuffer->FreeSpace = MultU64x32 (FreeClusters, BytesPerCluster);
|
||||||
FileSystemInfoBuffer->BlockSize = BytesPerCluster;
|
FileSystemInfoBuffer->BlockSize = BytesPerCluster;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// try GetDiskFreeSpaceEx then
|
// try GetDiskFreeSpaceEx then
|
||||||
@ -1715,7 +1697,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set information about a file
|
Set information about a file
|
||||||
|
|
||||||
@ -1790,7 +1771,6 @@ WinNtFileSetInfo (
|
|||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FreePool (PrivateRoot->VolumeLabel);
|
FreePool (PrivateRoot->VolumeLabel);
|
||||||
PrivateRoot->VolumeLabel = AllocatePool (StrSize (NewFileSystemInfo->VolumeLabel));
|
PrivateRoot->VolumeLabel = AllocatePool (StrSize (NewFileSystemInfo->VolumeLabel));
|
||||||
if (PrivateRoot->VolumeLabel == NULL) {
|
if (PrivateRoot->VolumeLabel == NULL) {
|
||||||
@ -1848,8 +1828,9 @@ WinNtFileSetInfo (
|
|||||||
|
|
||||||
if ((NewFileInfo->Size <= SIZE_OF_EFI_FILE_INFO) ||
|
if ((NewFileInfo->Size <= SIZE_OF_EFI_FILE_INFO) ||
|
||||||
(NewFileInfo->Attribute &~(EFI_FILE_VALID_ATTR)) ||
|
(NewFileInfo->Attribute &~(EFI_FILE_VALID_ATTR)) ||
|
||||||
(sizeof (UINTN) == 4 && NewFileInfo->Size > 0xFFFFFFFF)
|
((sizeof (UINTN) == 4) && (NewFileInfo->Size > 0xFFFFFFFF))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
@ -1959,15 +1940,18 @@ WinNtFileSetInfo (
|
|||||||
//
|
//
|
||||||
if (!IsZero (&NewFileInfo->CreateTime, sizeof (EFI_TIME)) &&
|
if (!IsZero (&NewFileInfo->CreateTime, sizeof (EFI_TIME)) &&
|
||||||
CompareMem (&NewFileInfo->CreateTime, &OldFileInfo->CreateTime, sizeof (EFI_TIME))
|
CompareMem (&NewFileInfo->CreateTime, &OldFileInfo->CreateTime, sizeof (EFI_TIME))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
TimeChangeFlag = TRUE;
|
TimeChangeFlag = TRUE;
|
||||||
} else if (!IsZero (&NewFileInfo->LastAccessTime, sizeof (EFI_TIME)) &&
|
} else if (!IsZero (&NewFileInfo->LastAccessTime, sizeof (EFI_TIME)) &&
|
||||||
CompareMem (&NewFileInfo->LastAccessTime, &OldFileInfo->LastAccessTime, sizeof (EFI_TIME))
|
CompareMem (&NewFileInfo->LastAccessTime, &OldFileInfo->LastAccessTime, sizeof (EFI_TIME))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
TimeChangeFlag = TRUE;
|
TimeChangeFlag = TRUE;
|
||||||
} else if (!IsZero (&NewFileInfo->ModificationTime, sizeof (EFI_TIME)) &&
|
} else if (!IsZero (&NewFileInfo->ModificationTime, sizeof (EFI_TIME)) &&
|
||||||
CompareMem (&NewFileInfo->ModificationTime, &OldFileInfo->ModificationTime, sizeof (EFI_TIME))
|
CompareMem (&NewFileInfo->ModificationTime, &OldFileInfo->ModificationTime, sizeof (EFI_TIME))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
TimeChangeFlag = TRUE;
|
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);
|
CloseHandle (PrivateFile->DirHandle);
|
||||||
PrivateFile->DirHandle = INVALID_HANDLE_VALUE;
|
PrivateFile->DirHandle = INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
@ -2120,7 +2104,6 @@ WinNtFileSetInfo (
|
|||||||
FreePool (TempFileName);
|
FreePool (TempFileName);
|
||||||
|
|
||||||
goto Done;
|
goto Done;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2163,7 +2146,6 @@ WinNtFileSetInfo (
|
|||||||
// Time change
|
// Time change
|
||||||
//
|
//
|
||||||
if (TimeChangeFlag) {
|
if (TimeChangeFlag) {
|
||||||
|
|
||||||
NewCreationSystemTime.wYear = NewFileInfo->CreateTime.Year;
|
NewCreationSystemTime.wYear = NewFileInfo->CreateTime.Year;
|
||||||
NewCreationSystemTime.wMonth = NewFileInfo->CreateTime.Month;
|
NewCreationSystemTime.wMonth = NewFileInfo->CreateTime.Month;
|
||||||
NewCreationSystemTime.wDay = NewFileInfo->CreateTime.Day;
|
NewCreationSystemTime.wDay = NewFileInfo->CreateTime.Day;
|
||||||
@ -2175,14 +2157,16 @@ WinNtFileSetInfo (
|
|||||||
if (!SystemTimeToFileTime (
|
if (!SystemTimeToFileTime (
|
||||||
&NewCreationSystemTime,
|
&NewCreationSystemTime,
|
||||||
&NewCreationFileTime
|
&NewCreationFileTime
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LocalFileTimeToFileTime (
|
if (!LocalFileTimeToFileTime (
|
||||||
&NewCreationFileTime,
|
&NewCreationFileTime,
|
||||||
&NewCreationFileTime
|
&NewCreationFileTime
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2197,14 +2181,16 @@ WinNtFileSetInfo (
|
|||||||
if (!SystemTimeToFileTime (
|
if (!SystemTimeToFileTime (
|
||||||
&NewLastAccessSystemTime,
|
&NewLastAccessSystemTime,
|
||||||
&NewLastAccessFileTime
|
&NewLastAccessFileTime
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LocalFileTimeToFileTime (
|
if (!LocalFileTimeToFileTime (
|
||||||
&NewLastAccessFileTime,
|
&NewLastAccessFileTime,
|
||||||
&NewLastAccessFileTime
|
&NewLastAccessFileTime
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2219,14 +2205,16 @@ WinNtFileSetInfo (
|
|||||||
if (!SystemTimeToFileTime (
|
if (!SystemTimeToFileTime (
|
||||||
&NewLastWriteSystemTime,
|
&NewLastWriteSystemTime,
|
||||||
&NewLastWriteFileTime
|
&NewLastWriteFileTime
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LocalFileTimeToFileTime (
|
if (!LocalFileTimeToFileTime (
|
||||||
&NewLastWriteFileTime,
|
&NewLastWriteFileTime,
|
||||||
&NewLastWriteFileTime
|
&NewLastWriteFileTime
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2235,11 +2223,11 @@ WinNtFileSetInfo (
|
|||||||
&NewCreationFileTime,
|
&NewCreationFileTime,
|
||||||
&NewLastAccessFileTime,
|
&NewLastAccessFileTime,
|
||||||
&NewLastWriteFileTime
|
&NewLastWriteFileTime
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -2295,7 +2283,6 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Flush data back for the file handle.
|
Flush data back for the file handle.
|
||||||
|
|
||||||
@ -2351,11 +2338,8 @@ Done:
|
|||||||
//
|
//
|
||||||
// bugbug: - Use Windows error reporting.
|
// bugbug: - Use Windows error reporting.
|
||||||
//
|
//
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
WinNtFileSystmeThunkOpen (
|
WinNtFileSystmeThunkOpen (
|
||||||
IN EMU_IO_THUNK_PROTOCOL *This
|
IN EMU_IO_THUNK_PROTOCOL *This
|
||||||
@ -2390,7 +2374,6 @@ WinNtFileSystmeThunkOpen (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
WinNtFileSystmeThunkClose (
|
WinNtFileSystmeThunkClose (
|
||||||
IN EMU_IO_THUNK_PROTOCOL *This
|
IN EMU_IO_THUNK_PROTOCOL *This
|
||||||
@ -2404,14 +2387,15 @@ WinNtFileSystmeThunkClose (
|
|||||||
if (Private->VolumeLabel != NULL) {
|
if (Private->VolumeLabel != NULL) {
|
||||||
FreePool (Private->VolumeLabel);
|
FreePool (Private->VolumeLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->FilePath != NULL) {
|
if (Private->FilePath != NULL) {
|
||||||
FreePool (Private->FilePath);
|
FreePool (Private->FilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Private);
|
FreePool (Private);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_FILE_PROTOCOL gWinNtFileProtocol = {
|
EFI_FILE_PROTOCOL gWinNtFileProtocol = {
|
||||||
EFI_FILE_REVISION,
|
EFI_FILE_REVISION,
|
||||||
WinNtFileOpen,
|
WinNtFileOpen,
|
||||||
@ -2431,7 +2415,6 @@ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL gWinNtFileSystemProtocol = {
|
|||||||
WinNtOpenVolume
|
WinNtOpenVolume
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
EMU_IO_THUNK_PROTOCOL mWinNtFileSystemThunkIo = {
|
EMU_IO_THUNK_PROTOCOL mWinNtFileSystemThunkIo = {
|
||||||
&gEfiSimpleFileSystemProtocolGuid,
|
&gEfiSimpleFileSystemProtocolGuid,
|
||||||
NULL,
|
NULL,
|
||||||
@ -2441,5 +2424,3 @@ EMU_IO_THUNK_PROTOCOL mWinNtFileSystemThunkIo = {
|
|||||||
WinNtFileSystmeThunkClose,
|
WinNtFileSystmeThunkClose,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ Abstract:
|
|||||||
#ifndef _WIN_GOP_H_
|
#ifndef _WIN_GOP_H_
|
||||||
#define _WIN_GOP_H_
|
#define _WIN_GOP_H_
|
||||||
|
|
||||||
|
|
||||||
#include "WinHost.h"
|
#include "WinHost.h"
|
||||||
|
|
||||||
#include <Protocol/EmuIoThunk.h>
|
#include <Protocol/EmuIoThunk.h>
|
||||||
@ -55,7 +54,6 @@ typedef struct {
|
|||||||
|
|
||||||
#define WIN_NT_GOP_CLASS_NAME L"WinNtGopWindow"
|
#define WIN_NT_GOP_CLASS_NAME L"WinNtGopWindow"
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT64 Signature;
|
UINT64 Signature;
|
||||||
EMU_GRAPHICS_WINDOW_PROTOCOL GraphicsWindowIo;
|
EMU_GRAPHICS_WINDOW_PROTOCOL GraphicsWindowIo;
|
||||||
@ -119,7 +117,6 @@ typedef struct {
|
|||||||
#define GRAPHICS_PRIVATE_DATA_FROM_THIS(a) \
|
#define GRAPHICS_PRIVATE_DATA_FROM_THIS(a) \
|
||||||
CR(a, GRAPHICS_PRIVATE_DATA, GraphicsWindowIo, GRAPHICS_PRIVATE_DATA_SIGNATURE)
|
CR(a, GRAPHICS_PRIVATE_DATA, GraphicsWindowIo, GRAPHICS_PRIVATE_DATA_SIGNATURE)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Gop Hardware abstraction internal worker functions
|
// Gop Hardware abstraction internal worker functions
|
||||||
//
|
//
|
||||||
@ -180,13 +177,13 @@ WinNtWndGetPointerState (
|
|||||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||||
IN EFI_SIMPLE_POINTER_STATE *State
|
IN EFI_SIMPLE_POINTER_STATE *State
|
||||||
);
|
);
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GopPrivateCreateQ (
|
GopPrivateCreateQ (
|
||||||
IN GRAPHICS_PRIVATE_DATA *Private,
|
IN GRAPHICS_PRIVATE_DATA *Private,
|
||||||
IN GOP_QUEUE_FIXED *Queue
|
IN GOP_QUEUE_FIXED *Queue
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
TODO: Add function description
|
TODO: Add function description
|
||||||
|
|
||||||
@ -200,5 +197,5 @@ GopPrivateDestroyQ (
|
|||||||
IN GRAPHICS_PRIVATE_DATA *Private,
|
IN GRAPHICS_PRIVATE_DATA *Private,
|
||||||
IN GOP_QUEUE_FIXED *Queue
|
IN GOP_QUEUE_FIXED *Queue
|
||||||
);
|
);
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -22,10 +22,8 @@ Abstract:
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "WinGop.h"
|
#include "WinGop.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
TODO: Add function description
|
TODO: Add function description
|
||||||
|
|
||||||
@ -46,7 +44,6 @@ GopPrivateCreateQ (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
TODO: Add function description
|
TODO: Add function description
|
||||||
|
|
||||||
@ -67,7 +64,6 @@ GopPrivateDestroyQ (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
TODO: Add function description
|
TODO: Add function description
|
||||||
|
|
||||||
@ -99,7 +95,6 @@ GopPrivateAddQ (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
TODO: Add function description
|
TODO: Add function description
|
||||||
|
|
||||||
@ -127,7 +122,7 @@ GopPrivateDeleteQ (
|
|||||||
CopyMem (Key, &Queue->Q[Queue->Front], sizeof (EFI_KEY_DATA));
|
CopyMem (Key, &Queue->Q[Queue->Front], sizeof (EFI_KEY_DATA));
|
||||||
Queue->Front = (Queue->Front + 1) % MAX_Q;
|
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 (!Private->IsPartialKeySupport) {
|
||||||
//
|
//
|
||||||
// If partial keystrok is not enabled, don't return the partial keystroke.
|
// If partial keystrok is not enabled, don't return the partial keystroke.
|
||||||
@ -137,11 +132,11 @@ GopPrivateDeleteQ (
|
|||||||
return EFI_NOT_READY;
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LeaveCriticalSection (&Queue->Cs);
|
LeaveCriticalSection (&Queue->Cs);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
TODO: Add function description
|
TODO: Add function description
|
||||||
|
|
||||||
@ -184,42 +179,55 @@ InitializeKeyState (
|
|||||||
if (Private->LeftCtrl) {
|
if (Private->LeftCtrl) {
|
||||||
KeyState->KeyShiftState |= EFI_LEFT_CONTROL_PRESSED;
|
KeyState->KeyShiftState |= EFI_LEFT_CONTROL_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->RightCtrl) {
|
if (Private->RightCtrl) {
|
||||||
KeyState->KeyShiftState |= EFI_RIGHT_CONTROL_PRESSED;
|
KeyState->KeyShiftState |= EFI_RIGHT_CONTROL_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->LeftAlt) {
|
if (Private->LeftAlt) {
|
||||||
KeyState->KeyShiftState |= EFI_LEFT_ALT_PRESSED;
|
KeyState->KeyShiftState |= EFI_LEFT_ALT_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->RightAlt) {
|
if (Private->RightAlt) {
|
||||||
KeyState->KeyShiftState |= EFI_RIGHT_ALT_PRESSED;
|
KeyState->KeyShiftState |= EFI_RIGHT_ALT_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->LeftShift) {
|
if (Private->LeftShift) {
|
||||||
KeyState->KeyShiftState |= EFI_LEFT_SHIFT_PRESSED;
|
KeyState->KeyShiftState |= EFI_LEFT_SHIFT_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->RightShift) {
|
if (Private->RightShift) {
|
||||||
KeyState->KeyShiftState |= EFI_RIGHT_SHIFT_PRESSED;
|
KeyState->KeyShiftState |= EFI_RIGHT_SHIFT_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->LeftLogo) {
|
if (Private->LeftLogo) {
|
||||||
KeyState->KeyShiftState |= EFI_LEFT_LOGO_PRESSED;
|
KeyState->KeyShiftState |= EFI_LEFT_LOGO_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->RightLogo) {
|
if (Private->RightLogo) {
|
||||||
KeyState->KeyShiftState |= EFI_RIGHT_LOGO_PRESSED;
|
KeyState->KeyShiftState |= EFI_RIGHT_LOGO_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->Menu) {
|
if (Private->Menu) {
|
||||||
KeyState->KeyShiftState |= EFI_MENU_KEY_PRESSED;
|
KeyState->KeyShiftState |= EFI_MENU_KEY_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->SysReq) {
|
if (Private->SysReq) {
|
||||||
KeyState->KeyShiftState |= EFI_SYS_REQ_PRESSED;
|
KeyState->KeyShiftState |= EFI_SYS_REQ_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->CapsLock) {
|
if (Private->CapsLock) {
|
||||||
KeyState->KeyToggleState |= EFI_CAPS_LOCK_ACTIVE;
|
KeyState->KeyToggleState |= EFI_CAPS_LOCK_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->NumLock) {
|
if (Private->NumLock) {
|
||||||
KeyState->KeyToggleState |= EFI_NUM_LOCK_ACTIVE;
|
KeyState->KeyToggleState |= EFI_NUM_LOCK_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->ScrollLock) {
|
if (Private->ScrollLock) {
|
||||||
KeyState->KeyToggleState |= EFI_SCROLL_LOCK_ACTIVE;
|
KeyState->KeyToggleState |= EFI_SCROLL_LOCK_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->IsPartialKeySupport) {
|
if (Private->IsPartialKeySupport) {
|
||||||
KeyState->KeyToggleState |= EFI_KEY_STATE_EXPOSED;
|
KeyState->KeyToggleState |= EFI_KEY_STATE_EXPOSED;
|
||||||
}
|
}
|
||||||
@ -251,7 +259,8 @@ GopPrivateAddKey (
|
|||||||
//
|
//
|
||||||
if ((Private->LeftCtrl || Private->RightCtrl) &&
|
if ((Private->LeftCtrl || Private->RightCtrl) &&
|
||||||
(KeyData.Key.UnicodeChar >= 1) && (KeyData.Key.UnicodeChar <= 26)
|
(KeyData.Key.UnicodeChar >= 1) && (KeyData.Key.UnicodeChar <= 26)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
if ((Private->LeftShift || Private->RightShift) == Private->CapsLock) {
|
if ((Private->LeftShift || Private->RightShift) == Private->CapsLock) {
|
||||||
KeyData.Key.UnicodeChar = (CHAR16)(KeyData.Key.UnicodeChar + L'a' - 1);
|
KeyData.Key.UnicodeChar = (CHAR16)(KeyData.Key.UnicodeChar + L'a' - 1);
|
||||||
} else {
|
} else {
|
||||||
@ -264,7 +273,8 @@ GopPrivateAddKey (
|
|||||||
//
|
//
|
||||||
if (((KeyData.Key.UnicodeChar >= L'a') && (KeyData.Key.UnicodeChar <= L'z')) ||
|
if (((KeyData.Key.UnicodeChar >= L'a') && (KeyData.Key.UnicodeChar <= L'z')) ||
|
||||||
((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);
|
KeyData.KeyState.KeyShiftState &= ~(EFI_LEFT_SHIFT_PRESSED | EFI_RIGHT_SHIFT_PRESSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +286,6 @@ GopPrivateAddKey (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
WinNtWndCheckKey (
|
WinNtWndCheckKey (
|
||||||
@ -288,14 +297,15 @@ WinNtWndCheckKey (
|
|||||||
Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
|
Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
|
||||||
|
|
||||||
return GopPrivateCheckQ (&Private->QueueForRead);
|
return GopPrivateCheckQ (&Private->QueueForRead);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
WinNtWndGetKey (
|
WinNtWndGetKey (
|
||||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
|
||||||
IN EFI_KEY_DATA *KeyData
|
IN EFI_KEY_DATA *KeyData
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@ -336,7 +346,7 @@ WinNtWndGetKey (
|
|||||||
// EFI_NOT_READY.
|
// EFI_NOT_READY.
|
||||||
//
|
//
|
||||||
if (!Private->IsPartialKeySupport) {
|
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;
|
Status = EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -344,7 +354,6 @@ WinNtWndGetKey (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -365,20 +374,23 @@ WinNtWndKeySetState (
|
|||||||
if ((*KeyToggleState & EFI_SCROLL_LOCK_ACTIVE) == EFI_SCROLL_LOCK_ACTIVE) {
|
if ((*KeyToggleState & EFI_SCROLL_LOCK_ACTIVE) == EFI_SCROLL_LOCK_ACTIVE) {
|
||||||
Private->ScrollLock = TRUE;
|
Private->ScrollLock = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*KeyToggleState & EFI_NUM_LOCK_ACTIVE) == EFI_NUM_LOCK_ACTIVE) {
|
if ((*KeyToggleState & EFI_NUM_LOCK_ACTIVE) == EFI_NUM_LOCK_ACTIVE) {
|
||||||
Private->NumLock = TRUE;
|
Private->NumLock = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*KeyToggleState & EFI_CAPS_LOCK_ACTIVE) == EFI_CAPS_LOCK_ACTIVE) {
|
if ((*KeyToggleState & EFI_CAPS_LOCK_ACTIVE) == EFI_CAPS_LOCK_ACTIVE) {
|
||||||
Private->CapsLock = TRUE;
|
Private->CapsLock = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*KeyToggleState & EFI_KEY_STATE_EXPOSED) == EFI_KEY_STATE_EXPOSED) {
|
if ((*KeyToggleState & EFI_KEY_STATE_EXPOSED) == EFI_KEY_STATE_EXPOSED) {
|
||||||
Private->IsPartialKeySupport = TRUE;
|
Private->IsPartialKeySupport = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Private->KeyState.KeyToggleState = *KeyToggleState;
|
Private->KeyState.KeyToggleState = *KeyToggleState;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
WinNtWndRegisterKeyNotify (
|
WinNtWndRegisterKeyNotify (
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user