diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2008-01-17 12:02:09 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-01-23 12:29:29 -0500 |
commit | 3776541d8a46347a4924353a192c6ce4a3d04e2e (patch) | |
tree | a679ae851b943a1f28079066009c41ba9f718cfb /drivers/scsi/qla2xxx | |
parent | 43ef058010c79a967195539bbcdeee8c5b24219d (diff) |
[SCSI] qla2xxx: Fix for 32-bit platforms with 64-bit resources.
The driver stores the contents of PCI resources into unsigned
long's before ioremapping. This breaks on 32-bit platforms which
support 64-bit MMIO resources.
Correct code by removing the temporary variables used during MMIO
PIO mapping and using resource_size_t where applicable. Also
correct a small typo in a printk() where the wrong region number
was displayed.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_def.h | 3 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 22 |
2 files changed, 8 insertions, 17 deletions
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index a33d3d57a17e..d0b78af60f7b 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -2271,8 +2271,7 @@ typedef struct scsi_qla_host { | |||
2271 | 2271 | ||
2272 | int bars; | 2272 | int bars; |
2273 | device_reg_t __iomem *iobase; /* Base I/O address */ | 2273 | device_reg_t __iomem *iobase; /* Base I/O address */ |
2274 | unsigned long pio_address; | 2274 | resource_size_t pio_address; |
2275 | unsigned long pio_length; | ||
2276 | #define MIN_IOBASE_LEN 0x100 | 2275 | #define MIN_IOBASE_LEN 0x100 |
2277 | 2276 | ||
2278 | /* ISP ring lock, rings, and indexes */ | 2277 | /* ISP ring lock, rings, and indexes */ |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index a5bcf1f390b3..df1694a2f875 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -1479,8 +1479,7 @@ qla2x00_set_isp_flags(scsi_qla_host_t *ha) | |||
1479 | static int | 1479 | static int |
1480 | qla2x00_iospace_config(scsi_qla_host_t *ha) | 1480 | qla2x00_iospace_config(scsi_qla_host_t *ha) |
1481 | { | 1481 | { |
1482 | unsigned long pio, pio_len, pio_flags; | 1482 | resource_size_t pio; |
1483 | unsigned long mmio, mmio_len, mmio_flags; | ||
1484 | 1483 | ||
1485 | if (pci_request_selected_regions(ha->pdev, ha->bars, | 1484 | if (pci_request_selected_regions(ha->pdev, ha->bars, |
1486 | QLA2XXX_DRIVER_NAME)) { | 1485 | QLA2XXX_DRIVER_NAME)) { |
@@ -1495,10 +1494,8 @@ qla2x00_iospace_config(scsi_qla_host_t *ha) | |||
1495 | 1494 | ||
1496 | /* We only need PIO for Flash operations on ISP2312 v2 chips. */ | 1495 | /* We only need PIO for Flash operations on ISP2312 v2 chips. */ |
1497 | pio = pci_resource_start(ha->pdev, 0); | 1496 | pio = pci_resource_start(ha->pdev, 0); |
1498 | pio_len = pci_resource_len(ha->pdev, 0); | 1497 | if (pci_resource_flags(ha->pdev, 0) & IORESOURCE_IO) { |
1499 | pio_flags = pci_resource_flags(ha->pdev, 0); | 1498 | if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { |
1500 | if (pio_flags & IORESOURCE_IO) { | ||
1501 | if (pio_len < MIN_IOBASE_LEN) { | ||
1502 | qla_printk(KERN_WARNING, ha, | 1499 | qla_printk(KERN_WARNING, ha, |
1503 | "Invalid PCI I/O region size (%s)...\n", | 1500 | "Invalid PCI I/O region size (%s)...\n", |
1504 | pci_name(ha->pdev)); | 1501 | pci_name(ha->pdev)); |
@@ -1511,28 +1508,23 @@ qla2x00_iospace_config(scsi_qla_host_t *ha) | |||
1511 | pio = 0; | 1508 | pio = 0; |
1512 | } | 1509 | } |
1513 | ha->pio_address = pio; | 1510 | ha->pio_address = pio; |
1514 | ha->pio_length = pio_len; | ||
1515 | 1511 | ||
1516 | skip_pio: | 1512 | skip_pio: |
1517 | /* Use MMIO operations for all accesses. */ | 1513 | /* Use MMIO operations for all accesses. */ |
1518 | mmio = pci_resource_start(ha->pdev, 1); | 1514 | if (!(pci_resource_flags(ha->pdev, 1) & IORESOURCE_MEM)) { |
1519 | mmio_len = pci_resource_len(ha->pdev, 1); | ||
1520 | mmio_flags = pci_resource_flags(ha->pdev, 1); | ||
1521 | |||
1522 | if (!(mmio_flags & IORESOURCE_MEM)) { | ||
1523 | qla_printk(KERN_ERR, ha, | 1515 | qla_printk(KERN_ERR, ha, |
1524 | "region #0 not an MMIO resource (%s), aborting\n", | 1516 | "region #1 not an MMIO resource (%s), aborting\n", |
1525 | pci_name(ha->pdev)); | 1517 | pci_name(ha->pdev)); |
1526 | goto iospace_error_exit; | 1518 | goto iospace_error_exit; |
1527 | } | 1519 | } |
1528 | if (mmio_len < MIN_IOBASE_LEN) { | 1520 | if (pci_resource_len(ha->pdev, 1) < MIN_IOBASE_LEN) { |
1529 | qla_printk(KERN_ERR, ha, | 1521 | qla_printk(KERN_ERR, ha, |
1530 | "Invalid PCI mem region size (%s), aborting\n", | 1522 | "Invalid PCI mem region size (%s), aborting\n", |
1531 | pci_name(ha->pdev)); | 1523 | pci_name(ha->pdev)); |
1532 | goto iospace_error_exit; | 1524 | goto iospace_error_exit; |
1533 | } | 1525 | } |
1534 | 1526 | ||
1535 | ha->iobase = ioremap(mmio, MIN_IOBASE_LEN); | 1527 | ha->iobase = ioremap(pci_resource_start(ha->pdev, 1), MIN_IOBASE_LEN); |
1536 | if (!ha->iobase) { | 1528 | if (!ha->iobase) { |
1537 | qla_printk(KERN_ERR, ha, | 1529 | qla_printk(KERN_ERR, ha, |
1538 | "cannot remap MMIO (%s), aborting\n", pci_name(ha->pdev)); | 1530 | "cannot remap MMIO (%s), aborting\n", pci_name(ha->pdev)); |