aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/syslib/ppc85xx_rio.c
diff options
context:
space:
mode:
authorMatt Porter <mporter@kernel.crashing.org>2005-11-07 04:00:20 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:47 -0500
commit6978bbc097c2f665c336927a9d56ae39ef75fa56 (patch)
tree541673cd413025c09b52984c5dc0333133c46a71 /arch/ppc/syslib/ppc85xx_rio.c
parent2b0c28d7f8846f80a436093e906f5175d1fa8f55 (diff)
[PATCH] rapidio: message interface updates
Updates the RIO messaging interface to pass a device instance into the event registeration and callbacks. Signed-off-by: Matt Porter <mporter@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ppc/syslib/ppc85xx_rio.c')
-rw-r--r--arch/ppc/syslib/ppc85xx_rio.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/arch/ppc/syslib/ppc85xx_rio.c b/arch/ppc/syslib/ppc85xx_rio.c
index 9d09c2715e0a..297f3b549177 100644
--- a/arch/ppc/syslib/ppc85xx_rio.c
+++ b/arch/ppc/syslib/ppc85xx_rio.c
@@ -135,6 +135,7 @@ static struct rio_msg_tx_ring {
135 dma_addr_t phys_buffer[RIO_MAX_TX_RING_SIZE]; 135 dma_addr_t phys_buffer[RIO_MAX_TX_RING_SIZE];
136 int tx_slot; 136 int tx_slot;
137 int size; 137 int size;
138 void *dev_id;
138} msg_tx_ring; 139} msg_tx_ring;
139 140
140static struct rio_msg_rx_ring { 141static struct rio_msg_rx_ring {
@@ -143,6 +144,7 @@ static struct rio_msg_rx_ring {
143 void *virt_buffer[RIO_MAX_RX_RING_SIZE]; 144 void *virt_buffer[RIO_MAX_RX_RING_SIZE];
144 int rx_slot; 145 int rx_slot;
145 int size; 146 int size;
147 void *dev_id;
146} msg_rx_ring; 148} msg_rx_ring;
147 149
148/** 150/**
@@ -376,7 +378,7 @@ mpc85xx_rio_tx_handler(int irq, void *dev_instance, struct pt_regs *regs)
376 if (osr & RIO_MSG_OSR_EOMI) { 378 if (osr & RIO_MSG_OSR_EOMI) {
377 u32 dqp = in_be32((void *)&msg_regs->odqdpar); 379 u32 dqp = in_be32((void *)&msg_regs->odqdpar);
378 int slot = (dqp - msg_tx_ring.phys) >> 5; 380 int slot = (dqp - msg_tx_ring.phys) >> 5;
379 port->outb_msg[0].mcback(port, -1, slot); 381 port->outb_msg[0].mcback(port, msg_tx_ring.dev_id, -1, slot);
380 382
381 /* Ack the end-of-message interrupt */ 383 /* Ack the end-of-message interrupt */
382 out_be32((void *)&msg_regs->osr, RIO_MSG_OSR_EOMI); 384 out_be32((void *)&msg_regs->osr, RIO_MSG_OSR_EOMI);
@@ -389,6 +391,7 @@ mpc85xx_rio_tx_handler(int irq, void *dev_instance, struct pt_regs *regs)
389/** 391/**
390 * rio_open_outb_mbox - Initialize MPC85xx outbound mailbox 392 * rio_open_outb_mbox - Initialize MPC85xx outbound mailbox
391 * @mport: Master port implementing the outbound message unit 393 * @mport: Master port implementing the outbound message unit
394 * @dev_id: Device specific pointer to pass on event
392 * @mbox: Mailbox to open 395 * @mbox: Mailbox to open
393 * @entries: Number of entries in the outbound mailbox ring 396 * @entries: Number of entries in the outbound mailbox ring
394 * 397 *
@@ -396,7 +399,7 @@ mpc85xx_rio_tx_handler(int irq, void *dev_instance, struct pt_regs *regs)
396 * and enables the outbound message unit. Returns %0 on success and 399 * and enables the outbound message unit. Returns %0 on success and
397 * %-EINVAL or %-ENOMEM on failure. 400 * %-EINVAL or %-ENOMEM on failure.
398 */ 401 */
399int rio_open_outb_mbox(struct rio_mport *mport, int mbox, int entries) 402int rio_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries)
400{ 403{
401 int i, j, rc = 0; 404 int i, j, rc = 0;
402 405
@@ -407,6 +410,7 @@ int rio_open_outb_mbox(struct rio_mport *mport, int mbox, int entries)
407 } 410 }
408 411
409 /* Initialize shadow copy ring */ 412 /* Initialize shadow copy ring */
413 msg_tx_ring.dev_id = dev_id;
410 msg_tx_ring.size = entries; 414 msg_tx_ring.size = entries;
411 415
412 for (i = 0; i < msg_tx_ring.size; i++) { 416 for (i = 0; i < msg_tx_ring.size; i++) {
@@ -541,7 +545,7 @@ mpc85xx_rio_rx_handler(int irq, void *dev_instance, struct pt_regs *regs)
541 * make the callback with an unknown/invalid mailbox number 545 * make the callback with an unknown/invalid mailbox number
542 * argument. 546 * argument.
543 */ 547 */
544 port->inb_msg[0].mcback(port, -1, -1); 548 port->inb_msg[0].mcback(port, msg_rx_ring.dev_id, -1, -1);
545 549
546 /* Ack the queueing interrupt */ 550 /* Ack the queueing interrupt */
547 out_be32((void *)&msg_regs->isr, RIO_MSG_ISR_DIQI); 551 out_be32((void *)&msg_regs->isr, RIO_MSG_ISR_DIQI);
@@ -554,6 +558,7 @@ mpc85xx_rio_rx_handler(int irq, void *dev_instance, struct pt_regs *regs)
554/** 558/**
555 * rio_open_inb_mbox - Initialize MPC85xx inbound mailbox 559 * rio_open_inb_mbox - Initialize MPC85xx inbound mailbox
556 * @mport: Master port implementing the inbound message unit 560 * @mport: Master port implementing the inbound message unit
561 * @dev_id: Device specific pointer to pass on event
557 * @mbox: Mailbox to open 562 * @mbox: Mailbox to open
558 * @entries: Number of entries in the inbound mailbox ring 563 * @entries: Number of entries in the inbound mailbox ring
559 * 564 *
@@ -561,7 +566,7 @@ mpc85xx_rio_rx_handler(int irq, void *dev_instance, struct pt_regs *regs)
561 * and enables the inbound message unit. Returns %0 on success 566 * and enables the inbound message unit. Returns %0 on success
562 * and %-EINVAL or %-ENOMEM on failure. 567 * and %-EINVAL or %-ENOMEM on failure.
563 */ 568 */
564int rio_open_inb_mbox(struct rio_mport *mport, int mbox, int entries) 569int rio_open_inb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries)
565{ 570{
566 int i, rc = 0; 571 int i, rc = 0;
567 572
@@ -572,6 +577,7 @@ int rio_open_inb_mbox(struct rio_mport *mport, int mbox, int entries)
572 } 577 }
573 578
574 /* Initialize client buffer ring */ 579 /* Initialize client buffer ring */
580 msg_rx_ring.dev_id = dev_id;
575 msg_rx_ring.size = entries; 581 msg_rx_ring.size = entries;
576 msg_rx_ring.rx_slot = 0; 582 msg_rx_ring.rx_slot = 0;
577 for (i = 0; i < msg_rx_ring.size; i++) 583 for (i = 0; i < msg_rx_ring.size; i++)
@@ -777,7 +783,7 @@ mpc85xx_rio_dbell_handler(int irq, void *dev_instance, struct pt_regs *regs)
777 } 783 }
778 } 784 }
779 if (found) { 785 if (found) {
780 dbell->dinb(port, DBELL_SID(dmsg), DBELL_TID(dmsg), 786 dbell->dinb(port, dbell->dev_id, DBELL_SID(dmsg), DBELL_TID(dmsg),
781 DBELL_INF(dmsg)); 787 DBELL_INF(dmsg));
782 } else { 788 } else {
783 pr_debug 789 pr_debug