Merge branch 'for-2.6.31' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[pandora-kernel.git] / drivers / misc / sgi-gru / grulib.h
index e56e196..889bc44 100644 (file)
@@ -32,8 +32,8 @@
 /* Set Number of Request Blocks */
 #define GRU_CREATE_CONTEXT             _IOWR(GRU_IOCTL_NUM, 1, void *)
 
-/* Register task as using the slice */
-#define GRU_SET_TASK_SLICE             _IOWR(GRU_IOCTL_NUM, 5, void *)
+/*  Set Context Options */
+#define GRU_SET_CONTEXT_OPTION         _IOWR(GRU_IOCTL_NUM, 4, void *)
 
 /* Fetch exception detail */
 #define GRU_USER_GET_EXCEPTION_DETAIL  _IOWR(GRU_IOCTL_NUM, 6, void *)
 /* For user unload context */
 #define GRU_USER_UNLOAD_CONTEXT                _IOWR(GRU_IOCTL_NUM, 9, void *)
 
-/* For fetching GRU chiplet status */
-#define GRU_GET_CHIPLET_STATUS         _IOWR(GRU_IOCTL_NUM, 10, void *)
+/* For dumpping GRU chiplet state */
+#define GRU_DUMP_CHIPLET_STATE         _IOWR(GRU_IOCTL_NUM, 11, void *)
+
+/* For getting gseg statistics */
+#define GRU_GET_GSEG_STATISTICS                _IOWR(GRU_IOCTL_NUM, 12, void *)
 
 /* For user TLB flushing (primarily for tests) */
 #define GRU_USER_FLUSH_TLB             _IOWR(GRU_IOCTL_NUM, 50, void *)
 /* Get some config options (primarily for tests & emulator) */
 #define GRU_GET_CONFIG_INFO            _IOWR(GRU_IOCTL_NUM, 51, void *)
 
+/* Various kernel self-tests */
+#define GRU_KTEST                      _IOWR(GRU_IOCTL_NUM, 52, void *)
+
 #define CONTEXT_WINDOW_BYTES(th)        (GRU_GSEG_PAGESIZE * (th))
 #define THREAD_POINTER(p, th)          (p + GRU_GSEG_PAGESIZE * (th))
+#define GSEG_START(cb)                 ((void *)((unsigned long)(cb) & ~(GRU_GSEG_PAGESIZE - 1)))
+
+/*
+ * Statictics kept on a per-GTS basis.
+ */
+struct gts_statistics {
+       unsigned long   fmm_tlbdropin;
+       unsigned long   upm_tlbdropin;
+       unsigned long   context_stolen;
+};
+
+struct gru_get_gseg_statistics_req {
+       unsigned long           gseg;
+       struct gts_statistics   stats;
+};
 
 /*
  * Structure used to pass TLB flush parameters to the driver
@@ -74,6 +95,16 @@ struct gru_unload_context_req {
        unsigned long   gseg;
 };
 
+/*
+ * Structure used to set context options
+ */
+enum {sco_gseg_owner, sco_cch_req_slice};
+struct gru_set_context_option_req {
+       unsigned long   gseg;
+       int             op;
+       unsigned long   val1;
+};
+
 /*
  * Structure used to pass TLB flush parameters to the driver
  */
@@ -83,6 +114,36 @@ struct gru_flush_tlb_req {
        size_t          len;
 };
 
+/*
+ * Structure used to pass TLB flush parameters to the driver
+ */
+enum {dcs_pid, dcs_gid};
+struct gru_dump_chiplet_state_req {
+       unsigned int    op;
+       unsigned int    gid;
+       int             ctxnum;
+       char            data_opt;
+       char            lock_cch;
+       pid_t           pid;
+       void            *buf;
+       size_t          buflen;
+       /* ---- output --- */
+       unsigned int    num_contexts;
+};
+
+#define GRU_DUMP_MAGIC 0x3474ab6c
+struct gru_dump_context_header {
+       unsigned int    magic;
+       unsigned int    gid;
+       unsigned char   ctxnum;
+       unsigned char   cbrcnt;
+       unsigned char   dsrcnt;
+       pid_t           pid;
+       unsigned long   vaddr;
+       int             cch_locked;
+       unsigned long   data[0];
+};
+
 /*
  * GRU configuration info (temp - for testing)
  */