drivers/firmware/stratix10-rsu.c

Source file repositories/reference/linux-study-clean/drivers/firmware/stratix10-rsu.c

File Facts

System
Linux kernel
Corpus path
drivers/firmware/stratix10-rsu.c
Extension
.c
Size
22321 bytes
Lines
825
Domain
Driver Families
Bucket
drivers/firmware
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct stratix10_rsu_priv {
	struct stratix10_svc_chan *chan;
	struct stratix10_svc_client client;
	struct completion completion;
	struct mutex lock;
	struct {
		unsigned long current_image;
		unsigned long fail_image;
		unsigned int version;
		unsigned int state;
		unsigned int error_details;
		unsigned int error_location;
	} status;

	struct {
		unsigned int dcmf0;
		unsigned int dcmf1;
		unsigned int dcmf2;
		unsigned int dcmf3;
	} dcmf_version;

	struct {
		unsigned int dcmf0;
		unsigned int dcmf1;
		unsigned int dcmf2;
		unsigned int dcmf3;
	} dcmf_status;

	unsigned int retry_counter;
	unsigned int max_retry;

	unsigned long spt0_address;
	unsigned long spt1_address;
};

typedef void (*rsu_async_callback)(struct device *dev,
	struct stratix10_rsu_priv *priv, struct stratix10_svc_cb_data *data);

/**
 * rsu_async_status_callback() - Status callback from rsu_async_send()
 * @dev: pointer to device object
 * @priv: pointer to priv object
 * @data: pointer to callback data structure
 *
 * Callback from rsu_async_send() to get the system rsu error status.
 */
static void rsu_async_status_callback(struct device *dev,
				      struct stratix10_rsu_priv *priv,
				      struct stratix10_svc_cb_data *data)
{
	struct arm_smccc_1_2_regs *res = (struct arm_smccc_1_2_regs *)data->kaddr1;

	priv->status.current_image = res->a2;
	priv->status.fail_image = res->a3;
	priv->status.state = res->a4;
	priv->status.version = res->a5;
	priv->status.error_location = res->a7;
	priv->status.error_details = res->a8;
	priv->retry_counter = res->a9;
}

/**
 * rsu_command_callback() - Update callback from Intel Service Layer
 * @client: pointer to client
 * @data: pointer to callback data structure
 *
 * Callback from Intel service layer for RSU commands.
 */
static void rsu_command_callback(struct stratix10_svc_client *client,
				 struct stratix10_svc_cb_data *data)
{
	struct stratix10_rsu_priv *priv = client->priv;

	if (data->status == BIT(SVC_STATUS_NO_SUPPORT))
		dev_warn(client->dev, "Secure FW doesn't support notify\n");
	else if (data->status == BIT(SVC_STATUS_ERROR))
		dev_err(client->dev, "Failure, returned status is %lu\n",
			BIT(data->status));

	complete(&priv->completion);
}


/**
 * rsu_max_retry_callback() - Callback from Intel service layer for getting
 * the max retry value from the firmware
 * @client: pointer to client
 * @data: pointer to callback data structure
 *
 * Callback from Intel service layer for max retry.

Annotation

Implementation Notes