Skip to content

Commit 98dcd59

Browse files
Camuso, Tonygregkh
authored andcommitted
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>
1 parent f6a4e49 commit 98dcd59

2 files changed

Lines changed: 24 additions & 13 deletions

File tree

‎drivers/misc/hpilo.c‎

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
static struct class *ilo_class;
3232
static unsigned int ilo_major;
33+
static unsigned int max_ccb = MIN_CCB;
3334
static char ilo_hwdev[MAX_ILO_DEV];
3435

3536
static inline int get_entry_id(int entry)
@@ -424,7 +425,7 @@ static void ilo_set_reset(struct ilo_hwinfo *hw)
424425
* Mapped memory is zeroed on ilo reset, so set a per ccb flag
425426
* to indicate that this ccb needs to be closed and reopened.
426427
*/
427-
for (slot = 0; slot < MAX_CCB; slot++) {
428+
for (slot = 0; slot < max_ccb; slot++) {
428429
if (!hw->ccb_alloc[slot])
429430
continue;
430431
set_channel_reset(&hw->ccb_alloc[slot]->driver_ccb);
@@ -535,7 +536,7 @@ static int ilo_close(struct inode *ip, struct file *fp)
535536
struct ilo_hwinfo *hw;
536537
unsigned long flags;
537538

538-
slot = iminor(ip) % MAX_CCB;
539+
slot = iminor(ip) % max_ccb;
539540
hw = container_of(ip->i_cdev, struct ilo_hwinfo, cdev);
540541

541542
spin_lock(&hw->open_lock);
@@ -566,7 +567,7 @@ static int ilo_open(struct inode *ip, struct file *fp)
566567
struct ilo_hwinfo *hw;
567568
unsigned long flags;
568569

569-
slot = iminor(ip) % MAX_CCB;
570+
slot = iminor(ip) % max_ccb;
570571
hw = container_of(ip->i_cdev, struct ilo_hwinfo, cdev);
571572

572573
/* new ccb allocation */
@@ -663,7 +664,7 @@ static irqreturn_t ilo_isr(int irq, void *data)
663664
ilo_set_reset(hw);
664665
}
665666

666-
for (i = 0; i < MAX_CCB; i++) {
667+
for (i = 0; i < max_ccb; i++) {
667668
if (!hw->ccb_alloc[i])
668669
continue;
669670
if (pending & (1 << i))
@@ -697,14 +698,14 @@ static int __devinit ilo_map_device(struct pci_dev *pdev, struct ilo_hwinfo *hw)
697698
}
698699

699700
/* 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);
701702
if (hw->ram_vaddr == NULL) {
702703
dev_err(&pdev->dev, "Error mapping shared mem\n");
703704
goto mmio_free;
704705
}
705706

706707
/* 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);
708709
if (hw->db_vaddr == NULL) {
709710
dev_err(&pdev->dev, "Error mapping doorbell\n");
710711
goto ram_free;
@@ -727,7 +728,7 @@ static void ilo_remove(struct pci_dev *pdev)
727728
clear_device(ilo_hw);
728729

729730
minor = MINOR(ilo_hw->cdev.dev);
730-
for (i = minor; i < minor + MAX_CCB; i++)
731+
for (i = minor; i < minor + max_ccb; i++)
731732
device_destroy(ilo_class, MKDEV(ilo_major, i));
732733

733734
cdev_del(&ilo_hw->cdev);
@@ -737,7 +738,7 @@ static void ilo_remove(struct pci_dev *pdev)
737738
pci_release_regions(pdev);
738739
pci_disable_device(pdev);
739740
kfree(ilo_hw);
740-
ilo_hwdev[(minor / MAX_CCB)] = 0;
741+
ilo_hwdev[(minor / max_ccb)] = 0;
741742
}
742743

743744
static int __devinit ilo_probe(struct pci_dev *pdev,
@@ -746,6 +747,11 @@ static int __devinit ilo_probe(struct pci_dev *pdev,
746747
int devnum, minor, start, error;
747748
struct ilo_hwinfo *ilo_hw;
748749

750+
if (max_ccb > MAX_CCB)
751+
max_ccb = MAX_CCB;
752+
else if (max_ccb < MIN_CCB)
753+
max_ccb = MIN_CCB;
754+
749755
/* find a free range for device files */
750756
for (devnum = 0; devnum < MAX_ILO_DEV; devnum++) {
751757
if (ilo_hwdev[devnum] == 0) {
@@ -795,14 +801,14 @@ static int __devinit ilo_probe(struct pci_dev *pdev,
795801

796802
cdev_init(&ilo_hw->cdev, &ilo_fops);
797803
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);
800806
if (error) {
801807
dev_err(&pdev->dev, "Could not add cdev\n");
802808
goto remove_isr;
803809
}
804810

805-
for (minor = 0 ; minor < MAX_CCB; minor++) {
811+
for (minor = 0 ; minor < max_ccb; minor++) {
806812
struct device *dev;
807813
dev = device_create(ilo_class, &pdev->dev,
808814
MKDEV(ilo_major, minor), NULL,
@@ -879,11 +885,14 @@ static void __exit ilo_exit(void)
879885
class_destroy(ilo_class);
880886
}
881887

882-
MODULE_VERSION("1.2");
888+
MODULE_VERSION("1.3");
883889
MODULE_ALIAS(ILO_NAME);
884890
MODULE_DESCRIPTION(ILO_NAME);
885891
MODULE_AUTHOR("David Altobelli <david.altobelli@hp.com>");
886892
MODULE_LICENSE("GPL v2");
887893

894+
module_param(max_ccb, uint, 0444);
895+
MODULE_PARM_DESC(max_ccb, "Maximum number of HP iLO channels to attach (8)");
896+
888897
module_init(ilo_init);
889898
module_exit(ilo_exit);

‎drivers/misc/hpilo.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
#define ILO_NAME "hpilo"
1515

1616
/* 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
1820
/* max number of supported devices */
1921
#define MAX_ILO_DEV 1
2022
/* max number of files */

0 commit comments

Comments
 (0)