@@ -68,6 +68,10 @@ static int cciss_tape_cmds = 6;
6868module_param (cciss_tape_cmds , int , 0644 );
6969MODULE_PARM_DESC (cciss_tape_cmds ,
7070 "number of commands to allocate for tape devices (default: 6)" );
71+ static int cciss_simple_mode ;
72+ module_param (cciss_simple_mode , int , S_IRUGO |S_IWUSR );
73+ MODULE_PARM_DESC (cciss_simple_mode ,
74+ "Use 'simple mode' rather than 'performant mode'" );
7175
7276static DEFINE_MUTEX (cciss_mutex );
7377static struct proc_dir_entry * proc_cciss ;
@@ -176,6 +180,7 @@ static void cciss_geometry_inquiry(ctlr_info_t *h, int logvol,
176180 unsigned int block_size , InquiryData_struct * inq_buff ,
177181 drive_info_struct * drv );
178182static void __devinit cciss_interrupt_mode (ctlr_info_t * );
183+ static int __devinit cciss_enter_simple_mode (struct ctlr_info * h );
179184static void start_io (ctlr_info_t * h );
180185static int sendcmd_withirq (ctlr_info_t * h , __u8 cmd , void * buff , size_t size ,
181186 __u8 page_code , unsigned char scsi3addr [],
@@ -388,7 +393,7 @@ static void cciss_seq_show_header(struct seq_file *seq)
388393 h -> product_name ,
389394 (unsigned long )h -> board_id ,
390395 h -> firm_ver [0 ], h -> firm_ver [1 ], h -> firm_ver [2 ],
391- h -> firm_ver [3 ], (unsigned int )h -> intr [PERF_MODE_INT ],
396+ h -> firm_ver [3 ], (unsigned int )h -> intr [h -> intr_mode ],
392397 h -> num_luns ,
393398 h -> Qdepth , h -> commands_outstanding ,
394399 h -> maxQsinceinit , h -> max_outstanding , h -> maxSG );
@@ -636,6 +641,18 @@ static ssize_t host_store_rescan(struct device *dev,
636641}
637642static DEVICE_ATTR (rescan , S_IWUSR , NULL, host_store_rescan ) ;
638643
644+ static ssize_t host_show_transport_mode (struct device * dev ,
645+ struct device_attribute * attr ,
646+ char * buf )
647+ {
648+ struct ctlr_info * h = to_hba (dev );
649+
650+ return snprintf (buf , 20 , "%s\n" ,
651+ h -> transMethod & CFGTBL_Trans_Performant ?
652+ "performant" : "simple" );
653+ }
654+ static DEVICE_ATTR (transport_mode , S_IRUGO , host_show_transport_mode , NULL) ;
655+
639656static ssize_t dev_show_unique_id (struct device * dev ,
640657 struct device_attribute * attr ,
641658 char * buf )
@@ -808,6 +825,7 @@ static DEVICE_ATTR(usage_count, S_IRUGO, cciss_show_usage_count, NULL);
808825static struct attribute * cciss_host_attrs [] = {
809826 & dev_attr_rescan .attr ,
810827 & dev_attr_resettable .attr ,
828+ & dev_attr_transport_mode .attr ,
811829 NULL
812830};
813831
@@ -3984,6 +4002,9 @@ static void __devinit cciss_put_controller_into_performant_mode(ctlr_info_t *h)
39844002{
39854003 __u32 trans_support ;
39864004
4005+ if (cciss_simple_mode )
4006+ return ;
4007+
39874008 dev_dbg (& h -> pdev -> dev , "Trying to put board into Performant mode\n" );
39884009 /* Attempt to put controller into performant mode if supported */
39894010 /* Does board support performant mode? */
@@ -4081,7 +4102,7 @@ static void __devinit cciss_interrupt_mode(ctlr_info_t *h)
40814102default_int_mode :
40824103#endif /* CONFIG_PCI_MSI */
40834104 /* if we get here we're going to use the default interrupt mode */
4084- h -> intr [PERF_MODE_INT ] = h -> pdev -> irq ;
4105+ h -> intr [h -> intr_mode ] = h -> pdev -> irq ;
40854106 return ;
40864107}
40874108
@@ -4341,6 +4362,9 @@ static int __devinit cciss_pci_init(ctlr_info_t *h)
43414362 }
43424363 cciss_enable_scsi_prefetch (h );
43434364 cciss_p600_dma_prefetch_quirk (h );
4365+ err = cciss_enter_simple_mode (h );
4366+ if (err )
4367+ goto err_out_free_res ;
43444368 cciss_put_controller_into_performant_mode (h );
43454369 return 0 ;
43464370
@@ -4533,6 +4557,13 @@ static int cciss_controller_hard_reset(struct pci_dev *pdev,
45334557 pmcsr &= ~PCI_PM_CTRL_STATE_MASK ;
45344558 pmcsr |= PCI_D0 ;
45354559 pci_write_config_word (pdev , pos + PCI_PM_CTRL , pmcsr );
4560+
4561+ /*
4562+ * The P600 requires a small delay when changing states.
4563+ * Otherwise we may think the board did not reset and we bail.
4564+ * This for kdump only and is particular to the P600.
4565+ */
4566+ msleep (500 );
45364567 }
45374568 return 0 ;
45384569}
@@ -4843,20 +4874,20 @@ static int cciss_request_irq(ctlr_info_t *h,
48434874 irqreturn_t (* intxhandler )(int , void * ))
48444875{
48454876 if (h -> msix_vector || h -> msi_vector ) {
4846- if (!request_irq (h -> intr [PERF_MODE_INT ], msixhandler ,
4877+ if (!request_irq (h -> intr [h -> intr_mode ], msixhandler ,
48474878 IRQF_DISABLED , h -> devname , h ))
48484879 return 0 ;
48494880 dev_err (& h -> pdev -> dev , "Unable to get msi irq %d"
4850- " for %s\n" , h -> intr [PERF_MODE_INT ],
4881+ " for %s\n" , h -> intr [h -> intr_mode ],
48514882 h -> devname );
48524883 return -1 ;
48534884 }
48544885
4855- if (!request_irq (h -> intr [PERF_MODE_INT ], intxhandler ,
4886+ if (!request_irq (h -> intr [h -> intr_mode ], intxhandler ,
48564887 IRQF_DISABLED , h -> devname , h ))
48574888 return 0 ;
48584889 dev_err (& h -> pdev -> dev , "Unable to get irq %d for %s\n" ,
4859- h -> intr [PERF_MODE_INT ], h -> devname );
4890+ h -> intr [h -> intr_mode ], h -> devname );
48604891 return -1 ;
48614892}
48624893
@@ -4887,7 +4918,7 @@ static void cciss_undo_allocations_after_kdump_soft_reset(ctlr_info_t *h)
48874918{
48884919 int ctlr = h -> ctlr ;
48894920
4890- free_irq (h -> intr [PERF_MODE_INT ], h );
4921+ free_irq (h -> intr [h -> intr_mode ], h );
48914922#ifdef CONFIG_PCI_MSI
48924923 if (h -> msix_vector )
48934924 pci_disable_msix (h -> pdev );
@@ -4953,6 +4984,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
49534984 h = hba [i ];
49544985 h -> pdev = pdev ;
49554986 h -> busy_initializing = 1 ;
4987+ h -> intr_mode = cciss_simple_mode ? SIMPLE_MODE_INT : PERF_MODE_INT ;
49564988 INIT_LIST_HEAD (& h -> cmpQ );
49574989 INIT_LIST_HEAD (& h -> reqQ );
49584990 mutex_init (& h -> busy_shutting_down );
@@ -5009,7 +5041,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
50095041
50105042 dev_info (& h -> pdev -> dev , "%s: <0x%x> at PCI %s IRQ %d%s using DAC\n" ,
50115043 h -> devname , pdev -> device , pci_name (pdev ),
5012- h -> intr [PERF_MODE_INT ], dac ? "" : " not" );
5044+ h -> intr [h -> intr_mode ], dac ? "" : " not" );
50135045
50145046 if (cciss_allocate_cmd_pool (h ))
50155047 goto clean4 ;
@@ -5056,7 +5088,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
50565088 spin_lock_irqsave (& h -> lock , flags );
50575089 h -> access .set_intr_mask (h , CCISS_INTR_OFF );
50585090 spin_unlock_irqrestore (& h -> lock , flags );
5059- free_irq (h -> intr [PERF_MODE_INT ], h );
5091+ free_irq (h -> intr [h -> intr_mode ], h );
50605092 rc = cciss_request_irq (h , cciss_msix_discard_completions ,
50615093 cciss_intx_discard_completions );
50625094 if (rc ) {
@@ -5133,7 +5165,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
51335165 cciss_free_cmd_pool (h );
51345166 cciss_free_scatterlists (h );
51355167 cciss_free_sg_chain_blocks (h -> cmd_sg_list , h -> nr_cmds );
5136- free_irq (h -> intr [PERF_MODE_INT ], h );
5168+ free_irq (h -> intr [h -> intr_mode ], h );
51375169clean2 :
51385170 unregister_blkdev (h -> major , h -> devname );
51395171clean1 :
@@ -5172,9 +5204,31 @@ static void cciss_shutdown(struct pci_dev *pdev)
51725204 if (return_code != IO_OK )
51735205 dev_warn (& h -> pdev -> dev , "Error flushing cache\n" );
51745206 h -> access .set_intr_mask (h , CCISS_INTR_OFF );
5175- free_irq (h -> intr [PERF_MODE_INT ], h );
5207+ free_irq (h -> intr [h -> intr_mode ], h );
5208+ }
5209+
5210+ static int __devinit cciss_enter_simple_mode (struct ctlr_info * h )
5211+ {
5212+ u32 trans_support ;
5213+
5214+ trans_support = readl (& (h -> cfgtable -> TransportSupport ));
5215+ if (!(trans_support & SIMPLE_MODE ))
5216+ return - ENOTSUPP ;
5217+
5218+ h -> max_commands = readl (& (h -> cfgtable -> CmdsOutMax ));
5219+ writel (CFGTBL_Trans_Simple , & (h -> cfgtable -> HostWrite .TransportRequest ));
5220+ writel (CFGTBL_ChangeReq , h -> vaddr + SA5_DOORBELL );
5221+ cciss_wait_for_mode_change_ack (h );
5222+ print_cfg_table (h );
5223+ if (!(readl (& (h -> cfgtable -> TransportActive )) & CFGTBL_Trans_Simple )) {
5224+ dev_warn (& h -> pdev -> dev , "unable to get board into simple mode\n" );
5225+ return - ENODEV ;
5226+ }
5227+ h -> transMethod = CFGTBL_Trans_Simple ;
5228+ return 0 ;
51765229}
51775230
5231+
51785232static void __devexit cciss_remove_one (struct pci_dev * pdev )
51795233{
51805234 ctlr_info_t * h ;
0 commit comments