Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cciss: Add cciss_allow_hpsa module parameter

Add cciss_allow_hpsa module parameter. This parameter causes
the cciss driver to ignore any Smart Array devices known to be
supported by the hpsa driver.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

authored by

Stephen M. Cameron and committed by
Jens Axboe
2ec24ff1 2cfa948c

+34 -40
+34 -40
drivers/block/cciss.c
··· 68 68 MODULE_VERSION("3.6.20"); 69 69 MODULE_LICENSE("GPL"); 70 70 71 + static int cciss_allow_hpsa; 72 + module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR); 73 + MODULE_PARM_DESC(cciss_allow_hpsa, 74 + "Prevent cciss driver from accessing hardware known to be " 75 + " supported by the hpsa driver"); 76 + 71 77 #include "cciss_cmd.h" 72 78 #include "cciss.h" 73 79 #include <linux/cciss_ioctl.h> ··· 107 101 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249}, 108 102 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324A}, 109 103 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324B}, 110 - {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 111 - PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, 112 104 {0,} 113 105 }; 114 106 ··· 127 123 {0x409D0E11, "Smart Array 6400 EM", &SA5_access}, 128 124 {0x40910E11, "Smart Array 6i", &SA5_access}, 129 125 {0x3225103C, "Smart Array P600", &SA5_access}, 130 - {0x3223103C, "Smart Array P800", &SA5_access}, 131 - {0x3234103C, "Smart Array P400", &SA5_access}, 132 126 {0x3235103C, "Smart Array P400i", &SA5_access}, 133 127 {0x3211103C, "Smart Array E200i", &SA5_access}, 134 128 {0x3212103C, "Smart Array E200", &SA5_access}, ··· 134 132 {0x3214103C, "Smart Array E200i", &SA5_access}, 135 133 {0x3215103C, "Smart Array E200i", &SA5_access}, 136 134 {0x3237103C, "Smart Array E500", &SA5_access}, 135 + /* controllers below this line are also supported by the hpsa driver. */ 136 + #define HPSA_BOUNDARY 0x3223103C 137 + {0x3223103C, "Smart Array P800", &SA5_access}, 138 + {0x3234103C, "Smart Array P400", &SA5_access}, 137 139 {0x323D103C, "Smart Array P700m", &SA5_access}, 138 140 {0x3241103C, "Smart Array P212", &SA5_access}, 139 141 {0x3243103C, "Smart Array P410", &SA5_access}, ··· 146 140 {0x3249103C, "Smart Array P812", &SA5_access}, 147 141 {0x324A103C, "Smart Array P712m", &SA5_access}, 148 142 {0x324B103C, "Smart Array P711m", &SA5_access}, 149 - {0xFFFF103C, "Unknown Smart Array", &SA5_access}, 150 143 }; 151 144 152 145 /* How long to wait (in milliseconds) for board to go into simple mode */ ··· 3759 3754 __u64 cfg_offset; 3760 3755 __u32 cfg_base_addr; 3761 3756 __u64 cfg_base_addr_index; 3762 - int i, err; 3757 + int i, prod_index, err; 3758 + 3759 + subsystem_vendor_id = pdev->subsystem_vendor; 3760 + subsystem_device_id = pdev->subsystem_device; 3761 + board_id = (((__u32) (subsystem_device_id << 16) & 0xffff0000) | 3762 + subsystem_vendor_id); 3763 + 3764 + for (i = 0; i < ARRAY_SIZE(products); i++) { 3765 + /* Stand aside for hpsa driver on request */ 3766 + if (cciss_allow_hpsa && products[i].board_id == HPSA_BOUNDARY) 3767 + return -ENODEV; 3768 + if (board_id == products[i].board_id) 3769 + break; 3770 + } 3771 + prod_index = i; 3772 + if (prod_index == ARRAY_SIZE(products)) { 3773 + dev_warn(&pdev->dev, 3774 + "unrecognized board ID: 0x%08lx, ignoring.\n", 3775 + (unsigned long) board_id); 3776 + return -ENODEV; 3777 + } 3763 3778 3764 3779 /* check to see if controller has been disabled */ 3765 3780 /* BEFORE trying to enable it */ ··· 3802 3777 "aborting\n"); 3803 3778 return err; 3804 3779 } 3805 - 3806 - subsystem_vendor_id = pdev->subsystem_vendor; 3807 - subsystem_device_id = pdev->subsystem_device; 3808 - board_id = (((__u32) (subsystem_device_id << 16) & 0xffff0000) | 3809 - subsystem_vendor_id); 3810 3780 3811 3781 #ifdef CCISS_DEBUG 3812 3782 printk("command = %x\n", command); ··· 3888 3868 * leave a little room for ioctl calls. 3889 3869 */ 3890 3870 c->max_commands = readl(&(c->cfgtable->CmdsOutMax)); 3891 - for (i = 0; i < ARRAY_SIZE(products); i++) { 3892 - if (board_id == products[i].board_id) { 3893 - c->product_name = products[i].product_name; 3894 - c->access = *(products[i].access); 3895 - c->nr_cmds = c->max_commands - 4; 3896 - break; 3897 - } 3898 - } 3871 + c->product_name = products[prod_index].product_name; 3872 + c->access = *(products[prod_index].access); 3873 + c->nr_cmds = c->max_commands - 4; 3899 3874 if ((readb(&c->cfgtable->Signature[0]) != 'C') || 3900 3875 (readb(&c->cfgtable->Signature[1]) != 'I') || 3901 3876 (readb(&c->cfgtable->Signature[2]) != 'S') || ··· 3898 3883 printk("Does not appear to be a valid CISS config table\n"); 3899 3884 err = -ENODEV; 3900 3885 goto err_out_free_res; 3901 - } 3902 - /* We didn't find the controller in our list. We know the 3903 - * signature is valid. If it's an HP device let's try to 3904 - * bind to the device and fire it up. Otherwise we bail. 3905 - */ 3906 - if (i == ARRAY_SIZE(products)) { 3907 - if (subsystem_vendor_id == PCI_VENDOR_ID_HP) { 3908 - c->product_name = products[i-1].product_name; 3909 - c->access = *(products[i-1].access); 3910 - c->nr_cmds = c->max_commands - 4; 3911 - printk(KERN_WARNING "cciss: This is an unknown " 3912 - "Smart Array controller.\n" 3913 - "cciss: Please update to the latest driver " 3914 - "available from www.hp.com.\n"); 3915 - } else { 3916 - printk(KERN_WARNING "cciss: Sorry, I don't know how" 3917 - " to access the Smart Array controller %08lx\n" 3918 - , (unsigned long)board_id); 3919 - err = -ENODEV; 3920 - goto err_out_free_res; 3921 - } 3922 3886 } 3923 3887 #ifdef CONFIG_X86 3924 3888 {