ivpu_fw.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2020-2025 Intel Corporation
  4. */
  5. #ifndef __IVPU_FW_H__
  6. #define __IVPU_FW_H__
  7. #include "vpu_boot_api.h"
  8. #include "vpu_jsm_api.h"
  9. #define FW_VERSION_HEADER_SIZE SZ_4K
  10. #define FW_VERSION_STR_SIZE SZ_256
  11. struct ivpu_device;
  12. struct ivpu_bo;
  13. struct vpu_boot_params;
  14. struct ivpu_fw_info {
  15. const struct firmware *file;
  16. const char *name;
  17. char version[FW_VERSION_STR_SIZE];
  18. struct ivpu_bo *mem_bp;
  19. struct ivpu_bo *mem_fw_ver;
  20. struct ivpu_bo *mem;
  21. struct ivpu_bo *mem_shave_nn;
  22. struct ivpu_bo *mem_log_crit;
  23. struct ivpu_bo *mem_log_verb;
  24. u64 boot_params_addr;
  25. u64 boot_params_size;
  26. u64 fw_version_addr;
  27. u64 fw_version_size;
  28. u64 runtime_addr;
  29. u32 runtime_size;
  30. u64 image_load_offset;
  31. u32 image_size;
  32. u32 shave_nn_size;
  33. u64 warm_boot_entry_point;
  34. u64 cold_boot_entry_point;
  35. u8 last_boot_mode;
  36. u8 next_boot_mode;
  37. u32 trace_level;
  38. u32 trace_destination_mask;
  39. u64 trace_hw_component_mask;
  40. u32 dvfs_mode;
  41. u32 primary_preempt_buf_size;
  42. u32 secondary_preempt_buf_size;
  43. u64 read_only_addr;
  44. u32 read_only_size;
  45. u32 sched_mode;
  46. u64 last_heartbeat;
  47. };
  48. bool ivpu_is_within_range(u64 addr, size_t size, struct ivpu_addr_range *range);
  49. int ivpu_fw_init(struct ivpu_device *vdev);
  50. void ivpu_fw_fini(struct ivpu_device *vdev);
  51. void ivpu_fw_load(struct ivpu_device *vdev);
  52. void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params *boot_params);
  53. static inline bool ivpu_fw_is_warm_boot(struct ivpu_device *vdev)
  54. {
  55. return vdev->fw->next_boot_mode == VPU_BOOT_TYPE_WARMBOOT;
  56. }
  57. static inline u32 ivpu_fw_preempt_buf_size(struct ivpu_device *vdev)
  58. {
  59. return vdev->fw->primary_preempt_buf_size + vdev->fw->secondary_preempt_buf_size;
  60. }
  61. #endif /* __IVPU_FW_H__ */