Commit a89f29f6 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

[SCSI] aic7xxx: move to dma_get_required_mask() and correct 39 bit assumptions

This patch moves aic7xxx over to the dma_get_required_mask() API and
dumps its open coded memory check.

It also appears from this bug:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=167049

That 39 bit addressing doesn't work on older cards.  I surmise that the
AHC_LARGE_SCBS flag is the one that marks cards capable of using 39 bit
addressing, so I also folded that check into the code.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 154fb614
...@@ -1109,15 +1109,6 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa ...@@ -1109,15 +1109,6 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa
return (0); return (0);
} }
uint64_t
ahc_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
......
...@@ -494,8 +494,6 @@ ahc_insb(struct ahc_softc * ahc, long port, uint8_t *array, int count) ...@@ -494,8 +494,6 @@ ahc_insb(struct ahc_softc * ahc, long port, uint8_t *array, int count)
int ahc_linux_register_host(struct ahc_softc *, int ahc_linux_register_host(struct ahc_softc *,
struct scsi_host_template *); struct scsi_host_template *);
uint64_t ahc_linux_get_memsize(void);
/*************************** Pretty Printing **********************************/ /*************************** Pretty Printing **********************************/
struct info_str { struct info_str {
char *buffer; char *buffer;
......
...@@ -180,6 +180,7 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -180,6 +180,7 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
struct ahc_pci_identity *entry; struct ahc_pci_identity *entry;
char *name; char *name;
int error; int error;
struct device *dev = &pdev->dev;
pci = pdev; pci = pdev;
entry = ahc_find_pci_device(pci); entry = ahc_find_pci_device(pci);
...@@ -209,11 +210,12 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -209,11 +210,12 @@ ahc_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
&& ahc_linux_get_memsize() > 0x80000000 && ahc->features & AHC_LARGE_SCBS
&& pci_set_dma_mask(pdev, mask_39bit) == 0) { && dma_set_mask(dev, mask_39bit) == 0
&& dma_get_required_mask(dev) > DMA_32BIT_MASK) {
ahc->flags |= AHC_39BIT_ADDRESSING; ahc->flags |= AHC_39BIT_ADDRESSING;
} else { } else {
if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { if (dma_set_mask(dev, DMA_32BIT_MASK)) {
printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n"); printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n");
return (-ENODEV); return (-ENODEV);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment