Compare commits
122 Commits
edk2-stabl
...
esrt
Author | SHA1 | Date | |
---|---|---|---|
|
2b549700ac | ||
|
88f5720e16 | ||
|
27585e73da | ||
|
42a443d5cd | ||
|
c466cc2ca5 | ||
|
5c49aca613 | ||
|
99891bd41e | ||
|
3485d55709 | ||
|
c1a7127e01 | ||
|
2f21eddfb8 | ||
|
860c29c923 | ||
|
8cfead2839 | ||
|
30f6b2f3c7 | ||
|
4de32568fa | ||
|
ff91020528 | ||
|
943773983d | ||
|
e91ea5561d | ||
|
5e86b202de | ||
|
b764882195 | ||
|
a2abc5e15f | ||
|
a618e43977 | ||
|
bbc04972bc | ||
|
61a7f360d9 | ||
|
fc1c47ccad | ||
|
fec64b04eb | ||
|
05aa27ef23 | ||
|
06cc698885 | ||
|
cb870a1ce9 | ||
|
90e04a7e31 | ||
|
1d01d2a9a7 | ||
|
70e9b22f5c | ||
|
e9d6369050 | ||
|
58d6aae969 | ||
|
4e0fcaba18 | ||
|
2d04a62512 | ||
|
8a0955dfa8 | ||
|
06f4583ea5 | ||
|
9daa69a59e | ||
|
9030464a1b | ||
|
bcfe7a54aa | ||
|
600c565eb2 | ||
|
aae506ce44 | ||
|
bf2ca74bb6 | ||
|
654e5958cd | ||
|
9657bbe08f | ||
|
10cbbe06d3 | ||
|
802391f1fe | ||
|
db04386fd9 | ||
|
7d5abcd016 | ||
|
d296a36cc4 | ||
|
bdb15bf9ba | ||
|
25af751320 | ||
|
7f99fae217 | ||
|
c134065066 | ||
|
eec38fd383 | ||
|
b9564773f1 | ||
|
8c767bb014 | ||
|
7386ad5ae3 | ||
|
e727453a97 | ||
|
553bda4d8e | ||
|
3e7febc83c | ||
|
b664a5352c | ||
|
b376a7d60f | ||
|
3fb944f925 | ||
|
1d70aa7a9b | ||
|
0bef9ccd43 | ||
|
d3b38ea28a | ||
|
69ae47ba5d | ||
|
95c492569f | ||
|
d996a4bc9f | ||
|
9f528fb4c0 | ||
|
bbab5b95b4 | ||
|
5e84cc0714 | ||
|
2af54dd5bd | ||
|
00283317d8 | ||
|
232f661f99 | ||
|
552ca5cc88 | ||
|
94e7cfc7e7 | ||
|
de7030ed26 | ||
|
587653cd8b | ||
|
e167ed1a3d | ||
|
003534f8f0 | ||
|
a363907bc9 | ||
|
530cc53f96 | ||
|
112268c70d | ||
|
726280b214 | ||
|
b1ab82d4c8 | ||
|
2e16857f3d | ||
|
308f9a49b0 | ||
|
7ab09015b1 | ||
|
d1c0828262 | ||
|
b4dd94c217 | ||
|
f428f538b6 | ||
|
75b91c0b9f | ||
|
9f1dd0acb1 | ||
|
6db1a5555a | ||
|
72f8b9d80b | ||
|
7b4a99be8a | ||
|
8dd4fc5be6 | ||
|
ef56f55d19 | ||
|
6fdd1c13a7 | ||
|
ac826886c9 | ||
|
a776bbabd9 | ||
|
b7f0226a46 | ||
|
ca1773878d | ||
|
aee0098faf | ||
|
03e19e6bc8 | ||
|
7311e96417 | ||
|
3d359ff905 | ||
|
605c4a1ff2 | ||
|
1803757a9b | ||
|
75c4a8e10d | ||
|
0938f9235c | ||
|
7b17bcd9a0 | ||
|
357383bc4f | ||
|
c82d6dd4a3 | ||
|
ced4cb7609 | ||
|
ad3dea9861 | ||
|
d910e83299 | ||
|
4d7137f261 | ||
|
5963ce5d28 | ||
|
a7ddc7847c |
@@ -137,7 +137,7 @@
|
|||||||
# hardware coherency (i.e., no virtualization or cache coherent DMA)
|
# hardware coherency (i.e., no virtualization or cache coherent DMA)
|
||||||
gArmTokenSpaceGuid.PcdNormalMemoryNonshareableOverride|FALSE|BOOLEAN|0x00000043
|
gArmTokenSpaceGuid.PcdNormalMemoryNonshareableOverride|FALSE|BOOLEAN|0x00000043
|
||||||
|
|
||||||
[PcdsFeatureFlag.AARCH64]
|
[PcdsFeatureFlag.AARCH64, PcdsFeatureFlag.ARM]
|
||||||
## Used to select method for requesting services from S-EL1.<BR><BR>
|
## Used to select method for requesting services from S-EL1.<BR><BR>
|
||||||
# TRUE - Selects FF-A calls for communication between S-EL0 and SPMC.<BR>
|
# TRUE - Selects FF-A calls for communication between S-EL0 and SPMC.<BR>
|
||||||
# FALSE - Selects SVC calls for communication between S-EL0 and SPMC.<BR>
|
# FALSE - Selects SVC calls for communication between S-EL0 and SPMC.<BR>
|
||||||
|
@@ -161,4 +161,6 @@
|
|||||||
[Components.AARCH64]
|
[Components.AARCH64]
|
||||||
ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
|
ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
|
||||||
ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
|
ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
|
||||||
|
|
||||||
|
[Components.AARCH64, Components.ARM]
|
||||||
ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
|
ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf
|
||||||
|
@@ -17,9 +17,21 @@
|
|||||||
#define ARM_FFA_SVC_H_
|
#define ARM_FFA_SVC_H_
|
||||||
|
|
||||||
#define ARM_SVC_ID_FFA_VERSION_AARCH32 0x84000063
|
#define ARM_SVC_ID_FFA_VERSION_AARCH32 0x84000063
|
||||||
|
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH32 0x8400006F
|
||||||
|
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH32 0x84000070
|
||||||
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64 0xC400006F
|
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64 0xC400006F
|
||||||
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64 0xC4000070
|
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64 0xC4000070
|
||||||
|
|
||||||
|
/* Generic IDs when using AArch32 or AArch64 execution state */
|
||||||
|
#ifdef MDE_CPU_AARCH64
|
||||||
|
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64
|
||||||
|
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64
|
||||||
|
#endif
|
||||||
|
#ifdef MDE_CPU_ARM
|
||||||
|
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH32
|
||||||
|
#define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH32
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SPM_MAJOR_VERSION_FFA 1
|
#define SPM_MAJOR_VERSION_FFA 1
|
||||||
#define SPM_MINOR_VERSION_FFA 0
|
#define SPM_MINOR_VERSION_FFA 0
|
||||||
|
|
||||||
|
@@ -15,10 +15,25 @@
|
|||||||
* privileged operations on its behalf.
|
* privileged operations on its behalf.
|
||||||
*/
|
*/
|
||||||
#define ARM_SVC_ID_SPM_VERSION_AARCH32 0x84000060
|
#define ARM_SVC_ID_SPM_VERSION_AARCH32 0x84000060
|
||||||
|
#define ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH32 0x84000061
|
||||||
|
#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH32 0x84000064
|
||||||
|
#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH32 0x84000065
|
||||||
#define ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64 0xC4000061
|
#define ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64 0xC4000061
|
||||||
#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64 0xC4000064
|
#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64 0xC4000064
|
||||||
#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64 0xC4000065
|
#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64 0xC4000065
|
||||||
|
|
||||||
|
/* Generic IDs when using AArch32 or AArch64 execution state */
|
||||||
|
#ifdef MDE_CPU_AARCH64
|
||||||
|
#define ARM_SVC_ID_SP_EVENT_COMPLETE ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64
|
||||||
|
#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64
|
||||||
|
#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64
|
||||||
|
#endif
|
||||||
|
#ifdef MDE_CPU_ARM
|
||||||
|
#define ARM_SVC_ID_SP_EVENT_COMPLETE ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH32
|
||||||
|
#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH32
|
||||||
|
#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH32
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SET_MEM_ATTR_DATA_PERM_MASK 0x3
|
#define SET_MEM_ATTR_DATA_PERM_MASK 0x3
|
||||||
#define SET_MEM_ATTR_DATA_PERM_SHIFT 0
|
#define SET_MEM_ATTR_DATA_PERM_SHIFT 0
|
||||||
#define SET_MEM_ATTR_DATA_PERM_NO_ACCESS 0
|
#define SET_MEM_ATTR_DATA_PERM_NO_ACCESS 0
|
||||||
|
@@ -49,6 +49,14 @@
|
|||||||
#define ARM_SMC_ID_MM_COMMUNICATE_AARCH32 0x84000041
|
#define ARM_SMC_ID_MM_COMMUNICATE_AARCH32 0x84000041
|
||||||
#define ARM_SMC_ID_MM_COMMUNICATE_AARCH64 0xC4000041
|
#define ARM_SMC_ID_MM_COMMUNICATE_AARCH64 0xC4000041
|
||||||
|
|
||||||
|
/* Generic ID when using AArch32 or AArch64 execution state */
|
||||||
|
#ifdef MDE_CPU_AARCH64
|
||||||
|
#define ARM_SMC_ID_MM_COMMUNICATE ARM_SMC_ID_MM_COMMUNICATE_AARCH64
|
||||||
|
#endif
|
||||||
|
#ifdef MDE_CPU_ARM
|
||||||
|
#define ARM_SMC_ID_MM_COMMUNICATE ARM_SMC_ID_MM_COMMUNICATE_AARCH32
|
||||||
|
#endif
|
||||||
|
|
||||||
/* MM return error codes */
|
/* MM return error codes */
|
||||||
#define ARM_SMC_MM_RET_SUCCESS 0
|
#define ARM_SMC_MM_RET_SUCCESS 0
|
||||||
#define ARM_SMC_MM_RET_NOT_SUPPORTED -1
|
#define ARM_SMC_MM_RET_NOT_SUPPORTED -1
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
File managing the MMU for ARMv8 architecture in S-EL0
|
File managing the MMU for ARMv8 architecture in S-EL0
|
||||||
|
|
||||||
Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
|
Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
|
||||||
|
Copyright (c) 2021, Linaro Limited
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
@par Reference(s):
|
@par Reference(s):
|
||||||
@@ -62,7 +63,7 @@ SendMemoryPermissionRequest (
|
|||||||
// for other Direct Request calls which are not atomic
|
// for other Direct Request calls which are not atomic
|
||||||
// We therefore check only for Direct Response by the
|
// We therefore check only for Direct Response by the
|
||||||
// callee.
|
// callee.
|
||||||
if (SvcArgs->Arg0 == ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64) {
|
if (SvcArgs->Arg0 == ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP) {
|
||||||
// A Direct Response means FF-A success
|
// A Direct Response means FF-A success
|
||||||
// Now check the payload for errors
|
// Now check the payload for errors
|
||||||
// The callee sends back the return value
|
// The callee sends back the return value
|
||||||
@@ -164,13 +165,13 @@ GetMemoryPermissions (
|
|||||||
ZeroMem (&SvcArgs, sizeof (ARM_SVC_ARGS));
|
ZeroMem (&SvcArgs, sizeof (ARM_SVC_ARGS));
|
||||||
if (FeaturePcdGet (PcdFfaEnable)) {
|
if (FeaturePcdGet (PcdFfaEnable)) {
|
||||||
// See [2], Section 10.2 FFA_MSG_SEND_DIRECT_REQ.
|
// See [2], Section 10.2 FFA_MSG_SEND_DIRECT_REQ.
|
||||||
SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64;
|
SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ;
|
||||||
SvcArgs.Arg1 = ARM_FFA_DESTINATION_ENDPOINT_ID;
|
SvcArgs.Arg1 = ARM_FFA_DESTINATION_ENDPOINT_ID;
|
||||||
SvcArgs.Arg2 = 0;
|
SvcArgs.Arg2 = 0;
|
||||||
SvcArgs.Arg3 = ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64;
|
SvcArgs.Arg3 = ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES;
|
||||||
SvcArgs.Arg4 = BaseAddress;
|
SvcArgs.Arg4 = BaseAddress;
|
||||||
} else {
|
} else {
|
||||||
SvcArgs.Arg0 = ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64;
|
SvcArgs.Arg0 = ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES;
|
||||||
SvcArgs.Arg1 = BaseAddress;
|
SvcArgs.Arg1 = BaseAddress;
|
||||||
SvcArgs.Arg2 = 0;
|
SvcArgs.Arg2 = 0;
|
||||||
SvcArgs.Arg3 = 0;
|
SvcArgs.Arg3 = 0;
|
||||||
@@ -219,15 +220,15 @@ RequestMemoryPermissionChange (
|
|||||||
ZeroMem (&SvcArgs, sizeof (ARM_SVC_ARGS));
|
ZeroMem (&SvcArgs, sizeof (ARM_SVC_ARGS));
|
||||||
if (FeaturePcdGet (PcdFfaEnable)) {
|
if (FeaturePcdGet (PcdFfaEnable)) {
|
||||||
// See [2], Section 10.2 FFA_MSG_SEND_DIRECT_REQ.
|
// See [2], Section 10.2 FFA_MSG_SEND_DIRECT_REQ.
|
||||||
SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64;
|
SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ;
|
||||||
SvcArgs.Arg1 = ARM_FFA_DESTINATION_ENDPOINT_ID;
|
SvcArgs.Arg1 = ARM_FFA_DESTINATION_ENDPOINT_ID;
|
||||||
SvcArgs.Arg2 = 0;
|
SvcArgs.Arg2 = 0;
|
||||||
SvcArgs.Arg3 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64;
|
SvcArgs.Arg3 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES;
|
||||||
SvcArgs.Arg4 = BaseAddress;
|
SvcArgs.Arg4 = BaseAddress;
|
||||||
SvcArgs.Arg5 = EFI_SIZE_TO_PAGES (Length);
|
SvcArgs.Arg5 = EFI_SIZE_TO_PAGES (Length);
|
||||||
SvcArgs.Arg6 = Permissions;
|
SvcArgs.Arg6 = Permissions;
|
||||||
} else {
|
} else {
|
||||||
SvcArgs.Arg0 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64;
|
SvcArgs.Arg0 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES;
|
||||||
SvcArgs.Arg1 = BaseAddress;
|
SvcArgs.Arg1 = BaseAddress;
|
||||||
SvcArgs.Arg2 = EFI_SIZE_TO_PAGES (Length);
|
SvcArgs.Arg2 = EFI_SIZE_TO_PAGES (Length);
|
||||||
SvcArgs.Arg3 = Permissions;
|
SvcArgs.Arg3 = Permissions;
|
@@ -16,14 +16,14 @@
|
|||||||
LIBRARY_CLASS = StandaloneMmMmuLib
|
LIBRARY_CLASS = StandaloneMmMmuLib
|
||||||
PI_SPECIFICATION_VERSION = 0x00010032
|
PI_SPECIFICATION_VERSION = 0x00010032
|
||||||
|
|
||||||
[Sources.AARCH64]
|
[Sources]
|
||||||
AArch64/ArmMmuStandaloneMmLib.c
|
ArmMmuStandaloneMmLib.c
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
ArmPkg/ArmPkg.dec
|
ArmPkg/ArmPkg.dec
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
|
||||||
[FeaturePcd.AARCH64]
|
[FeaturePcd.ARM, FeaturePcd.AARCH64]
|
||||||
gArmTokenSpaceGuid.PcdFfaEnable
|
gArmTokenSpaceGuid.PcdFfaEnable
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
|
Submodule BaseTools/Source/C/BrotliCompress/brotli updated: 666c3280cc...aa7b018dcb
@@ -13,6 +13,14 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o DevicePathUtili
|
|||||||
|
|
||||||
include $(MAKEROOT)/Makefiles/app.makefile
|
include $(MAKEROOT)/Makefiles/app.makefile
|
||||||
|
|
||||||
|
GCCVERSION = $(shell gcc -dumpversion | awk -F'.' '{print $$1}')
|
||||||
|
ifneq ("$(GCCVERSION)", "5")
|
||||||
|
ifneq ($(CXX), llvm)
|
||||||
|
# gcc 12 trips over device path handling
|
||||||
|
BUILD_CFLAGS += -Wno-error=stringop-overflow
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
LIBS = -lCommon
|
LIBS = -lCommon
|
||||||
ifeq ($(CYGWIN), CYGWIN)
|
ifeq ($(CYGWIN), CYGWIN)
|
||||||
LIBS += -L/lib/e2fsprogs -luuid
|
LIBS += -L/lib/e2fsprogs -luuid
|
||||||
|
@@ -542,7 +542,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
|
|||||||
PeFileBuffer = (UINT8 *) malloc (PeFileSize);
|
PeFileBuffer = (UINT8 *) malloc (PeFileSize);
|
||||||
if (PeFileBuffer == NULL) {
|
if (PeFileBuffer == NULL) {
|
||||||
fclose (InFileHandle);
|
fclose (InFileHandle);
|
||||||
Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle);
|
Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
|
fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
|
||||||
|
@@ -34,9 +34,27 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include "FvLib.h"
|
#include "FvLib.h"
|
||||||
#include "PeCoffLib.h"
|
#include "PeCoffLib.h"
|
||||||
|
|
||||||
#define ARMT_UNCONDITIONAL_JUMP_INSTRUCTION 0xEB000000
|
|
||||||
#define ARM64_UNCONDITIONAL_JUMP_INSTRUCTION 0x14000000
|
#define ARM64_UNCONDITIONAL_JUMP_INSTRUCTION 0x14000000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Arm instruction to jump to Fv entry instruction in Arm or Thumb mode.
|
||||||
|
* From ARM Arch Ref Manual versions b/c/d, section A8.8.25 BL, BLX (immediate)
|
||||||
|
* BLX (encoding A2) branches to offset in Thumb instruction set mode.
|
||||||
|
* BL (encoding A1) branches to offset in Arm instruction set mode.
|
||||||
|
*/
|
||||||
|
#define ARM_JUMP_OFFSET_MAX 0xffffff
|
||||||
|
#define ARM_JUMP_TO_ARM(Offset) (0xeb000000 | ((Offset - 8) >> 2))
|
||||||
|
|
||||||
|
#define _ARM_JUMP_TO_THUMB(Imm32) (0xfa000000 | \
|
||||||
|
(((Imm32) & (1 << 1)) << (24 - 1)) | \
|
||||||
|
(((Imm32) >> 2) & 0x7fffff))
|
||||||
|
#define ARM_JUMP_TO_THUMB(Offset) _ARM_JUMP_TO_THUMB((Offset) - 8)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Arm instruction to return from exception (MOVS PC, LR)
|
||||||
|
*/
|
||||||
|
#define ARM_RETURN_FROM_EXCEPTION 0xE1B0F07E
|
||||||
|
|
||||||
BOOLEAN mArm = FALSE;
|
BOOLEAN mArm = FALSE;
|
||||||
BOOLEAN mRiscV = FALSE;
|
BOOLEAN mRiscV = FALSE;
|
||||||
STATIC UINT32 MaxFfsAlignment = 0;
|
STATIC UINT32 MaxFfsAlignment = 0;
|
||||||
@@ -2203,23 +2221,25 @@ Returns:
|
|||||||
// if we found an SEC core entry point then generate a branch instruction
|
// if we found an SEC core entry point then generate a branch instruction
|
||||||
// to it and populate a debugger SWI entry as well
|
// to it and populate a debugger SWI entry as well
|
||||||
if (UpdateVectorSec) {
|
if (UpdateVectorSec) {
|
||||||
|
UINT32 EntryOffset;
|
||||||
|
|
||||||
VerboseMsg("UpdateArmResetVectorIfNeeded updating ARM SEC vector");
|
VerboseMsg("UpdateArmResetVectorIfNeeded updating ARM SEC vector");
|
||||||
|
|
||||||
// B SecEntryPoint - signed_immed_24 part +/-32MB offset
|
EntryOffset = (INT32)(SecCoreEntryAddress - FvInfo->BaseAddress);
|
||||||
// on ARM, the PC is always 8 ahead, so we're not really jumping from the base address, but from base address + 8
|
|
||||||
ResetVector[0] = (INT32)(SecCoreEntryAddress - FvInfo->BaseAddress - 8) >> 2;
|
|
||||||
|
|
||||||
if (ResetVector[0] > 0x00FFFFFF) {
|
if (EntryOffset > ARM_JUMP_OFFSET_MAX) {
|
||||||
Error(NULL, 0, 3000, "Invalid", "SEC Entry point must be within 32MB of the start of the FV");
|
Error(NULL, 0, 3000, "Invalid", "SEC Entry point offset above 1MB of the start of the FV");
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add opcode for an unconditional branch with no link. i.e.: " B SecEntryPoint"
|
if ((SecCoreEntryAddress & 1) != 0) {
|
||||||
ResetVector[0] |= ARMT_UNCONDITIONAL_JUMP_INSTRUCTION;
|
ResetVector[0] = ARM_JUMP_TO_THUMB(EntryOffset);
|
||||||
|
} else {
|
||||||
|
ResetVector[0] = ARM_JUMP_TO_ARM(EntryOffset);
|
||||||
|
}
|
||||||
|
|
||||||
// SWI handler movs pc,lr. Just in case a debugger uses SWI
|
// SWI handler movs pc,lr. Just in case a debugger uses SWI
|
||||||
ResetVector[2] = 0xE1B0F07E;
|
ResetVector[2] = ARM_RETURN_FROM_EXCEPTION;
|
||||||
|
|
||||||
// Place holder to support a common interrupt handler from ROM.
|
// Place holder to support a common interrupt handler from ROM.
|
||||||
// Currently not supported. For this to be used the reset vector would not be in this FV
|
// Currently not supported. For this to be used the reset vector would not be in this FV
|
||||||
|
@@ -1062,7 +1062,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
|
|||||||
PeFileBuffer = (UINT8 *) malloc (PeFileSize);
|
PeFileBuffer = (UINT8 *) malloc (PeFileSize);
|
||||||
if (PeFileBuffer == NULL) {
|
if (PeFileBuffer == NULL) {
|
||||||
fclose (InFileHandle);
|
fclose (InFileHandle);
|
||||||
Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle);
|
Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
|
fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
|
||||||
|
@@ -2825,12 +2825,13 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
|
|||||||
|
|
||||||
nowPos64 = p->nowPos64;
|
nowPos64 = p->nowPos64;
|
||||||
RangeEnc_Init(&p->rc);
|
RangeEnc_Init(&p->rc);
|
||||||
p->rc.outStream = &outStream.vt;
|
|
||||||
|
|
||||||
if (desiredPackSize == 0)
|
if (desiredPackSize == 0)
|
||||||
return SZ_ERROR_OUTPUT_EOF;
|
return SZ_ERROR_OUTPUT_EOF;
|
||||||
|
|
||||||
|
p->rc.outStream = &outStream.vt;
|
||||||
res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
|
res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
|
||||||
|
p->rc.outStream = NULL;
|
||||||
|
|
||||||
*unpackSize = (UInt32)(p->nowPos64 - nowPos64);
|
*unpackSize = (UInt32)(p->nowPos64 - nowPos64);
|
||||||
*destLen -= outStream.rem;
|
*destLen -= outStream.rem;
|
||||||
|
@@ -152,11 +152,11 @@ class CompressedImage(Image):
|
|||||||
try:
|
try:
|
||||||
TmpData = DeCompress('Efi', self[self._HEADER_SIZE_:])
|
TmpData = DeCompress('Efi', self[self._HEADER_SIZE_:])
|
||||||
DecData = array('B')
|
DecData = array('B')
|
||||||
DecData.fromstring(TmpData)
|
DecData.frombytes(TmpData)
|
||||||
except:
|
except:
|
||||||
TmpData = DeCompress('Framework', self[self._HEADER_SIZE_:])
|
TmpData = DeCompress('Framework', self[self._HEADER_SIZE_:])
|
||||||
DecData = array('B')
|
DecData = array('B')
|
||||||
DecData.fromstring(TmpData)
|
DecData.frombytes(TmpData)
|
||||||
|
|
||||||
SectionList = []
|
SectionList = []
|
||||||
Offset = 0
|
Offset = 0
|
||||||
@@ -196,7 +196,7 @@ class Ui(Image):
|
|||||||
return len(self)
|
return len(self)
|
||||||
|
|
||||||
def _GetUiString(self):
|
def _GetUiString(self):
|
||||||
return codecs.utf_16_decode(self[0:-2].tostring())[0]
|
return codecs.utf_16_decode(self[0:-2].tobytes())[0]
|
||||||
|
|
||||||
String = property(_GetUiString)
|
String = property(_GetUiString)
|
||||||
|
|
||||||
@@ -738,7 +738,7 @@ class GuidDefinedImage(Image):
|
|||||||
Offset = self.DataOffset - 4
|
Offset = self.DataOffset - 4
|
||||||
TmpData = DeCompress('Framework', self[self.Offset:])
|
TmpData = DeCompress('Framework', self[self.Offset:])
|
||||||
DecData = array('B')
|
DecData = array('B')
|
||||||
DecData.fromstring(TmpData)
|
DecData.frombytes(TmpData)
|
||||||
Offset = 0
|
Offset = 0
|
||||||
while Offset < len(DecData):
|
while Offset < len(DecData):
|
||||||
Sec = Section()
|
Sec = Section()
|
||||||
@@ -759,7 +759,7 @@ class GuidDefinedImage(Image):
|
|||||||
|
|
||||||
TmpData = DeCompress('Lzma', self[self.Offset:])
|
TmpData = DeCompress('Lzma', self[self.Offset:])
|
||||||
DecData = array('B')
|
DecData = array('B')
|
||||||
DecData.fromstring(TmpData)
|
DecData.frombytes(TmpData)
|
||||||
Offset = 0
|
Offset = 0
|
||||||
while Offset < len(DecData):
|
while Offset < len(DecData):
|
||||||
Sec = Section()
|
Sec = Section()
|
||||||
|
@@ -155,7 +155,7 @@ ConvertAsn1TimeToEfiTime (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Str = (CONST CHAR8*)Asn1Time->data;
|
Str = (CONST CHAR8*)Asn1Time->data;
|
||||||
SetMem (EfiTime, 0, sizeof (EFI_TIME));
|
SetMem (EfiTime, sizeof (EFI_TIME), 0);
|
||||||
|
|
||||||
Index = 0;
|
Index = 0;
|
||||||
if (Asn1Time->type == V_ASN1_UTCTIME) { /* two digit year */
|
if (Asn1Time->type == V_ASN1_UTCTIME) { /* two digit year */
|
||||||
|
Submodule CryptoPkg/Library/OpensslLib/openssl updated: 52c587d60b...e2e09d9fba
@@ -224,7 +224,7 @@ DmaMap (
|
|||||||
goto FreeMapInfo;
|
goto FreeMapInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Map->Operation == MapOperationBusMasterRead) {
|
if (Operation == MapOperationBusMasterRead) {
|
||||||
CopyMem (Map->BufferAddress, (VOID *)(UINTN)HostAddress, *NumberOfBytes);
|
CopyMem (Map->BufferAddress, (VOID *)(UINTN)HostAddress, *NumberOfBytes);
|
||||||
}
|
}
|
||||||
mCpu->FlushDataCache (mCpu, (UINTN)Map->BufferAddress, AllocSize,
|
mCpu->FlushDataCache (mCpu, (UINTN)Map->BufferAddress, AllocSize,
|
||||||
|
47
FSDrivers/IA32/LICENSE.txt
Normal file
47
FSDrivers/IA32/LICENSE.txt
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
Licensing for the filesystem drivers is complex. Three different licenses
|
||||||
|
apply to various parts of the code:
|
||||||
|
|
||||||
|
* Christoph Pfisterer's original file system wrapper (FSW) code is covered
|
||||||
|
by a BSD-style license. Many of the source files with names that take the
|
||||||
|
form fsw_*.[ch] are so licensed, but this is NOT generally true of
|
||||||
|
filesystem-specific files (e.g., fsw_ext2.c or fsw_btrfs.c).
|
||||||
|
|
||||||
|
* Certain filesystem drivers are licensed under the GPLv2, either because
|
||||||
|
they borrow code from the Linux kernel or because a developer (typically
|
||||||
|
Oracle) applied the GPLv2 license to them. This is true of the ext2fs,
|
||||||
|
ext4fs, ReiserFS, HFS+, and ISO-9660 drivers.
|
||||||
|
|
||||||
|
* At least one filesystem driver (Btrfs) uses code taken from GRUB, and so
|
||||||
|
uses the GPLv3 (or later) license.
|
||||||
|
|
||||||
|
Note that the GPLv2 and GPLv3 are, ironically, not compatible licenses.
|
||||||
|
Thus, code from GPLv2 and GPLv3 projects should not be mixed. The BSD
|
||||||
|
license used by Pfisterer's original code is compatible with both versions
|
||||||
|
of the GPL, so the fact that both GPLv2 and GPLv3 drivers is built upon it
|
||||||
|
is OK. If you intend to contribute to this project's drivers or use the
|
||||||
|
code yourself, please keep this fact in mind.
|
||||||
|
|
||||||
|
The below was written by Christoph Pfisterer with respect to his original
|
||||||
|
code:
|
||||||
|
|
||||||
|
File System Wrapper License
|
||||||
|
=============================
|
||||||
|
|
||||||
|
The various parts of the File System Wrapper source code come from
|
||||||
|
different sources and may carry different licenses. Here's a quick
|
||||||
|
account of the situation:
|
||||||
|
|
||||||
|
* The core code was written from scratch and is covered by a
|
||||||
|
BSD-style license.
|
||||||
|
|
||||||
|
* The EFI host driver was written from scratch, possibly using code
|
||||||
|
from the TianoCore project and Intel's EFI Application Toolkit. It
|
||||||
|
is covered by a BSD-style license.
|
||||||
|
|
||||||
|
* The ext2 and reiserfs file system drivers use definitions from the
|
||||||
|
Linux kernel source. The actual code was written from scratch,
|
||||||
|
using multiple sources for reference. These drivers are covered by
|
||||||
|
the GNU GPL.
|
||||||
|
|
||||||
|
For more details, see each file's boilerplate comment. The full text
|
||||||
|
of the GNU GPL is in the file LICENSE_GPL.txt.
|
340
FSDrivers/IA32/LICENSE_GPL.txt
Normal file
340
FSDrivers/IA32/LICENSE_GPL.txt
Normal file
@@ -0,0 +1,340 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
BIN
FSDrivers/IA32/exfat_ia32.efi
Normal file
BIN
FSDrivers/IA32/exfat_ia32.efi
Normal file
Binary file not shown.
BIN
FSDrivers/IA32/ext2_ia32.efi
Normal file
BIN
FSDrivers/IA32/ext2_ia32.efi
Normal file
Binary file not shown.
BIN
FSDrivers/IA32/ext4_ia32.efi
Normal file
BIN
FSDrivers/IA32/ext4_ia32.efi
Normal file
Binary file not shown.
BIN
FSDrivers/IA32/ntfs_ia32.efi
Normal file
BIN
FSDrivers/IA32/ntfs_ia32.efi
Normal file
Binary file not shown.
47
FSDrivers/X64/LICENSE.txt
Normal file
47
FSDrivers/X64/LICENSE.txt
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
Licensing for the filesystem drivers is complex. Three different licenses
|
||||||
|
apply to various parts of the code:
|
||||||
|
|
||||||
|
* Christoph Pfisterer's original file system wrapper (FSW) code is covered
|
||||||
|
by a BSD-style license. Many of the source files with names that take the
|
||||||
|
form fsw_*.[ch] are so licensed, but this is NOT generally true of
|
||||||
|
filesystem-specific files (e.g., fsw_ext2.c or fsw_btrfs.c).
|
||||||
|
|
||||||
|
* Certain filesystem drivers are licensed under the GPLv2, either because
|
||||||
|
they borrow code from the Linux kernel or because a developer (typically
|
||||||
|
Oracle) applied the GPLv2 license to them. This is true of the ext2fs,
|
||||||
|
ext4fs, ReiserFS, HFS+, and ISO-9660 drivers.
|
||||||
|
|
||||||
|
* At least one filesystem driver (Btrfs) uses code taken from GRUB, and so
|
||||||
|
uses the GPLv3 (or later) license.
|
||||||
|
|
||||||
|
Note that the GPLv2 and GPLv3 are, ironically, not compatible licenses.
|
||||||
|
Thus, code from GPLv2 and GPLv3 projects should not be mixed. The BSD
|
||||||
|
license used by Pfisterer's original code is compatible with both versions
|
||||||
|
of the GPL, so the fact that both GPLv2 and GPLv3 drivers is built upon it
|
||||||
|
is OK. If you intend to contribute to this project's drivers or use the
|
||||||
|
code yourself, please keep this fact in mind.
|
||||||
|
|
||||||
|
The below was written by Christoph Pfisterer with respect to his original
|
||||||
|
code:
|
||||||
|
|
||||||
|
File System Wrapper License
|
||||||
|
=============================
|
||||||
|
|
||||||
|
The various parts of the File System Wrapper source code come from
|
||||||
|
different sources and may carry different licenses. Here's a quick
|
||||||
|
account of the situation:
|
||||||
|
|
||||||
|
* The core code was written from scratch and is covered by a
|
||||||
|
BSD-style license.
|
||||||
|
|
||||||
|
* The EFI host driver was written from scratch, possibly using code
|
||||||
|
from the TianoCore project and Intel's EFI Application Toolkit. It
|
||||||
|
is covered by a BSD-style license.
|
||||||
|
|
||||||
|
* The ext2 and reiserfs file system drivers use definitions from the
|
||||||
|
Linux kernel source. The actual code was written from scratch,
|
||||||
|
using multiple sources for reference. These drivers are covered by
|
||||||
|
the GNU GPL.
|
||||||
|
|
||||||
|
For more details, see each file's boilerplate comment. The full text
|
||||||
|
of the GNU GPL is in the file LICENSE_GPL.txt.
|
340
FSDrivers/X64/LICENSE_GPL.txt
Normal file
340
FSDrivers/X64/LICENSE_GPL.txt
Normal file
@@ -0,0 +1,340 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
BIN
FSDrivers/X64/exfat_ia32.efi
Normal file
BIN
FSDrivers/X64/exfat_ia32.efi
Normal file
Binary file not shown.
BIN
FSDrivers/X64/exfat_x64.efi
Normal file
BIN
FSDrivers/X64/exfat_x64.efi
Normal file
Binary file not shown.
BIN
FSDrivers/X64/ext2_x64.efi
Normal file
BIN
FSDrivers/X64/ext2_x64.efi
Normal file
Binary file not shown.
BIN
FSDrivers/X64/ext4_x64.efi
Normal file
BIN
FSDrivers/X64/ext4_x64.efi
Normal file
Binary file not shown.
BIN
FSDrivers/X64/ntfs_x64.efi
Normal file
BIN
FSDrivers/X64/ntfs_x64.efi
Normal file
Binary file not shown.
27
FSDrivers/exfat.inf
Normal file
27
FSDrivers/exfat.inf
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# ReadOnly exFAT filesystem driver
|
||||||
|
# From https://efi.akeo.ie/ v1.5
|
||||||
|
##
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = exfat
|
||||||
|
FILE_GUID = CB683001-379F-48C7-B7B6-707D29454BF5
|
||||||
|
MODULE_TYPE = UEFI_DRIVER
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
VALID_ARCHITECTURES = X64 IA32
|
||||||
|
|
||||||
|
[Binaries.X64]
|
||||||
|
PE32|X64/exfat_x64.efi|*
|
||||||
|
|
||||||
|
[Binaries.IA32]
|
||||||
|
PE32|IA32/exfat_ia32.efi|*
|
||||||
|
|
||||||
|
|
25
FSDrivers/ext2.inf
Normal file
25
FSDrivers/ext2.inf
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# EXT2 filesystem driver. See */LICENSE.txt for details.
|
||||||
|
# https://www.rodsbooks.com/refind/ v0.12
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = ext2
|
||||||
|
FILE_GUID = 8EC49C43-D1C4-4E6C-98BF-232CA5D89A1B
|
||||||
|
MODULE_TYPE = UEFI_DRIVER
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
VALID_ARCHITECTURES = X64 IA32
|
||||||
|
|
||||||
|
[Binaries.X64]
|
||||||
|
PE32|X64/ext2_x64.efi|*
|
||||||
|
|
||||||
|
[Binaries.IA32]
|
||||||
|
PE32|IA32/ext2_ia32.efi|*
|
||||||
|
|
25
FSDrivers/ext4.inf
Normal file
25
FSDrivers/ext4.inf
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# EXT4 filesystem driver. See */LICENSE.txt for details.
|
||||||
|
# https://www.rodsbooks.com/refind/ v0.12
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = ext4
|
||||||
|
FILE_GUID = 9d380387-a15a-4053-ae19-ff3495b6d0d5
|
||||||
|
MODULE_TYPE = UEFI_DRIVER
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
VALID_ARCHITECTURES = X64 IA32
|
||||||
|
|
||||||
|
[Binaries.X64]
|
||||||
|
PE32|X64/ext4_x64.efi|*
|
||||||
|
|
||||||
|
[Binaries.IA32]
|
||||||
|
PE32|IA32/ext4_ia32.efi|*
|
||||||
|
|
27
FSDrivers/ntfs.inf
Normal file
27
FSDrivers/ntfs.inf
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# ReadOnly NTFS filesystem driver
|
||||||
|
# From https://efi.akeo.ie/ v1.5
|
||||||
|
##
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = ntfs
|
||||||
|
FILE_GUID = 2282efd0-678b-4753-8d06-200d5940285d
|
||||||
|
MODULE_TYPE = UEFI_DRIVER
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
VALID_ARCHITECTURES = X64 IA32
|
||||||
|
|
||||||
|
[Binaries.X64]
|
||||||
|
PE32|X64/ntfs_x64.efi|*
|
||||||
|
|
||||||
|
[Binaries.IA32]
|
||||||
|
PE32|IA32/ntfs_ia32.efi|*
|
||||||
|
|
||||||
|
|
@@ -7,6 +7,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#include <IndustryStandard/Pci.h>
|
||||||
|
#include <Protocol/PciIo.h>
|
||||||
|
#include <Protocol/PciRootBridgeIo.h>
|
||||||
|
#include <Protocol/UsbIo.h>
|
||||||
|
#include <Register/Amd/Cpuid.h>
|
||||||
|
#include <Register/Intel/Cpuid.h>
|
||||||
|
#include <Register/Intel/Msr.h>
|
||||||
|
|
||||||
#include "FrontPage.h"
|
#include "FrontPage.h"
|
||||||
#include "FrontPageCustomizedUi.h"
|
#include "FrontPageCustomizedUi.h"
|
||||||
|
|
||||||
@@ -17,7 +25,6 @@ EFI_GUID mFrontPageGuid = FRONT_PAGE_FORMSET_GUID;
|
|||||||
BOOLEAN mResetRequired = FALSE;
|
BOOLEAN mResetRequired = FALSE;
|
||||||
|
|
||||||
EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
|
EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
|
||||||
CHAR8 *mLanguageString;
|
|
||||||
BOOLEAN mModeInitialized = FALSE;
|
BOOLEAN mModeInitialized = FALSE;
|
||||||
//
|
//
|
||||||
// Boot video resolution and text mode.
|
// Boot video resolution and text mode.
|
||||||
@@ -34,11 +41,12 @@ UINT32 mSetupTextModeRow = 0;
|
|||||||
UINT32 mSetupHorizontalResolution = 0;
|
UINT32 mSetupHorizontalResolution = 0;
|
||||||
UINT32 mSetupVerticalResolution = 0;
|
UINT32 mSetupVerticalResolution = 0;
|
||||||
|
|
||||||
|
EFI_SYSTEM_TABLE * gSystemTable = NULL;
|
||||||
|
|
||||||
FRONT_PAGE_CALLBACK_DATA gFrontPagePrivate = {
|
FRONT_PAGE_CALLBACK_DATA gFrontPagePrivate = {
|
||||||
FRONT_PAGE_CALLBACK_DATA_SIGNATURE,
|
FRONT_PAGE_CALLBACK_DATA_SIGNATURE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
|
||||||
{
|
{
|
||||||
FakeExtractConfig,
|
FakeExtractConfig,
|
||||||
FakeRouteConfig,
|
FakeRouteConfig,
|
||||||
@@ -211,7 +219,7 @@ UpdateFrontPageForm (
|
|||||||
//
|
//
|
||||||
StartGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
|
StartGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
|
||||||
StartGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
|
StartGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
|
||||||
StartGuidLabel->Number = LABEL_FRANTPAGE_INFORMATION;
|
StartGuidLabel->Number = LABEL_FRONTPAGE_INFORMATION;
|
||||||
//
|
//
|
||||||
// Create Hii Extend Label OpCode as the end opcode
|
// Create Hii Extend Label OpCode as the end opcode
|
||||||
//
|
//
|
||||||
@@ -239,6 +247,124 @@ UpdateFrontPageForm (
|
|||||||
HiiFreeOpCodeHandle (EndOpCodeHandle);
|
HiiFreeOpCodeHandle (EndOpCodeHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Copied from Device Manager; clean up
|
||||||
|
void ShowSecureBootConfig(void)
|
||||||
|
{
|
||||||
|
void *StartHandle;
|
||||||
|
void *EndHandle;
|
||||||
|
EFI_IFR_GUID_LABEL *StartLabel;
|
||||||
|
EFI_IFR_GUID_LABEL *EndLabel;
|
||||||
|
EFI_HII_HANDLE *HiiHandles;
|
||||||
|
EFI_HII_HANDLE HiiHandle = gFrontPagePrivate.HiiHandle;
|
||||||
|
UINTN Index;
|
||||||
|
EFI_STRING String;
|
||||||
|
EFI_STRING_ID Token;
|
||||||
|
EFI_STRING_ID TokenHelp;
|
||||||
|
EFI_IFR_FORM_SET *Buffer = NULL;
|
||||||
|
UINTN BufferSize = 0;
|
||||||
|
UINT8 ClassGuidNum;
|
||||||
|
EFI_GUID *ClassGuid;
|
||||||
|
UINTN TempSize = 0;
|
||||||
|
UINT8 *Ptr;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
// XXX: Copied from SecureBootConfigDxe
|
||||||
|
EFI_GUID SecureBootConfigGuid = { 0x5daf50a5, 0xea81, 0x4de2, {0x8f, 0x9b, 0xca, 0xbd, 0xa9, 0xcf, 0x5c, 0x14}};
|
||||||
|
|
||||||
|
StartHandle = HiiAllocateOpCodeHandle();
|
||||||
|
ASSERT(StartHandle != NULL);
|
||||||
|
|
||||||
|
EndHandle = HiiAllocateOpCodeHandle();
|
||||||
|
ASSERT(EndHandle != NULL);
|
||||||
|
|
||||||
|
StartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode(StartHandle, &gEfiIfrTianoGuid, NULL, sizeof(*StartLabel));
|
||||||
|
StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
|
||||||
|
StartLabel->Number = LABEL_DEVICES_LIST;
|
||||||
|
|
||||||
|
EndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode(EndHandle, &gEfiIfrTianoGuid, NULL, sizeof(*EndLabel));
|
||||||
|
EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
|
||||||
|
EndLabel->Number = LABEL_END;
|
||||||
|
|
||||||
|
// Get SecureBootConfig handle
|
||||||
|
HiiHandles = HiiGetHiiHandles(&SecureBootConfigGuid);
|
||||||
|
ASSERT(HiiHandles != NULL);
|
||||||
|
|
||||||
|
// Search for formset of each class type
|
||||||
|
for (Index = 0; HiiHandles[Index] != NULL; Index++) {
|
||||||
|
Status = HiiGetFormSetFromHiiHandle(HiiHandles[Index], &Buffer, &BufferSize);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr = (UINT8 *)Buffer;
|
||||||
|
while (TempSize < BufferSize) {
|
||||||
|
TempSize += ((EFI_IFR_OP_HEADER *)Ptr)->Length;
|
||||||
|
if (((EFI_IFR_OP_HEADER *)Ptr)->Length <= OFFSET_OF (EFI_IFR_FORM_SET, Flags)) {
|
||||||
|
Ptr += ((EFI_IFR_OP_HEADER *)Ptr)->Length;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassGuidNum = (UINT8)(((EFI_IFR_FORM_SET *)Ptr)->Flags & 0x3);
|
||||||
|
ClassGuid = (EFI_GUID *)(VOID *)(Ptr + sizeof(EFI_IFR_FORM_SET));
|
||||||
|
while (ClassGuidNum-- > 0) {
|
||||||
|
if (CompareGuid(&gEfiHiiPlatformSetupFormsetGuid, ClassGuid) == 0) {
|
||||||
|
ClassGuid++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String = HiiGetString(HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->FormSetTitle, NULL);
|
||||||
|
if (String == NULL) {
|
||||||
|
String = HiiGetString(HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL);
|
||||||
|
ASSERT (String != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
Token = HiiSetString(HiiHandle, 0, String, NULL);
|
||||||
|
FreePool(String);
|
||||||
|
|
||||||
|
String = HiiGetString(HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->Help, NULL);
|
||||||
|
if (String == NULL) {
|
||||||
|
String = HiiGetString(HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL);
|
||||||
|
ASSERT(String != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
TokenHelp = HiiSetString(HiiHandle, 0, String, NULL);
|
||||||
|
FreePool(String);
|
||||||
|
|
||||||
|
HiiCreateGotoExOpCode(
|
||||||
|
StartHandle,
|
||||||
|
0,
|
||||||
|
Token,
|
||||||
|
TokenHelp,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
&SecureBootConfigGuid,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr += ((EFI_IFR_OP_HEADER *)Ptr)->Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
FreePool (Buffer);
|
||||||
|
Buffer = NULL;
|
||||||
|
TempSize = 0;
|
||||||
|
BufferSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
HiiUpdateForm(
|
||||||
|
HiiHandle,
|
||||||
|
&mFrontPageGuid,
|
||||||
|
FRONT_PAGE_FORM_ID,
|
||||||
|
StartHandle,
|
||||||
|
EndHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
HiiFreeOpCodeHandle(StartHandle);
|
||||||
|
HiiFreeOpCodeHandle(EndHandle);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize HII information for the FrontPage
|
Initialize HII information for the FrontPage
|
||||||
|
|
||||||
@@ -297,6 +423,8 @@ InitializeFrontPage (
|
|||||||
//
|
//
|
||||||
UpdateFrontPageForm();
|
UpdateFrontPageForm();
|
||||||
|
|
||||||
|
ShowSecureBootConfig();
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,10 +495,6 @@ FreeFrontPage(
|
|||||||
// Publish our HII data
|
// Publish our HII data
|
||||||
//
|
//
|
||||||
HiiRemovePackages (gFrontPagePrivate.HiiHandle);
|
HiiRemovePackages (gFrontPagePrivate.HiiHandle);
|
||||||
if (gFrontPagePrivate.LanguageToken != NULL) {
|
|
||||||
FreePool (gFrontPagePrivate.LanguageToken);
|
|
||||||
gFrontPagePrivate.LanguageToken = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -492,6 +616,462 @@ GetOptionalStringByIndex (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINT16 SmbiosTableLength (SMBIOS_STRUCTURE_POINTER SmbiosTableN)
|
||||||
|
{
|
||||||
|
CHAR8 *AChar;
|
||||||
|
UINT16 Length;
|
||||||
|
|
||||||
|
AChar = (CHAR8 *)(SmbiosTableN.Raw + SmbiosTableN.Hdr->Length);
|
||||||
|
while ((*AChar != 0) || (*(AChar + 1) != 0)) {
|
||||||
|
AChar ++; //stop at 00 - first 0
|
||||||
|
}
|
||||||
|
Length = (UINT16)((UINTN)AChar - (UINTN)SmbiosTableN.Raw + 2); //length includes 00
|
||||||
|
return Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
SMBIOS_STRUCTURE_POINTER GetSmbiosTableFromType (
|
||||||
|
SMBIOS_TABLE_ENTRY_POINT *SmbiosPoint, UINT8 SmbiosType, UINTN IndexTable)
|
||||||
|
{
|
||||||
|
SMBIOS_STRUCTURE_POINTER SmbiosTableN;
|
||||||
|
UINTN SmbiosTypeIndex;
|
||||||
|
|
||||||
|
SmbiosTypeIndex = 0;
|
||||||
|
SmbiosTableN.Raw = (UINT8 *)((UINTN)SmbiosPoint->TableAddress);
|
||||||
|
if (SmbiosTableN.Raw == NULL) {
|
||||||
|
return SmbiosTableN;
|
||||||
|
}
|
||||||
|
while ((SmbiosTypeIndex != IndexTable) || (SmbiosTableN.Hdr->Type != SmbiosType)) {
|
||||||
|
if (SmbiosTableN.Hdr->Type == SMBIOS_TYPE_END_OF_TABLE) {
|
||||||
|
SmbiosTableN.Raw = NULL;
|
||||||
|
return SmbiosTableN;
|
||||||
|
}
|
||||||
|
if (SmbiosTableN.Hdr->Type == SmbiosType) {
|
||||||
|
SmbiosTypeIndex++;
|
||||||
|
}
|
||||||
|
SmbiosTableN.Raw = (UINT8 *)(SmbiosTableN.Raw + SmbiosTableLength (SmbiosTableN));
|
||||||
|
}
|
||||||
|
return SmbiosTableN;
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
VOID
|
||||||
|
WarnNoBootableMedia (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CHAR16 *String;
|
||||||
|
EFI_STRING_ID Token;
|
||||||
|
EFI_BOOT_MANAGER_LOAD_OPTION *BootOption;
|
||||||
|
UINTN BootOptionCount;
|
||||||
|
UINTN Index;
|
||||||
|
UINTN Count = 0;
|
||||||
|
|
||||||
|
String = AllocateZeroPool (0x60);
|
||||||
|
BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
|
||||||
|
|
||||||
|
for (Index = 0; Index < BootOptionCount; Index++) {
|
||||||
|
//
|
||||||
|
// Don't count the hidden/inactive boot option
|
||||||
|
//
|
||||||
|
if (((BootOption[Index].Attributes & LOAD_OPTION_HIDDEN) != 0) || ((BootOption[Index].Attributes & LOAD_OPTION_ACTIVE) == 0)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);
|
||||||
|
|
||||||
|
if (Count == 0) {
|
||||||
|
StrCatS (String, 0x60 / sizeof (CHAR16), L"Warning: No bootable media found");
|
||||||
|
} else {
|
||||||
|
StrCatS (String, 0x60 / sizeof (CHAR16), L"");
|
||||||
|
}
|
||||||
|
|
||||||
|
Token = STRING_TOKEN (STR_NO_BOOTABLE_MEDIA);
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, String, NULL);
|
||||||
|
FreePool(String);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
StandardSignatureIsAuthenticAMD (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT32 RegEbx;
|
||||||
|
UINT32 RegEcx;
|
||||||
|
UINT32 RegEdx;
|
||||||
|
|
||||||
|
AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx);
|
||||||
|
return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
|
||||||
|
RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
|
||||||
|
RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
StandardSignatureIsGenuineIntel (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT32 RegEbx;
|
||||||
|
UINT32 RegEcx;
|
||||||
|
UINT32 RegEdx;
|
||||||
|
|
||||||
|
AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx);
|
||||||
|
return (RegEbx == CPUID_SIGNATURE_GENUINE_INTEL_EBX &&
|
||||||
|
RegEcx == CPUID_SIGNATURE_GENUINE_INTEL_ECX &&
|
||||||
|
RegEdx == CPUID_SIGNATURE_GENUINE_INTEL_EDX);
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
CHAR8 Signature[8];
|
||||||
|
UINT8 Checksum;
|
||||||
|
CHAR8 OemId[6];
|
||||||
|
UINT8 Revision;
|
||||||
|
UINT32 RsdtAddress;
|
||||||
|
} ACPI_RSDP;
|
||||||
|
|
||||||
|
CHAR8 RSDP_SIGNATURE[8] = {'R', 'S', 'D', ' ', 'P', 'T', 'R', ' '};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
CHAR8 Signature[4];
|
||||||
|
UINT32 Length;
|
||||||
|
UINT8 Revision;
|
||||||
|
UINT8 Checksum;
|
||||||
|
CHAR8 OemId[6];
|
||||||
|
CHAR8 OemTableId[8];
|
||||||
|
UINT32 OemRevision;
|
||||||
|
UINT32 CreatorId;
|
||||||
|
UINT32 CreatorRevision;
|
||||||
|
} ACPI_SDT_HEADER;
|
||||||
|
|
||||||
|
CHAR8 RSDT_SIGNATURE[4] = {'R', 'S', 'D', 'T'};
|
||||||
|
|
||||||
|
STATIC ACPI_SDT_HEADER* FindAcpiTable(CHAR8 Name[4]) {
|
||||||
|
UINTN Index;
|
||||||
|
EFI_CONFIGURATION_TABLE* ConfigurationTable;
|
||||||
|
UINTN RsdpPtr;
|
||||||
|
ACPI_RSDP* Rsdp;
|
||||||
|
UINTN RsdtPtr;
|
||||||
|
ACPI_SDT_HEADER* Rsdt;
|
||||||
|
UINTN TablePtr;
|
||||||
|
ACPI_SDT_HEADER* Table;
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, "FindAcpiTable: '%c%c%c%c'\n",
|
||||||
|
Name[0],
|
||||||
|
Name[1],
|
||||||
|
Name[2],
|
||||||
|
Name[3]
|
||||||
|
));
|
||||||
|
|
||||||
|
if (gSystemTable == NULL) {
|
||||||
|
DEBUG ((EFI_D_INFO, " System Table missing\n"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search the table for an entry that matches the ACPI Table Guid
|
||||||
|
for (Index = 0; Index < gSystemTable->NumberOfTableEntries; Index++) {
|
||||||
|
if (CompareGuid (&gEfiAcpiTableGuid, &(gSystemTable->ConfigurationTable[Index].VendorGuid))) {
|
||||||
|
ConfigurationTable = &gSystemTable->ConfigurationTable[Index];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ConfigurationTable == NULL) {
|
||||||
|
DEBUG ((EFI_D_INFO, " ACPI Configuration Table missing\n"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
RsdpPtr = (UINTN)ConfigurationTable->VendorTable;
|
||||||
|
DEBUG ((EFI_D_INFO, " RSDP 0x%x\n", RsdpPtr));
|
||||||
|
Rsdp = (ACPI_RSDP*)RsdpPtr;
|
||||||
|
DEBUG ((EFI_D_INFO, " Signature: '%c%c%c%c%c%c%c%c'\n",
|
||||||
|
Rsdp->Signature[0],
|
||||||
|
Rsdp->Signature[1],
|
||||||
|
Rsdp->Signature[2],
|
||||||
|
Rsdp->Signature[3],
|
||||||
|
Rsdp->Signature[4],
|
||||||
|
Rsdp->Signature[5],
|
||||||
|
Rsdp->Signature[6],
|
||||||
|
Rsdp->Signature[7]
|
||||||
|
));
|
||||||
|
if (CompareMem(Rsdp->Signature, RSDP_SIGNATURE, 8) != 0) {
|
||||||
|
DEBUG ((EFI_D_INFO, " RSDP invalid signature\n"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
DEBUG ((EFI_D_INFO, " Revision: 0x%x\n", Rsdp->Revision));
|
||||||
|
|
||||||
|
RsdtPtr = (UINTN)Rsdp->RsdtAddress;
|
||||||
|
DEBUG ((EFI_D_INFO, " RSDT 0x%x\n", RsdpPtr));
|
||||||
|
Rsdt = (ACPI_SDT_HEADER*)RsdtPtr;
|
||||||
|
DEBUG ((EFI_D_INFO, " Signature: '%c%c%c%c'\n",
|
||||||
|
Rsdt->Signature[0],
|
||||||
|
Rsdt->Signature[1],
|
||||||
|
Rsdt->Signature[2],
|
||||||
|
Rsdt->Signature[3]
|
||||||
|
));
|
||||||
|
if (CompareMem(Rsdt->Signature, RSDT_SIGNATURE, 4) != 0) {
|
||||||
|
DEBUG ((EFI_D_INFO, " RSDT invalid signature\n"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
DEBUG ((EFI_D_INFO, " Revision: 0x%x\n", Rsdt->Revision));
|
||||||
|
DEBUG ((EFI_D_INFO, " Length: 0x%x\n", Rsdt->Length));
|
||||||
|
|
||||||
|
for (Index = sizeof(ACPI_SDT_HEADER); Index < Rsdt->Length; Index += 4) {
|
||||||
|
TablePtr = (UINTN)(*(UINT32*)(RsdtPtr + Index));
|
||||||
|
DEBUG ((EFI_D_INFO, " Table %d: 0x%x\n", Index, TablePtr));
|
||||||
|
Table = (ACPI_SDT_HEADER*)TablePtr;
|
||||||
|
DEBUG ((EFI_D_INFO, " Signature: '%c%c%c%c'\n",
|
||||||
|
Table->Signature[0],
|
||||||
|
Table->Signature[1],
|
||||||
|
Table->Signature[2],
|
||||||
|
Table->Signature[3]
|
||||||
|
));
|
||||||
|
DEBUG ((EFI_D_INFO, " Revision: 0x%x\n", Table->Revision));
|
||||||
|
DEBUG ((EFI_D_INFO, " Length: 0x%x\n", Table->Length));
|
||||||
|
|
||||||
|
if (CompareMem(Table->Signature, Name, 4) == 0) {
|
||||||
|
DEBUG ((EFI_D_INFO, " Match found\n"));
|
||||||
|
return Table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, " No match found\n"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// From PciBusDxe
|
||||||
|
STATIC
|
||||||
|
EFI_STATUS
|
||||||
|
PciDevicePresent(
|
||||||
|
OUT PCI_TYPE00 *Pci,
|
||||||
|
IN UINT8 Bus,
|
||||||
|
IN UINT8 Device,
|
||||||
|
IN UINT8 Func
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT64 Address = EFI_PCI_ADDRESS(Bus, Device, Func, 0);
|
||||||
|
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_HANDLE *PciIoBuffer;
|
||||||
|
UINTN PciIoHandleCount = 0;
|
||||||
|
|
||||||
|
Status = gBS->LocateHandleBuffer(
|
||||||
|
ByProtocol,
|
||||||
|
&gEfiPciRootBridgeIoProtocolGuid,
|
||||||
|
NULL,
|
||||||
|
&PciIoHandleCount,
|
||||||
|
&PciIoBuffer
|
||||||
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
DEBUG((EFI_D_INFO, "%a: Failed to get PciRootBridgeIo handles: %r\n", __FUNCTION__, Status));
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (UINTN Index = 0; Index < PciIoHandleCount; Index++) {
|
||||||
|
Status = gBS->OpenProtocol(
|
||||||
|
PciIoBuffer[Index],
|
||||||
|
&gEfiPciRootBridgeIoProtocolGuid,
|
||||||
|
(VOID *)&PciRootBridgeIo,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||||
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
DEBUG((EFI_D_INFO, "%a: Failed to open PciRootBridgeIo protocol: %r\n", __FUNCTION__, Status));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read the Vendor ID register
|
||||||
|
Status = PciRootBridgeIo->Pci.Read(
|
||||||
|
PciRootBridgeIo,
|
||||||
|
EfiPciWidthUint32,
|
||||||
|
Address,
|
||||||
|
1,
|
||||||
|
Pci
|
||||||
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
DEBUG((EFI_D_INFO, "%a: Failed to read vendor ID: %r\n", __FUNCTION__, Status));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read the entire config header for the device
|
||||||
|
Status = PciRootBridgeIo->Pci.Read(
|
||||||
|
PciRootBridgeIo,
|
||||||
|
EfiPciWidthUint32,
|
||||||
|
Address,
|
||||||
|
sizeof(PCI_TYPE00) / sizeof(UINT32),
|
||||||
|
Pci
|
||||||
|
);
|
||||||
|
|
||||||
|
FreePool(PciIoBuffer);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
FreePool(PciIoBuffer);
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check for Intel device with class [0780] at 00:16.0.
|
||||||
|
*/
|
||||||
|
STATIC
|
||||||
|
BOOLEAN
|
||||||
|
HasCsmeDevice(VOID)
|
||||||
|
{
|
||||||
|
PCI_TYPE00 Pci;
|
||||||
|
|
||||||
|
if (!EFI_ERROR(PciDevicePresent(&Pci, 0x00, 0x16, 0x00))) {
|
||||||
|
DEBUG((EFI_D_INFO, "%a: vid=0x%04X, class=[%02X,%02X,%02X]\n", __FUNCTION__,
|
||||||
|
Pci.Hdr.VendorId, Pci.Hdr.ClassCode[0], Pci.Hdr.ClassCode[1], Pci.Hdr.ClassCode[2]));
|
||||||
|
return Pci.Hdr.VendorId == 0x8086 &&
|
||||||
|
Pci.Hdr.ClassCode[2] == PCI_CLASS_SCC &&
|
||||||
|
Pci.Hdr.ClassCode[1] == PCI_SUBCLASS_SCC_OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC VOID FirmwareConfigurationInformation(VOID) {
|
||||||
|
EFI_STRING_ID Token;
|
||||||
|
|
||||||
|
Token = STRING_TOKEN (STR_VIRTUALIZATION);
|
||||||
|
if (StandardSignatureIsGenuineIntel()) {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"Intel Virtualization", NULL);
|
||||||
|
|
||||||
|
Token = STRING_TOKEN (STR_VIRTUALIZATION_STATUS);
|
||||||
|
CPUID_VERSION_INFO_ECX VersionInfoEcx;
|
||||||
|
AsmCpuid (CPUID_VERSION_INFO, NULL, NULL, &VersionInfoEcx.Uint32, NULL);
|
||||||
|
if (VersionInfoEcx.Bits.VMX) {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"VT-x: Active", NULL);
|
||||||
|
} else {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"VT-x: Deactivated", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
Token = STRING_TOKEN (STR_IOMMU_STATUS);
|
||||||
|
CHAR8 TableName[4] = {'D', 'M', 'A', 'R'};
|
||||||
|
if (FindAcpiTable(TableName)) {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"VT-d: Active", NULL);
|
||||||
|
} else {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"VT-d: Deactivated", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
Token = STRING_TOKEN(STR_ME_STATUS);
|
||||||
|
if (HasCsmeDevice()) {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"The Intel Management Engine is enabled.", NULL);
|
||||||
|
} else {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"The Intel Management Engine is disabled at runtime to increase security.", NULL);
|
||||||
|
}
|
||||||
|
} else if (StandardSignatureIsAuthenticAMD()) {
|
||||||
|
//TODO: verify AMD tests
|
||||||
|
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"AMD Virtualization", NULL);
|
||||||
|
|
||||||
|
Token = STRING_TOKEN (STR_VIRTUALIZATION_STATUS);
|
||||||
|
CPUID_AMD_EXTENDED_CPU_SIG_ECX AmdExtendedCpuSigEcx;
|
||||||
|
AsmCpuid (CPUID_EXTENDED_CPU_SIG, NULL, NULL, &AmdExtendedCpuSigEcx.Uint32, NULL);
|
||||||
|
if (AmdExtendedCpuSigEcx.Bits.SVM) {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"AMD-V: Active", NULL);
|
||||||
|
} else {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"AMD-V: Deactivated", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
Token = STRING_TOKEN (STR_IOMMU_STATUS);
|
||||||
|
//TODO: proper test for AMD IOMMU
|
||||||
|
BOOLEAN iommu_active = FALSE;
|
||||||
|
if (iommu_active) {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"AMD-Vi: Active", NULL);
|
||||||
|
} else {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"AMD-Vi: Deactivated", NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Token = STRING_TOKEN (STR_TPM_STATUS);
|
||||||
|
CHAR8 TableName[4] = {'T', 'P', 'M', '2'};
|
||||||
|
if (FindAcpiTable(TableName)) {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"Trusted Platform Module: Active", NULL);
|
||||||
|
} else {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"Trusted Platform Module: Deactivated", NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID WebcamStatus(VOID) {
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN UsbIoHandleCount;
|
||||||
|
EFI_HANDLE *UsbIoBuffer;
|
||||||
|
UINTN Index;
|
||||||
|
EFI_USB_IO_PROTOCOL *UsbIo;
|
||||||
|
EFI_USB_DEVICE_DESCRIPTOR DevDesc;
|
||||||
|
EFI_USB_INTERFACE_DESCRIPTOR IntfDesc;
|
||||||
|
UINTN Webcams;
|
||||||
|
EFI_STRING_ID Token;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get all Usb IO handles in system
|
||||||
|
//
|
||||||
|
UsbIoHandleCount = 0;
|
||||||
|
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiUsbIoProtocolGuid, NULL, &UsbIoHandleCount, &UsbIoBuffer);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
DEBUG ((EFI_D_INFO, "Failed to read UsbIo handles: 0x%x\n", Status));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Webcams = 0;
|
||||||
|
for (Index = 0; Index < UsbIoHandleCount; Index++) {
|
||||||
|
DEBUG ((EFI_D_INFO, "UsbIo Handle %d\n", Index));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the child Usb IO interface
|
||||||
|
//
|
||||||
|
Status = gBS->HandleProtocol(
|
||||||
|
UsbIoBuffer[Index],
|
||||||
|
&gEfiUsbIoProtocolGuid,
|
||||||
|
(VOID **) &UsbIo
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_INFO, " Failed to find UsbIo protocol\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = UsbIo->UsbGetDeviceDescriptor (UsbIo, &DevDesc);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_INFO, " Failed to get device descriptor\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, " ID: 0x%04X:0x%04X\n", DevDesc.IdVendor, DevDesc.IdProduct));
|
||||||
|
DEBUG ((EFI_D_INFO, " DeviceClass: %d\n", DevDesc.DeviceClass));
|
||||||
|
DEBUG ((EFI_D_INFO, " DeviceSubClass: %d\n", DevDesc.DeviceSubClass));
|
||||||
|
DEBUG ((EFI_D_INFO, " DeviceProtocol: %d\n", DevDesc.DeviceProtocol));
|
||||||
|
|
||||||
|
Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &IntfDesc);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_INFO, " Failed to get interface descriptor\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, " Interface: %d\n", IntfDesc.InterfaceNumber));
|
||||||
|
DEBUG ((EFI_D_INFO, " InterfaceClass: %d\n", IntfDesc.InterfaceClass));
|
||||||
|
DEBUG ((EFI_D_INFO, " InterfaceSubClass: %d\n", IntfDesc.InterfaceSubClass));
|
||||||
|
DEBUG ((EFI_D_INFO, " InterfaceProtocol: %d\n", IntfDesc.InterfaceProtocol));
|
||||||
|
|
||||||
|
if (IntfDesc.InterfaceClass == 14 && IntfDesc.InterfaceSubClass == 1) {
|
||||||
|
DEBUG ((EFI_D_INFO, " Detected Video Control interface\n"));
|
||||||
|
Webcams++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FreePool (UsbIoBuffer);
|
||||||
|
|
||||||
|
//TODO: logic for not showing the warning on desktops
|
||||||
|
Token = STRING_TOKEN (STR_WEBCAM_STATUS);
|
||||||
|
if (Webcams == 0) {
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"Info: Webcam Module Disconnected", NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@@ -503,154 +1083,86 @@ UpdateFrontPageBannerStrings (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT8 StrIndex;
|
|
||||||
CHAR16 *NewString;
|
|
||||||
CHAR16 *FirmwareVersionString;
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
EFI_STRING_ID TokenToUpdate;
|
||||||
EFI_SMBIOS_PROTOCOL *Smbios;
|
EFI_PHYSICAL_ADDRESS *Table;
|
||||||
SMBIOS_TABLE_TYPE0 *Type0Record;
|
SMBIOS_TABLE_ENTRY_POINT *EntryPoint;
|
||||||
SMBIOS_TABLE_TYPE1 *Type1Record;
|
SMBIOS_STRUCTURE_POINTER SmbiosTable;
|
||||||
SMBIOS_TABLE_TYPE4 *Type4Record;
|
|
||||||
SMBIOS_TABLE_TYPE19 *Type19Record;
|
|
||||||
EFI_SMBIOS_TABLE_HEADER *Record;
|
|
||||||
UINT64 InstalledMemory;
|
|
||||||
BOOLEAN FoundCpu;
|
|
||||||
|
|
||||||
InstalledMemory = 0;
|
FirmwareConfigurationInformation();
|
||||||
FoundCpu = 0;
|
WarnNoBootableMedia ();
|
||||||
|
WebcamStatus();
|
||||||
//
|
|
||||||
// Update default banner string.
|
|
||||||
//
|
|
||||||
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_LEFT), NULL);
|
|
||||||
UiCustomizeFrontPageBanner (4, TRUE, &NewString);
|
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_LEFT), NewString, NULL);
|
|
||||||
FreePool (NewString);
|
|
||||||
|
|
||||||
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_RIGHT), NULL);
|
|
||||||
UiCustomizeFrontPageBanner (4, FALSE, &NewString);
|
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_RIGHT), NewString, NULL);
|
|
||||||
FreePool (NewString);
|
|
||||||
|
|
||||||
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_LEFT), NULL);
|
|
||||||
UiCustomizeFrontPageBanner (5, TRUE, &NewString);
|
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_LEFT), NewString, NULL);
|
|
||||||
FreePool (NewString);
|
|
||||||
|
|
||||||
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_RIGHT), NULL);
|
|
||||||
UiCustomizeFrontPageBanner (5, FALSE, &NewString);
|
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_RIGHT), NewString, NULL);
|
|
||||||
FreePool (NewString);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Update Front Page banner strings base on SmBios Table.
|
|
||||||
//
|
|
||||||
Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **) &Smbios);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
//
|
|
||||||
// Smbios protocol not found, get the default value.
|
|
||||||
//
|
|
||||||
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL), NULL);
|
|
||||||
UiCustomizeFrontPageBanner (1, TRUE, &NewString);
|
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL), NewString, NULL);
|
|
||||||
FreePool (NewString);
|
|
||||||
|
|
||||||
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL), NULL);
|
|
||||||
UiCustomizeFrontPageBanner (2, TRUE, &NewString);
|
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL), NewString, NULL);
|
|
||||||
FreePool (NewString);
|
|
||||||
|
|
||||||
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED), NULL);
|
|
||||||
UiCustomizeFrontPageBanner (2, FALSE, &NewString);
|
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED), NewString, NULL);
|
|
||||||
FreePool (NewString);
|
|
||||||
|
|
||||||
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NULL);
|
|
||||||
UiCustomizeFrontPageBanner (3, TRUE, &NewString);
|
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NewString, NULL);
|
|
||||||
FreePool (NewString);
|
|
||||||
|
|
||||||
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE), NULL);
|
|
||||||
UiCustomizeFrontPageBanner (3, FALSE, &NewString);
|
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE), NewString, NULL);
|
|
||||||
FreePool (NewString);
|
|
||||||
|
|
||||||
|
Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &Table);
|
||||||
|
if (EFI_ERROR (Status) || Table == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
|
EntryPoint = (SMBIOS_TABLE_ENTRY_POINT*)Table;
|
||||||
Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);
|
|
||||||
while (!EFI_ERROR(Status)) {
|
|
||||||
if (Record->Type == SMBIOS_TYPE_BIOS_INFORMATION) {
|
|
||||||
Type0Record = (SMBIOS_TABLE_TYPE0 *) Record;
|
|
||||||
StrIndex = Type0Record->BiosVersion;
|
|
||||||
GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type0Record + Type0Record->Hdr.Length), StrIndex, &NewString);
|
|
||||||
|
|
||||||
FirmwareVersionString = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
|
SmbiosTable = GetSmbiosTableFromType (EntryPoint, EFI_SMBIOS_TYPE_BIOS_INFORMATION , 0);
|
||||||
if (*FirmwareVersionString != 0x0000 ) {
|
if (SmbiosTable.Raw != NULL) {
|
||||||
FreePool (NewString);
|
CHAR16 *FwVersion;
|
||||||
NewString = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
|
CHAR16 *TmpBuffer;
|
||||||
UiCustomizeFrontPageBanner (3, TRUE, &NewString);
|
UINT8 VersionIdx;
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NewString, NULL);
|
|
||||||
} else {
|
TmpBuffer = AllocateZeroPool (0x60);
|
||||||
UiCustomizeFrontPageBanner (3, TRUE, &NewString);
|
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NewString, NULL);
|
VersionIdx = SmbiosTable.Type0->BiosVersion;
|
||||||
FreePool (NewString);
|
GetOptionalStringByIndex ((CHAR8*)((UINT8*)SmbiosTable.Raw + SmbiosTable.Hdr->Length), VersionIdx, &FwVersion);
|
||||||
}
|
|
||||||
|
StrCatS (TmpBuffer, 0x60 / sizeof (CHAR16), L"Version: ");
|
||||||
|
StrCatS (TmpBuffer, 0x60 / sizeof (CHAR16), FwVersion);
|
||||||
|
|
||||||
|
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION);
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, TmpBuffer, NULL);
|
||||||
|
|
||||||
|
FreePool (FwVersion);
|
||||||
|
FreePool (TmpBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Record->Type == SMBIOS_TYPE_SYSTEM_INFORMATION) {
|
SmbiosTable = GetSmbiosTableFromType (EntryPoint, SMBIOS_TYPE_SYSTEM_INFORMATION , 0);
|
||||||
Type1Record = (SMBIOS_TABLE_TYPE1 *) Record;
|
if (SmbiosTable.Raw != NULL) {
|
||||||
StrIndex = Type1Record->ProductName;
|
CHAR16 *Manufacturer;
|
||||||
GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type1Record + Type1Record->Hdr.Length), StrIndex, &NewString);
|
CHAR16 *ProductName;
|
||||||
UiCustomizeFrontPageBanner (1, TRUE, &NewString);
|
CHAR16 *ProductVersion;
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL), NewString, NULL);
|
CHAR16 *Title;
|
||||||
FreePool (NewString);
|
CHAR16 *Model;
|
||||||
}
|
UINT8 ModelIdx;
|
||||||
|
UINT8 ManIdx;
|
||||||
|
UINT8 VersionIdx;
|
||||||
|
|
||||||
if ((Record->Type == SMBIOS_TYPE_PROCESSOR_INFORMATION) && !FoundCpu) {
|
Title = AllocateZeroPool (0x60);
|
||||||
Type4Record = (SMBIOS_TABLE_TYPE4 *) Record;
|
Model = AllocateZeroPool (0x60);
|
||||||
//
|
|
||||||
// The information in the record should be only valid when the CPU Socket is populated.
|
|
||||||
//
|
|
||||||
if ((Type4Record->Status & SMBIOS_TYPE4_CPU_SOCKET_POPULATED) == SMBIOS_TYPE4_CPU_SOCKET_POPULATED) {
|
|
||||||
StrIndex = Type4Record->ProcessorVersion;
|
|
||||||
GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type4Record + Type4Record->Hdr.Length), StrIndex, &NewString);
|
|
||||||
UiCustomizeFrontPageBanner (2, TRUE, &NewString);
|
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL), NewString, NULL);
|
|
||||||
FreePool (NewString);
|
|
||||||
|
|
||||||
ConvertProcessorToString(Type4Record->CurrentSpeed, 6, &NewString);
|
ManIdx = SmbiosTable.Type1->Manufacturer;
|
||||||
UiCustomizeFrontPageBanner (2, FALSE, &NewString);
|
ModelIdx = SmbiosTable.Type1->ProductName;
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED), NewString, NULL);
|
|
||||||
FreePool (NewString);
|
|
||||||
|
|
||||||
FoundCpu = TRUE;
|
GetOptionalStringByIndex ((CHAR8*)((UINT8*)SmbiosTable.Raw + SmbiosTable.Hdr->Length), ModelIdx, &ProductName);
|
||||||
}
|
GetOptionalStringByIndex ((CHAR8*)((UINT8*)SmbiosTable.Raw + SmbiosTable.Hdr->Length), ManIdx, &Manufacturer);
|
||||||
}
|
|
||||||
|
|
||||||
if ( Record->Type == SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS ) {
|
StrCatS (Title, 0x60 / sizeof (CHAR16), Manufacturer);
|
||||||
Type19Record = (SMBIOS_TABLE_TYPE19 *) Record;
|
StrCatS (Title, 0x60 / sizeof (CHAR16), L" ");
|
||||||
if (Type19Record->StartingAddress != 0xFFFFFFFF ) {
|
StrCatS (Title, 0x60 / sizeof (CHAR16), ProductName);
|
||||||
InstalledMemory += RShiftU64(Type19Record->EndingAddress -
|
|
||||||
Type19Record->StartingAddress + 1, 10);
|
|
||||||
} else {
|
|
||||||
InstalledMemory += RShiftU64(Type19Record->ExtendedEndingAddress -
|
|
||||||
Type19Record->ExtendedStartingAddress + 1, 20);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);
|
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_TITLE);
|
||||||
}
|
HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, Title, NULL);
|
||||||
|
|
||||||
//
|
VersionIdx = SmbiosTable.Type1->Version;
|
||||||
// Now update the total installed RAM size
|
GetOptionalStringByIndex ((CHAR8*)((UINT8*)SmbiosTable.Raw + SmbiosTable.Hdr->Length), VersionIdx, &ProductVersion);
|
||||||
//
|
|
||||||
ConvertMemorySizeToString ((UINT32)InstalledMemory, &NewString );
|
StrCatS (Model, 0x60 / sizeof (CHAR16), L"Model: ");
|
||||||
UiCustomizeFrontPageBanner (3, FALSE, &NewString);
|
StrCatS (Model, 0x60 / sizeof (CHAR16), ProductVersion);
|
||||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE), NewString, NULL);
|
|
||||||
FreePool (NewString);
|
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL);
|
||||||
|
HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, Model, NULL);
|
||||||
|
|
||||||
|
FreePool (Model);
|
||||||
|
FreePool (Title);
|
||||||
|
FreePool (ProductVersion);
|
||||||
|
FreePool (ProductName);
|
||||||
|
FreePool (Manufacturer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -892,6 +1404,8 @@ InitializeUserInterface (
|
|||||||
UINTN BootTextColumn;
|
UINTN BootTextColumn;
|
||||||
UINTN BootTextRow;
|
UINTN BootTextRow;
|
||||||
|
|
||||||
|
gSystemTable = SystemTable;
|
||||||
|
|
||||||
if (!mModeInitialized) {
|
if (!mModeInitialized) {
|
||||||
//
|
//
|
||||||
// After the console is ready, get current video resolution
|
// After the console is ready, get current video resolution
|
||||||
@@ -1017,11 +1531,6 @@ UiEntry (
|
|||||||
|
|
||||||
FreeFrontPage ();
|
FreeFrontPage ();
|
||||||
|
|
||||||
if (mLanguageString != NULL) {
|
|
||||||
FreePool (mLanguageString);
|
|
||||||
mLanguageString = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//Will leave browser, check any reset required change is applied? if yes, reset system
|
//Will leave browser, check any reset required change is applied? if yes, reset system
|
||||||
//
|
//
|
||||||
@@ -1034,10 +1543,6 @@ UiEntry (
|
|||||||
// user change any option setting which needs a reset to be effective, and the reset will be applied according to the user selection.
|
// user change any option setting which needs a reset to be effective, and the reset will be applied according to the user selection.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Record the info that a reset is required.
|
Record the info that a reset is required.
|
||||||
A module boolean variable is used to record whether a reset is required.
|
A module boolean variable is used to record whether a reset is required.
|
||||||
@@ -1052,10 +1557,6 @@ EnableResetRequired (
|
|||||||
mResetRequired = TRUE;
|
mResetRequired = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check if user changed any option setting which needs a system reset to be effective.
|
Check if user changed any option setting which needs a system reset to be effective.
|
||||||
|
|
||||||
@@ -1110,4 +1611,3 @@ SetupResetReminder (
|
|||||||
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
|
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,9 +32,11 @@ extern EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
|
|||||||
//
|
//
|
||||||
// These are defined as the same with vfr file
|
// These are defined as the same with vfr file
|
||||||
//
|
//
|
||||||
#define FRONT_PAGE_FORM_ID 0x1000
|
#define FRONT_PAGE_FORM_ID 0x7600
|
||||||
|
#define FIRMWARE_INFO_FORM_ID 0x7601
|
||||||
|
|
||||||
#define LABEL_FRANTPAGE_INFORMATION 0x1000
|
#define LABEL_FRONTPAGE_INFORMATION 0x1000
|
||||||
|
#define LABEL_DEVICES_LIST 0x2000
|
||||||
#define LABEL_END 0xffff
|
#define LABEL_END 0xffff
|
||||||
|
|
||||||
#define FRONT_PAGE_FORMSET_GUID \
|
#define FRONT_PAGE_FORMSET_GUID \
|
||||||
@@ -52,7 +54,6 @@ typedef struct {
|
|||||||
//
|
//
|
||||||
EFI_HII_HANDLE HiiHandle;
|
EFI_HII_HANDLE HiiHandle;
|
||||||
EFI_HANDLE DriverHandle;
|
EFI_HANDLE DriverHandle;
|
||||||
EFI_STRING_ID *LanguageToken;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Produced protocols
|
// Produced protocols
|
||||||
@@ -210,4 +211,3 @@ ExtractDevicePathFromHiiHandle (
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif // _FRONT_PAGE_H_
|
#endif // _FRONT_PAGE_H_
|
||||||
|
|
||||||
|
@@ -29,35 +29,15 @@ UiCustomizeFrontPage (
|
|||||||
IN VOID *StartOpCodeHandle
|
IN VOID *StartOpCodeHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Create "Select Language" menu with Oneof opcode.
|
|
||||||
//
|
|
||||||
UiCreateLanguageMenu (HiiHandle, StartOpCodeHandle);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Create empty line.
|
|
||||||
//
|
|
||||||
UiCreateEmptyLine(HiiHandle, StartOpCodeHandle);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Find third party drivers which need to be shown in the front page.
|
|
||||||
//
|
|
||||||
UiListThirdPartyDrivers (HiiHandle, &gEfiIfrFrontPageGuid, NULL, StartOpCodeHandle);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Create empty line.
|
|
||||||
//
|
|
||||||
UiCreateEmptyLine(HiiHandle, StartOpCodeHandle);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create "Continue" menu.
|
// Create "Continue" menu.
|
||||||
//
|
//
|
||||||
UiCreateContinueMenu(HiiHandle, StartOpCodeHandle);
|
UiCreateContinueMenu(HiiHandle, StartOpCodeHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create reset menu.
|
// Find third party drivers which need to be shown in the front page.
|
||||||
//
|
//
|
||||||
UiCreateResetMenu(HiiHandle, StartOpCodeHandle);
|
UiListThirdPartyDrivers (HiiHandle, &gEfiIfrFrontPageGuid, NULL, StartOpCodeHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,44 +76,3 @@ UiFrontPageCallbackHandler (
|
|||||||
|
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Update the banner string in the front page.
|
|
||||||
|
|
||||||
Current layout for the banner string like below:
|
|
||||||
PS: Totally only 5 lines of banner supported.
|
|
||||||
|
|
||||||
Line 1: Left BannerStr RightBannerStr
|
|
||||||
Line 2: Left BannerStr RightBannerStr
|
|
||||||
Line 3: Left BannerStr RightBannerStr
|
|
||||||
Line 4: Left BannerStr RightBannerStr
|
|
||||||
Line 5: Left BannerStr RightBannerStr
|
|
||||||
<EmptyLine>
|
|
||||||
First menu in front page.
|
|
||||||
...
|
|
||||||
|
|
||||||
@param LineIndex The line index of the banner need to check.
|
|
||||||
@param LeftOrRight The left or right banner need to check.
|
|
||||||
@param BannerStr Banner string need to update.
|
|
||||||
Input the current string and user can update
|
|
||||||
it and return the new string.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
UiCustomizeFrontPageBanner (
|
|
||||||
IN UINTN LineIndex,
|
|
||||||
IN BOOLEAN LeftOrRight,
|
|
||||||
IN OUT EFI_STRING *BannerStr
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if ((LineIndex == 5) && LeftOrRight) {
|
|
||||||
// Update STR_CUSTOMIZE_BANNER_LINE5_LEFT
|
|
||||||
if (PcdGetBool(PcdTestKeyUsed)) {
|
|
||||||
if (BannerStr != NULL) {
|
|
||||||
FreePool(*BannerStr);
|
|
||||||
}
|
|
||||||
*BannerStr = HiiGetString(gFrontPagePrivate.HiiHandle, STRING_TOKEN(STR_TEST_KEY_USED), NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
@@ -9,35 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#ifndef __FRONTPAGE_CUSTOMIZED_UI_H__
|
#ifndef __FRONTPAGE_CUSTOMIZED_UI_H__
|
||||||
#define __FRONTPAGE_CUSTOMIZED_UI_H__
|
#define __FRONTPAGE_CUSTOMIZED_UI_H__
|
||||||
|
|
||||||
/**
|
|
||||||
Update the banner string in the front page.
|
|
||||||
|
|
||||||
Current layout for the banner string like below:
|
|
||||||
PS: Totally only 5 lines of banner supported.
|
|
||||||
|
|
||||||
Line 1: Left BannerStr RightBannerStr
|
|
||||||
Line 2: Left BannerStr RightBannerStr
|
|
||||||
Line 3: Left BannerStr RightBannerStr
|
|
||||||
Line 4: Left BannerStr RightBannerStr
|
|
||||||
Line 5: Left BannerStr RightBannerStr
|
|
||||||
<EmptyLine>
|
|
||||||
First menu in front page.
|
|
||||||
...
|
|
||||||
|
|
||||||
@param LineIndex The line index of the banner need to check.
|
|
||||||
@param LeftOrRight The left or right banner need to check.
|
|
||||||
@param BannerStr Banner string need to update.
|
|
||||||
Input the current string and user can update
|
|
||||||
it and return the new string.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
UiCustomizeFrontPageBanner (
|
|
||||||
IN UINTN LineIndex,
|
|
||||||
IN BOOLEAN LeftOrRight,
|
|
||||||
IN OUT EFI_STRING *BannerStr
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Customize menus in the page.
|
Customize menus in the page.
|
||||||
|
|
||||||
|
@@ -35,8 +35,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#define UI_HII_DRIVER_LIST_SIZE 0x8
|
#define UI_HII_DRIVER_LIST_SIZE 0x8
|
||||||
|
|
||||||
#define FRONT_PAGE_KEY_CONTINUE 0x1000
|
#define FRONT_PAGE_KEY_CONTINUE 0x1000
|
||||||
#define FRONT_PAGE_KEY_RESET 0x1001
|
|
||||||
#define FRONT_PAGE_KEY_LANGUAGE 0x1002
|
|
||||||
#define FRONT_PAGE_KEY_DRIVER 0x2000
|
#define FRONT_PAGE_KEY_DRIVER 0x2000
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -47,112 +45,10 @@ typedef struct {
|
|||||||
BOOLEAN EmptyLineAfter;
|
BOOLEAN EmptyLineAfter;
|
||||||
} UI_HII_DRIVER_INSTANCE;
|
} UI_HII_DRIVER_INSTANCE;
|
||||||
|
|
||||||
CHAR8 *gLanguageString;
|
|
||||||
EFI_STRING_ID *gLanguageToken;
|
|
||||||
UI_HII_DRIVER_INSTANCE *gHiiDriverList;
|
UI_HII_DRIVER_INSTANCE *gHiiDriverList;
|
||||||
extern EFI_HII_HANDLE gStringPackHandle;
|
extern EFI_HII_HANDLE gStringPackHandle;
|
||||||
UINT8 gCurrentLanguageIndex;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Get next language from language code list (with separator ';').
|
|
||||||
|
|
||||||
If LangCode is NULL, then ASSERT.
|
|
||||||
If Lang is NULL, then ASSERT.
|
|
||||||
|
|
||||||
@param LangCode On input: point to first language in the list. On
|
|
||||||
output: point to next language in the list, or
|
|
||||||
NULL if no more language in the list.
|
|
||||||
@param Lang The first language in the list.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
GetNextLanguage (
|
|
||||||
IN OUT CHAR8 **LangCode,
|
|
||||||
OUT CHAR8 *Lang
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN Index;
|
|
||||||
CHAR8 *StringPtr;
|
|
||||||
|
|
||||||
ASSERT (LangCode != NULL);
|
|
||||||
ASSERT (*LangCode != NULL);
|
|
||||||
ASSERT (Lang != NULL);
|
|
||||||
|
|
||||||
Index = 0;
|
|
||||||
StringPtr = *LangCode;
|
|
||||||
while (StringPtr[Index] != 0 && StringPtr[Index] != ';') {
|
|
||||||
Index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
CopyMem (Lang, StringPtr, Index);
|
|
||||||
Lang[Index] = 0;
|
|
||||||
|
|
||||||
if (StringPtr[Index] == ';') {
|
|
||||||
Index++;
|
|
||||||
}
|
|
||||||
*LangCode = StringPtr + Index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function processes the language changes in configuration.
|
|
||||||
|
|
||||||
@param Value A pointer to the data being sent to the original exporting driver.
|
|
||||||
|
|
||||||
|
|
||||||
@retval TRUE The callback successfully handled the action.
|
|
||||||
@retval FALSE The callback not supported in this handler.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
LanguageChangeHandler (
|
|
||||||
IN EFI_IFR_TYPE_VALUE *Value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
CHAR8 *LangCode;
|
|
||||||
CHAR8 *Lang;
|
|
||||||
UINTN Index;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Allocate working buffer for RFC 4646 language in supported LanguageString.
|
|
||||||
//
|
|
||||||
Lang = AllocatePool (AsciiStrSize (gLanguageString));
|
|
||||||
ASSERT (Lang != NULL);
|
|
||||||
|
|
||||||
Index = 0;
|
|
||||||
LangCode = gLanguageString;
|
|
||||||
while (*LangCode != 0) {
|
|
||||||
GetNextLanguage (&LangCode, Lang);
|
|
||||||
|
|
||||||
if (Index == Value->u8) {
|
|
||||||
gCurrentLanguageIndex = Value->u8;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Index == Value->u8) {
|
|
||||||
Status = gRT->SetVariable (
|
|
||||||
L"PlatformLang",
|
|
||||||
&gEfiGlobalVariableGuid,
|
|
||||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
|
||||||
AsciiStrSize (Lang),
|
|
||||||
Lang
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
FreePool (Lang);
|
|
||||||
return EFI_DEVICE_ERROR;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ASSERT (FALSE);
|
|
||||||
}
|
|
||||||
FreePool (Lang);
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function processes the results of changes in configuration.
|
This function processes the results of changes in configuration.
|
||||||
|
|
||||||
@@ -181,19 +77,12 @@ UiSupportLibCallbackHandler (
|
|||||||
OUT EFI_STATUS *Status
|
OUT EFI_STATUS *Status
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (QuestionId != FRONT_PAGE_KEY_CONTINUE &&
|
if (QuestionId != FRONT_PAGE_KEY_CONTINUE) {
|
||||||
QuestionId != FRONT_PAGE_KEY_RESET &&
|
|
||||||
QuestionId != FRONT_PAGE_KEY_LANGUAGE) {
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
|
if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
|
||||||
if (QuestionId == FRONT_PAGE_KEY_LANGUAGE) {
|
|
||||||
Value->u8 = gCurrentLanguageIndex;
|
|
||||||
*Status = EFI_SUCCESS;
|
|
||||||
} else {
|
|
||||||
*Status = EFI_UNSUPPORTED;
|
*Status = EFI_UNSUPPORTED;
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,17 +109,6 @@ UiSupportLibCallbackHandler (
|
|||||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
|
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FRONT_PAGE_KEY_LANGUAGE:
|
|
||||||
*Status = LanguageChangeHandler(Value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FRONT_PAGE_KEY_RESET:
|
|
||||||
//
|
|
||||||
// Reset
|
|
||||||
//
|
|
||||||
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
|
|
||||||
*Status = EFI_UNSUPPORTED;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -239,156 +117,6 @@ UiSupportLibCallbackHandler (
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Create Select language menu in the front page with oneof opcode.
|
|
||||||
|
|
||||||
@param[in] HiiHandle The hii handle for the Uiapp driver.
|
|
||||||
@param[in] StartOpCodeHandle The opcode handle to save the new opcode.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
UiCreateLanguageMenu (
|
|
||||||
IN EFI_HII_HANDLE HiiHandle,
|
|
||||||
IN VOID *StartOpCodeHandle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
CHAR8 *LangCode;
|
|
||||||
CHAR8 *Lang;
|
|
||||||
UINTN LangSize;
|
|
||||||
CHAR8 *CurrentLang;
|
|
||||||
UINTN OptionCount;
|
|
||||||
CHAR16 *StringBuffer;
|
|
||||||
VOID *OptionsOpCodeHandle;
|
|
||||||
UINTN StringSize;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
EFI_HII_STRING_PROTOCOL *HiiString;
|
|
||||||
|
|
||||||
Lang = NULL;
|
|
||||||
StringBuffer = NULL;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Init OpCode Handle and Allocate space for creation of UpdateData Buffer
|
|
||||||
//
|
|
||||||
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
|
|
||||||
ASSERT (OptionsOpCodeHandle != NULL);
|
|
||||||
|
|
||||||
GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&CurrentLang, NULL);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Get Support language list from variable.
|
|
||||||
//
|
|
||||||
GetEfiGlobalVariable2 (L"PlatformLangCodes", (VOID**)&gLanguageString, NULL);
|
|
||||||
if (gLanguageString == NULL) {
|
|
||||||
gLanguageString = AllocateCopyPool (
|
|
||||||
AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)),
|
|
||||||
(CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)
|
|
||||||
);
|
|
||||||
ASSERT (gLanguageString != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gLanguageToken == NULL) {
|
|
||||||
//
|
|
||||||
// Count the language list number.
|
|
||||||
//
|
|
||||||
LangCode = gLanguageString;
|
|
||||||
Lang = AllocatePool (AsciiStrSize (gLanguageString));
|
|
||||||
ASSERT (Lang != NULL);
|
|
||||||
|
|
||||||
OptionCount = 0;
|
|
||||||
while (*LangCode != 0) {
|
|
||||||
GetNextLanguage (&LangCode, Lang);
|
|
||||||
OptionCount ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Allocate extra 1 as the end tag.
|
|
||||||
//
|
|
||||||
gLanguageToken = AllocateZeroPool ((OptionCount + 1) * sizeof (EFI_STRING_ID));
|
|
||||||
ASSERT (gLanguageToken != NULL);
|
|
||||||
|
|
||||||
Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &HiiString);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
LangCode = gLanguageString;
|
|
||||||
OptionCount = 0;
|
|
||||||
while (*LangCode != 0) {
|
|
||||||
GetNextLanguage (&LangCode, Lang);
|
|
||||||
|
|
||||||
StringSize = 0;
|
|
||||||
Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
|
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
|
||||||
StringBuffer = AllocateZeroPool (StringSize);
|
|
||||||
ASSERT (StringBuffer != NULL);
|
|
||||||
Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
LangSize = AsciiStrSize (Lang);
|
|
||||||
StringBuffer = AllocatePool (LangSize * sizeof (CHAR16));
|
|
||||||
ASSERT (StringBuffer != NULL);
|
|
||||||
AsciiStrToUnicodeStrS (Lang, StringBuffer, LangSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT (StringBuffer != NULL);
|
|
||||||
gLanguageToken[OptionCount] = HiiSetString (HiiHandle, 0, StringBuffer, NULL);
|
|
||||||
FreePool (StringBuffer);
|
|
||||||
|
|
||||||
OptionCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT (gLanguageToken != NULL);
|
|
||||||
LangCode = gLanguageString;
|
|
||||||
OptionCount = 0;
|
|
||||||
if (Lang == NULL) {
|
|
||||||
Lang = AllocatePool (AsciiStrSize (gLanguageString));
|
|
||||||
ASSERT (Lang != NULL);
|
|
||||||
}
|
|
||||||
while (*LangCode != 0) {
|
|
||||||
GetNextLanguage (&LangCode, Lang);
|
|
||||||
|
|
||||||
if (CurrentLang != NULL && AsciiStrCmp (Lang, CurrentLang) == 0) {
|
|
||||||
HiiCreateOneOfOptionOpCode (
|
|
||||||
OptionsOpCodeHandle,
|
|
||||||
gLanguageToken[OptionCount],
|
|
||||||
EFI_IFR_OPTION_DEFAULT,
|
|
||||||
EFI_IFR_NUMERIC_SIZE_1,
|
|
||||||
(UINT8) OptionCount
|
|
||||||
);
|
|
||||||
gCurrentLanguageIndex = (UINT8) OptionCount;
|
|
||||||
} else {
|
|
||||||
HiiCreateOneOfOptionOpCode (
|
|
||||||
OptionsOpCodeHandle,
|
|
||||||
gLanguageToken[OptionCount],
|
|
||||||
0,
|
|
||||||
EFI_IFR_NUMERIC_SIZE_1,
|
|
||||||
(UINT8) OptionCount
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
OptionCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CurrentLang != NULL) {
|
|
||||||
FreePool (CurrentLang);
|
|
||||||
}
|
|
||||||
FreePool (Lang);
|
|
||||||
|
|
||||||
HiiCreateOneOfOpCode (
|
|
||||||
StartOpCodeHandle,
|
|
||||||
FRONT_PAGE_KEY_LANGUAGE,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
STRING_TOKEN (STR_LANGUAGE_SELECT),
|
|
||||||
STRING_TOKEN (STR_LANGUAGE_SELECT_HELP),
|
|
||||||
EFI_IFR_FLAG_CALLBACK,
|
|
||||||
EFI_IFR_NUMERIC_SIZE_1,
|
|
||||||
OptionsOpCodeHandle,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create continue menu in the front page.
|
Create continue menu in the front page.
|
||||||
|
|
||||||
@@ -405,8 +133,8 @@ UiCreateContinueMenu (
|
|||||||
HiiCreateActionOpCode (
|
HiiCreateActionOpCode (
|
||||||
StartOpCodeHandle,
|
StartOpCodeHandle,
|
||||||
FRONT_PAGE_KEY_CONTINUE,
|
FRONT_PAGE_KEY_CONTINUE,
|
||||||
STRING_TOKEN (STR_CONTINUE_PROMPT),
|
STRING_TOKEN (STR_BOOT_DEFAULT_PROMPT),
|
||||||
STRING_TOKEN (STR_CONTINUE_PROMPT),
|
STRING_TOKEN (STR_BOOT_DEFAULT_HELP),
|
||||||
EFI_IFR_FLAG_CALLBACK,
|
EFI_IFR_FLAG_CALLBACK,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
@@ -425,30 +153,7 @@ UiCreateEmptyLine (
|
|||||||
IN VOID *StartOpCodeHandle
|
IN VOID *StartOpCodeHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_NULL_STRING), 0, 0, 0);
|
HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_EMPTY_STRING), 0, 0, 0);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Create Reset menu in the front page.
|
|
||||||
|
|
||||||
@param[in] HiiHandle The hii handle for the Uiapp driver.
|
|
||||||
@param[in] StartOpCodeHandle The opcode handle to save the new opcode.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
UiCreateResetMenu (
|
|
||||||
IN EFI_HII_HANDLE HiiHandle,
|
|
||||||
IN VOID *StartOpCodeHandle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
HiiCreateActionOpCode (
|
|
||||||
StartOpCodeHandle,
|
|
||||||
FRONT_PAGE_KEY_RESET,
|
|
||||||
STRING_TOKEN (STR_RESET_STRING),
|
|
||||||
STRING_TOKEN (STR_RESET_STRING),
|
|
||||||
EFI_IFR_FLAG_CALLBACK,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -35,32 +35,6 @@ UiCreateEmptyLine (
|
|||||||
IN VOID *StartOpCodeHandle
|
IN VOID *StartOpCodeHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
Create Select language menu in the front page with oneof opcode.
|
|
||||||
|
|
||||||
@param[in] HiiHandle The hii handle for the Uiapp driver.
|
|
||||||
@param[in] StartOpCodeHandle The opcode handle to save the new opcode.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
UiCreateLanguageMenu (
|
|
||||||
IN EFI_HII_HANDLE HiiHandle,
|
|
||||||
IN VOID *StartOpCodeHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Create Reset menu.
|
|
||||||
|
|
||||||
@param[in] HiiHandle The hii handle for the Uiapp driver.
|
|
||||||
@param[in] StartOpCodeHandle The opcode handle to save the new opcode.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
UiCreateResetMenu (
|
|
||||||
IN EFI_HII_HANDLE HiiHandle,
|
|
||||||
IN VOID *StartOpCodeHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Rename the driver name if necessary.
|
Rename the driver name if necessary.
|
||||||
|
|
||||||
|
@@ -10,59 +10,19 @@
|
|||||||
/=#
|
/=#
|
||||||
|
|
||||||
#langdef en-US "English"
|
#langdef en-US "English"
|
||||||
#langdef fr-FR "Français"
|
|
||||||
#langdef en "Standard English"
|
|
||||||
#langdef fr "Standard Français"
|
|
||||||
|
|
||||||
#string STR_FRONT_PAGE_TITLE #language en-US "Front Page"
|
#string STR_FRONT_PAGE_TITLE #language en-US "Front Page"
|
||||||
#language fr-FR "Front Page"
|
#string STR_FRONT_PAGE_COMPUTER_MODEL #language en-US "<model>"
|
||||||
#string STR_FRONT_PAGE_COMPUTER_MODEL #language en-US ""
|
#string STR_FRONT_PAGE_BIOS_VERSION #language en-US "<bios>"
|
||||||
#language fr-FR ""
|
#string STR_FIRMWARE_INFO #language en-US "Firmware Configuration Information"
|
||||||
#string STR_FRONT_PAGE_CPU_MODEL #language en-US ""
|
#string STR_BOOT_DEFAULT_PROMPT #language en-US "Boot Default"
|
||||||
#language fr-FR ""
|
#string STR_BOOT_DEFAULT_HELP #language en-US "Boot the default entry"
|
||||||
#string STR_FRONT_PAGE_CPU_SPEED #language en-US ""
|
|
||||||
#language fr-FR ""
|
|
||||||
#string STR_FRONT_PAGE_MEMORY_SIZE #language en-US ""
|
|
||||||
#language fr-FR ""
|
|
||||||
#string STR_FRONT_PAGE_BIOS_VERSION #language en-US ""
|
|
||||||
#language fr-FR ""
|
|
||||||
#string STR_FRONT_PAGE_BANNER_0_LEFT #language en-US "Wonder Computer Model 1000Z Manufactured by Intel®"
|
|
||||||
#language fr-FR "Demander le Modèle d'Ordinateur 1000Z A Fabriqué par Intel®"
|
|
||||||
#string STR_FRONT_PAGE_BANNER_0_RIGHT #language en-US "OK"
|
|
||||||
#language fr-FR "Bon"
|
|
||||||
#string STR_FRONT_PAGE_BANNER_1_LEFT #language en-US "2 Pentium® X Xeon processors running at 800Thz"
|
|
||||||
#language fr-FR "2 processeurs Pentium® X Xeon tournants à 800Thz"
|
|
||||||
#string STR_FRONT_PAGE_BANNER_1_RIGHT #language en-US "24 TB System RAM"
|
|
||||||
#language fr-FR "24 TB RAM de Système"
|
|
||||||
#string STR_FRONT_PAGE_BANNER_2_LEFT #language en-US "ACME® EFI BIOS Version 13.5 Release 1039.92"
|
|
||||||
#language fr-FR "ACME® EFI BIOS Version 13.5 Release 1039.92"
|
|
||||||
#string STR_FRONT_PAGE_BANNER_3_LEFT #language en-US "Serial Number: 1Z123456789MARMAR (Need SMBIOS entries)"
|
|
||||||
#language fr-FR "Numéro de série: 1Z123456789MARMAR (Les entrées de SMBIOS de besoin)"
|
|
||||||
#string STR_CONTINUE_PROMPT #language en-US "Continue"
|
|
||||||
#language fr-FR "Continuer"
|
|
||||||
#string STR_CONTINUE_HELP #language en-US "This selection will direct the system to continue to booting process"
|
|
||||||
#language fr-FR "Cette sélection dirigera le système pour continuer au processus d'amorçage"
|
|
||||||
#string STR_LANGUAGE_SELECT #language en-US "Select Language"
|
|
||||||
#language fr-FR "Choisir la Langue"
|
|
||||||
#string STR_LANGUAGE_SELECT_HELP #language en-US "This is the option one adjusts to change the language for the current system"
|
|
||||||
#language fr-FR "Ceci est l'option qu'on ajuste pour changer la langue pour le système actuel"
|
|
||||||
#string STR_MISSING_STRING #language en-US "Missing String"
|
#string STR_MISSING_STRING #language en-US "Missing String"
|
||||||
#language fr-FR "Missing String"
|
#string STR_NO_BOOTABLE_MEDIA #language en-US ""
|
||||||
|
#string STR_WEBCAM_STATUS #language en-US ""
|
||||||
#string STR_EMPTY_STRING #language en-US ""
|
#string STR_EMPTY_STRING #language en-US ""
|
||||||
#language fr-FR ""
|
#string STR_VIRTUALIZATION #language en-US ""
|
||||||
#string STR_RESET_STRING #language en-US "Reset"
|
#string STR_VIRTUALIZATION_STATUS #language en-US ""
|
||||||
#language fr-FR "Reset"
|
#string STR_IOMMU_STATUS #language en-US ""
|
||||||
#string STR_RESET_STRING_HELP #language en-US "Reset the current setting."
|
#string STR_TPM_STATUS #language en-US ""
|
||||||
#language fr-FR "Reset the current setting."
|
#string STR_ME_STATUS #language en-US ""
|
||||||
#string STR_CUSTOMIZE_BANNER_LINE4_LEFT #language en-US ""
|
|
||||||
#language fr-FR ""
|
|
||||||
#string STR_CUSTOMIZE_BANNER_LINE4_RIGHT #language en-US ""
|
|
||||||
#language fr-FR ""
|
|
||||||
#string STR_CUSTOMIZE_BANNER_LINE5_LEFT #language en-US ""
|
|
||||||
#language fr-FR ""
|
|
||||||
#string STR_CUSTOMIZE_BANNER_LINE5_RIGHT #language en-US ""
|
|
||||||
#language fr-FR ""
|
|
||||||
#string STR_TEST_KEY_USED #language en-US "WARNING: Test key detected."
|
|
||||||
#language fr-FR "WARNING: Test key detected."
|
|
||||||
#string STR_NULL_STRING #language en-US " "
|
|
||||||
#language fr-FR " "
|
|
||||||
|
@@ -9,72 +9,61 @@
|
|||||||
|
|
||||||
#define FORMSET_GUID { 0x9e0c30bc, 0x3f06, 0x4ba6, 0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe }
|
#define FORMSET_GUID { 0x9e0c30bc, 0x3f06, 0x4ba6, 0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe }
|
||||||
|
|
||||||
#define FRONT_PAGE_FORM_ID 0x1000
|
#define FRONT_PAGE_FORM_ID 0x7600
|
||||||
|
#define FIRMWARE_INFO_FORM_ID 0x7601
|
||||||
|
|
||||||
#define LABEL_FRANTPAGE_INFORMATION 0x1000
|
#define LABEL_FRONTPAGE_INFORMATION 0x1000
|
||||||
|
#define LABEL_DEVICES_LIST 0x2000
|
||||||
#define LABEL_END 0xffff
|
#define LABEL_END 0xffff
|
||||||
|
|
||||||
formset
|
formset
|
||||||
guid = FORMSET_GUID,
|
guid = FORMSET_GUID,
|
||||||
title = STRING_TOKEN(STR_FRONT_PAGE_TITLE),
|
title = STRING_TOKEN(STR_FRONT_PAGE_TITLE),
|
||||||
help = STRING_TOKEN(STR_EMPTY_STRING ),
|
help = STRING_TOKEN(STR_EMPTY_STRING),
|
||||||
classguid = FORMSET_GUID,
|
classguid = FORMSET_GUID,
|
||||||
|
|
||||||
form formid = FRONT_PAGE_FORM_ID,
|
form formid = FRONT_PAGE_FORM_ID,
|
||||||
title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
|
title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
|
||||||
|
|
||||||
banner
|
subtitle text = STRING_TOKEN(STR_FRONT_PAGE_COMPUTER_MODEL);
|
||||||
title = STRING_TOKEN(STR_FRONT_PAGE_COMPUTER_MODEL),
|
subtitle text = STRING_TOKEN(STR_FRONT_PAGE_BIOS_VERSION);
|
||||||
line 1,
|
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
|
||||||
align left;
|
|
||||||
|
|
||||||
banner
|
label LABEL_FRONTPAGE_INFORMATION;
|
||||||
title = STRING_TOKEN(STR_FRONT_PAGE_CPU_MODEL),
|
|
||||||
line 2,
|
|
||||||
align left;
|
|
||||||
|
|
||||||
banner
|
|
||||||
title = STRING_TOKEN(STR_FRONT_PAGE_CPU_SPEED),
|
|
||||||
line 2,
|
|
||||||
align right;
|
|
||||||
|
|
||||||
banner
|
|
||||||
title = STRING_TOKEN(STR_FRONT_PAGE_BIOS_VERSION),
|
|
||||||
line 3,
|
|
||||||
align left;
|
|
||||||
|
|
||||||
banner
|
|
||||||
title = STRING_TOKEN(STR_FRONT_PAGE_MEMORY_SIZE),
|
|
||||||
line 3,
|
|
||||||
align right;
|
|
||||||
|
|
||||||
banner
|
|
||||||
title = STRING_TOKEN(STR_CUSTOMIZE_BANNER_LINE4_LEFT),
|
|
||||||
line 4,
|
|
||||||
align left;
|
|
||||||
|
|
||||||
banner
|
|
||||||
title = STRING_TOKEN(STR_CUSTOMIZE_BANNER_LINE4_RIGHT),
|
|
||||||
line 4,
|
|
||||||
align right;
|
|
||||||
|
|
||||||
banner
|
|
||||||
title = STRING_TOKEN(STR_CUSTOMIZE_BANNER_LINE5_LEFT),
|
|
||||||
line 5,
|
|
||||||
align left;
|
|
||||||
|
|
||||||
banner
|
|
||||||
title = STRING_TOKEN(STR_CUSTOMIZE_BANNER_LINE5_RIGHT),
|
|
||||||
line 5,
|
|
||||||
align right;
|
|
||||||
|
|
||||||
label LABEL_FRANTPAGE_INFORMATION;
|
|
||||||
//
|
//
|
||||||
// This is where we will dynamically add a Action type op-code to show
|
// This is where we will dynamically add a Action type op-code to show
|
||||||
// the platform information.
|
// the platform information.
|
||||||
//
|
//
|
||||||
label LABEL_END;
|
label LABEL_END;
|
||||||
|
|
||||||
|
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
|
||||||
|
|
||||||
|
label LABEL_DEVICES_LIST;
|
||||||
|
label LABEL_END;
|
||||||
|
|
||||||
|
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
|
||||||
|
|
||||||
|
goto FIRMWARE_INFO_FORM_ID,
|
||||||
|
prompt = STRING_TOKEN(STR_FIRMWARE_INFO),
|
||||||
|
help = STRING_TOKEN(STR_EMPTY_STRING);
|
||||||
|
|
||||||
|
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
|
||||||
|
subtitle text = STRING_TOKEN(STR_NO_BOOTABLE_MEDIA);
|
||||||
|
subtitle text = STRING_TOKEN(STR_WEBCAM_STATUS);
|
||||||
|
|
||||||
|
endform;
|
||||||
|
|
||||||
|
form formid = FIRMWARE_INFO_FORM_ID,
|
||||||
|
title = STRING_TOKEN(STR_FIRMWARE_INFO);
|
||||||
|
|
||||||
|
subtitle text = STRING_TOKEN(STR_VIRTUALIZATION);
|
||||||
|
subtitle text = STRING_TOKEN(STR_VIRTUALIZATION_STATUS);
|
||||||
|
subtitle text = STRING_TOKEN(STR_IOMMU_STATUS);
|
||||||
|
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
|
||||||
|
subtitle text = STRING_TOKEN(STR_TPM_STATUS);
|
||||||
|
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
|
||||||
|
subtitle text = STRING_TOKEN(STR_ME_STATUS);
|
||||||
|
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
|
||||||
endform;
|
endform;
|
||||||
|
|
||||||
endformset;
|
endformset;
|
||||||
|
@@ -56,8 +56,11 @@
|
|||||||
UefiBootManagerLib
|
UefiBootManagerLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
|
gEfiAcpiTableGuid ## CONSUMES ## GUID
|
||||||
gEfiIfrTianoGuid ## CONSUMES ## GUID (Extended IFR Guid Opcode)
|
gEfiIfrTianoGuid ## CONSUMES ## GUID (Extended IFR Guid Opcode)
|
||||||
gEfiIfrFrontPageGuid ## CONSUMES ## GUID
|
gEfiIfrFrontPageGuid ## CONSUMES ## GUID
|
||||||
|
gEfiSmbiosTableGuid ## CONSUMES ## GUID
|
||||||
|
gEfiHiiPlatformSetupFormsetGuid ## CONSUMES ## GUID
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiSmbiosProtocolGuid ## CONSUMES
|
gEfiSmbiosProtocolGuid ## CONSUMES
|
||||||
|
@@ -1709,13 +1709,7 @@ InitKeyboard (
|
|||||||
//
|
//
|
||||||
// wait for BAT completion code
|
// wait for BAT completion code
|
||||||
//
|
//
|
||||||
mWaitForValueTimeOut = KEYBOARD_BAT_TIMEOUT;
|
KeyboardWaitForValue (ConsoleIn, KEYBOARD_8048_RETURN_8042_BAT_SUCCESS);
|
||||||
|
|
||||||
Status = KeyboardWaitForValue (ConsoleIn, KEYBOARD_8048_RETURN_8042_BAT_SUCCESS);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
KeyboardError (ConsoleIn, L"Keyboard self test failed!\n\r");
|
|
||||||
goto Done;
|
|
||||||
}
|
|
||||||
|
|
||||||
mWaitForValueTimeOut = KEYBOARD_WAITFORVALUE_TIMEOUT;
|
mWaitForValueTimeOut = KEYBOARD_WAITFORVALUE_TIMEOUT;
|
||||||
|
|
||||||
|
@@ -521,16 +521,35 @@ EmmcTuningClkForHs200 (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(BhtHostPciSupport(PciIo)) {
|
||||||
|
//set data transfer with 4bit
|
||||||
|
Status = SdMmcHcSetBusWidth (PciIo, Slot, 4);
|
||||||
|
//enable hardware tuning
|
||||||
|
HostCtrl2 = (UINT8)(~0x10);
|
||||||
|
Status = SdMmcHcAndMmio (PciIo, Slot, 0x110,sizeof (HostCtrl2), &HostCtrl2);
|
||||||
|
|
||||||
|
Status = EmmcSendTuningBlk (PassThru, Slot, 4);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((DEBUG_ERROR, "EmmcTuningClkForHs200: Send tuning block fails with %r\n", Status));
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ask the device to send a sequence of tuning blocks till the tuning procedure is done.
|
// Ask the device to send a sequence of tuning blocks till the tuning procedure is done.
|
||||||
//
|
//
|
||||||
Retry = 0;
|
Retry = 0;
|
||||||
do {
|
do {
|
||||||
|
if(!BhtHostPciSupport(PciIo)) {
|
||||||
Status = EmmcSendTuningBlk (PassThru, Slot, BusWidth);
|
Status = EmmcSendTuningBlk (PassThru, Slot, BusWidth);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((DEBUG_ERROR, "EmmcTuningClkForHs200: Send tuning block fails with %r\n", Status));
|
DEBUG ((DEBUG_ERROR, "EmmcTuningClkForHs200: Send tuning block fails with %r\n", Status));
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
gBS->Stall(5000);
|
||||||
|
}
|
||||||
|
|
||||||
Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, TRUE, sizeof (HostCtrl2), &HostCtrl2);
|
Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, TRUE, sizeof (HostCtrl2), &HostCtrl2);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@@ -542,6 +561,10 @@ EmmcTuningClkForHs200 (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((HostCtrl2 & (BIT6 | BIT7)) == BIT7) {
|
if ((HostCtrl2 & (BIT6 | BIT7)) == BIT7) {
|
||||||
|
if(BhtHostPciSupport(PciIo)) {
|
||||||
|
//set data transfer with default
|
||||||
|
Status = SdMmcHcSetBusWidth (PciIo, Slot, BusWidth);
|
||||||
|
}
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
} while (++Retry < 40);
|
} while (++Retry < 40);
|
||||||
@@ -874,10 +897,54 @@ EmmcSwitchToHS200 (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BhtHostPciSupport(PciIo)){
|
||||||
|
BusMode->BusTiming = SdMmcMmcHs200;
|
||||||
|
Status = EmmcSwitchBusTiming (PciIo, PassThru, Slot, Rca, BusMode->DriverStrength,
|
||||||
|
BusMode->BusTiming, BusMode->ClockFreq);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = SdMmcHcWaitMmioSet (
|
||||||
|
PciIo,
|
||||||
|
Slot,
|
||||||
|
0x1cc,
|
||||||
|
sizeof (Rca),
|
||||||
|
BIT14,
|
||||||
|
BIT14,
|
||||||
|
SD_MMC_HC_GENERIC_TIMEOUT
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Wait 2nd Card Detect debounce Finished by wait twice of debounce max time
|
||||||
|
UINT32 value32;
|
||||||
|
while (1) {
|
||||||
|
Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_PRESENT_STATE, TRUE, sizeof(value32), &value32);
|
||||||
|
if (((value32 >> 18) & 0x01) == ((value32 >> 16) & 0x01)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = SdMmcHcWaitMmioSet (
|
||||||
|
PciIo,
|
||||||
|
Slot,
|
||||||
|
0x1cc,
|
||||||
|
sizeof (Rca),
|
||||||
|
BIT11,
|
||||||
|
BIT11,
|
||||||
|
SD_MMC_CLOCK_STABLE_TIMEOUT
|
||||||
|
);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Status = EmmcSwitchBusTiming (PciIo, PassThru, Slot, Rca, BusMode->DriverStrength, BusMode->BusTiming, BusMode->ClockFreq);
|
Status = EmmcSwitchBusTiming (PciIo, PassThru, Slot, Rca, BusMode->DriverStrength, BusMode->BusTiming, BusMode->ClockFreq);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Status = EmmcTuningClkForHs200 (PciIo, PassThru, Slot, BusMode->BusWidth);
|
Status = EmmcTuningClkForHs200 (PciIo, PassThru, Slot, BusMode->BusWidth);
|
||||||
|
|
||||||
@@ -1263,10 +1330,89 @@ EmmcSetBusMode (
|
|||||||
DEBUG ((DEBUG_INFO, "EmmcSetBusMode: Target bus mode: timing = %d, width = %d, clock freq = %d, driver strength = %d\n",
|
DEBUG ((DEBUG_INFO, "EmmcSetBusMode: Target bus mode: timing = %d, width = %d, clock freq = %d, driver strength = %d\n",
|
||||||
BusMode.BusTiming, BusMode.BusWidth, BusMode.ClockFreq, BusMode.DriverStrength.Emmc));
|
BusMode.BusTiming, BusMode.BusWidth, BusMode.ClockFreq, BusMode.DriverStrength.Emmc));
|
||||||
|
|
||||||
|
if (BhtHostPciSupport(PciIo)) {
|
||||||
|
UINT8 EmmcVar;
|
||||||
|
UINTN EmmcVarSize;
|
||||||
|
Status = gRT->GetVariable (
|
||||||
|
L"EMMC_FORCE_CARD_MODE",
|
||||||
|
&gEfiGenericVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&EmmcVarSize,
|
||||||
|
&EmmcVar
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR(Status) && EmmcVar <= 2) {
|
||||||
|
if (EmmcVar == 2) {
|
||||||
|
BusMode.BusTiming = SdMmcMmcHs200;
|
||||||
|
BusMode.ClockFreq = 200;
|
||||||
|
} else if (EmmcVar == 1) {
|
||||||
|
BusMode.BusTiming = SdMmcMmcHs200;
|
||||||
|
BusMode.ClockFreq = 100;
|
||||||
|
} else {
|
||||||
|
BusMode.BusTiming = SdMmcMmcHsSdr;
|
||||||
|
BusMode.ClockFreq = 52;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
BusMode.BusTiming = SdMmcMmcHsSdr;
|
||||||
|
BusMode.ClockFreq = 52;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (BusMode.BusTiming == SdMmcMmcHs400) {
|
if (BusMode.BusTiming == SdMmcMmcHs400) {
|
||||||
|
//
|
||||||
|
// Execute HS400 timing switch procedure
|
||||||
|
//
|
||||||
Status = EmmcSwitchToHS400 (PciIo, PassThru, Slot, Rca, &BusMode);
|
Status = EmmcSwitchToHS400 (PciIo, PassThru, Slot, Rca, &BusMode);
|
||||||
} else if (BusMode.BusTiming == SdMmcMmcHs200) {
|
} else if (BusMode.BusTiming == SdMmcMmcHs200) {
|
||||||
|
//
|
||||||
|
// Execute HS200 timing switch procedure
|
||||||
|
//
|
||||||
Status = EmmcSwitchToHS200 (PciIo, PassThru, Slot, Rca, &BusMode);
|
Status = EmmcSwitchToHS200 (PciIo, PassThru, Slot, Rca, &BusMode);
|
||||||
|
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
if (BhtHostPciSupport(PciIo)) {
|
||||||
|
UINT32 val32;
|
||||||
|
UINT16 EmmcVar;
|
||||||
|
UINTN EmmcVarSize;
|
||||||
|
#if !defined(HS100_ALLPASS_PHASE) || HS100_ALLPASS_PHASE > 10 || HS100_ALLPASS_PHASE < 0
|
||||||
|
#error "HS100_ALLPASS_PHASE is undefined or value is invalid"
|
||||||
|
#else
|
||||||
|
val32 = PciBhtRead32(PciIo, 0x300);
|
||||||
|
val32 &= 0xFF0FFFFF;
|
||||||
|
EmmcVarSize = sizeof(EmmcVar);
|
||||||
|
Status = gRT->GetVariable (
|
||||||
|
L"EMMC_HS100_ALLPASS_PHASE",
|
||||||
|
&gEfiGenericVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&EmmcVarSize,
|
||||||
|
&EmmcVar
|
||||||
|
);
|
||||||
|
if (EFI_ERROR(Status) || EmmcVar > 10)
|
||||||
|
EmmcVar = HS100_ALLPASS_PHASE;
|
||||||
|
val32 |= (EmmcVar << 20);
|
||||||
|
PciBhtWrite32(PciIo, 0x300, 0x21000033 | val32);
|
||||||
|
#endif
|
||||||
|
BusMode.ClockFreq = 100;
|
||||||
|
|
||||||
|
SdMmcHcRwMmio (PciIo, Slot, 0x3C, TRUE, sizeof(val32), &val32);
|
||||||
|
val32 &= ~BIT22;
|
||||||
|
SdMmcHcRwMmio (PciIo, Slot, 0x3C, FALSE, sizeof(val32), &val32);
|
||||||
|
val32 = (BIT26 | BIT25);
|
||||||
|
SdMmcHcOrMmio (PciIo, Slot, 0x2C, sizeof(val32), &val32);
|
||||||
|
|
||||||
|
Status = EmmcSwitchToHS200 (PciIo, PassThru, Slot, Rca, &BusMode);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
if (((ExtCsd.DeviceType & BIT1) != 0) && (Private->Capability[Slot].HighSpeed != 0)) {
|
||||||
|
BusMode.BusTiming = SdMmcMmcHsSdr;
|
||||||
|
BusMode.ClockFreq = 52;
|
||||||
|
Status = EmmcSwitchToHighSpeed (PciIo, PassThru, Slot, Rca, &BusMode);
|
||||||
|
} else if (((ExtCsd.DeviceType & BIT0) != 0) && (Private->Capability[Slot].HighSpeed != 0)) {
|
||||||
|
BusMode.BusTiming = SdMmcMmcHsSdr;
|
||||||
|
BusMode.ClockFreq = 26;
|
||||||
|
Status = EmmcSwitchToHighSpeed (PciIo, PassThru, Slot, Rca, &BusMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Note that EmmcSwitchToHighSpeed is also called for SdMmcMmcLegacy
|
// Note that EmmcSwitchToHighSpeed is also called for SdMmcMmcLegacy
|
||||||
|
@@ -305,6 +305,13 @@ SdMmcPciHcEnumerateDevice (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BhtHostPciSupport(Private->PciIo)) {
|
||||||
|
Status = SdMmcHcGetCapability (Private->PciIo, Slot, &Private->Capability[Slot]);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Private->Slot[Slot].MediaPresent = TRUE;
|
Private->Slot[Slot].MediaPresent = TRUE;
|
||||||
Private->Slot[Slot].Initialized = TRUE;
|
Private->Slot[Slot].Initialized = TRUE;
|
||||||
RoutineNum = sizeof (mCardTypeDetectRoutineTable) / sizeof (CARD_TYPE_DETECT_ROUTINE);
|
RoutineNum = sizeof (mCardTypeDetectRoutineTable) / sizeof (CARD_TYPE_DETECT_ROUTINE);
|
||||||
@@ -321,6 +328,7 @@ SdMmcPciHcEnumerateDevice (
|
|||||||
// This card doesn't get initialized correctly.
|
// This card doesn't get initialized correctly.
|
||||||
//
|
//
|
||||||
if (Index == RoutineNum) {
|
if (Index == RoutineNum) {
|
||||||
|
DEBUG ((DEBUG_INFO, "Load driver failure\n"));
|
||||||
Private->Slot[Slot].Initialized = FALSE;
|
Private->Slot[Slot].Initialized = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,6 +549,8 @@ SdMmcPciHcDriverBindingStart (
|
|||||||
UINT32 RoutineNum;
|
UINT32 RoutineNum;
|
||||||
BOOLEAN MediaPresent;
|
BOOLEAN MediaPresent;
|
||||||
BOOLEAN Support64BitDma;
|
BOOLEAN Support64BitDma;
|
||||||
|
UINT16 IntStatus;
|
||||||
|
UINT32 value;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "SdMmcPciHcDriverBindingStart: Start\n"));
|
DEBUG ((DEBUG_INFO, "SdMmcPciHcDriverBindingStart: Start\n"));
|
||||||
|
|
||||||
@@ -735,6 +745,13 @@ SdMmcPciHcDriverBindingStart (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BhtHostPciSupport(PciIo)) {
|
||||||
|
Status = SdMmcHcGetCapability (PciIo, Slot, &Private->Capability[Slot]);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Private->Slot[Slot].MediaPresent = TRUE;
|
Private->Slot[Slot].MediaPresent = TRUE;
|
||||||
Private->Slot[Slot].Initialized = TRUE;
|
Private->Slot[Slot].Initialized = TRUE;
|
||||||
RoutineNum = sizeof (mCardTypeDetectRoutineTable) / sizeof (CARD_TYPE_DETECT_ROUTINE);
|
RoutineNum = sizeof (mCardTypeDetectRoutineTable) / sizeof (CARD_TYPE_DETECT_ROUTINE);
|
||||||
@@ -751,9 +768,25 @@ SdMmcPciHcDriverBindingStart (
|
|||||||
// This card doesn't get initialized correctly.
|
// This card doesn't get initialized correctly.
|
||||||
//
|
//
|
||||||
if (Index == RoutineNum) {
|
if (Index == RoutineNum) {
|
||||||
|
DEBUG ((DEBUG_INFO, "Load driver failure\n"));
|
||||||
Private->Slot[Slot].Initialized = FALSE;
|
Private->Slot[Slot].Initialized = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (BhtHostPciSupport(Private->PciIo)) {
|
||||||
|
SdMmcHcRwMmio (Private->PciIo,0,0x110,TRUE,sizeof (value),&value);
|
||||||
|
SdMmcHcRwMmio (Private->PciIo,0,0x114,TRUE,sizeof (value),&value);
|
||||||
|
SdMmcHcRwMmio (Private->PciIo,0,0x1a8,TRUE,sizeof (value),&value);
|
||||||
|
SdMmcHcRwMmio (Private->PciIo,0,0x1ac,TRUE,sizeof (value),&value);
|
||||||
|
SdMmcHcRwMmio (Private->PciIo,0,0x1B0,TRUE,sizeof (value),&value);
|
||||||
|
SdMmcHcRwMmio (Private->PciIo,0,0x1CC,TRUE,sizeof (value),&value);
|
||||||
|
SdMmcHcRwMmio (Private->PciIo,0,0x040,TRUE,sizeof (value),&value);
|
||||||
|
SdMmcHcRwMmio (Private->PciIo,0,SD_MMC_HC_PRESENT_STATE,TRUE,sizeof (value),&value);
|
||||||
|
SdMmcHcRwMmio (Private->PciIo,0,SD_MMC_HC_HOST_CTRL1,TRUE,sizeof (IntStatus),&IntStatus);
|
||||||
|
SdMmcHcRwMmio (Private->PciIo,0,SD_MMC_HC_CLOCK_CTRL,TRUE,sizeof (IntStatus),&IntStatus);
|
||||||
|
SdMmcHcRwMmio (Private->PciIo,0,SD_MMC_HC_TIMEOUT_CTRL,TRUE,sizeof (IntStatus),&IntStatus);
|
||||||
|
SdMmcHcRwMmio (Private->PciIo,0,SD_MMC_HC_NOR_INT_STS,TRUE,sizeof (value),&value);
|
||||||
|
SdMmcHcRwMmio (Private->PciIo,0,SD_MMC_HC_HOST_CTRL2,TRUE,sizeof (IntStatus),&IntStatus);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Enable 64-bit DMA support in the PCI layer if this controller
|
// Enable 64-bit DMA support in the PCI layer if this controller
|
||||||
|
@@ -20,6 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Library/UefiDriverEntryPoint.h>
|
#include <Library/UefiDriverEntryPoint.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
@@ -33,6 +34,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Protocol/SdMmcOverride.h>
|
#include <Protocol/SdMmcOverride.h>
|
||||||
#include <Protocol/SdMmcPassThru.h>
|
#include <Protocol/SdMmcPassThru.h>
|
||||||
|
|
||||||
|
#include <Guid/DebugMask.h>
|
||||||
|
|
||||||
#include "SdMmcPciHci.h"
|
#include "SdMmcPciHci.h"
|
||||||
|
|
||||||
extern EFI_COMPONENT_NAME_PROTOCOL gSdMmcPciHcComponentName;
|
extern EFI_COMPONENT_NAME_PROTOCOL gSdMmcPciHcComponentName;
|
||||||
@@ -46,10 +49,16 @@ extern EDKII_SD_MMC_OVERRIDE *mOverride;
|
|||||||
#define SD_MMC_HC_PRIVATE_FROM_THIS(a) \
|
#define SD_MMC_HC_PRIVATE_FROM_THIS(a) \
|
||||||
CR(a, SD_MMC_HC_PRIVATE_DATA, PassThru, SD_MMC_HC_PRIVATE_SIGNATURE)
|
CR(a, SD_MMC_HC_PRIVATE_DATA, PassThru, SD_MMC_HC_PRIVATE_SIGNATURE)
|
||||||
|
|
||||||
|
#define HOST_CLK_DRIVE_STRENGTH 2
|
||||||
|
#define HOST_DAT_DRIVE_STRENGTH 2
|
||||||
|
#define HS200_ALLPASS_PHASE 0
|
||||||
|
#define HS100_ALLPASS_PHASE 6
|
||||||
|
|
||||||
//
|
//
|
||||||
// Generic time out value, 1 microsecond as unit.
|
// Generic time out value, 1 microsecond as unit.
|
||||||
//
|
//
|
||||||
#define SD_MMC_HC_GENERIC_TIMEOUT 1 * 1000 * 1000
|
#define SD_MMC_HC_GENERIC_TIMEOUT 1 * 1000 * 100
|
||||||
|
#define SD_MMC_CLOCK_STABLE_TIMEOUT 3 * 1000
|
||||||
|
|
||||||
//
|
//
|
||||||
// SD/MMC async transfer timer interval, set by experience.
|
// SD/MMC async transfer timer interval, set by experience.
|
||||||
|
@@ -14,12 +14,12 @@
|
|||||||
##
|
##
|
||||||
|
|
||||||
[Defines]
|
[Defines]
|
||||||
INF_VERSION = 0x00010005
|
INF_VERSION = 0x00010007
|
||||||
BASE_NAME = SdMmcPciHcDxe
|
BASE_NAME = SdMmcPciHcDxe
|
||||||
MODULE_UNI_FILE = SdMmcPciHcDxe.uni
|
MODULE_UNI_FILE = SdMmcPciHcDxe.uni
|
||||||
FILE_GUID = 8E325979-3FE1-4927-AAE2-8F5C4BD2AF0D
|
FILE_GUID = 8E325979-3FE1-4927-AAE2-8F5C4BD2AF0D
|
||||||
MODULE_TYPE = UEFI_DRIVER
|
MODULE_TYPE = UEFI_DRIVER
|
||||||
VERSION_STRING = 1.0
|
VERSION_STRING = 1.5.4
|
||||||
ENTRY_POINT = InitializeSdMmcPciHcDxe
|
ENTRY_POINT = InitializeSdMmcPciHcDxe
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -63,6 +63,9 @@
|
|||||||
gEfiPciIoProtocolGuid ## TO_START
|
gEfiPciIoProtocolGuid ## TO_START
|
||||||
gEfiSdMmcPassThruProtocolGuid ## BY_START
|
gEfiSdMmcPassThruProtocolGuid ## BY_START
|
||||||
|
|
||||||
|
[Guids]
|
||||||
|
gEfiGenericVariableGuid
|
||||||
|
|
||||||
# [Event]
|
# [Event]
|
||||||
# EVENT_TYPE_PERIODIC_TIMER ## SOMETIMES_CONSUMES
|
# EVENT_TYPE_PERIODIC_TIMER ## SOMETIMES_CONSUMES
|
||||||
|
|
||||||
|
@@ -14,6 +14,9 @@
|
|||||||
|
|
||||||
#include "SdMmcPciHcDxe.h"
|
#include "SdMmcPciHcDxe.h"
|
||||||
|
|
||||||
|
int g_deviceId = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Dump the content of SD/MMC host controller's Capability Register.
|
Dump the content of SD/MMC host controller's Capability Register.
|
||||||
|
|
||||||
@@ -1145,6 +1148,15 @@ SdMmcHcInitPowerVoltage (
|
|||||||
// Set SD Bus Voltage Select and SD Bus Power fields in Power Control Register
|
// Set SD Bus Voltage Select and SD Bus Power fields in Power Control Register
|
||||||
//
|
//
|
||||||
Status = SdMmcHcPowerControl (PciIo, Slot, MaxVoltage);
|
Status = SdMmcHcPowerControl (PciIo, Slot, MaxVoltage);
|
||||||
|
if (BhtHostPciSupport(PciIo)){
|
||||||
|
// 1.8V signaling enable
|
||||||
|
HostCtrl2 = BIT3;
|
||||||
|
Status = SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
|
||||||
|
gBS->Stall (5000);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@@ -1196,6 +1208,7 @@ SdMmcHcInitHost (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||||
SD_MMC_HC_SLOT_CAP Capability;
|
SD_MMC_HC_SLOT_CAP Capability;
|
||||||
|
UINT32 value32;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Notify the SD/MMC override protocol that we are about to initialize
|
// Notify the SD/MMC override protocol that we are about to initialize
|
||||||
@@ -1218,10 +1231,192 @@ SdMmcHcInitHost (
|
|||||||
PciIo = Private->PciIo;
|
PciIo = Private->PciIo;
|
||||||
Capability = Private->Capability[Slot];
|
Capability = Private->Capability[Slot];
|
||||||
|
|
||||||
|
if (BhtHostPciSupport(PciIo)){
|
||||||
|
UINT8 CardMode;
|
||||||
|
UINT16 EmmcVar;
|
||||||
|
UINTN EmmcVarSize;
|
||||||
|
UINT64 Cap;
|
||||||
|
|
||||||
|
//unlock PCR write protect
|
||||||
|
#ifdef DISABLE_L1_2
|
||||||
|
PciBhtAnd32(PciIo, 0xd0, ~(BIT31));
|
||||||
|
PciBhtAnd32(PciIo, 0x90, ~(BIT1 | BIT0));
|
||||||
|
|
||||||
|
value32 = PciBhtRead32(PciIo, 0xe0);
|
||||||
|
value32 &= ~(BIT31 | BIT30 | BIT29 | BIT28);
|
||||||
|
value32 |= (BIT29 | BIT28);
|
||||||
|
PciBhtWrite32(PciIo, 0xe0, value32);
|
||||||
|
|
||||||
|
value32 = PciBhtRead32(PciIo, 0xfc);
|
||||||
|
value32 &= ~(BIT19 | BIT18 | BIT17 | BIT16);
|
||||||
|
value32 |= (BIT19);
|
||||||
|
PciBhtWrite32(PciIo, 0xfc, value32);
|
||||||
|
|
||||||
|
value32 = PciBhtRead32(PciIo, 0x3f4);
|
||||||
|
value32 &= ~(BIT3 | BIT2 | BIT1 | BIT0);
|
||||||
|
value32 |= (BIT3 | BIT1);
|
||||||
|
PciBhtWrite32(PciIo, 0x3f4, value32);
|
||||||
|
|
||||||
|
value32 = PciBhtRead32(PciIo, 0x248);
|
||||||
|
value32 &= ~(BIT3 | BIT2 | BIT1 | BIT0);
|
||||||
|
value32 |= (BIT3 | BIT1);
|
||||||
|
PciBhtWrite32(PciIo, 0x248, value32);
|
||||||
|
|
||||||
|
value32 = PciBhtRead32(PciIo, 0x90);
|
||||||
|
value32 &= ~(BIT1 | BIT0);
|
||||||
|
value32 |= (BIT1);
|
||||||
|
PciBhtWrite32(PciIo, 0x90, value32);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* FET on */
|
||||||
|
PciBhtOr32(PciIo, 0xEC, 0x3);
|
||||||
|
/* Led on */
|
||||||
|
//PciBhtAnd32(PciIo, 0x334, (UINT32)~BIT13);
|
||||||
|
PciBhtOr32(PciIo, 0xD4, BIT6);
|
||||||
|
/* Set 1.8v emmc signaling flag */
|
||||||
|
PciBhtOr32(PciIo, 0x308, BIT4);
|
||||||
|
/* Set 200MBaseClock */
|
||||||
|
value32 = PciBhtRead32(PciIo, 0x304);
|
||||||
|
value32 &= 0x0000FFFF;
|
||||||
|
value32 |= 0x25100000;
|
||||||
|
#if !defined(HOST_CLK_DRIVE_STRENGTH) || HOST_CLK_DRIVE_STRENGTH > 7 || HOST_CLK_DRIVE_STRENGTH < 0
|
||||||
|
#error "HOST_CMD_DRIVE_STRENGTH is undefined or value is invalid"
|
||||||
|
#else
|
||||||
|
EmmcVarSize = sizeof(EmmcVar);
|
||||||
|
Status = gRT->GetVariable (
|
||||||
|
L"EMMC_CLK_DRIVER_STRENGTH",
|
||||||
|
&gEfiGenericVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&EmmcVarSize,
|
||||||
|
&EmmcVar
|
||||||
|
);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
EmmcVar = HOST_CLK_DRIVE_STRENGTH;
|
||||||
|
}
|
||||||
|
value32 &= 0xFFFFFF8F;
|
||||||
|
value32 |= ((EmmcVar & 0x7) << 4);
|
||||||
|
#endif
|
||||||
|
#if !defined(HOST_DAT_DRIVE_STRENGTH) || HOST_DAT_DRIVE_STRENGTH > 7 || HOST_DAT_DRIVE_STRENGTH < 0
|
||||||
|
#error "HOST_DATA_DRIVE_STRENGTH is undefined or value is invalid"
|
||||||
|
#else
|
||||||
|
EmmcVarSize = sizeof(EmmcVar);
|
||||||
|
Status = gRT->GetVariable (
|
||||||
|
L"EMMC_DATA_DRIVER_STRENGTH",
|
||||||
|
&gEfiGenericVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&EmmcVarSize,
|
||||||
|
&EmmcVar
|
||||||
|
);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
EmmcVar = HOST_DAT_DRIVE_STRENGTH;
|
||||||
|
}
|
||||||
|
value32 &= 0xFFFFFFF1;
|
||||||
|
value32 |= ((EmmcVar & 0x7) << 1);
|
||||||
|
#endif
|
||||||
|
PciBhtWrite32(PciIo, 0x304, value32);
|
||||||
|
PciBhtOr32(PciIo, 0x3E4, BIT22);
|
||||||
|
|
||||||
|
EmmcVarSize = sizeof(CardMode);
|
||||||
|
Status = gRT->GetVariable (
|
||||||
|
L"EMMC_FORCE_CARD_MODE",
|
||||||
|
&gEfiGenericVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&EmmcVarSize,
|
||||||
|
&CardMode
|
||||||
|
);
|
||||||
|
if (EFI_ERROR(Status) || CardMode > 2) {
|
||||||
|
CardMode = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CardMode == 1) {
|
||||||
|
#if !defined(HS100_ALLPASS_PHASE) || HS100_ALLPASS_PHASE > 10 || HS100_ALLPASS_PHASE < 0
|
||||||
|
#error "HS200_ALLPASS_PHASE is undefined or value is invalid"
|
||||||
|
#else
|
||||||
|
EmmcVarSize = sizeof(EmmcVar);
|
||||||
|
Status = gRT->GetVariable (
|
||||||
|
L"EMMC_HS100_ALLPASS_PHASE",
|
||||||
|
&gEfiGenericVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&EmmcVarSize,
|
||||||
|
&EmmcVar
|
||||||
|
);
|
||||||
|
if (EFI_ERROR(Status) || EmmcVar > 10) {
|
||||||
|
EmmcVar = HS100_ALLPASS_PHASE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
} else if (CardMode == 2) {
|
||||||
|
#if !defined(HS200_ALLPASS_PHASE) || HS200_ALLPASS_PHASE > 10 || HS200_ALLPASS_PHASE < 0
|
||||||
|
#error "HS200_ALLPASS_PHASE is undefined or value is invalid"
|
||||||
|
#else
|
||||||
|
EmmcVarSize = sizeof(EmmcVar);
|
||||||
|
Status = gRT->GetVariable (
|
||||||
|
L"EMMC_HS200_ALLPASS_PHASE",
|
||||||
|
&gEfiGenericVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&EmmcVarSize,
|
||||||
|
&EmmcVar
|
||||||
|
);
|
||||||
|
if (EFI_ERROR(Status) || EmmcVar > 10) {
|
||||||
|
EmmcVar = HS200_ALLPASS_PHASE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
value32 = 0x21000033 | (EmmcVar << 20);
|
||||||
|
PciBhtWrite32(PciIo, 0x300, value32);
|
||||||
|
|
||||||
|
//enable internal clk
|
||||||
|
value32 = BIT0;
|
||||||
|
Status = SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_CLOCK_CTRL,sizeof(value32), &value32);
|
||||||
|
|
||||||
|
//reset pll start
|
||||||
|
Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, TRUE, sizeof(value32), &value32);
|
||||||
|
value32 |= BIT12;
|
||||||
|
Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, FALSE, sizeof(value32), &value32);
|
||||||
|
gBS->Stall(1);
|
||||||
|
|
||||||
|
//reset pll end
|
||||||
|
Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, TRUE,sizeof(value32), &value32);
|
||||||
|
value32 &= ~BIT12;
|
||||||
|
value32 |= BIT18;
|
||||||
|
Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, FALSE, sizeof(value32), &value32);
|
||||||
|
|
||||||
|
//wait BaseClk stable 0x1CC bit14
|
||||||
|
Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, TRUE, sizeof(value32), &value32);
|
||||||
|
while(!(value32&BIT14)){
|
||||||
|
gBS->Stall(100);
|
||||||
|
Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, TRUE, sizeof(value32), &value32);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value32 & BIT18) {
|
||||||
|
//Wait 2nd Card Detect debounce Finished by wait twice of debounce max time
|
||||||
|
while (1) {
|
||||||
|
Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_PRESENT_STATE, TRUE, sizeof(value32), &value32);
|
||||||
|
if (((value32 >> 16) & 0x01) == ((value32 >> 18) & 0x01))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//force pll active end
|
||||||
|
Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, TRUE, sizeof(value32), &value32);
|
||||||
|
value32 &= ~BIT18;
|
||||||
|
Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, FALSE, sizeof(value32), &value32);
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_CAP, TRUE, sizeof (Cap), &Cap);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
CopyMem (&Capability, &Cap, sizeof (Cap));
|
||||||
|
|
||||||
|
Status = SdMmcHcInitPowerVoltage (PciIo, Slot, Capability);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Status = SdMmcHcInitV4Enhancements (PciIo, Slot, Capability, Private->ControllerVersion[Slot]);
|
Status = SdMmcHcInitV4Enhancements (PciIo, Slot, Capability, Private->ControllerVersion[Slot]);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Perform first time clock setup with 400 KHz frequency.
|
// Perform first time clock setup with 400 KHz frequency.
|
||||||
@@ -1235,10 +1430,12 @@ SdMmcHcInitHost (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!BhtHostPciSupport(PciIo)){
|
||||||
Status = SdMmcHcInitPowerVoltage (PciIo, Slot, Capability);
|
Status = SdMmcHcInitPowerVoltage (PciIo, Slot, Capability);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Status = SdMmcHcInitTimeoutCtrl (PciIo, Slot);
|
Status = SdMmcHcInitTimeoutCtrl (PciIo, Slot);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@@ -2836,3 +3033,279 @@ SdMmcWaitTrbResult (
|
|||||||
return EFI_TIMEOUT;
|
return EFI_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOLEAN BhtHostPciSupport(EFI_PCI_IO_PROTOCOL *PciIo)
|
||||||
|
{
|
||||||
|
PCI_TYPE00 Pci;
|
||||||
|
|
||||||
|
PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32,
|
||||||
|
0, sizeof Pci / sizeof (UINT32), &Pci);
|
||||||
|
|
||||||
|
DEBUG ((DEBUG_INFO, "check device %04x:%04x\n", Pci.Hdr.VendorId, Pci.Hdr.DeviceId));
|
||||||
|
|
||||||
|
if (Pci.Hdr.VendorId != 0x1217)
|
||||||
|
goto end;
|
||||||
|
|
||||||
|
switch (Pci.Hdr.DeviceId)
|
||||||
|
{
|
||||||
|
case 0x8420: //PCI_DEV_ID_SDS0
|
||||||
|
case 0x8421: //PCI_DEV_ID_SDS1
|
||||||
|
case 0x8520: //PCI_DEV_ID_FJ2
|
||||||
|
case 0x8620: //PCI_DEV_ID_SB0
|
||||||
|
case 0x8621: //PCI_DEV_ID_SB1
|
||||||
|
g_deviceId = Pci.Hdr.DeviceId;
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DbgNull(IN CONST CHAR16 * fmt, ...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT32 bht_readl(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset)
|
||||||
|
{
|
||||||
|
UINT32 arg;
|
||||||
|
PciIo->Mem.Read(PciIo,EfiPciIoWidthUint32,1,offset,1,&arg);
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bht_writel(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value)
|
||||||
|
{
|
||||||
|
PciIo->Mem.Write(PciIo,EfiPciIoWidthUint32,1,offset,1,&value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UINT32 PciBhtRead32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset)
|
||||||
|
{
|
||||||
|
UINT32 i = 0;
|
||||||
|
UINT32 tmp[3] = {0};
|
||||||
|
|
||||||
|
if((g_deviceId == PCI_DEV_ID_SDS0) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_SDS1) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_FJ2) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_SB0) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_SB1))
|
||||||
|
{
|
||||||
|
// For Sandstorm, HW implement a mapping method by memory space reg to access PCI reg.
|
||||||
|
// Enable mapping
|
||||||
|
|
||||||
|
// Check function conflict
|
||||||
|
if((g_deviceId == PCI_DEV_ID_SDS0) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_FJ2) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_SB0) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_SB1))
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingEn, 0x40000000);
|
||||||
|
while((bht_readl(PciIo, BHT_PCIRMappingEn) & 0x40000000) == 0)
|
||||||
|
{
|
||||||
|
if(i == 5)
|
||||||
|
{
|
||||||
|
goto RD_DIS_MAPPING;
|
||||||
|
}
|
||||||
|
gBS->Stall(1000);
|
||||||
|
i++;
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingEn, 0x40000000);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(g_deviceId == PCI_DEV_ID_SDS1)
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingEn, 0x20000000);
|
||||||
|
while((bht_readl(PciIo, BHT_PCIRMappingEn) & 0x20000000) == 0)
|
||||||
|
{
|
||||||
|
if(i == 5)
|
||||||
|
{
|
||||||
|
//DbgErr((DRIVERNAME " - %s() function 1 can't lock!\n", __FUNCTION__));
|
||||||
|
goto RD_DIS_MAPPING;
|
||||||
|
}
|
||||||
|
gBS->Stall(1000);
|
||||||
|
i++;
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingEn, 0x20000000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check last operation is complete
|
||||||
|
i = 0;
|
||||||
|
while(bht_readl(PciIo, BHT_PCIRMappingCtl) & 0xc0000000)
|
||||||
|
{
|
||||||
|
if(i == 5)
|
||||||
|
{
|
||||||
|
//DbgErr((DRIVERNAME " - [204] = 0x%x\n", RegisterRead32(ELN_dPCIRMappingCtl)));
|
||||||
|
//DbgErr((DRIVERNAME " - [208] = 0x%x\n", RegisterRead32(ELN_dPCIRMappingEn)));
|
||||||
|
//DbgErr((DRIVERNAME " - %s() check last operation complete timeout!!!\n", __FUNCTION__));
|
||||||
|
goto RD_DIS_MAPPING;
|
||||||
|
}
|
||||||
|
gBS->Stall(1000);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set register address
|
||||||
|
tmp[0] |= 0x40000000;
|
||||||
|
tmp[0] |= offset;
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingCtl, tmp[0]);
|
||||||
|
|
||||||
|
// Check read is complete
|
||||||
|
i = 0;
|
||||||
|
while(bht_readl(PciIo, BHT_PCIRMappingCtl) & 0x40000000)
|
||||||
|
{
|
||||||
|
if(i == 5)
|
||||||
|
{
|
||||||
|
//DbgErr((DRIVERNAME " - %s() check read operation complete timeout!!!\n", __FUNCTION__));
|
||||||
|
goto RD_DIS_MAPPING;
|
||||||
|
}
|
||||||
|
gBS->Stall(1000);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get PCIR value
|
||||||
|
tmp[1] = bht_readl(PciIo, BHT_PCIRMappingVal);
|
||||||
|
|
||||||
|
RD_DIS_MAPPING:
|
||||||
|
// Disable mapping
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingEn, 0x80000000);
|
||||||
|
|
||||||
|
//DbgDebug(L"%s offset=%x Value:%x\n", __FUNCTION__, offset, tmp[1]);
|
||||||
|
return tmp[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
//DbgDebug(L"%s offset=%x Value:%x\n", __FUNCTION__, offset, tmp[0]);
|
||||||
|
return tmp[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
void PciBhtWrite32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value)
|
||||||
|
{
|
||||||
|
UINT32 tmp = 0;
|
||||||
|
UINT32 i = 0;
|
||||||
|
|
||||||
|
if((g_deviceId == PCI_DEV_ID_SDS0) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_SDS1) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_FJ2) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_SB0) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_SB1))
|
||||||
|
{
|
||||||
|
// For Sandstorm, HW implement a mapping method by memory space reg to access PCI reg.
|
||||||
|
// Upper caller doesn't need to set 0xD0.
|
||||||
|
|
||||||
|
// Enable mapping
|
||||||
|
|
||||||
|
// Check function conflict
|
||||||
|
if((g_deviceId == PCI_DEV_ID_SDS0) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_FJ2) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_SB0) ||
|
||||||
|
(g_deviceId == PCI_DEV_ID_SB1))
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingEn, 0x40000000);
|
||||||
|
while((bht_readl(PciIo, BHT_PCIRMappingEn) & 0x40000000) == 0)
|
||||||
|
{
|
||||||
|
if(i == 5)
|
||||||
|
{
|
||||||
|
//DbgErr((DRIVERNAME " - %s() function 0 can't lock!\n", __FUNCTION__));
|
||||||
|
goto WR_DIS_MAPPING;
|
||||||
|
}
|
||||||
|
|
||||||
|
gBS->Stall(1000);
|
||||||
|
i++;
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingEn, 0x40000000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(g_deviceId == PCI_DEV_ID_SDS1)
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingEn, 0x20000000);
|
||||||
|
|
||||||
|
while((bht_readl(PciIo, BHT_PCIRMappingEn) & 0x20000000) == 0)
|
||||||
|
{
|
||||||
|
if(i == 5)
|
||||||
|
{
|
||||||
|
//DbgErr((DRIVERNAME " - %s() function 0 can't lock!\n", __FUNCTION__));
|
||||||
|
goto WR_DIS_MAPPING;
|
||||||
|
}
|
||||||
|
|
||||||
|
gBS->Stall(1000);
|
||||||
|
i++;
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingEn, 0x20000000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable MEM access
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingVal, 0x80000000);
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingCtl, 0x800000D0);
|
||||||
|
|
||||||
|
// Check last operation is complete
|
||||||
|
i = 0;
|
||||||
|
while(bht_readl(PciIo, BHT_PCIRMappingCtl) & 0xc0000000)
|
||||||
|
{
|
||||||
|
if(i == 5)
|
||||||
|
{
|
||||||
|
//DbgErr((DRIVERNAME " - %s() check last operation complete timeout!!!\n", __FUNCTION__));
|
||||||
|
goto WR_DIS_MAPPING;
|
||||||
|
}
|
||||||
|
gBS->Stall(1000);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set write value
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingVal, value);
|
||||||
|
// Set register address
|
||||||
|
tmp |= 0x80000000;
|
||||||
|
tmp |= offset;
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingCtl, tmp);
|
||||||
|
|
||||||
|
// Check write is complete
|
||||||
|
i = 0;
|
||||||
|
while(bht_readl(PciIo, BHT_PCIRMappingCtl) & 0x80000000)
|
||||||
|
{
|
||||||
|
if(i == 5)
|
||||||
|
{
|
||||||
|
//DbgErr((DRIVERNAME " - %s() check write operation complete timeout!!!\n", __FUNCTION__));
|
||||||
|
goto WR_DIS_MAPPING;
|
||||||
|
}
|
||||||
|
gBS->Stall(1000);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
WR_DIS_MAPPING:
|
||||||
|
// Disable MEM access
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingVal, 0x80000001);
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingCtl, 0x800000D0);
|
||||||
|
|
||||||
|
// Check last operation is complete
|
||||||
|
i = 0;
|
||||||
|
while(bht_readl(PciIo, BHT_PCIRMappingCtl) & 0xc0000000)
|
||||||
|
{
|
||||||
|
if(i == 5)
|
||||||
|
{
|
||||||
|
//DbgErr((DRIVERNAME " - %s() check last operation complete timeout!!!\n", __FUNCTION__));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
gBS->Stall(1000);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable function conflict
|
||||||
|
|
||||||
|
// Disable mapping
|
||||||
|
bht_writel(PciIo, BHT_PCIRMappingEn, 0x80000000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PciBhtOr32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value)
|
||||||
|
{
|
||||||
|
UINT32 arg;
|
||||||
|
arg = PciBhtRead32(PciIo, offset);
|
||||||
|
PciBhtWrite32(PciIo, offset, value | arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PciBhtAnd32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value)
|
||||||
|
{
|
||||||
|
UINT32 arg;
|
||||||
|
arg = PciBhtRead32(PciIo, offset);
|
||||||
|
PciBhtWrite32(PciIo, offset, value & arg);
|
||||||
|
}
|
||||||
|
@@ -607,4 +607,33 @@ SdMmcSetDriverStrength (
|
|||||||
IN SD_DRIVER_STRENGTH_TYPE DriverStrength
|
IN SD_DRIVER_STRENGTH_TYPE DriverStrength
|
||||||
);
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
BhtHostPciSupport(EFI_PCI_IO_PROTOCOL *PciIo);
|
||||||
|
UINT32
|
||||||
|
PciBhtRead32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset);
|
||||||
|
void
|
||||||
|
PciBhtWrite32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value);
|
||||||
|
void
|
||||||
|
PciBhtOr32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value);
|
||||||
|
void
|
||||||
|
PciBhtAnd32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value);
|
||||||
|
extern void
|
||||||
|
DbgNull(IN CONST CHAR16 * fmt, ...);
|
||||||
|
|
||||||
|
|
||||||
|
#define PCI_DEV_ID_RJ 0x8320
|
||||||
|
#define PCI_DEV_ID_SDS0 0x8420
|
||||||
|
#define PCI_DEV_ID_SDS1 0x8421
|
||||||
|
#define PCI_DEV_ID_FJ2 0x8520
|
||||||
|
#define PCI_DEV_ID_SB0 0x8620
|
||||||
|
#define PCI_DEV_ID_SB1 0x8621
|
||||||
|
|
||||||
|
|
||||||
|
// O2/BHT add BAR1 for PCIR mapping registers
|
||||||
|
// These registers is defined by O2/BHT, but we may follow name definition rule.
|
||||||
|
#define BHT_PCIRMappingVal (0x200) /* PCI CFG Space Register Mapping Value Register */
|
||||||
|
#define BHT_PCIRMappingCtl (0x204) /* PCI CFG Space Register Mapping Control Register */
|
||||||
|
#define BHT_PCIRMappingEn (0x208) /* PCI CFG Space Register Mapping Enable Register */
|
||||||
|
#define BHT_GPIOCTL (0x210) /* GPIO control register*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -285,7 +285,7 @@ UsbHcBulkTransfer (
|
|||||||
IN UINT8 DevSpeed,
|
IN UINT8 DevSpeed,
|
||||||
IN UINTN MaxPacket,
|
IN UINTN MaxPacket,
|
||||||
IN UINT8 BufferNum,
|
IN UINT8 BufferNum,
|
||||||
IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
|
IN OUT VOID *Data[],
|
||||||
IN OUT UINTN *DataLength,
|
IN OUT UINTN *DataLength,
|
||||||
IN OUT UINT8 *DataToggle,
|
IN OUT UINT8 *DataToggle,
|
||||||
IN UINTN TimeOut,
|
IN UINTN TimeOut,
|
||||||
|
@@ -149,7 +149,7 @@ UsbHcBulkTransfer (
|
|||||||
IN UINT8 DevSpeed,
|
IN UINT8 DevSpeed,
|
||||||
IN UINTN MaxPacket,
|
IN UINTN MaxPacket,
|
||||||
IN UINT8 BufferNum,
|
IN UINT8 BufferNum,
|
||||||
IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
|
IN OUT VOID *Data[],
|
||||||
IN OUT UINTN *DataLength,
|
IN OUT UINTN *DataLength,
|
||||||
IN OUT UINT8 *DataToggle,
|
IN OUT UINT8 *DataToggle,
|
||||||
IN UINTN TimeOut,
|
IN UINTN TimeOut,
|
||||||
|
@@ -801,10 +801,7 @@ InitUSBKeyboard (
|
|||||||
IN OUT USB_KB_DEV *UsbKeyboardDevice
|
IN OUT USB_KB_DEV *UsbKeyboardDevice
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT16 ConfigValue;
|
|
||||||
UINT8 Protocol;
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 TransferResult;
|
|
||||||
|
|
||||||
REPORT_STATUS_CODE_WITH_DEVICE_PATH (
|
REPORT_STATUS_CODE_WITH_DEVICE_PATH (
|
||||||
EFI_PROGRESS_CODE,
|
EFI_PROGRESS_CODE,
|
||||||
@@ -817,27 +814,17 @@ InitUSBKeyboard (
|
|||||||
InitQueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, sizeof (EFI_KEY_DATA));
|
InitQueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, sizeof (EFI_KEY_DATA));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Use the config out of the descriptor
|
// Set boot protocol for the USB Keyboard.
|
||||||
// Assumed the first config is the correct one and this is not always the case
|
// This driver only supports boot protocol.
|
||||||
//
|
//
|
||||||
Status = UsbGetConfiguration (
|
Status = UsbSetProtocolRequest (
|
||||||
UsbKeyboardDevice->UsbIo,
|
UsbKeyboardDevice->UsbIo,
|
||||||
&ConfigValue,
|
UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
|
||||||
&TransferResult
|
BOOT_PROTOCOL
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
ConfigValue = 0x01;
|
|
||||||
//
|
|
||||||
// Uses default configuration to configure the USB Keyboard device.
|
|
||||||
//
|
|
||||||
Status = UsbSetConfiguration (
|
|
||||||
UsbKeyboardDevice->UsbIo,
|
|
||||||
ConfigValue,
|
|
||||||
&TransferResult
|
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
//
|
//
|
||||||
// If configuration could not be set here, it means
|
// If protocol could not be set here, it means
|
||||||
// the keyboard interface has some errors and could
|
// the keyboard interface has some errors and could
|
||||||
// not be initialized
|
// not be initialized
|
||||||
//
|
//
|
||||||
@@ -849,24 +836,6 @@ InitUSBKeyboard (
|
|||||||
|
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
UsbGetProtocolRequest (
|
|
||||||
UsbKeyboardDevice->UsbIo,
|
|
||||||
UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
|
|
||||||
&Protocol
|
|
||||||
);
|
|
||||||
//
|
|
||||||
// Set boot protocol for the USB Keyboard.
|
|
||||||
// This driver only supports boot protocol.
|
|
||||||
//
|
|
||||||
if (Protocol != BOOT_PROTOCOL) {
|
|
||||||
UsbSetProtocolRequest (
|
|
||||||
UsbKeyboardDevice->UsbIo,
|
|
||||||
UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
|
|
||||||
BOOT_PROTOCOL
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
UsbKeyboardDevice->CtrlOn = FALSE;
|
UsbKeyboardDevice->CtrlOn = FALSE;
|
||||||
UsbKeyboardDevice->AltOn = FALSE;
|
UsbKeyboardDevice->AltOn = FALSE;
|
||||||
|
@@ -70,6 +70,10 @@ CoreRemoveInterfaceFromProtocol (
|
|||||||
for(Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) {
|
for(Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) {
|
||||||
ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
|
ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
|
||||||
|
|
||||||
|
// Signal notify events before removing the protocol too.
|
||||||
|
// XXX: What effect does this have on other code?
|
||||||
|
CoreSignalEvent (ProtNotify->Event);
|
||||||
|
|
||||||
if (ProtNotify->Position == &Prot->ByProtocol) {
|
if (ProtNotify->Position == &Prot->ByProtocol) {
|
||||||
ProtNotify->Position = Prot->ByProtocol.BackLink;
|
ProtNotify->Position = Prot->ByProtocol.BackLink;
|
||||||
}
|
}
|
||||||
|
@@ -61,4 +61,14 @@ BootLogoUpdateProgress (
|
|||||||
IN UINTN PreviousValue
|
IN UINTN PreviousValue
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Install Boot Logo into BGRT table
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
AddBGRT (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -213,7 +213,7 @@ TranslateBmpToGopBlt (
|
|||||||
|
|
||||||
if ((BmpHeader->Size != BmpImageSize) ||
|
if ((BmpHeader->Size != BmpImageSize) ||
|
||||||
(BmpHeader->Size < BmpHeader->ImageOffset) ||
|
(BmpHeader->Size < BmpHeader->ImageOffset) ||
|
||||||
(BmpHeader->Size - BmpHeader->ImageOffset != DataSize)) {
|
(BmpHeader->Size - BmpHeader->ImageOffset < DataSize)) {
|
||||||
|
|
||||||
DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n"));
|
DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n"));
|
||||||
DEBUG ((DEBUG_ERROR, " BmpHeader->Size: 0x%x\n", BmpHeader->Size));
|
DEBUG ((DEBUG_ERROR, " BmpHeader->Size: 0x%x\n", BmpHeader->Size));
|
||||||
|
283
MdeModulePkg/Library/BootLogoLib/Bgrt.c
Normal file
283
MdeModulePkg/Library/BootLogoLib/Bgrt.c
Normal file
@@ -0,0 +1,283 @@
|
|||||||
|
#include <IndustryStandard/Acpi.h>
|
||||||
|
#include <IndustryStandard/Bmp.h>
|
||||||
|
#include <Library/BaseLib.h>
|
||||||
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
#include <Library/BootLogoLib.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
#include <Protocol/FirmwareVolume2.h>
|
||||||
|
#include <Protocol/SimpleFileSystem.h>
|
||||||
|
|
||||||
|
/** RSDP (Root System Description Pointer) */
|
||||||
|
typedef struct {
|
||||||
|
CHAR8 signature[8];
|
||||||
|
UINT8 checksum;
|
||||||
|
CHAR8 oem_id[6];
|
||||||
|
UINT8 revision;
|
||||||
|
UINT32 rsdt_address;
|
||||||
|
UINT32 length;
|
||||||
|
UINT64 xsdt_address;
|
||||||
|
UINT8 extended_checksum;
|
||||||
|
UINT8 reserved[3];
|
||||||
|
} ACPI_20_RSDP;
|
||||||
|
|
||||||
|
/** SDT (System Description Table) entry header */
|
||||||
|
typedef struct {
|
||||||
|
CHAR8 signature[4];
|
||||||
|
UINT32 length;
|
||||||
|
UINT8 revision;
|
||||||
|
UINT8 checksum;
|
||||||
|
CHAR8 oem_id[6];
|
||||||
|
CHAR8 oem_table_id[8];
|
||||||
|
UINT32 oem_revision;
|
||||||
|
UINT32 asl_compiler_id;
|
||||||
|
UINT32 asl_compiler_revision;
|
||||||
|
} ACPI_SDT_HEADER;
|
||||||
|
|
||||||
|
/** BGRT structure */
|
||||||
|
typedef struct {
|
||||||
|
ACPI_SDT_HEADER header;
|
||||||
|
UINT16 version;
|
||||||
|
UINT8 status;
|
||||||
|
UINT8 image_type;
|
||||||
|
UINT64 image_address;
|
||||||
|
UINT32 image_offset_x;
|
||||||
|
UINT32 image_offset_y;
|
||||||
|
} ACPI_BGRT;
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
LoadBmp(
|
||||||
|
OUT EFI_PHYSICAL_ADDRESS *BmpAddress,
|
||||||
|
OUT UINT32 *BmpSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN FvProtocolCount;
|
||||||
|
EFI_HANDLE *FvHandles;
|
||||||
|
EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
|
||||||
|
UINTN Index;
|
||||||
|
UINT32 AuthenticationStatus;
|
||||||
|
|
||||||
|
UINT8 *Buffer;
|
||||||
|
UINTN BmpBufferSize;
|
||||||
|
|
||||||
|
Buffer = 0;
|
||||||
|
FvHandles = NULL;
|
||||||
|
|
||||||
|
Status = gBS->LocateHandleBuffer (
|
||||||
|
ByProtocol,
|
||||||
|
&gEfiFirmwareVolume2ProtocolGuid,
|
||||||
|
NULL,
|
||||||
|
&FvProtocolCount,
|
||||||
|
&FvHandles
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
for (Index = 0; Index < FvProtocolCount; Index++) {
|
||||||
|
Status = gBS->HandleProtocol (
|
||||||
|
FvHandles[Index],
|
||||||
|
&gEfiFirmwareVolume2ProtocolGuid,
|
||||||
|
(VOID **) &Fv
|
||||||
|
);
|
||||||
|
BmpBufferSize = 0;
|
||||||
|
Status = Fv->ReadSection (
|
||||||
|
Fv,
|
||||||
|
(EFI_GUID *)PcdGetPtr(PcdLogoFile),
|
||||||
|
EFI_SECTION_RAW,
|
||||||
|
0,
|
||||||
|
(void **)&Buffer,
|
||||||
|
&BmpBufferSize,
|
||||||
|
&AuthenticationStatus
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
*BmpAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)Buffer;
|
||||||
|
*BmpSize = (UINT32)BmpBufferSize;
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Status = EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FvHandles != NULL) {
|
||||||
|
gBS->FreePool (FvHandles);
|
||||||
|
FvHandles = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT8 SumBytes(const UINT8* arr, UINTN size) {
|
||||||
|
UINT8 sum = 0;
|
||||||
|
UINTN i;
|
||||||
|
for (i = 0; i < size; ++i) {
|
||||||
|
sum += arr[i];
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
int VerifyAcpiRsdp2Checksums(const void* data) {
|
||||||
|
const UINT8* arr = data;
|
||||||
|
UINTN size = *(const UINT32*)&arr[20];
|
||||||
|
return SumBytes(arr, 20) == 0 && SumBytes(arr, size) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetAcpiRsdp2Checksums(void* data) {
|
||||||
|
UINT8* arr = data;
|
||||||
|
UINTN size = *(const UINT32*)&arr[20];
|
||||||
|
arr[9] = 0;
|
||||||
|
arr[32] = 0;
|
||||||
|
arr[9] = -SumBytes(arr, 20);
|
||||||
|
arr[32] = -SumBytes(arr, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
int VerifyAcpiSdtChecksum(const void* data) {
|
||||||
|
const UINT8* arr = data;
|
||||||
|
UINTN size = *(const UINT32*)&arr[4];
|
||||||
|
return SumBytes(arr, size) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetAcpiSdtChecksum(void* data) {
|
||||||
|
UINT8* arr = data;
|
||||||
|
UINTN size = *(const UINT32*)&arr[4];
|
||||||
|
arr[9] = 0;
|
||||||
|
arr[9] = -SumBytes(arr, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
const CHAR16* TmpStr(CHAR8 *src, int length) {
|
||||||
|
static CHAR16 arr[4][16];
|
||||||
|
static int j;
|
||||||
|
CHAR16* dest = arr[j = (j+1) % 4];
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < length && i < 16-1 && src[i]; ++i) {
|
||||||
|
dest[i] = src[i];
|
||||||
|
}
|
||||||
|
dest[i] = 0;
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 min(UINT32 first, UINT32 second){
|
||||||
|
if (first < second)
|
||||||
|
return first;
|
||||||
|
return second;
|
||||||
|
}
|
||||||
|
|
||||||
|
ACPI_SDT_HEADER* CreateXsdt(ACPI_SDT_HEADER* xsdt0, UINTN entries) {
|
||||||
|
ACPI_SDT_HEADER* xsdt = 0;
|
||||||
|
UINT32 xsdt_len = (UINT32)(sizeof(ACPI_SDT_HEADER) + entries * sizeof(UINT64));
|
||||||
|
gBS->AllocatePool(EfiACPIReclaimMemory, xsdt_len, (void**)&xsdt);
|
||||||
|
if (!xsdt) {
|
||||||
|
DEBUG ((EFI_D_INFO, "HackBGRT: Failed to allocate memory for XSDT.\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
ZeroMem(xsdt, xsdt_len);
|
||||||
|
CopyMem(xsdt, xsdt0, min(xsdt0->length, xsdt_len));
|
||||||
|
xsdt->length = xsdt_len;
|
||||||
|
SetAcpiSdtChecksum(xsdt);
|
||||||
|
return xsdt;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ACPI_BGRT* HandleAcpiTables(ACPI_BGRT* bgrt) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < gST->NumberOfTableEntries; i++) {
|
||||||
|
EFI_GUID* vendor_guid = &gST->ConfigurationTable[i].VendorGuid;
|
||||||
|
ACPI_20_RSDP *rsdp;
|
||||||
|
ACPI_SDT_HEADER *xsdt;
|
||||||
|
UINT64 *entry_arr;
|
||||||
|
UINT32 entry_arr_length;
|
||||||
|
|
||||||
|
if (!CompareGuid(vendor_guid, &gEfiAcpiTableGuid) && !CompareGuid(vendor_guid, &gEfiAcpi20TableGuid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
rsdp = (ACPI_20_RSDP *) gST->ConfigurationTable[i].VendorTable;
|
||||||
|
if (CompareMem(rsdp->signature, "RSD PTR ", 8) != 0 || rsdp->revision < 2 || !VerifyAcpiRsdp2Checksums(rsdp)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DEBUG ((EFI_D_INFO, "RSDP: revision = %d, OEM ID = %s\n", rsdp->revision, TmpStr(rsdp->oem_id, 6)));
|
||||||
|
|
||||||
|
xsdt = (ACPI_SDT_HEADER *) (UINTN) rsdp->xsdt_address;
|
||||||
|
if (!xsdt || CompareMem(xsdt->signature, "XSDT", 4) != 0 || !VerifyAcpiSdtChecksum(xsdt)) {
|
||||||
|
DEBUG ((EFI_D_INFO, "* XSDT: missing or invalid\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
entry_arr = (UINT64*)&xsdt[1];
|
||||||
|
entry_arr_length = (xsdt->length - sizeof(*xsdt)) / sizeof(UINT64);
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, "* XSDT: OEM ID = %s, entry count = %d\n", TmpStr(xsdt->oem_id, 6), entry_arr_length));
|
||||||
|
|
||||||
|
if (bgrt) {
|
||||||
|
DEBUG ((EFI_D_INFO, " - Adding missing BGRT.\n"));
|
||||||
|
xsdt = CreateXsdt(xsdt, entry_arr_length + 1);
|
||||||
|
entry_arr = (UINT64*)&xsdt[1];
|
||||||
|
entry_arr[entry_arr_length++] = (UINTN) bgrt;
|
||||||
|
rsdp->xsdt_address = (UINTN) xsdt;
|
||||||
|
SetAcpiRsdp2Checksums(rsdp);
|
||||||
|
}
|
||||||
|
SetAcpiSdtChecksum(xsdt);
|
||||||
|
}
|
||||||
|
return bgrt;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
AddBGRT (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
ACPI_BGRT *bgrt;
|
||||||
|
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||||
|
EFI_PHYSICAL_ADDRESS BmpAddress;
|
||||||
|
UINT32 BmpSize;
|
||||||
|
BMP_IMAGE_HEADER *BmpHeader;
|
||||||
|
const char data[0x38] =
|
||||||
|
"BGRT" "\x38\x00\x00\x00" "\x00" "\xd6" "INTEL " " EDK2"
|
||||||
|
"\x20\x17\x00\x00" "PTL " "\x02\x00\x00\x00"
|
||||||
|
"\x01\x00" "\x00" "\x00";
|
||||||
|
|
||||||
|
BmpAddress = 0;
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, "HackBGRT Start\n"));
|
||||||
|
|
||||||
|
Status = gBS->HandleProtocol (
|
||||||
|
gST->ConsoleOutHandle,
|
||||||
|
&gEfiGraphicsOutputProtocolGuid,
|
||||||
|
(VOID**)&GraphicsOutput
|
||||||
|
);
|
||||||
|
|
||||||
|
// Replace missing = allocate new.
|
||||||
|
gBS->AllocatePool(EfiACPIReclaimMemory, sizeof(*bgrt), (void**)&bgrt);
|
||||||
|
if (!bgrt) {
|
||||||
|
DEBUG ((EFI_D_INFO, "HackBGRT MEM ERR\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, "HackBGRT Load Bmp\n"));
|
||||||
|
Status = LoadBmp(&BmpAddress, &BmpSize);
|
||||||
|
if (EFI_ERROR(Status)){
|
||||||
|
DEBUG ((EFI_D_INFO, "HackBGRT BMP Load ERR\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, "HackBGRT Set Table; BMP Size: %d\n", BmpSize));
|
||||||
|
// Clear the BGRT.
|
||||||
|
CopyMem(bgrt, data, sizeof(data));
|
||||||
|
|
||||||
|
if (GraphicsOutput != NULL && GraphicsOutput->Mode != NULL && GraphicsOutput->Mode->Info != NULL)
|
||||||
|
{
|
||||||
|
BmpHeader = (BMP_IMAGE_HEADER *)BmpAddress;
|
||||||
|
bgrt->image_address = (UINTN)BmpAddress;
|
||||||
|
bgrt->image_offset_x = (GraphicsOutput->Mode->Info->HorizontalResolution - BmpHeader->PixelWidth) / 2;
|
||||||
|
bgrt->image_offset_y = ((GraphicsOutput->Mode->Info->VerticalResolution * 382) / 1000) -
|
||||||
|
(BmpHeader->PixelHeight / 2);
|
||||||
|
DEBUG ((EFI_D_INFO, "HackBGRT Set checksum\n"));
|
||||||
|
SetAcpiSdtChecksum(bgrt);
|
||||||
|
DEBUG ((EFI_D_INFO, "HackBGRT Add Table\n"));
|
||||||
|
HandleAcpiTables(bgrt);
|
||||||
|
} else {
|
||||||
|
DEBUG ((EFI_D_INFO, "HackBGRT no display connected, skip adding table\n"));
|
||||||
|
}
|
||||||
|
}
|
@@ -175,7 +175,7 @@ BootLogoEnableLogo (
|
|||||||
break;
|
break;
|
||||||
case EdkiiPlatformLogoDisplayAttributeCenter:
|
case EdkiiPlatformLogoDisplayAttributeCenter:
|
||||||
DestX = (SizeOfX - Image.Width) / 2;
|
DestX = (SizeOfX - Image.Width) / 2;
|
||||||
DestY = (SizeOfY - Image.Height) / 2;
|
DestY = (SizeOfY * 382) / 1000 - Image.Height / 2;
|
||||||
break;
|
break;
|
||||||
case EdkiiPlatformLogoDisplayAttributeCenterRight:
|
case EdkiiPlatformLogoDisplayAttributeCenterRight:
|
||||||
DestX = SizeOfX - Image.Width;
|
DestX = SizeOfX - Image.Width;
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
[Sources]
|
[Sources]
|
||||||
|
Bgrt.c
|
||||||
BootLogoLib.c
|
BootLogoLib.c
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
@@ -48,5 +49,12 @@
|
|||||||
gEfiUserManagerProtocolGuid ## CONSUMES
|
gEfiUserManagerProtocolGuid ## CONSUMES
|
||||||
gEdkiiPlatformLogoProtocolGuid ## CONSUMES
|
gEdkiiPlatformLogoProtocolGuid ## CONSUMES
|
||||||
|
|
||||||
|
[Guids]
|
||||||
|
gEfiAcpiTableGuid ## CONSUMES ## GUID
|
||||||
|
gEfiAcpi20TableGuid ## CONSUMES ## GUID
|
||||||
|
|
||||||
[FeaturePcd]
|
[FeaturePcd]
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## CONSUMES
|
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## CONSUMES
|
||||||
|
|
||||||
|
[Pcd]
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdLogoFile ## CONSUMES
|
||||||
|
@@ -722,6 +722,7 @@ BootMaintExtractConfig (
|
|||||||
*Progress = Request + StrLen (Request);
|
*Progress = Request + StrLen (Request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, "%a complete: %r\n", __FUNCTION__, Status));
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1033,6 +1034,7 @@ BootMaintRouteConfig (
|
|||||||
//
|
//
|
||||||
CopyMem (OldBmmData, NewBmmData, sizeof (BMM_FAKE_NV_DATA));
|
CopyMem (OldBmmData, NewBmmData, sizeof (BMM_FAKE_NV_DATA));
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, "%a complete: %r\n", __FUNCTION__, Status));
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
@@ -1093,6 +1095,8 @@ BootMaintCallback (
|
|||||||
Private = BMM_CALLBACK_DATA_FROM_THIS (This);
|
Private = BMM_CALLBACK_DATA_FROM_THIS (This);
|
||||||
|
|
||||||
if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
|
if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
|
||||||
|
DEBUG ((EFI_D_INFO, "EFI_BROWSER_ACTION_FORM_OPEN: 0x%0X\n", QuestionId));
|
||||||
|
|
||||||
if (QuestionId == KEY_VALUE_TRIGGER_FORM_OPEN_ACTION) {
|
if (QuestionId == KEY_VALUE_TRIGGER_FORM_OPEN_ACTION) {
|
||||||
if (!mFirstEnterBMMForm) {
|
if (!mFirstEnterBMMForm) {
|
||||||
//
|
//
|
||||||
@@ -1104,7 +1108,9 @@ BootMaintCallback (
|
|||||||
// 1. Update the menus (including legacy munu) show in BootMiantenanceManager page.
|
// 1. Update the menus (including legacy munu) show in BootMiantenanceManager page.
|
||||||
// 2. Re-scan the BootOption menus (including the legacy boot option).
|
// 2. Re-scan the BootOption menus (including the legacy boot option).
|
||||||
//
|
//
|
||||||
CustomizeMenus ();
|
//CustomizeMenus ();
|
||||||
|
UpdatePageId (Private, FORM_BOOT_CHG_ID);
|
||||||
|
UpdatePageBody (FORM_BOOT_CHG_ID, Private);
|
||||||
EfiBootManagerRefreshAllBootOption ();
|
EfiBootManagerRefreshAllBootOption ();
|
||||||
BOpt_GetBootOptions (Private);
|
BOpt_GetBootOptions (Private);
|
||||||
mFirstEnterBMMForm = TRUE;
|
mFirstEnterBMMForm = TRUE;
|
||||||
@@ -1119,6 +1125,8 @@ BootMaintCallback (
|
|||||||
HiiGetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap);
|
HiiGetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap);
|
||||||
|
|
||||||
if (Action == EFI_BROWSER_ACTION_CHANGING) {
|
if (Action == EFI_BROWSER_ACTION_CHANGING) {
|
||||||
|
DEBUG ((EFI_D_INFO, "EFI_BROWSER_ACTION_CHANGING: 0x%0X\n", QuestionId));
|
||||||
|
|
||||||
if (Value == NULL) {
|
if (Value == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
@@ -1204,6 +1212,8 @@ BootMaintCallback (
|
|||||||
ChooseFile (NULL, L".efi", BootFromFile, &File);
|
ChooseFile (NULL, L".efi", BootFromFile, &File);
|
||||||
}
|
}
|
||||||
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {
|
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {
|
||||||
|
DEBUG ((EFI_D_INFO, "EFI_BROWSER_ACTION_CHANGED: 0x%0X\n", QuestionId));
|
||||||
|
|
||||||
if ((Value == NULL) || (ActionRequest == NULL)) {
|
if ((Value == NULL) || (ActionRequest == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
@@ -1243,6 +1253,11 @@ BootMaintCallback (
|
|||||||
CurrentFakeNVMap->DriverOptionChanged = TRUE;
|
CurrentFakeNVMap->DriverOptionChanged = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (QuestionId == BOOT_OPTION_ORDER_QUESTION_ID) {
|
||||||
|
// Save BootOrder on list update
|
||||||
|
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
|
||||||
|
}
|
||||||
|
|
||||||
if ((QuestionId >= BOOT_OPTION_DEL_QUESTION_ID) && (QuestionId < BOOT_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) {
|
if ((QuestionId >= BOOT_OPTION_DEL_QUESTION_ID) && (QuestionId < BOOT_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) {
|
||||||
if (Value->b){
|
if (Value->b){
|
||||||
//
|
//
|
||||||
@@ -1306,6 +1321,7 @@ BootMaintCallback (
|
|||||||
//
|
//
|
||||||
HiiSetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap, NULL);
|
HiiSetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap, NULL);
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, "%a complete: %r\n", __FUNCTION__, EFI_SUCCESS));
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1630,6 +1646,28 @@ BmmInitialBootModeInfo (
|
|||||||
mBmmModeInitialized = TRUE;
|
mBmmModeInitialized = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
EFI_STATUS
|
||||||
|
UnregisterHotKeys(VOID)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_INPUT_KEY HotKey;
|
||||||
|
EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2;
|
||||||
|
|
||||||
|
Status = gBS->LocateProtocol (&gEdkiiFormBrowserEx2ProtocolGuid, NULL, (VOID **) &FormBrowserEx2);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
HotKey.UnicodeChar = CHAR_NULL;
|
||||||
|
|
||||||
|
HotKey.ScanCode = SCAN_F9;
|
||||||
|
FormBrowserEx2->RegisterHotKey(&HotKey, BROWSER_ACTION_UNREGISTER, 0, NULL);
|
||||||
|
|
||||||
|
HotKey.ScanCode = SCAN_F10;
|
||||||
|
FormBrowserEx2->RegisterHotKey(&HotKey, BROWSER_ACTION_UNREGISTER, 0, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Install Boot Maintenance Manager Menu driver.
|
Install Boot Maintenance Manager Menu driver.
|
||||||
@@ -1705,8 +1743,8 @@ BootMaintenanceManagerUiLibConstructor (
|
|||||||
|
|
||||||
mBmmCallbackInfo->MenuEntry = (BM_MENU_ENTRY *) Ptr;
|
mBmmCallbackInfo->MenuEntry = (BM_MENU_ENTRY *) Ptr;
|
||||||
|
|
||||||
mBmmCallbackInfo->BmmPreviousPageId = FORM_MAIN_ID;
|
mBmmCallbackInfo->BmmPreviousPageId = FORM_BOOT_CHG_ID;
|
||||||
mBmmCallbackInfo->BmmCurrentPageId = FORM_MAIN_ID;
|
mBmmCallbackInfo->BmmCurrentPageId = FORM_BOOT_CHG_ID;
|
||||||
|
|
||||||
InitAllMenu (mBmmCallbackInfo);
|
InitAllMenu (mBmmCallbackInfo);
|
||||||
|
|
||||||
@@ -1718,6 +1756,11 @@ BootMaintenanceManagerUiLibConstructor (
|
|||||||
|
|
||||||
BmmInitialBootModeInfo();
|
BmmInitialBootModeInfo();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Remove the F9 and F10 hotkeys
|
||||||
|
//
|
||||||
|
UnregisterHotKeys();
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,8 +19,9 @@ formset
|
|||||||
name = BmmData,
|
name = BmmData,
|
||||||
guid = BOOT_MAINT_FORMSET_GUID;
|
guid = BOOT_MAINT_FORMSET_GUID;
|
||||||
|
|
||||||
form formid = FORM_MAIN_ID,
|
form formid = FORM_BOOT_CHG_ID,
|
||||||
title = STRING_TOKEN(STR_FORM_MAIN_TITLE);
|
title = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add this invisible text in order to indicate enter Boot Maintenance Manager form.
|
// Add this invisible text in order to indicate enter Boot Maintenance Manager form.
|
||||||
// To trigger the form open action.
|
// To trigger the form open action.
|
||||||
@@ -33,6 +34,14 @@ formset
|
|||||||
key = KEY_VALUE_TRIGGER_FORM_OPEN_ACTION;
|
key = KEY_VALUE_TRIGGER_FORM_OPEN_ACTION;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
label FORM_BOOT_CHG_ID;
|
||||||
|
label LABEL_END;
|
||||||
|
|
||||||
|
endform;
|
||||||
|
|
||||||
|
form formid = FORM_MAIN_ID,
|
||||||
|
title = STRING_TOKEN(STR_FORM_MAIN_TITLE);
|
||||||
|
|
||||||
label LABEL_FORM_MAIN_START;
|
label LABEL_FORM_MAIN_START;
|
||||||
//
|
//
|
||||||
// This is where we will dynamically add a Action type op-code to show
|
// This is where we will dynamically add a Action type op-code to show
|
||||||
@@ -148,14 +157,6 @@ formset
|
|||||||
label LABEL_END;
|
label LABEL_END;
|
||||||
endform;
|
endform;
|
||||||
|
|
||||||
form formid = FORM_BOOT_CHG_ID,
|
|
||||||
title = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE);
|
|
||||||
|
|
||||||
label FORM_BOOT_CHG_ID;
|
|
||||||
label LABEL_END;
|
|
||||||
|
|
||||||
endform;
|
|
||||||
|
|
||||||
form formid = FORM_DRV_ADD_ID,
|
form formid = FORM_DRV_ADD_ID,
|
||||||
title = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE);
|
title = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE);
|
||||||
|
|
||||||
|
@@ -17,11 +17,11 @@
|
|||||||
#language fr-FR "NONE"
|
#language fr-FR "NONE"
|
||||||
#string STR_MISSING_STRING #language en-US "Missing String"
|
#string STR_MISSING_STRING #language en-US "Missing String"
|
||||||
#language fr-FR "Missing String"
|
#language fr-FR "Missing String"
|
||||||
#string STR_FORM_MAIN_TITLE #language en-US "Boot Maintenance Manager"
|
#string STR_FORM_MAIN_TITLE #language en-US "Change Boot Order"
|
||||||
#language fr-FR "Boot Maintenance Manager"
|
#language fr-FR "Boot Maintenance Manager"
|
||||||
#string STR_FORM_BOOT_SETUP_TITLE #language en-US "Boot Options"
|
#string STR_FORM_BOOT_SETUP_TITLE #language en-US "Boot Options"
|
||||||
#language fr-FR "Boot Options"
|
#language fr-FR "Boot Options"
|
||||||
#string STR_BOOT_MAINT_MANAGER_HELP #language en-US "This selection will take you to the Boot Maintenance Manager"
|
#string STR_BOOT_MAINT_MANAGER_HELP #language en-US "Change the order of boot entries"
|
||||||
#language fr-FR "This selection will take you to the Boot Maintenance Manager"
|
#language fr-FR "This selection will take you to the Boot Maintenance Manager"
|
||||||
#string STR_FORM_BOOT_SETUP_HELP #language en-US "Modify system boot options"
|
#string STR_FORM_BOOT_SETUP_HELP #language en-US "Modify system boot options"
|
||||||
#language fr-FR "Modify system boot options"
|
#language fr-FR "Modify system boot options"
|
||||||
@@ -251,7 +251,7 @@
|
|||||||
#language fr-FR "Boot system from a file or device"
|
#language fr-FR "Boot system from a file or device"
|
||||||
#string STR_OPTIONAL_DATA #language en-US "Input Optional Data"
|
#string STR_OPTIONAL_DATA #language en-US "Input Optional Data"
|
||||||
#language fr-FR "Input Optional Data"
|
#language fr-FR "Input Optional Data"
|
||||||
#string STR_CHANGE_ORDER #language en-US "Change the order"
|
#string STR_CHANGE_ORDER #language en-US "Change Boot Order"
|
||||||
#language fr-FR "Change the order"
|
#language fr-FR "Change the order"
|
||||||
#string STR_BOOT_LEGACY #language en-US "Boot Legacy System"
|
#string STR_BOOT_LEGACY #language en-US "Boot Legacy System"
|
||||||
#language fr-FR "Boot Legacy System"
|
#language fr-FR "Boot Legacy System"
|
||||||
|
@@ -112,40 +112,6 @@ UpdatePageEnd (
|
|||||||
IN BMM_CALLBACK_DATA *CallbackData
|
IN BMM_CALLBACK_DATA *CallbackData
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Create the "Apply changes" and "Discard changes" tags.
|
|
||||||
//
|
|
||||||
if (CallbackData->BmmAskSaveOrNot) {
|
|
||||||
HiiCreateSubTitleOpCode (
|
|
||||||
mStartOpCodeHandle,
|
|
||||||
STRING_TOKEN (STR_NULL_STRING),
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
|
|
||||||
HiiCreateActionOpCode (
|
|
||||||
mStartOpCodeHandle,
|
|
||||||
KEY_VALUE_SAVE_AND_EXIT,
|
|
||||||
STRING_TOKEN (STR_SAVE_AND_EXIT),
|
|
||||||
STRING_TOKEN (STR_NULL_STRING),
|
|
||||||
EFI_IFR_FLAG_CALLBACK,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Ensure user can return to the main page.
|
|
||||||
//
|
|
||||||
HiiCreateActionOpCode (
|
|
||||||
mStartOpCodeHandle,
|
|
||||||
KEY_VALUE_NO_SAVE_AND_EXIT,
|
|
||||||
STRING_TOKEN (STR_NO_SAVE_AND_EXIT),
|
|
||||||
STRING_TOKEN (STR_NULL_STRING),
|
|
||||||
EFI_IFR_FLAG_CALLBACK,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
|
|
||||||
HiiUpdateForm (
|
HiiUpdateForm (
|
||||||
CallbackData->BmmHiiHandle,
|
CallbackData->BmmHiiHandle,
|
||||||
&mBootMaintGuid,
|
&mBootMaintGuid,
|
||||||
@@ -642,7 +608,7 @@ UpdateOrderPage (
|
|||||||
VarOffset, // Offset in Buffer Storage
|
VarOffset, // Offset in Buffer Storage
|
||||||
STRING_TOKEN (STR_CHANGE_ORDER), // Question prompt text
|
STRING_TOKEN (STR_CHANGE_ORDER), // Question prompt text
|
||||||
STRING_TOKEN (STR_CHANGE_ORDER), // Question help text
|
STRING_TOKEN (STR_CHANGE_ORDER), // Question help text
|
||||||
0, // Question flag
|
EFI_IFR_FLAG_CALLBACK, // Question flag
|
||||||
0, // Ordered list flag, e.g. EFI_IFR_UNIQUE_SET
|
0, // Ordered list flag, e.g. EFI_IFR_UNIQUE_SET
|
||||||
EFI_IFR_TYPE_NUM_SIZE_32, // Data type of Question value
|
EFI_IFR_TYPE_NUM_SIZE_32, // Data type of Question value
|
||||||
100, // Maximum container
|
100, // Maximum container
|
||||||
@@ -1143,8 +1109,8 @@ UpdatePageId (
|
|||||||
NewPageId = FORM_CON_COM_SETUP_ID;
|
NewPageId = FORM_CON_COM_SETUP_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((NewPageId > 0) && (NewPageId < MAXIMUM_FORM_ID)) {
|
//if ((NewPageId > 0) && (NewPageId < MAXIMUM_FORM_ID)) {
|
||||||
Private->BmmPreviousPageId = Private->BmmCurrentPageId;
|
// Private->BmmPreviousPageId = Private->BmmCurrentPageId;
|
||||||
Private->BmmCurrentPageId = NewPageId;
|
// Private->BmmCurrentPageId = NewPageId;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
@@ -631,6 +631,7 @@ Var_UpdateBootOrder (
|
|||||||
BOpt_FreeMenu (&BootOptionMenu);
|
BOpt_FreeMenu (&BootOptionMenu);
|
||||||
BOpt_GetBootOptions (CallbackData);
|
BOpt_GetBootOptions (CallbackData);
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, "Updated BootOrder: %r\n", Status));
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "BootManager.h"
|
#include "BootManager.h"
|
||||||
|
|
||||||
|
#include <Protocol/BlockIo.h>
|
||||||
|
|
||||||
UINT16 mKeyInput;
|
UINT16 mKeyInput;
|
||||||
EFI_GUID mBootManagerGuid = BOOT_MANAGER_FORMSET_GUID;
|
EFI_GUID mBootManagerGuid = BOOT_MANAGER_FORMSET_GUID;
|
||||||
//
|
//
|
||||||
@@ -27,6 +29,10 @@ UINT32 mBmSetupVerticalResolution = 0;
|
|||||||
|
|
||||||
BOOLEAN mBmModeInitialized = FALSE;
|
BOOLEAN mBmModeInitialized = FALSE;
|
||||||
|
|
||||||
|
STATIC EFI_EVENT mBmRefreshEvent;
|
||||||
|
STATIC CONST EFI_GUID mBmRefreshGuid = BOOT_MANAGER_REFRESH_GUID;
|
||||||
|
STATIC VOID *mBlockIoRegistration; // Unused
|
||||||
|
|
||||||
CHAR16 *mDeviceTypeStr[] = {
|
CHAR16 *mDeviceTypeStr[] = {
|
||||||
L"Legacy BEV",
|
L"Legacy BEV",
|
||||||
L"Legacy Floppy",
|
L"Legacy Floppy",
|
||||||
@@ -484,22 +490,10 @@ UpdateBootManager (
|
|||||||
BOOLEAN IsLegacyOption;
|
BOOLEAN IsLegacyOption;
|
||||||
BOOLEAN NeedEndOp;
|
BOOLEAN NeedEndOp;
|
||||||
UINTN MaxLen;
|
UINTN MaxLen;
|
||||||
|
UINTN OptionCount = 0;
|
||||||
|
|
||||||
DeviceType = (UINT16) -1;
|
DeviceType = (UINT16) -1;
|
||||||
|
|
||||||
//
|
|
||||||
// for better user experience
|
|
||||||
// 1. User changes HD configuration (e.g.: unplug HDD), here we have a chance to remove the HDD boot option
|
|
||||||
// 2. User enables/disables UEFI PXE, here we have a chance to add/remove EFI Network boot option
|
|
||||||
//
|
|
||||||
EfiBootManagerRefreshAllBootOption ();
|
|
||||||
|
|
||||||
//
|
|
||||||
// BdsDxe doesn't group the legacy boot options for the same device type
|
|
||||||
// It's UI's choice.
|
|
||||||
//
|
|
||||||
GroupMultipleLegacyBootOption4SameType ();
|
|
||||||
|
|
||||||
BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
|
BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
|
||||||
|
|
||||||
HiiHandle = gBootManagerPrivate.HiiHandle;
|
HiiHandle = gBootManagerPrivate.HiiHandle;
|
||||||
@@ -526,6 +520,7 @@ UpdateBootManager (
|
|||||||
EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
|
EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
|
||||||
EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
|
EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
|
||||||
EndLabel->Number = LABEL_BOOT_OPTION_END;
|
EndLabel->Number = LABEL_BOOT_OPTION_END;
|
||||||
|
|
||||||
mKeyInput = 0;
|
mKeyInput = 0;
|
||||||
NeedEndOp = FALSE;
|
NeedEndOp = FALSE;
|
||||||
for (Index = 0; Index < BootOptionCount; Index++) {
|
for (Index = 0; Index < BootOptionCount; Index++) {
|
||||||
@@ -541,6 +536,8 @@ UpdateBootManager (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OptionCount++;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Group the legacy boot option in the sub title created dynamically
|
// Group the legacy boot option in the sub title created dynamically
|
||||||
//
|
//
|
||||||
@@ -596,6 +593,10 @@ UpdateBootManager (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OptionCount == 0) {
|
||||||
|
HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_NO_BOOTABLE_MEDIA), 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (NeedEndOp) {
|
if (NeedEndOp) {
|
||||||
HiiCreateEndOpCode (StartOpCodeHandle);
|
HiiCreateEndOpCode (StartOpCodeHandle);
|
||||||
}
|
}
|
||||||
@@ -787,7 +788,6 @@ BootManagerCallback (
|
|||||||
{
|
{
|
||||||
EFI_BOOT_MANAGER_LOAD_OPTION *BootOption;
|
EFI_BOOT_MANAGER_LOAD_OPTION *BootOption;
|
||||||
UINTN BootOptionCount;
|
UINTN BootOptionCount;
|
||||||
EFI_INPUT_KEY Key;
|
|
||||||
|
|
||||||
if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
|
if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
|
||||||
//
|
//
|
||||||
@@ -831,19 +831,31 @@ BootManagerCallback (
|
|||||||
EfiBootManagerBoot (&BootOption[QuestionId - 1]);
|
EfiBootManagerBoot (&BootOption[QuestionId - 1]);
|
||||||
BmSetConsoleMode (TRUE);
|
BmSetConsoleMode (TRUE);
|
||||||
|
|
||||||
if (EFI_ERROR (BootOption[QuestionId - 1].Status)) {
|
|
||||||
gST->ConOut->OutputString (
|
|
||||||
gST->ConOut,
|
|
||||||
HiiGetString (gBootManagerPrivate.HiiHandle, STRING_TOKEN (STR_ANY_KEY_CONTINUE), NULL)
|
|
||||||
);
|
|
||||||
gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
|
||||||
}
|
|
||||||
|
|
||||||
EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);
|
EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
RefreshBootOptions(
|
||||||
|
IN EFI_EVENT Event,
|
||||||
|
IN VOID *Context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_TPL OldTpl = gBS->RaiseTPL(TPL_CALLBACK);
|
||||||
|
|
||||||
|
EfiBootManagerRefreshAllBootOption();
|
||||||
|
|
||||||
|
// BdsDxe doesn't group the legacy boot options for the same device type. It's UI's choice.
|
||||||
|
GroupMultipleLegacyBootOption4SameType();
|
||||||
|
|
||||||
|
UpdateBootManager();
|
||||||
|
|
||||||
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Install Boot Manager Menu driver.
|
Install Boot Manager Menu driver.
|
||||||
@@ -892,6 +904,23 @@ BootManagerUiLibConstructor (
|
|||||||
|
|
||||||
BmInitialBootModeInfo ();
|
BmInitialBootModeInfo ();
|
||||||
|
|
||||||
|
Status = gBS->CreateEventEx(
|
||||||
|
EVT_NOTIFY_SIGNAL,
|
||||||
|
TPL_CALLBACK,
|
||||||
|
RefreshBootOptions,
|
||||||
|
NULL,
|
||||||
|
&mBmRefreshGuid,
|
||||||
|
&mBmRefreshEvent
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR(Status);
|
||||||
|
|
||||||
|
Status = gBS->RegisterProtocolNotify (
|
||||||
|
&gEfiBlockIoProtocolGuid,
|
||||||
|
mBmRefreshEvent,
|
||||||
|
&mBlockIoRegistration
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -912,6 +941,8 @@ BootManagerUiLibDestructor (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
gBS->CloseEvent(mBmRefreshEvent);
|
||||||
|
|
||||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
gBootManagerPrivate.DriverHandle,
|
gBootManagerPrivate.DriverHandle,
|
||||||
&gEfiDevicePathProtocolGuid,
|
&gEfiDevicePathProtocolGuid,
|
||||||
|
@@ -46,7 +46,12 @@ typedef struct {
|
|||||||
0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b} \
|
0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BOOT_MANAGER_FORM_ID 0x1000
|
#define BOOT_MANAGER_REFRESH_GUID \
|
||||||
|
{ \
|
||||||
|
0x7648C827, 0xBE32, 0x44D2, { 0xA1, 0x33, 0xF1, 0x7F, 0x93, 0x76, 0xC7, 0x00 } \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define BOOT_MANAGER_FORM_ID 0x1030
|
||||||
|
|
||||||
#define LABEL_BOOT_OPTION 0x00
|
#define LABEL_BOOT_OPTION 0x00
|
||||||
#define LABEL_BOOT_OPTION_END 0x01
|
#define LABEL_BOOT_OPTION_END 0x01
|
||||||
|
@@ -17,20 +17,9 @@
|
|||||||
|
|
||||||
/=#
|
/=#
|
||||||
#langdef en-US "English"
|
#langdef en-US "English"
|
||||||
#langdef fr-FR "Français"
|
|
||||||
|
|
||||||
#string STR_BM_BANNER #language en-US "Boot Manager"
|
#string STR_BM_BANNER #language en-US "One Time Boot"
|
||||||
#language fr-FR "Boot Manager"
|
#string STR_BOOT_MANAGER_HELP #language en-US "Boot an entry one time"
|
||||||
#string STR_BOOT_MANAGER_HELP #language en-US "This selection will take you to the Boot Manager"
|
|
||||||
#language fr-FR "This selection will take you to the Boot Manager"
|
|
||||||
#string STR_HELP_FOOTER #language en-US "Use the <↑> and <↓> keys to choose a boot option, the <Enter> key to select a boot option, and the <Esc> key to exit the Boot Manager Menu."
|
|
||||||
#language fr-FR "<↑> pour <↓> changer l'option, <ENTRER> choisir une option, <ESC> pour sortir"
|
|
||||||
#string STR_AND #language en-US " and "
|
|
||||||
#language fr-FR " et "
|
|
||||||
#string STR_BOOT_OPTION_BANNER #language en-US "Boot Manager Menu"
|
|
||||||
#language fr-FR "le Menu d'Option de Botte"
|
|
||||||
#string STR_ANY_KEY_CONTINUE #language en-US "Press any key to continue..."
|
#string STR_ANY_KEY_CONTINUE #language en-US "Press any key to continue..."
|
||||||
#language fr-FR "Appuie n'importe quelle pour continuer..."
|
#string STR_NO_BOOTABLE_MEDIA #language en-US "No bootable media found"
|
||||||
#string STR_LAST_STRING #language en-US ""
|
#string STR_EMPTY_STRING #language en-US ""
|
||||||
#language fr-FR ""
|
|
||||||
|
|
||||||
|
@@ -51,6 +51,7 @@
|
|||||||
gEfiHiiConfigAccessProtocolGuid ## CONSUMES
|
gEfiHiiConfigAccessProtocolGuid ## CONSUMES
|
||||||
gEfiDevicePathToTextProtocolGuid ## CONSUMES
|
gEfiDevicePathToTextProtocolGuid ## CONSUMES
|
||||||
gEdkiiFormBrowserEx2ProtocolGuid ## CONSUMES
|
gEdkiiFormBrowserEx2ProtocolGuid ## CONSUMES
|
||||||
|
gEfiBlockIoProtocolGuid
|
||||||
|
|
||||||
[FeaturePcd]
|
[FeaturePcd]
|
||||||
|
|
||||||
|
@@ -7,8 +7,9 @@
|
|||||||
//
|
//
|
||||||
//**/
|
//**/
|
||||||
#define FORMSET_GUID { 0x847bc3fe, 0xb974, 0x446d, 0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b }
|
#define FORMSET_GUID { 0x847bc3fe, 0xb974, 0x446d, 0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b }
|
||||||
|
#define BOOT_MANAGER_REFRESH_GUID { 0x7648C827, 0xBE32, 0x44D2, { 0xA1, 0x33, 0xF1, 0x7F, 0x93, 0x76, 0xC7, 0x00 }}
|
||||||
|
|
||||||
#define BOOT_MANAGER_FORM_ID 0x1000
|
#define BOOT_MANAGER_FORM_ID 0x1030
|
||||||
|
|
||||||
#define LABEL_BOOT_OPTION 0x00
|
#define LABEL_BOOT_OPTION 0x00
|
||||||
#define LABEL_BOOT_OPTION_END 0x01
|
#define LABEL_BOOT_OPTION_END 0x01
|
||||||
@@ -21,18 +22,15 @@ formset
|
|||||||
|
|
||||||
form formid = BOOT_MANAGER_FORM_ID,
|
form formid = BOOT_MANAGER_FORM_ID,
|
||||||
title = STRING_TOKEN(STR_BM_BANNER);
|
title = STRING_TOKEN(STR_BM_BANNER);
|
||||||
|
refreshguid = BOOT_MANAGER_REFRESH_GUID;
|
||||||
subtitle text = STRING_TOKEN(STR_LAST_STRING);
|
|
||||||
subtitle text = STRING_TOKEN(STR_BOOT_OPTION_BANNER);
|
|
||||||
subtitle text = STRING_TOKEN(STR_LAST_STRING);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//Add this invisable text in order to indicate enter Boot Manager form.
|
//Add this invisable text in order to indicate enter Boot Manager form.
|
||||||
//
|
//
|
||||||
suppressif TRUE;
|
suppressif TRUE;
|
||||||
text
|
text
|
||||||
help = STRING_TOKEN(STR_LAST_STRING ),
|
help = STRING_TOKEN(STR_EMPTY_STRING),
|
||||||
text = STRING_TOKEN(STR_LAST_STRING ),
|
text = STRING_TOKEN(STR_EMPTY_STRING),
|
||||||
flags = INTERACTIVE,
|
flags = INTERACTIVE,
|
||||||
key = 0x1212;
|
key = 0x1212;
|
||||||
endif;
|
endif;
|
||||||
@@ -43,9 +41,6 @@ formset
|
|||||||
label LABEL_BOOT_OPTION;
|
label LABEL_BOOT_OPTION;
|
||||||
label LABEL_BOOT_OPTION_END;
|
label LABEL_BOOT_OPTION_END;
|
||||||
|
|
||||||
subtitle text = STRING_TOKEN(STR_LAST_STRING);
|
|
||||||
subtitle text = STRING_TOKEN(STR_HELP_FOOTER);
|
|
||||||
|
|
||||||
endform;
|
endform;
|
||||||
|
|
||||||
endformset;
|
endformset;
|
||||||
|
Submodule MdeModulePkg/Library/BrotliCustomDecompressLib/brotli updated: 666c3280cc...aa7b018dcb
@@ -1779,6 +1779,9 @@ EfiBootManagerBoot (
|
|||||||
UINTN FileSize;
|
UINTN FileSize;
|
||||||
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
|
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
|
||||||
EFI_EVENT LegacyBootEvent;
|
EFI_EVENT LegacyBootEvent;
|
||||||
|
EFI_INPUT_KEY Key;
|
||||||
|
UINTN Index;
|
||||||
|
UINT8 *SecureBoot;
|
||||||
|
|
||||||
if (BootOption == NULL) {
|
if (BootOption == NULL) {
|
||||||
return;
|
return;
|
||||||
@@ -1914,6 +1917,38 @@ EfiBootManagerBoot (
|
|||||||
//
|
//
|
||||||
BmReportLoadFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR, Status);
|
BmReportLoadFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR, Status);
|
||||||
BootOption->Status = Status;
|
BootOption->Status = Status;
|
||||||
|
|
||||||
|
if (gST->ConOut != NULL) {
|
||||||
|
gST->ConOut->ClearScreen (gST->ConOut);
|
||||||
|
|
||||||
|
//
|
||||||
|
// When UEFI Secure Boot is enabled, unsigned modules won't load.
|
||||||
|
//
|
||||||
|
SecureBoot = NULL;
|
||||||
|
GetEfiGlobalVariable2 (EFI_SECURE_BOOT_MODE_NAME, (VOID**)&SecureBoot, NULL);
|
||||||
|
if ((SecureBoot != NULL) && (*SecureBoot == SECURE_BOOT_MODE_ENABLE)) {
|
||||||
|
AsciiPrint ("SecureBoot is enabled.\n");
|
||||||
|
} else {
|
||||||
|
AsciiPrint ("SecureBoot is disabled.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SecureBoot != NULL) {
|
||||||
|
FreePool (SecureBoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
AsciiPrint (
|
||||||
|
"Booting from '%s' failed; verify it contains a 64-bit UEFI OS.\n"
|
||||||
|
"\nPress any key to continue booting...\n",
|
||||||
|
BootOption->Description);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (gST->ConIn != NULL) {
|
||||||
|
Status = gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &Index);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
ASSERT (Index == 0);
|
||||||
|
while (!EFI_ERROR (gST->ConIn->ReadKeyStroke (gST->ConIn, &Key))) {}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2116,12 +2151,14 @@ BmEnumerateBootOptions (
|
|||||||
EFI_BLOCK_IO_PROTOCOL *BlkIo;
|
EFI_BLOCK_IO_PROTOCOL *BlkIo;
|
||||||
UINTN Removable;
|
UINTN Removable;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
UINTN EmmcCount;
|
||||||
CHAR16 *Description;
|
CHAR16 *Description;
|
||||||
|
|
||||||
ASSERT (BootOptionCount != NULL);
|
ASSERT (BootOptionCount != NULL);
|
||||||
|
|
||||||
*BootOptionCount = 0;
|
*BootOptionCount = 0;
|
||||||
BootOptions = NULL;
|
BootOptions = NULL;
|
||||||
|
EmmcCount = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Parse removable block io followed by fixed block io
|
// Parse removable block io followed by fixed block io
|
||||||
@@ -2160,6 +2197,17 @@ BmEnumerateBootOptions (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Description = BmGetBootDescription (Handles[Index]);
|
Description = BmGetBootDescription (Handles[Index]);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Skip secondary entries for internal eMMC devices
|
||||||
|
//
|
||||||
|
if (StrCmp(Description, L"eMMC Device") == 0) {
|
||||||
|
EmmcCount++;
|
||||||
|
if (EmmcCount > 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BootOptions = ReallocatePool (
|
BootOptions = ReallocatePool (
|
||||||
sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount),
|
sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount),
|
||||||
sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount + 1),
|
sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount + 1),
|
||||||
|
@@ -15,7 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#define PRODUCT_IDENTIFICATION_LENGTH 16
|
#define PRODUCT_IDENTIFICATION_LENGTH 16
|
||||||
|
|
||||||
CONST UINT16 mBmUsbLangId = 0x0409; // English
|
CONST UINT16 mBmUsbLangId = 0x0409; // English
|
||||||
CHAR16 mBmUefiPrefix[] = L"UEFI ";
|
|
||||||
|
|
||||||
LIST_ENTRY mPlatformBootDescriptionHandlers = INITIALIZE_LIST_HEAD_VARIABLE (mPlatformBootDescriptionHandlers);
|
LIST_ENTRY mPlatformBootDescriptionHandlers = INITIALIZE_LIST_HEAD_VARIABLE (mPlatformBootDescriptionHandlers);
|
||||||
|
|
||||||
@@ -144,9 +143,8 @@ BmGetDescriptionFromDiskInfo (
|
|||||||
EFI_ATAPI_IDENTIFY_DATA IdentifyData;
|
EFI_ATAPI_IDENTIFY_DATA IdentifyData;
|
||||||
EFI_SCSI_INQUIRY_DATA InquiryData;
|
EFI_SCSI_INQUIRY_DATA InquiryData;
|
||||||
CHAR16 *Description;
|
CHAR16 *Description;
|
||||||
UINTN Length;
|
CHAR16 *DescTemp;
|
||||||
CONST UINTN ModelNameLength = 40;
|
CONST UINTN ModelNameLength = 40;
|
||||||
CONST UINTN SerialNumberLength = 20;
|
|
||||||
CHAR8 *StrPtr;
|
CHAR8 *StrPtr;
|
||||||
UINT8 Temp;
|
UINT8 Temp;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
@@ -171,25 +169,19 @@ BmGetDescriptionFromDiskInfo (
|
|||||||
&BufferSize
|
&BufferSize
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Description = AllocateZeroPool ((ModelNameLength + SerialNumberLength + 2) * sizeof (CHAR16));
|
Description = AllocateZeroPool (ModelNameLength * sizeof (CHAR16));
|
||||||
ASSERT (Description != NULL);
|
ASSERT (Description != NULL);
|
||||||
for (Index = 0; Index + 1 < ModelNameLength; Index += 2) {
|
for (Index = 0; Index + 1 < ModelNameLength; Index += 2) {
|
||||||
Description[Index] = (CHAR16) IdentifyData.ModelName[Index + 1];
|
Description[Index] = (CHAR16) IdentifyData.ModelName[Index + 1];
|
||||||
Description[Index + 1] = (CHAR16) IdentifyData.ModelName[Index];
|
Description[Index + 1] = (CHAR16) IdentifyData.ModelName[Index];
|
||||||
}
|
}
|
||||||
|
Description[Index] = L'\0';
|
||||||
Length = Index;
|
|
||||||
Description[Length++] = L' ';
|
|
||||||
|
|
||||||
for (Index = 0; Index + 1 < SerialNumberLength; Index += 2) {
|
|
||||||
Description[Length + Index] = (CHAR16) IdentifyData.SerialNo[Index + 1];
|
|
||||||
Description[Length + Index + 1] = (CHAR16) IdentifyData.SerialNo[Index];
|
|
||||||
}
|
|
||||||
Length += Index;
|
|
||||||
Description[Length++] = L'\0';
|
|
||||||
ASSERT (Length == ModelNameLength + SerialNumberLength + 2);
|
|
||||||
|
|
||||||
BmEliminateExtraSpaces (Description);
|
BmEliminateExtraSpaces (Description);
|
||||||
|
|
||||||
|
DescTemp = AllocateZeroPool (0x60);
|
||||||
|
StrCatS (DescTemp, 0x60 / sizeof (CHAR16), Description);
|
||||||
|
StrCpyS(Description, StrSize (DescTemp) / sizeof (CHAR16), DescTemp);
|
||||||
|
FreePool (DescTemp);
|
||||||
}
|
}
|
||||||
} else if (CompareGuid (&DiskInfo->Interface, &gEfiDiskInfoScsiInterfaceGuid)) {
|
} else if (CompareGuid (&DiskInfo->Interface, &gEfiDiskInfoScsiInterfaceGuid)) {
|
||||||
BufferSize = sizeof (EFI_SCSI_INQUIRY_DATA);
|
BufferSize = sizeof (EFI_SCSI_INQUIRY_DATA);
|
||||||
@@ -268,7 +260,6 @@ BmGetUsbDescription (
|
|||||||
CHAR16 NullChar;
|
CHAR16 NullChar;
|
||||||
CHAR16 *Manufacturer;
|
CHAR16 *Manufacturer;
|
||||||
CHAR16 *Product;
|
CHAR16 *Product;
|
||||||
CHAR16 *SerialNumber;
|
|
||||||
CHAR16 *Description;
|
CHAR16 *Description;
|
||||||
EFI_USB_DEVICE_DESCRIPTOR DevDesc;
|
EFI_USB_DEVICE_DESCRIPTOR DevDesc;
|
||||||
UINTN DescMaxSize;
|
UINTN DescMaxSize;
|
||||||
@@ -309,24 +300,12 @@ BmGetUsbDescription (
|
|||||||
Product = &NullChar;
|
Product = &NullChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = UsbIo->UsbGetStringDescriptor (
|
|
||||||
UsbIo,
|
|
||||||
mBmUsbLangId,
|
|
||||||
DevDesc.StrSerialNumber,
|
|
||||||
&SerialNumber
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
SerialNumber = &NullChar;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((Manufacturer == &NullChar) &&
|
if ((Manufacturer == &NullChar) &&
|
||||||
(Product == &NullChar) &&
|
(Product == &NullChar)) {
|
||||||
(SerialNumber == &NullChar)
|
|
||||||
) {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DescMaxSize = StrSize (Manufacturer) + StrSize (Product) + StrSize (SerialNumber);
|
DescMaxSize = StrSize (Manufacturer) + StrSize (Product);
|
||||||
Description = AllocateZeroPool (DescMaxSize);
|
Description = AllocateZeroPool (DescMaxSize);
|
||||||
ASSERT (Description != NULL);
|
ASSERT (Description != NULL);
|
||||||
StrCatS (Description, DescMaxSize/sizeof(CHAR16), Manufacturer);
|
StrCatS (Description, DescMaxSize/sizeof(CHAR16), Manufacturer);
|
||||||
@@ -335,17 +314,12 @@ BmGetUsbDescription (
|
|||||||
StrCatS (Description, DescMaxSize/sizeof(CHAR16), Product);
|
StrCatS (Description, DescMaxSize/sizeof(CHAR16), Product);
|
||||||
StrCatS (Description, DescMaxSize/sizeof(CHAR16), L" ");
|
StrCatS (Description, DescMaxSize/sizeof(CHAR16), L" ");
|
||||||
|
|
||||||
StrCatS (Description, DescMaxSize/sizeof(CHAR16), SerialNumber);
|
|
||||||
|
|
||||||
if (Manufacturer != &NullChar) {
|
if (Manufacturer != &NullChar) {
|
||||||
FreePool (Manufacturer);
|
FreePool (Manufacturer);
|
||||||
}
|
}
|
||||||
if (Product != &NullChar) {
|
if (Product != &NullChar) {
|
||||||
FreePool (Product);
|
FreePool (Product);
|
||||||
}
|
}
|
||||||
if (SerialNumber != &NullChar) {
|
|
||||||
FreePool (SerialNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
BmEliminateExtraSpaces (Description);
|
BmEliminateExtraSpaces (Description);
|
||||||
|
|
||||||
@@ -564,6 +538,7 @@ BmGetNvmeDescription (
|
|||||||
EFI_NVM_EXPRESS_COMPLETION Completion;
|
EFI_NVM_EXPRESS_COMPLETION Completion;
|
||||||
NVME_ADMIN_CONTROLLER_DATA ControllerData;
|
NVME_ADMIN_CONTROLLER_DATA ControllerData;
|
||||||
CHAR16 *Description;
|
CHAR16 *Description;
|
||||||
|
CHAR16 *DescTemp;
|
||||||
CHAR16 *Char;
|
CHAR16 *Char;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
@@ -630,16 +605,11 @@ BmGetNvmeDescription (
|
|||||||
for (Index = 0; Index < ARRAY_SIZE (ControllerData.Mn); Index++) {
|
for (Index = 0; Index < ARRAY_SIZE (ControllerData.Mn); Index++) {
|
||||||
*(Char++) = (CHAR16) ControllerData.Mn[Index];
|
*(Char++) = (CHAR16) ControllerData.Mn[Index];
|
||||||
}
|
}
|
||||||
*(Char++) = L' ';
|
|
||||||
for (Index = 0; Index < ARRAY_SIZE (ControllerData.Sn); Index++) {
|
|
||||||
*(Char++) = (CHAR16) ControllerData.Sn[Index];
|
|
||||||
}
|
|
||||||
*(Char++) = L' ';
|
|
||||||
UnicodeValueToStringS (
|
|
||||||
Char, sizeof (CHAR16) * (MAXIMUM_VALUE_CHARACTERS + 1),
|
|
||||||
0, DevicePath.NvmeNamespace->NamespaceId, 0
|
|
||||||
);
|
|
||||||
BmEliminateExtraSpaces (Description);
|
BmEliminateExtraSpaces (Description);
|
||||||
|
DescTemp = AllocateZeroPool (0x60);
|
||||||
|
StrCatS (DescTemp, 0x60 / sizeof (CHAR16), Description);
|
||||||
|
StrCpyS(Description, StrSize (DescTemp) / sizeof (CHAR16), DescTemp);
|
||||||
|
FreePool (DescTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Description;
|
return Description;
|
||||||
@@ -771,7 +741,6 @@ BmGetBootDescription (
|
|||||||
BM_BOOT_DESCRIPTION_ENTRY *Entry;
|
BM_BOOT_DESCRIPTION_ENTRY *Entry;
|
||||||
CHAR16 *Description;
|
CHAR16 *Description;
|
||||||
CHAR16 *DefaultDescription;
|
CHAR16 *DefaultDescription;
|
||||||
CHAR16 *Temp;
|
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -781,16 +750,6 @@ BmGetBootDescription (
|
|||||||
for (Index = 0; Index < ARRAY_SIZE (mBmBootDescriptionHandlers); Index++) {
|
for (Index = 0; Index < ARRAY_SIZE (mBmBootDescriptionHandlers); Index++) {
|
||||||
DefaultDescription = mBmBootDescriptionHandlers[Index] (Handle);
|
DefaultDescription = mBmBootDescriptionHandlers[Index] (Handle);
|
||||||
if (DefaultDescription != NULL) {
|
if (DefaultDescription != NULL) {
|
||||||
//
|
|
||||||
// Avoid description confusion between UEFI & Legacy boot option by adding "UEFI " prefix
|
|
||||||
// ONLY for core provided boot description handler.
|
|
||||||
//
|
|
||||||
Temp = AllocatePool (StrSize (DefaultDescription) + sizeof (mBmUefiPrefix));
|
|
||||||
ASSERT (Temp != NULL);
|
|
||||||
StrCpyS (Temp, (StrSize (DefaultDescription) + sizeof (mBmUefiPrefix)) / sizeof (CHAR16), mBmUefiPrefix);
|
|
||||||
StrCatS (Temp, (StrSize (DefaultDescription) + sizeof (mBmUefiPrefix)) / sizeof (CHAR16), DefaultDescription);
|
|
||||||
FreePool (DefaultDescription);
|
|
||||||
DefaultDescription = Temp;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -44,6 +44,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Protocol/DeferredImageLoad.h>
|
#include <Protocol/DeferredImageLoad.h>
|
||||||
#include <Protocol/PlatformBootManager.h>
|
#include <Protocol/PlatformBootManager.h>
|
||||||
|
|
||||||
|
#include <Guid/ImageAuthentication.h>
|
||||||
#include <Guid/MemoryTypeInformation.h>
|
#include <Guid/MemoryTypeInformation.h>
|
||||||
#include <Guid/FileInfo.h>
|
#include <Guid/FileInfo.h>
|
||||||
#include <Guid/GlobalVariable.h>
|
#include <Guid/GlobalVariable.h>
|
||||||
|
207
MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c
Normal file
207
MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
/** @file
|
||||||
|
Unit tests of the UefiSortLib
|
||||||
|
|
||||||
|
Copyright (C) Huawei Technologies Co., Ltd. All rights reserved
|
||||||
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <cmocka.h>
|
||||||
|
|
||||||
|
#include <Uefi.h>
|
||||||
|
#include <Library/BaseLib.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/MemoryAllocationLib.h>
|
||||||
|
|
||||||
|
#include <Library/UnitTestLib.h>
|
||||||
|
#include <Library/SortLib.h>
|
||||||
|
|
||||||
|
#define UNIT_TEST_APP_NAME "UefiSortLib Unit Tests"
|
||||||
|
#define UNIT_TEST_APP_VERSION "1.0"
|
||||||
|
|
||||||
|
#define TEST_ARRAY_SIZE_9 9
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function is called by PerformQuickSort to compare int values.
|
||||||
|
|
||||||
|
@param[in] Left The pointer to first buffer.
|
||||||
|
@param[in] Right The pointer to second buffer.
|
||||||
|
|
||||||
|
@retval 0 Buffer1 equal to Buffer2.
|
||||||
|
@return <0 Buffer1 is less than Buffer2.
|
||||||
|
@return >0 Buffer1 is greater than Buffer2.
|
||||||
|
|
||||||
|
**/
|
||||||
|
INTN
|
||||||
|
EFIAPI
|
||||||
|
TestCompareFunction (
|
||||||
|
IN CONST VOID *Left,
|
||||||
|
IN CONST VOID *Right
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (*(UINT32*)Right > *(UINT32*)Left) {
|
||||||
|
return 1;
|
||||||
|
} else if (*(UINT32*)Right < *(UINT32*)Left) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Unit test for PerformQuickSort () API of the UefiSortLib.
|
||||||
|
|
||||||
|
@param[in] Context [Optional] An optional parameter that enables:
|
||||||
|
1) test-case reuse with varied parameters and
|
||||||
|
2) test-case re-entry for Target tests that need a
|
||||||
|
reboot. This parameter is a VOID* and it is the
|
||||||
|
responsibility of the test author to ensure that the
|
||||||
|
contents are well understood by all test cases that may
|
||||||
|
consume it.
|
||||||
|
|
||||||
|
@retval UNIT_TEST_PASSED The Unit test has completed and the test
|
||||||
|
case was successful.
|
||||||
|
@retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed.
|
||||||
|
**/
|
||||||
|
UNIT_TEST_STATUS
|
||||||
|
EFIAPI
|
||||||
|
SortUINT32ArrayShouldSucceed (
|
||||||
|
IN UNIT_TEST_CONTEXT Context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN TestCount;
|
||||||
|
UINT32 Index;
|
||||||
|
UINT32 TestBuffer[TEST_ARRAY_SIZE_9];
|
||||||
|
UINT32 TestResult[TEST_ARRAY_SIZE_9];
|
||||||
|
|
||||||
|
TestCount = TEST_ARRAY_SIZE_9;
|
||||||
|
for (Index = 0; Index < TEST_ARRAY_SIZE_9; Index++) {
|
||||||
|
TestBuffer[Index] = Index + 1;
|
||||||
|
TestResult[Index] = TEST_ARRAY_SIZE_9 - Index;
|
||||||
|
}
|
||||||
|
|
||||||
|
PerformQuickSort (TestBuffer, TestCount, sizeof (UINT32), (SORT_COMPARE)TestCompareFunction);
|
||||||
|
UT_ASSERT_MEM_EQUAL (TestBuffer, TestResult, sizeof (UINT32) * TEST_ARRAY_SIZE_9);
|
||||||
|
|
||||||
|
return UNIT_TEST_PASSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Unit test for StringCompare () API of the UefiSortLib.
|
||||||
|
|
||||||
|
@param[in] Context [Optional] An optional parameter that enables:
|
||||||
|
1) test-case reuse with varied parameters and
|
||||||
|
2) test-case re-entry for Target tests that need a
|
||||||
|
reboot. This parameter is a VOID* and it is the
|
||||||
|
responsibility of the test author to ensure that the
|
||||||
|
contents are well understood by all test cases that may
|
||||||
|
consume it.
|
||||||
|
|
||||||
|
@retval UNIT_TEST_PASSED The Unit test has completed and the test
|
||||||
|
case was successful.
|
||||||
|
@retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed.
|
||||||
|
**/
|
||||||
|
UNIT_TEST_STATUS
|
||||||
|
EFIAPI
|
||||||
|
CompareSameBufferShouldSucceed (
|
||||||
|
IN UNIT_TEST_CONTEXT Context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
INTN retval;
|
||||||
|
CONST CHAR16* TestBuffer[] = { L"abcdefg" };
|
||||||
|
|
||||||
|
retval = StringCompare (TestBuffer, TestBuffer);
|
||||||
|
UT_ASSERT_TRUE (retval == 0);
|
||||||
|
|
||||||
|
return UNIT_TEST_PASSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initialze the unit test framework, suite, and unit tests for the
|
||||||
|
UefiSortLib and run the UefiSortLib unit test.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS All test cases were dispatched.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to
|
||||||
|
initialize the unit tests.
|
||||||
|
**/
|
||||||
|
STATIC
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
UnitTestingEntry (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UNIT_TEST_FRAMEWORK_HANDLE Framework;
|
||||||
|
UNIT_TEST_SUITE_HANDLE SortTests;
|
||||||
|
|
||||||
|
Framework = NULL;
|
||||||
|
|
||||||
|
DEBUG(( DEBUG_INFO, "%a v%a\n", UNIT_TEST_APP_NAME, UNIT_TEST_APP_VERSION ));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Start setting up the test framework for running the tests.
|
||||||
|
//
|
||||||
|
Status = InitUnitTestFramework (&Framework, UNIT_TEST_APP_NAME, gEfiCallerBaseName, UNIT_TEST_APP_VERSION);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((DEBUG_ERROR, "Failed in InitUnitTestFramework. Status = %r\n", Status));
|
||||||
|
goto EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Populate the UefiSortLib Unit Test Suite.
|
||||||
|
//
|
||||||
|
Status = CreateUnitTestSuite (&SortTests, Framework, "UefiSortLib Sort Tests", "UefiSortLib.SortLib", NULL, NULL);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((DEBUG_ERROR, "Failed in CreateUnitTestSuite for UefiSortLib API Tests\n"));
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// --------------Suite--------Description------------Name--------------Function----------------Pre---Post---Context-----------
|
||||||
|
//
|
||||||
|
AddTestCase (SortTests, "Sort the Array", "Sort", SortUINT32ArrayShouldSucceed, NULL, NULL, NULL);
|
||||||
|
AddTestCase (SortTests, "Compare the Buffer", "Compare", CompareSameBufferShouldSucceed, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Execute the tests.
|
||||||
|
//
|
||||||
|
Status = RunAllTestSuites (Framework);
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
if (Framework) {
|
||||||
|
FreeUnitTestFramework (Framework);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Avoid ECC error for function name that starts with lower case letter
|
||||||
|
///
|
||||||
|
#define UefiSortLibUnitTestMain main
|
||||||
|
|
||||||
|
/**
|
||||||
|
Standard POSIX C entry point for host based unit test execution.
|
||||||
|
|
||||||
|
@param[in] Argc Number of arguments
|
||||||
|
@param[in] Argv Array of pointers to arguments
|
||||||
|
|
||||||
|
@retval 0 Success
|
||||||
|
@retval other Error
|
||||||
|
**/
|
||||||
|
INT32
|
||||||
|
UefiSortLibUnitTestMain (
|
||||||
|
IN INT32 Argc,
|
||||||
|
IN CHAR8 *Argv[]
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UnitTestingEntry ();
|
||||||
|
return 0;
|
||||||
|
}
|
@@ -0,0 +1,32 @@
|
|||||||
|
## @file
|
||||||
|
# This is a unit test for the UefiSortLib.
|
||||||
|
#
|
||||||
|
# Copyright (C) Huawei Technologies Co., Ltd. All rights reserved
|
||||||
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
##
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010017
|
||||||
|
BASE_NAME = UefiSortLibUnitTest
|
||||||
|
FILE_GUID = 271337A3-0D79-BA3E-BC03-714E518E3B1B
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
MODULE_TYPE = HOST_APPLICATION
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources]
|
||||||
|
UefiSortLibUnitTest.c
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
|
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
UnitTestLib
|
||||||
|
DebugLib
|
||||||
|
UefiSortLib
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 315 KiB |
@@ -19,6 +19,7 @@
|
|||||||
"ExceptionList": [
|
"ExceptionList": [
|
||||||
"8005", "UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE.UID",
|
"8005", "UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE.UID",
|
||||||
"8005", "UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE.HID",
|
"8005", "UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE.HID",
|
||||||
|
"8001", "UefiSortLibUnitTestMain",
|
||||||
],
|
],
|
||||||
## Both file path and directory path are accepted.
|
## Both file path and directory path are accepted.
|
||||||
"IgnoreFiles": [
|
"IgnoreFiles": [
|
||||||
|
@@ -2159,3 +2159,8 @@
|
|||||||
|
|
||||||
[UserExtensions.TianoCore."ExtraFiles"]
|
[UserExtensions.TianoCore."ExtraFiles"]
|
||||||
MdeModulePkgExtra.uni
|
MdeModulePkgExtra.uni
|
||||||
|
|
||||||
|
[PcdsFixedAtBuild, PcdsPatchableInModule]
|
||||||
|
## FFS filename to find the default BMP Logo file.
|
||||||
|
# @Prompt FFS Name of Boot Logo File
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdLogoFile |{ 0x99, 0x8b, 0xB2, 0x7B, 0xBB, 0x61, 0xD5, 0x11, 0x9A, 0x5D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }|VOID*|0x40000003
|
||||||
|
@@ -41,3 +41,9 @@
|
|||||||
<PcdsFixedAtBuild>
|
<PcdsFixedAtBuild>
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdAllowVariablePolicyEnforcementDisable|TRUE
|
gEfiMdeModulePkgTokenSpaceGuid.PcdAllowVariablePolicyEnforcementDisable|TRUE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf {
|
||||||
|
<LibraryClasses>
|
||||||
|
UefiSortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
|
||||||
|
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||||
|
}
|
||||||
|
@@ -326,7 +326,8 @@ BdsWait (
|
|||||||
// Can be removed after all keyboard drivers invoke callback in timer callback.
|
// Can be removed after all keyboard drivers invoke callback in timer callback.
|
||||||
|
|
||||||
if (HotkeyTriggered != NULL) {
|
if (HotkeyTriggered != NULL) {
|
||||||
Status = BdsWaitForSingleEvent (HotkeyTriggered, EFI_TIMER_PERIOD_SECONDS (1));
|
//Status = BdsWaitForSingleEvent (HotkeyTriggered, EFI_TIMER_PERIOD_SECONDS (1));
|
||||||
|
Status = BdsWaitForSingleEvent (gST->ConIn->WaitForKey, EFI_TIMER_PERIOD_SECONDS (1));
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1024,7 +1025,7 @@ BdsEntry (
|
|||||||
//
|
//
|
||||||
// BdsReadKeys() can be removed after all keyboard drivers invoke callback in timer callback.
|
// BdsReadKeys() can be removed after all keyboard drivers invoke callback in timer callback.
|
||||||
//
|
//
|
||||||
BdsReadKeys ();
|
//BdsReadKeys ();
|
||||||
|
|
||||||
EfiBootManagerHotkeyBoot ();
|
EfiBootManagerHotkeyBoot ();
|
||||||
|
|
||||||
|
@@ -499,19 +499,6 @@ GraphicsConsoleControllerDriverStart (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ModeNumber != Private->GraphicsOutput->Mode->Mode) {
|
|
||||||
//
|
|
||||||
// Current graphics mode is not set or is not set to the mode which we have found,
|
|
||||||
// set the new graphic mode.
|
|
||||||
//
|
|
||||||
Status = Private->GraphicsOutput->SetMode (Private->GraphicsOutput, ModeNumber);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
//
|
|
||||||
// The mode set operation failed
|
|
||||||
//
|
|
||||||
goto Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
|
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
|
||||||
//
|
//
|
||||||
// At first try to set user-defined resolution
|
// At first try to set user-defined resolution
|
||||||
@@ -780,23 +767,6 @@ CheckModeSupported (
|
|||||||
&Info
|
&Info
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
if ((Info->HorizontalResolution == HorizontalResolution) &&
|
|
||||||
(Info->VerticalResolution == VerticalResolution)) {
|
|
||||||
if ((GraphicsOutput->Mode->Info->HorizontalResolution == HorizontalResolution) &&
|
|
||||||
(GraphicsOutput->Mode->Info->VerticalResolution == VerticalResolution)) {
|
|
||||||
//
|
|
||||||
// If video device has been set to this mode, we do not need to SetMode again
|
|
||||||
//
|
|
||||||
FreePool (Info);
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
FreePool (Info);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FreePool (Info);
|
FreePool (Info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1922,7 +1892,8 @@ FlushCursor (
|
|||||||
|
|
||||||
CurrentMode = This->Mode;
|
CurrentMode = This->Mode;
|
||||||
|
|
||||||
if (!CurrentMode->CursorVisible) {
|
if (!CurrentMode->CursorVisible ||
|
||||||
|
(CurrentMode->CursorColumn == 0 && CurrentMode->CursorRow == 0 )) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
All Pcd Ppi services are implemented here.
|
All Pcd Ppi services are implemented here.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
@@ -339,6 +339,75 @@ PcdPeimInit (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
Status = PeiServicesRegisterForShadow (FileHandle);
|
||||||
|
if (Status == EFI_ALREADY_STARTED) {
|
||||||
|
//
|
||||||
|
// This is now starting in memory, the second time starting.
|
||||||
|
//
|
||||||
|
EFI_PEI_PPI_DESCRIPTOR *OldPpiList;
|
||||||
|
EFI_PEI_PPI_DESCRIPTOR *OldPpiList2;
|
||||||
|
VOID *Ppi;
|
||||||
|
VOID *Ppi2;
|
||||||
|
|
||||||
|
OldPpiList = NULL;
|
||||||
|
Status = PeiServicesLocatePpi (
|
||||||
|
&gPcdPpiGuid,
|
||||||
|
0,
|
||||||
|
&OldPpiList,
|
||||||
|
&Ppi
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
if (OldPpiList != NULL) {
|
||||||
|
Status = PeiServicesReInstallPpi (OldPpiList, &mPpiList[0]);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
OldPpiList2 = NULL;
|
||||||
|
Status = PeiServicesLocatePpi (
|
||||||
|
&gGetPcdInfoPpiGuid,
|
||||||
|
0,
|
||||||
|
&OldPpiList2,
|
||||||
|
&Ppi2
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
if (OldPpiList2 != NULL) {
|
||||||
|
Status = PeiServicesReInstallPpi (OldPpiList2, &mPpiList2[0]);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
OldPpiList = NULL;
|
||||||
|
Status = PeiServicesLocatePpi (
|
||||||
|
&gEfiPeiPcdPpiGuid,
|
||||||
|
0,
|
||||||
|
&OldPpiList,
|
||||||
|
&Ppi
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
if (OldPpiList != NULL) {
|
||||||
|
Status = PeiServicesReInstallPpi (OldPpiList, &mPpiList[1]);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
OldPpiList2 = NULL;
|
||||||
|
Status = PeiServicesLocatePpi (
|
||||||
|
&gEfiGetPcdInfoPpiGuid,
|
||||||
|
0,
|
||||||
|
&OldPpiList2,
|
||||||
|
&Ppi2
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
if (OldPpiList2 != NULL) {
|
||||||
|
Status = PeiServicesReInstallPpi (OldPpiList2, &mPpiList2[1]);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
BuildPcdDatabase (FileHandle);
|
BuildPcdDatabase (FileHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
consumed by drivers that do not care about ACPI versions.
|
consumed by drivers that do not care about ACPI versions.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
Copyright (c) 2019, ARM Ltd. All rights reserved.<BR>
|
Copyright (c) 2019 - 2021, ARM Ltd. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@@ -11,6 +11,6 @@
|
|||||||
#ifndef _ACPI_H_
|
#ifndef _ACPI_H_
|
||||||
#define _ACPI_H_
|
#define _ACPI_H_
|
||||||
|
|
||||||
#include <IndustryStandard/Acpi63.h>
|
#include <IndustryStandard/Acpi64.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
3148
MdePkg/Include/IndustryStandard/Acpi64.h
Normal file
3148
MdePkg/Include/IndustryStandard/Acpi64.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -6378,7 +6378,11 @@ typedef union {
|
|||||||
/// [Bit 11] Execute Disable Bit Enable: IA32_EFER.NXE (R/W).
|
/// [Bit 11] Execute Disable Bit Enable: IA32_EFER.NXE (R/W).
|
||||||
///
|
///
|
||||||
UINT32 NXE:1;
|
UINT32 NXE:1;
|
||||||
UINT32 Reserved3:20;
|
///
|
||||||
|
/// [ Bit 12] Secure Virtual Machine Enable (AMD only)
|
||||||
|
///
|
||||||
|
UINT32 SVME:1;
|
||||||
|
UINT32 Reserved3:19;
|
||||||
UINT32 Reserved4:32;
|
UINT32 Reserved4:32;
|
||||||
} Bits;
|
} Bits;
|
||||||
///
|
///
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) Microsoft Corporation
|
# Copyright (c) Microsoft Corporation
|
||||||
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
||||||
|
# Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
##
|
##
|
||||||
{
|
{
|
||||||
@@ -19,6 +20,7 @@
|
|||||||
],
|
],
|
||||||
## Both file path and directory path are accepted.
|
## Both file path and directory path are accepted.
|
||||||
"IgnoreFiles": [
|
"IgnoreFiles": [
|
||||||
|
"Include/IndustryStandard/Acpi64.h"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
## options defined ci/Plugin/CompilerPlugin
|
## options defined ci/Plugin/CompilerPlugin
|
||||||
|
29
OvmfPkg/Include/Library/Tcg2PhysicalPresencePlatformLib.h
Normal file
29
OvmfPkg/Include/Library/Tcg2PhysicalPresencePlatformLib.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/** @file
|
||||||
|
Returns the platform specific Physical Presence configuration.
|
||||||
|
|
||||||
|
Copyright (C) 2020 9elements GmbH
|
||||||
|
|
||||||
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef __TCG2_PHYSICAL_PRESENCE_PLATFORM_LIB_H__
|
||||||
|
#define __TCG2_PHYSICAL_PRESENCE_PLATFORM_LIB_H__
|
||||||
|
|
||||||
|
#include <IndustryStandard/QemuTpm.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads the platform specific Physical Presence configuration.
|
||||||
|
|
||||||
|
@param[out] The Config structure to read to.
|
||||||
|
@param[out] The PPIinMMIO is True when the PPI is in MMIO memory space
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Operation completed successfully.
|
||||||
|
@retval EFI_PROTOCOL_ERROR Invalid fw_cfg entry size.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
TpmPPIPlatformReadConfig (
|
||||||
|
OUT QEMU_FWCFG_TPM_CONFIG *Config,
|
||||||
|
OUT BOOLEAN *PPIinMMIO
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
@@ -27,8 +27,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Library/HobLib.h>
|
#include <Library/HobLib.h>
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/PrintLib.h>
|
#include <Library/PrintLib.h>
|
||||||
#include <Library/QemuFwCfgLib.h>
|
|
||||||
#include <Library/Tpm2CommandLib.h>
|
#include <Library/Tpm2CommandLib.h>
|
||||||
|
#include <Library/Tcg2PhysicalPresencePlatformLib.h>
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||||
@@ -37,46 +37,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#define CONFIRM_BUFFER_SIZE 4096
|
#define CONFIRM_BUFFER_SIZE 4096
|
||||||
|
|
||||||
|
/* Wait 3 minutes for user input */
|
||||||
|
#define TIMEOUT (1000 * 1000 * 60 * 3)
|
||||||
|
|
||||||
EFI_HII_HANDLE mTcg2PpStringPackHandle;
|
EFI_HII_HANDLE mTcg2PpStringPackHandle;
|
||||||
|
|
||||||
#define TPM_PPI_FLAGS (QEMU_TPM_PPI_FUNC_ALLOWED_USR_REQ)
|
#define TPM_PPI_FLAGS (QEMU_TPM_PPI_FUNC_ALLOWED_USR_REQ)
|
||||||
|
|
||||||
STATIC volatile QEMU_TPM_PPI *mPpi;
|
STATIC volatile QEMU_TPM_PPI *mPpi;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Reads QEMU PPI config from fw_cfg.
|
|
||||||
|
|
||||||
@param[out] The Config structure to read to.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Operation completed successfully.
|
|
||||||
@retval EFI_PROTOCOL_ERROR Invalid fw_cfg entry size.
|
|
||||||
**/
|
|
||||||
STATIC
|
|
||||||
EFI_STATUS
|
|
||||||
QemuTpmReadConfig (
|
|
||||||
OUT QEMU_FWCFG_TPM_CONFIG *Config
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
FIRMWARE_CONFIG_ITEM FwCfgItem;
|
|
||||||
UINTN FwCfgSize;
|
|
||||||
|
|
||||||
Status = QemuFwCfgFindFile ("etc/tpm/config", &FwCfgItem, &FwCfgSize);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FwCfgSize != sizeof (*Config)) {
|
|
||||||
return EFI_PROTOCOL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
QemuFwCfgSelectItem (FwCfgItem);
|
|
||||||
QemuFwCfgReadBytes (sizeof (*Config), Config);
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initializes QEMU PPI memory region.
|
Initializes QEMU PPI memory region.
|
||||||
|
|
||||||
@@ -91,6 +60,7 @@ QemuTpmInitPPI (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
QEMU_FWCFG_TPM_CONFIG Config;
|
QEMU_FWCFG_TPM_CONFIG Config;
|
||||||
|
BOOLEAN PPIinMMIO;
|
||||||
EFI_PHYSICAL_ADDRESS PpiAddress64;
|
EFI_PHYSICAL_ADDRESS PpiAddress64;
|
||||||
EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
|
EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
|
||||||
UINTN Idx;
|
UINTN Idx;
|
||||||
@@ -99,7 +69,7 @@ QemuTpmInitPPI (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = QemuTpmReadConfig (&Config);
|
Status = TpmPPIPlatformReadConfig (&Config, &PPIinMMIO);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@@ -123,12 +93,22 @@ QemuTpmInitPPI (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
goto InvalidPpiAddress;
|
goto InvalidPpiAddress;
|
||||||
}
|
}
|
||||||
|
if (PPIinMMIO) {
|
||||||
if (!EFI_ERROR (Status) &&
|
if (!EFI_ERROR (Status) &&
|
||||||
(Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo &&
|
(Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo &&
|
||||||
Descriptor.GcdMemoryType != EfiGcdMemoryTypeNonExistent)) {
|
Descriptor.GcdMemoryType != EfiGcdMemoryTypeNonExistent)) {
|
||||||
DEBUG ((DEBUG_ERROR, "[TPM2PP] mPpi has an invalid memory type\n"));
|
DEBUG ((DEBUG_ERROR, "[TPM2PP] mPpi has an invalid memory type\n"));
|
||||||
goto InvalidPpiAddress;
|
goto InvalidPpiAddress;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (!EFI_ERROR (Status) &&
|
||||||
|
(Descriptor.GcdMemoryType != EfiGcdMemoryTypeReserved &&
|
||||||
|
Descriptor.GcdMemoryType != EfiGcdMemoryTypeSystemMemory)) {
|
||||||
|
DEBUG ((DEBUG_ERROR, "[TPM2PP] mPpi has an invalid memory type\n"));
|
||||||
|
goto InvalidPpiAddress;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (Idx = 0; Idx < ARRAY_SIZE (mPpi->Func); Idx++) {
|
for (Idx = 0; Idx < ARRAY_SIZE (mPpi->Func); Idx++) {
|
||||||
mPpi->Func[Idx] = 0;
|
mPpi->Func[Idx] = 0;
|
||||||
@@ -360,12 +340,16 @@ Tcg2ExecutePhysicalPresence (
|
|||||||
STATIC
|
STATIC
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
Tcg2ReadUserKey (
|
Tcg2ReadUserKey (
|
||||||
IN BOOLEAN CautionKey
|
IN BOOLEAN CautionKey,
|
||||||
|
IN UINTN Timeout
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_INPUT_KEY Key;
|
EFI_INPUT_KEY Key;
|
||||||
UINT16 InputKey;
|
UINT16 InputKey;
|
||||||
|
UINTN Delay;
|
||||||
|
|
||||||
|
Delay = Timeout / 50;
|
||||||
|
|
||||||
InputKey = 0;
|
InputKey = 0;
|
||||||
do {
|
do {
|
||||||
@@ -382,7 +366,13 @@ Tcg2ReadUserKey (
|
|||||||
InputKey = Key.ScanCode;
|
InputKey = Key.ScanCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (InputKey == 0);
|
gBS->Stall (50);
|
||||||
|
Delay--;
|
||||||
|
} while (InputKey == 0 && Delay > 0);
|
||||||
|
|
||||||
|
if (Delay == 0) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (InputKey != SCAN_ESC) {
|
if (InputKey != SCAN_ESC) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -638,7 +628,7 @@ Tcg2UserConfirm (
|
|||||||
FreePool (ConfirmText);
|
FreePool (ConfirmText);
|
||||||
HiiRemovePackages (mTcg2PpStringPackHandle);
|
HiiRemovePackages (mTcg2PpStringPackHandle);
|
||||||
|
|
||||||
if (Tcg2ReadUserKey (CautionKey)) {
|
if (Tcg2ReadUserKey (CautionKey, TIMEOUT)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -57,11 +57,11 @@
|
|||||||
HobLib
|
HobLib
|
||||||
MemoryAllocationLib
|
MemoryAllocationLib
|
||||||
PrintLib
|
PrintLib
|
||||||
QemuFwCfgLib
|
|
||||||
Tpm2CommandLib
|
Tpm2CommandLib
|
||||||
UefiBootServicesTableLib
|
UefiBootServicesTableLib
|
||||||
UefiLib
|
UefiLib
|
||||||
UefiRuntimeServicesTableLib
|
UefiRuntimeServicesTableLib
|
||||||
|
Tcg2PhysicalPresencePlatformLib
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiTcg2ProtocolGuid ## SOMETIMES_CONSUMES
|
gEfiTcg2ProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
|
@@ -0,0 +1,56 @@
|
|||||||
|
/** @file
|
||||||
|
Returns the platform specific configuration for the QEMU PPI.
|
||||||
|
|
||||||
|
Caution: This module requires additional review when modified.
|
||||||
|
This driver will have external input - variable.
|
||||||
|
This external input must be validated carefully to avoid security issue.
|
||||||
|
|
||||||
|
Copyright (C) 2018, Red Hat, Inc.
|
||||||
|
Copyright (c) 2018, IBM Corporation. All rights reserved.<BR>
|
||||||
|
Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <PiDxe.h>
|
||||||
|
|
||||||
|
#include <IndustryStandard/QemuTpm.h>
|
||||||
|
|
||||||
|
#include <Library/QemuFwCfgLib.h>
|
||||||
|
#include <Library/Tcg2PhysicalPresencePlatformLib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads QEMU PPI config from fw_cfg.
|
||||||
|
|
||||||
|
@param[out] The Config structure to read to.
|
||||||
|
@param[out] The PPIinMMIO is True when the PPI is in MMIO memory space
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Operation completed successfully.
|
||||||
|
@retval EFI_PROTOCOL_ERROR Invalid fw_cfg entry size.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
TpmPPIPlatformReadConfig (
|
||||||
|
OUT QEMU_FWCFG_TPM_CONFIG *Config,
|
||||||
|
OUT BOOLEAN *PPIinMMIO
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
FIRMWARE_CONFIG_ITEM FwCfgItem;
|
||||||
|
UINTN FwCfgSize;
|
||||||
|
|
||||||
|
Status = QemuFwCfgFindFile ("etc/tpm/config", &FwCfgItem, &FwCfgSize);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FwCfgSize != sizeof (*Config)) {
|
||||||
|
return EFI_PROTOCOL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
QemuFwCfgSelectItem (FwCfgItem);
|
||||||
|
QemuFwCfgReadBytes (sizeof (*Config), Config);
|
||||||
|
|
||||||
|
*PPIinMMIO = TRUE;
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
@@ -0,0 +1,36 @@
|
|||||||
|
## @file
|
||||||
|
# Returns the platform specific configuration for the QEMU PPI.
|
||||||
|
#
|
||||||
|
# Caution: This module requires additional review when modified.
|
||||||
|
# This driver will have external input - variable.
|
||||||
|
# This external input must be validated carefully to avoid security issue.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2018, Red Hat, Inc.
|
||||||
|
# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
#
|
||||||
|
##
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = Tcg2PhysicalPresencePlatformLibQemu
|
||||||
|
FILE_GUID = 9336E7F0-6CA1-4E6D-A0E9-DFE5F077AA02
|
||||||
|
MODULE_TYPE = DXE_DRIVER
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
LIBRARY_CLASS = Tcg2PhysicalPresencePlatformLib|DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources]
|
||||||
|
DxeTcg2PhysicalPresencePlatformLib.c
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
OvmfPkg/OvmfPkg.dec
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
QemuFwCfgLib
|
@@ -233,6 +233,7 @@
|
|||||||
Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
|
Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
|
||||||
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
|
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
|
||||||
Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
|
Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
|
||||||
|
Tcg2PhysicalPresencePlatformLib|OvmfPkg/Library/Tcg2PhysicalPresencePlatformLibQemu/DxeTcg2PhysicalPresencePlatformLib.inf
|
||||||
Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
|
Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
|
||||||
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
|
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
|
||||||
!else
|
!else
|
||||||
|
@@ -237,6 +237,7 @@
|
|||||||
Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
|
Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
|
||||||
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
|
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
|
||||||
Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
|
Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
|
||||||
|
Tcg2PhysicalPresencePlatformLib|OvmfPkg/Library/Tcg2PhysicalPresencePlatformLibQemu/DxeTcg2PhysicalPresencePlatformLib.inf
|
||||||
Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
|
Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
|
||||||
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
|
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
|
||||||
!else
|
!else
|
||||||
|
@@ -237,6 +237,7 @@
|
|||||||
Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
|
Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
|
||||||
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
|
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
|
||||||
Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
|
Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
|
||||||
|
Tcg2PhysicalPresencePlatformLib|OvmfPkg/Library/Tcg2PhysicalPresencePlatformLibQemu/DxeTcg2PhysicalPresencePlatformLib.inf
|
||||||
Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
|
Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
|
||||||
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
|
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
|
||||||
!else
|
!else
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
APIs for JSON operations.
|
APIs for JSON operations.
|
||||||
|
|
||||||
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
@@ -53,6 +53,13 @@ typedef INT64 EDKII_JSON_INT_T; // #JSON_INTEGER_IS_LONG_LONG is set to 1
|
|||||||
Index < JsonArrayCount(Array) && (Value = JsonArrayGetValue(Array, Index)); \
|
Index < JsonArrayCount(Array) && (Value = JsonArrayGetValue(Array, Index)); \
|
||||||
Index++)
|
Index++)
|
||||||
|
|
||||||
|
#define EDKII_JSON_OBJECT_FOREACH_SAFE(Object, N, Key, Value) \
|
||||||
|
for (Key = JsonObjectIteratorKey(JsonObjectIterator(Object)), \
|
||||||
|
N = JsonObjectIteratorNext(Object, JsonObjectKeyToIterator(Key)); \
|
||||||
|
Key && (Value = JsonObjectIteratorValue(JsonObjectKeyToIterator(Key))); \
|
||||||
|
Key = JsonObjectIteratorKey(N), \
|
||||||
|
N = JsonObjectIteratorNext(Object, JsonObjectKeyToIterator(Key)))
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Map to the json_error_t in jansson.h
|
/// Map to the json_error_t in jansson.h
|
||||||
///
|
///
|
||||||
@@ -177,12 +184,12 @@ JsonValueInitUnicodeString (
|
|||||||
|
|
||||||
@param[in] Value The integer to initialize to JSON value
|
@param[in] Value The integer to initialize to JSON value
|
||||||
|
|
||||||
@retval The created JSON value which contains a JSON number or NULL.
|
@retval The created JSON value which contains a JSON integer or NULL.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EDKII_JSON_VALUE
|
EDKII_JSON_VALUE
|
||||||
EFIAPI
|
EFIAPI
|
||||||
JsonValueInitNumber (
|
JsonValueInitInteger (
|
||||||
IN INT64 Value
|
IN INT64 Value
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -218,6 +225,36 @@ JsonValueInitNull (
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function is used to initialize a JSON value which contains a TRUE JSON value,
|
||||||
|
or NULL on error.
|
||||||
|
|
||||||
|
NULL JSON value is kept as static value, and no need to do any cleanup work.
|
||||||
|
|
||||||
|
@retval The created JSON TRUE value.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EDKII_JSON_VALUE
|
||||||
|
EFIAPI
|
||||||
|
JsonValueInitTrue (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function is used to initialize a JSON value which contains a FALSE JSON value,
|
||||||
|
or NULL on error.
|
||||||
|
|
||||||
|
NULL JSON value is kept as static value, and no need to do any cleanup work.
|
||||||
|
|
||||||
|
@retval The created JSON FALSE value.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EDKII_JSON_VALUE
|
||||||
|
EFIAPI
|
||||||
|
JsonValueInitFalse (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The function is used to decrease the reference count of a JSON value by one, and once
|
The function is used to decrease the reference count of a JSON value by one, and once
|
||||||
this reference count drops to zero, the value is destroyed and it can no longer be used.
|
this reference count drops to zero, the value is destroyed and it can no longer be used.
|
||||||
@@ -313,6 +350,21 @@ JsonValueIsString (
|
|||||||
IN EDKII_JSON_VALUE Json
|
IN EDKII_JSON_VALUE Json
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function is used to return if the provided JSON value contains a JSON integer.
|
||||||
|
|
||||||
|
@param[in] Json The provided JSON value.
|
||||||
|
|
||||||
|
@retval TRUE The JSON value is contains JSON integer.
|
||||||
|
@retval FALSE The JSON value doesn't contain a JSON integer.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
JsonValueIsInteger (
|
||||||
|
IN EDKII_JSON_VALUE Json
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The function is used to return if the provided JSON value contains a JSON number.
|
The function is used to return if the provided JSON value contains a JSON number.
|
||||||
|
|
||||||
@@ -343,6 +395,36 @@ JsonValueIsBoolean (
|
|||||||
IN EDKII_JSON_VALUE Json
|
IN EDKII_JSON_VALUE Json
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function is used to return if the provided JSON value contains a TRUE value.
|
||||||
|
|
||||||
|
@param[in] Json The provided JSON value.
|
||||||
|
|
||||||
|
@retval TRUE The JSON value contains a TRUE value.
|
||||||
|
@retval FALSE The JSON value doesn't contain a TRUE value.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
JsonValueIsTrue (
|
||||||
|
IN EDKII_JSON_VALUE Json
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function is used to return if the provided JSON value contains a FALSE value.
|
||||||
|
|
||||||
|
@param[in] Json The provided JSON value.
|
||||||
|
|
||||||
|
@retval TRUE The JSON value contains a FALSE value.
|
||||||
|
@retval FALSE The JSON value doesn't contain a FALSE value.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
JsonValueIsFalse (
|
||||||
|
IN EDKII_JSON_VALUE Json
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The function is used to return if the provided JSON value contains a JSON NULL.
|
The function is used to return if the provided JSON value contains a JSON NULL.
|
||||||
|
|
||||||
@@ -424,19 +506,19 @@ JsonValueGetUnicodeString (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The function is used to retrieve the associated integer in a number type JSON value.
|
The function is used to retrieve the associated integer in a integer type JSON value.
|
||||||
|
|
||||||
The input JSON value should not be NULL or contain no JSON number, otherwise it will
|
The input JSON value should not be NULL or contain no JSON Integer, otherwise it will
|
||||||
ASSERT() and return 0.
|
ASSERT() and return 0.
|
||||||
|
|
||||||
@param[in] Json The provided JSON value.
|
@param[in] Json The provided JSON value.
|
||||||
|
|
||||||
@retval Return the associated number in JSON value.
|
@retval Return the associated Integer in JSON value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
INT64
|
INT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
JsonValueGetNumber (
|
JsonValueGetInteger (
|
||||||
IN EDKII_JSON_VALUE Json
|
IN EDKII_JSON_VALUE Json
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -675,6 +757,8 @@ JsonDumpString (
|
|||||||
Caller needs to cleanup the root value by calling JsonValueFree().
|
Caller needs to cleanup the root value by calling JsonValueFree().
|
||||||
|
|
||||||
@param[in] String The NULL terminated CHAR8 string to convert.
|
@param[in] String The NULL terminated CHAR8 string to convert.
|
||||||
|
@param[in] Flags Flags for loading JSON string.
|
||||||
|
@param[in] Error Returned error status.
|
||||||
|
|
||||||
@retval Array JSON value or object JSON value, or NULL when any error occurs.
|
@retval Array JSON value or object JSON value, or NULL when any error occurs.
|
||||||
|
|
||||||
@@ -682,7 +766,9 @@ JsonDumpString (
|
|||||||
EDKII_JSON_VALUE
|
EDKII_JSON_VALUE
|
||||||
EFIAPI
|
EFIAPI
|
||||||
JsonLoadString (
|
JsonLoadString (
|
||||||
IN CONST CHAR8* String
|
IN CONST CHAR8* String,
|
||||||
|
IN UINT64 Flags,
|
||||||
|
IN EDKII_JSON_ERROR *Error
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -781,11 +867,36 @@ JsonObjectIteratorValue (
|
|||||||
@retval Iterator pointer
|
@retval Iterator pointer
|
||||||
**/
|
**/
|
||||||
VOID *
|
VOID *
|
||||||
|
EFIAPI
|
||||||
JsonObjectIteratorNext (
|
JsonObjectIteratorNext (
|
||||||
IN EDKII_JSON_VALUE JsonValue,
|
IN EDKII_JSON_VALUE JsonValue,
|
||||||
IN VOID *Iterator
|
IN VOID *Iterator
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the key of iterator pointing
|
||||||
|
|
||||||
|
@param[in] Iterator Iterator pointer
|
||||||
|
@retval Key
|
||||||
|
**/
|
||||||
|
CHAR8 *
|
||||||
|
EFIAPI
|
||||||
|
JsonObjectIteratorKey (
|
||||||
|
IN VOID *Iterator
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the pointer of iterator by key.
|
||||||
|
|
||||||
|
@param[in] Key The key of interator pointer.
|
||||||
|
@retval Pointer to interator
|
||||||
|
**/
|
||||||
|
VOID *
|
||||||
|
EFIAPI
|
||||||
|
JsonObjectKeyToIterator (
|
||||||
|
IN CHAR8 *Key
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the json type of this json value
|
Returns the json type of this json value
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
Redfish CRT wrapper functions.
|
Redfish CRT wrapper functions.
|
||||||
|
|
||||||
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
@@ -5,7 +5,7 @@
|
|||||||
https://jansson.readthedocs.io/en/2.13/apiref.html
|
https://jansson.readthedocs.io/en/2.13/apiref.html
|
||||||
|
|
||||||
Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
**/
|
**/
|
||||||
@@ -154,12 +154,12 @@ JsonValueInitUnicodeString (
|
|||||||
|
|
||||||
@param[in] Value The integer to initialize to JSON value
|
@param[in] Value The integer to initialize to JSON value
|
||||||
|
|
||||||
@retval The created JSON value which contains a JSON number or NULL.
|
@retval The created JSON value which contains a JSON integer or NULL.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EDKII_JSON_VALUE
|
EDKII_JSON_VALUE
|
||||||
EFIAPI
|
EFIAPI
|
||||||
JsonValueInitNumber (
|
JsonValueInitInteger (
|
||||||
IN INT64 Value
|
IN INT64 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -186,6 +186,42 @@ JsonValueInitBoolean (
|
|||||||
return (EDKII_JSON_VALUE)json_boolean (Value);
|
return (EDKII_JSON_VALUE)json_boolean (Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function is used to initialize a JSON value which contains a TRUE JSON value,
|
||||||
|
or NULL on error.
|
||||||
|
|
||||||
|
NULL JSON value is kept as static value, and no need to do any cleanup work.
|
||||||
|
|
||||||
|
@retval The created JSON TRUE value.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EDKII_JSON_VALUE
|
||||||
|
EFIAPI
|
||||||
|
JsonValueInitTrue (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return (EDKII_JSON_VALUE)json_true();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function is used to initialize a JSON value which contains a FALSE JSON value,
|
||||||
|
or NULL on error.
|
||||||
|
|
||||||
|
NULL JSON value is kept as static value, and no need to do any cleanup work.
|
||||||
|
|
||||||
|
@retval The created JSON FALSE value.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EDKII_JSON_VALUE
|
||||||
|
EFIAPI
|
||||||
|
JsonValueInitFalse (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return (EDKII_JSON_VALUE)json_false();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The function is used to initialize a JSON value which contains a new JSON NULL,
|
The function is used to initialize a JSON value which contains a new JSON NULL,
|
||||||
or NULL on error.
|
or NULL on error.
|
||||||
@@ -314,6 +350,24 @@ JsonValueIsString (
|
|||||||
return json_is_string ((json_t *) Json);
|
return json_is_string ((json_t *) Json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function is used to return if the provided JSON value contains a JSON integer.
|
||||||
|
|
||||||
|
@param[in] Json The provided JSON value.
|
||||||
|
|
||||||
|
@retval TRUE The JSON value is contains JSON integer.
|
||||||
|
@retval FALSE The JSON value doesn't contain a JSON integer.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
JsonValueIsInteger (
|
||||||
|
IN EDKII_JSON_VALUE Json
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return json_is_integer ((json_t *) Json);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The function is used to return if the provided JSON value contains a JSON number.
|
The function is used to return if the provided JSON value contains a JSON number.
|
||||||
|
|
||||||
@@ -329,7 +383,7 @@ JsonValueIsNumber (
|
|||||||
IN EDKII_JSON_VALUE Json
|
IN EDKII_JSON_VALUE Json
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return json_is_integer ((json_t *) Json);
|
return json_is_number ((json_t *) Json);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -350,6 +404,47 @@ JsonValueIsBoolean (
|
|||||||
return json_is_boolean ((json_t *) Json);
|
return json_is_boolean ((json_t *) Json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function is used to return if the provided JSON value contains a TRUE value.
|
||||||
|
|
||||||
|
@param[in] Json The provided JSON value.
|
||||||
|
|
||||||
|
@retval TRUE The JSON value contains a TRUE value.
|
||||||
|
@retval FALSE The JSON value doesn't contain a TRUE value.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
JsonValueIsTrue (
|
||||||
|
IN EDKII_JSON_VALUE Json
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (json_is_true ((json_t *)Json)) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function is used to return if the provided JSON value contains a FALSE value.
|
||||||
|
|
||||||
|
@param[in] Json The provided JSON value.
|
||||||
|
|
||||||
|
@retval TRUE The JSON value contains a FALSE value.
|
||||||
|
@retval FALSE The JSON value doesn't contain a FALSE value.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
JsonValueIsFalse (
|
||||||
|
IN EDKII_JSON_VALUE Json
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (json_is_false ((json_t *)Json)) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
The function is used to return if the provided JSON value contains a JSON NULL.
|
The function is used to return if the provided JSON value contains a JSON NULL.
|
||||||
|
|
||||||
@@ -485,24 +580,24 @@ JsonValueGetUnicodeString (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The function is used to retrieve the associated integer in a number type JSON value.
|
The function is used to retrieve the associated integer in a integer type JSON value.
|
||||||
|
|
||||||
The input JSON value should not be NULL or contain no JSON number, otherwise it will
|
The input JSON value should not be NULL or contain no JSON integer, otherwise it will
|
||||||
ASSERT() and return 0.
|
ASSERT() and return 0.
|
||||||
|
|
||||||
@param[in] Json The provided JSON value.
|
@param[in] Json The provided JSON value.
|
||||||
|
|
||||||
@retval Return the associated number in JSON value.
|
@retval Return the associated integer in JSON value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
INT64
|
INT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
JsonValueGetNumber (
|
JsonValueGetInteger (
|
||||||
IN EDKII_JSON_VALUE Json
|
IN EDKII_JSON_VALUE Json
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (Json != NULL && JsonValueIsNumber (Json));
|
ASSERT (Json != NULL && JsonValueIsInteger (Json));
|
||||||
if (Json == NULL || !JsonValueIsNumber (Json)) {
|
if (Json == NULL || !JsonValueIsInteger (Json)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,6 +925,8 @@ JsonDumpString (
|
|||||||
Caller needs to cleanup the root value by calling JsonValueFree().
|
Caller needs to cleanup the root value by calling JsonValueFree().
|
||||||
|
|
||||||
@param[in] String The NULL terminated CHAR8 string to convert.
|
@param[in] String The NULL terminated CHAR8 string to convert.
|
||||||
|
@param[in] Flags Flags for loading JSON string.
|
||||||
|
@param[in] Error Returned error status.
|
||||||
|
|
||||||
@retval Array JSON value or object JSON value, or NULL when any error occurs.
|
@retval Array JSON value or object JSON value, or NULL when any error occurs.
|
||||||
|
|
||||||
@@ -837,12 +934,12 @@ JsonDumpString (
|
|||||||
EDKII_JSON_VALUE
|
EDKII_JSON_VALUE
|
||||||
EFIAPI
|
EFIAPI
|
||||||
JsonLoadString (
|
JsonLoadString (
|
||||||
IN CONST CHAR8* String
|
IN CONST CHAR8* String,
|
||||||
|
IN UINT64 Flags,
|
||||||
|
IN EDKII_JSON_ERROR *Error
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
json_error_t JsonError;
|
return (EDKII_JSON_VALUE) json_loads ((const char *)String, Flags, (json_error_t *)Error);
|
||||||
|
|
||||||
return (EDKII_JSON_VALUE) json_loads ((const char *)String, 0, &JsonError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -959,6 +1056,7 @@ JsonObjectIteratorValue (
|
|||||||
@retval Iterator pointer
|
@retval Iterator pointer
|
||||||
**/
|
**/
|
||||||
VOID *
|
VOID *
|
||||||
|
EFIAPI
|
||||||
JsonObjectIteratorNext (
|
JsonObjectIteratorNext (
|
||||||
IN EDKII_JSON_VALUE JsonValue,
|
IN EDKII_JSON_VALUE JsonValue,
|
||||||
IN VOID *Iterator
|
IN VOID *Iterator
|
||||||
@@ -967,6 +1065,36 @@ JsonObjectIteratorNext (
|
|||||||
return json_object_iter_next(JsonValue, Iterator);
|
return json_object_iter_next(JsonValue, Iterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the key of iterator pointing.
|
||||||
|
|
||||||
|
@param[in] Iterator Iterator pointer
|
||||||
|
@retval Key
|
||||||
|
**/
|
||||||
|
CHAR8 *
|
||||||
|
EFIAPI
|
||||||
|
JsonObjectIteratorKey (
|
||||||
|
IN VOID *Iterator
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return (CHAR8 *)json_object_iter_key(Iterator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the pointer of iterator by key.
|
||||||
|
|
||||||
|
@param[in] Key The key of interator pointer.
|
||||||
|
@retval Pointer to interator
|
||||||
|
**/
|
||||||
|
VOID *
|
||||||
|
EFIAPI
|
||||||
|
JsonObjectKeyToIterator (
|
||||||
|
IN CHAR8 *Key
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return json_object_key_to_iter(Key);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the json type of this json value.
|
Returns the json type of this json value.
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
#ifndef LIBREDFISH_REDFISH_PAYLOAD_H_
|
#ifndef LIBREDFISH_REDFISH_PAYLOAD_H_
|
||||||
#define LIBREDFISH_REDFISH_PAYLOAD_H_
|
#define LIBREDFISH_REDFISH_PAYLOAD_H_
|
||||||
|
|
||||||
#include <PrivateInclude/Library/RedfishCrtLib.h>
|
#include <Include/Library/RedfishCrtLib.h>
|
||||||
|
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
#include <redfishService.h>
|
#include <redfishService.h>
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
|
||||||
#include <PrivateInclude/Library/RedfishCrtLib.h>
|
#include <Include/Library/RedfishCrtLib.h>
|
||||||
|
|
||||||
#include <Protocol/EdkIIRedfishConfigHandler.h>
|
#include <Protocol/EdkIIRedfishConfigHandler.h>
|
||||||
#include <Protocol/RestEx.h>
|
#include <Protocol/RestEx.h>
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
#ifndef LIBREDFISH_REDPATH_H_
|
#ifndef LIBREDFISH_REDPATH_H_
|
||||||
#define LIBREDFISH_REDPATH_H_
|
#define LIBREDFISH_REDPATH_H_
|
||||||
|
|
||||||
#include <PrivateInclude/Library/RedfishCrtLib.h>
|
#include <Include/Library/RedfishCrtLib.h>
|
||||||
|
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user