| /* |
| * Copyright 2023 Google LLC |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| #ifndef PLDM_OEM_GOOGLE_H |
| #define PLDM_OEM_GOOGLE_H |
| |
| #ifdef __cplusplus |
| extern "C" |
| { |
| #endif |
| |
| #include <stddef.h> |
| #include <stdint.h> |
| |
| #include <cstdint> |
| |
| /* PLDM OEM event */ |
| #define PLDM_EVENT_CLASS_OEM_GOOGLE (0xF6) |
| |
| /** @struct pldm_event_oem_google_event |
| * |
| * structure representing google OEM platform event message header |
| */ |
| struct pldm_event_oem_google_event_hdr |
| { |
| uint8_t IANA[3]; /* google IANA=54494 [00 D4 DE]*/ |
| uint16_t googleOEMEventID; /* Register in pldm_event_oem_google_id */ |
| } __attribute__((packed)); |
| |
| /* |
| * To keep backwards compatibility, whenever the eventID gets registered in the |
| * following enum, it will get kept forever. This means the following enum value |
| * definition will only be appended, no change, no deletion. |
| */ |
| enum pldm_event_oem_google_id : std::uint16_t |
| { |
| PLDM_EVENT_OEM_GOOGLE_ID_UNDEFINED = 0, |
| PLDM_EVENT_OEM_GOOGLE_SOC_RESET_ME = 1, |
| PLDM_EVENT_OEM_GOOGLE_CRASH_DUMP = 2, |
| |
| _RESERVED_PLDM_EVENT_OEM_ID = 0xFFFF, |
| }; |
| |
| /* |
| * Supported SOC reset type |
| * SOC_RESET_ME_AUTO: BMC make the choice of best reset avaiable reset type. |
| */ |
| enum pldm_event_oem_google_soc_reset_me_type : std::uint16_t |
| { |
| SOC_RESET_ME_AUTO = 0, |
| SOC_RESET_ME_COLD = 1, |
| SOC_RESET_ME_WARM = 2, |
| |
| _RESERVED_SOC_RESET_ME_TYPE = 0xFFFF, |
| }; |
| |
| /* |
| * SOC_RESET_ME google oem event message |
| */ |
| struct pldm_event_oem_google_soc_reset_me |
| { |
| uint64_t internalInfo; /* internal information associate to reset request */ |
| uint32_t resetQuiesent; /* reset quiesent period in seconds */ |
| uint16_t resetType; /* pldm_event_oem_google_soc_reset_me_type */ |
| uint16_t descLen; /* reset reason description length */ |
| /* char description[descLen]; reset reason decription legnth is descLen |
| */ |
| } __attribute__((packed)); |
| |
| inline bool isGoogleIANA(const uint8_t* iana) |
| { |
| return ((0x00 == iana[0]) && (0xD4 == iana[1]) && (0xDE == iana[2])); |
| } |
| |
| /** @brief Decode Google Platform OEM Event Message (event_class == 0xF6) data |
| * @param[in] event_data - PLDM event message data |
| * @param[in] event_data_length - Length of event message data |
| * @param[out] oem_event_data_offset - OEM event data offset from event data |
| * @param[out] oem_event_data_len - OEM event dat length |
| * @return google OEM PLDM event id |
| */ |
| uint16_t platform_oem_google_decode_event_message_req( |
| const uint8_t* event_data, size_t event_data_length, |
| size_t* oem_event_data_offset, size_t* oem_event_data_len); |
| |
| /** @brief sanity check the pldm_event_oem_google_soc_reset_me oem message data |
| * @param[in] oem_event_data - oem event message data |
| * @param[in] oem_event_data_len - oem event message data lenght |
| * @return pointer to pldm_event_oem_google_soc_reset_me if pass sanity check |
| * otherwise return NULL |
| */ |
| const struct pldm_event_oem_google_soc_reset_me* |
| pldm_event_oem_google_soc_reset_me_msg(const uint8_t* oem_event_data, |
| size_t oem_event_data_len); |
| |
| #ifdef __cplusplus |
| } |
| #endif |
| |
| #endif /* PLDM_OEM_GOOGLE_H */ |