Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
OpenCorePKG_MOD
提交
35222181
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,发现更多精彩内容 >>
提交
35222181
编写于
3月 10, 2019
作者:
V
vit9696
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Unify SMBIOS fields and fix user test compilation
上级
eec5cfcf
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
135 addition
and
148 deletion
+135
-148
Include/Library/OcCpuLib.h
Include/Library/OcCpuLib.h
+2
-3
Include/Library/OcSmbiosLib.h
Include/Library/OcSmbiosLib.h
+11
-8
Include/Library/OcVariableLib.h
Include/Library/OcVariableLib.h
+0
-96
Library/OcCpuLib/OcCpuLib.c
Library/OcCpuLib/OcCpuLib.c
+2
-2
Library/OcSmbiosLib/SmbiosPatch.c
Library/OcSmbiosLib/SmbiosPatch.c
+15
-23
Tests/SmbiosTest/SmbiosTest.c
Tests/SmbiosTest/SmbiosTest.c
+13
-7
TestsUser/Include/Base.h
TestsUser/Include/Base.h
+72
-1
TestsUser/Smbios/Smbios.c
TestsUser/Smbios/Smbios.c
+20
-8
未找到文件。
Include/Library/OcCpuLib.h
浏览文件 @
35222181
...
...
@@ -21,7 +21,6 @@
//
#define OC_CPU_SNB_QPB_CLOCK 0x19U
// CPU_INFO
typedef
struct
{
//
// Note, Vendor and BrandString are reordered for proper alignment.
...
...
@@ -64,7 +63,7 @@ typedef struct {
UINT64
CPUFrequency
;
UINT64
FSBFrequency
;
}
CPU_INFO
;
}
OC_
CPU_INFO
;
// OcCpuScanProcessor
/** Scan the processor and fill the cpu info structure with results
...
...
@@ -73,7 +72,7 @@ typedef struct {
**/
VOID
OcCpuScanProcessor
(
IN
OUT
CPU_INFO
*
Cpu
IN
OUT
OC_
CPU_INFO
*
Cpu
);
#endif // OC_CPU_LIB_H_
Include/Library/OcSmbiosLib.h
浏览文件 @
35222181
...
...
@@ -19,6 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef OC_SMBIOS_LIB_H
#define OC_SMBIOS_LIB_H
#include <Library/OcCpuLib.h>
//
// This GUID is used for storing SMBIOS data when the firmware overwrites SMBIOS data at original
// GUID at ExitBootServices, like it happens on some Dell computers.
...
...
@@ -58,20 +60,20 @@ typedef struct OC_SMBIOS_DATA_ {
CONST
CHAR8
*
BoardSerialNumber
;
CONST
CHAR8
*
BoardAssetTag
;
CONST
CHAR8
*
BoardLocationInChassis
;
UINT8
BoardType
;
//
// Type 17
//
UINT8
MemoryFormFactor
;
UINT8
*
BoardType
;
//
// Type 3
//
UINT8
ChassisType
;
UINT8
*
ChassisType
;
CONST
CHAR8
*
ChassisManufacturer
;
CONST
CHAR8
*
ChassisVersion
;
CONST
CHAR8
*
ChassisSerialNumber
;
CONST
CHAR8
*
ChassisAssetTag
;
//
// Type 17
//
UINT8
*
MemoryFormFactor
;
//
// Type 128
// FirmwareFeatures and FirmwareFeaturesMask are split into two UINT32
// values, the lower referring to the traditional FirmwareFeatures and the
...
...
@@ -82,7 +84,7 @@ typedef struct OC_SMBIOS_DATA_ {
//
// Type 131
//
UINT16
ProcessorType
;
UINT16
*
ProcessorType
;
//
// Type 133
//
...
...
@@ -126,7 +128,8 @@ typedef enum OC_SMBIOS_UPDATE_MODE_ {
EFI_STATUS
CreateSmbios
(
IN
OC_SMBIOS_DATA
*
Data
,
IN
OC_SMBIOS_UPDATE_MODE
Mode
IN
OC_SMBIOS_UPDATE_MODE
Mode
,
IN
OC_CPU_INFO
*
CpuInfo
);
#endif // OC_SMBIOS_LIB_H
Include/Library/OcVariableLib.h
已删除
100755 → 0
浏览文件 @
eec5cfcf
/** @file
Copyright (C) 2016 - 2017, The HermitCrabs Lab. All rights reserved.
All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef OC_VARIABLE_LIB_H_
#define OC_VARIABLE_LIB_H_
// CheckVariableBoolean
/** Check the boolean-value of an EFI Variable.
@param[in] Name The firmware allocated handle for the EFI image.
@param[in] VendorGuid A unique identifier for the vendor.
@retval Boolean value indicating TRUE, if variable exists.
**/
BOOLEAN
CheckVariableBoolean
(
IN
CHAR16
*
Name
,
IN
EFI_GUID
*
VendorGuid
);
// DeleteVariables
/** Deletes all EFI Variables matching the pattern.
@param[in] VendorGuid A unique identifier for the vendor.
@param[in] SearchName A Null-terminated Unicode string that is the name of the vendor’s variable. Each SearchName is
unique for each VendorGuid.
SearchName must contain 1 or more Unicode characters. If SearchName is an empty Unicode
string, then EFI_INVALID_PARAMETER is returned.
@retval EFI_SUCCESS The variable was deleted successfully.
**/
EFI_STATUS
DeleteVariables
(
IN
EFI_GUID
*
VendorGuid
,
IN
CHAR16
*
SearchName
);
// OcGetVariable
/** Return the variables value in buffer.
@param[in] Name A Null-terminated Ascii string that is the name of the vendor’s variable. Each Name is
unique for each VendorGuid.
Name must contain 1 or more Ascii characters. If Name is an empty Ascii string, then
EFI_INVALID_PARAMETER is returned.
@param[in] VendorGuid A unique identifier for the vendor.
@param[in,out] BufferPtr Pointer to store the buffer.
@param[in,out] BufferSize Size of the variables data buffer.
@retval A pointer to the variables data
**/
EFI_STATUS
OcGetVariable
(
IN
CHAR8
*
Name
,
IN
EFI_GUID
*
VendorGuid
,
IN
OUT
VOID
**
BufferPtr
,
IN
OUT
UINTN
*
BufferSize
);
// SetVariable
/** Sets an EFI Variable.
@param[in] Name A Null-terminated Ascii string that is the name of the vendor’s variable. Each Name is
unique for each VendorGuid.
Name must contain 1 or more Ascii characters. If Name is an empty Ascii string, then
EFI_INVALID_PARAMETER is returned.
@param[in] VendorGuid A unique identifier for the vendor.
@param[in] Attributes Attributes bitmask to set for the variable. Refer to the GetVariable() function
description.
@param[in] DataSize The size in bytes of the Data buffer. A size of zero causes the variable to be deleted.
@param[in] Data The contents for the variable.
@param[in] OverideDefault A boolean flag which enables updating a previously set value.
@retval EFI_SUCCESS The variable was set successfully.
**/
EFI_STATUS
SetVariable
(
IN
CHAR8
*
Name
,
IN
EFI_GUID
*
VendorGuid
,
IN
UINT32
Attributes
,
IN
UINTN
DataSize
,
IN
VOID
*
Data
,
IN
BOOLEAN
OverideDefault
);
#endif // OC_VARIABLE_LIB_H_
Library/OcCpuLib/OcCpuLib.c
浏览文件 @
35222181
...
...
@@ -552,7 +552,7 @@ DetectAppleProcessorType (
VOID
ScanIntelProcessor
(
IN
OUT
CPU_INFO
*
Cpu
IN
OUT
OC_
CPU_INFO
*
Cpu
)
{
UINT32
CpuidEax
;
...
...
@@ -743,7 +743,7 @@ ScanIntelProcessor (
**/
VOID
OcCpuScanProcessor
(
IN
OUT
CPU_INFO
*
Cpu
IN
OUT
OC_
CPU_INFO
*
Cpu
)
{
UINT32
CpuidEax
;
...
...
Library/OcSmbiosLib/SmbiosPatch.c
浏览文件 @
35222181
...
...
@@ -225,7 +225,7 @@ PatchBaseboardInformation (
SMBIOS_OVERRIDE_V
(
Table
,
Standard
.
Type2
->
FeatureFlag
,
Original
,
NULL
,
NULL
);
SMBIOS_OVERRIDE_S
(
Table
,
Standard
.
Type2
->
LocationInChassis
,
Original
,
Data
->
BoardLocationInChassis
,
&
StringIndex
,
NULL
);
Table
->
CurrentPtr
.
Standard
.
Type2
->
ChassisHandle
=
OcSmbiosSystemEnclosureHandle
;
SMBIOS_OVERRIDE_V
(
Table
,
Standard
.
Type2
->
BoardType
,
Original
,
&
Data
->
BoardType
,
NULL
);
SMBIOS_OVERRIDE_V
(
Table
,
Standard
.
Type2
->
BoardType
,
Original
,
Data
->
BoardType
,
NULL
);
//
// Leave NumberOfContainedObjectHandles as 0, just like Apple does.
...
...
@@ -280,7 +280,7 @@ PatchSystemEnclosure (
}
SMBIOS_OVERRIDE_S
(
Table
,
Standard
.
Type3
->
Manufacturer
,
Original
,
Data
->
ChassisManufacturer
,
&
StringIndex
,
NULL
);
SMBIOS_OVERRIDE_V
(
Table
,
Standard
.
Type3
->
Type
,
Original
,
&
Data
->
ChassisType
,
NULL
);
SMBIOS_OVERRIDE_V
(
Table
,
Standard
.
Type3
->
Type
,
Original
,
Data
->
ChassisType
,
NULL
);
SMBIOS_OVERRIDE_S
(
Table
,
Standard
.
Type3
->
Version
,
Original
,
Data
->
ChassisVersion
,
&
StringIndex
,
NULL
);
SMBIOS_OVERRIDE_S
(
Table
,
Standard
.
Type3
->
SerialNumber
,
Original
,
Data
->
ChassisSerialNumber
,
&
StringIndex
,
NULL
);
SMBIOS_OVERRIDE_S
(
Table
,
Standard
.
Type3
->
AssetTag
,
Original
,
Data
->
ChassisAssetTag
,
&
StringIndex
,
NULL
);
...
...
@@ -313,7 +313,7 @@ VOID
PatchProcessorInformation
(
IN
OUT
OC_SMBIOS_TABLE
*
Table
,
IN
OC_SMBIOS_DATA
*
Data
,
IN
CPU_INFO
*
CpuInfo
IN
OC_CPU_INFO
*
CpuInfo
)
{
APPLE_SMBIOS_STRUCTURE_POINTER
Original
;
...
...
@@ -695,11 +695,7 @@ PatchMemoryDevice (
SMBIOS_OVERRIDE_V
(
Table
,
Standard
.
Type17
->
TotalWidth
,
Original
,
NULL
,
NULL
);
SMBIOS_OVERRIDE_V
(
Table
,
Standard
.
Type17
->
DataWidth
,
Original
,
NULL
,
NULL
);
SMBIOS_OVERRIDE_V
(
Table
,
Standard
.
Type17
->
Size
,
Original
,
NULL
,
NULL
);
if
(
Data
->
MemoryFormFactor
!=
0
)
{
Table
->
CurrentPtr
.
Standard
.
Type17
->
FormFactor
=
Data
->
MemoryFormFactor
;
}
else
{
Table
->
CurrentPtr
.
Standard
.
Type17
->
FormFactor
=
MemoryFormFactorSodimm
;
}
SMBIOS_OVERRIDE_V
(
Table
,
Standard
.
Type17
->
FormFactor
,
Original
,
Data
->
MemoryFormFactor
,
NULL
);
SMBIOS_OVERRIDE_V
(
Table
,
Standard
.
Type17
->
DeviceSet
,
Original
,
NULL
,
NULL
);
SMBIOS_OVERRIDE_S
(
Table
,
Standard
.
Type17
->
DeviceLocator
,
Original
,
NULL
,
&
StringIndex
,
NULL
);
SMBIOS_OVERRIDE_S
(
Table
,
Standard
.
Type17
->
BankLocator
,
Original
,
NULL
,
&
StringIndex
,
NULL
);
...
...
@@ -987,22 +983,20 @@ VOID
CreateAppleProcessorType
(
IN
OUT
OC_SMBIOS_TABLE
*
Table
,
IN
OC_SMBIOS_DATA
*
Data
,
IN
CPU_INFO
*
CpuInfo
IN
OC_CPU_INFO
*
CpuInfo
)
{
APPLE_SMBIOS_STRUCTURE_POINTER
Original
;
UINT8
MinLength
;
MinLength
=
sizeof
(
*
Table
->
CurrentPtr
.
Type131
);
Original
.
Raw
=
NULL
;
MinLength
=
sizeof
(
*
Table
->
CurrentPtr
.
Type131
);
if
(
EFI_ERROR
(
SmbiosInitialiseStruct
(
Table
,
APPLE_SMBIOS_TYPE_PROCESSOR_TYPE
,
MinLength
,
1
)))
{
return
;
}
if
(
Data
->
ProcessorType
!=
AppleProcessorTypeUnknown
)
{
Table
->
CurrentPtr
.
Type131
->
ProcessorType
.
Type
=
Data
->
ProcessorType
;
}
else
{
Table
->
CurrentPtr
.
Type131
->
ProcessorType
.
Type
=
CpuInfo
->
AppleProcessorType
;
}
SMBIOS_OVERRIDE_V
(
Table
,
Type131
->
ProcessorType
.
Type
,
Original
,
Data
->
ProcessorType
,
&
CpuInfo
->
AppleProcessorType
);
SmbiosFinaliseStruct
(
Table
);
}
...
...
@@ -1020,7 +1014,7 @@ VOID
CreateAppleProcessorSpeed
(
IN
OUT
OC_SMBIOS_TABLE
*
Table
,
IN
OC_SMBIOS_DATA
*
Data
,
IN
CPU_INFO
*
CpuInfo
IN
OC_CPU_INFO
*
CpuInfo
)
{
#ifndef OC_PROVIDE_APPLE_PROCESSOR_BUS_SPEED
...
...
@@ -1535,12 +1529,12 @@ SmbiosTableApply (
EFI_STATUS
CreateSmbios
(
IN
OC_SMBIOS_DATA
*
Data
,
IN
OC_SMBIOS_UPDATE_MODE
Mode
IN
OC_SMBIOS_UPDATE_MODE
Mode
,
IN
OC_CPU_INFO
*
CpuInfo
)
{
EFI_STATUS
Status
;
OC_SMBIOS_TABLE
SmbiosTable
;
CPU_INFO
CpuInfo
;
SMBIOS_HANDLE
MemoryDeviceHandle
;
APPLE_SMBIOS_STRUCTURE_POINTER
MemoryDeviceInfo
;
APPLE_SMBIOS_STRUCTURE_POINTER
MemoryDeviceAddress
;
...
...
@@ -1564,13 +1558,11 @@ CreateSmbios (
return
EFI_OUT_OF_RESOURCES
;
}
OcCpuScanProcessor
(
&
CpuInfo
);
PatchBiosInformation
(
&
SmbiosTable
,
Data
);
PatchSystemInformation
(
&
SmbiosTable
,
Data
);
PatchBaseboardInformation
(
&
SmbiosTable
,
Data
);
PatchSystemEnclosure
(
&
SmbiosTable
,
Data
);
PatchProcessorInformation
(
&
SmbiosTable
,
Data
,
&
CpuInfo
);
PatchProcessorInformation
(
&
SmbiosTable
,
Data
,
CpuInfo
);
PatchCacheInformation
(
&
SmbiosTable
,
Data
);
PatchSystemPorts
(
&
SmbiosTable
,
Data
);
PatchSystemSlots
(
&
SmbiosTable
,
Data
);
...
...
@@ -1623,8 +1615,8 @@ CreateSmbios (
PatchPortableBatteryDevice
(
&
SmbiosTable
,
Data
);
PatchBootInformation
(
&
SmbiosTable
,
Data
);
CreateAppleProcessorType
(
&
SmbiosTable
,
Data
,
&
CpuInfo
);
CreateAppleProcessorSpeed
(
&
SmbiosTable
,
Data
,
&
CpuInfo
);
CreateAppleProcessorType
(
&
SmbiosTable
,
Data
,
CpuInfo
);
CreateAppleProcessorSpeed
(
&
SmbiosTable
,
Data
,
CpuInfo
);
CreateAppleFirmwareVolume
(
&
SmbiosTable
,
Data
);
CreateSmBiosEndOfTable
(
&
SmbiosTable
,
Data
);
...
...
Tests/SmbiosTest/SmbiosTest.c
浏览文件 @
35222181
...
...
@@ -27,6 +27,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/OcProtocolLib.h>
#include <Library/OcAppleBootPolicyLib.h>
#include <Library/OcSmbiosLib.h>
#include <Library/OcCpuLib.h>
#include <Protocol/AppleBootPolicy.h>
#include <Protocol/DevicePathPropertyDatabase.h>
...
...
@@ -42,8 +43,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/SimpleTextInEx.h>
#include <Protocol/SimpleFileSystem.h>
static
GUID
SystemUUID
=
{
0x5BC82C38
,
0x4DB6
,
0x4883
,
{
0x85
,
0x2E
,
0xE7
,
0x8D
,
0x78
,
0x0A
,
0x6F
,
0xE6
}};
static
OC_SMBIOS_DATA
Data
=
{
STATIC
GUID
SystemUUID
=
{
0x5BC82C38
,
0x4DB6
,
0x4883
,
{
0x85
,
0x2E
,
0xE7
,
0x8D
,
0x78
,
0x0A
,
0x6F
,
0xE6
}};
STATIC
UINT8
BoardType
=
0xA
;
// Motherboard (BaseBoardTypeMotherBoard)
STATIC
UINT8
MemoryFormFactor
=
0xD
;
// SODIMM, 0x9 for DIMM (MemoryFormFactorSodimm)
STATIC
UINT8
ChassisType
=
0xD
;
// All in one (MiscChassisTypeAllInOne)
STATIC
OC_SMBIOS_DATA
Data
=
{
.
BIOSVendor
=
NULL
,
// Do not change BIOS Vendor
.
BIOSVersion
=
"134.0.0.0.0"
,
.
BIOSReleaseDate
=
"12/08/2017"
,
...
...
@@ -60,16 +64,16 @@ static OC_SMBIOS_DATA Data = {
.
BoardSerialNumber
=
"SU77PEPELATZWAFFE"
,
.
BoardAssetTag
=
""
,
.
BoardLocationInChassis
=
"Part Component"
,
.
BoardType
=
0xA
,
// Motherboard (BaseBoardTypeMotherBoard)
.
MemoryFormFactor
=
0xD
,
// SODIMM, 0x9 for DIMM (MemoryFormFactorSodimm)
.
ChassisType
=
0xD
,
// All in one (MiscChassisTypeAllInOne)
.
BoardType
=
&
BoardType
,
.
MemoryFormFactor
=
&
MemoryFormFactor
,
.
ChassisType
=
&
ChassisType
,
.
ChassisManufacturer
=
NULL
,
// Do not change Chassis Manufacturer
.
ChassisVersion
=
"Mac-27ADBB7B4CEE8E61"
,
.
ChassisSerialNumber
=
"SU77OPENCORE"
,
.
ChassisAssetTag
=
"iMac-Aluminum"
,
.
FirmwareFeatures
=
0xE00FE137
,
.
FirmwareFeaturesMask
=
0xFF1FFF3F
,
.
ProcessorType
=
0
,
// Will be calculated automatically
.
ProcessorType
=
NULL
,
// Will be calculated automatically
.
PlatformFeature
=
1
};
...
...
@@ -80,7 +84,9 @@ TestSmbios (
IN
EFI_SYSTEM_TABLE
*
SystemTable
)
{
CreateSmbios
(
&
Data
,
OcSmbiosUpdateAuto
);
OC_CPU_INFO
CpuInfo
;
OcCpuScanProcessor
(
&
CpuInfo
);
CreateSmbios
(
&
Data
,
OcSmbiosUpdateAuto
,
&
CpuInfo
);
return
EFI_SUCCESS
;
}
...
...
TestsUser/Include/Base.h
浏览文件 @
35222181
...
...
@@ -473,7 +473,7 @@ struct _LIST_ENTRY {
#define ReallocatePool(a,b,c) realloc(c,b)
#define FreePool(x) free(x)
#define CompareMem(a,b,c) memcmp((a),(b),(c))
#define CopyMem(a,b,c) mem
cpy
((a),(b),(c))
#define CopyMem(a,b,c) mem
move
((a),(b),(c))
#define ZeroMem(a,b) memset(a, 0, b)
#define AsciiSPrint snppprintf
#define AsciiStrCmp strcmp
...
...
@@ -1090,6 +1090,77 @@ WriteUnaligned64 (
return
Value
;
}
STATIC
UINTN
InternalBaseLibBitFieldReadUint
(
IN
UINTN
Operand
,
IN
UINTN
StartBit
,
IN
UINTN
EndBit
)
{
//
// ~((UINTN)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]
// are 1's while bit[EndBit + 1] thru the most significant bit are 0's.
//
return
(
Operand
&
~
((
UINTN
)
-
2
<<
EndBit
))
>>
StartBit
;
}
STATIC
UINT8
BitFieldRead8
(
IN
UINT8
Operand
,
IN
UINTN
StartBit
,
IN
UINTN
EndBit
)
{
ASSERT
(
EndBit
<
8
);
ASSERT
(
StartBit
<=
EndBit
);
return
(
UINT8
)
InternalBaseLibBitFieldReadUint
(
Operand
,
StartBit
,
EndBit
);
}
STATIC
UINT64
BitFieldRead64
(
IN
UINT64
Operand
,
IN
UINTN
StartBit
,
IN
UINTN
EndBit
)
{
ASSERT
(
EndBit
<
64
);
ASSERT
(
StartBit
<=
EndBit
);
return
RShiftU64
(
Operand
&
~
LShiftU64
((
UINT64
)
-
2
,
EndBit
),
StartBit
);
}
STATIC
INTN
HighBitSet32
(
IN
UINT32
Operand
)
{
INTN
BitIndex
;
if
(
Operand
==
0
)
{
return
-
1
;
}
for
(
BitIndex
=
31
;
(
INT32
)
Operand
>
0
;
BitIndex
--
,
Operand
<<=
1
);
return
BitIndex
;
}
STATIC
UINT32
GetPowerOfTwo32
(
IN
UINT32
Operand
)
{
if
(
0
==
Operand
)
{
return
0
;
}
return
1ul
<<
HighBitSet32
(
Operand
);
}
STATIC
VOID
*
AllocateCopyPool
(
...
...
TestsUser/Smbios/Smbios.c
浏览文件 @
35222181
...
...
@@ -54,8 +54,11 @@ EFI_GUID gEfiSmbios3TableGuid;
EFI_GUID
gEfiSmbiosTableGuid
;
EFI_GUID
gOcCustomSmbiosTableGuid
;
static
GUID
SystemUUID
=
{
0x5BC82C38
,
0x4DB6
,
0x4883
,
{
0x85
,
0x2E
,
0xE7
,
0x8D
,
0x78
,
0x0A
,
0x6F
,
0xE6
}};
static
OC_SMBIOS_DATA
SmbiosData
=
{
STATIC
GUID
SystemUUID
=
{
0x5BC82C38
,
0x4DB6
,
0x4883
,
{
0x85
,
0x2E
,
0xE7
,
0x8D
,
0x78
,
0x0A
,
0x6F
,
0xE6
}};
STATIC
UINT8
BoardType
=
0xA
;
// Motherboard (BaseBoardTypeMotherBoard)
STATIC
UINT8
MemoryFormFactor
=
0xD
;
// SODIMM, 0x9 for DIMM (MemoryFormFactorSodimm)
STATIC
UINT8
ChassisType
=
0xD
;
// All in one (MiscChassisTypeAllInOne)
STATIC
OC_SMBIOS_DATA
SmbiosData
=
{
.
BIOSVendor
=
NULL
,
// Do not change BIOS Vendor
.
BIOSVersion
=
"134.0.0.0.0"
,
.
BIOSReleaseDate
=
"12/08/2017"
,
...
...
@@ -72,19 +75,20 @@ static OC_SMBIOS_DATA SmbiosData = {
.
BoardSerialNumber
=
"SU77PEPELATZWAFFE"
,
.
BoardAssetTag
=
""
,
.
BoardLocationInChassis
=
"Part Component"
,
.
BoardType
=
0xA
,
// Motherboard (BaseBoardTypeMotherBoard)
.
MemoryFormFactor
=
0xD
,
// SODIMM, 0x9 for DIMM (MemoryFormFactorSodimm)
.
ChassisType
=
0xD
,
// All in one (MiscChassisTypeAllInOne)
.
BoardType
=
&
BoardType
,
.
MemoryFormFactor
=
&
MemoryFormFactor
,
.
ChassisType
=
&
ChassisType
,
.
ChassisManufacturer
=
NULL
,
// Do not change Chassis Manufacturer
.
ChassisVersion
=
"Mac-27ADBB7B4CEE8E61"
,
.
ChassisSerialNumber
=
"SU77OPENCORE"
,
.
ChassisAssetTag
=
"iMac-Aluminum"
,
.
FirmwareFeatures
=
0xE00FE137
,
.
FirmwareFeaturesMask
=
0xFF1FFF3F
,
.
ProcessorType
=
0
,
// Will be calculated automatically
.
ProcessorType
=
NULL
,
// Will be calculated automatically
.
PlatformFeature
=
1
};
bool
doDump
=
false
;
_Thread_local
uint32_t
externalUsedPages
=
0
;
_Thread_local
uint8_t
externalBlob
[
EFI_PAGE_SIZE
*
TOTAL_PAGES
];
...
...
@@ -131,9 +135,13 @@ int main(int argc, char** argv) {
gSmbios3
.
TableAddress
=
(
uintptr_t
)
b
;
gSmbios3
.
EntryPointLength
=
sizeof
(
SMBIOS_TABLE_3_0_ENTRY_POINT
);
OC_CPU_INFO
CpuInfo
;
OcCpuScanProcessor
(
&
CpuInfo
);
CreateSmbios
(
&
SmbiosData
,
0
0
,
&
CpuInfo
);
return
0
;
...
...
@@ -150,9 +158,13 @@ INT32 LLVMFuzzerTestOneInput(CONST UINT8 *Data, UINTN Size) {
gSmbios3
.
TableAddress
=
(
uintptr_t
)
NewData
;
gSmbios3
.
EntryPointLength
=
sizeof
(
SMBIOS_TABLE_3_0_ENTRY_POINT
);
OC_CPU_INFO
CpuInfo
;
OcCpuScanProcessor
(
&
CpuInfo
);
CreateSmbios
(
&
SmbiosData
,
0
0
,
&
CpuInfo
);
FreePool
(
NewData
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录