Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
OpenCorePKG_MOD
提交
1672d8fb
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,发现更多精彩内容 >>
提交
1672d8fb
编写于
2月 07, 2019
作者:
V
vit9696
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add AppleMajorType to CPU_INFO
上级
8ea219ed
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
66 addition
and
9 deletion
+66
-9
Include/Library/OcCpuLib.h
Include/Library/OcCpuLib.h
+4
-3
Library/OcCpuLib/OcCpuLib.c
Library/OcCpuLib/OcCpuLib.c
+61
-6
Library/OcCpuLib/OcCpuLib.inf
Library/OcCpuLib/OcCpuLib.inf
+1
-0
未找到文件。
Include/Library/OcCpuLib.h
浏览文件 @
1672d8fb
...
...
@@ -12,8 +12,8 @@
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef OC_CPU_LIB_H
_
#define OC_CPU_LIB_H
_
#ifndef OC_CPU_LIB_H
#define OC_CPU_LIB_H
// CPU_INFO
typedef
struct
{
...
...
@@ -30,6 +30,7 @@ typedef struct {
UINT64
ExtFeatures
;
UINT32
Signature
;
UINT8
Brand
;
UINT8
AppleMajorType
;
UINT32
MaxExtId
;
...
...
@@ -60,7 +61,7 @@ typedef struct {
**/
EFI_STATUS
OcCpuScanProcessor
(
IN
CPU_INFO
*
Platform
IN
OUT
CPU_INFO
*
Cpu
);
#endif // OC_CPU_LIB_H_
Library/OcCpuLib/OcCpuLib.c
浏览文件 @
1672d8fb
...
...
@@ -17,6 +17,7 @@
#include <IndustryStandard/CpuId.h>
#include <IndustryStandard/GenericIch.h>
#include <IndustryStandard/Pci.h>
#include <IndustryStandard/AppleSmBios.h>
#include <Protocol/PciIo.h>
...
...
@@ -27,6 +28,7 @@
#include <Library/IoLib.h>
#include <Library/OcCpuLib.h>
#include <Library/PciLib.h>
#include <Library/OcStringLib.h>
#include <Library/OcTimerLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
...
...
@@ -44,16 +46,17 @@
**/
EFI_STATUS
OcCpuScanProcessor
(
IN
CPU_INFO
*
Cpu
IN
OUT
CPU_INFO
*
Cpu
)
{
EFI_STATUS
Status
;
UINT32
CpuidEax
;
UINT32
CpuidEbx
;
UINT32
CpuidEcx
;
UINT32
CpuidEdx
;
UINT64
Msr
=
0
;
UINT32
CpuidEax
;
UINT32
CpuidEbx
;
UINT32
CpuidEcx
;
UINT32
CpuidEdx
;
UINT64
Msr
=
0
;
CONST
CHAR8
*
BrandInfix
;
DEBUG_FUNCTION_ENTRY
(
DEBUG_VERBOSE
);
...
...
@@ -133,6 +136,58 @@ OcCpuScanProcessor (
if
(
*
(
UINT32
*
)
Cpu
->
Vendor
==
CPUID_VENDOR_INTEL
)
{
BrandInfix
=
AsciiStrStr
(
Cpu
->
BrandString
,
"Core"
);
if
(
BrandInfix
!=
NULL
)
{
while
((
*
BrandInfix
!=
' '
)
&&
(
*
BrandInfix
!=
'\0'
))
{
++
BrandInfix
;
}
while
(
*
BrandInfix
==
' '
)
{
++
BrandInfix
;
}
if
(
AsciiStrnCmp
(
BrandInfix
,
"i7"
,
L_STR_LEN
(
"i7"
))
==
0
)
{
Cpu
->
AppleMajorType
=
AppleProcessorMajorI7
;
}
else
if
(
AsciiStrnCmp
(
BrandInfix
,
"i5"
,
L_STR_LEN
(
"i5"
))
==
0
)
{
Cpu
->
AppleMajorType
=
AppleProcessorMajorI5
;
}
else
if
(
AsciiStrnCmp
(
BrandInfix
,
"i3"
,
L_STR_LEN
(
"i3"
))
==
0
)
{
Cpu
->
AppleMajorType
=
AppleProcessorMajorI3
;
}
else
if
(
AsciiStrnCmp
(
BrandInfix
,
"i9"
,
L_STR_LEN
(
"i9"
))
==
0
)
{
Cpu
->
AppleMajorType
=
AppleProcessorMajorI9
;
}
else
if
(
AsciiStrnCmp
(
BrandInfix
,
"m3"
,
L_STR_LEN
(
"m3"
))
==
0
)
{
Cpu
->
AppleMajorType
=
AppleProcessorMajorM3
;
}
else
if
(
AsciiStrnCmp
(
BrandInfix
,
"m5"
,
L_STR_LEN
(
"m5"
))
==
0
)
{
Cpu
->
AppleMajorType
=
AppleProcessorMajorM5
;
}
else
if
(
AsciiStrnCmp
(
BrandInfix
,
"m7"
,
L_STR_LEN
(
"m7"
))
==
0
)
{
Cpu
->
AppleMajorType
=
AppleProcessorMajorM7
;
}
else
if
(
AsciiStrnCmp
(
BrandInfix
,
"M"
,
L_STR_LEN
(
"M"
))
==
0
)
{
Cpu
->
AppleMajorType
=
AppleProcessorMajorM
;
}
else
if
(
AsciiStrnCmp
(
BrandInfix
,
"2 Duo"
,
L_STR_LEN
(
"2 Duo"
))
==
0
)
{
Cpu
->
AppleMajorType
=
AppleProcessorMajorCore2
;
}
else
{
Cpu
->
AppleMajorType
=
AppleProcessorMajorCore
;
}
}
else
{
BrandInfix
=
AsciiStrStr
(
Cpu
->
BrandString
,
"Xeon"
);
if
(
BrandInfix
!=
NULL
)
{
while
((
*
BrandInfix
!=
' '
)
&&
(
*
BrandInfix
!=
'\0'
))
{
++
BrandInfix
;
}
while
(
*
BrandInfix
==
' '
)
{
++
BrandInfix
;
}
if
(
AsciiStrnCmp
(
BrandInfix
,
"E5"
,
L_STR_LEN
(
"E5"
))
==
0
)
{
Cpu
->
AppleMajorType
=
AppleProcessorMajorXeonE5
;
}
else
if
(
AsciiStrnCmp
(
BrandInfix
,
"W"
,
L_STR_LEN
(
"W"
))
==
0
)
{
Cpu
->
AppleMajorType
=
AppleProcessorMajorXeonW
;
}
else
{
Cpu
->
AppleMajorType
=
AppleProcessorMajorXeonNehalem
;
}
}
}
Msr
=
AsmReadMsr64
(
MSR_PKG_CST_CONFIG_CONTROL
);
if
((
Cpu
->
Family
==
0x06
&&
Cpu
->
Model
>=
0x0c
)
||
...
...
Library/OcCpuLib/OcCpuLib.inf
浏览文件 @
1672d8fb
...
...
@@ -31,6 +31,7 @@
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
UefiCpuPkg/UefiCpuPkg.dec
EfiPkg/EfiPkg.dec
[LibraryClasses]
BaseLib
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录