drivers/crypto/nx/nx.h

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

File Facts

System
Linux kernel
Corpus path
drivers/crypto/nx/nx.h
Extension
.h
Size
5319 bytes
Lines
198
Domain
Driver Families
Bucket
drivers/crypto
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 nx_sg {
	u64 addr;
	u32 rsvd;
	u32 len;
} __attribute((packed));

#define NX_PAGE_SIZE		(4096)
#define NX_MAX_SG_ENTRIES	(NX_PAGE_SIZE/(sizeof(struct nx_sg)))

enum nx_status {
	NX_DISABLED,
	NX_WAITING,
	NX_OKAY
};

/* msc_triplet and max_sync_cop are used only to assist in parsing the
 * openFirmware property */
struct msc_triplet {
	u32 keybitlen;
	u32 databytelen;
	u32 sglen;
} __packed;

struct max_sync_cop {
	u32 fc;
	u32 mode;
	u32 triplets;
	struct msc_triplet trip[];
} __packed;

struct alg_props {
	u32 databytelen;
	u32 sglen;
};

#define NX_OF_FLAG_MAXSGLEN_SET		(1)
#define NX_OF_FLAG_STATUS_SET		(2)
#define NX_OF_FLAG_MAXSYNCCOP_SET	(4)
#define NX_OF_FLAG_MASK_READY		(NX_OF_FLAG_MAXSGLEN_SET | \
					 NX_OF_FLAG_STATUS_SET |   \
					 NX_OF_FLAG_MAXSYNCCOP_SET)
struct nx_of {
	u32 flags;
	u32 max_sg_len;
	enum nx_status status;
	struct alg_props ap[NX_MAX_FC][NX_MAX_MODE][3];
};

struct nx_stats {
	atomic_t aes_ops;
	atomic64_t aes_bytes;
	atomic_t sha256_ops;
	atomic64_t sha256_bytes;
	atomic_t sha512_ops;
	atomic64_t sha512_bytes;

	atomic_t sync_ops;

	atomic_t errors;
	atomic_t last_error;
	atomic_t last_error_pid;
};

struct nx_crypto_driver {
	struct nx_stats    stats;
	struct nx_of       of;
	struct vio_dev    *viodev;
	struct vio_driver  viodriver;
	struct dentry     *dfs_root;
};

#define NX_GCM4106_NONCE_LEN		(4)
#define NX_GCM_CTR_OFFSET		(12)
struct nx_gcm_rctx {
	u8 iv[16];
};

struct nx_gcm_priv {
	u8 iauth_tag[16];
	u8 nonce[NX_GCM4106_NONCE_LEN];
};

#define NX_CCM_AES_KEY_LEN		(16)
#define NX_CCM4309_AES_KEY_LEN		(19)
#define NX_CCM4309_NONCE_LEN		(3)
struct nx_ccm_rctx {
	u8 iv[16];
};

struct nx_ccm_priv {

Annotation

Implementation Notes