aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorEd Lin <ed.lin@promise.com>2009-03-31 21:30:25 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-04-03 10:23:09 -0400
commit99946f8141f65a8bd5034ac5b1a53237aec8743e (patch)
treed3c2b98039a5d27c664c1e7acae0ccff60f24c10 /drivers/scsi
parentf14981616205eedb6fe8b24a09ec103ed976e122 (diff)
[SCSI] stex: add MSI support
This adds the MSI support (default 0=off) Signed-off-by: Ed Lin <ed.lin@promise.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/stex.c48
1 files changed, 43 insertions, 5 deletions
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index de6c30e37463..c4eb5c1cc1bc 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -292,11 +292,15 @@ struct st_hba {
292 struct st_ccb *wait_ccb; 292 struct st_ccb *wait_ccb;
293 293
294 unsigned int mu_status; 294 unsigned int mu_status;
295 int out_req_cnt;
296
297 unsigned int cardtype; 295 unsigned int cardtype;
296 int msi_enabled;
297 int out_req_cnt;
298}; 298};
299 299
300static int msi;
301module_param(msi, int, 0);
302MODULE_PARM_DESC(msi, "Enable Message Signaled Interrupts(0=off, 1=on)");
303
300static const char console_inq_page[] = 304static const char console_inq_page[] =
301{ 305{
302 0x03,0x00,0x03,0x03,0xFA,0x00,0x00,0x30, 306 0x03,0x00,0x03,0x03,0xFA,0x00,0x00,0x30,
@@ -1041,6 +1045,40 @@ static int stex_set_dma_mask(struct pci_dev * pdev)
1041 return ret; 1045 return ret;
1042} 1046}
1043 1047
1048static int stex_request_irq(struct st_hba *hba)
1049{
1050 struct pci_dev *pdev = hba->pdev;
1051 int status;
1052
1053 if (msi) {
1054 status = pci_enable_msi(pdev);
1055 if (status != 0)
1056 printk(KERN_ERR DRV_NAME
1057 "(%s): error %d setting up MSI\n",
1058 pci_name(pdev), status);
1059 else
1060 hba->msi_enabled = 1;
1061 } else
1062 hba->msi_enabled = 0;
1063
1064 status = request_irq(pdev->irq, stex_intr, IRQF_SHARED, DRV_NAME, hba);
1065
1066 if (status != 0) {
1067 if (hba->msi_enabled)
1068 pci_disable_msi(pdev);
1069 }
1070 return status;
1071}
1072
1073static void stex_free_irq(struct st_hba *hba)
1074{
1075 struct pci_dev *pdev = hba->pdev;
1076
1077 free_irq(pdev->irq, hba);
1078 if (hba->msi_enabled)
1079 pci_disable_msi(pdev);
1080}
1081
1044static int __devinit 1082static int __devinit
1045stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) 1083stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1046{ 1084{
@@ -1125,7 +1163,7 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1125 hba->host = host; 1163 hba->host = host;
1126 hba->pdev = pdev; 1164 hba->pdev = pdev;
1127 1165
1128 err = request_irq(pdev->irq, stex_intr, IRQF_SHARED, DRV_NAME, hba); 1166 err = stex_request_irq(hba);
1129 if (err) { 1167 if (err) {
1130 printk(KERN_ERR DRV_NAME "(%s): request irq failed\n", 1168 printk(KERN_ERR DRV_NAME "(%s): request irq failed\n",
1131 pci_name(pdev)); 1169 pci_name(pdev));
@@ -1157,7 +1195,7 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1157 return 0; 1195 return 0;
1158 1196
1159out_free_irq: 1197out_free_irq:
1160 free_irq(pdev->irq, hba); 1198 stex_free_irq(hba);
1161out_pci_free: 1199out_pci_free:
1162 dma_free_coherent(&pdev->dev, hba->dma_size, 1200 dma_free_coherent(&pdev->dev, hba->dma_size,
1163 hba->dma_mem, hba->dma_handle); 1201 hba->dma_mem, hba->dma_handle);
@@ -1216,7 +1254,7 @@ static void stex_hba_stop(struct st_hba *hba)
1216 1254
1217static void stex_hba_free(struct st_hba *hba) 1255static void stex_hba_free(struct st_hba *hba)
1218{ 1256{
1219 free_irq(hba->pdev->irq, hba); 1257 stex_free_irq(hba);
1220 1258
1221 iounmap(hba->mmio_base); 1259 iounmap(hba->mmio_base);
1222 1260