Skip to content

Commit ebad3cc

Browse files
cminyardgregkh
authored andcommitted
ipmi: Add the i2c-addr property for SSIF interfaces
commit d732363 upstream. This is required for SSIF to work. There was no way to know if the interface being added was SI or SSIF from the platform data, but that was required so the i2c-addr is only added for SSIF interfaces. So add a field for that. Also rework the logic a bit so that ipmi-type is not set for SSIF interfaces, as it is not necessary for that. Fixes: 3cd83ba ("ipmi: Consolidate the adding of platform devices") Reported-by: Kamlakant Patel <kamlakantp@marvell.com> Signed-off-by: Corey Minyard <cminyard@mvista.com> Cc: stable@vger.kernel.org # 5.1 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9c52c4c commit ebad3cc

5 files changed

Lines changed: 22 additions & 12 deletions

File tree

‎drivers/char/ipmi/ipmi_dmi.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr,
4747
memset(&p, 0, sizeof(p));
4848

4949
name = "dmi-ipmi-si";
50+
p.iftype = IPMI_PLAT_IF_SI;
5051
switch (type) {
5152
case IPMI_DMI_TYPE_SSIF:
5253
name = "dmi-ipmi-ssif";
54+
p.iftype = IPMI_PLAT_IF_SSIF;
5355
p.type = SI_TYPE_INVALID;
5456
break;
5557
case IPMI_DMI_TYPE_BT:

‎drivers/char/ipmi/ipmi_plat_data.c‎

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct platform_device *ipmi_platform_add(const char *name, unsigned int inst,
1212
struct ipmi_plat_data *p)
1313
{
1414
struct platform_device *pdev;
15-
unsigned int num_r = 1, size, pidx = 0;
15+
unsigned int num_r = 1, size = 0, pidx = 0;
1616
struct resource r[4];
1717
struct property_entry pr[6];
1818
u32 flags;
@@ -21,19 +21,22 @@ struct platform_device *ipmi_platform_add(const char *name, unsigned int inst,
2121
memset(pr, 0, sizeof(pr));
2222
memset(r, 0, sizeof(r));
2323

24-
if (p->type == SI_BT)
25-
size = 3;
26-
else if (p->type == SI_TYPE_INVALID)
27-
size = 0;
28-
else
29-
size = 2;
24+
if (p->iftype == IPMI_PLAT_IF_SI) {
25+
if (p->type == SI_BT)
26+
size = 3;
27+
else if (p->type != SI_TYPE_INVALID)
28+
size = 2;
29+
30+
if (p->regsize == 0)
31+
p->regsize = DEFAULT_REGSIZE;
32+
if (p->regspacing == 0)
33+
p->regspacing = p->regsize;
3034

31-
if (p->regsize == 0)
32-
p->regsize = DEFAULT_REGSIZE;
33-
if (p->regspacing == 0)
34-
p->regspacing = p->regsize;
35+
pr[pidx++] = PROPERTY_ENTRY_U8("ipmi-type", p->type);
36+
} else if (p->iftype == IPMI_PLAT_IF_SSIF) {
37+
pr[pidx++] = PROPERTY_ENTRY_U16("i2c-addr", p->addr);
38+
}
3539

36-
pr[pidx++] = PROPERTY_ENTRY_U8("ipmi-type", p->type);
3740
if (p->slave_addr)
3841
pr[pidx++] = PROPERTY_ENTRY_U8("slave-addr", p->slave_addr);
3942
pr[pidx++] = PROPERTY_ENTRY_U8("addr-source", p->addr_source);

‎drivers/char/ipmi/ipmi_plat_data.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

77
#include <linux/ipmi.h>
88

9+
enum ipmi_plat_interface_type { IPMI_PLAT_IF_SI, IPMI_PLAT_IF_SSIF };
10+
911
struct ipmi_plat_data {
12+
enum ipmi_plat_interface_type iftype;
1013
unsigned int type; /* si_type for si, SI_INVALID for others */
1114
unsigned int space; /* addr_space for si, intf# for ssif. */
1215
unsigned long addr;

‎drivers/char/ipmi/ipmi_si_hardcode.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ static void __init ipmi_hardcode_init_one(const char *si_type_str,
8383

8484
memset(&p, 0, sizeof(p));
8585

86+
p.iftype = IPMI_PLAT_IF_SI;
8687
if (!si_type_str || !*si_type_str || strcmp(si_type_str, "kcs") == 0) {
8788
p.type = SI_KCS;
8889
} else if (strcmp(si_type_str, "smic") == 0) {

‎drivers/char/ipmi/ipmi_si_hotmod.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ static int parse_hotmod_str(const char *curr, enum hotmod_op *op,
108108
int rv;
109109
unsigned int ival;
110110

111+
h->iftype = IPMI_PLAT_IF_SI;
111112
rv = parse_str(hotmod_ops, &ival, "operation", &curr);
112113
if (rv)
113114
return rv;

0 commit comments

Comments
 (0)