Commit 23f0bb47a4ec4c662b2bbf0221d6289e91b06ece

Authored by HighPoint Linux Team
Committed by James Bottomley
1 parent f3d8af9e27

[SCSI] hptiop: fix RR312x in hosts with >12GB

As the limitation of RR312x's dma engine, the HBA can not access host memory
over 12GB.  This fixes

https://bugzilla.kernel.org/show_bug.cgi?id=14311

[alan: resurrected bug from 2009 and pushed upstream]
Reported-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: HighPoint Linux Team <linux@highpoint-tech.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

Showing 2 changed files with 8 additions and 3 deletions Side-by-side Diff

drivers/scsi/hptiop.c
... ... @@ -42,7 +42,7 @@
42 42  
43 43 static char driver_name[] = "hptiop";
44 44 static const char driver_name_long[] = "RocketRAID 3xxx/4xxx Controller driver";
45   -static const char driver_ver[] = "v1.6 (090910)";
  45 +static const char driver_ver[] = "v1.6 (091225)";
46 46  
47 47 static int iop_send_sync_msg(struct hptiop_hba *hba, u32 msg, u32 millisec);
48 48 static void hptiop_finish_scsi_req(struct hptiop_hba *hba, u32 tag,
... ... @@ -958,6 +958,7 @@
958 958 {
959 959 struct Scsi_Host *host = NULL;
960 960 struct hptiop_hba *hba;
  961 + struct hptiop_adapter_ops *iop_ops;
961 962 struct hpt_iop_request_get_config iop_config;
962 963 struct hpt_iop_request_set_config set_config;
963 964 dma_addr_t start_phy;
... ... @@ -978,7 +979,8 @@
978 979 pci_set_master(pcidev);
979 980  
980 981 /* Enable 64bit DMA if possible */
981   - if (pci_set_dma_mask(pcidev, DMA_BIT_MASK(64))) {
  982 + iop_ops = (struct hptiop_adapter_ops *)id->driver_data;
  983 + if (pci_set_dma_mask(pcidev, DMA_BIT_MASK(iop_ops->hw_dma_bit_mask))) {
982 984 if (pci_set_dma_mask(pcidev, DMA_BIT_MASK(32))) {
983 985 printk(KERN_ERR "hptiop: fail to set dma_mask\n");
984 986 goto disable_pci_device;
... ... @@ -998,7 +1000,7 @@
998 1000  
999 1001 hba = (struct hptiop_hba *)host->hostdata;
1000 1002  
1001   - hba->ops = (struct hptiop_adapter_ops *)id->driver_data;
  1003 + hba->ops = iop_ops;
1002 1004 hba->pcidev = pcidev;
1003 1005 hba->host = host;
1004 1006 hba->initialized = 0;
... ... @@ -1239,6 +1241,7 @@
1239 1241 .iop_intr = iop_intr_itl,
1240 1242 .post_msg = hptiop_post_msg_itl,
1241 1243 .post_req = hptiop_post_req_itl,
  1244 + .hw_dma_bit_mask = 64,
1242 1245 };
1243 1246  
1244 1247 static struct hptiop_adapter_ops hptiop_mv_ops = {
... ... @@ -1254,6 +1257,7 @@
1254 1257 .iop_intr = iop_intr_mv,
1255 1258 .post_msg = hptiop_post_msg_mv,
1256 1259 .post_req = hptiop_post_req_mv,
  1260 + .hw_dma_bit_mask = 33,
1257 1261 };
1258 1262  
1259 1263 static struct pci_device_id hptiop_id_table[] = {
drivers/scsi/hptiop.h
... ... @@ -297,6 +297,7 @@
297 297 int (*iop_intr)(struct hptiop_hba *hba);
298 298 void (*post_msg)(struct hptiop_hba *hba, u32 msg);
299 299 void (*post_req)(struct hptiop_hba *hba, struct hptiop_request *_req);
  300 + int hw_dma_bit_mask;
300 301 };
301 302  
302 303 #define HPT_IOCTL_RESULT_OK 0