xref: /openbmc/ipmbbridge/ipmbdefines.hpp (revision 0736e213)
1 /* Copyright 2018 Intel
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *    http://www.apache.org/licenses/LICENSE-2.0
8  *
9  *  Unless required by applicable law or agreed to in writing, software
10  *  distributed under the License is distributed on an "AS IS" BASIS,
11  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  *  See the License for the specific language governing permissions and
13  *  limitations under the License.
14  */
15 
16 #ifndef IPMBDEFINES_HPP
17 #define IPMBDEFINES_HPP
18 
19 #include <inttypes.h>
20 
21 // -Wpedantic doesn't like flexible array members in C++.
22 // Disable it for this file.
23 #pragma GCC diagnostic push
24 #pragma GCC diagnostic ignored "-Wpedantic"
25 
26 #pragma pack(1)
27 typedef struct _IPMB_HEADER
28 {
29     union
30     {
31         struct
32         {
33             /** @brief IPMB Connection Header Format */
34             uint8_t address;
35             uint8_t rsNetFnLUN; /// @brief responder's net function and logical
36                                 /// unit number
37             uint8_t checksum1;  /// @brief checksum computed on first two bytes
38                                 /// of IPMB_HEADER
39             /** @brief IPMB Header */
40             uint8_t rqSA;     /// @brief requester's target address, LS bit=0
41             uint8_t rqSeqLUN; /// @brief requester's sequence number and logical
42                               /// unit number
43             uint8_t cmd; /// @brief command required by the network identify the
44                          /// type of rqts
45             uint8_t data[]; /// @brief payload
46         } Req;              /// @brief IPMB request header
47         struct
48         {
49             uint8_t address;
50             /** @brief IPMB Connection Header Format */
51             uint8_t rqNetFnLUN; /// @brief requester's net function and logical
52                                 /// unit number
53             uint8_t checksum1;  /// @brief checksum computed on first two bytes
54                                 /// of IPMB_HEADER
55             /** @brief IPMB Header */
56             uint8_t rsSA;     /// @brief responder's target address, LS bit=0
57             uint8_t rsSeqLUN; /// @brief responder's sequence number and logical
58                               /// unit number
59             uint8_t cmd; /// @brief command required by the network identify the
60                          /// type of rqts
61             uint8_t completionCode; /// @brief IPMB nodes return a Completion
62                                     /// Code in all response msgs
63             uint8_t data[];         /// @brief payload
64         } Resp;                     /// @brief IPMB response header
65     } Header;                       /// @brief IPMB frame header
66 } IPMB_HEADER;
67 #pragma pack()
68 
69 typedef struct _IPMB_DRV_HDR
70 {
71     uint8_t len;
72     IPMB_HEADER hdr;
73 } IPMB_PKT;
74 
75 #pragma GCC diagnostic pop
76 #endif
77