xref: /linux/drivers/gpu/drm/imagination/pvr_rogue_fwif_shared_check.h (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1 /* SPDX-License-Identifier: GPL-2.0-only OR MIT */
2 /* Copyright (c) 2023 Imagination Technologies Ltd. */
3 
4 #ifndef PVR_ROGUE_FWIF_SHARED_CHECK_H
5 #define PVR_ROGUE_FWIF_SHARED_CHECK_H
6 
7 #include <linux/build_bug.h>
8 
9 #define OFFSET_CHECK(type, member, offset) \
10 	static_assert(offsetof(type, member) == (offset), \
11 		      "offsetof(" #type ", " #member ") incorrect")
12 
13 #define SIZE_CHECK(type, size) \
14 	static_assert(sizeof(type) == (size), #type " is incorrect size")
15 
16 OFFSET_CHECK(struct rogue_fwif_dma_addr, dev_addr, 0);
17 OFFSET_CHECK(struct rogue_fwif_dma_addr, fw_addr, 8);
18 SIZE_CHECK(struct rogue_fwif_dma_addr, 16);
19 
20 OFFSET_CHECK(struct rogue_fwif_ufo, addr, 0);
21 OFFSET_CHECK(struct rogue_fwif_ufo, value, 4);
22 SIZE_CHECK(struct rogue_fwif_ufo, 8);
23 
24 OFFSET_CHECK(struct rogue_fwif_cleanup_ctl, submitted_commands, 0);
25 OFFSET_CHECK(struct rogue_fwif_cleanup_ctl, executed_commands, 4);
26 SIZE_CHECK(struct rogue_fwif_cleanup_ctl, 8);
27 
28 OFFSET_CHECK(struct rogue_fwif_cccb_ctl, write_offset, 0);
29 OFFSET_CHECK(struct rogue_fwif_cccb_ctl, read_offset, 4);
30 OFFSET_CHECK(struct rogue_fwif_cccb_ctl, dep_offset, 8);
31 OFFSET_CHECK(struct rogue_fwif_cccb_ctl, wrap_mask, 12);
32 OFFSET_CHECK(struct rogue_fwif_cccb_ctl, read_offset2, 16);
33 OFFSET_CHECK(struct rogue_fwif_cccb_ctl, read_offset3, 20);
34 OFFSET_CHECK(struct rogue_fwif_cccb_ctl, read_offset4, 24);
35 SIZE_CHECK(struct rogue_fwif_cccb_ctl, 32);
36 
37 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
38 	     geom_reg_vdm_context_state_base_addr, 0);
39 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
40 	     geom_reg_vdm_context_state_resume_addr, 8);
41 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
42 	     geom_reg_ta_context_state_base_addr, 16);
43 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
44 	     geom_state[0].geom_reg_vdm_context_store_task0, 24);
45 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
46 	     geom_state[0].geom_reg_vdm_context_store_task1, 32);
47 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
48 	     geom_state[0].geom_reg_vdm_context_store_task2, 40);
49 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
50 	     geom_state[0].geom_reg_vdm_context_resume_task0, 48);
51 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
52 	     geom_state[0].geom_reg_vdm_context_resume_task1, 56);
53 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
54 	     geom_state[0].geom_reg_vdm_context_resume_task2, 64);
55 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
56 	     geom_state[0].geom_reg_vdm_context_store_task3, 72);
57 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
58 	     geom_state[0].geom_reg_vdm_context_store_task4, 80);
59 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
60 	     geom_state[0].geom_reg_vdm_context_resume_task3, 88);
61 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
62 	     geom_state[0].geom_reg_vdm_context_resume_task4, 96);
63 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
64 	     geom_state[1].geom_reg_vdm_context_store_task0, 104);
65 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
66 	     geom_state[1].geom_reg_vdm_context_store_task1, 112);
67 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
68 	     geom_state[1].geom_reg_vdm_context_store_task2, 120);
69 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
70 	     geom_state[1].geom_reg_vdm_context_resume_task0, 128);
71 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
72 	     geom_state[1].geom_reg_vdm_context_resume_task1, 136);
73 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
74 	     geom_state[1].geom_reg_vdm_context_resume_task2, 144);
75 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
76 	     geom_state[1].geom_reg_vdm_context_store_task3, 152);
77 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
78 	     geom_state[1].geom_reg_vdm_context_store_task4, 160);
79 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
80 	     geom_state[1].geom_reg_vdm_context_resume_task3, 168);
81 OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
82 	     geom_state[1].geom_reg_vdm_context_resume_task4, 176);
83 SIZE_CHECK(struct rogue_fwif_geom_registers_caswitch, 184);
84 
85 OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_context_pds0, 0);
86 OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_context_pds1, 8);
87 OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_terminate_pds, 16);
88 OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_terminate_pds1, 24);
89 OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_resume_pds0, 32);
90 OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_context_pds0_b, 40);
91 OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_resume_pds0_b, 48);
92 SIZE_CHECK(struct rogue_fwif_cdm_registers_cswitch, 56);
93 
94 OFFSET_CHECK(struct rogue_fwif_static_rendercontext_state, ctxswitch_regs, 0);
95 SIZE_CHECK(struct rogue_fwif_static_rendercontext_state, 368);
96 
97 OFFSET_CHECK(struct rogue_fwif_static_computecontext_state, ctxswitch_regs, 0);
98 SIZE_CHECK(struct rogue_fwif_static_computecontext_state, 56);
99 
100 OFFSET_CHECK(struct rogue_fwif_cmd_common, frame_num, 0);
101 SIZE_CHECK(struct rogue_fwif_cmd_common, 4);
102 
103 OFFSET_CHECK(struct rogue_fwif_cmd_geom_frag_shared, cmn, 0);
104 OFFSET_CHECK(struct rogue_fwif_cmd_geom_frag_shared, hwrt_data_fw_addr, 4);
105 OFFSET_CHECK(struct rogue_fwif_cmd_geom_frag_shared, pr_buffer_fw_addr, 8);
106 SIZE_CHECK(struct rogue_fwif_cmd_geom_frag_shared, 16);
107 
108 #endif /* PVR_ROGUE_FWIF_SHARED_CHECK_H */
109