Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
7a453308
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看板
提交
7a453308
编写于
9月 12, 2017
作者:
C
Corey Minyard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ipmi_si: Move hardcode handling to a separate file.
Signed-off-by:
N
Corey Minyard
<
cminyard@mvista.com
>
上级
44814ec9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
154 addition
and
147 deletion
+154
-147
drivers/char/ipmi/Makefile
drivers/char/ipmi/Makefile
+1
-1
drivers/char/ipmi/ipmi_si.h
drivers/char/ipmi/ipmi_si.h
+1
-0
drivers/char/ipmi/ipmi_si_hardcode.c
drivers/char/ipmi/ipmi_si_hardcode.c
+146
-0
drivers/char/ipmi/ipmi_si_intf.c
drivers/char/ipmi/ipmi_si_intf.c
+6
-146
未找到文件。
drivers/char/ipmi/Makefile
浏览文件 @
7a453308
...
...
@@ -3,7 +3,7 @@
#
ipmi_si-y
:=
ipmi_si_intf.o ipmi_kcs_sm.o ipmi_smic_sm.o ipmi_bt_sm.o
\
ipmi_si_hotmod.o
ipmi_si_hotmod.o
ipmi_si_hardcode.o
obj-$(CONFIG_IPMI_HANDLER)
+=
ipmi_msghandler.o
obj-$(CONFIG_IPMI_DEVICE_INTERFACE)
+=
ipmi_devintf.o
...
...
drivers/char/ipmi/ipmi_si.h
浏览文件 @
7a453308
...
...
@@ -22,3 +22,4 @@ void ipmi_irq_finish_setup(struct si_sm_io *io);
int
ipmi_si_remove_by_dev
(
struct
device
*
dev
);
void
ipmi_si_remove_by_data
(
int
addr_space
,
enum
si_type
si_type
,
unsigned
long
addr
);
int
ipmi_si_hardcode_find_bmc
(
void
);
drivers/char/ipmi/ipmi_si_hardcode.c
0 → 100644
浏览文件 @
7a453308
#include <linux/moduleparam.h>
#include "ipmi_si.h"
#define PFX "ipmi_hardcode: "
/*
* There can be 4 IO ports passed in (with or without IRQs), 4 addresses,
* a default IO port, and 1 ACPI/SPMI address. That sets SI_MAX_DRIVERS.
*/
#define SI_MAX_PARMS 4
static
char
*
si_type
[
SI_MAX_PARMS
];
#define MAX_SI_TYPE_STR 30
static
char
si_type_str
[
MAX_SI_TYPE_STR
];
static
unsigned
long
addrs
[
SI_MAX_PARMS
];
static
unsigned
int
num_addrs
;
static
unsigned
int
ports
[
SI_MAX_PARMS
];
static
unsigned
int
num_ports
;
static
int
irqs
[
SI_MAX_PARMS
];
static
unsigned
int
num_irqs
;
static
int
regspacings
[
SI_MAX_PARMS
];
static
unsigned
int
num_regspacings
;
static
int
regsizes
[
SI_MAX_PARMS
];
static
unsigned
int
num_regsizes
;
static
int
regshifts
[
SI_MAX_PARMS
];
static
unsigned
int
num_regshifts
;
static
int
slave_addrs
[
SI_MAX_PARMS
];
/* Leaving 0 chooses the default value */
static
unsigned
int
num_slave_addrs
;
module_param_string
(
type
,
si_type_str
,
MAX_SI_TYPE_STR
,
0
);
MODULE_PARM_DESC
(
type
,
"Defines the type of each interface, each"
" interface separated by commas. The types are 'kcs',"
" 'smic', and 'bt'. For example si_type=kcs,bt will set"
" the first interface to kcs and the second to bt"
);
module_param_hw_array
(
addrs
,
ulong
,
iomem
,
&
num_addrs
,
0
);
MODULE_PARM_DESC
(
addrs
,
"Sets the memory address of each interface, the"
" addresses separated by commas. Only use if an interface"
" is in memory. Otherwise, set it to zero or leave"
" it blank."
);
module_param_hw_array
(
ports
,
uint
,
ioport
,
&
num_ports
,
0
);
MODULE_PARM_DESC
(
ports
,
"Sets the port address of each interface, the"
" addresses separated by commas. Only use if an interface"
" is a port. Otherwise, set it to zero or leave"
" it blank."
);
module_param_hw_array
(
irqs
,
int
,
irq
,
&
num_irqs
,
0
);
MODULE_PARM_DESC
(
irqs
,
"Sets the interrupt of each interface, the"
" addresses separated by commas. Only use if an interface"
" has an interrupt. Otherwise, set it to zero or leave"
" it blank."
);
module_param_hw_array
(
regspacings
,
int
,
other
,
&
num_regspacings
,
0
);
MODULE_PARM_DESC
(
regspacings
,
"The number of bytes between the start address"
" and each successive register used by the interface. For"
" instance, if the start address is 0xca2 and the spacing"
" is 2, then the second address is at 0xca4. Defaults"
" to 1."
);
module_param_hw_array
(
regsizes
,
int
,
other
,
&
num_regsizes
,
0
);
MODULE_PARM_DESC
(
regsizes
,
"The size of the specific IPMI register in bytes."
" This should generally be 1, 2, 4, or 8 for an 8-bit,"
" 16-bit, 32-bit, or 64-bit register. Use this if you"
" the 8-bit IPMI register has to be read from a larger"
" register."
);
module_param_hw_array
(
regshifts
,
int
,
other
,
&
num_regshifts
,
0
);
MODULE_PARM_DESC
(
regshifts
,
"The amount to shift the data read from the."
" IPMI register, in bits. For instance, if the data"
" is read from a 32-bit word and the IPMI data is in"
" bit 8-15, then the shift would be 8"
);
module_param_hw_array
(
slave_addrs
,
int
,
other
,
&
num_slave_addrs
,
0
);
MODULE_PARM_DESC
(
slave_addrs
,
"Set the default IPMB slave address for"
" the controller. Normally this is 0x20, but can be"
" overridden by this parm. This is an array indexed"
" by interface number."
);
int
ipmi_si_hardcode_find_bmc
(
void
)
{
int
ret
=
-
ENODEV
;
int
i
;
struct
si_sm_io
io
;
char
*
str
;
/* Parse out the si_type string into its components. */
str
=
si_type_str
;
if
(
*
str
!=
'\0'
)
{
for
(
i
=
0
;
(
i
<
SI_MAX_PARMS
)
&&
(
*
str
!=
'\0'
);
i
++
)
{
si_type
[
i
]
=
str
;
str
=
strchr
(
str
,
','
);
if
(
str
)
{
*
str
=
'\0'
;
str
++
;
}
else
{
break
;
}
}
}
memset
(
&
io
,
0
,
sizeof
(
io
));
for
(
i
=
0
;
i
<
SI_MAX_PARMS
;
i
++
)
{
if
(
!
ports
[
i
]
&&
!
addrs
[
i
])
continue
;
io
.
addr_source
=
SI_HARDCODED
;
pr_info
(
PFX
"probing via hardcoded address
\n
"
);
if
(
!
si_type
[
i
]
||
strcmp
(
si_type
[
i
],
"kcs"
)
==
0
)
{
io
.
si_type
=
SI_KCS
;
}
else
if
(
strcmp
(
si_type
[
i
],
"smic"
)
==
0
)
{
io
.
si_type
=
SI_SMIC
;
}
else
if
(
strcmp
(
si_type
[
i
],
"bt"
)
==
0
)
{
io
.
si_type
=
SI_BT
;
}
else
{
pr_warn
(
PFX
"Interface type specified for interface %d, was invalid: %s
\n
"
,
i
,
si_type
[
i
]);
continue
;
}
if
(
ports
[
i
])
{
/* An I/O port */
io
.
addr_data
=
ports
[
i
];
io
.
addr_type
=
IPMI_IO_ADDR_SPACE
;
}
else
if
(
addrs
[
i
])
{
/* A memory port */
io
.
addr_data
=
addrs
[
i
];
io
.
addr_type
=
IPMI_MEM_ADDR_SPACE
;
}
else
{
pr_warn
(
PFX
"Interface type specified for interface %d, but port and address were not set or set to zero.
\n
"
,
i
);
continue
;
}
io
.
addr
=
NULL
;
io
.
regspacing
=
regspacings
[
i
];
if
(
!
io
.
regspacing
)
io
.
regspacing
=
DEFAULT_REGSPACING
;
io
.
regsize
=
regsizes
[
i
];
if
(
!
io
.
regsize
)
io
.
regsize
=
DEFAULT_REGSIZE
;
io
.
regshift
=
regshifts
[
i
];
io
.
irq
=
irqs
[
i
];
if
(
io
.
irq
)
io
.
irq_setup
=
ipmi_std_irq_setup
;
io
.
slave_addr
=
slave_addrs
[
i
];
ret
=
ipmi_si_add_smi
(
&
io
);
}
return
ret
;
}
drivers/char/ipmi/ipmi_si_intf.c
浏览文件 @
7a453308
...
...
@@ -291,9 +291,8 @@ struct smi_info {
#define smi_get_stat(smi, stat) \
((unsigned int) atomic_read(&(smi)->stats[SI_STAT_ ## stat]))
#define SI_MAX_PARMS 4
static
int
force_kipmid
[
SI_MAX_PARMS
];
#define IPMI_MAX_INTFS 4
static
int
force_kipmid
[
IPMI_MAX_INTFS
];
static
int
num_force_kipmid
;
#ifdef CONFIG_PCI
static
bool
pci_registered
;
...
...
@@ -302,7 +301,7 @@ static bool pci_registered;
static
bool
parisc_registered
;
#endif
static
unsigned
int
kipmid_max_busy_us
[
SI_MAX_PARM
S
];
static
unsigned
int
kipmid_max_busy_us
[
IPMI_MAX_INTF
S
];
static
int
num_max_busy_us
;
static
bool
unload_when_empty
=
true
;
...
...
@@ -1271,11 +1270,6 @@ static const struct ipmi_smi_handlers handlers = {
.
poll
=
poll
,
};
/*
* There can be 4 IO ports passed in (with or without IRQs), 4 addresses,
* a default IO port, and 1 ACPI/SPMI address. That sets SI_MAX_DRIVERS.
*/
static
LIST_HEAD
(
smi_infos
);
static
DEFINE_MUTEX
(
smi_infos_lock
);
static
int
smi_num
;
/* Used to sequence the SMIs */
...
...
@@ -1290,23 +1284,6 @@ static bool si_tryplatform = true;
#ifdef CONFIG_PCI
static
bool
si_trypci
=
true
;
#endif
static
char
*
si_type
[
SI_MAX_PARMS
];
#define MAX_SI_TYPE_STR 30
static
char
si_type_str
[
MAX_SI_TYPE_STR
];
static
unsigned
long
addrs
[
SI_MAX_PARMS
];
static
unsigned
int
num_addrs
;
static
unsigned
int
ports
[
SI_MAX_PARMS
];
static
unsigned
int
num_ports
;
static
int
irqs
[
SI_MAX_PARMS
];
static
unsigned
int
num_irqs
;
static
int
regspacings
[
SI_MAX_PARMS
];
static
unsigned
int
num_regspacings
;
static
int
regsizes
[
SI_MAX_PARMS
];
static
unsigned
int
num_regsizes
;
static
int
regshifts
[
SI_MAX_PARMS
];
static
unsigned
int
num_regshifts
;
static
int
slave_addrs
[
SI_MAX_PARMS
];
/* Leaving 0 chooses the default value */
static
unsigned
int
num_slave_addrs
;
static
const
char
*
const
addr_space_to_str
[]
=
{
"i/o"
,
"mem"
};
...
...
@@ -1329,48 +1306,6 @@ module_param_named(trypci, si_trypci, bool, 0);
MODULE_PARM_DESC
(
trypci
,
"Setting this to zero will disable the"
" default scan of the interfaces identified via pci"
);
#endif
module_param_string
(
type
,
si_type_str
,
MAX_SI_TYPE_STR
,
0
);
MODULE_PARM_DESC
(
type
,
"Defines the type of each interface, each"
" interface separated by commas. The types are 'kcs',"
" 'smic', and 'bt'. For example si_type=kcs,bt will set"
" the first interface to kcs and the second to bt"
);
module_param_hw_array
(
addrs
,
ulong
,
iomem
,
&
num_addrs
,
0
);
MODULE_PARM_DESC
(
addrs
,
"Sets the memory address of each interface, the"
" addresses separated by commas. Only use if an interface"
" is in memory. Otherwise, set it to zero or leave"
" it blank."
);
module_param_hw_array
(
ports
,
uint
,
ioport
,
&
num_ports
,
0
);
MODULE_PARM_DESC
(
ports
,
"Sets the port address of each interface, the"
" addresses separated by commas. Only use if an interface"
" is a port. Otherwise, set it to zero or leave"
" it blank."
);
module_param_hw_array
(
irqs
,
int
,
irq
,
&
num_irqs
,
0
);
MODULE_PARM_DESC
(
irqs
,
"Sets the interrupt of each interface, the"
" addresses separated by commas. Only use if an interface"
" has an interrupt. Otherwise, set it to zero or leave"
" it blank."
);
module_param_hw_array
(
regspacings
,
int
,
other
,
&
num_regspacings
,
0
);
MODULE_PARM_DESC
(
regspacings
,
"The number of bytes between the start address"
" and each successive register used by the interface. For"
" instance, if the start address is 0xca2 and the spacing"
" is 2, then the second address is at 0xca4. Defaults"
" to 1."
);
module_param_hw_array
(
regsizes
,
int
,
other
,
&
num_regsizes
,
0
);
MODULE_PARM_DESC
(
regsizes
,
"The size of the specific IPMI register in bytes."
" This should generally be 1, 2, 4, or 8 for an 8-bit,"
" 16-bit, 32-bit, or 64-bit register. Use this if you"
" the 8-bit IPMI register has to be read from a larger"
" register."
);
module_param_hw_array
(
regshifts
,
int
,
other
,
&
num_regshifts
,
0
);
MODULE_PARM_DESC
(
regshifts
,
"The amount to shift the data read from the."
" IPMI register, in bits. For instance, if the data"
" is read from a 32-bit word and the IPMI data is in"
" bit 8-15, then the shift would be 8"
);
module_param_hw_array
(
slave_addrs
,
int
,
other
,
&
num_slave_addrs
,
0
);
MODULE_PARM_DESC
(
slave_addrs
,
"Set the default IPMB slave address for"
" the controller. Normally this is 0x20, but can be"
" overridden by this parm. This is an array indexed"
" by interface number."
);
module_param_array
(
force_kipmid
,
int
,
&
num_force_kipmid
,
0
);
MODULE_PARM_DESC
(
force_kipmid
,
"Force the kipmi daemon to be enabled (1) or"
" disabled(0). Normally the IPMI driver auto-detects"
...
...
@@ -1691,64 +1626,6 @@ static struct smi_info *smi_info_alloc(void)
return
info
;
}
static
int
hardcode_find_bmc
(
void
)
{
int
ret
=
-
ENODEV
;
int
i
;
struct
si_sm_io
io
;
memset
(
&
io
,
0
,
sizeof
(
io
));
for
(
i
=
0
;
i
<
SI_MAX_PARMS
;
i
++
)
{
if
(
!
ports
[
i
]
&&
!
addrs
[
i
])
continue
;
io
.
addr_source
=
SI_HARDCODED
;
pr_info
(
PFX
"probing via hardcoded address
\n
"
);
if
(
!
si_type
[
i
]
||
strcmp
(
si_type
[
i
],
"kcs"
)
==
0
)
{
io
.
si_type
=
SI_KCS
;
}
else
if
(
strcmp
(
si_type
[
i
],
"smic"
)
==
0
)
{
io
.
si_type
=
SI_SMIC
;
}
else
if
(
strcmp
(
si_type
[
i
],
"bt"
)
==
0
)
{
io
.
si_type
=
SI_BT
;
}
else
{
pr_warn
(
PFX
"Interface type specified for interface %d, was invalid: %s
\n
"
,
i
,
si_type
[
i
]);
continue
;
}
if
(
ports
[
i
])
{
/* An I/O port */
io
.
addr_data
=
ports
[
i
];
io
.
addr_type
=
IPMI_IO_ADDR_SPACE
;
}
else
if
(
addrs
[
i
])
{
/* A memory port */
io
.
addr_data
=
addrs
[
i
];
io
.
addr_type
=
IPMI_MEM_ADDR_SPACE
;
}
else
{
pr_warn
(
PFX
"Interface type specified for interface %d, but port and address were not set or set to zero.
\n
"
,
i
);
continue
;
}
io
.
addr
=
NULL
;
io
.
regspacing
=
regspacings
[
i
];
if
(
!
io
.
regspacing
)
io
.
regspacing
=
DEFAULT_REGSPACING
;
io
.
regsize
=
regsizes
[
i
];
if
(
!
io
.
regsize
)
io
.
regsize
=
DEFAULT_REGSIZE
;
io
.
regshift
=
regshifts
[
i
];
io
.
irq
=
irqs
[
i
];
if
(
io
.
irq
)
io
.
irq_setup
=
ipmi_std_irq_setup
;
io
.
slave_addr
=
slave_addrs
[
i
];
ret
=
ipmi_si_add_smi
(
&
io
);
}
return
ret
;
}
#ifdef CONFIG_ACPI
/*
...
...
@@ -3349,8 +3226,6 @@ static int try_smi_init(struct smi_info *new_smi)
static
int
init_ipmi_si
(
void
)
{
int
i
;
char
*
str
;
int
rv
;
struct
smi_info
*
e
;
enum
ipmi_addr_src
type
=
SI_INVALID
;
...
...
@@ -3366,26 +3241,11 @@ static int init_ipmi_si(void)
}
}
/* Parse out the si_type string into its components. */
str
=
si_type_str
;
if
(
*
str
!=
'\0'
)
{
for
(
i
=
0
;
(
i
<
SI_MAX_PARMS
)
&&
(
*
str
!=
'\0'
);
i
++
)
{
si_type
[
i
]
=
str
;
str
=
strchr
(
str
,
','
);
if
(
str
)
{
*
str
=
'\0'
;
str
++
;
}
else
{
break
;
}
}
}
pr_info
(
"IPMI System Interface driver.
\n
"
);
/* If the user gave us a device, they presumably want us to use it */
if
(
!
hardcode_find_bmc
())
return
0
;
if
(
!
ipmi_si_
hardcode_find_bmc
())
goto
do_scan
;
#ifdef CONFIG_PCI
if
(
si_trypci
)
{
...
...
@@ -3411,7 +3271,7 @@ static int init_ipmi_si(void)
with multiple BMCs we assume that there will be several instances
of a given type so if we succeed in registering a type then also
try to register everything else of the same type */
do_scan:
mutex_lock
(
&
smi_infos_lock
);
list_for_each_entry
(
e
,
&
smi_infos
,
link
)
{
/* Try to register a device if it has an IRQ and we either
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录