Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2/*
3 * Surface System Aggregator Module (SSAM) user-space EC interface.
4 *
5 * Definitions, structs, and IOCTLs for the /dev/surface/aggregator misc
6 * device. This device provides direct user-space access to the SSAM EC.
7 * Intended for debugging and development.
8 *
9 * Copyright (C) 2020 Maximilian Luz <luzmaximilian@gmail.com>
10 */
11
12#ifndef _UAPI_LINUX_SURFACE_AGGREGATOR_CDEV_H
13#define _UAPI_LINUX_SURFACE_AGGREGATOR_CDEV_H
14
15#include <linux/ioctl.h>
16#include <linux/types.h>
17
18/**
19 * enum ssam_cdev_request_flags - Request flags for SSAM cdev request IOCTL.
20 *
21 * @SSAM_CDEV_REQUEST_HAS_RESPONSE:
22 * Specifies that the request expects a response. If not set, the request
23 * will be directly completed after its underlying packet has been
24 * transmitted. If set, the request transport system waits for a response
25 * of the request.
26 *
27 * @SSAM_CDEV_REQUEST_UNSEQUENCED:
28 * Specifies that the request should be transmitted via an unsequenced
29 * packet. If set, the request must not have a response, meaning that this
30 * flag and the %SSAM_CDEV_REQUEST_HAS_RESPONSE flag are mutually
31 * exclusive.
32 */
33enum ssam_cdev_request_flags {
34 SSAM_CDEV_REQUEST_HAS_RESPONSE = 0x01,
35 SSAM_CDEV_REQUEST_UNSEQUENCED = 0x02,
36};
37
38/**
39 * struct ssam_cdev_request - Controller request IOCTL argument.
40 * @target_category: Target category of the SAM request.
41 * @target_id: Target ID of the SAM request.
42 * @command_id: Command ID of the SAM request.
43 * @instance_id: Instance ID of the SAM request.
44 * @flags: Request flags (see &enum ssam_cdev_request_flags).
45 * @status: Request status (output).
46 * @payload: Request payload (input data).
47 * @payload.data: Pointer to request payload data.
48 * @payload.length: Length of request payload data (in bytes).
49 * @response: Request response (output data).
50 * @response.data: Pointer to response buffer.
51 * @response.length: On input: Capacity of response buffer (in bytes).
52 * On output: Length of request response (number of bytes
53 * in the buffer that are actually used).
54 */
55struct ssam_cdev_request {
56 __u8 target_category;
57 __u8 target_id;
58 __u8 command_id;
59 __u8 instance_id;
60 __u16 flags;
61 __s16 status;
62
63 struct {
64 __u64 data;
65 __u16 length;
66 __u8 __pad[6];
67 } payload;
68
69 struct {
70 __u64 data;
71 __u16 length;
72 __u8 __pad[6];
73 } response;
74} __attribute__((__packed__));
75
76#define SSAM_CDEV_REQUEST _IOWR(0xA5, 1, struct ssam_cdev_request)
77
78#endif /* _UAPI_LINUX_SURFACE_AGGREGATOR_CDEV_H */