Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
3fd32f9e
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
3fd32f9e
编写于
9月 01, 2017
作者:
C
Corey Minyard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ipmi: Convert IPMI GUID over to Linux guid_t
Signed-off-by:
N
Corey Minyard
<
cminyard@mvista.com
>
上级
31b0b073
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
27 deletion
+23
-27
drivers/char/ipmi/ipmi_msghandler.c
drivers/char/ipmi/ipmi_msghandler.c
+23
-27
未找到文件。
drivers/char/ipmi/ipmi_msghandler.c
浏览文件 @
3fd32f9e
...
...
@@ -48,6 +48,7 @@
#include <linux/interrupt.h>
#include <linux/moduleparam.h>
#include <linux/workqueue.h>
#include <linux/uuid.h>
#define PFX "IPMI message handler: "
...
...
@@ -286,8 +287,8 @@ struct bmc_device {
int
dyn_id_set
;
unsigned
long
dyn_id_expiry
;
struct
mutex
dyn_mutex
;
/* Protects id, intfs, & dyn* */
u8
guid
[
16
]
;
u8
fetch_guid
[
16
]
;
guid_t
guid
;
guid_t
fetch_guid
;
int
dyn_guid_set
;
struct
kref
usecount
;
struct
work_struct
remove_work
;
...
...
@@ -296,7 +297,7 @@ struct bmc_device {
static
int
bmc_get_device_id
(
ipmi_smi_t
intf
,
struct
bmc_device
*
bmc
,
struct
ipmi_device_id
*
id
,
bool
*
guid_set
,
u8
*
guid
);
bool
*
guid_set
,
guid_t
*
guid
);
/*
* Various statistics for IPMI, these index stats[] in the ipmi_smi
...
...
@@ -560,7 +561,7 @@ static void __get_guid(ipmi_smi_t intf);
static
void
__ipmi_bmc_unregister
(
ipmi_smi_t
intf
);
static
int
__ipmi_bmc_register
(
ipmi_smi_t
intf
,
struct
ipmi_device_id
*
id
,
bool
guid_set
,
u8
*
guid
,
int
intf_num
);
bool
guid_set
,
guid_t
*
guid
,
int
intf_num
);
static
int
__scan_channels
(
ipmi_smi_t
intf
,
struct
ipmi_device_id
*
id
);
...
...
@@ -2224,7 +2225,7 @@ static int __get_device_id(ipmi_smi_t intf, struct bmc_device *bmc)
*/
static
int
__bmc_get_device_id
(
ipmi_smi_t
intf
,
struct
bmc_device
*
bmc
,
struct
ipmi_device_id
*
id
,
bool
*
guid_set
,
u8
*
guid
,
int
intf_num
)
bool
*
guid_set
,
guid_t
*
guid
,
int
intf_num
)
{
int
rv
=
0
;
int
prev_dyn_id_set
,
prev_guid_set
;
...
...
@@ -2277,23 +2278,23 @@ static int __bmc_get_device_id(ipmi_smi_t intf, struct bmc_device *bmc,
||
(
!
prev_guid_set
&&
bmc
->
dyn_guid_set
)
||
(
!
prev_dyn_id_set
&&
bmc
->
dyn_id_set
)
||
(
prev_guid_set
&&
bmc
->
dyn_guid_set
&&
memcmp
(
bmc
->
guid
,
bmc
->
fetch_guid
,
16
))
&&
!
guid_equal
(
&
bmc
->
guid
,
&
bmc
->
fetch_guid
))
||
bmc
->
id
.
device_id
!=
bmc
->
fetch_id
.
device_id
||
bmc
->
id
.
manufacturer_id
!=
bmc
->
fetch_id
.
manufacturer_id
||
bmc
->
id
.
product_id
!=
bmc
->
fetch_id
.
product_id
)
{
struct
ipmi_device_id
id
=
bmc
->
fetch_id
;
int
guid_set
=
bmc
->
dyn_guid_set
;
u8
guid
[
16
]
;
guid_t
guid
;
memcpy
(
guid
,
bmc
->
fetch_guid
,
16
)
;
guid
=
bmc
->
fetch_guid
;
mutex_unlock
(
&
bmc
->
dyn_mutex
);
__ipmi_bmc_unregister
(
intf
);
/* Fill in the temporary BMC for good measure. */
intf
->
bmc
->
id
=
id
;
intf
->
bmc
->
dyn_guid_set
=
guid_set
;
memcpy
(
intf
->
bmc
->
guid
,
guid
,
16
)
;
if
(
__ipmi_bmc_register
(
intf
,
&
id
,
guid_set
,
guid
,
intf_num
))
intf
->
bmc
->
guid
=
guid
;
if
(
__ipmi_bmc_register
(
intf
,
&
id
,
guid_set
,
&
guid
,
intf_num
))
need_waiter
(
intf
);
/* Retry later on an error. */
else
__scan_channels
(
intf
,
&
id
);
...
...
@@ -2328,7 +2329,7 @@ static int __bmc_get_device_id(ipmi_smi_t intf, struct bmc_device *bmc,
if
(
!
rv
)
{
bmc
->
id
=
bmc
->
fetch_id
;
if
(
bmc
->
dyn_guid_set
)
memcpy
(
bmc
->
guid
,
bmc
->
fetch_guid
,
16
)
;
bmc
->
guid
=
bmc
->
fetch_guid
;
else
if
(
prev_guid_set
)
/*
* The guid used to be valid and it failed to fetch,
...
...
@@ -2345,7 +2346,7 @@ static int __bmc_get_device_id(ipmi_smi_t intf, struct bmc_device *bmc,
*
guid_set
=
bmc
->
dyn_guid_set
;
if
(
guid
&&
bmc
->
dyn_guid_set
)
memcpy
(
guid
,
bmc
->
guid
,
16
)
;
*
guid
=
bmc
->
guid
;
}
mutex_unlock
(
&
bmc
->
dyn_mutex
);
...
...
@@ -2357,7 +2358,7 @@ static int __bmc_get_device_id(ipmi_smi_t intf, struct bmc_device *bmc,
static
int
bmc_get_device_id
(
ipmi_smi_t
intf
,
struct
bmc_device
*
bmc
,
struct
ipmi_device_id
*
id
,
bool
*
guid_set
,
u8
*
guid
)
bool
*
guid_set
,
guid_t
*
guid
)
{
return
__bmc_get_device_id
(
intf
,
bmc
,
id
,
guid_set
,
guid
,
-
1
);
}
...
...
@@ -2735,21 +2736,16 @@ static ssize_t guid_show(struct device *dev, struct device_attribute *attr,
{
struct
bmc_device
*
bmc
=
to_bmc_device
(
dev
);
bool
guid_set
;
u8
guid
[
16
]
;
guid_t
guid
;
int
rv
;
rv
=
bmc_get_device_id
(
NULL
,
bmc
,
NULL
,
&
guid_set
,
guid
);
rv
=
bmc_get_device_id
(
NULL
,
bmc
,
NULL
,
&
guid_set
,
&
guid
);
if
(
rv
)
return
rv
;
if
(
!
guid_set
)
return
-
ENOENT
;
return
snprintf
(
buf
,
100
,
"%2.2x%2.2x%2.2x%2.2x-%2.2x%2.2x-%2.2x%2.2x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x
\n
"
,
guid
[
3
],
guid
[
2
],
guid
[
1
],
guid
[
0
],
guid
[
5
],
guid
[
4
],
guid
[
7
],
guid
[
6
],
guid
[
8
],
guid
[
9
],
guid
[
10
],
guid
[
11
],
guid
[
12
],
guid
[
13
],
guid
[
14
],
guid
[
15
]);
return
snprintf
(
buf
,
38
,
"%pUl
\n
"
,
guid
.
b
);
}
static
DEVICE_ATTR
(
guid
,
S_IRUGO
,
guid_show
,
NULL
);
...
...
@@ -2806,7 +2802,7 @@ static const struct device_type bmc_device_type = {
static
int
__find_bmc_guid
(
struct
device
*
dev
,
void
*
data
)
{
unsigned
char
*
guid
=
data
;
guid_t
*
guid
=
data
;
struct
bmc_device
*
bmc
;
int
rv
;
...
...
@@ -2814,7 +2810,7 @@ static int __find_bmc_guid(struct device *dev, void *data)
return
0
;
bmc
=
to_bmc_device
(
dev
);
rv
=
bmc
->
dyn_guid_set
&&
memcmp
(
bmc
->
guid
,
guid
,
16
)
==
0
;
rv
=
bmc
->
dyn_guid_set
&&
guid_equal
(
&
bmc
->
guid
,
guid
)
;
if
(
rv
)
rv
=
kref_get_unless_zero
(
&
bmc
->
usecount
);
return
rv
;
...
...
@@ -2824,7 +2820,7 @@ static int __find_bmc_guid(struct device *dev, void *data)
* Returns with the bmc's usecount incremented, if it is non-NULL.
*/
static
struct
bmc_device
*
ipmi_find_bmc_guid
(
struct
device_driver
*
drv
,
unsigned
char
*
guid
)
guid_t
*
guid
)
{
struct
device
*
dev
;
struct
bmc_device
*
bmc
=
NULL
;
...
...
@@ -2947,7 +2943,7 @@ static void ipmi_bmc_unregister(ipmi_smi_t intf)
*/
static
int
__ipmi_bmc_register
(
ipmi_smi_t
intf
,
struct
ipmi_device_id
*
id
,
bool
guid_set
,
u8
*
guid
,
int
intf_num
)
bool
guid_set
,
guid_t
*
guid
,
int
intf_num
)
{
int
rv
;
struct
bmc_device
*
bmc
=
intf
->
bmc
;
...
...
@@ -3008,7 +3004,7 @@ static int __ipmi_bmc_register(ipmi_smi_t intf,
bmc
->
id
=
*
id
;
bmc
->
dyn_id_set
=
1
;
bmc
->
dyn_guid_set
=
guid_set
;
memcpy
(
bmc
->
guid
,
guid
,
16
)
;
bmc
->
guid
=
*
guid
;
bmc
->
dyn_id_expiry
=
jiffies
+
IPMI_DYN_DEV_ID_EXPIRY
;
bmc
->
pdev
.
name
=
"ipmi_bmc"
;
...
...
@@ -3165,7 +3161,7 @@ static void guid_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg)
goto
out
;
}
memcpy
(
bmc
->
fetch_guid
,
msg
->
msg
.
data
+
1
,
16
);
memcpy
(
bmc
->
fetch_guid
.
b
,
msg
->
msg
.
data
+
1
,
16
);
/*
* Make sure the guid data is available before setting
* dyn_guid_set.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录