bcm_vk.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright 2018-2020 Broadcom.
  4. */
  5. #ifndef BCM_VK_H
  6. #define BCM_VK_H
  7. #include <linux/atomic.h>
  8. #include <linux/firmware.h>
  9. #include <linux/irq.h>
  10. #include <linux/kref.h>
  11. #include <linux/miscdevice.h>
  12. #include <linux/mutex.h>
  13. #include <linux/pci.h>
  14. #include <linux/poll.h>
  15. #include <linux/sched/signal.h>
  16. #include <linux/tty.h>
  17. #include <linux/uaccess.h>
  18. #include <uapi/linux/misc/bcm_vk.h>
  19. #include "bcm_vk_msg.h"
  20. #define DRV_MODULE_NAME "bcm-vk"
  21. /*
  22. * Load Image is completed in two stages:
  23. *
  24. * 1) When the VK device boot-up, M7 CPU runs and executes the BootROM.
  25. * The Secure Boot Loader (SBL) as part of the BootROM will run
  26. * to open up ITCM for host to push BOOT1 image.
  27. * SBL will authenticate the image before jumping to BOOT1 image.
  28. *
  29. * 2) Because BOOT1 image is a secured image, we also called it the
  30. * Secure Boot Image (SBI). At second stage, SBI will initialize DDR
  31. * and wait for host to push BOOT2 image to DDR.
  32. * SBI will authenticate the image before jumping to BOOT2 image.
  33. *
  34. */
  35. /* Location of registers of interest in BAR0 */
  36. /* Request register for Secure Boot Loader (SBL) download */
  37. #define BAR_CODEPUSH_SBL 0x400
  38. /* Start of ITCM */
  39. #define CODEPUSH_BOOT1_ENTRY 0x00400000
  40. #define CODEPUSH_MASK 0xfffff000
  41. #define CODEPUSH_BOOTSTART BIT(0)
  42. /* Boot Status register */
  43. #define BAR_BOOT_STATUS 0x404
  44. #define SRAM_OPEN BIT(16)
  45. #define DDR_OPEN BIT(17)
  46. /* Firmware loader progress status definitions */
  47. #define FW_LOADER_ACK_SEND_MORE_DATA BIT(18)
  48. #define FW_LOADER_ACK_IN_PROGRESS BIT(19)
  49. #define FW_LOADER_ACK_RCVD_ALL_DATA BIT(20)
  50. /* Boot1/2 is running in standalone mode */
  51. #define BOOT_STDALONE_RUNNING BIT(21)
  52. /* definitions for boot status register */
  53. #define BOOT_STATE_MASK (0xffffffff & \
  54. ~(FW_LOADER_ACK_SEND_MORE_DATA | \
  55. FW_LOADER_ACK_IN_PROGRESS | \
  56. BOOT_STDALONE_RUNNING))
  57. #define BOOT_ERR_SHIFT 4
  58. #define BOOT_ERR_MASK (0xf << BOOT_ERR_SHIFT)
  59. #define BOOT_PROG_MASK 0xf
  60. #define BROM_STATUS_NOT_RUN 0x2
  61. #define BROM_NOT_RUN (SRAM_OPEN | BROM_STATUS_NOT_RUN)
  62. #define BROM_STATUS_COMPLETE 0x6
  63. #define BROM_RUNNING (SRAM_OPEN | BROM_STATUS_COMPLETE)
  64. #define BOOT1_STATUS_COMPLETE 0x6
  65. #define BOOT1_RUNNING (DDR_OPEN | BOOT1_STATUS_COMPLETE)
  66. #define BOOT2_STATUS_COMPLETE 0x6
  67. #define BOOT2_RUNNING (FW_LOADER_ACK_RCVD_ALL_DATA | \
  68. BOOT2_STATUS_COMPLETE)
  69. /* Boot request for Secure Boot Image (SBI) */
  70. #define BAR_CODEPUSH_SBI 0x408
  71. /* 64M mapped to BAR2 */
  72. #define CODEPUSH_BOOT2_ENTRY 0x60000000
  73. #define BAR_CARD_STATUS 0x410
  74. /* CARD_STATUS definitions */
  75. #define CARD_STATUS_TTYVK0_READY BIT(0)
  76. #define CARD_STATUS_TTYVK1_READY BIT(1)
  77. #define BAR_BOOT1_STDALONE_PROGRESS 0x420
  78. #define BOOT1_STDALONE_SUCCESS (BIT(13) | BIT(14))
  79. #define BOOT1_STDALONE_PROGRESS_MASK BOOT1_STDALONE_SUCCESS
  80. #define BAR_METADATA_VERSION 0x440
  81. #define BAR_OS_UPTIME 0x444
  82. #define BAR_CHIP_ID 0x448
  83. #define MAJOR_SOC_REV(_chip_id) (((_chip_id) >> 20) & 0xf)
  84. #define BAR_CARD_TEMPERATURE 0x45c
  85. /* defines for all temperature sensor */
  86. #define BCM_VK_TEMP_FIELD_MASK 0xff
  87. #define BCM_VK_CPU_TEMP_SHIFT 0
  88. #define BCM_VK_DDR0_TEMP_SHIFT 8
  89. #define BCM_VK_DDR1_TEMP_SHIFT 16
  90. #define BAR_CARD_VOLTAGE 0x460
  91. /* defines for voltage rail conversion */
  92. #define BCM_VK_VOLT_RAIL_MASK 0xffff
  93. #define BCM_VK_3P3_VOLT_REG_SHIFT 16
  94. #define BAR_CARD_ERR_LOG 0x464
  95. /* Error log register bit definition - register for error alerts */
  96. #define ERR_LOG_UECC BIT(0)
  97. #define ERR_LOG_SSIM_BUSY BIT(1)
  98. #define ERR_LOG_AFBC_BUSY BIT(2)
  99. #define ERR_LOG_HIGH_TEMP_ERR BIT(3)
  100. #define ERR_LOG_WDOG_TIMEOUT BIT(4)
  101. #define ERR_LOG_SYS_FAULT BIT(5)
  102. #define ERR_LOG_RAMDUMP BIT(6)
  103. #define ERR_LOG_COP_WDOG_TIMEOUT BIT(7)
  104. /* warnings */
  105. #define ERR_LOG_MEM_ALLOC_FAIL BIT(8)
  106. #define ERR_LOG_LOW_TEMP_WARN BIT(9)
  107. #define ERR_LOG_ECC BIT(10)
  108. #define ERR_LOG_IPC_DWN BIT(11)
  109. /* Alert bit definitions detectd on host */
  110. #define ERR_LOG_HOST_INTF_V_FAIL BIT(13)
  111. #define ERR_LOG_HOST_HB_FAIL BIT(14)
  112. #define ERR_LOG_HOST_PCIE_DWN BIT(15)
  113. #define BAR_CARD_ERR_MEM 0x468
  114. /* defines for mem err, all fields have same width */
  115. #define BCM_VK_MEM_ERR_FIELD_MASK 0xff
  116. #define BCM_VK_ECC_MEM_ERR_SHIFT 0
  117. #define BCM_VK_UECC_MEM_ERR_SHIFT 8
  118. /* threshold of event occurrence and logs start to come out */
  119. #define BCM_VK_ECC_THRESHOLD 10
  120. #define BCM_VK_UECC_THRESHOLD 1
  121. #define BAR_CARD_PWR_AND_THRE 0x46c
  122. /* defines for power and temp threshold, all fields have same width */
  123. #define BCM_VK_PWR_AND_THRE_FIELD_MASK 0xff
  124. #define BCM_VK_LOW_TEMP_THRE_SHIFT 0
  125. #define BCM_VK_HIGH_TEMP_THRE_SHIFT 8
  126. #define BCM_VK_PWR_STATE_SHIFT 16
  127. #define BAR_CARD_STATIC_INFO 0x470
  128. #define BAR_INTF_VER 0x47c
  129. #define BAR_INTF_VER_MAJOR_SHIFT 16
  130. #define BAR_INTF_VER_MASK 0xffff
  131. /*
  132. * major and minor semantic version numbers supported
  133. * Please update as required on interface changes
  134. */
  135. #define SEMANTIC_MAJOR 1
  136. #define SEMANTIC_MINOR 0
  137. /*
  138. * first door bell reg, ie for queue = 0. Only need the first one, as
  139. * we will use the queue number to derive the others
  140. */
  141. #define VK_BAR0_REGSEG_DB_BASE 0x484
  142. #define VK_BAR0_REGSEG_DB_REG_GAP 8 /*
  143. * DB register gap,
  144. * DB1 at 0x48c and DB2 at 0x494
  145. */
  146. /* reset register and specific values */
  147. #define VK_BAR0_RESET_DB_NUM 3
  148. #define VK_BAR0_RESET_DB_SOFT 0xffffffff
  149. #define VK_BAR0_RESET_DB_HARD 0xfffffffd
  150. #define VK_BAR0_RESET_RAMPDUMP 0xa0000000
  151. #define VK_BAR0_Q_DB_BASE(q_num) (VK_BAR0_REGSEG_DB_BASE + \
  152. ((q_num) * VK_BAR0_REGSEG_DB_REG_GAP))
  153. #define VK_BAR0_RESET_DB_BASE (VK_BAR0_REGSEG_DB_BASE + \
  154. (VK_BAR0_RESET_DB_NUM * VK_BAR0_REGSEG_DB_REG_GAP))
  155. #define BAR_BOOTSRC_SELECT 0xc78
  156. /* BOOTSRC definitions */
  157. #define BOOTSRC_SOFT_ENABLE BIT(14)
  158. /* Card OS Firmware version size */
  159. #define BAR_FIRMWARE_TAG_SIZE 50
  160. #define FIRMWARE_STATUS_PRE_INIT_DONE 0x1f
  161. /* VK MSG_ID defines */
  162. #define VK_MSG_ID_BITMAP_SIZE 4096
  163. #define VK_MSG_ID_BITMAP_MASK (VK_MSG_ID_BITMAP_SIZE - 1)
  164. #define VK_MSG_ID_OVERFLOW 0xffff
  165. /*
  166. * BAR1
  167. */
  168. /* BAR1 message q definition */
  169. /* indicate if msgq ctrl in BAR1 is populated */
  170. #define VK_BAR1_MSGQ_DEF_RDY 0x60c0
  171. /* ready marker value for the above location, normal boot2 */
  172. #define VK_BAR1_MSGQ_RDY_MARKER 0xbeefcafe
  173. /* ready marker value for the above location, normal boot2 */
  174. #define VK_BAR1_DIAG_RDY_MARKER 0xdeadcafe
  175. /* number of msgqs in BAR1 */
  176. #define VK_BAR1_MSGQ_NR 0x60c4
  177. /* BAR1 queue control structure offset */
  178. #define VK_BAR1_MSGQ_CTRL_OFF 0x60c8
  179. /* BAR1 ucode and boot1 version tag */
  180. #define VK_BAR1_UCODE_VER_TAG 0x6170
  181. #define VK_BAR1_BOOT1_VER_TAG 0x61b0
  182. #define VK_BAR1_VER_TAG_SIZE 64
  183. /* Memory to hold the DMA buffer memory address allocated for boot2 download */
  184. #define VK_BAR1_DMA_BUF_OFF_HI 0x61e0
  185. #define VK_BAR1_DMA_BUF_OFF_LO (VK_BAR1_DMA_BUF_OFF_HI + 4)
  186. #define VK_BAR1_DMA_BUF_SZ (VK_BAR1_DMA_BUF_OFF_HI + 8)
  187. /* Scratch memory allocated on host for VK */
  188. #define VK_BAR1_SCRATCH_OFF_HI 0x61f0
  189. #define VK_BAR1_SCRATCH_OFF_LO (VK_BAR1_SCRATCH_OFF_HI + 4)
  190. #define VK_BAR1_SCRATCH_SZ_ADDR (VK_BAR1_SCRATCH_OFF_HI + 8)
  191. #define VK_BAR1_SCRATCH_DEF_NR_PAGES 32
  192. /* BAR1 DAUTH info */
  193. #define VK_BAR1_DAUTH_BASE_ADDR 0x6200
  194. #define VK_BAR1_DAUTH_STORE_SIZE 0x48
  195. #define VK_BAR1_DAUTH_VALID_SIZE 0x8
  196. #define VK_BAR1_DAUTH_MAX 4
  197. #define VK_BAR1_DAUTH_STORE_ADDR(x) \
  198. (VK_BAR1_DAUTH_BASE_ADDR + \
  199. (x) * (VK_BAR1_DAUTH_STORE_SIZE + VK_BAR1_DAUTH_VALID_SIZE))
  200. #define VK_BAR1_DAUTH_VALID_ADDR(x) \
  201. (VK_BAR1_DAUTH_STORE_ADDR(x) + VK_BAR1_DAUTH_STORE_SIZE)
  202. /* BAR1 SOTP AUTH and REVID info */
  203. #define VK_BAR1_SOTP_REVID_BASE_ADDR 0x6340
  204. #define VK_BAR1_SOTP_REVID_SIZE 0x10
  205. #define VK_BAR1_SOTP_REVID_MAX 2
  206. #define VK_BAR1_SOTP_REVID_ADDR(x) \
  207. (VK_BAR1_SOTP_REVID_BASE_ADDR + (x) * VK_BAR1_SOTP_REVID_SIZE)
  208. /* VK device supports a maximum of 3 bars */
  209. #define MAX_BAR 3
  210. /* default number of msg blk for inband SGL */
  211. #define BCM_VK_DEF_IB_SGL_BLK_LEN 16
  212. #define BCM_VK_IB_SGL_BLK_MAX 24
  213. enum pci_barno {
  214. BAR_0 = 0,
  215. BAR_1,
  216. BAR_2
  217. };
  218. #ifdef CONFIG_BCM_VK_TTY
  219. #define BCM_VK_NUM_TTY 2
  220. #else
  221. #define BCM_VK_NUM_TTY 0
  222. #endif
  223. struct bcm_vk_tty {
  224. struct tty_port port;
  225. u32 to_offset; /* bar offset to use */
  226. u32 to_size; /* to VK buffer size */
  227. u32 wr; /* write offset shadow */
  228. u32 from_offset; /* bar offset to use */
  229. u32 from_size; /* from VK buffer size */
  230. u32 rd; /* read offset shadow */
  231. pid_t pid;
  232. bool irq_enabled;
  233. bool is_opened; /* tracks tty open/close */
  234. };
  235. /* VK device max power state, supports 3, full, reduced and low */
  236. #define MAX_OPP 3
  237. #define MAX_CARD_INFO_TAG_SIZE 64
  238. struct bcm_vk_card_info {
  239. u32 version;
  240. char os_tag[MAX_CARD_INFO_TAG_SIZE];
  241. char cmpt_tag[MAX_CARD_INFO_TAG_SIZE];
  242. u32 cpu_freq_mhz;
  243. u32 cpu_scale[MAX_OPP];
  244. u32 ddr_freq_mhz;
  245. u32 ddr_size_MB;
  246. u32 video_core_freq_mhz;
  247. };
  248. /* DAUTH related info */
  249. struct bcm_vk_dauth_key {
  250. char store[VK_BAR1_DAUTH_STORE_SIZE];
  251. char valid[VK_BAR1_DAUTH_VALID_SIZE];
  252. };
  253. struct bcm_vk_dauth_info {
  254. struct bcm_vk_dauth_key keys[VK_BAR1_DAUTH_MAX];
  255. };
  256. /*
  257. * Control structure of logging messages from the card. This
  258. * buffer is for logmsg that comes from vk
  259. */
  260. struct bcm_vk_peer_log {
  261. u32 rd_idx;
  262. u32 wr_idx;
  263. u32 buf_size;
  264. u32 mask;
  265. char data[];
  266. };
  267. /* max buf size allowed */
  268. #define BCM_VK_PEER_LOG_BUF_MAX SZ_16K
  269. /* max size per line of peer log */
  270. #define BCM_VK_PEER_LOG_LINE_MAX 256
  271. /*
  272. * single entry for processing type + utilization
  273. */
  274. #define BCM_VK_PROC_TYPE_TAG_LEN 8
  275. struct bcm_vk_proc_mon_entry_t {
  276. char tag[BCM_VK_PROC_TYPE_TAG_LEN];
  277. u32 used;
  278. u32 max; /**< max capacity */
  279. };
  280. /**
  281. * Structure for run time utilization
  282. */
  283. #define BCM_VK_PROC_MON_MAX 8 /* max entries supported */
  284. struct bcm_vk_proc_mon_info {
  285. u32 num; /**< no of entries */
  286. u32 entry_size; /**< per entry size */
  287. struct bcm_vk_proc_mon_entry_t entries[BCM_VK_PROC_MON_MAX];
  288. };
  289. struct bcm_vk_hb_ctrl {
  290. struct timer_list timer;
  291. u32 last_uptime;
  292. u32 lost_cnt;
  293. };
  294. struct bcm_vk_alert {
  295. u16 flags;
  296. u16 notfs;
  297. };
  298. /* some alert counters that the driver will keep track */
  299. struct bcm_vk_alert_cnts {
  300. u16 ecc;
  301. u16 uecc;
  302. };
  303. struct bcm_vk {
  304. struct pci_dev *pdev;
  305. void __iomem *bar[MAX_BAR];
  306. int num_irqs;
  307. struct bcm_vk_card_info card_info;
  308. struct bcm_vk_proc_mon_info proc_mon_info;
  309. struct bcm_vk_dauth_info dauth_info;
  310. /* mutex to protect the ioctls */
  311. struct mutex mutex;
  312. struct miscdevice miscdev;
  313. int devid; /* dev id allocated */
  314. #ifdef CONFIG_BCM_VK_TTY
  315. struct tty_driver *tty_drv;
  316. struct timer_list serial_timer;
  317. struct bcm_vk_tty tty[BCM_VK_NUM_TTY];
  318. struct workqueue_struct *tty_wq_thread;
  319. struct work_struct tty_wq_work;
  320. #endif
  321. /* Reference-counting to handle file operations */
  322. struct kref kref;
  323. spinlock_t msg_id_lock; /* Spinlock for msg_id */
  324. u16 msg_id;
  325. DECLARE_BITMAP(bmap, VK_MSG_ID_BITMAP_SIZE);
  326. spinlock_t ctx_lock; /* Spinlock for component context */
  327. struct bcm_vk_ctx ctx[VK_CMPT_CTX_MAX];
  328. struct bcm_vk_ht_entry pid_ht[VK_PID_HT_SZ];
  329. pid_t reset_pid; /* process that issue reset */
  330. atomic_t msgq_inited; /* indicate if info has been synced with vk */
  331. struct bcm_vk_msg_chan to_v_msg_chan;
  332. struct bcm_vk_msg_chan to_h_msg_chan;
  333. struct workqueue_struct *wq_thread;
  334. struct work_struct wq_work; /* work queue for deferred job */
  335. unsigned long wq_offload[1]; /* various flags on wq requested */
  336. void *tdma_vaddr; /* test dma segment virtual addr */
  337. dma_addr_t tdma_addr; /* test dma segment bus addr */
  338. struct notifier_block panic_nb;
  339. u32 ib_sgl_size; /* size allocated for inband sgl insertion */
  340. /* heart beat mechanism control structure */
  341. struct bcm_vk_hb_ctrl hb_ctrl;
  342. /* house-keeping variable of error logs */
  343. spinlock_t host_alert_lock; /* protection to access host_alert struct */
  344. struct bcm_vk_alert host_alert;
  345. struct bcm_vk_alert peer_alert; /* bits set by the card */
  346. struct bcm_vk_alert_cnts alert_cnts;
  347. /* offset of the peer log control in BAR2 */
  348. u32 peerlog_off;
  349. struct bcm_vk_peer_log peerlog_info; /* record of peer log info */
  350. /* offset of processing monitoring info in BAR2 */
  351. u32 proc_mon_off;
  352. };
  353. /* wq offload work items bits definitions */
  354. enum bcm_vk_wq_offload_flags {
  355. BCM_VK_WQ_DWNLD_PEND = 0,
  356. BCM_VK_WQ_DWNLD_AUTO = 1,
  357. BCM_VK_WQ_NOTF_PEND = 2,
  358. };
  359. /* a macro to get an individual field with mask and shift */
  360. #define BCM_VK_EXTRACT_FIELD(_field, _reg, _mask, _shift) \
  361. (_field = (((_reg) >> (_shift)) & (_mask)))
  362. struct bcm_vk_entry {
  363. const u32 mask;
  364. const u32 exp_val;
  365. const char *str;
  366. };
  367. /* alerts that could be generated from peer */
  368. #define BCM_VK_PEER_ERR_NUM 12
  369. extern struct bcm_vk_entry const bcm_vk_peer_err[BCM_VK_PEER_ERR_NUM];
  370. /* alerts detected by the host */
  371. #define BCM_VK_HOST_ERR_NUM 3
  372. extern struct bcm_vk_entry const bcm_vk_host_err[BCM_VK_HOST_ERR_NUM];
  373. /*
  374. * check if PCIe interface is down on read. Use it when it is
  375. * certain that _val should never be all ones.
  376. */
  377. #define BCM_VK_INTF_IS_DOWN(val) ((val) == 0xffffffff)
  378. static inline u32 vkread32(struct bcm_vk *vk, enum pci_barno bar, u64 offset)
  379. {
  380. return readl(vk->bar[bar] + offset);
  381. }
  382. static inline void vkwrite32(struct bcm_vk *vk,
  383. u32 value,
  384. enum pci_barno bar,
  385. u64 offset)
  386. {
  387. writel(value, vk->bar[bar] + offset);
  388. }
  389. static inline u8 vkread8(struct bcm_vk *vk, enum pci_barno bar, u64 offset)
  390. {
  391. return readb(vk->bar[bar] + offset);
  392. }
  393. static inline void vkwrite8(struct bcm_vk *vk,
  394. u8 value,
  395. enum pci_barno bar,
  396. u64 offset)
  397. {
  398. writeb(value, vk->bar[bar] + offset);
  399. }
  400. static inline bool bcm_vk_msgq_marker_valid(struct bcm_vk *vk)
  401. {
  402. u32 rdy_marker = 0;
  403. u32 fw_status;
  404. fw_status = vkread32(vk, BAR_0, VK_BAR_FWSTS);
  405. if ((fw_status & VK_FWSTS_READY) == VK_FWSTS_READY)
  406. rdy_marker = vkread32(vk, BAR_1, VK_BAR1_MSGQ_DEF_RDY);
  407. return (rdy_marker == VK_BAR1_MSGQ_RDY_MARKER);
  408. }
  409. int bcm_vk_open(struct inode *inode, struct file *p_file);
  410. ssize_t bcm_vk_read(struct file *p_file, char __user *buf, size_t count,
  411. loff_t *f_pos);
  412. ssize_t bcm_vk_write(struct file *p_file, const char __user *buf,
  413. size_t count, loff_t *f_pos);
  414. __poll_t bcm_vk_poll(struct file *p_file, struct poll_table_struct *wait);
  415. int bcm_vk_release(struct inode *inode, struct file *p_file);
  416. void bcm_vk_release_data(struct kref *kref);
  417. irqreturn_t bcm_vk_msgq_irqhandler(int irq, void *dev_id);
  418. irqreturn_t bcm_vk_notf_irqhandler(int irq, void *dev_id);
  419. irqreturn_t bcm_vk_tty_irqhandler(int irq, void *dev_id);
  420. int bcm_vk_msg_init(struct bcm_vk *vk);
  421. void bcm_vk_msg_remove(struct bcm_vk *vk);
  422. void bcm_vk_drain_msg_on_reset(struct bcm_vk *vk);
  423. int bcm_vk_sync_msgq(struct bcm_vk *vk, bool force_sync);
  424. void bcm_vk_blk_drv_access(struct bcm_vk *vk);
  425. s32 bcm_to_h_msg_dequeue(struct bcm_vk *vk);
  426. int bcm_vk_send_shutdown_msg(struct bcm_vk *vk, u32 shut_type,
  427. const pid_t pid, const u32 q_num);
  428. void bcm_to_v_q_doorbell(struct bcm_vk *vk, u32 q_num, u32 db_val);
  429. int bcm_vk_auto_load_all_images(struct bcm_vk *vk);
  430. void bcm_vk_hb_init(struct bcm_vk *vk);
  431. void bcm_vk_hb_deinit(struct bcm_vk *vk);
  432. void bcm_vk_handle_notf(struct bcm_vk *vk);
  433. bool bcm_vk_drv_access_ok(struct bcm_vk *vk);
  434. void bcm_vk_set_host_alert(struct bcm_vk *vk, u32 bit_mask);
  435. #ifdef CONFIG_BCM_VK_TTY
  436. int bcm_vk_tty_init(struct bcm_vk *vk, char *name);
  437. void bcm_vk_tty_exit(struct bcm_vk *vk);
  438. void bcm_vk_tty_terminate_tty_user(struct bcm_vk *vk);
  439. void bcm_vk_tty_wq_exit(struct bcm_vk *vk);
  440. static inline void bcm_vk_tty_set_irq_enabled(struct bcm_vk *vk, int index)
  441. {
  442. vk->tty[index].irq_enabled = true;
  443. }
  444. #else
  445. static inline int bcm_vk_tty_init(struct bcm_vk *vk, char *name)
  446. {
  447. return 0;
  448. }
  449. static inline void bcm_vk_tty_exit(struct bcm_vk *vk)
  450. {
  451. }
  452. static inline void bcm_vk_tty_terminate_tty_user(struct bcm_vk *vk)
  453. {
  454. }
  455. static inline void bcm_vk_tty_wq_exit(struct bcm_vk *vk)
  456. {
  457. }
  458. static inline void bcm_vk_tty_set_irq_enabled(struct bcm_vk *vk, int index)
  459. {
  460. }
  461. #endif /* CONFIG_BCM_VK_TTY */
  462. #endif