falcon.h (3118B)
1#ifndef __NVKM_FALCON_H__ 2#define __NVKM_FALCON_H__ 3#include <engine/falcon.h> 4 5int nvkm_falcon_ctor(const struct nvkm_falcon_func *, struct nvkm_subdev *owner, 6 const char *name, u32 addr, struct nvkm_falcon *); 7void nvkm_falcon_dtor(struct nvkm_falcon *); 8 9void nvkm_falcon_v1_load_imem(struct nvkm_falcon *, 10 void *, u32, u32, u16, u8, bool); 11void nvkm_falcon_v1_load_dmem(struct nvkm_falcon *, void *, u32, u32, u8); 12void nvkm_falcon_v1_read_dmem(struct nvkm_falcon *, u32, u32, u8, void *); 13void nvkm_falcon_v1_bind_context(struct nvkm_falcon *, struct nvkm_memory *); 14int nvkm_falcon_v1_wait_for_halt(struct nvkm_falcon *, u32); 15int nvkm_falcon_v1_clear_interrupt(struct nvkm_falcon *, u32); 16void nvkm_falcon_v1_set_start_addr(struct nvkm_falcon *, u32 start_addr); 17void nvkm_falcon_v1_start(struct nvkm_falcon *); 18int nvkm_falcon_v1_enable(struct nvkm_falcon *); 19void nvkm_falcon_v1_disable(struct nvkm_falcon *); 20 21void gp102_sec2_flcn_bind_context(struct nvkm_falcon *, struct nvkm_memory *); 22int gp102_sec2_flcn_enable(struct nvkm_falcon *); 23 24#define FLCN_PRINTK(t,f,fmt,a...) do { \ 25 if ((f)->owner->name != (f)->name) \ 26 nvkm_##t((f)->owner, "%s: "fmt"\n", (f)->name, ##a); \ 27 else \ 28 nvkm_##t((f)->owner, fmt"\n", ##a); \ 29} while(0) 30#define FLCN_DBG(f,fmt,a...) FLCN_PRINTK(debug, (f), fmt, ##a) 31#define FLCN_ERR(f,fmt,a...) FLCN_PRINTK(error, (f), fmt, ##a) 32 33/** 34 * struct nvfw_falcon_msg - header for all messages 35 * 36 * @unit_id: id of firmware process that sent the message 37 * @size: total size of message 38 * @ctrl_flags: control flags 39 * @seq_id: used to match a message from its corresponding command 40 */ 41struct nvfw_falcon_msg { 42 u8 unit_id; 43 u8 size; 44 u8 ctrl_flags; 45 u8 seq_id; 46}; 47 48#define nvfw_falcon_cmd nvfw_falcon_msg 49#define NV_FALCON_CMD_UNIT_ID_REWIND 0x00 50 51struct nvkm_falcon_qmgr; 52int nvkm_falcon_qmgr_new(struct nvkm_falcon *, struct nvkm_falcon_qmgr **); 53void nvkm_falcon_qmgr_del(struct nvkm_falcon_qmgr **); 54 55typedef int 56(*nvkm_falcon_qmgr_callback)(void *priv, struct nvfw_falcon_msg *); 57 58struct nvkm_falcon_cmdq; 59int nvkm_falcon_cmdq_new(struct nvkm_falcon_qmgr *, const char *name, 60 struct nvkm_falcon_cmdq **); 61void nvkm_falcon_cmdq_del(struct nvkm_falcon_cmdq **); 62void nvkm_falcon_cmdq_init(struct nvkm_falcon_cmdq *, 63 u32 index, u32 offset, u32 size); 64void nvkm_falcon_cmdq_fini(struct nvkm_falcon_cmdq *); 65int nvkm_falcon_cmdq_send(struct nvkm_falcon_cmdq *, struct nvfw_falcon_cmd *, 66 nvkm_falcon_qmgr_callback, void *priv, 67 unsigned long timeout_jiffies); 68 69struct nvkm_falcon_msgq; 70int nvkm_falcon_msgq_new(struct nvkm_falcon_qmgr *, const char *name, 71 struct nvkm_falcon_msgq **); 72void nvkm_falcon_msgq_del(struct nvkm_falcon_msgq **); 73void nvkm_falcon_msgq_init(struct nvkm_falcon_msgq *, 74 u32 index, u32 offset, u32 size); 75int nvkm_falcon_msgq_recv_initmsg(struct nvkm_falcon_msgq *, void *, u32 size); 76void nvkm_falcon_msgq_recv(struct nvkm_falcon_msgq *); 77#endif