| /* |
| * 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. |
| */ |
| |
| #ifndef SECURITY_CRYPTA_COMMANDS_CHROMIUMOS_G_EC_COMMANDS_H_ |
| #define SECURITY_CRYPTA_COMMANDS_CHROMIUMOS_G_EC_COMMANDS_H_ |
| |
| #include <stdint.h> |
| |
| #define G_EC_HOST_REQUEST_VERSION 3 |
| #define G_EC_HOST_RESPONSE_VERSION 3 |
| |
| #define G_EC_CMD_BOARD_SPECIFIC_BASE 0x3E00 |
| |
| /* Given the private host command offset, calculate the true private host |
| * command value. |
| */ |
| #define G_EC_PRIVATE_HOST_COMMAND_VALUE(command) \ |
| (G_EC_CMD_BOARD_SPECIFIC_BASE + (command)) |
| |
| /* Version 3 request from host */ |
| typedef struct |
| { |
| /* Structure version (=3) |
| * |
| * EC will return EC_RES_INVALID_HEADER if it receives a header with a |
| * version it doesn't know how to parse. |
| */ |
| uint8_t struct_version; |
| |
| /* Checksum of request and data; sum of all bytes including checksum should |
| * total to 0. |
| */ |
| uint8_t checksum; |
| |
| /* Command code */ |
| uint16_t command; |
| |
| /* Command version */ |
| uint8_t command_version; |
| |
| /* Unused byte in current protocol version; set to 0 */ |
| uint8_t reserved; |
| |
| /* Length of data which follows this header */ |
| uint16_t data_len; |
| } __attribute__((packed)) g_ec_host_request; |
| |
| /* Version 3 response from EC */ |
| typedef struct |
| { |
| /* Structure version (=3) */ |
| uint8_t struct_version; |
| |
| /* Checksum of response and data; sum of all bytes including checksum should |
| * total to 0. |
| */ |
| uint8_t checksum; |
| |
| /* Result code (EC_RES_*) */ |
| uint16_t result; |
| |
| /* Length of data which follows this header */ |
| uint16_t data_len; |
| |
| /* Unused bytes in current protocol version; set to 0 */ |
| uint16_t reserved; |
| } __attribute__((packed)) g_ec_host_response; |
| |
| #endif // SECURITY_CRYPTA_COMMANDS_CHROMIUMOS_G_EC_COMMANDS_H_ |