aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c9
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.h2
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm_pci.c19
3 files changed, 9 insertions, 21 deletions
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 9bfcca5ede08..c7fe478f4813 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1126,15 +1126,6 @@ ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *templa
1126 return 0; 1126 return 0;
1127} 1127}
1128 1128
1129uint64_t
1130ahd_linux_get_memsize(void)
1131{
1132 struct sysinfo si;
1133
1134 si_meminfo(&si);
1135 return ((uint64_t)si.totalram << PAGE_SHIFT);
1136}
1137
1138/* 1129/*
1139 * Place the SCSI bus into a known state by either resetting it, 1130 * Place the SCSI bus into a known state by either resetting it,
1140 * or forcing transfer negotiations on the next command to any 1131 * or forcing transfer negotiations on the next command to any
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h
index 3a67fc578d78..147c83c456a5 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.h
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.h
@@ -496,8 +496,6 @@ ahd_insb(struct ahd_softc * ahd, long port, uint8_t *array, int count)
496int ahd_linux_register_host(struct ahd_softc *, 496int ahd_linux_register_host(struct ahd_softc *,
497 struct scsi_host_template *); 497 struct scsi_host_template *);
498 498
499uint64_t ahd_linux_get_memsize(void);
500
501/*************************** Pretty Printing **********************************/ 499/*************************** Pretty Printing **********************************/
502struct info_str { 500struct info_str {
503 char *buffer; 501 char *buffer;
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
index 1a3ab6aa856b..c62ce41f2793 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
@@ -132,6 +132,7 @@ ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
132 struct ahd_pci_identity *entry; 132 struct ahd_pci_identity *entry;
133 char *name; 133 char *name;
134 int error; 134 int error;
135 struct device *dev = &pdev->dev;
135 136
136 pci = pdev; 137 pci = pdev;
137 entry = ahd_find_pci_device(pci); 138 entry = ahd_find_pci_device(pci);
@@ -161,20 +162,18 @@ ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
161 pci_set_master(pdev); 162 pci_set_master(pdev);
162 163
163 if (sizeof(dma_addr_t) > 4) { 164 if (sizeof(dma_addr_t) > 4) {
164 uint64_t memsize; 165 const u64 required_mask = dma_get_required_mask(dev);
165 const uint64_t mask_39bit = 0x7FFFFFFFFFULL;
166 166
167 memsize = ahd_linux_get_memsize(); 167 if (required_mask > DMA_39BIT_MASK &&
168 168 dma_set_mask(dev, DMA_64BIT_MASK) == 0)
169 if (memsize >= 0x8000000000ULL
170 && pci_set_dma_mask(pdev, DMA_64BIT_MASK) == 0) {
171 ahd->flags |= AHD_64BIT_ADDRESSING; 169 ahd->flags |= AHD_64BIT_ADDRESSING;
172 } else if (memsize > 0x80000000 170 else if (required_mask > DMA_32BIT_MASK &&
173 && pci_set_dma_mask(pdev, mask_39bit) == 0) { 171 dma_set_mask(dev, DMA_39BIT_MASK) == 0)
174 ahd->flags |= AHD_39BIT_ADDRESSING; 172 ahd->flags |= AHD_39BIT_ADDRESSING;
175 } 173 else
174 dma_set_mask(dev, DMA_32BIT_MASK);
176 } else { 175 } else {
177 pci_set_dma_mask(pdev, DMA_32BIT_MASK); 176 dma_set_mask(dev, DMA_32BIT_MASK);
178 } 177 }
179 ahd->dev_softc = pci; 178 ahd->dev_softc = pci;
180 error = ahd_pci_config(ahd, entry); 179 error = ahd_pci_config(ahd, entry);