include/linux/mailbox/riscv-rpmi-message.h

Source file repositories/reference/linux-study-clean/include/linux/mailbox/riscv-rpmi-message.h

File Facts

System
Linux kernel
Corpus path
include/linux/mailbox/riscv-rpmi-message.h
Extension
.h
Size
5965 bytes
Lines
244
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct rpmi_message_header {
	__le16 servicegroup_id;
	u8 service_id;
	u8 flags;
	__le16 datalen;
	__le16 token;
};

/* RPMI message */
struct rpmi_message {
	struct rpmi_message_header header;
	u8 data[];
};

/* RPMI notification event */
struct rpmi_notification_event {
	__le16 event_datalen;
	u8 event_id;
	u8 reserved;
	u8 event_data[];
};

/* RPMI error codes */
enum rpmi_error_codes {
	RPMI_SUCCESS			= 0,
	RPMI_ERR_FAILED			= -1,
	RPMI_ERR_NOTSUPP		= -2,
	RPMI_ERR_INVALID_PARAM		= -3,
	RPMI_ERR_DENIED			= -4,
	RPMI_ERR_INVALID_ADDR		= -5,
	RPMI_ERR_ALREADY		= -6,
	RPMI_ERR_EXTENSION		= -7,
	RPMI_ERR_HW_FAULT		= -8,
	RPMI_ERR_BUSY			= -9,
	RPMI_ERR_INVALID_STATE		= -10,
	RPMI_ERR_BAD_RANGE		= -11,
	RPMI_ERR_TIMEOUT		= -12,
	RPMI_ERR_IO			= -13,
	RPMI_ERR_NO_DATA		= -14,
	RPMI_ERR_RESERVED_START		= -15,
	RPMI_ERR_RESERVED_END		= -127,
	RPMI_ERR_VENDOR_START		= -128,
};

static inline int rpmi_to_linux_error(int rpmi_error)
{
	switch (rpmi_error) {
	case RPMI_SUCCESS:
		return 0;
	case RPMI_ERR_INVALID_PARAM:
	case RPMI_ERR_BAD_RANGE:
	case RPMI_ERR_INVALID_STATE:
		return -EINVAL;
	case RPMI_ERR_DENIED:
		return -EPERM;
	case RPMI_ERR_INVALID_ADDR:
	case RPMI_ERR_HW_FAULT:
		return -EFAULT;
	case RPMI_ERR_ALREADY:
		return -EALREADY;
	case RPMI_ERR_BUSY:
		return -EBUSY;
	case RPMI_ERR_TIMEOUT:
		return -ETIMEDOUT;
	case RPMI_ERR_IO:
		return -ECOMM;
	case RPMI_ERR_FAILED:
	case RPMI_ERR_NOTSUPP:
	case RPMI_ERR_NO_DATA:
	case RPMI_ERR_EXTENSION:
	default:
		return -EOPNOTSUPP;
	}
}

/* RPMI service group IDs */
#define RPMI_SRVGRP_SYSTEM_MSI		0x00002
#define RPMI_SRVGRP_CLOCK		0x00008

/* RPMI clock service IDs */
enum rpmi_clock_service_id {
	RPMI_CLK_SRV_ENABLE_NOTIFICATION = 0x01,
	RPMI_CLK_SRV_GET_NUM_CLOCKS = 0x02,
	RPMI_CLK_SRV_GET_ATTRIBUTES = 0x03,
	RPMI_CLK_SRV_GET_SUPPORTED_RATES = 0x04,
	RPMI_CLK_SRV_SET_CONFIG = 0x05,
	RPMI_CLK_SRV_GET_CONFIG = 0x06,
	RPMI_CLK_SRV_SET_RATE = 0x07,
	RPMI_CLK_SRV_GET_RATE = 0x08,
	RPMI_CLK_SRV_ID_MAX_COUNT

Annotation

Implementation Notes