aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ipmi/ipmi_devintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/ipmi/ipmi_devintf.c')
-rw-r--r--drivers/char/ipmi/ipmi_devintf.c101
1 files changed, 87 insertions, 14 deletions
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
index e0a53570fea1..883ac4352be4 100644
--- a/drivers/char/ipmi/ipmi_devintf.c
+++ b/drivers/char/ipmi/ipmi_devintf.c
@@ -47,8 +47,6 @@
47#include <linux/device.h> 47#include <linux/device.h>
48#include <linux/compat.h> 48#include <linux/compat.h>
49 49
50#define IPMI_DEVINTF_VERSION "v33"
51
52struct ipmi_file_private 50struct ipmi_file_private
53{ 51{
54 ipmi_user_t user; 52 ipmi_user_t user;
@@ -411,6 +409,7 @@ static int ipmi_ioctl(struct inode *inode,
411 break; 409 break;
412 } 410 }
413 411
412 /* The next four are legacy, not per-channel. */
414 case IPMICTL_SET_MY_ADDRESS_CMD: 413 case IPMICTL_SET_MY_ADDRESS_CMD:
415 { 414 {
416 unsigned int val; 415 unsigned int val;
@@ -420,22 +419,25 @@ static int ipmi_ioctl(struct inode *inode,
420 break; 419 break;
421 } 420 }
422 421
423 ipmi_set_my_address(priv->user, val); 422 rv = ipmi_set_my_address(priv->user, 0, val);
424 rv = 0;
425 break; 423 break;
426 } 424 }
427 425
428 case IPMICTL_GET_MY_ADDRESS_CMD: 426 case IPMICTL_GET_MY_ADDRESS_CMD:
429 { 427 {
430 unsigned int val; 428 unsigned int val;
429 unsigned char rval;
430
431 rv = ipmi_get_my_address(priv->user, 0, &rval);
432 if (rv)
433 break;
431 434
432 val = ipmi_get_my_address(priv->user); 435 val = rval;
433 436
434 if (copy_to_user(arg, &val, sizeof(val))) { 437 if (copy_to_user(arg, &val, sizeof(val))) {
435 rv = -EFAULT; 438 rv = -EFAULT;
436 break; 439 break;
437 } 440 }
438 rv = 0;
439 break; 441 break;
440 } 442 }
441 443
@@ -448,24 +450,94 @@ static int ipmi_ioctl(struct inode *inode,
448 break; 450 break;
449 } 451 }
450 452
451 ipmi_set_my_LUN(priv->user, val); 453 rv = ipmi_set_my_LUN(priv->user, 0, val);
452 rv = 0;
453 break; 454 break;
454 } 455 }
455 456
456 case IPMICTL_GET_MY_LUN_CMD: 457 case IPMICTL_GET_MY_LUN_CMD:
457 { 458 {
458 unsigned int val; 459 unsigned int val;
460 unsigned char rval;
459 461
460 val = ipmi_get_my_LUN(priv->user); 462 rv = ipmi_get_my_LUN(priv->user, 0, &rval);
463 if (rv)
464 break;
465
466 val = rval;
467
468 if (copy_to_user(arg, &val, sizeof(val))) {
469 rv = -EFAULT;
470 break;
471 }
472 break;
473 }
474
475 case IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD:
476 {
477 struct ipmi_channel_lun_address_set val;
478
479 if (copy_from_user(&val, arg, sizeof(val))) {
480 rv = -EFAULT;
481 break;
482 }
483
484 return ipmi_set_my_address(priv->user, val.channel, val.value);
485 break;
486 }
487
488 case IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD:
489 {
490 struct ipmi_channel_lun_address_set val;
491
492 if (copy_from_user(&val, arg, sizeof(val))) {
493 rv = -EFAULT;
494 break;
495 }
496
497 rv = ipmi_get_my_address(priv->user, val.channel, &val.value);
498 if (rv)
499 break;
500
501 if (copy_to_user(arg, &val, sizeof(val))) {
502 rv = -EFAULT;
503 break;
504 }
505 break;
506 }
507
508 case IPMICTL_SET_MY_CHANNEL_LUN_CMD:
509 {
510 struct ipmi_channel_lun_address_set val;
511
512 if (copy_from_user(&val, arg, sizeof(val))) {
513 rv = -EFAULT;
514 break;
515 }
516
517 rv = ipmi_set_my_LUN(priv->user, val.channel, val.value);
518 break;
519 }
520
521 case IPMICTL_GET_MY_CHANNEL_LUN_CMD:
522 {
523 struct ipmi_channel_lun_address_set val;
524
525 if (copy_from_user(&val, arg, sizeof(val))) {
526 rv = -EFAULT;
527 break;
528 }
529
530 rv = ipmi_get_my_LUN(priv->user, val.channel, &val.value);
531 if (rv)
532 break;
461 533
462 if (copy_to_user(arg, &val, sizeof(val))) { 534 if (copy_to_user(arg, &val, sizeof(val))) {
463 rv = -EFAULT; 535 rv = -EFAULT;
464 break; 536 break;
465 } 537 }
466 rv = 0;
467 break; 538 break;
468 } 539 }
540
469 case IPMICTL_SET_TIMING_PARMS_CMD: 541 case IPMICTL_SET_TIMING_PARMS_CMD:
470 { 542 {
471 struct ipmi_timing_parms parms; 543 struct ipmi_timing_parms parms;
@@ -748,8 +820,7 @@ static __init int init_ipmi_devintf(void)
748 if (ipmi_major < 0) 820 if (ipmi_major < 0)
749 return -EINVAL; 821 return -EINVAL;
750 822
751 printk(KERN_INFO "ipmi device interface version " 823 printk(KERN_INFO "ipmi device interface\n");
752 IPMI_DEVINTF_VERSION "\n");
753 824
754 ipmi_class = class_create(THIS_MODULE, "ipmi"); 825 ipmi_class = class_create(THIS_MODULE, "ipmi");
755 if (IS_ERR(ipmi_class)) { 826 if (IS_ERR(ipmi_class)) {
@@ -792,3 +863,5 @@ static __exit void cleanup_ipmi(void)
792module_exit(cleanup_ipmi); 863module_exit(cleanup_ipmi);
793 864
794MODULE_LICENSE("GPL"); 865MODULE_LICENSE("GPL");
866MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>");
867MODULE_DESCRIPTION("Linux device interface for the IPMI message handler.");