Debian Codegraph @

libfreeipmi/sel/ipmi-sel-string-gigabyte-md90fs0zb.c

raw symbols SCIP
1 /*
2 * Copyright (C) 2003-2015 FreeIPMI Core Team
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif /* HAVE_CONFIG_H */
22
23 #include <stdio.h>
24 #include <stdlib.h>
25 #if STDC_HEADERS
26 #include <string.h>
27 #include <stdarg.h>
28 #endif /* STDC_HEADERS */
29 #include <assert.h>
30 #include <errno.h>
31
32 #include "freeipmi/sel/ipmi-sel.h"
33
34 #include "freeipmi/record-format/ipmi-sel-record-format.h"
35 #include "freeipmi/spec/ipmi-event-reading-type-code-spec.h"
36 #include "freeipmi/spec/ipmi-iana-enterprise-numbers-spec.h"
37 #include "freeipmi/spec/ipmi-product-id-spec.h"
38 #include "freeipmi/spec/ipmi-sensor-and-event-code-tables-spec.h"
39 #include "freeipmi/spec/ipmi-sensor-types-spec.h"
40 #include "freeipmi/spec/oem/ipmi-sensor-and-event-code-tables-oem-gigabyte-spec.h"
41
42 #include "ipmi-sel-common.h"
43 #include "ipmi-sel-defs.h"
44 #include "ipmi-sel-string.h"
45 #include "ipmi-sel-string-gigabyte-common.h"
46 #include "ipmi-sel-trace.h"
47 #include "ipmi-sel-util.h"
48
49 #include "freeipmi-portability.h"
50
51 /* return (0) - no OEM match
52 * return (1) - OEM match
53 * return (-1) - error, cleanup and return error
54 */
55 int
56 sel_string_output_gigabyte_md90fs0zb_event_data2_discrete_oem (ipmi_sel_ctx_t ctx,
57 struct ipmi_sel_entry *sel_entry,
58 uint8_t sel_record_type,
59 char *tmpbuf,
60 unsigned int tmpbuflen,
61 unsigned int flags,
62 unsigned int *wlen,
63 struct ipmi_sel_system_event_record_data *system_event_record_data)
64 {
65 int ret;
66
67 assert (ctx);
68 assert (ctx->magic == IPMI_SEL_CTX_MAGIC);
69 assert (ctx->manufacturer_id == IPMI_IANA_ENTERPRISE_ID_GIGABYTE);
70 assert (sel_entry);
71 assert (tmpbuf);
72 assert (tmpbuflen);
73 assert (!(flags & ~IPMI_SEL_STRING_FLAGS_MASK));
74 assert (flags & IPMI_SEL_STRING_FLAGS_INTERPRET_OEM_DATA);
75 assert (wlen);
76 assert (system_event_record_data);
77 assert (system_event_record_data->event_data2_flag == IPMI_SEL_EVENT_DATA_OEM_CODE);
78 assert (ctx->product_id == IPMI_GIGABYTE_PRODUCT_ID_MD90_FS0_ZB);
79
80 /*
81 * Gigabyte MD90-FS0-ZB
82 */
83 if ((ret = sel_string_output_gigabyte_common_event_data2_discrete_oem (ctx,
84 sel_entry,
85 sel_record_type,
86 tmpbuf,
87 tmpbuflen,
88 flags,
89 wlen,
90 system_event_record_data)) < 0)
91 return (-1);
92
93 if (ret)
94 return (ret);
95
96 return (0);
97 }
98
99 /* return (0) - no OEM match
100 * return (1) - OEM match
101 * return (-1) - error, cleanup and return error
102 */
103 int
104 sel_string_output_gigabyte_md90fs0zb_event_data3_discrete_oem (ipmi_sel_ctx_t ctx,
105 struct ipmi_sel_entry *sel_entry,
106 uint8_t sel_record_type,
107 char *tmpbuf,
108 unsigned int tmpbuflen,
109 unsigned int flags,
110 unsigned int *wlen,
111 struct ipmi_sel_system_event_record_data *system_event_record_data)
112 {
113 int ret;
114
115 assert (ctx);
116 assert (ctx->magic == IPMI_SEL_CTX_MAGIC);
117 assert (ctx->manufacturer_id == IPMI_IANA_ENTERPRISE_ID_GIGABYTE);
118 assert (sel_entry);
119 assert (tmpbuf);
120 assert (tmpbuflen);
121 assert (!(flags & ~IPMI_SEL_STRING_FLAGS_MASK));
122 assert (flags & IPMI_SEL_STRING_FLAGS_INTERPRET_OEM_DATA);
123 assert (wlen);
124 assert (system_event_record_data);
125 assert (system_event_record_data->event_data3_flag == IPMI_SEL_EVENT_DATA_OEM_CODE);
126 assert (ctx->product_id == IPMI_GIGABYTE_PRODUCT_ID_MD90_FS0_ZB);
127
128 /*
129 * Gigabyte MD90-FS0-ZB
130 */
131
132 if ((ret = sel_string_output_gigabyte_common_event_data3_discrete_oem (ctx,
133 sel_entry,
134 sel_record_type,
135 tmpbuf,
136 tmpbuflen,
137 flags,
138 wlen,
139 system_event_record_data)) < 0)
140 return (-1);
141
142 if (ret)
143 return (ret);
144
145 return (0);
146 }
147
148 struct sel_string_oem sel_string_oem_gigabyte_md90fs0zb =
149 {
150 NULL,
151 NULL,
152 NULL,
153 NULL,
154 sel_string_output_gigabyte_md90fs0zb_event_data2_discrete_oem,
155 NULL,
156 NULL,
157 sel_string_output_gigabyte_md90fs0zb_event_data3_discrete_oem,
158 NULL,
159 NULL,
160 NULL,
161 NULL,
162 };