aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xpc.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/sgi-xp/xpc.h')
-rw-r--r--drivers/misc/sgi-xp/xpc.h140
1 files changed, 107 insertions, 33 deletions
diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h
index 4c26181defff..619208d61862 100644
--- a/drivers/misc/sgi-xp/xpc.h
+++ b/drivers/misc/sgi-xp/xpc.h
@@ -181,8 +181,8 @@ struct xpc_vars_part_sn2 {
181 xpc_nasid_mask_nlongs)) 181 xpc_nasid_mask_nlongs))
182 182
183/* 183/*
184 * The activate_mq is used to send/receive messages that affect XPC's heartbeat, 184 * The activate_mq is used to send/receive GRU messages that affect XPC's
185 * partition active state, and channel state. This is UV only. 185 * heartbeat, partition active state, and channel state. This is UV only.
186 */ 186 */
187struct xpc_activate_mq_msghdr_uv { 187struct xpc_activate_mq_msghdr_uv {
188 short partid; /* sender's partid */ 188 short partid; /* sender's partid */
@@ -209,45 +209,45 @@ struct xpc_activate_mq_msghdr_uv {
209#define XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV 11 209#define XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV 11
210 210
211struct xpc_activate_mq_msg_uv { 211struct xpc_activate_mq_msg_uv {
212 struct xpc_activate_mq_msghdr_uv header; 212 struct xpc_activate_mq_msghdr_uv hdr;
213}; 213};
214 214
215struct xpc_activate_mq_msg_heartbeat_req_uv { 215struct xpc_activate_mq_msg_heartbeat_req_uv {
216 struct xpc_activate_mq_msghdr_uv header; 216 struct xpc_activate_mq_msghdr_uv hdr;
217 u64 heartbeat; 217 u64 heartbeat;
218}; 218};
219 219
220struct xpc_activate_mq_msg_activate_req_uv { 220struct xpc_activate_mq_msg_activate_req_uv {
221 struct xpc_activate_mq_msghdr_uv header; 221 struct xpc_activate_mq_msghdr_uv hdr;
222 unsigned long rp_gpa; 222 unsigned long rp_gpa;
223 unsigned long activate_mq_gpa; 223 unsigned long activate_mq_gpa;
224}; 224};
225 225
226struct xpc_activate_mq_msg_deactivate_req_uv { 226struct xpc_activate_mq_msg_deactivate_req_uv {
227 struct xpc_activate_mq_msghdr_uv header; 227 struct xpc_activate_mq_msghdr_uv hdr;
228 enum xp_retval reason; 228 enum xp_retval reason;
229}; 229};
230 230
231struct xpc_activate_mq_msg_chctl_closerequest_uv { 231struct xpc_activate_mq_msg_chctl_closerequest_uv {
232 struct xpc_activate_mq_msghdr_uv header; 232 struct xpc_activate_mq_msghdr_uv hdr;
233 short ch_number; 233 short ch_number;
234 enum xp_retval reason; 234 enum xp_retval reason;
235}; 235};
236 236
237struct xpc_activate_mq_msg_chctl_closereply_uv { 237struct xpc_activate_mq_msg_chctl_closereply_uv {
238 struct xpc_activate_mq_msghdr_uv header; 238 struct xpc_activate_mq_msghdr_uv hdr;
239 short ch_number; 239 short ch_number;
240}; 240};
241 241
242struct xpc_activate_mq_msg_chctl_openrequest_uv { 242struct xpc_activate_mq_msg_chctl_openrequest_uv {
243 struct xpc_activate_mq_msghdr_uv header; 243 struct xpc_activate_mq_msghdr_uv hdr;
244 short ch_number; 244 short ch_number;
245 short msg_size; /* size of notify_mq's messages */ 245 short entry_size; /* size of notify_mq's GRU messages */
246 short local_nentries; /* ??? Is this needed? What is? */ 246 short local_nentries; /* ??? Is this needed? What is? */
247}; 247};
248 248
249struct xpc_activate_mq_msg_chctl_openreply_uv { 249struct xpc_activate_mq_msg_chctl_openreply_uv {
250 struct xpc_activate_mq_msghdr_uv header; 250 struct xpc_activate_mq_msghdr_uv hdr;
251 short ch_number; 251 short ch_number;
252 short remote_nentries; /* ??? Is this needed? What is? */ 252 short remote_nentries; /* ??? Is this needed? What is? */
253 short local_nentries; /* ??? Is this needed? What is? */ 253 short local_nentries; /* ??? Is this needed? What is? */
@@ -284,7 +284,7 @@ struct xpc_gp_sn2 {
284 */ 284 */
285struct xpc_openclose_args { 285struct xpc_openclose_args {
286 u16 reason; /* reason why channel is closing */ 286 u16 reason; /* reason why channel is closing */
287 u16 msg_size; /* sizeof each message entry */ 287 u16 entry_size; /* sizeof each message entry */
288 u16 remote_nentries; /* #of message entries in remote msg queue */ 288 u16 remote_nentries; /* #of message entries in remote msg queue */
289 u16 local_nentries; /* #of message entries in local msg queue */ 289 u16 local_nentries; /* #of message entries in local msg queue */
290 unsigned long local_msgqueue_pa; /* phys addr of local message queue */ 290 unsigned long local_msgqueue_pa; /* phys addr of local message queue */
@@ -294,22 +294,79 @@ struct xpc_openclose_args {
294 L1_CACHE_ALIGN(sizeof(struct xpc_openclose_args) * \ 294 L1_CACHE_ALIGN(sizeof(struct xpc_openclose_args) * \
295 XPC_MAX_NCHANNELS) 295 XPC_MAX_NCHANNELS)
296 296
297/* struct xpc_msg flags */
298 297
299#define XPC_M_DONE 0x01 /* msg has been received/consumed */ 298/*
300#define XPC_M_READY 0x02 /* msg is ready to be sent */ 299 * Structures to define a fifo singly-linked list.
301#define XPC_M_INTERRUPT 0x04 /* send interrupt when msg consumed */ 300 */
301
302struct xpc_fifo_entry_uv {
303 struct xpc_fifo_entry_uv *next;
304};
305
306struct xpc_fifo_head_uv {
307 struct xpc_fifo_entry_uv *first;
308 struct xpc_fifo_entry_uv *last;
309 spinlock_t lock;
310 int n_entries;
311};
312
313/*
314 * Define a sn2 styled message.
315 *
316 * A user-defined message resides in the payload area. The max size of the
317 * payload is defined by the user via xpc_connect().
318 *
319 * The size of a message entry (within a message queue) must be a 128-byte
320 * cacheline sized multiple in order to facilitate the BTE transfer of messages
321 * from one message queue to another.
322 */
323struct xpc_msg_sn2 {
324 u8 flags; /* FOR XPC INTERNAL USE ONLY */
325 u8 reserved[7]; /* FOR XPC INTERNAL USE ONLY */
326 s64 number; /* FOR XPC INTERNAL USE ONLY */
327
328 u64 payload; /* user defined portion of message */
329};
330
331/* struct xpc_msg_sn2 flags */
332
333#define XPC_M_SN2_DONE 0x01 /* msg has been received/consumed */
334#define XPC_M_SN2_READY 0x02 /* msg is ready to be sent */
335#define XPC_M_SN2_INTERRUPT 0x04 /* send interrupt when msg consumed */
336
337/*
338 * The format of a uv XPC notify_mq GRU message is as follows:
339 *
340 * A user-defined message resides in the payload area. The max size of the
341 * payload is defined by the user via xpc_connect().
342 *
343 * The size of a message (payload and header) sent via the GRU must be either 1
344 * or 2 GRU_CACHE_LINE_BYTES in length.
345 */
302 346
303#define XPC_MSG_ADDRESS(_payload) \ 347struct xpc_notify_mq_msghdr_uv {
304 ((struct xpc_msg *)((u8 *)(_payload) - XPC_MSG_PAYLOAD_OFFSET)) 348 union {
349 unsigned int gru_msg_hdr; /* FOR GRU INTERNAL USE ONLY */
350 struct xpc_fifo_entry_uv next; /* FOR XPC INTERNAL USE ONLY */
351 } u;
352 short partid; /* FOR XPC INTERNAL USE ONLY */
353 u8 ch_number; /* FOR XPC INTERNAL USE ONLY */
354 u8 size; /* FOR XPC INTERNAL USE ONLY */
355 unsigned int msg_slot_number; /* FOR XPC INTERNAL USE ONLY */
356};
357
358struct xpc_notify_mq_msg_uv {
359 struct xpc_notify_mq_msghdr_uv hdr;
360 unsigned long payload;
361};
305 362
306/* 363/*
307 * Defines notify entry. 364 * Define sn2's notify entry.
308 * 365 *
309 * This is used to notify a message's sender that their message was received 366 * This is used to notify a message's sender that their message was received
310 * and consumed by the intended recipient. 367 * and consumed by the intended recipient.
311 */ 368 */
312struct xpc_notify { 369struct xpc_notify_sn2 {
313 u8 type; /* type of notification */ 370 u8 type; /* type of notification */
314 371
315 /* the following two fields are only used if type == XPC_N_CALL */ 372 /* the following two fields are only used if type == XPC_N_CALL */
@@ -317,9 +374,20 @@ struct xpc_notify {
317 void *key; /* pointer to user's key */ 374 void *key; /* pointer to user's key */
318}; 375};
319 376
320/* struct xpc_notify type of notification */ 377/* struct xpc_notify_sn2 type of notification */
321 378
322#define XPC_N_CALL 0x01 /* notify function provided by user */ 379#define XPC_N_CALL 0x01 /* notify function provided by user */
380
381/*
382 * Define uv's version of the notify entry. It additionally is used to allocate
383 * a msg slot on the remote partition into which is copied a sent message.
384 */
385struct xpc_send_msg_slot_uv {
386 struct xpc_fifo_entry_uv next;
387 unsigned int msg_slot_number;
388 xpc_notify_func func; /* user's notify function */
389 void *key; /* pointer to user's key */
390};
323 391
324/* 392/*
325 * Define the structure that manages all the stuff required by a channel. In 393 * Define the structure that manages all the stuff required by a channel. In
@@ -409,14 +477,14 @@ struct xpc_channel_sn2 {
409 /* opening or closing of channel */ 477 /* opening or closing of channel */
410 478
411 void *local_msgqueue_base; /* base address of kmalloc'd space */ 479 void *local_msgqueue_base; /* base address of kmalloc'd space */
412 struct xpc_msg *local_msgqueue; /* local message queue */ 480 struct xpc_msg_sn2 *local_msgqueue; /* local message queue */
413 void *remote_msgqueue_base; /* base address of kmalloc'd space */ 481 void *remote_msgqueue_base; /* base address of kmalloc'd space */
414 struct xpc_msg *remote_msgqueue; /* cached copy of remote partition's */ 482 struct xpc_msg_sn2 *remote_msgqueue; /* cached copy of remote */
415 /* local message queue */ 483 /* partition's local message queue */
416 unsigned long remote_msgqueue_pa; /* phys addr of remote partition's */ 484 unsigned long remote_msgqueue_pa; /* phys addr of remote partition's */
417 /* local message queue */ 485 /* local message queue */
418 486
419 struct xpc_notify *notify_queue; /* notify queue for messages sent */ 487 struct xpc_notify_sn2 *notify_queue;/* notify queue for messages sent */
420 488
421 /* various flavors of local and remote Get/Put values */ 489 /* various flavors of local and remote Get/Put values */
422 490
@@ -432,6 +500,12 @@ struct xpc_channel_sn2 {
432struct xpc_channel_uv { 500struct xpc_channel_uv {
433 unsigned long remote_notify_mq_gpa; /* gru phys address of remote */ 501 unsigned long remote_notify_mq_gpa; /* gru phys address of remote */
434 /* partition's notify mq */ 502 /* partition's notify mq */
503
504 struct xpc_send_msg_slot_uv *send_msg_slots;
505 struct xpc_notify_mq_msg_uv *recv_msg_slots;
506
507 struct xpc_fifo_head_uv msg_slot_free_list;
508 struct xpc_fifo_head_uv recv_msg_list; /* deliverable payloads */
435}; 509};
436 510
437struct xpc_channel { 511struct xpc_channel {
@@ -444,7 +518,7 @@ struct xpc_channel {
444 518
445 u16 number; /* channel # */ 519 u16 number; /* channel # */
446 520
447 u16 msg_size; /* sizeof each msg entry */ 521 u16 entry_size; /* sizeof each msg entry */
448 u16 local_nentries; /* #of msg entries in local msg queue */ 522 u16 local_nentries; /* #of msg entries in local msg queue */
449 u16 remote_nentries; /* #of msg entries in remote msg queue */ 523 u16 remote_nentries; /* #of msg entries in remote msg queue */
450 524
@@ -733,8 +807,8 @@ extern enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *);
733extern void (*xpc_teardown_msg_structures) (struct xpc_channel *); 807extern void (*xpc_teardown_msg_structures) (struct xpc_channel *);
734extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *); 808extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *);
735extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *, int); 809extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *, int);
736extern int (*xpc_n_of_deliverable_msgs) (struct xpc_channel *); 810extern int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *);
737extern struct xpc_msg *(*xpc_get_deliverable_msg) (struct xpc_channel *); 811extern void *(*xpc_get_deliverable_payload) (struct xpc_channel *);
738extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *, 812extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *,
739 unsigned long, int); 813 unsigned long, int);
740extern void (*xpc_request_partition_reactivation) (struct xpc_partition *); 814extern void (*xpc_request_partition_reactivation) (struct xpc_partition *);
@@ -762,9 +836,9 @@ extern void (*xpc_send_chctl_openreply) (struct xpc_channel *, unsigned long *);
762extern void (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *, 836extern void (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *,
763 unsigned long); 837 unsigned long);
764 838
765extern enum xp_retval (*xpc_send_msg) (struct xpc_channel *, u32, void *, u16, 839extern enum xp_retval (*xpc_send_payload) (struct xpc_channel *, u32, void *,
766 u8, xpc_notify_func, void *); 840 u16, u8, xpc_notify_func, void *);
767extern void (*xpc_received_msg) (struct xpc_channel *, struct xpc_msg *); 841extern void (*xpc_received_payload) (struct xpc_channel *, void *);
768 842
769/* found in xpc_sn2.c */ 843/* found in xpc_sn2.c */
770extern int xpc_init_sn2(void); 844extern int xpc_init_sn2(void);
@@ -805,7 +879,7 @@ extern enum xp_retval xpc_initiate_send_notify(short, int, u32, void *, u16,
805extern void xpc_initiate_received(short, int, void *); 879extern void xpc_initiate_received(short, int, void *);
806extern void xpc_process_sent_chctl_flags(struct xpc_partition *); 880extern void xpc_process_sent_chctl_flags(struct xpc_partition *);
807extern void xpc_connected_callout(struct xpc_channel *); 881extern void xpc_connected_callout(struct xpc_channel *);
808extern void xpc_deliver_msg(struct xpc_channel *); 882extern void xpc_deliver_payload(struct xpc_channel *);
809extern void xpc_disconnect_channel(const int, struct xpc_channel *, 883extern void xpc_disconnect_channel(const int, struct xpc_channel *,
810 enum xp_retval, unsigned long *); 884 enum xp_retval, unsigned long *);
811extern void xpc_disconnect_callout(struct xpc_channel *, enum xp_retval); 885extern void xpc_disconnect_callout(struct xpc_channel *, enum xp_retval);