ipmi: Move lun and address out of channel struct

Put it in it's own struct, getting ready for channel information
being dynamically changed.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
This commit is contained in:
Corey Minyard 2017-09-05 15:50:12 -05:00
parent c0734bd594
commit 5fdb1fb2ab
1 changed files with 25 additions and 22 deletions

View File

@ -245,7 +245,9 @@ struct seq_table {
struct ipmi_channel { struct ipmi_channel {
unsigned char medium; unsigned char medium;
unsigned char protocol; unsigned char protocol;
};
struct ipmi_my_addrinfo {
/* /*
* My slave address. This is initialized to IPMI_BMC_SLAVE_ADDR, * My slave address. This is initialized to IPMI_BMC_SLAVE_ADDR,
* but may be changed by the user. * but may be changed by the user.
@ -530,6 +532,7 @@ struct ipmi_smi {
/* Channel information */ /* Channel information */
struct ipmi_channel channels[IPMI_MAX_CHANNELS]; struct ipmi_channel channels[IPMI_MAX_CHANNELS];
struct ipmi_my_addrinfo addrinfo[IPMI_MAX_CHANNELS];
/* Proc FS stuff. */ /* Proc FS stuff. */
struct proc_dir_entry *proc_dir; struct proc_dir_entry *proc_dir;
@ -1251,7 +1254,7 @@ int ipmi_set_my_address(ipmi_user_t user,
{ {
if (channel >= IPMI_MAX_CHANNELS) if (channel >= IPMI_MAX_CHANNELS)
return -EINVAL; return -EINVAL;
user->intf->channels[channel].address = address; user->intf->addrinfo[channel].address = address;
return 0; return 0;
} }
EXPORT_SYMBOL(ipmi_set_my_address); EXPORT_SYMBOL(ipmi_set_my_address);
@ -1262,7 +1265,7 @@ int ipmi_get_my_address(ipmi_user_t user,
{ {
if (channel >= IPMI_MAX_CHANNELS) if (channel >= IPMI_MAX_CHANNELS)
return -EINVAL; return -EINVAL;
*address = user->intf->channels[channel].address; *address = user->intf->addrinfo[channel].address;
return 0; return 0;
} }
EXPORT_SYMBOL(ipmi_get_my_address); EXPORT_SYMBOL(ipmi_get_my_address);
@ -1273,7 +1276,7 @@ int ipmi_set_my_LUN(ipmi_user_t user,
{ {
if (channel >= IPMI_MAX_CHANNELS) if (channel >= IPMI_MAX_CHANNELS)
return -EINVAL; return -EINVAL;
user->intf->channels[channel].lun = LUN & 0x3; user->intf->addrinfo[channel].lun = LUN & 0x3;
return 0; return 0;
} }
EXPORT_SYMBOL(ipmi_set_my_LUN); EXPORT_SYMBOL(ipmi_set_my_LUN);
@ -1284,7 +1287,7 @@ int ipmi_get_my_LUN(ipmi_user_t user,
{ {
if (channel >= IPMI_MAX_CHANNELS) if (channel >= IPMI_MAX_CHANNELS)
return -EINVAL; return -EINVAL;
*address = user->intf->channels[channel].lun; *address = user->intf->addrinfo[channel].lun;
return 0; return 0;
} }
EXPORT_SYMBOL(ipmi_get_my_LUN); EXPORT_SYMBOL(ipmi_get_my_LUN);
@ -2045,8 +2048,8 @@ static int check_addr(ipmi_smi_t intf,
{ {
if (addr->channel >= IPMI_MAX_CHANNELS) if (addr->channel >= IPMI_MAX_CHANNELS)
return -EINVAL; return -EINVAL;
*lun = intf->channels[addr->channel].lun; *lun = intf->addrinfo[addr->channel].lun;
*saddr = intf->channels[addr->channel].address; *saddr = intf->addrinfo[addr->channel].address;
return 0; return 0;
} }
@ -2167,8 +2170,8 @@ send_get_device_id_cmd(ipmi_smi_t intf)
NULL, NULL,
NULL, NULL,
0, 0,
intf->channels[0].address, intf->addrinfo[0].address,
intf->channels[0].lun, intf->addrinfo[0].lun,
-1, 0); -1, 0);
} }
@ -2347,9 +2350,9 @@ static int smi_ipmb_proc_show(struct seq_file *m, void *v)
ipmi_smi_t intf = m->private; ipmi_smi_t intf = m->private;
int i; int i;
seq_printf(m, "%x", intf->channels[0].address); seq_printf(m, "%x", intf->addrinfo[0].address);
for (i = 1; i < IPMI_MAX_CHANNELS; i++) for (i = 1; i < IPMI_MAX_CHANNELS; i++)
seq_printf(m, " %x", intf->channels[i].address); seq_printf(m, " %x", intf->addrinfo[i].address);
seq_putc(m, '\n'); seq_putc(m, '\n');
return 0; return 0;
@ -3113,8 +3116,8 @@ send_guid_cmd(ipmi_smi_t intf, int chan)
NULL, NULL,
NULL, NULL,
0, 0,
intf->channels[0].address, intf->addrinfo[0].address,
intf->channels[0].lun, intf->addrinfo[0].lun,
-1, 0); -1, 0);
} }
@ -3200,8 +3203,8 @@ send_channel_info_cmd(ipmi_smi_t intf, int chan)
NULL, NULL,
NULL, NULL,
0, 0,
intf->channels[0].address, intf->addrinfo[0].address,
intf->channels[0].lun, intf->addrinfo[0].lun,
-1, 0); -1, 0);
} }
@ -3331,11 +3334,11 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers,
INIT_WORK(&intf->bmc_reg_work, redo_bmc_reg); INIT_WORK(&intf->bmc_reg_work, redo_bmc_reg);
intf->si_dev = si_dev; intf->si_dev = si_dev;
for (j = 0; j < IPMI_MAX_CHANNELS; j++) { for (j = 0; j < IPMI_MAX_CHANNELS; j++) {
intf->channels[j].address = IPMI_BMC_SLAVE_ADDR; intf->addrinfo[j].address = IPMI_BMC_SLAVE_ADDR;
intf->channels[j].lun = 2; intf->addrinfo[j].lun = 2;
} }
if (slave_addr != 0) if (slave_addr != 0)
intf->channels[0].address = slave_addr; intf->addrinfo[0].address = slave_addr;
INIT_LIST_HEAD(&intf->users); INIT_LIST_HEAD(&intf->users);
intf->handlers = handlers; intf->handlers = handlers;
intf->send_info = send_info; intf->send_info = send_info;
@ -3665,7 +3668,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf,
msg->data[3] = msg->rsp[6]; msg->data[3] = msg->rsp[6];
msg->data[4] = ((netfn + 1) << 2) | (msg->rsp[7] & 0x3); msg->data[4] = ((netfn + 1) << 2) | (msg->rsp[7] & 0x3);
msg->data[5] = ipmb_checksum(&(msg->data[3]), 2); msg->data[5] = ipmb_checksum(&(msg->data[3]), 2);
msg->data[6] = intf->channels[msg->rsp[3] & 0xf].address; msg->data[6] = intf->addrinfo[msg->rsp[3] & 0xf].address;
/* rqseq/lun */ /* rqseq/lun */
msg->data[7] = (msg->rsp[7] & 0xfc) | (msg->rsp[4] & 0x3); msg->data[7] = (msg->rsp[7] & 0xfc) | (msg->rsp[4] & 0x3);
msg->data[8] = msg->rsp[8]; /* cmd */ msg->data[8] = msg->rsp[8]; /* cmd */
@ -4849,8 +4852,8 @@ static void ipmi_panic_request_and_wait(ipmi_smi_t intf,
&smi_msg, &smi_msg,
&recv_msg, &recv_msg,
0, 0,
intf->channels[0].address, intf->addrinfo[0].address,
intf->channels[0].lun, intf->addrinfo[0].lun,
0, 1); /* Don't retry, and don't wait. */ 0, 1); /* Don't retry, and don't wait. */
if (rv) if (rv)
atomic_sub(2, &panic_done_count); atomic_sub(2, &panic_done_count);
@ -4999,7 +5002,7 @@ static void send_panic_events(char *str)
*/ */
if (((intf->event_receiver & 1) == 0) if (((intf->event_receiver & 1) == 0)
&& (intf->event_receiver != 0) && (intf->event_receiver != 0)
&& (intf->event_receiver != intf->channels[0].address)) { && (intf->event_receiver != intf->addrinfo[0].address)) {
/* /*
* The event receiver is valid, send an IPMB * The event receiver is valid, send an IPMB
* message. * message.
@ -5036,7 +5039,7 @@ static void send_panic_events(char *str)
data[0] = 0; data[0] = 0;
data[1] = 0; data[1] = 0;
data[2] = 0xf0; /* OEM event without timestamp. */ data[2] = 0xf0; /* OEM event without timestamp. */
data[3] = intf->channels[0].address; data[3] = intf->addrinfo[0].address;
data[4] = j++; /* sequence # */ data[4] = j++; /* sequence # */
/* /*
* Always give 11 bytes, so strncpy will fill * Always give 11 bytes, so strncpy will fill