Lines Matching +full:surface +full:- +full:sam
1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Surface System Aggregator Module (SSAM) controller interface.
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
33 * struct ssam_event - SAM event sent from the EC to the host.
51 * enum ssam_request_flags - Flags for SAM requests.
70 * struct ssam_request - SAM request description.
79 * This struct fully describes a SAM request with payload. It is intended to
94 * struct ssam_response - Response buffer for SAM request.
125 /* -- Synchronous request interface. ---------------------------------------- */
128 * struct ssam_request_sync - Synchronous SAM request struct.
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.
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
312 * struct ssam_request_spec_md - Blue-print specification for multi-device SAM
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
335 * SSAM_DEFINE_SYNC_REQUEST_N() - Define synchronous SAM request function
340 * Defines a function executing the synchronous SAM request specified by
373 * SSAM_DEFINE_SYNC_REQUEST_W() - Define synchronous SAM request function with
379 * Defines a function executing the synchronous SAM request specified by
414 * SSAM_DEFINE_SYNC_REQUEST_R() - Define synchronous SAM request function with
420 * Defines a function executing the synchronous SAM request specified by
466 return -EIO; \
473 * SSAM_DEFINE_SYNC_REQUEST_WR() - Define synchronous SAM request function with
480 * Defines a function executing the synchronous SAM request specified by @spec,
527 return -EIO; \
534 * SSAM_DEFINE_SYNC_REQUEST_MD_N() - Define synchronous multi-device SAM
539 * Defines a function executing the synchronous SAM request specified by
541 * specifying parameters are not hard-coded, but instead must be provided to
574 * SSAM_DEFINE_SYNC_REQUEST_MD_W() - Define synchronous multi-device SAM
580 * Defines a function executing the synchronous SAM request specified by
582 * return value. Device specifying parameters are not hard-coded, but instead
617 * SSAM_DEFINE_SYNC_REQUEST_MD_R() - Define synchronous multi-device SAM
623 * Defines a function executing the synchronous SAM request specified by
625 * type @rtype. Device specifying parameters are not hard-coded, but instead
671 return -EIO; \
678 * SSAM_DEFINE_SYNC_REQUEST_MD_WR() - Define synchronous multi-device SAM
685 * Defines a function executing the synchronous SAM request specified by @spec,
687 * of type @rtype. Device specifying parameters are not hard-coded, but instead
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
779 * struct ssam_notifier_block - Base notifier block for SSAM event
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.
840 * This struct describes a SAM event registry via the minimal collection of
841 * SAM IDs specifying the requests to use for enabling and disabling an event.
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.
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.
938 * struct ssam_event_notifier - Notifier block for SSAM events.
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.