Skip to content

Commit

Permalink
ipmi: Move lun and address out of channel struct
Browse files Browse the repository at this point in the history
Put it in it's own struct, getting ready for channel information
being dynamically changed.

Signed-off-by: Corey Minyard <[email protected]>
  • Loading branch information
cminyard committed Sep 27, 2017
1 parent c0734bd commit 5fdb1fb
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions drivers/char/ipmi/ipmi_msghandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ struct seq_table {
struct ipmi_channel {
unsigned char medium;
unsigned char protocol;
};

struct ipmi_my_addrinfo {
/*
* My slave address. This is initialized to IPMI_BMC_SLAVE_ADDR,
* but may be changed by the user.
Expand Down Expand Up @@ -530,6 +532,7 @@ struct ipmi_smi {

/* Channel information */
struct ipmi_channel channels[IPMI_MAX_CHANNELS];
struct ipmi_my_addrinfo addrinfo[IPMI_MAX_CHANNELS];

/* Proc FS stuff. */
struct proc_dir_entry *proc_dir;
Expand Down Expand Up @@ -1251,7 +1254,7 @@ int ipmi_set_my_address(ipmi_user_t user,
{
if (channel >= IPMI_MAX_CHANNELS)
return -EINVAL;
user->intf->channels[channel].address = address;
user->intf->addrinfo[channel].address = address;
return 0;
}
EXPORT_SYMBOL(ipmi_set_my_address);
Expand All @@ -1262,7 +1265,7 @@ int ipmi_get_my_address(ipmi_user_t user,
{
if (channel >= IPMI_MAX_CHANNELS)
return -EINVAL;
*address = user->intf->channels[channel].address;
*address = user->intf->addrinfo[channel].address;
return 0;
}
EXPORT_SYMBOL(ipmi_get_my_address);
Expand All @@ -1273,7 +1276,7 @@ int ipmi_set_my_LUN(ipmi_user_t user,
{
if (channel >= IPMI_MAX_CHANNELS)
return -EINVAL;
user->intf->channels[channel].lun = LUN & 0x3;
user->intf->addrinfo[channel].lun = LUN & 0x3;
return 0;
}
EXPORT_SYMBOL(ipmi_set_my_LUN);
Expand All @@ -1284,7 +1287,7 @@ int ipmi_get_my_LUN(ipmi_user_t user,
{
if (channel >= IPMI_MAX_CHANNELS)
return -EINVAL;
*address = user->intf->channels[channel].lun;
*address = user->intf->addrinfo[channel].lun;
return 0;
}
EXPORT_SYMBOL(ipmi_get_my_LUN);
Expand Down Expand Up @@ -2045,8 +2048,8 @@ static int check_addr(ipmi_smi_t intf,
{
if (addr->channel >= IPMI_MAX_CHANNELS)
return -EINVAL;
*lun = intf->channels[addr->channel].lun;
*saddr = intf->channels[addr->channel].address;
*lun = intf->addrinfo[addr->channel].lun;
*saddr = intf->addrinfo[addr->channel].address;
return 0;
}

Expand Down Expand Up @@ -2167,8 +2170,8 @@ send_get_device_id_cmd(ipmi_smi_t intf)
NULL,
NULL,
0,
intf->channels[0].address,
intf->channels[0].lun,
intf->addrinfo[0].address,
intf->addrinfo[0].lun,
-1, 0);
}

Expand Down Expand Up @@ -2347,9 +2350,9 @@ static int smi_ipmb_proc_show(struct seq_file *m, void *v)
ipmi_smi_t intf = m->private;
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++)
seq_printf(m, " %x", intf->channels[i].address);
seq_printf(m, " %x", intf->addrinfo[i].address);
seq_putc(m, '\n');

return 0;
Expand Down Expand Up @@ -3113,8 +3116,8 @@ send_guid_cmd(ipmi_smi_t intf, int chan)
NULL,
NULL,
0,
intf->channels[0].address,
intf->channels[0].lun,
intf->addrinfo[0].address,
intf->addrinfo[0].lun,
-1, 0);
}

Expand Down Expand Up @@ -3200,8 +3203,8 @@ send_channel_info_cmd(ipmi_smi_t intf, int chan)
NULL,
NULL,
0,
intf->channels[0].address,
intf->channels[0].lun,
intf->addrinfo[0].address,
intf->addrinfo[0].lun,
-1, 0);
}

Expand Down Expand Up @@ -3331,11 +3334,11 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers,
INIT_WORK(&intf->bmc_reg_work, redo_bmc_reg);
intf->si_dev = si_dev;
for (j = 0; j < IPMI_MAX_CHANNELS; j++) {
intf->channels[j].address = IPMI_BMC_SLAVE_ADDR;
intf->channels[j].lun = 2;
intf->addrinfo[j].address = IPMI_BMC_SLAVE_ADDR;
intf->addrinfo[j].lun = 2;
}
if (slave_addr != 0)
intf->channels[0].address = slave_addr;
intf->addrinfo[0].address = slave_addr;
INIT_LIST_HEAD(&intf->users);
intf->handlers = handlers;
intf->send_info = send_info;
Expand Down Expand Up @@ -3665,7 +3668,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf,
msg->data[3] = msg->rsp[6];
msg->data[4] = ((netfn + 1) << 2) | (msg->rsp[7] & 0x3);
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 */
msg->data[7] = (msg->rsp[7] & 0xfc) | (msg->rsp[4] & 0x3);
msg->data[8] = msg->rsp[8]; /* cmd */
Expand Down Expand Up @@ -4849,8 +4852,8 @@ static void ipmi_panic_request_and_wait(ipmi_smi_t intf,
&smi_msg,
&recv_msg,
0,
intf->channels[0].address,
intf->channels[0].lun,
intf->addrinfo[0].address,
intf->addrinfo[0].lun,
0, 1); /* Don't retry, and don't wait. */
if (rv)
atomic_sub(2, &panic_done_count);
Expand Down Expand Up @@ -4999,7 +5002,7 @@ static void send_panic_events(char *str)
*/
if (((intf->event_receiver & 1) == 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
* message.
Expand Down Expand Up @@ -5036,7 +5039,7 @@ static void send_panic_events(char *str)
data[0] = 0;
data[1] = 0;
data[2] = 0xf0; /* OEM event without timestamp. */
data[3] = intf->channels[0].address;
data[3] = intf->addrinfo[0].address;
data[4] = j++; /* sequence # */
/*
* Always give 11 bytes, so strncpy will fill
Expand Down

0 comments on commit 5fdb1fb

Please sign in to comment.