aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/misc/sgi-gru/gruhandles.c22
-rw-r--r--drivers/misc/sgi-gru/gruhandles.h6
2 files changed, 25 insertions, 3 deletions
diff --git a/drivers/misc/sgi-gru/gruhandles.c b/drivers/misc/sgi-gru/gruhandles.c
index 37e7cfc53b9c..806419a6b44c 100644
--- a/drivers/misc/sgi-gru/gruhandles.c
+++ b/drivers/misc/sgi-gru/gruhandles.c
@@ -54,6 +54,21 @@ static void start_instruction(void *h)
54 gru_flush_cache(h); 54 gru_flush_cache(h);
55} 55}
56 56
57static void report_instruction_timeout(void *h)
58{
59 unsigned long goff = GSEGPOFF((unsigned long)h);
60 char *id = "???";
61
62 if (TYPE_IS(CCH, goff))
63 id = "CCH";
64 else if (TYPE_IS(TGH, goff))
65 id = "TGH";
66 else if (TYPE_IS(TFH, goff))
67 id = "TFH";
68
69 panic(KERN_ALERT "GRU %p (%s) is malfunctioning\n", h, id);
70}
71
57static int wait_instruction_complete(void *h, enum mcs_op opc) 72static int wait_instruction_complete(void *h, enum mcs_op opc)
58{ 73{
59 int status; 74 int status;
@@ -64,9 +79,10 @@ static int wait_instruction_complete(void *h, enum mcs_op opc)
64 status = GET_MSEG_HANDLE_STATUS(h); 79 status = GET_MSEG_HANDLE_STATUS(h);
65 if (status != CCHSTATUS_ACTIVE) 80 if (status != CCHSTATUS_ACTIVE)
66 break; 81 break;
67 if (GRU_OPERATION_TIMEOUT < (get_cycles() - start_time)) 82 if (GRU_OPERATION_TIMEOUT < (get_cycles() - start_time)) {
68 panic("GRU %p is malfunctioning: start %ld, end %ld\n", 83 report_instruction_timeout(h);
69 h, start_time, (unsigned long)get_cycles()); 84 start_time = get_cycles();
85 }
70 } 86 }
71 if (gru_options & OPT_STATS) 87 if (gru_options & OPT_STATS)
72 update_mcs_stats(opc, get_cycles() - start_time); 88 update_mcs_stats(opc, get_cycles() - start_time);
diff --git a/drivers/misc/sgi-gru/gruhandles.h b/drivers/misc/sgi-gru/gruhandles.h
index f44112242d00..47b762f89e0d 100644
--- a/drivers/misc/sgi-gru/gruhandles.h
+++ b/drivers/misc/sgi-gru/gruhandles.h
@@ -91,6 +91,12 @@
91/* Convert an arbitrary handle address to the beginning of the GRU segment */ 91/* Convert an arbitrary handle address to the beginning of the GRU segment */
92#define GRUBASE(h) ((void *)((unsigned long)(h) & ~(GRU_SIZE - 1))) 92#define GRUBASE(h) ((void *)((unsigned long)(h) & ~(GRU_SIZE - 1)))
93 93
94/* Test a valid handle address to determine the type */
95#define TYPE_IS(hn, h) ((h) >= GRU_##hn##_BASE && (h) < \
96 GRU_##hn##_BASE + GRU_NUM_##hn * GRU_HANDLE_STRIDE && \
97 (((h) & (GRU_HANDLE_STRIDE - 1)) == 0))
98
99
94/* General addressing macros. */ 100/* General addressing macros. */
95static inline void *get_gseg_base_address(void *base, int ctxnum) 101static inline void *get_gseg_base_address(void *base, int ctxnum)
96{ 102{