[SCSI] aic79xx: use dma_get_required_mask()
As originally noted by Frederic Temporelli, the aic79xx supports 64 bit addressing, but the initialization code of the driver is wrong: it tests the available memory size instead of testing the maximum available memory address. This patch uses the correct dma_get_required_mask() macros to determine the correct addressing method. Signed-off-by: Hannes Reinecke <hare@suse.de> Cc: Xavier Bru <xavier.bru@bull.net> CC: Frederic Temporelli <frederic.temporelli@bull.net> cosmetic fixes Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
parent
5504802117
commit
19966769f9
|
@ -1126,15 +1126,6 @@ ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *templa
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
|
||||||
ahd_linux_get_memsize(void)
|
|
||||||
{
|
|
||||||
struct sysinfo si;
|
|
||||||
|
|
||||||
si_meminfo(&si);
|
|
||||||
return ((uint64_t)si.totalram << PAGE_SHIFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Place the SCSI bus into a known state by either resetting it,
|
* Place the SCSI bus into a known state by either resetting it,
|
||||||
* or forcing transfer negotiations on the next command to any
|
* or forcing transfer negotiations on the next command to any
|
||||||
|
|
|
@ -496,8 +496,6 @@ ahd_insb(struct ahd_softc * ahd, long port, uint8_t *array, int count)
|
||||||
int ahd_linux_register_host(struct ahd_softc *,
|
int ahd_linux_register_host(struct ahd_softc *,
|
||||||
struct scsi_host_template *);
|
struct scsi_host_template *);
|
||||||
|
|
||||||
uint64_t ahd_linux_get_memsize(void);
|
|
||||||
|
|
||||||
/*************************** Pretty Printing **********************************/
|
/*************************** Pretty Printing **********************************/
|
||||||
struct info_str {
|
struct info_str {
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
|
|
@ -132,6 +132,7 @@ ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
struct ahd_pci_identity *entry;
|
struct ahd_pci_identity *entry;
|
||||||
char *name;
|
char *name;
|
||||||
int error;
|
int error;
|
||||||
|
struct device *dev = &pdev->dev;
|
||||||
|
|
||||||
pci = pdev;
|
pci = pdev;
|
||||||
entry = ahd_find_pci_device(pci);
|
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)
|
||||||
pci_set_master(pdev);
|
pci_set_master(pdev);
|
||||||
|
|
||||||
if (sizeof(dma_addr_t) > 4) {
|
if (sizeof(dma_addr_t) > 4) {
|
||||||
uint64_t memsize;
|
const u64 required_mask = dma_get_required_mask(dev);
|
||||||
const uint64_t mask_39bit = 0x7FFFFFFFFFULL;
|
|
||||||
|
|
||||||
memsize = ahd_linux_get_memsize();
|
if (required_mask > DMA_39BIT_MASK &&
|
||||||
|
dma_set_mask(dev, DMA_64BIT_MASK) == 0)
|
||||||
if (memsize >= 0x8000000000ULL
|
|
||||||
&& pci_set_dma_mask(pdev, DMA_64BIT_MASK) == 0) {
|
|
||||||
ahd->flags |= AHD_64BIT_ADDRESSING;
|
ahd->flags |= AHD_64BIT_ADDRESSING;
|
||||||
} else if (memsize > 0x80000000
|
else if (required_mask > DMA_32BIT_MASK &&
|
||||||
&& pci_set_dma_mask(pdev, mask_39bit) == 0) {
|
dma_set_mask(dev, DMA_39BIT_MASK) == 0)
|
||||||
ahd->flags |= AHD_39BIT_ADDRESSING;
|
ahd->flags |= AHD_39BIT_ADDRESSING;
|
||||||
}
|
else
|
||||||
|
dma_set_mask(dev, DMA_32BIT_MASK);
|
||||||
} else {
|
} else {
|
||||||
pci_set_dma_mask(pdev, DMA_32BIT_MASK);
|
dma_set_mask(dev, DMA_32BIT_MASK);
|
||||||
}
|
}
|
||||||
ahd->dev_softc = pci;
|
ahd->dev_softc = pci;
|
||||||
error = ahd_pci_config(ahd, entry);
|
error = ahd_pci_config(ahd, entry);
|
||||||
|
|
Loading…
Reference in New Issue