diff options
Diffstat (limited to 'include/nvgpu/flcnif_cmn.h')
-rw-r--r-- | include/nvgpu/flcnif_cmn.h | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/include/nvgpu/flcnif_cmn.h b/include/nvgpu/flcnif_cmn.h new file mode 100644 index 0000000..273da1e --- /dev/null +++ b/include/nvgpu/flcnif_cmn.h | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | * DEALINGS IN THE SOFTWARE. | ||
21 | */ | ||
22 | |||
23 | #ifndef NVGPU_FLCNIF_CMN_H | ||
24 | #define NVGPU_FLCNIF_CMN_H | ||
25 | |||
26 | #define PMU_CMD_SUBMIT_PAYLOAD_PARAMS_FB_SIZE_UNUSED 0 | ||
27 | |||
28 | struct falc_u64 { | ||
29 | u32 lo; | ||
30 | u32 hi; | ||
31 | }; | ||
32 | |||
33 | struct falc_dma_addr { | ||
34 | u32 dma_base; | ||
35 | /* | ||
36 | * dma_base1 is 9-bit MSB for FB Base | ||
37 | * address for the transfer in FB after | ||
38 | * address using 49b FB address | ||
39 | */ | ||
40 | u16 dma_base1; | ||
41 | u8 dma_offset; | ||
42 | }; | ||
43 | |||
44 | struct pmu_mem_v1 { | ||
45 | u32 dma_base; | ||
46 | u8 dma_offset; | ||
47 | u8 dma_idx; | ||
48 | u16 fb_size; | ||
49 | }; | ||
50 | |||
51 | struct pmu_mem_desc_v0 { | ||
52 | struct falc_u64 dma_addr; | ||
53 | u16 dma_sizemax; | ||
54 | u8 dma_idx; | ||
55 | }; | ||
56 | |||
57 | struct pmu_dmem { | ||
58 | u16 size; | ||
59 | u32 offset; | ||
60 | }; | ||
61 | |||
62 | struct flcn_mem_desc_v0 { | ||
63 | struct falc_u64 address; | ||
64 | u32 params; | ||
65 | }; | ||
66 | |||
67 | #define nv_flcn_mem_desc flcn_mem_desc_v0 | ||
68 | |||
69 | struct pmu_allocation_v1 { | ||
70 | struct { | ||
71 | struct pmu_dmem dmem; | ||
72 | struct pmu_mem_v1 fb; | ||
73 | } alloc; | ||
74 | }; | ||
75 | |||
76 | struct pmu_allocation_v2 { | ||
77 | struct { | ||
78 | struct pmu_dmem dmem; | ||
79 | struct pmu_mem_desc_v0 fb; | ||
80 | } alloc; | ||
81 | }; | ||
82 | |||
83 | struct pmu_allocation_v3 { | ||
84 | struct { | ||
85 | struct pmu_dmem dmem; | ||
86 | struct flcn_mem_desc_v0 fb; | ||
87 | } alloc; | ||
88 | }; | ||
89 | |||
90 | #define nv_pmu_allocation pmu_allocation_v3 | ||
91 | |||
92 | struct pmu_hdr { | ||
93 | u8 unit_id; | ||
94 | u8 size; | ||
95 | u8 ctrl_flags; | ||
96 | u8 seq_id; | ||
97 | }; | ||
98 | |||
99 | #define NV_FLCN_UNIT_ID_REWIND (0x00U) | ||
100 | |||
101 | #define PMU_MSG_HDR_SIZE sizeof(struct pmu_hdr) | ||
102 | #define PMU_CMD_HDR_SIZE sizeof(struct pmu_hdr) | ||
103 | |||
104 | #define nv_pmu_hdr pmu_hdr | ||
105 | typedef u8 flcn_status; | ||
106 | |||
107 | #define PMU_DMEM_ALLOC_ALIGNMENT (32) | ||
108 | #define PMU_DMEM_ALIGNMENT (4) | ||
109 | |||
110 | #define PMU_CMD_FLAGS_PMU_MASK (0xF0) | ||
111 | |||
112 | #define PMU_CMD_FLAGS_STATUS BIT(0) | ||
113 | #define PMU_CMD_FLAGS_INTR BIT(1) | ||
114 | #define PMU_CMD_FLAGS_EVENT BIT(2) | ||
115 | #define PMU_CMD_FLAGS_WATERMARK BIT(3) | ||
116 | |||
117 | #define ALIGN_UP(v, gran) (((v) + ((gran) - 1)) & ~((gran)-1)) | ||
118 | |||
119 | #define NV_UNSIGNED_ROUNDED_DIV(a, b) (((a) + ((b) / 2)) / (b)) | ||
120 | |||
121 | #endif /* NVGPU_FLCNIF_CMN_H */ | ||