Commit 98dcd59dd063dd8099d8dbccd84a40e927dc7138
Committed by
Greg Kroah-Hartman
1 parent
f6a4e494e0
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
misc: hpilo: increase number of max supported channels
Increase number of supported channels from 8 to 24. Make the number of channels configurable via module parameter max_ccb. Signed-off-by: Mark Rusk <mark.rusk@hp.com> Signed-off-by: Tony Camuso <tony.camuso@hp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 2 changed files with 24 additions and 13 deletions Side-by-side Diff
drivers/misc/hpilo.c
... | ... | @@ -30,6 +30,7 @@ |
30 | 30 | |
31 | 31 | static struct class *ilo_class; |
32 | 32 | static unsigned int ilo_major; |
33 | +static unsigned int max_ccb = MIN_CCB; | |
33 | 34 | static char ilo_hwdev[MAX_ILO_DEV]; |
34 | 35 | |
35 | 36 | static inline int get_entry_id(int entry) |
... | ... | @@ -424,7 +425,7 @@ |
424 | 425 | * Mapped memory is zeroed on ilo reset, so set a per ccb flag |
425 | 426 | * to indicate that this ccb needs to be closed and reopened. |
426 | 427 | */ |
427 | - for (slot = 0; slot < MAX_CCB; slot++) { | |
428 | + for (slot = 0; slot < max_ccb; slot++) { | |
428 | 429 | if (!hw->ccb_alloc[slot]) |
429 | 430 | continue; |
430 | 431 | set_channel_reset(&hw->ccb_alloc[slot]->driver_ccb); |
... | ... | @@ -535,7 +536,7 @@ |
535 | 536 | struct ilo_hwinfo *hw; |
536 | 537 | unsigned long flags; |
537 | 538 | |
538 | - slot = iminor(ip) % MAX_CCB; | |
539 | + slot = iminor(ip) % max_ccb; | |
539 | 540 | hw = container_of(ip->i_cdev, struct ilo_hwinfo, cdev); |
540 | 541 | |
541 | 542 | spin_lock(&hw->open_lock); |
... | ... | @@ -566,7 +567,7 @@ |
566 | 567 | struct ilo_hwinfo *hw; |
567 | 568 | unsigned long flags; |
568 | 569 | |
569 | - slot = iminor(ip) % MAX_CCB; | |
570 | + slot = iminor(ip) % max_ccb; | |
570 | 571 | hw = container_of(ip->i_cdev, struct ilo_hwinfo, cdev); |
571 | 572 | |
572 | 573 | /* new ccb allocation */ |
... | ... | @@ -663,7 +664,7 @@ |
663 | 664 | ilo_set_reset(hw); |
664 | 665 | } |
665 | 666 | |
666 | - for (i = 0; i < MAX_CCB; i++) { | |
667 | + for (i = 0; i < max_ccb; i++) { | |
667 | 668 | if (!hw->ccb_alloc[i]) |
668 | 669 | continue; |
669 | 670 | if (pending & (1 << i)) |
670 | 671 | |
... | ... | @@ -697,14 +698,14 @@ |
697 | 698 | } |
698 | 699 | |
699 | 700 | /* map the adapter shared memory region */ |
700 | - hw->ram_vaddr = pci_iomap(pdev, 2, MAX_CCB * ILOHW_CCB_SZ); | |
701 | + hw->ram_vaddr = pci_iomap(pdev, 2, max_ccb * ILOHW_CCB_SZ); | |
701 | 702 | if (hw->ram_vaddr == NULL) { |
702 | 703 | dev_err(&pdev->dev, "Error mapping shared mem\n"); |
703 | 704 | goto mmio_free; |
704 | 705 | } |
705 | 706 | |
706 | 707 | /* map the doorbell aperture */ |
707 | - hw->db_vaddr = pci_iomap(pdev, 3, MAX_CCB * ONE_DB_SIZE); | |
708 | + hw->db_vaddr = pci_iomap(pdev, 3, max_ccb * ONE_DB_SIZE); | |
708 | 709 | if (hw->db_vaddr == NULL) { |
709 | 710 | dev_err(&pdev->dev, "Error mapping doorbell\n"); |
710 | 711 | goto ram_free; |
... | ... | @@ -727,7 +728,7 @@ |
727 | 728 | clear_device(ilo_hw); |
728 | 729 | |
729 | 730 | minor = MINOR(ilo_hw->cdev.dev); |
730 | - for (i = minor; i < minor + MAX_CCB; i++) | |
731 | + for (i = minor; i < minor + max_ccb; i++) | |
731 | 732 | device_destroy(ilo_class, MKDEV(ilo_major, i)); |
732 | 733 | |
733 | 734 | cdev_del(&ilo_hw->cdev); |
... | ... | @@ -737,7 +738,7 @@ |
737 | 738 | pci_release_regions(pdev); |
738 | 739 | pci_disable_device(pdev); |
739 | 740 | kfree(ilo_hw); |
740 | - ilo_hwdev[(minor / MAX_CCB)] = 0; | |
741 | + ilo_hwdev[(minor / max_ccb)] = 0; | |
741 | 742 | } |
742 | 743 | |
743 | 744 | static int __devinit ilo_probe(struct pci_dev *pdev, |
... | ... | @@ -746,6 +747,11 @@ |
746 | 747 | int devnum, minor, start, error; |
747 | 748 | struct ilo_hwinfo *ilo_hw; |
748 | 749 | |
750 | + if (max_ccb > MAX_CCB) | |
751 | + max_ccb = MAX_CCB; | |
752 | + else if (max_ccb < MIN_CCB) | |
753 | + max_ccb = MIN_CCB; | |
754 | + | |
749 | 755 | /* find a free range for device files */ |
750 | 756 | for (devnum = 0; devnum < MAX_ILO_DEV; devnum++) { |
751 | 757 | if (ilo_hwdev[devnum] == 0) { |
752 | 758 | |
... | ... | @@ -795,14 +801,14 @@ |
795 | 801 | |
796 | 802 | cdev_init(&ilo_hw->cdev, &ilo_fops); |
797 | 803 | ilo_hw->cdev.owner = THIS_MODULE; |
798 | - start = devnum * MAX_CCB; | |
799 | - error = cdev_add(&ilo_hw->cdev, MKDEV(ilo_major, start), MAX_CCB); | |
804 | + start = devnum * max_ccb; | |
805 | + error = cdev_add(&ilo_hw->cdev, MKDEV(ilo_major, start), max_ccb); | |
800 | 806 | if (error) { |
801 | 807 | dev_err(&pdev->dev, "Could not add cdev\n"); |
802 | 808 | goto remove_isr; |
803 | 809 | } |
804 | 810 | |
805 | - for (minor = 0 ; minor < MAX_CCB; minor++) { | |
811 | + for (minor = 0 ; minor < max_ccb; minor++) { | |
806 | 812 | struct device *dev; |
807 | 813 | dev = device_create(ilo_class, &pdev->dev, |
808 | 814 | MKDEV(ilo_major, minor), NULL, |
809 | 815 | |
... | ... | @@ -879,11 +885,14 @@ |
879 | 885 | class_destroy(ilo_class); |
880 | 886 | } |
881 | 887 | |
882 | -MODULE_VERSION("1.2"); | |
888 | +MODULE_VERSION("1.3"); | |
883 | 889 | MODULE_ALIAS(ILO_NAME); |
884 | 890 | MODULE_DESCRIPTION(ILO_NAME); |
885 | 891 | MODULE_AUTHOR("David Altobelli <david.altobelli@hp.com>"); |
886 | 892 | MODULE_LICENSE("GPL v2"); |
893 | + | |
894 | +module_param(max_ccb, uint, 0444); | |
895 | +MODULE_PARM_DESC(max_ccb, "Maximum number of HP iLO channels to attach (8)"); | |
887 | 896 | |
888 | 897 | module_init(ilo_init); |
889 | 898 | module_exit(ilo_exit); |
drivers/misc/hpilo.h
... | ... | @@ -14,7 +14,9 @@ |
14 | 14 | #define ILO_NAME "hpilo" |
15 | 15 | |
16 | 16 | /* max number of open channel control blocks per device, hw limited to 32 */ |
17 | -#define MAX_CCB 8 | |
17 | +#define MAX_CCB 24 | |
18 | +/* min number of open channel control blocks per device, hw limited to 32 */ | |
19 | +#define MIN_CCB 8 | |
18 | 20 | /* max number of supported devices */ |
19 | 21 | #define MAX_ILO_DEV 1 |
20 | 22 | /* max number of files */ |