]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/misc/sgi-xp/xp.h
Merge branch 'x86/apic' into x86/core
[linux-2.6-omap-h63xx.git] / drivers / misc / sgi-xp / xp.h
index 0ca81f16646f24c5faa22774ca5a7a9ddfa6a762..859a5281c61b95aca896675cfa497403885aee84 100644 (file)
 #ifndef _DRIVERS_MISC_SGIXP_XP_H
 #define _DRIVERS_MISC_SGIXP_XP_H
 
-#include <linux/cache.h>
-#include <linux/hardirq.h>
 #include <linux/mutex.h>
-#include <asm/sn/types.h>
+
 #ifdef CONFIG_IA64
-#include <asm/sn/arch.h>
+#include <asm/system.h>
+#include <asm/sn/arch.h>       /* defines is_shub1() and is_shub2() */
+#define is_shub()      ia64_platform_is("sn2")
+#define is_uv()                ia64_platform_is("uv")
 #endif
-
-/* ??? Add this #define to some linux header file some day? */
-#define BYTES_PER_WORD sizeof(void *)
-
-#ifdef USE_DBUG_ON
-#define DBUG_ON(condition)     BUG_ON(condition)
-#else
-#define DBUG_ON(condition)
+#ifdef CONFIG_X86_64
+#include <asm/genapic.h>
+#define is_uv()                is_uv_system()
 #endif
 
 #ifndef is_shub1
 #endif
 
 #ifndef is_shub
-#define is_shub()      (is_shub1() || is_shub2())
+#define is_shub()      0
 #endif
 
 #ifndef is_uv
 #define is_uv()                0
 #endif
 
+#ifdef USE_DBUG_ON
+#define DBUG_ON(condition)     BUG_ON(condition)
+#else
+#define DBUG_ON(condition)
+#endif
+
 /*
  * Define the maximum number of partitions the system can possibly support.
  * It is based on the maximum number of hardware partitionable regions. The
 #endif
 
 /*
- * The format of an XPC message is as follows:
- *
- *      +-------+--------------------------------+
- *      | flags |////////////////////////////////|
- *      +-------+--------------------------------+
- *      |             message #                  |
- *      +----------------------------------------+
- *      |     payload (user-defined message)     |
- *      |                                        |
- *                     :
- *      |                                        |
- *      +----------------------------------------+
- *
- * The size of the payload is defined by the user via xpc_connect(). A user-
- * defined message resides in the payload area.
- *
- * The size of a message entry (within a message queue) must be a cacheline
- * sized multiple in order to facilitate the BTE transfer of messages from one
- * message queue to another. A macro, XPC_MSG_SIZE(), is provided for the user
+ * Define macro, XPC_MSG_SIZE(), is provided for the user
  * that wants to fit as many msg entries as possible in a given memory size
  * (e.g. a memory page).
  */
-struct xpc_msg {
-       u8 flags;               /* FOR XPC INTERNAL USE ONLY */
-       u8 reserved[7];         /* FOR XPC INTERNAL USE ONLY */
-       s64 number;             /* FOR XPC INTERNAL USE ONLY */
-
-       u64 payload;            /* user defined portion of message */
-};
+#define XPC_MSG_MAX_SIZE       128
+#define XPC_MSG_HDR_MAX_SIZE   16
+#define XPC_MSG_PAYLOAD_MAX_SIZE (XPC_MSG_MAX_SIZE - XPC_MSG_HDR_MAX_SIZE)
 
-#define XPC_MSG_PAYLOAD_OFFSET (u64) (&((struct xpc_msg *)0)->payload)
 #define XPC_MSG_SIZE(_payload_size) \
-               L1_CACHE_ALIGN(XPC_MSG_PAYLOAD_OFFSET + (_payload_size))
+                               ALIGN(XPC_MSG_HDR_MAX_SIZE + (_payload_size), \
+                                     is_uv() ? 64 : 128)
+
 
 /*
  * Define the return values and values passed to user's callout functions.
@@ -203,7 +184,15 @@ enum xp_retval {
        xpPayloadTooBig,        /* 55: payload too large for message slot */
 
        xpUnsupported,          /* 56: unsupported functionality or resource */
-       xpUnknownReason         /* 57: unknown reason - must be last in enum */
+       xpNeedMoreInfo,         /* 57: more info is needed by SAL */
+
+       xpGruCopyError,         /* 58: gru_copy_gru() returned error */
+       xpGruSendMqError,       /* 59: gru send message queue related error */
+
+       xpBadChannelNumber,     /* 60: invalid channel number */
+       xpBadMsgType,           /* 60: invalid message type */
+
+       xpUnknownReason         /* 61: unknown reason - must be last in enum */
 };
 
 /*
@@ -254,6 +243,9 @@ typedef void (*xpc_channel_func) (enum xp_retval reason, short partid,
  * calling xpc_received().
  *
  * All other reason codes indicate failure.
+ *
+ * NOTE: The user defined function must be callable by an interrupt handler
+ *       and thus cannot block.
  */
 typedef void (*xpc_notify_func) (enum xp_retval reason, short partid,
                                 int ch_number, void *key);
@@ -277,7 +269,7 @@ struct xpc_registration {
        xpc_channel_func func;  /* function to call */
        void *key;              /* pointer to user's key */
        u16 nentries;           /* #of msg entries in local msg queue */
-       u16 msg_size;           /* message queue's message size */
+       u16 entry_size;         /* message queue's message entry size */
        u32 assigned_limit;     /* limit on #of assigned kthreads */
        u32 idle_limit;         /* limit on #of idle kthreads */
 } ____cacheline_aligned;
@@ -342,8 +334,13 @@ xpc_partid_to_nasids(short partid, void *nasids)
 }
 
 extern short xp_max_npartitions;
+extern short xp_partition_id;
+extern u8 xp_region_size;
 
-extern enum xp_retval (*xp_remote_memcpy) (void *, const void *, size_t);
+extern unsigned long (*xp_pa) (void *);
+extern enum xp_retval (*xp_remote_memcpy) (unsigned long, const unsigned long,
+                      size_t);
+extern int (*xp_cpu_to_nasid) (int);
 
 extern u64 xp_nofault_PIOR_target;
 extern int xp_nofault_PIOR(void *);