Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
OpenCorePKG_MOD
提交
a8db83ac
O
OpenCorePKG_MOD
项目概览
btwise
/
OpenCorePKG_MOD
通知
26
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
OpenCorePKG_MOD
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a8db83ac
编写于
11月 07, 2021
作者:
P
PMheart
提交者:
GitHub
11月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ocvalidate: Add checks for UIScale (#299)
上级
b11e643c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
77 addition
and
53 deletion
+77
-53
Utilities/ocvalidate/Makefile
Utilities/ocvalidate/Makefile
+1
-1
Utilities/ocvalidate/NvramKeyInfo.c
Utilities/ocvalidate/NvramKeyInfo.c
+2
-0
Utilities/ocvalidate/NvramKeyInfo.h
Utilities/ocvalidate/NvramKeyInfo.h
+5
-0
Utilities/ocvalidate/ValidateNvram.c
Utilities/ocvalidate/ValidateNvram.c
+7
-0
Utilities/ocvalidate/ValidateUefi.c
Utilities/ocvalidate/ValidateUefi.c
+60
-50
Utilities/ocvalidate/ocvalidate.c
Utilities/ocvalidate/ocvalidate.c
+1
-1
Utilities/ocvalidate/ocvalidate.h
Utilities/ocvalidate/ocvalidate.h
+1
-1
未找到文件。
Utilities/ocvalidate/Makefile
浏览文件 @
a8db83ac
...
...
@@ -16,7 +16,7 @@ OBJS = $(PROJECT).o \
ValidateMisc.o
\
ValidateNvram.o
\
ValidatePlatformInfo.o
\
ValidateU
EFI
.o
ValidateU
efi
.o
#
# OcConfigurationLib targets.
#
...
...
Utilities/ocvalidate/NvramKeyInfo.c
浏览文件 @
a8db83ac
...
...
@@ -186,3 +186,5 @@ NVRAM_GUID_MAP mGUIDMaps[] = {
{
&
gAppleVendorVariableGuid
,
&
mAppleVendorVariableGuidKeyMaps
[
0
],
ARRAY_SIZE
(
mAppleVendorVariableGuidKeyMaps
)
},
};
UINTN
mGUIDMapsCount
=
ARRAY_SIZE
(
mGUIDMaps
);
BOOLEAN
mHasNvramUIScale
=
FALSE
;
Utilities/ocvalidate/NvramKeyInfo.h
浏览文件 @
a8db83ac
...
...
@@ -48,4 +48,9 @@ typedef struct NVRAM_GUID_MAP_ {
extern
NVRAM_GUID_MAP
mGUIDMaps
[];
extern
UINTN
mGUIDMapsCount
;
/**
Special check for UIScale under NVRAM and UEFI->Output.
**/
extern
BOOLEAN
mHasNvramUIScale
;
#endif // OC_USER_UTILITIES_OCVALIDATE_NVRAM_KEY_INFO_H
Utilities/ocvalidate/ValidateNvram.c
浏览文件 @
a8db83ac
...
...
@@ -140,6 +140,13 @@ ValidateNvramKeyByGuid (
OC_BLOB_GET
(
VariableMap
->
Keys
[
VariableIndex
])
));
++
ErrorCount
;
}
else
{
//
// Special check for UIScale when it is valid.
//
if
(
AsciiStrCmp
(
OC_BLOB_GET
(
VariableMap
->
Keys
[
VariableIndex
]),
"UIScale"
)
==
0
)
{
mHasNvramUIScale
=
TRUE
;
}
}
}
}
...
...
Utilities/ocvalidate/ValidateU
EFI
.c
→
Utilities/ocvalidate/ValidateU
efi
.c
浏览文件 @
a8db83ac
...
...
@@ -13,6 +13,7 @@
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "NvramKeyInfo.h"
#include "ocvalidate.h"
#include "OcValidateLib.h"
...
...
@@ -29,22 +30,22 @@
**/
STATIC
BOOLEAN
U
EFI
DriverHasDuplication
(
U
efi
DriverHasDuplication
(
IN
CONST
VOID
*
PrimaryDriver
,
IN
CONST
VOID
*
SecondaryDriver
)
{
CONST
OC_UEFI_DRIVER_ENTRY
*
U
EFI
PrimaryDriver
;
CONST
OC_UEFI_DRIVER_ENTRY
*
U
EFI
SecondaryDriver
;
CONST
CHAR8
*
U
EFI
DriverPrimaryString
;
CONST
CHAR8
*
U
EFI
DriverSecondaryString
;
CONST
OC_UEFI_DRIVER_ENTRY
*
U
efi
PrimaryDriver
;
CONST
OC_UEFI_DRIVER_ENTRY
*
U
efi
SecondaryDriver
;
CONST
CHAR8
*
U
efi
DriverPrimaryString
;
CONST
CHAR8
*
U
efi
DriverSecondaryString
;
U
EFI
PrimaryDriver
=
*
(
CONST
OC_UEFI_DRIVER_ENTRY
**
)
PrimaryDriver
;
U
EFI
SecondaryDriver
=
*
(
CONST
OC_UEFI_DRIVER_ENTRY
**
)
SecondaryDriver
;
U
EFIDriverPrimaryString
=
OC_BLOB_GET
(
&
UEFI
PrimaryDriver
->
Path
);
U
EFIDriverSecondaryString
=
OC_BLOB_GET
(
&
UEFI
SecondaryDriver
->
Path
);
U
efi
PrimaryDriver
=
*
(
CONST
OC_UEFI_DRIVER_ENTRY
**
)
PrimaryDriver
;
U
efi
SecondaryDriver
=
*
(
CONST
OC_UEFI_DRIVER_ENTRY
**
)
SecondaryDriver
;
U
efiDriverPrimaryString
=
OC_BLOB_GET
(
&
Uefi
PrimaryDriver
->
Path
);
U
efiDriverSecondaryString
=
OC_BLOB_GET
(
&
Uefi
SecondaryDriver
->
Path
);
return
StringIsDuplicated
(
"UEFI->Drivers"
,
U
EFIDriverPrimaryString
,
UEFI
DriverSecondaryString
);
return
StringIsDuplicated
(
"UEFI->Drivers"
,
U
efiDriverPrimaryString
,
Uefi
DriverSecondaryString
);
}
/**
...
...
@@ -58,31 +59,31 @@ UEFIDriverHasDuplication (
**/
STATIC
BOOLEAN
U
EFI
ReservedMemoryHasOverlap
(
U
efi
ReservedMemoryHasOverlap
(
IN
CONST
VOID
*
PrimaryEntry
,
IN
CONST
VOID
*
SecondaryEntry
)
{
CONST
OC_UEFI_RSVD_ENTRY
*
U
EFI
ReservedMemoryPrimaryEntry
;
CONST
OC_UEFI_RSVD_ENTRY
*
U
EFI
ReservedMemorySecondaryEntry
;
UINT64
U
EFI
ReservedMemoryPrimaryAddress
;
UINT64
U
EFI
ReservedMemoryPrimarySize
;
UINT64
U
EFI
ReservedMemorySecondaryAddress
;
UINT64
U
EFI
ReservedMemorySecondarySize
;
U
EFI
ReservedMemoryPrimaryEntry
=
*
(
CONST
OC_UEFI_RSVD_ENTRY
**
)
PrimaryEntry
;
U
EFI
ReservedMemorySecondaryEntry
=
*
(
CONST
OC_UEFI_RSVD_ENTRY
**
)
SecondaryEntry
;
U
EFIReservedMemoryPrimaryAddress
=
UEFI
ReservedMemoryPrimaryEntry
->
Address
;
U
EFIReservedMemoryPrimarySize
=
UEFI
ReservedMemoryPrimaryEntry
->
Size
;
U
EFIReservedMemorySecondaryAddress
=
UEFI
ReservedMemorySecondaryEntry
->
Address
;
U
EFIReservedMemorySecondarySize
=
UEFI
ReservedMemorySecondaryEntry
->
Size
;
if
(
!
U
EFIReservedMemoryPrimaryEntry
->
Enabled
||
!
UEFI
ReservedMemorySecondaryEntry
->
Enabled
)
{
CONST
OC_UEFI_RSVD_ENTRY
*
U
efi
ReservedMemoryPrimaryEntry
;
CONST
OC_UEFI_RSVD_ENTRY
*
U
efi
ReservedMemorySecondaryEntry
;
UINT64
U
efi
ReservedMemoryPrimaryAddress
;
UINT64
U
efi
ReservedMemoryPrimarySize
;
UINT64
U
efi
ReservedMemorySecondaryAddress
;
UINT64
U
efi
ReservedMemorySecondarySize
;
U
efi
ReservedMemoryPrimaryEntry
=
*
(
CONST
OC_UEFI_RSVD_ENTRY
**
)
PrimaryEntry
;
U
efi
ReservedMemorySecondaryEntry
=
*
(
CONST
OC_UEFI_RSVD_ENTRY
**
)
SecondaryEntry
;
U
efiReservedMemoryPrimaryAddress
=
Uefi
ReservedMemoryPrimaryEntry
->
Address
;
U
efiReservedMemoryPrimarySize
=
Uefi
ReservedMemoryPrimaryEntry
->
Size
;
U
efiReservedMemorySecondaryAddress
=
Uefi
ReservedMemorySecondaryEntry
->
Address
;
U
efiReservedMemorySecondarySize
=
Uefi
ReservedMemorySecondaryEntry
->
Size
;
if
(
!
U
efiReservedMemoryPrimaryEntry
->
Enabled
||
!
Uefi
ReservedMemorySecondaryEntry
->
Enabled
)
{
return
FALSE
;
}
if
(
U
EFIReservedMemoryPrimaryAddress
<
UEFIReservedMemorySecondaryAddress
+
UEFI
ReservedMemorySecondarySize
&&
U
EFIReservedMemorySecondaryAddress
<
UEFIReservedMemoryPrimaryAddress
+
UEFI
ReservedMemoryPrimarySize
)
{
if
(
U
efiReservedMemoryPrimaryAddress
<
UefiReservedMemorySecondaryAddress
+
Uefi
ReservedMemorySecondarySize
&&
U
efiReservedMemorySecondaryAddress
<
UefiReservedMemoryPrimaryAddress
+
Uefi
ReservedMemoryPrimarySize
)
{
DEBUG
((
DEBUG_WARN
,
"UEFI->ReservedMemory: Entries have overlapped Address and Size "
));
return
TRUE
;
}
...
...
@@ -114,7 +115,7 @@ ValidateReservedMemoryType (
STATIC
UINT32
CheckU
EFI
APFS
(
CheckU
efi
APFS
(
IN
OC_GLOBAL_CONFIG
*
Config
)
{
...
...
@@ -145,7 +146,7 @@ CheckUEFIAPFS (
STATIC
UINT32
CheckU
EFI
AppleInput
(
CheckU
efi
AppleInput
(
IN
OC_GLOBAL_CONFIG
*
Config
)
{
...
...
@@ -183,7 +184,7 @@ CheckUEFIAppleInput (
STATIC
UINT32
CheckU
EFI
Audio
(
CheckU
efi
Audio
(
IN
OC_GLOBAL_CONFIG
*
Config
)
{
...
...
@@ -224,7 +225,7 @@ CheckUEFIAudio (
STATIC
UINT32
CheckU
EFI
Drivers
(
CheckU
efi
Drivers
(
IN
OC_GLOBAL_CONFIG
*
Config
)
{
...
...
@@ -320,7 +321,7 @@ CheckUEFIDrivers (
UserUefi
->
Drivers
.
Values
,
UserUefi
->
Drivers
.
Count
,
sizeof
(
UserUefi
->
Drivers
.
Values
[
0
]),
U
EFI
DriverHasDuplication
U
efi
DriverHasDuplication
);
IsRequestBootVarRoutingEnabled
=
UserUefi
->
Quirks
.
RequestBootVarRouting
;
...
...
@@ -371,7 +372,7 @@ CheckUEFIDrivers (
STATIC
UINT32
CheckU
EFI
Input
(
CheckU
efi
Input
(
IN
OC_GLOBAL_CONFIG
*
Config
)
{
...
...
@@ -405,7 +406,7 @@ CheckUEFIInput (
STATIC
UINT32
CheckU
EFI
Output
(
CheckU
efi
Output
(
IN
OC_GLOBAL_CONFIG
*
Config
)
{
...
...
@@ -425,10 +426,12 @@ CheckUEFIOutput (
UINT32
UserBpp
;
BOOLEAN
UserSetMax
;
INT8
UIScale
;
BOOLEAN
HasUefiOutputUIScale
;
ErrorCount
=
0
;
UserUefi
=
&
Config
->
Uefi
;
IsTextRendererSystem
=
FALSE
;
HasUefiOutputUIScale
=
FALSE
;
//
// Sanitise strings.
...
...
@@ -521,6 +524,13 @@ CheckUEFIOutput (
if
(
UIScale
<
-
1
||
UIScale
>
2
)
{
DEBUG
((
DEBUG_WARN
,
"UEFI->Output->UIScale is borked (Can only be between -1 and 2)!
\n
"
));
++
ErrorCount
;
}
else
if
(
UIScale
!=
-
1
)
{
HasUefiOutputUIScale
=
TRUE
;
}
if
(
HasUefiOutputUIScale
&&
mHasNvramUIScale
)
{
DEBUG
((
DEBUG_WARN
,
"UIScale is set under both NVRAM and UEFI->Output!
\n
"
));
++
ErrorCount
;
}
return
ErrorCount
;
...
...
@@ -531,7 +541,7 @@ CheckUEFIOutput (
//
STATIC
UINT32
CheckU
EFI
Quirks
(
CheckU
efi
Quirks
(
IN
OC_GLOBAL_CONFIG
*
Config
)
{
...
...
@@ -553,7 +563,7 @@ CheckUEFIQuirks (
STATIC
UINT32
CheckU
EFI
ReservedMemory
(
CheckU
efi
ReservedMemory
(
IN
OC_GLOBAL_CONFIG
*
Config
)
{
...
...
@@ -600,36 +610,36 @@ CheckUEFIReservedMemory (
UserUefi
->
ReservedMemory
.
Values
,
UserUefi
->
ReservedMemory
.
Count
,
sizeof
(
UserUefi
->
ReservedMemory
.
Values
[
0
]),
U
EFI
ReservedMemoryHasOverlap
U
efi
ReservedMemoryHasOverlap
);
return
ErrorCount
;
}
UINT32
CheckU
EFI
(
CheckU
efi
(
IN
OC_GLOBAL_CONFIG
*
Config
)
{
UINT32
ErrorCount
;
UINTN
Index
;
STATIC
CONFIG_CHECK
U
EFI
Checkers
[]
=
{
&
CheckU
EFI
APFS
,
&
CheckU
EFI
AppleInput
,
&
CheckU
EFI
Audio
,
&
CheckU
EFI
Drivers
,
&
CheckU
EFI
Input
,
&
CheckU
EFI
Output
,
&
CheckU
EFI
Quirks
,
&
CheckU
EFI
ReservedMemory
STATIC
CONFIG_CHECK
U
efi
Checkers
[]
=
{
&
CheckU
efi
APFS
,
&
CheckU
efi
AppleInput
,
&
CheckU
efi
Audio
,
&
CheckU
efi
Drivers
,
&
CheckU
efi
Input
,
&
CheckU
efi
Output
,
&
CheckU
efi
Quirks
,
&
CheckU
efi
ReservedMemory
};
DEBUG
((
DEBUG_VERBOSE
,
"config loaded into %a!
\n
"
,
__func__
));
ErrorCount
=
0
;
for
(
Index
=
0
;
Index
<
ARRAY_SIZE
(
U
EFI
Checkers
);
++
Index
)
{
ErrorCount
+=
U
EFI
Checkers
[
Index
]
(
Config
);
for
(
Index
=
0
;
Index
<
ARRAY_SIZE
(
U
efi
Checkers
);
++
Index
)
{
ErrorCount
+=
U
efi
Checkers
[
Index
]
(
Config
);
}
return
ReportError
(
__func__
,
ErrorCount
);
...
...
Utilities/ocvalidate/ocvalidate.c
浏览文件 @
a8db83ac
...
...
@@ -36,7 +36,7 @@ CheckConfig (
&
CheckMisc
,
&
CheckNvram
,
&
CheckPlatformInfo
,
&
CheckU
EFI
&
CheckU
efi
};
ErrorCount
=
0
;
...
...
Utilities/ocvalidate/ocvalidate.h
浏览文件 @
a8db83ac
...
...
@@ -120,7 +120,7 @@ CheckPlatformInfo (
@return Number of errors detected in UEFI Section.
**/
UINT32
CheckU
EFI
(
CheckU
efi
(
IN
OC_GLOBAL_CONFIG
*
Config
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录