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 #ifndef IPMI_SOL_CMDS_H
20 #define IPMI_SOL_CMDS_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include <stdint.h>
27 #include <freeipmi/fiid/fiid.h>
28 
29 #define IPMI_SOL_CONFIGURATION_PARAMETERS_NO_SET_SELECTOR                            0x0
30 #define IPMI_SOL_CONFIGURATION_PARAMETERS_NO_BLOCK_SELECTOR                          0x0
31 
32 #define IPMI_SOL_CONFIGURATION_PARAMETERS_SET_COMPLETE                              0x00
33 #define IPMI_SOL_CONFIGURATION_PARAMETERS_SET_IN_PROGRESS                           0x01
34 #define IPMI_SOL_CONFIGURATION_PARAMETERS_SET_COMMIT_WRITE                          0x02
35 
36 #define IPMI_SOL_CONFIGURATION_PARAMETERS_SET_IN_PROGRESS_VALID(__value) \
37   (((__value) == IPMI_SOL_CONFIGURATION_PARAMETERS_SET_COMPLETE          \
38     || (__value) == IPMI_SOL_CONFIGURATION_PARAMETERS_SET_IN_PROGRESS    \
39     || (__value) == IPMI_SOL_CONFIGURATION_PARAMETERS_SET_COMMIT_WRITE) ? 1 : 0)
40 
41 #define IPMI_SOL_SOL_DISABLE    0x0
42 #define IPMI_SOL_SOL_ENABLE     0x1
43 
44 #define IPMI_SOL_SOL_ENABLE_VALID(__val) \
45   (((__val) == IPMI_SOL_SOL_DISABLE      \
46     || (__val) == IPMI_SOL_SOL_ENABLE) ? 1 : 0)
47 
48 #define IPMI_SOL_FORCE_SOL_PAYLOAD_AUTHENTICATION             0x1
49 #define IPMI_SOL_AUTHENTICATION_CONTROLLED_BY_REMOTE_SOFTWARE 0x0
50 
51 #define IPMI_SOL_FORCE_SOL_PAYLOAD_AUTHENTICATION_VALID(__val) \
52   (((__val) == IPMI_SOL_FORCE_SOL_PAYLOAD_AUTHENTICATION       \
53     || (__val) == IPMI_SOL_AUTHENTICATION_CONTROLLED_BY_REMOTE_SOFTWARE) ? 1 : 0)
54 
55 #define IPMI_SOL_FORCE_SOL_PAYLOAD_ENCRYPTION                 0x1
56 #define IPMI_SOL_ENCRYPTION_CONTROLLED_BY_REMOTE_SOFTWARE     0x0
57 
58 #define IPMI_SOL_FORCE_SOL_PAYLOAD_ENCRYPTION_VALID(__val) \
59   (((__val) == IPMI_SOL_FORCE_SOL_PAYLOAD_ENCRYPTION       \
60     || (__val) == IPMI_SOL_ENCRYPTION_CONTROLLED_BY_REMOTE_SOFTWARE) ? 1 : 0)
61 
62 #define IPMI_SOL_BIT_RATE_SERIAL_BIT_RATE 0x0
63 #define IPMI_SOL_BIT_RATE_96_KBPS         0x6
64 #define IPMI_SOL_BIT_RATE_192_KBPS        0x7
65 #define IPMI_SOL_BIT_RATE_384_KBPS        0x8
66 #define IPMI_SOL_BIT_RATE_576_KBPS        0x9
67 #define IPMI_SOL_BIT_RATE_1152_KBPS       0xA
68 
69 #define IPMI_SOL_BIT_RATE_VALID(__val)           \
70   (((__val) == IPMI_SOL_BIT_RATE_SERIAL_BIT_RATE \
71     || (__val) == IPMI_SOL_BIT_RATE_96_KBPS      \
72     || (__val) == IPMI_SOL_BIT_RATE_192_KBPS     \
73     || (__val) == IPMI_SOL_BIT_RATE_384_KBPS     \
74     || (__val) == IPMI_SOL_BIT_RATE_576_KBPS     \
75     || (__val) == IPMI_SOL_BIT_RATE_1152_KBPS) ? 1 : 0)
76 
77 #define IPMI_GET_SOL_PARAMETER                          0x0
78 #define IPMI_GET_SOL_PARAMETER_REVISION_ONLY            0x1
79 
80 #define IPMI_GET_SOL_PARAMETER_VALID(__val) \
81   (((__val) == IPMI_GET_SOL_PARAMETER       \
82     || (__val) == IPMI_GET_SOL_PARAMETER_REVISION_ONLY) ? 1 : 0)
83 
84 /*
85  * fill* functions return 0 on success, -1 on error.
86  *
87  * obj_cmd_rq must be for the fill function's respective fiid
88  * template request.
89  *
90  * see freeipmi/templates/ for template definitions
91  */
92 
93 extern fiid_template_t tmpl_cmd_set_sol_configuration_parameters_rq;
94 extern fiid_template_t tmpl_cmd_set_sol_configuration_parameters_rs;
95 extern fiid_template_t tmpl_cmd_set_sol_configuration_parameters_set_in_progress_rq;
96 extern fiid_template_t tmpl_cmd_set_sol_configuration_parameters_sol_enable_rq;
97 extern fiid_template_t tmpl_cmd_set_sol_configuration_parameters_sol_authentication_rq;
98 extern fiid_template_t tmpl_cmd_set_sol_configuration_parameters_character_accumulate_interval_and_send_threshold_rq;
99 extern fiid_template_t tmpl_cmd_set_sol_configuration_parameters_sol_retry_rq;
100 extern fiid_template_t tmpl_cmd_set_sol_configuration_parameters_sol_non_volatile_bit_rate_rq;
101 extern fiid_template_t tmpl_cmd_set_sol_configuration_parameters_sol_volatile_bit_rate_rq;
102 extern fiid_template_t tmpl_cmd_set_sol_configuration_parameters_sol_payload_port_number_rq;
103 
104 extern fiid_template_t tmpl_cmd_get_sol_configuration_parameters_rq;
105 extern fiid_template_t tmpl_cmd_get_sol_configuration_parameters_rs;
106 extern fiid_template_t tmpl_cmd_get_sol_configuration_parameters_set_in_progress_rs;
107 extern fiid_template_t tmpl_cmd_get_sol_configuration_parameters_sol_enable_rs;
108 extern fiid_template_t tmpl_cmd_get_sol_configuration_parameters_sol_authentication_rs;
109 extern fiid_template_t tmpl_cmd_get_sol_configuration_parameters_character_accumulate_interval_and_send_threshold_rs;
110 extern fiid_template_t tmpl_cmd_get_sol_configuration_parameters_sol_retry_rs;
111 extern fiid_template_t tmpl_cmd_get_sol_configuration_parameters_sol_non_volatile_bit_rate_rs;
112 extern fiid_template_t tmpl_cmd_get_sol_configuration_parameters_sol_volatile_bit_rate_rs;
113 extern fiid_template_t tmpl_cmd_get_sol_configuration_parameters_sol_payload_channel_rs;
114 extern fiid_template_t tmpl_cmd_get_sol_configuration_parameters_sol_payload_port_number_rs;
115 
116 int fill_cmd_set_sol_configuration_parameters (uint8_t channel_number,
117                                                uint8_t parameter_selector,
118                                                const void *configuration_parameter_data,
119                                                unsigned int configuration_parameter_data_len,
120                                                fiid_obj_t obj_data_rq);
121 
122 int fill_cmd_set_sol_configuration_parameters_set_in_progress (uint8_t channel_number,
123                                                                uint8_t state,
124                                                                fiid_obj_t obj_data_rq);
125 
126 int fill_cmd_set_sol_configuration_parameters_sol_enable (uint8_t channel_number,
127                                                           uint8_t sol_enable,
128                                                           fiid_obj_t obj_data_rq);
129 
130 int fill_cmd_set_sol_configuration_parameters_sol_authentication (uint8_t channel_number,
131                                                                   uint8_t sol_privilege_level,
132                                                                   uint8_t force_sol_payload_authentication,
133                                                                   uint8_t force_sol_payload_encryption,
134                                                                   fiid_obj_t obj_cmd_rq);
135 
136 int fill_cmd_set_sol_configuration_parameters_character_accumulate_interval_and_send_threshold (uint8_t channel_number,
137                                                                                                 uint8_t character_accumulate_interval,
138                                                                                                 uint8_t character_send_threshold,
139                                                                                                 fiid_obj_t obj_cmd_rq);
140 
141 int fill_cmd_set_sol_configuration_parameters_sol_retry (uint8_t channel_number,
142                                                          uint8_t retry_count,
143                                                          uint8_t retry_interval,
144                                                          fiid_obj_t obj_cmd_rq);
145 
146 int fill_cmd_set_sol_configuration_parameters_sol_non_volatile_bit_rate (uint8_t channel_number,
147                                                                          uint8_t bit_rate,
148                                                                          fiid_obj_t obj_cmd_rq);
149 
150 int fill_cmd_set_sol_configuration_parameters_sol_volatile_bit_rate (uint8_t channel_number,
151                                                                      uint8_t bit_rate,
152                                                                      fiid_obj_t obj_cmd_rq);
153 
154 int fill_cmd_set_sol_configuration_parameters_sol_payload_port_number (uint8_t channel_number,
155                                                                        uint16_t port_number,
156                                                                        fiid_obj_t obj_cmd_rq);
157 
158 int fill_cmd_get_sol_configuration_parameters (uint8_t channel_number,
159                                                uint8_t get_parameter,
160                                                uint8_t parameter_selector,
161                                                uint8_t set_selector,
162                                                uint8_t block_selector,
163                                                fiid_obj_t obj_data_rq);
164 
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif /* IPMI_SOL_CMDS_H */
170