-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathnon-standard-hisi_hip07.c
151 lines (134 loc) · 3.79 KB
/
non-standard-hisi_hip07.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
* Copyright (c) 2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ras-record.h"
#include "ras-logger.h"
#include "ras-report.h"
#include "ras-non-standard-handler.h"
/* common definitions */
/* HISI SAS definitions */
#define HISI_SAS_VALID_PA BIT(0)
#define HISI_SAS_VALID_MB_ERR BIT(1)
#define HISI_SAS_VALID_ERR_TYPE BIT(2)
#define HISI_SAS_VALID_AXI_ERR_INFO BIT(3)
struct hisi_sas_err_sec {
uint64_t val_bits;
uint64_t physical_addr;
uint32_t mb;
uint32_t type;
uint32_t axi_err_info;
};
/* Common Functions */
static char *err_bit_type(int etype)
{
switch (etype) {
case 0x0: return "single-bit ecc";
case 0x1: return "multi-bit ecc";
}
return "unknown error";
}
/* SAS Functions */
static char *sas_err_type(int etype)
{
switch (etype) {
case 0x0001: return "hgc_dqe ecc";
case 0x0002: return "hgc_iost ecc";
case 0x0004: return "hgc_itct ecc";
case 0x0008: return "hgc_iostl ecc";
case 0x0010: return "hgc_itctl ecc";
case 0x0020: return "hgc_cqe ecc";
case 0x0040: return "rxm_mem0 ecc";
case 0x0080: return "rxm_mem1 ecc";
case 0x0100: return "rxm_mem2 ecc";
case 0x0200: return "rxm_mem3 ecc";
case 0x0400: return "wp_depth";
case 0x0800: return "iptt_slot_no_match";
case 0x1000: return "rp_depth";
case 0x2000: return "axi err";
case 0x4000: return "fifo err";
case 0x8000: return "lm_add_fetch_list";
case 0x10000: return "hgc_abt_fetch_lm";
}
return "unknown error";
}
static char *sas_axi_err_type(int etype)
{
switch (etype) {
case 0x0001: return "IOST_AXI_W_ERR";
case 0x0002: return "IOST_AXI_R_ERR";
case 0x0004: return "ITCT_AXI_W_ERR";
case 0x0008: return "ITCT_AXI_R_ERR";
case 0x0010: return "SATA_AXI_W_ERR";
case 0x0020: return "SATA_AXI_R_ERR";
case 0x0040: return "DQE_AXI_R_ERR";
case 0x0080: return "CQE_AXI_W_ERR";
case 0x0100: return "CQE_WINFO_FIFO";
case 0x0200: return "CQE_MSG_FIFIO";
case 0x0400: return "GETDQE_FIFO";
case 0x0800: return "CMDP_FIFO";
case 0x1000: return "AWTCTRL_FIFO";
}
return "unknown error";
}
static int decode_hip07_sas_error(struct ras_events *ras,
struct ras_ns_dec_tab *dec_tab,
struct trace_seq *s,
struct ras_non_standard_event *event)
{
char buf[1024];
char *p = buf;
const struct hisi_sas_err_sec *err =
(struct hisi_sas_err_sec *)event->error;
if (err->val_bits == 0) {
trace_seq_printf(s, "%s: no valid error data\n",
__func__);
return -1;
}
p += sprintf(p, "[");
if (err->val_bits & HISI_SAS_VALID_PA)
p += sprintf(p, "phy addr = 0x%p: ",
(void *)err->physical_addr);
if (err->val_bits & HISI_SAS_VALID_MB_ERR)
p += sprintf(p, "%s: ", err_bit_type(err->mb));
if (err->val_bits & HISI_SAS_VALID_ERR_TYPE)
p += sprintf(p, "error type = %s: ",
sas_err_type(err->type));
if (err->val_bits & HISI_SAS_VALID_AXI_ERR_INFO)
p += sprintf(p, "axi error type = %s",
sas_axi_err_type(err->axi_err_info));
p += sprintf(p, "]");
trace_seq_printf(s, "\nHISI HIP07: SAS error: %s\n", buf);
return 0;
}
static int decode_hip07_hns_error(struct ras_events *ras,
struct ras_ns_dec_tab *dec_tab,
struct trace_seq *s,
struct ras_non_standard_event *event)
{
return 0;
}
struct ras_ns_dec_tab hisi_ns_dec_tab[] = {
{
.sec_type = "daffd8146eba4d8c8a91bc9bbf4aa301",
.decode = decode_hip07_sas_error,
},
{
.sec_type = "fbc2d923ea7a453dab132949f5af9e53",
.decode = decode_hip07_hns_error,
},
{ /* sentinel */ }
};
__attribute__((constructor))
static void hip07_init(void)
{
register_ns_dec_tab(hisi_ns_dec_tab);
}