Back to home page

OSCL-LXR

 
 

    


0001 #ifndef __NVKM_FALCON_H__
0002 #define __NVKM_FALCON_H__
0003 #include <engine/falcon.h>
0004 
0005 int nvkm_falcon_ctor(const struct nvkm_falcon_func *, struct nvkm_subdev *owner,
0006              const char *name, u32 addr, struct nvkm_falcon *);
0007 void nvkm_falcon_dtor(struct nvkm_falcon *);
0008 
0009 void nvkm_falcon_v1_load_imem(struct nvkm_falcon *,
0010                   void *, u32, u32, u16, u8, bool);
0011 void nvkm_falcon_v1_load_dmem(struct nvkm_falcon *, void *, u32, u32, u8);
0012 void nvkm_falcon_v1_read_dmem(struct nvkm_falcon *, u32, u32, u8, void *);
0013 void nvkm_falcon_v1_bind_context(struct nvkm_falcon *, struct nvkm_memory *);
0014 int nvkm_falcon_v1_wait_for_halt(struct nvkm_falcon *, u32);
0015 int nvkm_falcon_v1_clear_interrupt(struct nvkm_falcon *, u32);
0016 void nvkm_falcon_v1_set_start_addr(struct nvkm_falcon *, u32 start_addr);
0017 void nvkm_falcon_v1_start(struct nvkm_falcon *);
0018 int nvkm_falcon_v1_enable(struct nvkm_falcon *);
0019 void nvkm_falcon_v1_disable(struct nvkm_falcon *);
0020 
0021 void gp102_sec2_flcn_bind_context(struct nvkm_falcon *, struct nvkm_memory *);
0022 int gp102_sec2_flcn_enable(struct nvkm_falcon *);
0023 
0024 #define FLCN_PRINTK(t,f,fmt,a...) do {                               \
0025     if ((f)->owner->name != (f)->name)                           \
0026         nvkm_##t((f)->owner, "%s: "fmt"\n", (f)->name, ##a); \
0027     else                                                         \
0028         nvkm_##t((f)->owner, fmt"\n", ##a);                  \
0029 } while(0)
0030 #define FLCN_DBG(f,fmt,a...) FLCN_PRINTK(debug, (f), fmt, ##a)
0031 #define FLCN_ERR(f,fmt,a...) FLCN_PRINTK(error, (f), fmt, ##a)
0032 
0033 /**
0034  * struct nvfw_falcon_msg - header for all messages
0035  *
0036  * @unit_id:    id of firmware process that sent the message
0037  * @size:   total size of message
0038  * @ctrl_flags: control flags
0039  * @seq_id: used to match a message from its corresponding command
0040  */
0041 struct nvfw_falcon_msg {
0042     u8 unit_id;
0043     u8 size;
0044     u8 ctrl_flags;
0045     u8 seq_id;
0046 };
0047 
0048 #define nvfw_falcon_cmd nvfw_falcon_msg
0049 #define NV_FALCON_CMD_UNIT_ID_REWIND                                       0x00
0050 
0051 struct nvkm_falcon_qmgr;
0052 int nvkm_falcon_qmgr_new(struct nvkm_falcon *, struct nvkm_falcon_qmgr **);
0053 void nvkm_falcon_qmgr_del(struct nvkm_falcon_qmgr **);
0054 
0055 typedef int
0056 (*nvkm_falcon_qmgr_callback)(void *priv, struct nvfw_falcon_msg *);
0057 
0058 struct nvkm_falcon_cmdq;
0059 int nvkm_falcon_cmdq_new(struct nvkm_falcon_qmgr *, const char *name,
0060              struct nvkm_falcon_cmdq **);
0061 void nvkm_falcon_cmdq_del(struct nvkm_falcon_cmdq **);
0062 void nvkm_falcon_cmdq_init(struct nvkm_falcon_cmdq *,
0063                u32 index, u32 offset, u32 size);
0064 void nvkm_falcon_cmdq_fini(struct nvkm_falcon_cmdq *);
0065 int nvkm_falcon_cmdq_send(struct nvkm_falcon_cmdq *, struct nvfw_falcon_cmd *,
0066               nvkm_falcon_qmgr_callback, void *priv,
0067               unsigned long timeout_jiffies);
0068 
0069 struct nvkm_falcon_msgq;
0070 int nvkm_falcon_msgq_new(struct nvkm_falcon_qmgr *, const char *name,
0071              struct nvkm_falcon_msgq **);
0072 void nvkm_falcon_msgq_del(struct nvkm_falcon_msgq **);
0073 void nvkm_falcon_msgq_init(struct nvkm_falcon_msgq *,
0074                u32 index, u32 offset, u32 size);
0075 int nvkm_falcon_msgq_recv_initmsg(struct nvkm_falcon_msgq *, void *, u32 size);
0076 void nvkm_falcon_msgq_recv(struct nvkm_falcon_msgq *);
0077 #endif