drivers/s390/crypto/ap_bus.h

Source file repositories/reference/linux-study-clean/drivers/s390/crypto/ap_bus.h

File Facts

System
Linux kernel
Corpus path
drivers/s390/crypto/ap_bus.h
Extension
.h
Size
13855 bytes
Lines
381
Domain
Driver Families
Bucket
drivers/s390
Inferred role
Driver Families: operation-table or driver-model contract
Status
pattern 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 device_driver driver;

	int (*probe)(struct ap_device *);
	void (*remove)(struct ap_device *);
	int (*in_use)(unsigned long *apm, unsigned long *aqm);
	/*
	 * Called at the start of the ap bus scan function when
	 * the crypto config information (qci) has changed.
	 * This callback is not invoked if there is no AP
	 * QCI support available.
	 */
	void (*on_config_changed)(struct ap_config_info *new_config_info,
				  struct ap_config_info *old_config_info);
	/*
	 * Called at the end of the ap bus scan function when
	 * the crypto config information (qci) has changed.
	 * This callback is not invoked if there is no AP
	 * QCI support available.
	 */
	void (*on_scan_complete)(struct ap_config_info *new_config_info,
				 struct ap_config_info *old_config_info);

	struct ap_device_id *ids;
	unsigned int flags;
};

#define to_ap_drv(x) container_of_const((x), struct ap_driver, driver)

int ap_driver_register(struct ap_driver *, struct module *, char *);
void ap_driver_unregister(struct ap_driver *);

struct ap_device {
	struct device device;
	int device_type;		/* AP device type. */
};

#define to_ap_dev(x) container_of((x), struct ap_device, device)

struct ap_card {
	struct ap_device ap_dev;
	struct ap_tapq_hwinfo hwinfo;	/* TAPQ GR2 content */
	atomic64_t total_request_count;	/* # requests ever for this AP device.*/
	unsigned int maxmsgsize;	/* AP msg limit for this card */
	int id;				/* AP card number. */
	bool config;			/* configured state */
	bool chkstop;			/* checkstop state */
};

#define TAPQ_CARD_HWINFO_MASK 0xFFFF0000FFFF0F0FUL
#define ASSOC_IDX_INVALID 0x10000

#define to_ap_card(x) container_of((x), struct ap_card, ap_dev.device)

struct ap_queue {
	struct ap_device ap_dev;
	struct hlist_node hnode;	/* Node for the ap_queues hashtable */
	struct ap_card *card;		/* Ptr to assoc. AP card. */
	spinlock_t lock;		/* Per device lock. */
	u64 total_request_count;	/* # requests ever for this AP device.*/
	enum ap_dev_state dev_state;	/* queue device state */
	ap_qid_t qid;			/* AP queue id. */
	unsigned int se_bstate;		/* SE bind state (BS) */
	unsigned int assoc_idx;		/* SE association index */
	int queue_count;		/* # messages currently on AP queue. */
	int pendingq_count;		/* # requests on pendingq list. */
	int requestq_count;		/* # requests on requestq list. */
	int request_timeout;		/* Request timeout in jiffies. */
	struct timer_list timeout;	/* Timer for request timeouts. */
	struct list_head pendingq;	/* List of message sent to AP queue. */
	struct list_head requestq;	/* List of message yet to be sent. */
	struct ap_message *reply;	/* Per device reply message. */
	enum ap_sm_state sm_state;	/* ap queue state machine state */
	int rapq_fbit;			/* fbit arg for next rapq invocation */
	int last_err_rc;		/* last error state response code */
	bool config;			/* configured state */
	bool chkstop;			/* checkstop state */
};

#define to_ap_queue(x) container_of((x), struct ap_queue, ap_dev.device)

typedef enum ap_sm_wait (ap_func_t)(struct ap_queue *queue);

struct ap_response_type {
	struct completion work;
	int type;
};

struct ap_message {
	struct list_head list;		/* Request queueing. */
	unsigned long psmid;		/* Message id. */

Annotation

Implementation Notes