OSDN Git Service

[IA64] Fix Altix BTE error return status
[tomoyo/tomoyo-test1.git] / include / asm-ia64 / sn / bte.h
index 5335d87..a0d214f 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 2000-2006 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2007 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
 
@@ -150,6 +150,35 @@ typedef enum {
        BTEFAIL_NOTAVAIL,       /* BTE not available */
 } bte_result_t;
 
+#define BTEFAIL_SH2_RESP_SHORT 0x1     /* bit 000001 */
+#define BTEFAIL_SH2_RESP_LONG  0x2     /* bit 000010 */
+#define BTEFAIL_SH2_RESP_DSP   0x4     /* bit 000100 */
+#define BTEFAIL_SH2_RESP_ACCESS        0x8     /* bit 001000 */
+#define BTEFAIL_SH2_CRB_TO     0x10    /* bit 010000 */
+#define BTEFAIL_SH2_NACK_LIMIT 0x20    /* bit 100000 */
+#define BTEFAIL_SH2_ALL                0x3F    /* bit 111111 */
+
+#define        BTE_ERR_BITS    0x3FUL
+#define        BTE_ERR_SHIFT   36
+#define BTE_ERR_MASK   (BTE_ERR_BITS << BTE_ERR_SHIFT)
+
+#define BTE_ERROR_RETRY(value)                                         \
+       (is_shub2() ? (value != BTEFAIL_SH2_CRB_TO)                     \
+               : (value != BTEFAIL_TOUT))
+
+/*
+ * On shub1 BTE_ERR_MASK will always be false, so no need for is_shub2()
+ */
+#define BTE_SHUB2_ERROR(_status)                                       \
+       ((_status & BTE_ERR_MASK)                                       \
+          ? (((_status >> BTE_ERR_SHIFT) & BTE_ERR_BITS) | IBLS_ERROR) \
+          : _status)
+
+#define BTE_GET_ERROR_STATUS(_status)                                  \
+       (BTE_SHUB2_ERROR(_status) & ~IBLS_ERROR)
+
+#define BTE_VALID_SH2_ERROR(value)                                     \
+       ((value >= BTEFAIL_SH2_RESP_SHORT) && (value <= BTEFAIL_SH2_ALL))
 
 /*
  * Structure defining a bte.  An instance of this