![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 /* 0003 * System Control and Management Interface (SCMI) Message Protocol 0004 * notification header file containing some definitions, structures 0005 * and function prototypes related to SCMI Notification handling. 0006 * 0007 * Copyright (C) 2020-2021 ARM Ltd. 0008 */ 0009 #ifndef _SCMI_NOTIFY_H 0010 #define _SCMI_NOTIFY_H 0011 0012 #include <linux/device.h> 0013 #include <linux/ktime.h> 0014 #include <linux/types.h> 0015 0016 #define SCMI_PROTO_QUEUE_SZ 4096 0017 0018 /** 0019 * struct scmi_event - Describes an event to be supported 0020 * @id: Event ID 0021 * @max_payld_sz: Max possible size for the payload of a notification message 0022 * @max_report_sz: Max possible size for the report of a notification message 0023 * 0024 * Each SCMI protocol, during its initialization phase, can describe the events 0025 * it wishes to support in a few struct scmi_event and pass them to the core 0026 * using scmi_register_protocol_events(). 0027 */ 0028 struct scmi_event { 0029 u8 id; 0030 size_t max_payld_sz; 0031 size_t max_report_sz; 0032 }; 0033 0034 struct scmi_protocol_handle; 0035 0036 /** 0037 * struct scmi_event_ops - Protocol helpers called by the notification core. 0038 * @get_num_sources: Returns the number of possible events' sources for this 0039 * protocol 0040 * @set_notify_enabled: Enable/disable the required evt_id/src_id notifications 0041 * using the proper custom protocol commands. 0042 * Return 0 on Success 0043 * @fill_custom_report: fills a custom event report from the provided 0044 * event message payld identifying the event 0045 * specific src_id. 0046 * Return NULL on failure otherwise @report now fully 0047 * populated 0048 * 0049 * Context: Helpers described in &struct scmi_event_ops are called only in 0050 * process context. 0051 */ 0052 struct scmi_event_ops { 0053 int (*get_num_sources)(const struct scmi_protocol_handle *ph); 0054 int (*set_notify_enabled)(const struct scmi_protocol_handle *ph, 0055 u8 evt_id, u32 src_id, bool enabled); 0056 void *(*fill_custom_report)(const struct scmi_protocol_handle *ph, 0057 u8 evt_id, ktime_t timestamp, 0058 const void *payld, size_t payld_sz, 0059 void *report, u32 *src_id); 0060 }; 0061 0062 /** 0063 * struct scmi_protocol_events - Per-protocol description of available events 0064 * @queue_sz: Size in bytes of the per-protocol queue to use. 0065 * @ops: Array of protocol-specific events operations. 0066 * @evts: Array of supported protocol's events. 0067 * @num_events: Number of supported protocol's events described in @evts. 0068 * @num_sources: Number of protocol's sources, should be greater than 0; if not 0069 * available at compile time, it will be provided at run-time via 0070 * @get_num_sources. 0071 */ 0072 struct scmi_protocol_events { 0073 size_t queue_sz; 0074 const struct scmi_event_ops *ops; 0075 const struct scmi_event *evts; 0076 unsigned int num_events; 0077 unsigned int num_sources; 0078 }; 0079 0080 int scmi_notification_init(struct scmi_handle *handle); 0081 void scmi_notification_exit(struct scmi_handle *handle); 0082 int scmi_register_protocol_events(const struct scmi_handle *handle, u8 proto_id, 0083 const struct scmi_protocol_handle *ph, 0084 const struct scmi_protocol_events *ee); 0085 void scmi_deregister_protocol_events(const struct scmi_handle *handle, 0086 u8 proto_id); 0087 int scmi_notify(const struct scmi_handle *handle, u8 proto_id, u8 evt_id, 0088 const void *buf, size_t len, ktime_t ts); 0089 0090 #endif /* _SCMI_NOTIFY_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |