| // Copyright 2024 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. |
| |
| #pragma once |
| |
| #include "hoth_util.hpp" |
| |
| #include <stdplus/raw.hpp> |
| |
| #include <cstdint> |
| #include <span> |
| #include <vector> |
| |
| namespace ipmi_hoth |
| { |
| namespace internal |
| { |
| |
| /* Host command response codes (16-bit). Note that response codes should be |
| * stored in a uint16_t rather than directly in a value of this type. |
| */ |
| enum ec_status |
| { |
| EC_RES_SUCCESS = 0, |
| EC_RES_INVALID_COMMAND = 1, |
| EC_RES_ERROR = 2, |
| EC_RES_INVALID_PARAM = 3, |
| EC_RES_ACCESS_DENIED = 4, |
| EC_RES_INVALID_RESPONSE = 5, |
| EC_RES_INVALID_VERSION = 6, |
| EC_RES_INVALID_CHECKSUM = 7, |
| EC_RES_IN_PROGRESS = 8, /* Accepted, command in progress */ |
| EC_RES_UNAVAILABLE = 9, /* No response available */ |
| EC_RES_TIMEOUT = 10, /* We got a timeout */ |
| EC_RES_OVERFLOW = 11, /* Table / data overflow */ |
| EC_RES_INVALID_HEADER = 12, /* Header contains invalid data */ |
| EC_RES_REQUEST_TRUNCATED = 13, /* Didn't get the entire request */ |
| EC_RES_RESPONSE_TOO_BIG = 14, /* Response was too big to handle */ |
| EC_RES_BUS_ERROR = 15, /* Communications bus error */ |
| EC_RES_BUSY = 16, /* Up but too busy. Should retry */ |
| EC_RES_INVALID_HEADER_VERSION = 17, /* Header version invalid */ |
| EC_RES_INVALID_HEADER_CRC = 18, /* Header CRC invalid */ |
| EC_RES_INVALID_DATA_CRC = 19, /* Data CRC invalid */ |
| EC_RES_DUP_UNAVAILABLE = 20, /* Can't resend response */ |
| }; |
| |
| /** @class HothUtilImpl |
| * @brief Implementation of HothUtil interface |
| */ |
| class HothUtilImpl : public HothUtil |
| { |
| public: |
| std::vector<uint8_t> |
| wrapECSKMHSSRequest(std::span<const uint8_t> request) override; |
| std::vector<uint8_t> readSKMHSS(uint32_t slot) override; |
| std::vector<uint8_t> writeSKMHSS(uint32_t slot, |
| std::span<const uint8_t> data) override; |
| std::vector<uint8_t> deleteSKMHSS(uint32_t slot) override; |
| std::span<const uint8_t> |
| payloadECResponse(std::span<const uint8_t> rsp) override; |
| }; |
| |
| } // namespace internal |
| |
| } // namespace ipmi_hoth |