MAJOR=4
MINOR=19
DEVNAME=tty19
  "   ˆl–Ü4ý()¨‰P@Š	›�zã S�ÿÀƒh¹ÃÂ      30
  *   ˆl–ß=¿JÅ!¶e8 EpÜ TÅ£Áƒuð·_†I|¥�+ÅÄ ë    /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
 * CXL IOCTLs for Memory Devices
 */

#ifndef _CXL_MEM_H_
#define _CXL_MEM_H_

#include <linux/types.h>

/**
 * DOC: UAPI
 *
 * Not all of all commands that the driver supports are always available for use
 * by userspace. Userspace must check the results from the QUERY command in
 * order to determine the live set of commands.
 */

#define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
#define CXL_MEM_SEND_COMMAND _IOWR(0xCE, 2, struct cxl_send_command)

#define CXL_CMDS                                                          \
	___C(INVALID, "Invalid Command"),                                 \
	___C(IDENTIFY, "Identify Command"),                               \
	___C(RAW, "Raw device command"),                                  \
	___C(GET_SUPPORTED_LOGS, "Get Supported Logs"),                   \
	___C(GET_FW_INFO, "Get FW Info"),                                 \
	___C(GET_PARTITION_INFO, "Get Partition Information"),            \
	___C(GET_LSA, "Get Label Storage Area"),                          \
	___C(GET_HEALTH_INFO, "Get Health Info"),                         \
	___C(GET_LOG, "Get Log"),                                         \
	___C(SET_PARTITION_INFO, "Set Partition Information"),            \
	___C(SET_LSA, "Set Label Storage Area"),                          \
	___C(GET_ALERT_CONFIG, "Get Alert Configuration"),                \
	___C(SET_ALERT_CONFIG, "Set Alert Configuration"),                \
	___C(GET_SHUTDOWN_STATE, "Get Shutdown State"),                   \
	___C(SET_SHUTDOWN_STATE, "Set Shutdown State"),                   \
	___DEPRECATED(GET_POISON, "Get Poison List"),                     \
	___DEPRECATED(INJECT_POISON, "Inject Poison"),                    \
	___DEPRECATED(CLEAR_POISON, "Clear Poison"),                      \
	___C(GET_SCAN_MEDIA_CAPS, "Get Scan Media Capabilities"),         \
	___DEPRECATED(SCAN_MEDIA, "Scan Media"),                          \
	___DEPRECATED(GET_SCAN_MEDIA, "Get Scan Media Results"),          \
	___C(GET_TIMESTAMP, "Get Timestamp"),                             \
	___C(GET_LOG_CAPS, "Get Log Capabilities"),			  \
	___C(CLEAR_LOG, "Clear Log"),					  \
	___C(GET_SUP_LOG_SUBLIST, "Get Supported Logs Sub-List"),	  \
	___C(MAX, "invalid / last command")

#define ___C(a, b) CXL_MEM_COMMAND_ID_##a
#define ___DEPRECATED(a, b) CXL_MEM_DEPRECATED_ID_##a
enum { CXL_CMDS };

#undef ___C
#undef ___DEPRECATED
#define ___C(a, b) { b }
#define ___DEPRECATED(a, b) { "Deprecated " b }
static const struct {
	const char *name;
} cxl_command_names[] = { CXL_CMDS };

/*
 * Here's how this actually breaks out:
 * cxl_command_names[] = {
 *	[CXL_MEM_COMMAND_ID_INVALID] = { "Invalid Command" },
 *	[CXL_MEM_COMMAND_ID_IDENTIFY] = { "Identify Command" },
 *	...
 *	[CXL_MEM_COMMAND_ID_MAX] = { "invalid / last command" },
 * };
 */

#undef ___C
#undef ___DEPRECATED
#define ___C(a, b) (0)
#define ___DEPRECATED(a, b) (1)

static const __u8 cxl_deprecated_commands[]
	__attribute__((__unused__)) = { CXL_CMDS };

/*
 * Here's how this actually breaks out:
 * cxl_deprecated_commands[] = {
 *	[CXL_MEM_COMMAND_ID_INVALID] = 0,
 *	[CXL_MEM_COMMAND_ID_IDENTIFY] = 0,
 *	...
 *	[CXL_MEM_DEPRECATED_ID_GET_POISON] = 1,
 *	[CXL_MEM_DEPRECATED_ID_INJECT_POISON] = 1,
 *	[CXL_MEM_DEPRECATED_ID_CLEAR_POISON] = 1,
 *	...
 * };
 */

#undef ___C
#undef ___DEPRECATED

/**
 * struct cxl_command_info - Command information returned from a query.
 * @id: ID number for the command.
 * @flags: Flags that specify command behavior.
 *
 *         CXL_MEM_COMMAND_FLAG_USER_ENABLED
 *
 *         The given command id is supported by the driver and is supported by
 *         a related opcode on the device.
 *
 *         CXL_MEM_COMMAND_FLAG_EXCLUSIVE
 *
 *         Requests with the given command id will terminate with EBUSY as the
 *         kernel actively owns management of the given resource. For 