From: Pat Gefre <pfg@sgi.com>

Some small bte code clean ups



---

 25-akpm/arch/ia64/sn/io/sn2/bte_error.c |   31 +++----------------------------
 25-akpm/include/asm-ia64/sn/bte.h       |   23 ++++++++++++++++-------
 2 files changed, 19 insertions(+), 35 deletions(-)

diff -puN arch/ia64/sn/io/sn2/bte_error.c~sn29 arch/ia64/sn/io/sn2/bte_error.c
--- 25/arch/ia64/sn/io/sn2/bte_error.c~sn29	Thu Jan  8 15:22:54 2004
+++ 25-akpm/arch/ia64/sn/io/sn2/bte_error.c	Thu Jan  8 15:22:54 2004
@@ -62,36 +62,11 @@ bte_crb_error_handler(vertex_hdl_t hub_v
 	 * in the bte handle structure for the thread excercising the
 	 * interface to consume.
 	 */
-	switch (ioe->ie_errortype) {
-	case IIO_ICRB_ECODE_PERR:
-		bte->bh_error = BTEFAIL_POISON;
-		break;
-	case IIO_ICRB_ECODE_WERR:
-		bte->bh_error = BTEFAIL_PROT;
-		break;
-	case IIO_ICRB_ECODE_AERR:
-		bte->bh_error = BTEFAIL_ACCESS;
-		break;
-	case IIO_ICRB_ECODE_TOUT:
-		bte->bh_error = BTEFAIL_TOUT;
-		break;
-	case IIO_ICRB_ECODE_XTERR:
-		bte->bh_error = BTEFAIL_XTERR;
-		break;
-	case IIO_ICRB_ECODE_DERR:
-		bte->bh_error = BTEFAIL_DIR;
-		break;
-	case IIO_ICRB_ECODE_PWERR:
-	case IIO_ICRB_ECODE_PRERR:
-		/* NO BREAK */
-	default:
-		bte->bh_error = BTEFAIL_ERROR;
-	}
-
+	bte->bh_error = ioe->ie_errortype + BTEFAIL_OFFSET;
 	bte->bte_error_count++;
 
-	BTE_PRINTK(("Got an error on cnode %d bte %d\n",
-		    bte->bte_cnode, bte->bte_num));
+	BTE_PRINTK(("Got an error on cnode %d bte %d: HW error type 0x%x\n",
+		    bte->bte_cnode, bte->bte_num, ioe->ie_errortype));
 	bte_error_handler((unsigned long) hinfo->h_nodepda);
 }
 
diff -puN include/asm-ia64/sn/bte.h~sn29 include/asm-ia64/sn/bte.h
--- 25/include/asm-ia64/sn/bte.h~sn29	Thu Jan  8 15:22:54 2004
+++ 25-akpm/include/asm-ia64/sn/bte.h	Thu Jan  8 15:22:54 2004
@@ -81,16 +81,25 @@
 
 
 /* Possible results from bte_copy and bte_unaligned_copy */
+/* The following error codes map into the BTE hardware codes
+ * IIO_ICRB_ECODE_* (in shubio.h). The hardware uses
+ * an error code of 0 (IIO_ICRB_ECODE_DERR), but we want zero
+ * to mean BTE_SUCCESS, so add one (BTEFAIL_OFFSET) to the error
+ * codes to give the following error codes.
+ */
+#define BTEFAIL_OFFSET	1
+
 typedef enum {
 	BTE_SUCCESS,		/* 0 is success */
+	BTEFAIL_DIR,		/* Directory error due to IIO access*/
+	BTEFAIL_POISON,		/* poison error on IO access (write to poison page) */
+	BTEFAIL_WERR,		/* Write error (ie WINV to a Read only line) */
+	BTEFAIL_ACCESS,		/* access error (protection violation) */
+	BTEFAIL_PWERR,		/* Partial Write Error */
+	BTEFAIL_PRERR,		/* Partial Read Error */
+	BTEFAIL_TOUT,		/* CRB Time out */
+	BTEFAIL_XTERR,		/* Incoming xtalk pkt had error bit */
 	BTEFAIL_NOTAVAIL,	/* BTE not available */
-	BTEFAIL_POISON,		/* poison page */
-	BTEFAIL_PROT,		/* Protection violation */
-	BTEFAIL_ACCESS,		/* access error */
-	BTEFAIL_TOUT,		/* Time out */
-	BTEFAIL_XTERR,		/* Diretory error */
-	BTEFAIL_DIR,		/* Diretory error */
-	BTEFAIL_ERROR,		/* Generic error */
 } bte_result_t;
 
 

_