aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xpc_channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/sgi-xp/xpc_channel.c')
-rw-r--r--drivers/misc/sgi-xp/xpc_channel.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/misc/sgi-xp/xpc_channel.c b/drivers/misc/sgi-xp/xpc_channel.c
index 2eb3abff0e3a..652593fc486d 100644
--- a/drivers/misc/sgi-xp/xpc_channel.c
+++ b/drivers/misc/sgi-xp/xpc_channel.c
@@ -39,7 +39,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
39 39
40 if (!(ch->flags & XPC_C_SETUP)) { 40 if (!(ch->flags & XPC_C_SETUP)) {
41 spin_unlock_irqrestore(&ch->lock, *irq_flags); 41 spin_unlock_irqrestore(&ch->lock, *irq_flags);
42 ret = xpc_setup_msg_structures(ch); 42 ret = xpc_arch_ops.setup_msg_structures(ch);
43 spin_lock_irqsave(&ch->lock, *irq_flags); 43 spin_lock_irqsave(&ch->lock, *irq_flags);
44 44
45 if (ret != xpSuccess) 45 if (ret != xpSuccess)
@@ -53,7 +53,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
53 53
54 if (!(ch->flags & XPC_C_OPENREPLY)) { 54 if (!(ch->flags & XPC_C_OPENREPLY)) {
55 ch->flags |= XPC_C_OPENREPLY; 55 ch->flags |= XPC_C_OPENREPLY;
56 xpc_send_chctl_openreply(ch, irq_flags); 56 xpc_arch_ops.send_chctl_openreply(ch, irq_flags);
57 } 57 }
58 58
59 if (!(ch->flags & XPC_C_ROPENREPLY)) 59 if (!(ch->flags & XPC_C_ROPENREPLY))
@@ -61,7 +61,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
61 61
62 if (!(ch->flags & XPC_C_OPENCOMPLETE)) { 62 if (!(ch->flags & XPC_C_OPENCOMPLETE)) {
63 ch->flags |= (XPC_C_OPENCOMPLETE | XPC_C_CONNECTED); 63 ch->flags |= (XPC_C_OPENCOMPLETE | XPC_C_CONNECTED);
64 xpc_send_chctl_opencomplete(ch, irq_flags); 64 xpc_arch_ops.send_chctl_opencomplete(ch, irq_flags);
65 } 65 }
66 66
67 if (!(ch->flags & XPC_C_ROPENCOMPLETE)) 67 if (!(ch->flags & XPC_C_ROPENCOMPLETE))
@@ -100,7 +100,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
100 100
101 if (part->act_state == XPC_P_AS_DEACTIVATING) { 101 if (part->act_state == XPC_P_AS_DEACTIVATING) {
102 /* can't proceed until the other side disengages from us */ 102 /* can't proceed until the other side disengages from us */
103 if (xpc_partition_engaged(ch->partid)) 103 if (xpc_arch_ops.partition_engaged(ch->partid))
104 return; 104 return;
105 105
106 } else { 106 } else {
@@ -112,7 +112,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
112 112
113 if (!(ch->flags & XPC_C_CLOSEREPLY)) { 113 if (!(ch->flags & XPC_C_CLOSEREPLY)) {
114 ch->flags |= XPC_C_CLOSEREPLY; 114 ch->flags |= XPC_C_CLOSEREPLY;
115 xpc_send_chctl_closereply(ch, irq_flags); 115 xpc_arch_ops.send_chctl_closereply(ch, irq_flags);
116 } 116 }
117 117
118 if (!(ch->flags & XPC_C_RCLOSEREPLY)) 118 if (!(ch->flags & XPC_C_RCLOSEREPLY))
@@ -122,7 +122,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
122 /* wake those waiting for notify completion */ 122 /* wake those waiting for notify completion */
123 if (atomic_read(&ch->n_to_notify) > 0) { 123 if (atomic_read(&ch->n_to_notify) > 0) {
124 /* we do callout while holding ch->lock, callout can't block */ 124 /* we do callout while holding ch->lock, callout can't block */
125 xpc_notify_senders_of_disconnect(ch); 125 xpc_arch_ops.notify_senders_of_disconnect(ch);
126 } 126 }
127 127
128 /* both sides are disconnected now */ 128 /* both sides are disconnected now */
@@ -136,7 +136,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
136 DBUG_ON(atomic_read(&ch->n_to_notify) != 0); 136 DBUG_ON(atomic_read(&ch->n_to_notify) != 0);
137 137
138 /* it's now safe to free the channel's message queues */ 138 /* it's now safe to free the channel's message queues */
139 xpc_teardown_msg_structures(ch); 139 xpc_arch_ops.teardown_msg_structures(ch);
140 140
141 ch->func = NULL; 141 ch->func = NULL;
142 ch->key = NULL; 142 ch->key = NULL;
@@ -148,8 +148,9 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
148 148
149 /* 149 /*
150 * Mark the channel disconnected and clear all other flags, including 150 * Mark the channel disconnected and clear all other flags, including
151 * XPC_C_SETUP (because of call to xpc_teardown_msg_structures()) but 151 * XPC_C_SETUP (because of call to
152 * not including XPC_C_WDISCONNECT (if it was set). 152 * xpc_arch_ops.teardown_msg_structures()) but not including
153 * XPC_C_WDISCONNECT (if it was set).
153 */ 154 */
154 ch->flags = (XPC_C_DISCONNECTED | (ch->flags & XPC_C_WDISCONNECT)); 155 ch->flags = (XPC_C_DISCONNECTED | (ch->flags & XPC_C_WDISCONNECT));
155 156
@@ -395,7 +396,8 @@ again:
395 DBUG_ON(args->local_nentries == 0); 396 DBUG_ON(args->local_nentries == 0);
396 DBUG_ON(args->remote_nentries == 0); 397 DBUG_ON(args->remote_nentries == 0);
397 398
398 ret = xpc_save_remote_msgqueue_pa(ch, args->local_msgqueue_pa); 399 ret = xpc_arch_ops.save_remote_msgqueue_pa(ch,
400 args->local_msgqueue_pa);
399 if (ret != xpSuccess) { 401 if (ret != xpSuccess) {
400 XPC_DISCONNECT_CHANNEL(ch, ret, &irq_flags); 402 XPC_DISCONNECT_CHANNEL(ch, ret, &irq_flags);
401 goto out; 403 goto out;
@@ -531,7 +533,7 @@ xpc_connect_channel(struct xpc_channel *ch)
531 /* initiate the connection */ 533 /* initiate the connection */
532 534
533 ch->flags |= (XPC_C_OPENREQUEST | XPC_C_CONNECTING); 535 ch->flags |= (XPC_C_OPENREQUEST | XPC_C_CONNECTING);
534 xpc_send_chctl_openrequest(ch, &irq_flags); 536 xpc_arch_ops.send_chctl_openrequest(ch, &irq_flags);
535 537
536 xpc_process_connect(ch, &irq_flags); 538 xpc_process_connect(ch, &irq_flags);
537 539
@@ -549,7 +551,7 @@ xpc_process_sent_chctl_flags(struct xpc_partition *part)
549 int ch_number; 551 int ch_number;
550 u32 ch_flags; 552 u32 ch_flags;
551 553
552 chctl.all_flags = xpc_get_chctl_all_flags(part); 554 chctl.all_flags = xpc_arch_ops.get_chctl_all_flags(part);
553 555
554 /* 556 /*
555 * Initiate channel connections for registered channels. 557 * Initiate channel connections for registered channels.
@@ -598,7 +600,7 @@ xpc_process_sent_chctl_flags(struct xpc_partition *part)
598 */ 600 */
599 601
600 if (chctl.flags[ch_number] & XPC_MSG_CHCTL_FLAGS) 602 if (chctl.flags[ch_number] & XPC_MSG_CHCTL_FLAGS)
601 xpc_process_msg_chctl_flags(part, ch_number); 603 xpc_arch_ops.process_msg_chctl_flags(part, ch_number);
602 } 604 }
603} 605}
604 606
@@ -774,7 +776,7 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch,
774 XPC_C_ROPENREQUEST | XPC_C_ROPENREPLY | 776 XPC_C_ROPENREQUEST | XPC_C_ROPENREPLY |
775 XPC_C_CONNECTING | XPC_C_CONNECTED); 777 XPC_C_CONNECTING | XPC_C_CONNECTED);
776 778
777 xpc_send_chctl_closerequest(ch, irq_flags); 779 xpc_arch_ops.send_chctl_closerequest(ch, irq_flags);
778 780
779 if (channel_was_connected) 781 if (channel_was_connected)
780 ch->flags |= XPC_C_WASCONNECTED; 782 ch->flags |= XPC_C_WASCONNECTED;
@@ -881,8 +883,8 @@ xpc_initiate_send(short partid, int ch_number, u32 flags, void *payload,
881 DBUG_ON(payload == NULL); 883 DBUG_ON(payload == NULL);
882 884
883 if (xpc_part_ref(part)) { 885 if (xpc_part_ref(part)) {
884 ret = xpc_send_payload(&part->channels[ch_number], flags, 886 ret = xpc_arch_ops.send_payload(&part->channels[ch_number],
885 payload, payload_size, 0, NULL, NULL); 887 flags, payload, payload_size, 0, NULL, NULL);
886 xpc_part_deref(part); 888 xpc_part_deref(part);
887 } 889 }
888 890
@@ -933,9 +935,8 @@ xpc_initiate_send_notify(short partid, int ch_number, u32 flags, void *payload,
933 DBUG_ON(func == NULL); 935 DBUG_ON(func == NULL);
934 936
935 if (xpc_part_ref(part)) { 937 if (xpc_part_ref(part)) {
936 ret = xpc_send_payload(&part->channels[ch_number], flags, 938 ret = xpc_arch_ops.send_payload(&part->channels[ch_number],
937 payload, payload_size, XPC_N_CALL, func, 939 flags, payload, payload_size, XPC_N_CALL, func, key);
938 key);
939 xpc_part_deref(part); 940 xpc_part_deref(part);
940 } 941 }
941 return ret; 942 return ret;
@@ -949,7 +950,7 @@ xpc_deliver_payload(struct xpc_channel *ch)
949{ 950{
950 void *payload; 951 void *payload;
951 952
952 payload = xpc_get_deliverable_payload(ch); 953 payload = xpc_arch_ops.get_deliverable_payload(ch);
953 if (payload != NULL) { 954 if (payload != NULL) {
954 955
955 /* 956 /*
@@ -1003,7 +1004,7 @@ xpc_initiate_received(short partid, int ch_number, void *payload)
1003 DBUG_ON(ch_number < 0 || ch_number >= part->nchannels); 1004 DBUG_ON(ch_number < 0 || ch_number >= part->nchannels);
1004 1005
1005 ch = &part->channels[ch_number]; 1006 ch = &part->channels[ch_number];
1006 xpc_received_payload(ch, payload); 1007 xpc_arch_ops.received_payload(ch, payload);
1007 1008
1008 /* the call to xpc_msgqueue_ref() was done by xpc_deliver_payload() */ 1009 /* the call to xpc_msgqueue_ref() was done by xpc_deliver_payload() */
1009 xpc_msgqueue_deref(ch); 1010 xpc_msgqueue_deref(ch);