aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorRobin Holt <holt@sgi.com>2009-04-13 17:40:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-13 18:04:33 -0400
commita7665b0a380585fbd70a2275f3120c6086e0c92d (patch)
tree01465e3d7a8bc917084e9a47789f3508c38307cf /drivers/misc
parentefdd06ed181a88a11e612238c1ac04668e665395 (diff)
sgi-xpc: clean up numerous globals
Introduce xpc_arch_ops and eliminate numerous individual global definitions. Signed-off-by: Robin Holt <holt@sgi.com> Cc: Dean Nelson <dcn@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/sgi-xp/xpc.h112
-rw-r--r--drivers/misc/sgi-xp/xpc_channel.c43
-rw-r--r--drivers/misc/sgi-xp/xpc_main.c130
-rw-r--r--drivers/misc/sgi-xp/xpc_partition.c20
-rw-r--r--drivers/misc/sgi-xp/xpc_sn2.c122
-rw-r--r--drivers/misc/sgi-xp/xpc_uv.c122
6 files changed, 254 insertions, 295 deletions
diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h
index a54047674785..b94d5f767703 100644
--- a/drivers/misc/sgi-xp/xpc.h
+++ b/drivers/misc/sgi-xp/xpc.h
@@ -780,6 +780,62 @@ struct xpc_partition {
780 780
781} ____cacheline_aligned; 781} ____cacheline_aligned;
782 782
783struct xpc_arch_operations {
784 int (*setup_partitions) (void);
785 void (*teardown_partitions) (void);
786 void (*process_activate_IRQ_rcvd) (void);
787 enum xp_retval (*get_partition_rsvd_page_pa)
788 (void *, u64 *, unsigned long *, size_t *);
789 int (*setup_rsvd_page) (struct xpc_rsvd_page *);
790
791 void (*allow_hb) (short);
792 void (*disallow_hb) (short);
793 void (*disallow_all_hbs) (void);
794 void (*increment_heartbeat) (void);
795 void (*offline_heartbeat) (void);
796 void (*online_heartbeat) (void);
797 void (*heartbeat_init) (void);
798 void (*heartbeat_exit) (void);
799 enum xp_retval (*get_remote_heartbeat) (struct xpc_partition *);
800
801 void (*request_partition_activation) (struct xpc_rsvd_page *,
802 unsigned long, int);
803 void (*request_partition_reactivation) (struct xpc_partition *);
804 void (*request_partition_deactivation) (struct xpc_partition *);
805 void (*cancel_partition_deactivation_request) (struct xpc_partition *);
806 enum xp_retval (*setup_ch_structures) (struct xpc_partition *);
807 void (*teardown_ch_structures) (struct xpc_partition *);
808
809 enum xp_retval (*make_first_contact) (struct xpc_partition *);
810
811 u64 (*get_chctl_all_flags) (struct xpc_partition *);
812 void (*send_chctl_closerequest) (struct xpc_channel *, unsigned long *);
813 void (*send_chctl_closereply) (struct xpc_channel *, unsigned long *);
814 void (*send_chctl_openrequest) (struct xpc_channel *, unsigned long *);
815 void (*send_chctl_openreply) (struct xpc_channel *, unsigned long *);
816 void (*send_chctl_opencomplete) (struct xpc_channel *, unsigned long *);
817 void (*process_msg_chctl_flags) (struct xpc_partition *, int);
818
819 enum xp_retval (*save_remote_msgqueue_pa) (struct xpc_channel *,
820 unsigned long);
821
822 enum xp_retval (*setup_msg_structures) (struct xpc_channel *);
823 void (*teardown_msg_structures) (struct xpc_channel *);
824
825 void (*indicate_partition_engaged) (struct xpc_partition *);
826 void (*indicate_partition_disengaged) (struct xpc_partition *);
827 void (*assume_partition_disengaged) (short);
828 int (*partition_engaged) (short);
829 int (*any_partition_engaged) (void);
830
831 int (*n_of_deliverable_payloads) (struct xpc_channel *);
832 enum xp_retval (*send_payload) (struct xpc_channel *, u32, void *,
833 u16, u8, xpc_notify_func, void *);
834 void *(*get_deliverable_payload) (struct xpc_channel *);
835 void (*received_payload) (struct xpc_channel *, void *);
836 void (*notify_senders_of_disconnect) (struct xpc_channel *);
837};
838
783/* struct xpc_partition act_state values (for XPC HB) */ 839/* struct xpc_partition act_state values (for XPC HB) */
784 840
785#define XPC_P_AS_INACTIVE 0x00 /* partition is not active */ 841#define XPC_P_AS_INACTIVE 0x00 /* partition is not active */
@@ -820,6 +876,7 @@ extern struct xpc_registration xpc_registrations[];
820/* found in xpc_main.c */ 876/* found in xpc_main.c */
821extern struct device *xpc_part; 877extern struct device *xpc_part;
822extern struct device *xpc_chan; 878extern struct device *xpc_chan;
879extern struct xpc_arch_operations xpc_arch_ops;
823extern int xpc_disengage_timelimit; 880extern int xpc_disengage_timelimit;
824extern int xpc_disengage_timedout; 881extern int xpc_disengage_timedout;
825extern int xpc_activate_IRQ_rcvd; 882extern int xpc_activate_IRQ_rcvd;
@@ -830,61 +887,6 @@ extern void xpc_activate_partition(struct xpc_partition *);
830extern void xpc_activate_kthreads(struct xpc_channel *, int); 887extern void xpc_activate_kthreads(struct xpc_channel *, int);
831extern void xpc_create_kthreads(struct xpc_channel *, int, int); 888extern void xpc_create_kthreads(struct xpc_channel *, int, int);
832extern void xpc_disconnect_wait(int); 889extern void xpc_disconnect_wait(int);
833extern int (*xpc_setup_partitions_sn) (void);
834extern void (*xpc_teardown_partitions_sn) (void);
835extern enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *, u64 *,
836 unsigned long *,
837 size_t *);
838extern int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *);
839extern void (*xpc_heartbeat_init) (void);
840extern void (*xpc_heartbeat_exit) (void);
841extern void (*xpc_increment_heartbeat) (void);
842extern void (*xpc_offline_heartbeat) (void);
843extern void (*xpc_online_heartbeat) (void);
844extern enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *);
845extern void (*xpc_allow_hb) (short);
846extern void (*xpc_disallow_hb) (short);
847extern void (*xpc_disallow_all_hbs) (void);
848extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *);
849extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *);
850extern enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *);
851extern void (*xpc_teardown_msg_structures) (struct xpc_channel *);
852extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *);
853extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *, int);
854extern int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *);
855extern void *(*xpc_get_deliverable_payload) (struct xpc_channel *);
856extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *,
857 unsigned long, int);
858extern void (*xpc_request_partition_reactivation) (struct xpc_partition *);
859extern void (*xpc_request_partition_deactivation) (struct xpc_partition *);
860extern void (*xpc_cancel_partition_deactivation_request) (
861 struct xpc_partition *);
862extern void (*xpc_process_activate_IRQ_rcvd) (void);
863extern enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *);
864extern void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *);
865
866extern void (*xpc_indicate_partition_engaged) (struct xpc_partition *);
867extern int (*xpc_partition_engaged) (short);
868extern int (*xpc_any_partition_engaged) (void);
869extern void (*xpc_indicate_partition_disengaged) (struct xpc_partition *);
870extern void (*xpc_assume_partition_disengaged) (short);
871
872extern void (*xpc_send_chctl_closerequest) (struct xpc_channel *,
873 unsigned long *);
874extern void (*xpc_send_chctl_closereply) (struct xpc_channel *,
875 unsigned long *);
876extern void (*xpc_send_chctl_openrequest) (struct xpc_channel *,
877 unsigned long *);
878extern void (*xpc_send_chctl_openreply) (struct xpc_channel *, unsigned long *);
879extern void (*xpc_send_chctl_opencomplete) (struct xpc_channel *,
880 unsigned long *);
881
882extern enum xp_retval (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *,
883 unsigned long);
884
885extern enum xp_retval (*xpc_send_payload) (struct xpc_channel *, u32, void *,
886 u16, u8, xpc_notify_func, void *);
887extern void (*xpc_received_payload) (struct xpc_channel *, void *);
888 890
889/* found in xpc_sn2.c */ 891/* found in xpc_sn2.c */
890extern int xpc_init_sn2(void); 892extern int xpc_init_sn2(void);
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);
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index 2bb070e17222..fd3688a3e23f 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -169,68 +169,7 @@ static struct notifier_block xpc_die_notifier = {
169 .notifier_call = xpc_system_die, 169 .notifier_call = xpc_system_die,
170}; 170};
171 171
172int (*xpc_setup_partitions_sn) (void); 172struct xpc_arch_operations xpc_arch_ops;
173void (*xpc_teardown_partitions_sn) (void);
174enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *buf, u64 *cookie,
175 unsigned long *rp_pa,
176 size_t *len);
177int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *rp);
178
179void (*xpc_allow_hb) (short partid);
180void (*xpc_disallow_hb) (short partid);
181void (*xpc_disallow_all_hbs) (void);
182void (*xpc_heartbeat_init) (void);
183void (*xpc_heartbeat_exit) (void);
184void (*xpc_increment_heartbeat) (void);
185void (*xpc_offline_heartbeat) (void);
186void (*xpc_online_heartbeat) (void);
187enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *part);
188
189enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *part);
190void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *ch);
191u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *part);
192enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *ch);
193void (*xpc_teardown_msg_structures) (struct xpc_channel *ch);
194void (*xpc_process_msg_chctl_flags) (struct xpc_partition *part, int ch_number);
195int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *ch);
196void *(*xpc_get_deliverable_payload) (struct xpc_channel *ch);
197
198void (*xpc_request_partition_activation) (struct xpc_rsvd_page *remote_rp,
199 unsigned long remote_rp_pa,
200 int nasid);
201void (*xpc_request_partition_reactivation) (struct xpc_partition *part);
202void (*xpc_request_partition_deactivation) (struct xpc_partition *part);
203void (*xpc_cancel_partition_deactivation_request) (struct xpc_partition *part);
204
205void (*xpc_process_activate_IRQ_rcvd) (void);
206enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *part);
207void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *part);
208
209void (*xpc_indicate_partition_engaged) (struct xpc_partition *part);
210int (*xpc_partition_engaged) (short partid);
211int (*xpc_any_partition_engaged) (void);
212void (*xpc_indicate_partition_disengaged) (struct xpc_partition *part);
213void (*xpc_assume_partition_disengaged) (short partid);
214
215void (*xpc_send_chctl_closerequest) (struct xpc_channel *ch,
216 unsigned long *irq_flags);
217void (*xpc_send_chctl_closereply) (struct xpc_channel *ch,
218 unsigned long *irq_flags);
219void (*xpc_send_chctl_openrequest) (struct xpc_channel *ch,
220 unsigned long *irq_flags);
221void (*xpc_send_chctl_openreply) (struct xpc_channel *ch,
222 unsigned long *irq_flags);
223void (*xpc_send_chctl_opencomplete) (struct xpc_channel *ch,
224 unsigned long *irq_flags);
225
226enum xp_retval (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *ch,
227 unsigned long msgqueue_pa);
228
229enum xp_retval (*xpc_send_payload) (struct xpc_channel *ch, u32 flags,
230 void *payload, u16 payload_size,
231 u8 notify_type, xpc_notify_func func,
232 void *key);
233void (*xpc_received_payload) (struct xpc_channel *ch, void *payload);
234 173
235/* 174/*
236 * Timer function to enforce the timelimit on the partition disengage. 175 * Timer function to enforce the timelimit on the partition disengage.
@@ -245,7 +184,7 @@ xpc_timeout_partition_disengage(unsigned long data)
245 (void)xpc_partition_disengaged(part); 184 (void)xpc_partition_disengaged(part);
246 185
247 DBUG_ON(part->disengage_timeout != 0); 186 DBUG_ON(part->disengage_timeout != 0);
248 DBUG_ON(xpc_partition_engaged(XPC_PARTID(part))); 187 DBUG_ON(xpc_arch_ops.partition_engaged(XPC_PARTID(part)));
249} 188}
250 189
251/* 190/*
@@ -256,7 +195,7 @@ xpc_timeout_partition_disengage(unsigned long data)
256static void 195static void
257xpc_hb_beater(unsigned long dummy) 196xpc_hb_beater(unsigned long dummy)
258{ 197{
259 xpc_increment_heartbeat(); 198 xpc_arch_ops.increment_heartbeat();
260 199
261 if (time_is_before_eq_jiffies(xpc_hb_check_timeout)) 200 if (time_is_before_eq_jiffies(xpc_hb_check_timeout))
262 wake_up_interruptible(&xpc_activate_IRQ_wq); 201 wake_up_interruptible(&xpc_activate_IRQ_wq);
@@ -268,7 +207,7 @@ xpc_hb_beater(unsigned long dummy)
268static void 207static void
269xpc_start_hb_beater(void) 208xpc_start_hb_beater(void)
270{ 209{
271 xpc_heartbeat_init(); 210 xpc_arch_ops.heartbeat_init();
272 init_timer(&xpc_hb_timer); 211 init_timer(&xpc_hb_timer);
273 xpc_hb_timer.function = xpc_hb_beater; 212 xpc_hb_timer.function = xpc_hb_beater;
274 xpc_hb_beater(0); 213 xpc_hb_beater(0);
@@ -278,7 +217,7 @@ static void
278xpc_stop_hb_beater(void) 217xpc_stop_hb_beater(void)
279{ 218{
280 del_timer_sync(&xpc_hb_timer); 219 del_timer_sync(&xpc_hb_timer);
281 xpc_heartbeat_exit(); 220 xpc_arch_ops.heartbeat_exit();
282} 221}
283 222
284/* 223/*
@@ -307,7 +246,7 @@ xpc_check_remote_hb(void)
307 continue; 246 continue;
308 } 247 }
309 248
310 ret = xpc_get_remote_heartbeat(part); 249 ret = xpc_arch_ops.get_remote_heartbeat(part);
311 if (ret != xpSuccess) 250 if (ret != xpSuccess)
312 XPC_DEACTIVATE_PARTITION(part, ret); 251 XPC_DEACTIVATE_PARTITION(part, ret);
313 } 252 }
@@ -358,7 +297,7 @@ xpc_hb_checker(void *ignore)
358 force_IRQ = 0; 297 force_IRQ = 0;
359 dev_dbg(xpc_part, "processing activate IRQs " 298 dev_dbg(xpc_part, "processing activate IRQs "
360 "received\n"); 299 "received\n");
361 xpc_process_activate_IRQ_rcvd(); 300 xpc_arch_ops.process_activate_IRQ_rcvd();
362 } 301 }
363 302
364 /* wait for IRQ or timeout */ 303 /* wait for IRQ or timeout */
@@ -533,7 +472,7 @@ xpc_setup_ch_structures(struct xpc_partition *part)
533 init_waitqueue_head(&ch->idle_wq); 472 init_waitqueue_head(&ch->idle_wq);
534 } 473 }
535 474
536 ret = xpc_setup_ch_structures_sn(part); 475 ret = xpc_arch_ops.setup_ch_structures(part);
537 if (ret != xpSuccess) 476 if (ret != xpSuccess)
538 goto out_2; 477 goto out_2;
539 478
@@ -577,7 +516,7 @@ xpc_teardown_ch_structures(struct xpc_partition *part)
577 516
578 /* now we can begin tearing down the infrastructure */ 517 /* now we can begin tearing down the infrastructure */
579 518
580 xpc_teardown_ch_structures_sn(part); 519 xpc_arch_ops.teardown_ch_structures(part);
581 520
582 kfree(part->remote_openclose_args_base); 521 kfree(part->remote_openclose_args_base);
583 part->remote_openclose_args = NULL; 522 part->remote_openclose_args = NULL;
@@ -625,12 +564,12 @@ xpc_activating(void *__partid)
625 564
626 dev_dbg(xpc_part, "activating partition %d\n", partid); 565 dev_dbg(xpc_part, "activating partition %d\n", partid);
627 566
628 xpc_allow_hb(partid); 567 xpc_arch_ops.allow_hb(partid);
629 568
630 if (xpc_setup_ch_structures(part) == xpSuccess) { 569 if (xpc_setup_ch_structures(part) == xpSuccess) {
631 (void)xpc_part_ref(part); /* this will always succeed */ 570 (void)xpc_part_ref(part); /* this will always succeed */
632 571
633 if (xpc_make_first_contact(part) == xpSuccess) { 572 if (xpc_arch_ops.make_first_contact(part) == xpSuccess) {
634 xpc_mark_partition_active(part); 573 xpc_mark_partition_active(part);
635 xpc_channel_mgr(part); 574 xpc_channel_mgr(part);
636 /* won't return until partition is deactivating */ 575 /* won't return until partition is deactivating */
@@ -640,12 +579,12 @@ xpc_activating(void *__partid)
640 xpc_teardown_ch_structures(part); 579 xpc_teardown_ch_structures(part);
641 } 580 }
642 581
643 xpc_disallow_hb(partid); 582 xpc_arch_ops.disallow_hb(partid);
644 xpc_mark_partition_inactive(part); 583 xpc_mark_partition_inactive(part);
645 584
646 if (part->reason == xpReactivating) { 585 if (part->reason == xpReactivating) {
647 /* interrupting ourselves results in activating partition */ 586 /* interrupting ourselves results in activating partition */
648 xpc_request_partition_reactivation(part); 587 xpc_arch_ops.request_partition_reactivation(part);
649 } 588 }
650 589
651 return 0; 590 return 0;
@@ -718,10 +657,13 @@ xpc_activate_kthreads(struct xpc_channel *ch, int needed)
718static void 657static void
719xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch) 658xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch)
720{ 659{
660 int (*n_of_deliverable_payloads) (struct xpc_channel *) =
661 xpc_arch_ops.n_of_deliverable_payloads;
662
721 do { 663 do {
722 /* deliver messages to their intended recipients */ 664 /* deliver messages to their intended recipients */
723 665
724 while (xpc_n_of_deliverable_payloads(ch) > 0 && 666 while (n_of_deliverable_payloads(ch) > 0 &&
725 !(ch->flags & XPC_C_DISCONNECTING)) { 667 !(ch->flags & XPC_C_DISCONNECTING)) {
726 xpc_deliver_payload(ch); 668 xpc_deliver_payload(ch);
727 } 669 }
@@ -737,7 +679,7 @@ xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch)
737 "wait_event_interruptible_exclusive()\n"); 679 "wait_event_interruptible_exclusive()\n");
738 680
739 (void)wait_event_interruptible_exclusive(ch->idle_wq, 681 (void)wait_event_interruptible_exclusive(ch->idle_wq,
740 (xpc_n_of_deliverable_payloads(ch) > 0 || 682 (n_of_deliverable_payloads(ch) > 0 ||
741 (ch->flags & XPC_C_DISCONNECTING))); 683 (ch->flags & XPC_C_DISCONNECTING)));
742 684
743 atomic_dec(&ch->kthreads_idle); 685 atomic_dec(&ch->kthreads_idle);
@@ -754,6 +696,8 @@ xpc_kthread_start(void *args)
754 struct xpc_channel *ch; 696 struct xpc_channel *ch;
755 int n_needed; 697 int n_needed;
756 unsigned long irq_flags; 698 unsigned long irq_flags;
699 int (*n_of_deliverable_payloads) (struct xpc_channel *) =
700 xpc_arch_ops.n_of_deliverable_payloads;
757 701
758 dev_dbg(xpc_chan, "kthread starting, partid=%d, channel=%d\n", 702 dev_dbg(xpc_chan, "kthread starting, partid=%d, channel=%d\n",
759 partid, ch_number); 703 partid, ch_number);
@@ -782,7 +726,7 @@ xpc_kthread_start(void *args)
782 * additional kthreads to help deliver them. We only 726 * additional kthreads to help deliver them. We only
783 * need one less than total #of messages to deliver. 727 * need one less than total #of messages to deliver.
784 */ 728 */
785 n_needed = xpc_n_of_deliverable_payloads(ch) - 1; 729 n_needed = n_of_deliverable_payloads(ch) - 1;
786 if (n_needed > 0 && !(ch->flags & XPC_C_DISCONNECTING)) 730 if (n_needed > 0 && !(ch->flags & XPC_C_DISCONNECTING))
787 xpc_activate_kthreads(ch, n_needed); 731 xpc_activate_kthreads(ch, n_needed);
788 732
@@ -810,7 +754,7 @@ xpc_kthread_start(void *args)
810 754
811 if (atomic_dec_return(&ch->kthreads_assigned) == 0 && 755 if (atomic_dec_return(&ch->kthreads_assigned) == 0 &&
812 atomic_dec_return(&part->nchannels_engaged) == 0) { 756 atomic_dec_return(&part->nchannels_engaged) == 0) {
813 xpc_indicate_partition_disengaged(part); 757 xpc_arch_ops.indicate_partition_disengaged(part);
814 } 758 }
815 759
816 xpc_msgqueue_deref(ch); 760 xpc_msgqueue_deref(ch);
@@ -842,6 +786,8 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed,
842 u64 args = XPC_PACK_ARGS(ch->partid, ch->number); 786 u64 args = XPC_PACK_ARGS(ch->partid, ch->number);
843 struct xpc_partition *part = &xpc_partitions[ch->partid]; 787 struct xpc_partition *part = &xpc_partitions[ch->partid];
844 struct task_struct *kthread; 788 struct task_struct *kthread;
789 void (*indicate_partition_disengaged) (struct xpc_partition *) =
790 xpc_arch_ops.indicate_partition_disengaged;
845 791
846 while (needed-- > 0) { 792 while (needed-- > 0) {
847 793
@@ -863,7 +809,7 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed,
863 809
864 } else if (atomic_inc_return(&ch->kthreads_assigned) == 1 && 810 } else if (atomic_inc_return(&ch->kthreads_assigned) == 1 &&
865 atomic_inc_return(&part->nchannels_engaged) == 1) { 811 atomic_inc_return(&part->nchannels_engaged) == 1) {
866 xpc_indicate_partition_engaged(part); 812 xpc_arch_ops.indicate_partition_engaged(part);
867 } 813 }
868 (void)xpc_part_ref(part); 814 (void)xpc_part_ref(part);
869 xpc_msgqueue_ref(ch); 815 xpc_msgqueue_ref(ch);
@@ -885,7 +831,7 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed,
885 831
886 if (atomic_dec_return(&ch->kthreads_assigned) == 0 && 832 if (atomic_dec_return(&ch->kthreads_assigned) == 0 &&
887 atomic_dec_return(&part->nchannels_engaged) == 0) { 833 atomic_dec_return(&part->nchannels_engaged) == 0) {
888 xpc_indicate_partition_disengaged(part); 834 indicate_partition_disengaged(part);
889 } 835 }
890 xpc_msgqueue_deref(ch); 836 xpc_msgqueue_deref(ch);
891 xpc_part_deref(part); 837 xpc_part_deref(part);
@@ -998,13 +944,13 @@ xpc_setup_partitions(void)
998 atomic_set(&part->references, 0); 944 atomic_set(&part->references, 0);
999 } 945 }
1000 946
1001 return xpc_setup_partitions_sn(); 947 return xpc_arch_ops.setup_partitions();
1002} 948}
1003 949
1004static void 950static void
1005xpc_teardown_partitions(void) 951xpc_teardown_partitions(void)
1006{ 952{
1007 xpc_teardown_partitions_sn(); 953 xpc_arch_ops.teardown_partitions();
1008 kfree(xpc_partitions); 954 kfree(xpc_partitions);
1009} 955}
1010 956
@@ -1060,7 +1006,7 @@ xpc_do_exit(enum xp_retval reason)
1060 disengage_timeout = part->disengage_timeout; 1006 disengage_timeout = part->disengage_timeout;
1061 } 1007 }
1062 1008
1063 if (xpc_any_partition_engaged()) { 1009 if (xpc_arch_ops.any_partition_engaged()) {
1064 if (time_is_before_jiffies(printmsg_time)) { 1010 if (time_is_before_jiffies(printmsg_time)) {
1065 dev_info(xpc_part, "waiting for remote " 1011 dev_info(xpc_part, "waiting for remote "
1066 "partitions to deactivate, timeout in " 1012 "partitions to deactivate, timeout in "
@@ -1091,7 +1037,7 @@ xpc_do_exit(enum xp_retval reason)
1091 1037
1092 } while (1); 1038 } while (1);
1093 1039
1094 DBUG_ON(xpc_any_partition_engaged()); 1040 DBUG_ON(xpc_arch_ops.any_partition_engaged());
1095 1041
1096 xpc_teardown_rsvd_page(); 1042 xpc_teardown_rsvd_page();
1097 1043
@@ -1156,15 +1102,15 @@ xpc_die_deactivate(void)
1156 /* keep xpc_hb_checker thread from doing anything (just in case) */ 1102 /* keep xpc_hb_checker thread from doing anything (just in case) */
1157 xpc_exiting = 1; 1103 xpc_exiting = 1;
1158 1104
1159 xpc_disallow_all_hbs(); /*indicate we're deactivated */ 1105 xpc_arch_ops.disallow_all_hbs(); /*indicate we're deactivated */
1160 1106
1161 for (partid = 0; partid < xp_max_npartitions; partid++) { 1107 for (partid = 0; partid < xp_max_npartitions; partid++) {
1162 part = &xpc_partitions[partid]; 1108 part = &xpc_partitions[partid];
1163 1109
1164 if (xpc_partition_engaged(partid) || 1110 if (xpc_arch_ops.partition_engaged(partid) ||
1165 part->act_state != XPC_P_AS_INACTIVE) { 1111 part->act_state != XPC_P_AS_INACTIVE) {
1166 xpc_request_partition_deactivation(part); 1112 xpc_arch_ops.request_partition_deactivation(part);
1167 xpc_indicate_partition_disengaged(part); 1113 xpc_arch_ops.indicate_partition_disengaged(part);
1168 } 1114 }
1169 } 1115 }
1170 1116
@@ -1181,7 +1127,7 @@ xpc_die_deactivate(void)
1181 wait_to_print = XPC_DEACTIVATE_PRINTMSG_INTERVAL * 1000 * 5; 1127 wait_to_print = XPC_DEACTIVATE_PRINTMSG_INTERVAL * 1000 * 5;
1182 1128
1183 while (1) { 1129 while (1) {
1184 any_engaged = xpc_any_partition_engaged(); 1130 any_engaged = xpc_arch_ops.any_partition_engaged();
1185 if (!any_engaged) { 1131 if (!any_engaged) {
1186 dev_info(xpc_part, "all partitions have deactivated\n"); 1132 dev_info(xpc_part, "all partitions have deactivated\n");
1187 break; 1133 break;
@@ -1190,7 +1136,7 @@ xpc_die_deactivate(void)
1190 if (!keep_waiting--) { 1136 if (!keep_waiting--) {
1191 for (partid = 0; partid < xp_max_npartitions; 1137 for (partid = 0; partid < xp_max_npartitions;
1192 partid++) { 1138 partid++) {
1193 if (xpc_partition_engaged(partid)) { 1139 if (xpc_arch_ops.partition_engaged(partid)) {
1194 dev_info(xpc_part, "deactivate from " 1140 dev_info(xpc_part, "deactivate from "
1195 "remote partition %d timed " 1141 "remote partition %d timed "
1196 "out\n", partid); 1142 "out\n", partid);
@@ -1237,7 +1183,7 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
1237 /* fall through */ 1183 /* fall through */
1238 case DIE_MCA_MONARCH_ENTER: 1184 case DIE_MCA_MONARCH_ENTER:
1239 case DIE_INIT_MONARCH_ENTER: 1185 case DIE_INIT_MONARCH_ENTER:
1240 xpc_offline_heartbeat(); 1186 xpc_arch_ops.offline_heartbeat();
1241 break; 1187 break;
1242 1188
1243 case DIE_KDEBUG_LEAVE: 1189 case DIE_KDEBUG_LEAVE:
@@ -1248,7 +1194,7 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
1248 /* fall through */ 1194 /* fall through */
1249 case DIE_MCA_MONARCH_LEAVE: 1195 case DIE_MCA_MONARCH_LEAVE:
1250 case DIE_INIT_MONARCH_LEAVE: 1196 case DIE_INIT_MONARCH_LEAVE:
1251 xpc_online_heartbeat(); 1197 xpc_arch_ops.online_heartbeat();
1252 break; 1198 break;
1253 } 1199 }
1254#else 1200#else
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index 6722f6fe4dc7..65877bc5edaa 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -70,6 +70,9 @@ xpc_get_rsvd_page_pa(int nasid)
70 size_t buf_len = 0; 70 size_t buf_len = 0;
71 void *buf = buf; 71 void *buf = buf;
72 void *buf_base = NULL; 72 void *buf_base = NULL;
73 enum xp_retval (*get_partition_rsvd_page_pa)
74 (void *, u64 *, unsigned long *, size_t *) =
75 xpc_arch_ops.get_partition_rsvd_page_pa;
73 76
74 while (1) { 77 while (1) {
75 78
@@ -79,8 +82,7 @@ xpc_get_rsvd_page_pa(int nasid)
79 * ??? function or have two versions? Rename rp_pa for UV to 82 * ??? function or have two versions? Rename rp_pa for UV to
80 * ??? rp_gpa? 83 * ??? rp_gpa?
81 */ 84 */
82 ret = xpc_get_partition_rsvd_page_pa(buf, &cookie, &rp_pa, 85 ret = get_partition_rsvd_page_pa(buf, &cookie, &rp_pa, &len);
83 &len);
84 86
85 dev_dbg(xpc_part, "SAL returned with ret=%d, cookie=0x%016lx, " 87 dev_dbg(xpc_part, "SAL returned with ret=%d, cookie=0x%016lx, "
86 "address=0x%016lx, len=0x%016lx\n", ret, 88 "address=0x%016lx, len=0x%016lx\n", ret,
@@ -172,7 +174,7 @@ xpc_setup_rsvd_page(void)
172 xpc_part_nasids = XPC_RP_PART_NASIDS(rp); 174 xpc_part_nasids = XPC_RP_PART_NASIDS(rp);
173 xpc_mach_nasids = XPC_RP_MACH_NASIDS(rp); 175 xpc_mach_nasids = XPC_RP_MACH_NASIDS(rp);
174 176
175 ret = xpc_setup_rsvd_page_sn(rp); 177 ret = xpc_arch_ops.setup_rsvd_page(rp);
176 if (ret != 0) 178 if (ret != 0)
177 return ret; 179 return ret;
178 180
@@ -264,7 +266,7 @@ xpc_partition_disengaged(struct xpc_partition *part)
264 short partid = XPC_PARTID(part); 266 short partid = XPC_PARTID(part);
265 int disengaged; 267 int disengaged;
266 268
267 disengaged = !xpc_partition_engaged(partid); 269 disengaged = !xpc_arch_ops.partition_engaged(partid);
268 if (part->disengage_timeout) { 270 if (part->disengage_timeout) {
269 if (!disengaged) { 271 if (!disengaged) {
270 if (time_is_after_jiffies(part->disengage_timeout)) { 272 if (time_is_after_jiffies(part->disengage_timeout)) {
@@ -280,7 +282,7 @@ xpc_partition_disengaged(struct xpc_partition *part)
280 dev_info(xpc_part, "deactivate request to remote " 282 dev_info(xpc_part, "deactivate request to remote "
281 "partition %d timed out\n", partid); 283 "partition %d timed out\n", partid);
282 xpc_disengage_timedout = 1; 284 xpc_disengage_timedout = 1;
283 xpc_assume_partition_disengaged(partid); 285 xpc_arch_ops.assume_partition_disengaged(partid);
284 disengaged = 1; 286 disengaged = 1;
285 } 287 }
286 part->disengage_timeout = 0; 288 part->disengage_timeout = 0;
@@ -294,7 +296,7 @@ xpc_partition_disengaged(struct xpc_partition *part)
294 if (part->act_state != XPC_P_AS_INACTIVE) 296 if (part->act_state != XPC_P_AS_INACTIVE)
295 xpc_wakeup_channel_mgr(part); 297 xpc_wakeup_channel_mgr(part);
296 298
297 xpc_cancel_partition_deactivation_request(part); 299 xpc_arch_ops.cancel_partition_deactivation_request(part);
298 } 300 }
299 return disengaged; 301 return disengaged;
300} 302}
@@ -339,7 +341,7 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
339 spin_unlock_irqrestore(&part->act_lock, irq_flags); 341 spin_unlock_irqrestore(&part->act_lock, irq_flags);
340 if (reason == xpReactivating) { 342 if (reason == xpReactivating) {
341 /* we interrupt ourselves to reactivate partition */ 343 /* we interrupt ourselves to reactivate partition */
342 xpc_request_partition_reactivation(part); 344 xpc_arch_ops.request_partition_reactivation(part);
343 } 345 }
344 return; 346 return;
345 } 347 }
@@ -358,7 +360,7 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
358 spin_unlock_irqrestore(&part->act_lock, irq_flags); 360 spin_unlock_irqrestore(&part->act_lock, irq_flags);
359 361
360 /* ask remote partition to deactivate with regard to us */ 362 /* ask remote partition to deactivate with regard to us */
361 xpc_request_partition_deactivation(part); 363 xpc_arch_ops.request_partition_deactivation(part);
362 364
363 /* set a timelimit on the disengage phase of the deactivation request */ 365 /* set a timelimit on the disengage phase of the deactivation request */
364 part->disengage_timeout = jiffies + (xpc_disengage_timelimit * HZ); 366 part->disengage_timeout = jiffies + (xpc_disengage_timelimit * HZ);
@@ -496,7 +498,7 @@ xpc_discovery(void)
496 continue; 498 continue;
497 } 499 }
498 500
499 xpc_request_partition_activation(remote_rp, 501 xpc_arch_ops.request_partition_activation(remote_rp,
500 remote_rp_pa, nasid); 502 remote_rp_pa, nasid);
501 } 503 }
502 } 504 }
diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c
index 09bc1989f216..915a3b495da5 100644
--- a/drivers/misc/sgi-xp/xpc_sn2.c
+++ b/drivers/misc/sgi-xp/xpc_sn2.c
@@ -60,14 +60,14 @@ static struct xpc_vars_sn2 *xpc_vars_sn2;
60static struct xpc_vars_part_sn2 *xpc_vars_part_sn2; 60static struct xpc_vars_part_sn2 *xpc_vars_part_sn2;
61 61
62static int 62static int
63xpc_setup_partitions_sn_sn2(void) 63xpc_setup_partitions_sn2(void)
64{ 64{
65 /* nothing needs to be done */ 65 /* nothing needs to be done */
66 return 0; 66 return 0;
67} 67}
68 68
69static void 69static void
70xpc_teardown_partitions_sn_sn2(void) 70xpc_teardown_partitions_sn2(void)
71{ 71{
72 /* nothing needs to be done */ 72 /* nothing needs to be done */
73} 73}
@@ -628,7 +628,7 @@ xpc_get_partition_rsvd_page_pa_sn2(void *buf, u64 *cookie, unsigned long *rp_pa,
628 628
629 629
630static int 630static int
631xpc_setup_rsvd_page_sn_sn2(struct xpc_rsvd_page *rp) 631xpc_setup_rsvd_page_sn2(struct xpc_rsvd_page *rp)
632{ 632{
633 struct amo *amos_page; 633 struct amo *amos_page;
634 int i; 634 int i;
@@ -1162,7 +1162,7 @@ xpc_process_activate_IRQ_rcvd_sn2(void)
1162 * Setup the channel structures that are sn2 specific. 1162 * Setup the channel structures that are sn2 specific.
1163 */ 1163 */
1164static enum xp_retval 1164static enum xp_retval
1165xpc_setup_ch_structures_sn_sn2(struct xpc_partition *part) 1165xpc_setup_ch_structures_sn2(struct xpc_partition *part)
1166{ 1166{
1167 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2; 1167 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
1168 struct xpc_channel_sn2 *ch_sn2; 1168 struct xpc_channel_sn2 *ch_sn2;
@@ -1284,7 +1284,7 @@ out_1:
1284 * Teardown the channel structures that are sn2 specific. 1284 * Teardown the channel structures that are sn2 specific.
1285 */ 1285 */
1286static void 1286static void
1287xpc_teardown_ch_structures_sn_sn2(struct xpc_partition *part) 1287xpc_teardown_ch_structures_sn2(struct xpc_partition *part)
1288{ 1288{
1289 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2; 1289 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
1290 short partid = XPC_PARTID(part); 1290 short partid = XPC_PARTID(part);
@@ -2348,66 +2348,70 @@ xpc_received_payload_sn2(struct xpc_channel *ch, void *payload)
2348 xpc_acknowledge_msgs_sn2(ch, get, msg->flags); 2348 xpc_acknowledge_msgs_sn2(ch, get, msg->flags);
2349} 2349}
2350 2350
2351static struct xpc_arch_operations xpc_arch_ops_sn2 = {
2352 .setup_partitions = xpc_setup_partitions_sn2,
2353 .teardown_partitions = xpc_teardown_partitions_sn2,
2354 .process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_sn2,
2355 .get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_sn2,
2356 .setup_rsvd_page = xpc_setup_rsvd_page_sn2,
2357
2358 .allow_hb = xpc_allow_hb_sn2,
2359 .disallow_hb = xpc_disallow_hb_sn2,
2360 .disallow_all_hbs = xpc_disallow_all_hbs_sn2,
2361 .increment_heartbeat = xpc_increment_heartbeat_sn2,
2362 .offline_heartbeat = xpc_offline_heartbeat_sn2,
2363 .online_heartbeat = xpc_online_heartbeat_sn2,
2364 .heartbeat_init = xpc_heartbeat_init_sn2,
2365 .heartbeat_exit = xpc_heartbeat_exit_sn2,
2366 .get_remote_heartbeat = xpc_get_remote_heartbeat_sn2,
2367
2368 .request_partition_activation =
2369 xpc_request_partition_activation_sn2,
2370 .request_partition_reactivation =
2371 xpc_request_partition_reactivation_sn2,
2372 .request_partition_deactivation =
2373 xpc_request_partition_deactivation_sn2,
2374 .cancel_partition_deactivation_request =
2375 xpc_cancel_partition_deactivation_request_sn2,
2376
2377 .setup_ch_structures = xpc_setup_ch_structures_sn2,
2378 .teardown_ch_structures = xpc_teardown_ch_structures_sn2,
2379
2380 .make_first_contact = xpc_make_first_contact_sn2,
2381
2382 .get_chctl_all_flags = xpc_get_chctl_all_flags_sn2,
2383 .send_chctl_closerequest = xpc_send_chctl_closerequest_sn2,
2384 .send_chctl_closereply = xpc_send_chctl_closereply_sn2,
2385 .send_chctl_openrequest = xpc_send_chctl_openrequest_sn2,
2386 .send_chctl_openreply = xpc_send_chctl_openreply_sn2,
2387 .send_chctl_opencomplete = xpc_send_chctl_opencomplete_sn2,
2388 .process_msg_chctl_flags = xpc_process_msg_chctl_flags_sn2,
2389
2390 .save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_sn2,
2391
2392 .setup_msg_structures = xpc_setup_msg_structures_sn2,
2393 .teardown_msg_structures = xpc_teardown_msg_structures_sn2,
2394
2395 .indicate_partition_engaged = xpc_indicate_partition_engaged_sn2,
2396 .indicate_partition_disengaged = xpc_indicate_partition_disengaged_sn2,
2397 .partition_engaged = xpc_partition_engaged_sn2,
2398 .any_partition_engaged = xpc_any_partition_engaged_sn2,
2399 .assume_partition_disengaged = xpc_assume_partition_disengaged_sn2,
2400
2401 .n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_sn2,
2402 .send_payload = xpc_send_payload_sn2,
2403 .get_deliverable_payload = xpc_get_deliverable_payload_sn2,
2404 .received_payload = xpc_received_payload_sn2,
2405 .notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_sn2,
2406};
2407
2351int 2408int
2352xpc_init_sn2(void) 2409xpc_init_sn2(void)
2353{ 2410{
2354 int ret; 2411 int ret;
2355 size_t buf_size; 2412 size_t buf_size;
2356 2413
2357 xpc_setup_partitions_sn = xpc_setup_partitions_sn_sn2; 2414 xpc_arch_ops = xpc_arch_ops_sn2;
2358 xpc_teardown_partitions_sn = xpc_teardown_partitions_sn_sn2;
2359 xpc_get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_sn2;
2360 xpc_setup_rsvd_page_sn = xpc_setup_rsvd_page_sn_sn2;
2361
2362 xpc_allow_hb = xpc_allow_hb_sn2;
2363 xpc_disallow_hb = xpc_disallow_hb_sn2;
2364 xpc_disallow_all_hbs = xpc_disallow_all_hbs_sn2;
2365 xpc_increment_heartbeat = xpc_increment_heartbeat_sn2;
2366 xpc_offline_heartbeat = xpc_offline_heartbeat_sn2;
2367 xpc_online_heartbeat = xpc_online_heartbeat_sn2;
2368 xpc_heartbeat_init = xpc_heartbeat_init_sn2;
2369 xpc_heartbeat_exit = xpc_heartbeat_exit_sn2;
2370 xpc_get_remote_heartbeat = xpc_get_remote_heartbeat_sn2;
2371
2372 xpc_request_partition_activation = xpc_request_partition_activation_sn2;
2373 xpc_request_partition_reactivation =
2374 xpc_request_partition_reactivation_sn2;
2375 xpc_request_partition_deactivation =
2376 xpc_request_partition_deactivation_sn2;
2377 xpc_cancel_partition_deactivation_request =
2378 xpc_cancel_partition_deactivation_request_sn2;
2379
2380 xpc_process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_sn2;
2381 xpc_setup_ch_structures_sn = xpc_setup_ch_structures_sn_sn2;
2382 xpc_teardown_ch_structures_sn = xpc_teardown_ch_structures_sn_sn2;
2383 xpc_make_first_contact = xpc_make_first_contact_sn2;
2384
2385 xpc_get_chctl_all_flags = xpc_get_chctl_all_flags_sn2;
2386 xpc_send_chctl_closerequest = xpc_send_chctl_closerequest_sn2;
2387 xpc_send_chctl_closereply = xpc_send_chctl_closereply_sn2;
2388 xpc_send_chctl_openrequest = xpc_send_chctl_openrequest_sn2;
2389 xpc_send_chctl_openreply = xpc_send_chctl_openreply_sn2;
2390 xpc_send_chctl_opencomplete = xpc_send_chctl_opencomplete_sn2;
2391
2392 xpc_save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_sn2;
2393
2394 xpc_setup_msg_structures = xpc_setup_msg_structures_sn2;
2395 xpc_teardown_msg_structures = xpc_teardown_msg_structures_sn2;
2396
2397 xpc_notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_sn2;
2398 xpc_process_msg_chctl_flags = xpc_process_msg_chctl_flags_sn2;
2399 xpc_n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_sn2;
2400 xpc_get_deliverable_payload = xpc_get_deliverable_payload_sn2;
2401
2402 xpc_indicate_partition_engaged = xpc_indicate_partition_engaged_sn2;
2403 xpc_indicate_partition_disengaged =
2404 xpc_indicate_partition_disengaged_sn2;
2405 xpc_partition_engaged = xpc_partition_engaged_sn2;
2406 xpc_any_partition_engaged = xpc_any_partition_engaged_sn2;
2407 xpc_assume_partition_disengaged = xpc_assume_partition_disengaged_sn2;
2408
2409 xpc_send_payload = xpc_send_payload_sn2;
2410 xpc_received_payload = xpc_received_payload_sn2;
2411 2415
2412 if (offsetof(struct xpc_msg_sn2, payload) > XPC_MSG_HDR_MAX_SIZE) { 2416 if (offsetof(struct xpc_msg_sn2, payload) > XPC_MSG_HDR_MAX_SIZE) {
2413 dev_err(xpc_part, "header portion of struct xpc_msg_sn2 is " 2417 dev_err(xpc_part, "header portion of struct xpc_msg_sn2 is "
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
index 1e475b4c0887..9172fcdee4e2 100644
--- a/drivers/misc/sgi-xp/xpc_uv.c
+++ b/drivers/misc/sgi-xp/xpc_uv.c
@@ -62,7 +62,7 @@ static struct xpc_gru_mq_uv *xpc_activate_mq_uv;
62static struct xpc_gru_mq_uv *xpc_notify_mq_uv; 62static struct xpc_gru_mq_uv *xpc_notify_mq_uv;
63 63
64static int 64static int
65xpc_setup_partitions_sn_uv(void) 65xpc_setup_partitions_uv(void)
66{ 66{
67 short partid; 67 short partid;
68 struct xpc_partition_uv *part_uv; 68 struct xpc_partition_uv *part_uv;
@@ -78,7 +78,7 @@ xpc_setup_partitions_sn_uv(void)
78} 78}
79 79
80static void 80static void
81xpc_teardown_partitions_sn_uv(void) 81xpc_teardown_partitions_uv(void)
82{ 82{
83 short partid; 83 short partid;
84 struct xpc_partition_uv *part_uv; 84 struct xpc_partition_uv *part_uv;
@@ -782,7 +782,7 @@ xpc_get_partition_rsvd_page_pa_uv(void *buf, u64 *cookie, unsigned long *rp_pa,
782} 782}
783 783
784static int 784static int
785xpc_setup_rsvd_page_sn_uv(struct xpc_rsvd_page *rp) 785xpc_setup_rsvd_page_uv(struct xpc_rsvd_page *rp)
786{ 786{
787 xpc_heartbeat_uv = 787 xpc_heartbeat_uv =
788 &xpc_partitions[sn_partition_id].sn.uv.cached_heartbeat; 788 &xpc_partitions[sn_partition_id].sn.uv.cached_heartbeat;
@@ -980,7 +980,7 @@ xpc_n_of_fifo_entries_uv(struct xpc_fifo_head_uv *head)
980 * Setup the channel structures that are uv specific. 980 * Setup the channel structures that are uv specific.
981 */ 981 */
982static enum xp_retval 982static enum xp_retval
983xpc_setup_ch_structures_sn_uv(struct xpc_partition *part) 983xpc_setup_ch_structures_uv(struct xpc_partition *part)
984{ 984{
985 struct xpc_channel_uv *ch_uv; 985 struct xpc_channel_uv *ch_uv;
986 int ch_number; 986 int ch_number;
@@ -999,7 +999,7 @@ xpc_setup_ch_structures_sn_uv(struct xpc_partition *part)
999 * Teardown the channel structures that are uv specific. 999 * Teardown the channel structures that are uv specific.
1000 */ 1000 */
1001static void 1001static void
1002xpc_teardown_ch_structures_sn_uv(struct xpc_partition *part) 1002xpc_teardown_ch_structures_uv(struct xpc_partition *part)
1003{ 1003{
1004 /* nothing needs to be done */ 1004 /* nothing needs to be done */
1005 return; 1005 return;
@@ -1649,63 +1649,67 @@ xpc_received_payload_uv(struct xpc_channel *ch, void *payload)
1649 msg->hdr.msg_slot_number += ch->remote_nentries; 1649 msg->hdr.msg_slot_number += ch->remote_nentries;
1650} 1650}
1651 1651
1652static struct xpc_arch_operations xpc_arch_ops_uv = {
1653 .setup_partitions = xpc_setup_partitions_uv,
1654 .teardown_partitions = xpc_teardown_partitions_uv,
1655 .process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_uv,
1656 .get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_uv,
1657 .setup_rsvd_page = xpc_setup_rsvd_page_uv,
1658
1659 .allow_hb = xpc_allow_hb_uv,
1660 .disallow_hb = xpc_disallow_hb_uv,
1661 .disallow_all_hbs = xpc_disallow_all_hbs_uv,
1662 .increment_heartbeat = xpc_increment_heartbeat_uv,
1663 .offline_heartbeat = xpc_offline_heartbeat_uv,
1664 .online_heartbeat = xpc_online_heartbeat_uv,
1665 .heartbeat_init = xpc_heartbeat_init_uv,
1666 .heartbeat_exit = xpc_heartbeat_exit_uv,
1667 .get_remote_heartbeat = xpc_get_remote_heartbeat_uv,
1668
1669 .request_partition_activation =
1670 xpc_request_partition_activation_uv,
1671 .request_partition_reactivation =
1672 xpc_request_partition_reactivation_uv,
1673 .request_partition_deactivation =
1674 xpc_request_partition_deactivation_uv,
1675 .cancel_partition_deactivation_request =
1676 xpc_cancel_partition_deactivation_request_uv,
1677
1678 .setup_ch_structures = xpc_setup_ch_structures_uv,
1679 .teardown_ch_structures = xpc_teardown_ch_structures_uv,
1680
1681 .make_first_contact = xpc_make_first_contact_uv,
1682
1683 .get_chctl_all_flags = xpc_get_chctl_all_flags_uv,
1684 .send_chctl_closerequest = xpc_send_chctl_closerequest_uv,
1685 .send_chctl_closereply = xpc_send_chctl_closereply_uv,
1686 .send_chctl_openrequest = xpc_send_chctl_openrequest_uv,
1687 .send_chctl_openreply = xpc_send_chctl_openreply_uv,
1688 .send_chctl_opencomplete = xpc_send_chctl_opencomplete_uv,
1689 .process_msg_chctl_flags = xpc_process_msg_chctl_flags_uv,
1690
1691 .save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_uv,
1692
1693 .setup_msg_structures = xpc_setup_msg_structures_uv,
1694 .teardown_msg_structures = xpc_teardown_msg_structures_uv,
1695
1696 .indicate_partition_engaged = xpc_indicate_partition_engaged_uv,
1697 .indicate_partition_disengaged = xpc_indicate_partition_disengaged_uv,
1698 .assume_partition_disengaged = xpc_assume_partition_disengaged_uv,
1699 .partition_engaged = xpc_partition_engaged_uv,
1700 .any_partition_engaged = xpc_any_partition_engaged_uv,
1701
1702 .n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_uv,
1703 .send_payload = xpc_send_payload_uv,
1704 .get_deliverable_payload = xpc_get_deliverable_payload_uv,
1705 .received_payload = xpc_received_payload_uv,
1706 .notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_uv,
1707};
1708
1652int 1709int
1653xpc_init_uv(void) 1710xpc_init_uv(void)
1654{ 1711{
1655 xpc_setup_partitions_sn = xpc_setup_partitions_sn_uv; 1712 xpc_arch_ops = xpc_arch_ops_uv;
1656 xpc_teardown_partitions_sn = xpc_teardown_partitions_sn_uv;
1657 xpc_process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_uv;
1658 xpc_get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_uv;
1659 xpc_setup_rsvd_page_sn = xpc_setup_rsvd_page_sn_uv;
1660
1661 xpc_allow_hb = xpc_allow_hb_uv;
1662 xpc_disallow_hb = xpc_disallow_hb_uv;
1663 xpc_disallow_all_hbs = xpc_disallow_all_hbs_uv;
1664 xpc_increment_heartbeat = xpc_increment_heartbeat_uv;
1665 xpc_offline_heartbeat = xpc_offline_heartbeat_uv;
1666 xpc_online_heartbeat = xpc_online_heartbeat_uv;
1667 xpc_heartbeat_init = xpc_heartbeat_init_uv;
1668 xpc_heartbeat_exit = xpc_heartbeat_exit_uv;
1669 xpc_get_remote_heartbeat = xpc_get_remote_heartbeat_uv;
1670
1671 xpc_request_partition_activation = xpc_request_partition_activation_uv;
1672 xpc_request_partition_reactivation =
1673 xpc_request_partition_reactivation_uv;
1674 xpc_request_partition_deactivation =
1675 xpc_request_partition_deactivation_uv;
1676 xpc_cancel_partition_deactivation_request =
1677 xpc_cancel_partition_deactivation_request_uv;
1678
1679 xpc_setup_ch_structures_sn = xpc_setup_ch_structures_sn_uv;
1680 xpc_teardown_ch_structures_sn = xpc_teardown_ch_structures_sn_uv;
1681
1682 xpc_make_first_contact = xpc_make_first_contact_uv;
1683
1684 xpc_get_chctl_all_flags = xpc_get_chctl_all_flags_uv;
1685 xpc_send_chctl_closerequest = xpc_send_chctl_closerequest_uv;
1686 xpc_send_chctl_closereply = xpc_send_chctl_closereply_uv;
1687 xpc_send_chctl_openrequest = xpc_send_chctl_openrequest_uv;
1688 xpc_send_chctl_openreply = xpc_send_chctl_openreply_uv;
1689 xpc_send_chctl_opencomplete = xpc_send_chctl_opencomplete_uv;
1690
1691 xpc_save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_uv;
1692
1693 xpc_setup_msg_structures = xpc_setup_msg_structures_uv;
1694 xpc_teardown_msg_structures = xpc_teardown_msg_structures_uv;
1695
1696 xpc_indicate_partition_engaged = xpc_indicate_partition_engaged_uv;
1697 xpc_indicate_partition_disengaged =
1698 xpc_indicate_partition_disengaged_uv;
1699 xpc_assume_partition_disengaged = xpc_assume_partition_disengaged_uv;
1700 xpc_partition_engaged = xpc_partition_engaged_uv;
1701 xpc_any_partition_engaged = xpc_any_partition_engaged_uv;
1702
1703 xpc_n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_uv;
1704 xpc_process_msg_chctl_flags = xpc_process_msg_chctl_flags_uv;
1705 xpc_send_payload = xpc_send_payload_uv;
1706 xpc_notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_uv;
1707 xpc_get_deliverable_payload = xpc_get_deliverable_payload_uv;
1708 xpc_received_payload = xpc_received_payload_uv;
1709 1713
1710 if (sizeof(struct xpc_notify_mq_msghdr_uv) > XPC_MSG_HDR_MAX_SIZE) { 1714 if (sizeof(struct xpc_notify_mq_msghdr_uv) > XPC_MSG_HDR_MAX_SIZE) {
1711 dev_err(xpc_part, "xpc_notify_mq_msghdr_uv is larger than %d\n", 1715 dev_err(xpc_part, "xpc_notify_mq_msghdr_uv is larger than %d\n",