Skip to content

Commit

Permalink
[PATCH] ipmi: add per-channel IPMB addresses
Browse files Browse the repository at this point in the history
IPMI allows multiple IPMB channels on a single interface, and each channel
might have a different IPMB address.  However, the driver has only one IPMB
address that it uses for everything.  This patch adds new IOCTLS and a new
internal interface for setting per-channel IPMB addresses and LUNs.  New
systems are coming out with support for multiple IPMB channels, and they are
broken without this patch.

Signed-off-by: Corey Minyard <minyard@acm.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Corey Minyard authored and Linus Torvalds committed Sep 7, 2005
1 parent b224cd3 commit c14979b
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 60 deletions.
94 changes: 84 additions & 10 deletions drivers/char/ipmi/ipmi_devintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ static int ipmi_ioctl(struct inode *inode,
break;
}

/* The next four are legacy, not per-channel. */
case IPMICTL_SET_MY_ADDRESS_CMD:
{
unsigned int val;
Expand All @@ -420,22 +421,25 @@ static int ipmi_ioctl(struct inode *inode,
break;
}

ipmi_set_my_address(priv->user, val);
rv = 0;
rv = ipmi_set_my_address(priv->user, 0, val);
break;
}

case IPMICTL_GET_MY_ADDRESS_CMD:
{
unsigned int val;
unsigned int val;
unsigned char rval;

rv = ipmi_get_my_address(priv->user, 0, &rval);
if (rv)
break;

val = ipmi_get_my_address(priv->user);
val = rval;

if (copy_to_user(arg, &val, sizeof(val))) {
rv = -EFAULT;
break;
}
rv = 0;
break;
}

Expand All @@ -448,24 +452,94 @@ static int ipmi_ioctl(struct inode *inode,
break;
}

ipmi_set_my_LUN(priv->user, val);
rv = 0;
rv = ipmi_set_my_LUN(priv->user, 0, val);
break;
}

case IPMICTL_GET_MY_LUN_CMD:
{
unsigned int val;
unsigned int val;
unsigned char rval;

rv = ipmi_get_my_LUN(priv->user, 0, &rval);
if (rv)
break;

val = ipmi_get_my_LUN(priv->user);
val = rval;

if (copy_to_user(arg, &val, sizeof(val))) {
rv = -EFAULT;
break;
}
rv = 0;
break;
}

case IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD:
{
struct ipmi_channel_lun_address_set val;

if (copy_from_user(&val, arg, sizeof(val))) {
rv = -EFAULT;
break;
}

return ipmi_set_my_address(priv->user, val.channel, val.value);
break;
}

case IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD:
{
struct ipmi_channel_lun_address_set val;

if (copy_from_user(&val, arg, sizeof(val))) {
rv = -EFAULT;
break;
}

rv = ipmi_get_my_address(priv->user, val.channel, &val.value);
if (rv)
break;

if (copy_to_user(arg, &val, sizeof(val))) {
rv = -EFAULT;
break;
}
break;
}

case IPMICTL_SET_MY_CHANNEL_LUN_CMD:
{
struct ipmi_channel_lun_address_set val;

if (copy_from_user(&val, arg, sizeof(val))) {
rv = -EFAULT;
break;
}

rv = ipmi_set_my_LUN(priv->user, val.channel, val.value);
break;
}

case IPMICTL_GET_MY_CHANNEL_LUN_CMD:
{
struct ipmi_channel_lun_address_set val;

if (copy_from_user(&val, arg, sizeof(val))) {
rv = -EFAULT;
break;
}

rv = ipmi_get_my_LUN(priv->user, val.channel, &val.value);
if (rv)
break;

if (copy_to_user(arg, &val, sizeof(val))) {
rv = -EFAULT;
break;
}
break;
}

case IPMICTL_SET_TIMING_PARMS_CMD:
{
struct ipmi_timing_parms parms;
Expand Down
Loading

0 comments on commit c14979b

Please sign in to comment.