aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ipmi/ipmi_devintf.c
diff options
context:
space:
mode:
authorCorey Minyard <minyard@acm.org>2005-09-06 18:18:38 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 19:57:47 -0400
commitc14979b993021377228958498937bcdd9539cbce (patch)
treee30638df99aa69f707e7549e4e990e9e92d477ae /drivers/char/ipmi/ipmi_devintf.c
parentb224cd3a0ca376dd52f382905c1aaf5a83a54692 (diff)
[PATCH] ipmi: add per-channel IPMB addresses
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>
Diffstat (limited to 'drivers/char/ipmi/ipmi_devintf.c')
-rw-r--r--drivers/char/ipmi/ipmi_devintf.c94
1 files changed, 84 insertions, 10 deletions
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
index e0a53570fea1..5571e92c520f 100644
--- a/drivers/char/ipmi/ipmi_devintf.c
+++ b/drivers/char/ipmi/ipmi_devintf.c
@@ -411,6 +411,7 @@ static int ipmi_ioctl(struct inode *inode,
411 break; 411 break;
412 } 412 }
413 413
414 /* The next four are legacy, not per-channel. */
414 case IPMICTL_SET_MY_ADDRESS_CMD: 415 case IPMICTL_SET_MY_ADDRESS_CMD:
415 { 416 {
416 unsigned int val; 417 unsigned int val;
@@ -420,22 +421,25 @@ static int ipmi_ioctl(struct inode *inode,
420 break; 421 break;
421 } 422 }
422 423
423 ipmi_set_my_address(priv->user, val); 424 rv = ipmi_set_my_address(priv->user, 0, val);
424 rv = 0;
425 break; 425 break;
426 } 426 }
427 427
428 case IPMICTL_GET_MY_ADDRESS_CMD: 428 case IPMICTL_GET_MY_ADDRESS_CMD:
429 { 429 {
430 unsigned int val; 430 unsigned int val;
431 unsigned char rval;
432
433 rv = ipmi_get_my_address(priv->user, 0, &rval);
434 if (rv)
435 break;
431 436
432 val = ipmi_get_my_address(priv->user); 437 val = rval;
433 438
434 if (copy_to_user(arg, &val, sizeof(val))) { 439 if (copy_to_user(arg, &val, sizeof(val))) {
435 rv = -EFAULT; 440 rv = -EFAULT;
436 break; 441 break;
437 } 442 }
438 rv = 0;
439 break; 443 break;
440 } 444 }
441 445
@@ -448,24 +452,94 @@ static int ipmi_ioctl(struct inode *inode,
448 break; 452 break;
449 } 453 }
450 454
451 ipmi_set_my_LUN(priv->user, val); 455 rv = ipmi_set_my_LUN(priv->user, 0, val);
452 rv = 0;
453 break; 456 break;
454 } 457 }
455 458
456 case IPMICTL_GET_MY_LUN_CMD: 459 case IPMICTL_GET_MY_LUN_CMD:
457 { 460 {
458 unsigned int val; 461 unsigned int val;
462 unsigned char rval;
463
464 rv = ipmi_get_my_LUN(priv->user, 0, &rval);
465 if (rv)
466 break;
459 467
460 val = ipmi_get_my_LUN(priv->user); 468 val = rval;
461 469
462 if (copy_to_user(arg, &val, sizeof(val))) { 470 if (copy_to_user(arg, &val, sizeof(val))) {
463 rv = -EFAULT; 471 rv = -EFAULT;
464 break; 472 break;
465 } 473 }
466 rv = 0;
467 break; 474 break;
468 } 475 }
476
477 case IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD:
478 {
479 struct ipmi_channel_lun_address_set val;
480
481 if (copy_from_user(&val, arg, sizeof(val))) {
482 rv = -EFAULT;
483 break;
484 }
485
486 return ipmi_set_my_address(priv->user, val.channel, val.value);
487 break;
488 }
489
490 case IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD:
491 {
492 struct ipmi_channel_lun_address_set val;
493
494 if (copy_from_user(&val, arg, sizeof(val))) {
495 rv = -EFAULT;
496 break;
497 }
498
499 rv = ipmi_get_my_address(priv->user, val.channel, &val.value);
500 if (rv)
501 break;
502
503 if (copy_to_user(arg, &val, sizeof(val))) {
504 rv = -EFAULT;
505 break;
506 }
507 break;
508 }
509
510 case IPMICTL_SET_MY_CHANNEL_LUN_CMD:
511 {
512 struct ipmi_channel_lun_address_set val;
513
514 if (copy_from_user(&val, arg, sizeof(val))) {
515 rv = -EFAULT;
516 break;
517 }
518
519 rv = ipmi_set_my_LUN(priv->user, val.channel, val.value);
520 break;
521 }
522
523 case IPMICTL_GET_MY_CHANNEL_LUN_CMD:
524 {
525 struct ipmi_channel_lun_address_set val;
526
527 if (copy_from_user(&val, arg, sizeof(val))) {
528 rv = -EFAULT;
529 break;
530 }
531
532 rv = ipmi_get_my_LUN(priv->user, val.channel, &val.value);
533 if (rv)
534 break;
535
536 if (copy_to_user(arg, &val, sizeof(val))) {
537 rv = -EFAULT;
538 break;
539 }
540 break;
541 }
542
469 case IPMICTL_SET_TIMING_PARMS_CMD: 543 case IPMICTL_SET_TIMING_PARMS_CMD:
470 { 544 {
471 struct ipmi_timing_parms parms; 545 struct ipmi_timing_parms parms;