include/linux/habanalabs/hl_boot_if.h

Source file repositories/reference/linux-study-clean/include/linux/habanalabs/hl_boot_if.h

File Facts

System
Linux kernel
Corpus path
include/linux/habanalabs/hl_boot_if.h
Extension
.h
Size
27737 bytes
Lines
808
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 cpu_dyn_regs {
	__le32 cpu_pq_base_addr_low;
	__le32 cpu_pq_base_addr_high;
	__le32 cpu_pq_length;
	__le32 cpu_pq_init_status;
	__le32 cpu_eq_base_addr_low;
	__le32 cpu_eq_base_addr_high;
	__le32 cpu_eq_length;
	__le32 cpu_eq_ci;
	__le32 cpu_cq_base_addr_low;
	__le32 cpu_cq_base_addr_high;
	__le32 cpu_cq_length;
	__le32 cpu_pf_pq_pi;
	__le32 cpu_boot_dev_sts0;
	__le32 cpu_boot_dev_sts1;
	__le32 cpu_boot_err0;
	__le32 cpu_boot_err1;
	__le32 cpu_boot_status;
	__le32 fw_upd_sts;
	__le32 fw_upd_cmd;
	__le32 fw_upd_pending_sts;
	__le32 fuse_ver_offset;
	__le32 preboot_ver_offset;
	__le32 uboot_ver_offset;
	__le32 hw_state;
	__le32 kmd_msg_to_cpu;
	__le32 cpu_cmd_status_to_host;
	__le32 gic_host_pi_upd_irq;
	__le32 gic_tpc_qm_irq_ctrl;
	__le32 gic_mme_qm_irq_ctrl;
	__le32 gic_dma_qm_irq_ctrl;
	__le32 gic_nic_qm_irq_ctrl;
	__le32 gic_dma_core_irq_ctrl;
	__le32 gic_host_halt_irq;
	__le32 gic_host_ints_irq;
	__le32 reserved0;
	__le32 gic_rot_qm_irq_ctrl;
	__le32 reserved1;
	__le32 eng_arc_irq_ctrl;
	__le32 reserved2[20];		/* reserve for future use */
};

/* TODO: remove the desc magic after the code is updated to use message */
/* HCDM - Habana Communications Descriptor Magic */
#define HL_COMMS_DESC_MAGIC	0x4843444D
#define HL_COMMS_DESC_VER	3

/* HCMv - Habana Communications Message + header version */
#define HL_COMMS_MSG_MAGIC_VALUE	0x48434D00
#define HL_COMMS_MSG_MAGIC_MASK		0xFFFFFF00
#define HL_COMMS_MSG_MAGIC_VER_MASK	0xFF

#define HL_COMMS_MSG_MAGIC_VER(ver)	(HL_COMMS_MSG_MAGIC_VALUE |	\
					((ver) & HL_COMMS_MSG_MAGIC_VER_MASK))
#define HL_COMMS_MSG_MAGIC_V0		HL_COMMS_DESC_MAGIC
#define HL_COMMS_MSG_MAGIC_V1		HL_COMMS_MSG_MAGIC_VER(1)
#define HL_COMMS_MSG_MAGIC_V2		HL_COMMS_MSG_MAGIC_VER(2)
#define HL_COMMS_MSG_MAGIC_V3		HL_COMMS_MSG_MAGIC_VER(3)

#define HL_COMMS_MSG_MAGIC		HL_COMMS_MSG_MAGIC_V3

#define HL_COMMS_MSG_MAGIC_VALIDATE_MAGIC(magic)			\
		(((magic) & HL_COMMS_MSG_MAGIC_MASK) ==			\
		HL_COMMS_MSG_MAGIC_VALUE)

#define HL_COMMS_MSG_MAGIC_VALIDATE_VERSION(magic, ver)			\
		(((magic) & HL_COMMS_MSG_MAGIC_VER_MASK) >=		\
		((ver) & HL_COMMS_MSG_MAGIC_VER_MASK))

#define HL_COMMS_MSG_MAGIC_VALIDATE(magic, ver)				\
		(HL_COMMS_MSG_MAGIC_VALIDATE_MAGIC((magic)) &&		\
		HL_COMMS_MSG_MAGIC_VALIDATE_VERSION((magic), (ver)))

enum comms_msg_type {
	HL_COMMS_DESC_TYPE = 0,
	HL_COMMS_RESET_CAUSE_TYPE = 1,
	HL_COMMS_FW_CFG_SKIP_TYPE = 2,
	HL_COMMS_BINNING_CONF_TYPE = 3,
};

/*
 * Binning information shared between LKD and FW
 * @tpc_mask_l - TPC binning information lower 64 bit
 * @dec_mask - Decoder binning information
 * @dram_mask - DRAM binning information
 * @edma_mask - EDMA binning information
 * @mme_mask_l - MME binning information lower 32
 * @mme_mask_h - MME binning information upper 32
 * @rot_mask - Rotator binning information
 * @xbar_mask - xBAR binning information

Annotation

Implementation Notes