aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xp.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/sgi-xp/xp.h')
-rw-r--r--drivers/misc/sgi-xp/xp.h80
1 files changed, 29 insertions, 51 deletions
diff --git a/drivers/misc/sgi-xp/xp.h b/drivers/misc/sgi-xp/xp.h
index fb65981754c3..87171682664d 100644
--- a/drivers/misc/sgi-xp/xp.h
+++ b/drivers/misc/sgi-xp/xp.h
@@ -6,30 +6,25 @@
6 * Copyright (C) 2004-2008 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 2004-2008 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8 8
9
10/* 9/*
11 * External Cross Partition (XP) structures and defines. 10 * External Cross Partition (XP) structures and defines.
12 */ 11 */
13 12
14
15#ifndef _DRIVERS_MISC_SGIXP_XP_H 13#ifndef _DRIVERS_MISC_SGIXP_XP_H
16#define _DRIVERS_MISC_SGIXP_XP_H 14#define _DRIVERS_MISC_SGIXP_XP_H
17 15
18
19#include <linux/cache.h> 16#include <linux/cache.h>
20#include <linux/hardirq.h> 17#include <linux/hardirq.h>
21#include <linux/mutex.h> 18#include <linux/mutex.h>
22#include <asm/sn/types.h> 19#include <asm/sn/types.h>
23#include <asm/sn/bte.h> 20#include <asm/sn/bte.h>
24 21
25
26#ifdef USE_DBUG_ON 22#ifdef USE_DBUG_ON
27#define DBUG_ON(condition) BUG_ON(condition) 23#define DBUG_ON(condition) BUG_ON(condition)
28#else 24#else
29#define DBUG_ON(condition) 25#define DBUG_ON(condition)
30#endif 26#endif
31 27
32
33/* 28/*
34 * Define the maximum number of logically defined partitions the system 29 * Define the maximum number of logically defined partitions the system
35 * can support. It is constrained by the maximum number of hardware 30 * can support. It is constrained by the maximum number of hardware
@@ -43,7 +38,6 @@
43 */ 38 */
44#define XP_MAX_PARTITIONS 64 39#define XP_MAX_PARTITIONS 64
45 40
46
47/* 41/*
48 * Define the number of u64s required to represent all the C-brick nasids 42 * Define the number of u64s required to represent all the C-brick nasids
49 * as a bitmap. The cross-partition kernel modules deal only with 43 * as a bitmap. The cross-partition kernel modules deal only with
@@ -54,7 +48,6 @@
54#define XP_NASID_MASK_BYTES ((XP_MAX_PHYSNODE_ID + 7) / 8) 48#define XP_NASID_MASK_BYTES ((XP_MAX_PHYSNODE_ID + 7) / 8)
55#define XP_NASID_MASK_WORDS ((XP_MAX_PHYSNODE_ID + 63) / 64) 49#define XP_NASID_MASK_WORDS ((XP_MAX_PHYSNODE_ID + 63) / 64)
56 50
57
58/* 51/*
59 * Wrapper for bte_copy() that should it return a failure status will retry 52 * Wrapper for bte_copy() that should it return a failure status will retry
60 * the bte_copy() once in the hope that the failure was due to a temporary 53 * the bte_copy() once in the hope that the failure was due to a temporary
@@ -74,7 +67,6 @@ xp_bte_copy(u64 src, u64 vdst, u64 len, u64 mode, void *notification)
74 bte_result_t ret; 67 bte_result_t ret;
75 u64 pdst = ia64_tpa(vdst); 68 u64 pdst = ia64_tpa(vdst);
76 69
77
78 /* 70 /*
79 * Ensure that the physically mapped memory is contiguous. 71 * Ensure that the physically mapped memory is contiguous.
80 * 72 *
@@ -96,7 +88,6 @@ xp_bte_copy(u64 src, u64 vdst, u64 len, u64 mode, void *notification)
96 return ret; 88 return ret;
97} 89}
98 90
99
100/* 91/*
101 * XPC establishes channel connections between the local partition and any 92 * XPC establishes channel connections between the local partition and any
102 * other partition that is currently up. Over these channels, kernel-level 93 * other partition that is currently up. Over these channels, kernel-level
@@ -122,7 +113,6 @@ xp_bte_copy(u64 src, u64 vdst, u64 len, u64 mode, void *notification)
122#error XPC_NCHANNELS exceeds MAXIMUM allowed. 113#error XPC_NCHANNELS exceeds MAXIMUM allowed.
123#endif 114#endif
124 115
125
126/* 116/*
127 * The format of an XPC message is as follows: 117 * The format of an XPC message is as follows:
128 * 118 *
@@ -160,12 +150,10 @@ struct xpc_msg {
160 u64 payload; /* user defined portion of message */ 150 u64 payload; /* user defined portion of message */
161}; 151};
162 152
163
164#define XPC_MSG_PAYLOAD_OFFSET (u64) (&((struct xpc_msg *)0)->payload) 153#define XPC_MSG_PAYLOAD_OFFSET (u64) (&((struct xpc_msg *)0)->payload)
165#define XPC_MSG_SIZE(_payload_size) \ 154#define XPC_MSG_SIZE(_payload_size) \
166 L1_CACHE_ALIGN(XPC_MSG_PAYLOAD_OFFSET + (_payload_size)) 155 L1_CACHE_ALIGN(XPC_MSG_PAYLOAD_OFFSET + (_payload_size))
167 156
168
169/* 157/*
170 * Define the return values and values passed to user's callout functions. 158 * Define the return values and values passed to user's callout functions.
171 * (It is important to add new value codes at the end just preceding 159 * (It is important to add new value codes at the end just preceding
@@ -270,7 +258,6 @@ enum xpc_retval {
270 xpcUnknownReason /* 116: unknown reason -- must be last in list */ 258 xpcUnknownReason /* 116: unknown reason -- must be last in list */
271}; 259};
272 260
273
274/* 261/*
275 * Define the callout function types used by XPC to update the user on 262 * Define the callout function types used by XPC to update the user on
276 * connection activity and state changes (via the user function registered by 263 * connection activity and state changes (via the user function registered by
@@ -375,12 +362,11 @@ enum xpc_retval {
375 * =====================+================================+===================== 362 * =====================+================================+=====================
376 */ 363 */
377 364
378typedef void (*xpc_channel_func)(enum xpc_retval reason, partid_t partid, 365typedef void (*xpc_channel_func) (enum xpc_retval reason, partid_t partid,
379 int ch_number, void *data, void *key); 366 int ch_number, void *data, void *key);
380
381typedef void (*xpc_notify_func)(enum xpc_retval reason, partid_t partid,
382 int ch_number, void *key);
383 367
368typedef void (*xpc_notify_func) (enum xpc_retval reason, partid_t partid,
369 int ch_number, void *key);
384 370
385/* 371/*
386 * The following is a registration entry. There is a global array of these, 372 * The following is a registration entry. There is a global array of these,
@@ -398,50 +384,45 @@ typedef void (*xpc_notify_func)(enum xpc_retval reason, partid_t partid,
398 */ 384 */
399struct xpc_registration { 385struct xpc_registration {
400 struct mutex mutex; 386 struct mutex mutex;
401 xpc_channel_func func; /* function to call */ 387 xpc_channel_func func; /* function to call */
402 void *key; /* pointer to user's key */ 388 void *key; /* pointer to user's key */
403 u16 nentries; /* #of msg entries in local msg queue */ 389 u16 nentries; /* #of msg entries in local msg queue */
404 u16 msg_size; /* message queue's message size */ 390 u16 msg_size; /* message queue's message size */
405 u32 assigned_limit; /* limit on #of assigned kthreads */ 391 u32 assigned_limit; /* limit on #of assigned kthreads */
406 u32 idle_limit; /* limit on #of idle kthreads */ 392 u32 idle_limit; /* limit on #of idle kthreads */
407} ____cacheline_aligned; 393} ____cacheline_aligned;
408 394
409
410#define XPC_CHANNEL_REGISTERED(_c) (xpc_registrations[_c].func != NULL) 395#define XPC_CHANNEL_REGISTERED(_c) (xpc_registrations[_c].func != NULL)
411 396
412
413/* the following are valid xpc_allocate() flags */ 397/* the following are valid xpc_allocate() flags */
414#define XPC_WAIT 0 /* wait flag */ 398#define XPC_WAIT 0 /* wait flag */
415#define XPC_NOWAIT 1 /* no wait flag */ 399#define XPC_NOWAIT 1 /* no wait flag */
416
417 400
418struct xpc_interface { 401struct xpc_interface {
419 void (*connect)(int); 402 void (*connect) (int);
420 void (*disconnect)(int); 403 void (*disconnect) (int);
421 enum xpc_retval (*allocate)(partid_t, int, u32, void **); 404 enum xpc_retval (*allocate) (partid_t, int, u32, void **);
422 enum xpc_retval (*send)(partid_t, int, void *); 405 enum xpc_retval (*send) (partid_t, int, void *);
423 enum xpc_retval (*send_notify)(partid_t, int, void *, 406 enum xpc_retval (*send_notify) (partid_t, int, void *,
424 xpc_notify_func, void *); 407 xpc_notify_func, void *);
425 void (*received)(partid_t, int, void *); 408 void (*received) (partid_t, int, void *);
426 enum xpc_retval (*partid_to_nasids)(partid_t, void *); 409 enum xpc_retval (*partid_to_nasids) (partid_t, void *);
427}; 410};
428 411
429
430extern struct xpc_interface xpc_interface; 412extern struct xpc_interface xpc_interface;
431 413
432extern void xpc_set_interface(void (*)(int), 414extern void xpc_set_interface(void (*)(int),
433 void (*)(int), 415 void (*)(int),
434 enum xpc_retval (*)(partid_t, int, u32, void **), 416 enum xpc_retval (*)(partid_t, int, u32, void **),
435 enum xpc_retval (*)(partid_t, int, void *), 417 enum xpc_retval (*)(partid_t, int, void *),
436 enum xpc_retval (*)(partid_t, int, void *, xpc_notify_func, 418 enum xpc_retval (*)(partid_t, int, void *,
437 void *), 419 xpc_notify_func, void *),
438 void (*)(partid_t, int, void *), 420 void (*)(partid_t, int, void *),
439 enum xpc_retval (*)(partid_t, void *)); 421 enum xpc_retval (*)(partid_t, void *));
440extern void xpc_clear_interface(void); 422extern void xpc_clear_interface(void);
441 423
442
443extern enum xpc_retval xpc_connect(int, xpc_channel_func, void *, u16, 424extern enum xpc_retval xpc_connect(int, xpc_channel_func, void *, u16,
444 u16, u32, u32); 425 u16, u32, u32);
445extern void xpc_disconnect(int); 426extern void xpc_disconnect(int);
446 427
447static inline enum xpc_retval 428static inline enum xpc_retval
@@ -458,7 +439,7 @@ xpc_send(partid_t partid, int ch_number, void *payload)
458 439
459static inline enum xpc_retval 440static inline enum xpc_retval
460xpc_send_notify(partid_t partid, int ch_number, void *payload, 441xpc_send_notify(partid_t partid, int ch_number, void *payload,
461 xpc_notify_func func, void *key) 442 xpc_notify_func func, void *key)
462{ 443{
463 return xpc_interface.send_notify(partid, ch_number, payload, func, key); 444 return xpc_interface.send_notify(partid, ch_number, payload, func, key);
464} 445}
@@ -475,11 +456,8 @@ xpc_partid_to_nasids(partid_t partid, void *nasids)
475 return xpc_interface.partid_to_nasids(partid, nasids); 456 return xpc_interface.partid_to_nasids(partid, nasids);
476} 457}
477 458
478
479extern u64 xp_nofault_PIOR_target; 459extern u64 xp_nofault_PIOR_target;
480extern int xp_nofault_PIOR(void *); 460extern int xp_nofault_PIOR(void *);
481extern int xp_error_PIOR(void); 461extern int xp_error_PIOR(void);
482 462
483
484#endif /* _DRIVERS_MISC_SGIXP_XP_H */ 463#endif /* _DRIVERS_MISC_SGIXP_XP_H */
485