| 1 |
|
| 2 | |
| 3 | * Copyright (c) 2025 Intel Corporation
|
| 4 |
|
| 5 |
|
| 6 | #ifndef _INTEL_LB_MEI_INTERFACE_H_
|
| 7 | #define _INTEL_LB_MEI_INTERFACE_H_
|
| 8 |
|
| 9 | #include <linux/bits.h>
|
| 10 | #include <linux/types.h>
|
| 11 |
|
| 12 | struct device;
|
| 13 |
|
| 14 | |
| 15 | * define INTEL_LB_FLAG_IS_PERSISTENT - Mark the payload as persistent
|
| 16 | *
|
| 17 | * This flag indicates that the late binding payload should be stored
|
| 18 | * persistently in flash across warm resets.
|
| 19 |
|
| 20 | #define INTEL_LB_FLAG_IS_PERSISTENT BIT(0)
|
| 21 |
|
| 22 | |
| 23 | * enum intel_lb_type - enum to determine late binding payload type
|
| 24 | * @INTEL_LB_TYPE_FAN_CONTROL: Fan controller configuration
|
| 25 | * @INTEL_LB_TYPE_OCODE: Ocode firmware
|
| 26 |
|
| 27 | enum intel_lb_type {
|
| 28 | INTEL_LB_TYPE_FAN_CONTROL = 1,
|
| 29 | INTEL_LB_TYPE_OCODE = 3,
|
| 30 | };
|
| 31 |
|
| 32 | |
| 33 | * enum intel_lb_status - Status codes returned on late binding transmissions
|
| 34 | * @INTEL_LB_STATUS_SUCCESS: Operation completed successfully
|
| 35 | * @INTEL_LB_STATUS_4ID_MISMATCH: Mismatch in the expected 4ID (firmware identity/token)
|
| 36 | * @INTEL_LB_STATUS_ARB_FAILURE: Arbitration failure (e.g. conflicting access or state)
|
| 37 | * @INTEL_LB_STATUS_GENERAL_ERROR: General firmware error not covered by other codes
|
| 38 | * @INTEL_LB_STATUS_INVALID_PARAMS: One or more input parameters are invalid
|
| 39 | * @INTEL_LB_STATUS_INVALID_SIGNATURE: Payload has an invalid or untrusted signature
|
| 40 | * @INTEL_LB_STATUS_INVALID_PAYLOAD: Payload contents are not accepted by firmware
|
| 41 | * @INTEL_LB_STATUS_TIMEOUT: Operation timed out before completion
|
| 42 | * @INTEL_LB_STATUS_BUFFER_TOO_SMALL: Buffer provided is smaller when expected
|
| 43 | * @INTEL_LB_STATUS_INTERNAL_ERROR: Internal firmware error
|
| 44 | * @INTEL_LB_STATUS_INVALID_FPT_TABLE: Invalid firmware format table
|
| 45 | * @INTEL_LB_STATUS_SIGNED_PAYLOAD_VERIFICATION_ERROR: Error in signature verification
|
| 46 | * @INTEL_LB_STATUS_SIGNED_PAYLOAD_INVALID_CPD: Invalid CPD
|
| 47 | * @INTEL_LB_STATUS_SIGNED_PAYLOAD_FW_VERSION_MISMATCH: Firmware version mismatch
|
| 48 | * @INTEL_LB_STATUS_SIGNED_PAYLOAD_INVALID_MANIFEST: Invalid firmware manifest
|
| 49 | * @INTEL_LB_STATUS_SIGNED_PAYLOAD_INVALID_HASH: Wrong hash in signature
|
| 50 | * @INTEL_LB_STATUS_SIGNED_PAYLOAD_BINDING_TYPE_MISMATCH: Wrong firmware type provided
|
| 51 | * @INTEL_LB_STATUS_SIGNED_PAYLOAD_HANDLE_SVN_FAILED: SVN check failed
|
| 52 | * @INTEL_LB_STATUS_DESTINATION_MBOX_FAILURE: Failed to send datat to destination
|
| 53 | * @INTEL_LB_STATUS_MISSING_LOADING_PATCH: No loading patch found
|
| 54 | * @INTEL_LB_STATUS_INVALID_COMMAND: Invalid command number
|
| 55 | * @INTEL_LB_STATUS_INVALID_HECI_HEADER: Invalid transport header
|
| 56 | * @INTEL_LB_STATUS_IP_ERROR_START: Base for internal errors
|
| 57 |
|
| 58 | enum intel_lb_status {
|
| 59 | INTEL_LB_STATUS_SUCCESS = 0,
|
| 60 | INTEL_LB_STATUS_4ID_MISMATCH = 1,
|
| 61 | INTEL_LB_STATUS_ARB_FAILURE = 2,
|
| 62 | INTEL_LB_STATUS_GENERAL_ERROR = 3,
|
| 63 | INTEL_LB_STATUS_INVALID_PARAMS = 4,
|
| 64 | INTEL_LB_STATUS_INVALID_SIGNATURE = 5,
|
| 65 | INTEL_LB_STATUS_INVALID_PAYLOAD = 6,
|
| 66 | INTEL_LB_STATUS_TIMEOUT = 7,
|
| 67 | INTEL_LB_STATUS_BUFFER_TOO_SMALL = 8,
|
| 68 | INTEL_LB_STATUS_INTERNAL_ERROR = 9,
|
| 69 | INTEL_LB_STATUS_INVALID_FPT_TABLE = 10,
|
| 70 | INTEL_LB_STATUS_SIGNED_PAYLOAD_VERIFICATION_ERROR = 11,
|
| 71 | INTEL_LB_STATUS_SIGNED_PAYLOAD_INVALID_CPD = 12,
|
| 72 | INTEL_LB_STATUS_SIGNED_PAYLOAD_FW_VERSION_MISMATCH = 13,
|
| 73 | INTEL_LB_STATUS_SIGNED_PAYLOAD_INVALID_MANIFEST = 14,
|
| 74 | INTEL_LB_STATUS_SIGNED_PAYLOAD_INVALID_HASH = 15,
|
| 75 | INTEL_LB_STATUS_SIGNED_PAYLOAD_BINDING_TYPE_MISMATCH = 16,
|
| 76 | INTEL_LB_STATUS_SIGNED_PAYLOAD_HANDLE_SVN_FAILED = 17,
|
| 77 | INTEL_LB_STATUS_DESTINATION_MBOX_FAILURE = 18,
|
| 78 | INTEL_LB_STATUS_MISSING_LOADING_PATCH = 19,
|
| 79 | INTEL_LB_STATUS_INVALID_COMMAND = 20,
|
| 80 | INTEL_LB_STATUS_INVALID_HECI_HEADER = 21,
|
| 81 | INTEL_LB_STATUS_IP_ERROR_START = BIT(31),
|
| 82 | };
|
| 83 |
|
| 84 | |
| 85 | * struct intel_lb_component_ops - Ops for late binding services
|
| 86 |
|
| 87 | struct intel_lb_component_ops {
|
| 88 | |
| 89 | * @push_payload: Sends a payload to the authentication firmware
|
| 90 | *
|
| 91 | * @dev: Device struct corresponding to the mei device
|
| 92 | * @type: Payload type (see &enum intel_lb_type)
|
| 93 | * @flags: Payload flags bitmap (e.g. %INTEL_LB_FLAGS_IS_PERSISTENT)
|
| 94 | * @payload: Pointer to payload buffer
|
| 95 | * @payload_size: Payload buffer size in bytes
|
| 96 | *
|
| 97 | * Return: 0 success, negative errno value on transport failure,
|
| 98 | * positive error status returned by firmware
|
| 99 |
|
| 100 | int (*push_payload)(struct device *dev, u32 type, u32 flags,
|
| 101 | const void *payload, size_t payload_size);
|
| 102 | };
|
| 103 |
|
| 104 | #endif
|