xref: /linux/include/drm/intel/intel_lb_mei_interface.h (revision 07fdad3a93756b872da7b53647715c48d0f4a2d0)
1 /* SPDX-License-Identifier: MIT */
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/types.h>
10 
11 struct device;
12 
13 /**
14  * define INTEL_LB_FLAG_IS_PERSISTENT - Mark the payload as persistent
15  *
16  * This flag indicates that the late binding payload should be stored
17  * persistently in flash across warm resets.
18  */
19 #define INTEL_LB_FLAG_IS_PERSISTENT	BIT(0)
20 
21 /**
22  * enum intel_lb_type - enum to determine late binding payload type
23  * @INTEL_LB_TYPE_FAN_CONTROL: Fan controller configuration
24  */
25 enum intel_lb_type {
26 	INTEL_LB_TYPE_FAN_CONTROL = 1,
27 };
28 
29 /**
30  * enum intel_lb_status - Status codes returned on late binding transmissions
31  * @INTEL_LB_STATUS_SUCCESS: Operation completed successfully
32  * @INTEL_LB_STATUS_4ID_MISMATCH: Mismatch in the expected 4ID (firmware identity/token)
33  * @INTEL_LB_STATUS_ARB_FAILURE: Arbitration failure (e.g. conflicting access or state)
34  * @INTEL_LB_STATUS_GENERAL_ERROR: General firmware error not covered by other codes
35  * @INTEL_LB_STATUS_INVALID_PARAMS: One or more input parameters are invalid
36  * @INTEL_LB_STATUS_INVALID_SIGNATURE: Payload has an invalid or untrusted signature
37  * @INTEL_LB_STATUS_INVALID_PAYLOAD: Payload contents are not accepted by firmware
38  * @INTEL_LB_STATUS_TIMEOUT: Operation timed out before completion
39  */
40 enum intel_lb_status {
41 	INTEL_LB_STATUS_SUCCESS           = 0,
42 	INTEL_LB_STATUS_4ID_MISMATCH      = 1,
43 	INTEL_LB_STATUS_ARB_FAILURE       = 2,
44 	INTEL_LB_STATUS_GENERAL_ERROR     = 3,
45 	INTEL_LB_STATUS_INVALID_PARAMS    = 4,
46 	INTEL_LB_STATUS_INVALID_SIGNATURE = 5,
47 	INTEL_LB_STATUS_INVALID_PAYLOAD   = 6,
48 	INTEL_LB_STATUS_TIMEOUT           = 7,
49 };
50 
51 /**
52  * struct intel_lb_component_ops - Ops for late binding services
53  */
54 struct intel_lb_component_ops {
55 	/**
56 	 * push_payload - Sends a payload to the authentication firmware
57 	 * @dev: Device struct corresponding to the mei device
58 	 * @type: Payload type (see &enum intel_lb_type)
59 	 * @flags: Payload flags bitmap (e.g. %INTEL_LB_FLAGS_IS_PERSISTENT)
60 	 * @payload: Pointer to payload buffer
61 	 * @payload_size: Payload buffer size in bytes
62 	 *
63 	 * Return: 0 success, negative errno value on transport failure,
64 	 *         positive status returned by firmware
65 	 */
66 	int (*push_payload)(struct device *dev, u32 type, u32 flags,
67 			    const void *payload, size_t payload_size);
68 };
69 
70 #endif /* _INTEL_LB_MEI_INTERFACE_H_ */
71