Lines Matching +full:enum +full:- +full:as +full:- +full:flags
1 /* SPDX-License-Identifier: GPL-2.0+ */
6 * managing access and communication to and from the SSAM EC, as well as main
9 * Copyright (C) 2019-2021 Maximilian Luz <[email protected]>
22 /* -- Main data types and definitions --------------------------------------- */
25 * enum ssam_event_flags - Flags for enabling/disabling SAM events
28 enum ssam_event_flags {
33 * struct ssam_event - SAM event sent from the EC to the host.
34 * @target_category: Target category of the event source. See &enum ssam_ssh_tc.
51 * enum ssam_request_flags - Flags for SAM requests.
64 enum ssam_request_flags {
70 * struct ssam_request - SAM request description.
71 * @target_category: Category of the request's target. See &enum ssam_ssh_tc.
75 * @flags: Flags for the request. See &enum ssam_request_flags.
88 u16 flags; member
94 * struct ssam_response - Response buffer for SAM request.
125 /* -- Synchronous request interface. ---------------------------------------- */
128 * struct ssam_request_sync - Synchronous SAM request struct.
145 int ssam_request_sync_alloc(size_t payload_len, gfp_t flags,
152 enum ssam_request_flags flags);
155 * ssam_request_sync_set_data - Set message data of a synchronous request.
166 ssh_request_set_data(&rqst->base, ptr, len); in ssam_request_sync_set_data()
170 * ssam_request_sync_set_resp - Set response buffer of a synchronous request.
181 rqst->resp = resp; in ssam_request_sync_set_resp()
188 * ssam_request_sync_wait - Wait for completion of a synchronous request.
206 wait_for_completion(&rqst->comp); in ssam_request_sync_wait()
207 return rqst->status; in ssam_request_sync_wait()
220 * ssam_request_do_sync_onstack - Execute a synchronous request on the stack.
247 * __ssam_retry - Retry request in case of I/O errors or timeouts.
253 * request returns %-EREMOTEIO (indicates I/O error) or %-ETIMEDOUT (request
254 * or underlying packet timed out), @request will be re-executed again, up to
263 for (__i = (n); __i > 0; __i--) { \
265 if (__s != -ETIMEDOUT && __s != -EREMOTEIO) \
272 * ssam_retry - Retry request in case of I/O errors or timeouts up to three
278 * request returns %-EREMOTEIO (indicates I/O error) or -%ETIMEDOUT (request
279 * or underlying packet timed out), @request will be re-executed again, up to
290 * struct ssam_request_spec - Blue-print specification of SAM request.
291 * @target_category: Category of the request's target. See &enum ssam_ssh_tc.
295 * @flags: Flags for the request. See &enum ssam_request_flags.
297 * Blue-print specification for a SAM request. This struct describes the
299 * its instance-specific data (e.g. payload). It is intended to be used as base
308 u8 flags; member
312 * struct ssam_request_spec_md - Blue-print specification for multi-device SAM
314 * @target_category: Category of the request's target. See &enum ssam_ssh_tc.
316 * @flags: Flags for the request. See &enum ssam_request_flags.
318 * Blue-print specification for a multi-device SAM request, i.e. a request
322 * instance-specific data (e.g. payload) and without specifying any of its
324 * used as base for defining simple multi-device request functions via the
331 u8 flags; member
335 * SSAM_DEFINE_SYNC_REQUEST_N() - Define synchronous SAM request function
343 * allocation, as well as execution of the request itself, returning once the
347 * The generated function is defined as ``static int name(struct
365 rqst.flags = s.flags; \
373 * SSAM_DEFINE_SYNC_REQUEST_W() - Define synchronous SAM request function with
382 * struct, buffer allocation, as well as execution of the request itself,
386 * The generated function is defined as ``static int name(struct
405 rqst.flags = s.flags; \
414 * SSAM_DEFINE_SYNC_REQUEST_R() - Define synchronous SAM request function with
423 * and response structs, buffer allocation, as well as execution of the
427 * The generated function is defined as ``static int name(struct
448 rqst.flags = s.flags | SSAM_REQUEST_HAS_RESPONSE; \
466 return -EIO; \
473 * SSAM_DEFINE_SYNC_REQUEST_WR() - Define synchronous SAM request function with
483 * and response structs, buffer allocation, as well as execution of the request
487 * The generated function is defined as ``static int name(struct
509 rqst.flags = s.flags | SSAM_REQUEST_HAS_RESPONSE; \
527 return -EIO; \
534 * SSAM_DEFINE_SYNC_REQUEST_MD_N() - Define synchronous multi-device SAM
541 * specifying parameters are not hard-coded, but instead must be provided to
543 * struct, buffer allocation, as well as execution of the request itself,
547 * The generated function is defined as ``static int name(struct
566 rqst.flags = s.flags; \
574 * SSAM_DEFINE_SYNC_REQUEST_MD_W() - Define synchronous multi-device SAM
582 * return value. Device specifying parameters are not hard-coded, but instead
584 * setting up the request struct, buffer allocation, as well as execution of
588 * The generated function is defined as ``static int name(struct
608 rqst.flags = s.flags; \
617 * SSAM_DEFINE_SYNC_REQUEST_MD_R() - Define synchronous multi-device SAM
625 * type @rtype. Device specifying parameters are not hard-coded, but instead
627 * setting up the request and response structs, buffer allocation, as well as
631 * The generated function is defined as ``static int name(struct
653 rqst.flags = s.flags | SSAM_REQUEST_HAS_RESPONSE; \
671 return -EIO; \
678 * SSAM_DEFINE_SYNC_REQUEST_MD_WR() - Define synchronous multi-device SAM
687 * of type @rtype. Device specifying parameters are not hard-coded, but instead
689 * setting up the request and response structs, buffer allocation, as well as
693 * The generated function is defined as ``static int name(struct
717 rqst.flags = s.flags | SSAM_REQUEST_HAS_RESPONSE; \
735 return -EIO; \
742 /* -- Event notifier/callbacks. --------------------------------------------- */
745 #define SSAM_NOTIF_STATE_MASK ((1 << SSAM_NOTIF_STATE_SHIFT) - 1)
748 * enum ssam_notif_flags - Flags used in return values from SSAM notifier
768 enum ssam_notif_flags {
779 * struct ssam_notifier_block - Base notifier block for SSAM event
783 * respective notifier block and event as input and should return
784 * a notifier value, which can either be obtained from the flags
785 * provided in &enum ssam_notif_flags, converted from a standard
800 * ssam_notifier_from_errno() - Convert standard error value to notifier
814 return ((-err) << SSAM_NOTIF_STATE_SHIFT) | SSAM_NOTIF_STOP; in ssam_notifier_from_errno()
818 * ssam_notifier_to_errno() - Convert notifier return code to standard error
827 return -(ret >> SSAM_NOTIF_STATE_SHIFT); in ssam_notifier_to_errno()
831 /* -- Event/notification registry. ------------------------------------------ */
834 * struct ssam_event_registry - Registry specification used for enabling events.
837 * @cid_enable: Command ID for the event-enable request.
838 * @cid_disable: Command ID for the event-disable request.
853 * struct ssam_event_id - Unique event ID used for enabling events.
867 * enum ssam_event_mask - Flags specifying how events are matched to notifiers.
886 enum ssam_event_mask {
897 * SSAM_EVENT_REGISTRY() - Define a new event registry.
900 * @cid_en: Command ID for the event-enable request.
901 * @cid_dis: Command ID for the event-disable request.
924 * enum ssam_event_notifier_flags - Flags for event notifiers.
926 * The corresponding notifier acts as observer. Registering a notifier
933 enum ssam_event_notifier_flags {
938 * struct ssam_event_notifier - Notifier block for SSAM events.
943 * @event.mask: Flags determining how events are matched to the notifier.
944 * @event.flags: Flags used for enabling the event.
945 * @flags: Notifier flags (see &enum ssam_event_notifier_flags).
953 enum ssam_event_mask mask;
954 u8 flags; member
957 unsigned long flags; member
967 * ssam_notifier_unregister() - Unregister an event notifier.
972 * SAM event if the notifier is not marked as an observer. If the usage counter
975 * Return: Returns zero on success, %-ENOENT if the given notifier block has
978 * event-disable EC-command.
988 struct ssam_event_id id, u8 flags);
992 struct ssam_event_id id, u8 flags);