Commit 2a2383da authored by Liu Gang's avatar Liu Gang Committed by Kumar Gala

powerpc/srio: Fix the compile errors when building with 64bit

For the file "arch/powerpc/sysdev/fsl_rmu.c", there will be some compile
errors while using the corenet64_smp_defconfig:

.../fsl_rmu.c:315: error: cast from pointer to integer of different size
.../fsl_rmu.c:320: error: cast to pointer from integer of different size
.../fsl_rmu.c:320: error: cast to pointer from integer of different size
.../fsl_rmu.c:320: error: cast to pointer from integer of different size
.../fsl_rmu.c:330: error: cast to pointer from integer of different size
.../fsl_rmu.c:332: error: cast to pointer from integer of different size
.../fsl_rmu.c:339: error: cast to pointer from integer of different size
.../fsl_rmu.c:340: error: cast to pointer from integer of different size
.../fsl_rmu.c:341: error: cast to pointer from integer of different size
.../fsl_rmu.c:348: error: cast to pointer from integer of different size
.../fsl_rmu.c:348: error: cast to pointer from integer of different size
.../fsl_rmu.c:348: error: cast to pointer from integer of different size
.../fsl_rmu.c:659: error: cast from pointer to integer of different size
.../fsl_rmu.c:659: error: format '%8.8x' expects type 'unsigned int',
                   but argument 5 has type 'size_t'
.../fsl_rmu.c:985: error: cast from pointer to integer of different size
.../fsl_rmu.c:997: error: cast to pointer from integer of different size

Rewrote the corresponding code with the support of 64bit building.
Signed-off-by: default avatarLiu Gang <Gang.Liu@freescale.com>
Signed-off-by: default avatarShaohui Xie <Shaohui.Xie@freescale.com>
Reported-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent b6c46dcf
...@@ -100,14 +100,8 @@ ...@@ -100,14 +100,8 @@
#define DOORBELL_DSR_TE 0x00000080 #define DOORBELL_DSR_TE 0x00000080
#define DOORBELL_DSR_QFI 0x00000010 #define DOORBELL_DSR_QFI 0x00000010
#define DOORBELL_DSR_DIQI 0x00000001 #define DOORBELL_DSR_DIQI 0x00000001
#define DOORBELL_TID_OFFSET 0x02
#define DOORBELL_SID_OFFSET 0x04
#define DOORBELL_INFO_OFFSET 0x06
#define DOORBELL_MESSAGE_SIZE 0x08 #define DOORBELL_MESSAGE_SIZE 0x08
#define DBELL_SID(x) (*(u16 *)(x + DOORBELL_SID_OFFSET))
#define DBELL_TID(x) (*(u16 *)(x + DOORBELL_TID_OFFSET))
#define DBELL_INF(x) (*(u16 *)(x + DOORBELL_INFO_OFFSET))
struct rio_msg_regs { struct rio_msg_regs {
u32 omr; u32 omr;
...@@ -193,6 +187,13 @@ struct fsl_rmu { ...@@ -193,6 +187,13 @@ struct fsl_rmu {
int rxirq; int rxirq;
}; };
struct rio_dbell_msg {
u16 pad1;
u16 tid;
u16 sid;
u16 info;
};
/** /**
* fsl_rio_tx_handler - MPC85xx outbound message interrupt handler * fsl_rio_tx_handler - MPC85xx outbound message interrupt handler
* @irq: Linux interrupt number * @irq: Linux interrupt number
...@@ -311,8 +312,8 @@ fsl_rio_dbell_handler(int irq, void *dev_instance) ...@@ -311,8 +312,8 @@ fsl_rio_dbell_handler(int irq, void *dev_instance)
/* XXX Need to check/dispatch until queue empty */ /* XXX Need to check/dispatch until queue empty */
if (dsr & DOORBELL_DSR_DIQI) { if (dsr & DOORBELL_DSR_DIQI) {
u32 dmsg = struct rio_dbell_msg *dmsg =
(u32) fsl_dbell->dbell_ring.virt + fsl_dbell->dbell_ring.virt +
(in_be32(&fsl_dbell->dbell_regs->dqdpar) & 0xfff); (in_be32(&fsl_dbell->dbell_regs->dqdpar) & 0xfff);
struct rio_dbell *dbell; struct rio_dbell *dbell;
int found = 0; int found = 0;
...@@ -320,25 +321,25 @@ fsl_rio_dbell_handler(int irq, void *dev_instance) ...@@ -320,25 +321,25 @@ fsl_rio_dbell_handler(int irq, void *dev_instance)
pr_debug pr_debug
("RIO: processing doorbell," ("RIO: processing doorbell,"
" sid %2.2x tid %2.2x info %4.4x\n", " sid %2.2x tid %2.2x info %4.4x\n",
DBELL_SID(dmsg), DBELL_TID(dmsg), DBELL_INF(dmsg)); dmsg->sid, dmsg->tid, dmsg->info);
for (i = 0; i < MAX_PORT_NUM; i++) { for (i = 0; i < MAX_PORT_NUM; i++) {
if (fsl_dbell->mport[i]) { if (fsl_dbell->mport[i]) {
list_for_each_entry(dbell, list_for_each_entry(dbell,
&fsl_dbell->mport[i]->dbells, node) { &fsl_dbell->mport[i]->dbells, node) {
if ((dbell->res->start if ((dbell->res->start
<= DBELL_INF(dmsg)) <= dmsg->info)
&& (dbell->res->end && (dbell->res->end
>= DBELL_INF(dmsg))) { >= dmsg->info)) {
found = 1; found = 1;
break; break;
} }
} }
if (found && dbell->dinb) { if (found && dbell->dinb) {
dbell->dinb(fsl_dbell->mport[i], dbell->dinb(fsl_dbell->mport[i],
dbell->dev_id, DBELL_SID(dmsg), dbell->dev_id, dmsg->sid,
DBELL_TID(dmsg), dmsg->tid,
DBELL_INF(dmsg)); dmsg->info);
break; break;
} }
} }
...@@ -348,8 +349,8 @@ fsl_rio_dbell_handler(int irq, void *dev_instance) ...@@ -348,8 +349,8 @@ fsl_rio_dbell_handler(int irq, void *dev_instance)
pr_debug pr_debug
("RIO: spurious doorbell," ("RIO: spurious doorbell,"
" sid %2.2x tid %2.2x info %4.4x\n", " sid %2.2x tid %2.2x info %4.4x\n",
DBELL_SID(dmsg), DBELL_TID(dmsg), dmsg->sid, dmsg->tid,
DBELL_INF(dmsg)); dmsg->info);
} }
setbits32(&fsl_dbell->dbell_regs->dmr, DOORBELL_DMR_DI); setbits32(&fsl_dbell->dbell_regs->dmr, DOORBELL_DMR_DI);
out_be32(&fsl_dbell->dbell_regs->dsr, DOORBELL_DSR_DIQI); out_be32(&fsl_dbell->dbell_regs->dsr, DOORBELL_DSR_DIQI);
...@@ -657,7 +658,7 @@ fsl_add_outb_message(struct rio_mport *mport, struct rio_dev *rdev, int mbox, ...@@ -657,7 +658,7 @@ fsl_add_outb_message(struct rio_mport *mport, struct rio_dev *rdev, int mbox,
int ret = 0; int ret = 0;
pr_debug("RIO: fsl_add_outb_message(): destid %4.4x mbox %d buffer " \ pr_debug("RIO: fsl_add_outb_message(): destid %4.4x mbox %d buffer " \
"%8.8x len %8.8x\n", rdev->destid, mbox, (int)buffer, len); "%p len %8.8zx\n", rdev->destid, mbox, buffer, len);
if ((len < 8) || (len > RIO_MAX_MSG_SIZE)) { if ((len < 8) || (len > RIO_MAX_MSG_SIZE)) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
...@@ -972,7 +973,8 @@ int fsl_add_inb_buffer(struct rio_mport *mport, int mbox, void *buf) ...@@ -972,7 +973,8 @@ int fsl_add_inb_buffer(struct rio_mport *mport, int mbox, void *buf)
void *fsl_get_inb_message(struct rio_mport *mport, int mbox) void *fsl_get_inb_message(struct rio_mport *mport, int mbox)
{ {
struct fsl_rmu *rmu = GET_RMM_HANDLE(mport); struct fsl_rmu *rmu = GET_RMM_HANDLE(mport);
u32 phys_buf, virt_buf; u32 phys_buf;
void *virt_buf;
void *buf = NULL; void *buf = NULL;
int buf_idx; int buf_idx;
...@@ -982,7 +984,7 @@ void *fsl_get_inb_message(struct rio_mport *mport, int mbox) ...@@ -982,7 +984,7 @@ void *fsl_get_inb_message(struct rio_mport *mport, int mbox)
if (phys_buf == in_be32(&rmu->msg_regs->ifqepar)) if (phys_buf == in_be32(&rmu->msg_regs->ifqepar))
goto out2; goto out2;
virt_buf = (u32) rmu->msg_rx_ring.virt + (phys_buf virt_buf = rmu->msg_rx_ring.virt + (phys_buf
- rmu->msg_rx_ring.phys); - rmu->msg_rx_ring.phys);
buf_idx = (phys_buf - rmu->msg_rx_ring.phys) / RIO_MAX_MSG_SIZE; buf_idx = (phys_buf - rmu->msg_rx_ring.phys) / RIO_MAX_MSG_SIZE;
buf = rmu->msg_rx_ring.virt_buffer[buf_idx]; buf = rmu->msg_rx_ring.virt_buffer[buf_idx];
...@@ -994,7 +996,7 @@ void *fsl_get_inb_message(struct rio_mport *mport, int mbox) ...@@ -994,7 +996,7 @@ void *fsl_get_inb_message(struct rio_mport *mport, int mbox)
} }
/* Copy max message size, caller is expected to allocate that big */ /* Copy max message size, caller is expected to allocate that big */
memcpy(buf, (void *)virt_buf, RIO_MAX_MSG_SIZE); memcpy(buf, virt_buf, RIO_MAX_MSG_SIZE);
/* Clear the available buffer */ /* Clear the available buffer */
rmu->msg_rx_ring.virt_buffer[buf_idx] = NULL; rmu->msg_rx_ring.virt_buffer[buf_idx] = NULL;
......
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