Commit 00769ec4 authored by Jeff Garzik's avatar Jeff Garzik Committed by James Bottomley

[SCSI] megaraid: fix MMIO casts

megaraid's MMIO RD*/WR* macros directly call readl() and writel() with
an 'unsigned long' argument.  This throws a warning, but is otherwise OK
because the 'unsigned long' is really the result of ioremap().  This
setup is also OK because the variable can hold an ioremap cookie /or/ a
PCI I/O port (PIO).

However, to fix the warning thrown when readl() and writel() are passed
an unsigned long cookie, I introduce 'void __iomem *mmio_base', holding
the same value as 'base'.  This will silence the warnings, and also
cause an oops whenever these MMIO-only functions are ever accidentally
passed an I/O address.
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent e42ebefe
...@@ -73,10 +73,10 @@ static unsigned short int max_mbox_busy_wait = MBOX_BUSY_WAIT; ...@@ -73,10 +73,10 @@ static unsigned short int max_mbox_busy_wait = MBOX_BUSY_WAIT;
module_param(max_mbox_busy_wait, ushort, 0); module_param(max_mbox_busy_wait, ushort, 0);
MODULE_PARM_DESC(max_mbox_busy_wait, "Maximum wait for mailbox in microseconds if busy (default=MBOX_BUSY_WAIT=10)"); MODULE_PARM_DESC(max_mbox_busy_wait, "Maximum wait for mailbox in microseconds if busy (default=MBOX_BUSY_WAIT=10)");
#define RDINDOOR(adapter) readl((adapter)->base + 0x20) #define RDINDOOR(adapter) readl((adapter)->mmio_base + 0x20)
#define RDOUTDOOR(adapter) readl((adapter)->base + 0x2C) #define RDOUTDOOR(adapter) readl((adapter)->mmio_base + 0x2C)
#define WRINDOOR(adapter,value) writel(value, (adapter)->base + 0x20) #define WRINDOOR(adapter,value) writel(value, (adapter)->mmio_base + 0x20)
#define WROUTDOOR(adapter,value) writel(value, (adapter)->base + 0x2C) #define WROUTDOOR(adapter,value) writel(value, (adapter)->mmio_base + 0x2C)
/* /*
* Global variables * Global variables
...@@ -1386,7 +1386,8 @@ megaraid_isr_memmapped(int irq, void *devp) ...@@ -1386,7 +1386,8 @@ megaraid_isr_memmapped(int irq, void *devp)
handled = 1; handled = 1;
while( RDINDOOR(adapter) & 0x02 ) cpu_relax(); while( RDINDOOR(adapter) & 0x02 )
cpu_relax();
mega_cmd_done(adapter, completed, nstatus, status); mega_cmd_done(adapter, completed, nstatus, status);
...@@ -4668,6 +4669,8 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -4668,6 +4669,8 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
host->host_no, mega_baseport, irq); host->host_no, mega_baseport, irq);
adapter->base = mega_baseport; adapter->base = mega_baseport;
if (flag & BOARD_MEMMAP)
adapter->mmio_base = (void __iomem *) mega_baseport;
INIT_LIST_HEAD(&adapter->free_list); INIT_LIST_HEAD(&adapter->free_list);
INIT_LIST_HEAD(&adapter->pending_list); INIT_LIST_HEAD(&adapter->pending_list);
......
...@@ -802,6 +802,7 @@ typedef struct { ...@@ -802,6 +802,7 @@ typedef struct {
u32 flag; u32 flag;
unsigned long base; unsigned long base;
void __iomem *mmio_base;
/* mbox64 with mbox not aligned on 16-byte boundry */ /* mbox64 with mbox not aligned on 16-byte boundry */
mbox64_t *una_mbox64; mbox64_t *una_mbox64;
......
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