xref: /dflybsd-src/sys/dev/drm/amd/include/cgs_common.h (revision c59a5c484fdf34b9afa6e283014e4fff693253cc)
1*c59a5c48SFrançois Tigeot /*
2*c59a5c48SFrançois Tigeot  * Copyright 2015 Advanced Micro Devices, Inc.
3*c59a5c48SFrançois Tigeot  *
4*c59a5c48SFrançois Tigeot  * Permission is hereby granted, free of charge, to any person obtaining a
5*c59a5c48SFrançois Tigeot  * copy of this software and associated documentation files (the "Software"),
6*c59a5c48SFrançois Tigeot  * to deal in the Software without restriction, including without limitation
7*c59a5c48SFrançois Tigeot  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*c59a5c48SFrançois Tigeot  * and/or sell copies of the Software, and to permit persons to whom the
9*c59a5c48SFrançois Tigeot  * Software is furnished to do so, subject to the following conditions:
10*c59a5c48SFrançois Tigeot  *
11*c59a5c48SFrançois Tigeot  * The above copyright notice and this permission notice shall be included in
12*c59a5c48SFrançois Tigeot  * all copies or substantial portions of the Software.
13*c59a5c48SFrançois Tigeot  *
14*c59a5c48SFrançois Tigeot  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*c59a5c48SFrançois Tigeot  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*c59a5c48SFrançois Tigeot  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*c59a5c48SFrançois Tigeot  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*c59a5c48SFrançois Tigeot  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*c59a5c48SFrançois Tigeot  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*c59a5c48SFrançois Tigeot  * OTHER DEALINGS IN THE SOFTWARE.
21*c59a5c48SFrançois Tigeot  *
22*c59a5c48SFrançois Tigeot  *
23*c59a5c48SFrançois Tigeot  */
24*c59a5c48SFrançois Tigeot #ifndef _CGS_COMMON_H
25*c59a5c48SFrançois Tigeot #define _CGS_COMMON_H
26*c59a5c48SFrançois Tigeot 
27*c59a5c48SFrançois Tigeot #include "amd_shared.h"
28*c59a5c48SFrançois Tigeot 
29*c59a5c48SFrançois Tigeot /**
30*c59a5c48SFrançois Tigeot  * enum cgs_gpu_mem_type - GPU memory types
31*c59a5c48SFrançois Tigeot  */
32*c59a5c48SFrançois Tigeot enum cgs_gpu_mem_type {
33*c59a5c48SFrançois Tigeot 	CGS_GPU_MEM_TYPE__VISIBLE_FB,
34*c59a5c48SFrançois Tigeot 	CGS_GPU_MEM_TYPE__INVISIBLE_FB,
35*c59a5c48SFrançois Tigeot 	CGS_GPU_MEM_TYPE__VISIBLE_CONTIG_FB,
36*c59a5c48SFrançois Tigeot 	CGS_GPU_MEM_TYPE__INVISIBLE_CONTIG_FB,
37*c59a5c48SFrançois Tigeot 	CGS_GPU_MEM_TYPE__GART_CACHEABLE,
38*c59a5c48SFrançois Tigeot 	CGS_GPU_MEM_TYPE__GART_WRITECOMBINE
39*c59a5c48SFrançois Tigeot };
40*c59a5c48SFrançois Tigeot 
41*c59a5c48SFrançois Tigeot /**
42*c59a5c48SFrançois Tigeot  * enum cgs_ind_reg - Indirect register spaces
43*c59a5c48SFrançois Tigeot  */
44*c59a5c48SFrançois Tigeot enum cgs_ind_reg {
45*c59a5c48SFrançois Tigeot 	CGS_IND_REG__MMIO,
46*c59a5c48SFrançois Tigeot 	CGS_IND_REG__PCIE,
47*c59a5c48SFrançois Tigeot 	CGS_IND_REG__SMC,
48*c59a5c48SFrançois Tigeot 	CGS_IND_REG__UVD_CTX,
49*c59a5c48SFrançois Tigeot 	CGS_IND_REG__DIDT,
50*c59a5c48SFrançois Tigeot 	CGS_IND_REG__AUDIO_ENDPT
51*c59a5c48SFrançois Tigeot };
52*c59a5c48SFrançois Tigeot 
53*c59a5c48SFrançois Tigeot /**
54*c59a5c48SFrançois Tigeot  * enum cgs_clock - Clocks controlled by the SMU
55*c59a5c48SFrançois Tigeot  */
56*c59a5c48SFrançois Tigeot enum cgs_clock {
57*c59a5c48SFrançois Tigeot 	CGS_CLOCK__SCLK,
58*c59a5c48SFrançois Tigeot 	CGS_CLOCK__MCLK,
59*c59a5c48SFrançois Tigeot 	CGS_CLOCK__VCLK,
60*c59a5c48SFrançois Tigeot 	CGS_CLOCK__DCLK,
61*c59a5c48SFrançois Tigeot 	CGS_CLOCK__ECLK,
62*c59a5c48SFrançois Tigeot 	CGS_CLOCK__ACLK,
63*c59a5c48SFrançois Tigeot 	CGS_CLOCK__ICLK,
64*c59a5c48SFrançois Tigeot 	/* ... */
65*c59a5c48SFrançois Tigeot };
66*c59a5c48SFrançois Tigeot 
67*c59a5c48SFrançois Tigeot /**
68*c59a5c48SFrançois Tigeot  * enum cgs_engine - Engines that can be statically power-gated
69*c59a5c48SFrançois Tigeot  */
70*c59a5c48SFrançois Tigeot enum cgs_engine {
71*c59a5c48SFrançois Tigeot 	CGS_ENGINE__UVD,
72*c59a5c48SFrançois Tigeot 	CGS_ENGINE__VCE,
73*c59a5c48SFrançois Tigeot 	CGS_ENGINE__VP8,
74*c59a5c48SFrançois Tigeot 	CGS_ENGINE__ACP_DMA,
75*c59a5c48SFrançois Tigeot 	CGS_ENGINE__ACP_DSP0,
76*c59a5c48SFrançois Tigeot 	CGS_ENGINE__ACP_DSP1,
77*c59a5c48SFrançois Tigeot 	CGS_ENGINE__ISP,
78*c59a5c48SFrançois Tigeot 	/* ... */
79*c59a5c48SFrançois Tigeot };
80*c59a5c48SFrançois Tigeot 
81*c59a5c48SFrançois Tigeot /**
82*c59a5c48SFrançois Tigeot  * enum cgs_voltage_planes - Voltage planes for external camera HW
83*c59a5c48SFrançois Tigeot  */
84*c59a5c48SFrançois Tigeot enum cgs_voltage_planes {
85*c59a5c48SFrançois Tigeot 	CGS_VOLTAGE_PLANE__SENSOR0,
86*c59a5c48SFrançois Tigeot 	CGS_VOLTAGE_PLANE__SENSOR1,
87*c59a5c48SFrançois Tigeot 	/* ... */
88*c59a5c48SFrançois Tigeot };
89*c59a5c48SFrançois Tigeot 
90*c59a5c48SFrançois Tigeot /*
91*c59a5c48SFrançois Tigeot  * enum cgs_ucode_id - Firmware types for different IPs
92*c59a5c48SFrançois Tigeot  */
93*c59a5c48SFrançois Tigeot enum cgs_ucode_id {
94*c59a5c48SFrançois Tigeot 	CGS_UCODE_ID_SMU = 0,
95*c59a5c48SFrançois Tigeot 	CGS_UCODE_ID_SDMA0,
96*c59a5c48SFrançois Tigeot 	CGS_UCODE_ID_SDMA1,
97*c59a5c48SFrançois Tigeot 	CGS_UCODE_ID_CP_CE,
98*c59a5c48SFrançois Tigeot 	CGS_UCODE_ID_CP_PFP,
99*c59a5c48SFrançois Tigeot 	CGS_UCODE_ID_CP_ME,
100*c59a5c48SFrançois Tigeot 	CGS_UCODE_ID_CP_MEC,
101*c59a5c48SFrançois Tigeot 	CGS_UCODE_ID_CP_MEC_JT1,
102*c59a5c48SFrançois Tigeot 	CGS_UCODE_ID_CP_MEC_JT2,
103*c59a5c48SFrançois Tigeot 	CGS_UCODE_ID_GMCON_RENG,
104*c59a5c48SFrançois Tigeot 	CGS_UCODE_ID_RLC_G,
105*c59a5c48SFrançois Tigeot 	CGS_UCODE_ID_MAXIMUM,
106*c59a5c48SFrançois Tigeot };
107*c59a5c48SFrançois Tigeot 
108*c59a5c48SFrançois Tigeot /**
109*c59a5c48SFrançois Tigeot  * struct cgs_clock_limits - Clock limits
110*c59a5c48SFrançois Tigeot  *
111*c59a5c48SFrançois Tigeot  * Clocks are specified in 10KHz units.
112*c59a5c48SFrançois Tigeot  */
113*c59a5c48SFrançois Tigeot struct cgs_clock_limits {
114*c59a5c48SFrançois Tigeot 	unsigned min;		/**< Minimum supported frequency */
115*c59a5c48SFrançois Tigeot 	unsigned max;		/**< Maxumim supported frequency */
116*c59a5c48SFrançois Tigeot 	unsigned sustainable;	/**< Thermally sustainable frequency */
117*c59a5c48SFrançois Tigeot };
118*c59a5c48SFrançois Tigeot 
119*c59a5c48SFrançois Tigeot /**
120*c59a5c48SFrançois Tigeot  * struct cgs_firmware_info - Firmware information
121*c59a5c48SFrançois Tigeot  */
122*c59a5c48SFrançois Tigeot struct cgs_firmware_info {
123*c59a5c48SFrançois Tigeot 	uint16_t		version;
124*c59a5c48SFrançois Tigeot 	uint16_t		feature_version;
125*c59a5c48SFrançois Tigeot 	uint32_t		image_size;
126*c59a5c48SFrançois Tigeot 	uint64_t		mc_addr;
127*c59a5c48SFrançois Tigeot 	void			*kptr;
128*c59a5c48SFrançois Tigeot };
129*c59a5c48SFrançois Tigeot 
130*c59a5c48SFrançois Tigeot typedef unsigned long cgs_handle_t;
131*c59a5c48SFrançois Tigeot 
132*c59a5c48SFrançois Tigeot /**
133*c59a5c48SFrançois Tigeot  * cgs_gpu_mem_info() - Return information about memory heaps
134*c59a5c48SFrançois Tigeot  * @cgs_device: opaque device handle
135*c59a5c48SFrançois Tigeot  * @type:	memory type
136*c59a5c48SFrançois Tigeot  * @mc_start:	Start MC address of the heap (output)
137*c59a5c48SFrançois Tigeot  * @mc_size:	MC address space size (output)
138*c59a5c48SFrançois Tigeot  * @mem_size:	maximum amount of memory available for allocation (output)
139*c59a5c48SFrançois Tigeot  *
140*c59a5c48SFrançois Tigeot  * This function returns information about memory heaps. The type
141*c59a5c48SFrançois Tigeot  * parameter is used to select the memory heap. The mc_start and
142*c59a5c48SFrançois Tigeot  * mc_size for GART heaps may be bigger than the memory available for
143*c59a5c48SFrançois Tigeot  * allocation.
144*c59a5c48SFrançois Tigeot  *
145*c59a5c48SFrançois Tigeot  * mc_start and mc_size are undefined for non-contiguous FB memory
146*c59a5c48SFrançois Tigeot  * types, since buffers allocated with these types may or may not be
147*c59a5c48SFrançois Tigeot  * GART mapped.
148*c59a5c48SFrançois Tigeot  *
149*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
150*c59a5c48SFrançois Tigeot  */
151*c59a5c48SFrançois Tigeot typedef int (*cgs_gpu_mem_info_t)(void *cgs_device, enum cgs_gpu_mem_type type,
152*c59a5c48SFrançois Tigeot 				  uint64_t *mc_start, uint64_t *mc_size,
153*c59a5c48SFrançois Tigeot 				  uint64_t *mem_size);
154*c59a5c48SFrançois Tigeot 
155*c59a5c48SFrançois Tigeot /**
156*c59a5c48SFrançois Tigeot  * cgs_gmap_kmem() - map kernel memory to GART aperture
157*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
158*c59a5c48SFrançois Tigeot  * @kmem:	pointer to kernel memory
159*c59a5c48SFrançois Tigeot  * @size:	size to map
160*c59a5c48SFrançois Tigeot  * @min_offset: minimum offset from start of GART aperture
161*c59a5c48SFrançois Tigeot  * @max_offset: maximum offset from start of GART aperture
162*c59a5c48SFrançois Tigeot  * @kmem_handle: kernel memory handle (output)
163*c59a5c48SFrançois Tigeot  * @mcaddr:	MC address (output)
164*c59a5c48SFrançois Tigeot  *
165*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
166*c59a5c48SFrançois Tigeot  */
167*c59a5c48SFrançois Tigeot typedef int (*cgs_gmap_kmem_t)(void *cgs_device, void *kmem, uint64_t size,
168*c59a5c48SFrançois Tigeot 			       uint64_t min_offset, uint64_t max_offset,
169*c59a5c48SFrançois Tigeot 			       cgs_handle_t *kmem_handle, uint64_t *mcaddr);
170*c59a5c48SFrançois Tigeot 
171*c59a5c48SFrançois Tigeot /**
172*c59a5c48SFrançois Tigeot  * cgs_gunmap_kmem() - unmap kernel memory
173*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
174*c59a5c48SFrançois Tigeot  * @kmem_handle: kernel memory handle returned by gmap_kmem
175*c59a5c48SFrançois Tigeot  *
176*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
177*c59a5c48SFrançois Tigeot  */
178*c59a5c48SFrançois Tigeot typedef int (*cgs_gunmap_kmem_t)(void *cgs_device, cgs_handle_t kmem_handle);
179*c59a5c48SFrançois Tigeot 
180*c59a5c48SFrançois Tigeot /**
181*c59a5c48SFrançois Tigeot  * cgs_alloc_gpu_mem() - Allocate GPU memory
182*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
183*c59a5c48SFrançois Tigeot  * @type:	memory type
184*c59a5c48SFrançois Tigeot  * @size:	size in bytes
185*c59a5c48SFrançois Tigeot  * @align:	alignment in bytes
186*c59a5c48SFrançois Tigeot  * @min_offset: minimum offset from start of heap
187*c59a5c48SFrançois Tigeot  * @max_offset: maximum offset from start of heap
188*c59a5c48SFrançois Tigeot  * @handle:	memory handle (output)
189*c59a5c48SFrançois Tigeot  *
190*c59a5c48SFrançois Tigeot  * The memory types CGS_GPU_MEM_TYPE_*_CONTIG_FB force contiguous
191*c59a5c48SFrançois Tigeot  * memory allocation. This guarantees that the MC address returned by
192*c59a5c48SFrançois Tigeot  * cgs_gmap_gpu_mem is not mapped through the GART. The non-contiguous
193*c59a5c48SFrançois Tigeot  * FB memory types may be GART mapped depending on memory
194*c59a5c48SFrançois Tigeot  * fragmentation and memory allocator policies.
195*c59a5c48SFrançois Tigeot  *
196*c59a5c48SFrançois Tigeot  * If min/max_offset are non-0, the allocation will be forced to
197*c59a5c48SFrançois Tigeot  * reside between these offsets in its respective memory heap. The
198*c59a5c48SFrançois Tigeot  * base address that the offset relates to, depends on the memory
199*c59a5c48SFrançois Tigeot  * type.
200*c59a5c48SFrançois Tigeot  *
201*c59a5c48SFrançois Tigeot  * - CGS_GPU_MEM_TYPE__*_CONTIG_FB: FB MC base address
202*c59a5c48SFrançois Tigeot  * - CGS_GPU_MEM_TYPE__GART_*:	    GART aperture base address
203*c59a5c48SFrançois Tigeot  * - others:			    undefined, don't use with max_offset
204*c59a5c48SFrançois Tigeot  *
205*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
206*c59a5c48SFrançois Tigeot  */
207*c59a5c48SFrançois Tigeot typedef int (*cgs_alloc_gpu_mem_t)(void *cgs_device, enum cgs_gpu_mem_type type,
208*c59a5c48SFrançois Tigeot 				   uint64_t size, uint64_t align,
209*c59a5c48SFrançois Tigeot 				   uint64_t min_offset, uint64_t max_offset,
210*c59a5c48SFrançois Tigeot 				   cgs_handle_t *handle);
211*c59a5c48SFrançois Tigeot 
212*c59a5c48SFrançois Tigeot /**
213*c59a5c48SFrançois Tigeot  * cgs_free_gpu_mem() - Free GPU memory
214*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
215*c59a5c48SFrançois Tigeot  * @handle:	memory handle returned by alloc or import
216*c59a5c48SFrançois Tigeot  *
217*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
218*c59a5c48SFrançois Tigeot  */
219*c59a5c48SFrançois Tigeot typedef int (*cgs_free_gpu_mem_t)(void *cgs_device, cgs_handle_t handle);
220*c59a5c48SFrançois Tigeot 
221*c59a5c48SFrançois Tigeot /**
222*c59a5c48SFrançois Tigeot  * cgs_gmap_gpu_mem() - GPU-map GPU memory
223*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
224*c59a5c48SFrançois Tigeot  * @handle:	memory handle returned by alloc or import
225*c59a5c48SFrançois Tigeot  * @mcaddr:	MC address (output)
226*c59a5c48SFrançois Tigeot  *
227*c59a5c48SFrançois Tigeot  * Ensures that a buffer is GPU accessible and returns its MC address.
228*c59a5c48SFrançois Tigeot  *
229*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
230*c59a5c48SFrançois Tigeot  */
231*c59a5c48SFrançois Tigeot typedef int (*cgs_gmap_gpu_mem_t)(void *cgs_device, cgs_handle_t handle,
232*c59a5c48SFrançois Tigeot 				  uint64_t *mcaddr);
233*c59a5c48SFrançois Tigeot 
234*c59a5c48SFrançois Tigeot /**
235*c59a5c48SFrançois Tigeot  * cgs_gunmap_gpu_mem() - GPU-unmap GPU memory
236*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
237*c59a5c48SFrançois Tigeot  * @handle:	memory handle returned by alloc or import
238*c59a5c48SFrançois Tigeot  *
239*c59a5c48SFrançois Tigeot  * Allows the buffer to be migrated while it's not used by the GPU.
240*c59a5c48SFrançois Tigeot  *
241*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
242*c59a5c48SFrançois Tigeot  */
243*c59a5c48SFrançois Tigeot typedef int (*cgs_gunmap_gpu_mem_t)(void *cgs_device, cgs_handle_t handle);
244*c59a5c48SFrançois Tigeot 
245*c59a5c48SFrançois Tigeot /**
246*c59a5c48SFrançois Tigeot  * cgs_kmap_gpu_mem() - Kernel-map GPU memory
247*c59a5c48SFrançois Tigeot  *
248*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
249*c59a5c48SFrançois Tigeot  * @handle:	memory handle returned by alloc or import
250*c59a5c48SFrançois Tigeot  * @map:	Kernel virtual address the memory was mapped to (output)
251*c59a5c48SFrançois Tigeot  *
252*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
253*c59a5c48SFrançois Tigeot  */
254*c59a5c48SFrançois Tigeot typedef int (*cgs_kmap_gpu_mem_t)(void *cgs_device, cgs_handle_t handle,
255*c59a5c48SFrançois Tigeot 				  void **map);
256*c59a5c48SFrançois Tigeot 
257*c59a5c48SFrançois Tigeot /**
258*c59a5c48SFrançois Tigeot  * cgs_kunmap_gpu_mem() - Kernel-unmap GPU memory
259*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
260*c59a5c48SFrançois Tigeot  * @handle:	memory handle returned by alloc or import
261*c59a5c48SFrançois Tigeot  *
262*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
263*c59a5c48SFrançois Tigeot  */
264*c59a5c48SFrançois Tigeot typedef int (*cgs_kunmap_gpu_mem_t)(void *cgs_device, cgs_handle_t handle);
265*c59a5c48SFrançois Tigeot 
266*c59a5c48SFrançois Tigeot /**
267*c59a5c48SFrançois Tigeot  * cgs_read_register() - Read an MMIO register
268*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
269*c59a5c48SFrançois Tigeot  * @offset:	register offset
270*c59a5c48SFrançois Tigeot  *
271*c59a5c48SFrançois Tigeot  * Return:  register value
272*c59a5c48SFrançois Tigeot  */
273*c59a5c48SFrançois Tigeot typedef uint32_t (*cgs_read_register_t)(void *cgs_device, unsigned offset);
274*c59a5c48SFrançois Tigeot 
275*c59a5c48SFrançois Tigeot /**
276*c59a5c48SFrançois Tigeot  * cgs_write_register() - Write an MMIO register
277*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
278*c59a5c48SFrançois Tigeot  * @offset:	register offset
279*c59a5c48SFrançois Tigeot  * @value:	register value
280*c59a5c48SFrançois Tigeot  */
281*c59a5c48SFrançois Tigeot typedef void (*cgs_write_register_t)(void *cgs_device, unsigned offset,
282*c59a5c48SFrançois Tigeot 				     uint32_t value);
283*c59a5c48SFrançois Tigeot 
284*c59a5c48SFrançois Tigeot /**
285*c59a5c48SFrançois Tigeot  * cgs_read_ind_register() - Read an indirect register
286*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
287*c59a5c48SFrançois Tigeot  * @offset:	register offset
288*c59a5c48SFrançois Tigeot  *
289*c59a5c48SFrançois Tigeot  * Return:  register value
290*c59a5c48SFrançois Tigeot  */
291*c59a5c48SFrançois Tigeot typedef uint32_t (*cgs_read_ind_register_t)(void *cgs_device, enum cgs_ind_reg space,
292*c59a5c48SFrançois Tigeot 					    unsigned index);
293*c59a5c48SFrançois Tigeot 
294*c59a5c48SFrançois Tigeot /**
295*c59a5c48SFrançois Tigeot  * cgs_write_ind_register() - Write an indirect register
296*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
297*c59a5c48SFrançois Tigeot  * @offset:	register offset
298*c59a5c48SFrançois Tigeot  * @value:	register value
299*c59a5c48SFrançois Tigeot  */
300*c59a5c48SFrançois Tigeot typedef void (*cgs_write_ind_register_t)(void *cgs_device, enum cgs_ind_reg space,
301*c59a5c48SFrançois Tigeot 					 unsigned index, uint32_t value);
302*c59a5c48SFrançois Tigeot 
303*c59a5c48SFrançois Tigeot /**
304*c59a5c48SFrançois Tigeot  * cgs_read_pci_config_byte() - Read byte from PCI configuration space
305*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
306*c59a5c48SFrançois Tigeot  * @addr:	address
307*c59a5c48SFrançois Tigeot  *
308*c59a5c48SFrançois Tigeot  * Return:  Value read
309*c59a5c48SFrançois Tigeot  */
310*c59a5c48SFrançois Tigeot typedef uint8_t (*cgs_read_pci_config_byte_t)(void *cgs_device, unsigned addr);
311*c59a5c48SFrançois Tigeot 
312*c59a5c48SFrançois Tigeot /**
313*c59a5c48SFrançois Tigeot  * cgs_read_pci_config_word() - Read word from PCI configuration space
314*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
315*c59a5c48SFrançois Tigeot  * @addr:	address, must be word-aligned
316*c59a5c48SFrançois Tigeot  *
317*c59a5c48SFrançois Tigeot  * Return:  Value read
318*c59a5c48SFrançois Tigeot  */
319*c59a5c48SFrançois Tigeot typedef uint16_t (*cgs_read_pci_config_word_t)(void *cgs_device, unsigned addr);
320*c59a5c48SFrançois Tigeot 
321*c59a5c48SFrançois Tigeot /**
322*c59a5c48SFrançois Tigeot  * cgs_read_pci_config_dword() - Read dword from PCI configuration space
323*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
324*c59a5c48SFrançois Tigeot  * @addr:	address, must be dword-aligned
325*c59a5c48SFrançois Tigeot  *
326*c59a5c48SFrançois Tigeot  * Return:  Value read
327*c59a5c48SFrançois Tigeot  */
328*c59a5c48SFrançois Tigeot typedef uint32_t (*cgs_read_pci_config_dword_t)(void *cgs_device,
329*c59a5c48SFrançois Tigeot 						unsigned addr);
330*c59a5c48SFrançois Tigeot 
331*c59a5c48SFrançois Tigeot /**
332*c59a5c48SFrançois Tigeot  * cgs_write_pci_config_byte() - Write byte to PCI configuration space
333*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
334*c59a5c48SFrançois Tigeot  * @addr:	address
335*c59a5c48SFrançois Tigeot  * @value:	value to write
336*c59a5c48SFrançois Tigeot  */
337*c59a5c48SFrançois Tigeot typedef void (*cgs_write_pci_config_byte_t)(void *cgs_device, unsigned addr,
338*c59a5c48SFrançois Tigeot 					    uint8_t value);
339*c59a5c48SFrançois Tigeot 
340*c59a5c48SFrançois Tigeot /**
341*c59a5c48SFrançois Tigeot  * cgs_write_pci_config_word() - Write byte to PCI configuration space
342*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
343*c59a5c48SFrançois Tigeot  * @addr:	address, must be word-aligned
344*c59a5c48SFrançois Tigeot  * @value:	value to write
345*c59a5c48SFrançois Tigeot  */
346*c59a5c48SFrançois Tigeot typedef void (*cgs_write_pci_config_word_t)(void *cgs_device, unsigned addr,
347*c59a5c48SFrançois Tigeot 					    uint16_t value);
348*c59a5c48SFrançois Tigeot 
349*c59a5c48SFrançois Tigeot /**
350*c59a5c48SFrançois Tigeot  * cgs_write_pci_config_dword() - Write byte to PCI configuration space
351*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
352*c59a5c48SFrançois Tigeot  * @addr:	address, must be dword-aligned
353*c59a5c48SFrançois Tigeot  * @value:	value to write
354*c59a5c48SFrançois Tigeot  */
355*c59a5c48SFrançois Tigeot typedef void (*cgs_write_pci_config_dword_t)(void *cgs_device, unsigned addr,
356*c59a5c48SFrançois Tigeot 					     uint32_t value);
357*c59a5c48SFrançois Tigeot 
358*c59a5c48SFrançois Tigeot /**
359*c59a5c48SFrançois Tigeot  * cgs_atom_get_data_table() - Get a pointer to an ATOM BIOS data table
360*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
361*c59a5c48SFrançois Tigeot  * @table:	data table index
362*c59a5c48SFrançois Tigeot  * @size:	size of the table (output, may be NULL)
363*c59a5c48SFrançois Tigeot  * @frev:	table format revision (output, may be NULL)
364*c59a5c48SFrançois Tigeot  * @crev:	table content revision (output, may be NULL)
365*c59a5c48SFrançois Tigeot  *
366*c59a5c48SFrançois Tigeot  * Return: Pointer to start of the table, or NULL on failure
367*c59a5c48SFrançois Tigeot  */
368*c59a5c48SFrançois Tigeot typedef const void *(*cgs_atom_get_data_table_t)(
369*c59a5c48SFrançois Tigeot 	void *cgs_device, unsigned table,
370*c59a5c48SFrançois Tigeot 	uint16_t *size, uint8_t *frev, uint8_t *crev);
371*c59a5c48SFrançois Tigeot 
372*c59a5c48SFrançois Tigeot /**
373*c59a5c48SFrançois Tigeot  * cgs_atom_get_cmd_table_revs() - Get ATOM BIOS command table revisions
374*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
375*c59a5c48SFrançois Tigeot  * @table:	data table index
376*c59a5c48SFrançois Tigeot  * @frev:	table format revision (output, may be NULL)
377*c59a5c48SFrançois Tigeot  * @crev:	table content revision (output, may be NULL)
378*c59a5c48SFrançois Tigeot  *
379*c59a5c48SFrançois Tigeot  * Return: 0 on success, -errno otherwise
380*c59a5c48SFrançois Tigeot  */
381*c59a5c48SFrançois Tigeot typedef int (*cgs_atom_get_cmd_table_revs_t)(void *cgs_device, unsigned table,
382*c59a5c48SFrançois Tigeot 					     uint8_t *frev, uint8_t *crev);
383*c59a5c48SFrançois Tigeot 
384*c59a5c48SFrançois Tigeot /**
385*c59a5c48SFrançois Tigeot  * cgs_atom_exec_cmd_table() - Execute an ATOM BIOS command table
386*c59a5c48SFrançois Tigeot  * @cgs_device: opaque device handle
387*c59a5c48SFrançois Tigeot  * @table:	command table index
388*c59a5c48SFrançois Tigeot  * @args:	arguments
389*c59a5c48SFrançois Tigeot  *
390*c59a5c48SFrançois Tigeot  * Return: 0 on success, -errno otherwise
391*c59a5c48SFrançois Tigeot  */
392*c59a5c48SFrançois Tigeot typedef int (*cgs_atom_exec_cmd_table_t)(void *cgs_device,
393*c59a5c48SFrançois Tigeot 					 unsigned table, void *args);
394*c59a5c48SFrançois Tigeot 
395*c59a5c48SFrançois Tigeot /**
396*c59a5c48SFrançois Tigeot  * cgs_create_pm_request() - Create a power management request
397*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
398*c59a5c48SFrançois Tigeot  * @request:	handle of created PM request (output)
399*c59a5c48SFrançois Tigeot  *
400*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
401*c59a5c48SFrançois Tigeot  */
402*c59a5c48SFrançois Tigeot typedef int (*cgs_create_pm_request_t)(void *cgs_device, cgs_handle_t *request);
403*c59a5c48SFrançois Tigeot 
404*c59a5c48SFrançois Tigeot /**
405*c59a5c48SFrançois Tigeot  * cgs_destroy_pm_request() - Destroy a power management request
406*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
407*c59a5c48SFrançois Tigeot  * @request:	handle of created PM request
408*c59a5c48SFrançois Tigeot  *
409*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
410*c59a5c48SFrançois Tigeot  */
411*c59a5c48SFrançois Tigeot typedef int (*cgs_destroy_pm_request_t)(void *cgs_device, cgs_handle_t request);
412*c59a5c48SFrançois Tigeot 
413*c59a5c48SFrançois Tigeot /**
414*c59a5c48SFrançois Tigeot  * cgs_set_pm_request() - Activate or deactiveate a PM request
415*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
416*c59a5c48SFrançois Tigeot  * @request:	PM request handle
417*c59a5c48SFrançois Tigeot  * @active:	0 = deactivate, non-0 = activate
418*c59a5c48SFrançois Tigeot  *
419*c59a5c48SFrançois Tigeot  * While a PM request is active, its minimum clock requests are taken
420*c59a5c48SFrançois Tigeot  * into account as the requested engines are powered up. When the
421*c59a5c48SFrançois Tigeot  * request is inactive, the engines may be powered down and clocks may
422*c59a5c48SFrançois Tigeot  * be lower, depending on other PM requests by other driver
423*c59a5c48SFrançois Tigeot  * components.
424*c59a5c48SFrançois Tigeot  *
425*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
426*c59a5c48SFrançois Tigeot  */
427*c59a5c48SFrançois Tigeot typedef int (*cgs_set_pm_request_t)(void *cgs_device, cgs_handle_t request,
428*c59a5c48SFrançois Tigeot 				    int active);
429*c59a5c48SFrançois Tigeot 
430*c59a5c48SFrançois Tigeot /**
431*c59a5c48SFrançois Tigeot  * cgs_pm_request_clock() - Request a minimum frequency for a specific clock
432*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
433*c59a5c48SFrançois Tigeot  * @request:	PM request handle
434*c59a5c48SFrançois Tigeot  * @clock:	which clock?
435*c59a5c48SFrançois Tigeot  * @freq:	requested min. frequency in 10KHz units (0 to clear request)
436*c59a5c48SFrançois Tigeot  *
437*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
438*c59a5c48SFrançois Tigeot  */
439*c59a5c48SFrançois Tigeot typedef int (*cgs_pm_request_clock_t)(void *cgs_device, cgs_handle_t request,
440*c59a5c48SFrançois Tigeot 				      enum cgs_clock clock, unsigned freq);
441*c59a5c48SFrançois Tigeot 
442*c59a5c48SFrançois Tigeot /**
443*c59a5c48SFrançois Tigeot  * cgs_pm_request_engine() - Request an engine to be powered up
444*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
445*c59a5c48SFrançois Tigeot  * @request:	PM request handle
446*c59a5c48SFrançois Tigeot  * @engine:	which engine?
447*c59a5c48SFrançois Tigeot  * @powered:	0 = powered down, non-0 = powered up
448*c59a5c48SFrançois Tigeot  *
449*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
450*c59a5c48SFrançois Tigeot  */
451*c59a5c48SFrançois Tigeot typedef int (*cgs_pm_request_engine_t)(void *cgs_device, cgs_handle_t request,
452*c59a5c48SFrançois Tigeot 				       enum cgs_engine engine, int powered);
453*c59a5c48SFrançois Tigeot 
454*c59a5c48SFrançois Tigeot /**
455*c59a5c48SFrançois Tigeot  * cgs_pm_query_clock_limits() - Query clock frequency limits
456*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
457*c59a5c48SFrançois Tigeot  * @clock:	which clock?
458*c59a5c48SFrançois Tigeot  * @limits:	clock limits
459*c59a5c48SFrançois Tigeot  *
460*c59a5c48SFrançois Tigeot  * Return:  0 on success, -errno otherwise
461*c59a5c48SFrançois Tigeot  */
462*c59a5c48SFrançois Tigeot typedef int (*cgs_pm_query_clock_limits_t)(void *cgs_device,
463*c59a5c48SFrançois Tigeot 					   enum cgs_clock clock,
464*c59a5c48SFrançois Tigeot 					   struct cgs_clock_limits *limits);
465*c59a5c48SFrançois Tigeot 
466*c59a5c48SFrançois Tigeot /**
467*c59a5c48SFrançois Tigeot  * cgs_set_camera_voltages() - Apply specific voltages to PMIC voltage planes
468*c59a5c48SFrançois Tigeot  * @cgs_device:	opaque device handle
469*c59a5c48SFrançois Tigeot  * @mask:	bitmask of voltages to change (1<<CGS_VOLTAGE_PLANE__xyz|...)
470*c59a5c48SFrançois Tigeot  * @voltages:	pointer to array of voltage values in 1mV units
471*c59a5c48SFrançois Tigeot  *
472*c59a5c48SFrançois Tigeot  * Return: 0 on success, -errno otherwise
473*c59a5c48SFrançois Tigeot  */
474*c59a5c48SFrançois Tigeot typedef int (*cgs_set_camera_voltages_t)(void *cgs_device, uint32_t mask,
475*c59a5c48SFrançois Tigeot 					 const uint32_t *voltages);
476*c59a5c48SFrançois Tigeot /**
477*c59a5c48SFrançois Tigeot  * cgs_get_firmware_info - Get the firmware information from core driver
478*c59a5c48SFrançois Tigeot  * @cgs_device: opaque device handle
479*c59a5c48SFrançois Tigeot  * @type: the firmware type
480*c59a5c48SFrançois Tigeot  * @info: returend firmware information
481*c59a5c48SFrançois Tigeot  *
482*c59a5c48SFrançois Tigeot  * Return: 0 on success, -errno otherwise
483*c59a5c48SFrançois Tigeot  */
484*c59a5c48SFrançois Tigeot typedef int (*cgs_get_firmware_info)(void *cgs_device,
485*c59a5c48SFrançois Tigeot 				     enum cgs_ucode_id type,
486*c59a5c48SFrançois Tigeot 				     struct cgs_firmware_info *info);
487*c59a5c48SFrançois Tigeot 
488*c59a5c48SFrançois Tigeot typedef int(*cgs_set_powergating_state)(void *cgs_device,
489*c59a5c48SFrançois Tigeot 				  enum amd_ip_block_type block_type,
490*c59a5c48SFrançois Tigeot 				  enum amd_powergating_state state);
491*c59a5c48SFrançois Tigeot 
492*c59a5c48SFrançois Tigeot typedef int(*cgs_set_clockgating_state)(void *cgs_device,
493*c59a5c48SFrançois Tigeot 				  enum amd_ip_block_type block_type,
494*c59a5c48SFrançois Tigeot 				  enum amd_clockgating_state state);
495*c59a5c48SFrançois Tigeot 
496*c59a5c48SFrançois Tigeot struct cgs_ops {
497*c59a5c48SFrançois Tigeot 	/* memory management calls (similar to KFD interface) */
498*c59a5c48SFrançois Tigeot 	cgs_gpu_mem_info_t gpu_mem_info;
499*c59a5c48SFrançois Tigeot 	cgs_gmap_kmem_t gmap_kmem;
500*c59a5c48SFrançois Tigeot 	cgs_gunmap_kmem_t gunmap_kmem;
501*c59a5c48SFrançois Tigeot 	cgs_alloc_gpu_mem_t alloc_gpu_mem;
502*c59a5c48SFrançois Tigeot 	cgs_free_gpu_mem_t free_gpu_mem;
503*c59a5c48SFrançois Tigeot 	cgs_gmap_gpu_mem_t gmap_gpu_mem;
504*c59a5c48SFrançois Tigeot 	cgs_gunmap_gpu_mem_t gunmap_gpu_mem;
505*c59a5c48SFrançois Tigeot 	cgs_kmap_gpu_mem_t kmap_gpu_mem;
506*c59a5c48SFrançois Tigeot 	cgs_kunmap_gpu_mem_t kunmap_gpu_mem;
507*c59a5c48SFrançois Tigeot 	/* MMIO access */
508*c59a5c48SFrançois Tigeot 	cgs_read_register_t read_register;
509*c59a5c48SFrançois Tigeot 	cgs_write_register_t write_register;
510*c59a5c48SFrançois Tigeot 	cgs_read_ind_register_t read_ind_register;
511*c59a5c48SFrançois Tigeot 	cgs_write_ind_register_t write_ind_register;
512*c59a5c48SFrançois Tigeot 	/* PCI configuration space access */
513*c59a5c48SFrançois Tigeot 	cgs_read_pci_config_byte_t read_pci_config_byte;
514*c59a5c48SFrançois Tigeot 	cgs_read_pci_config_word_t read_pci_config_word;
515*c59a5c48SFrançois Tigeot 	cgs_read_pci_config_dword_t read_pci_config_dword;
516*c59a5c48SFrançois Tigeot 	cgs_write_pci_config_byte_t write_pci_config_byte;
517*c59a5c48SFrançois Tigeot 	cgs_write_pci_config_word_t write_pci_config_word;
518*c59a5c48SFrançois Tigeot 	cgs_write_pci_config_dword_t write_pci_config_dword;
519*c59a5c48SFrançois Tigeot 	/* ATOM BIOS */
520*c59a5c48SFrançois Tigeot 	cgs_atom_get_data_table_t atom_get_data_table;
521*c59a5c48SFrançois Tigeot 	cgs_atom_get_cmd_table_revs_t atom_get_cmd_table_revs;
522*c59a5c48SFrançois Tigeot 	cgs_atom_exec_cmd_table_t atom_exec_cmd_table;
523*c59a5c48SFrançois Tigeot 	/* Power management */
524*c59a5c48SFrançois Tigeot 	cgs_create_pm_request_t create_pm_request;
525*c59a5c48SFrançois Tigeot 	cgs_destroy_pm_request_t destroy_pm_request;
526*c59a5c48SFrançois Tigeot 	cgs_set_pm_request_t set_pm_request;
527*c59a5c48SFrançois Tigeot 	cgs_pm_request_clock_t pm_request_clock;
528*c59a5c48SFrançois Tigeot 	cgs_pm_request_engine_t pm_request_engine;
529*c59a5c48SFrançois Tigeot 	cgs_pm_query_clock_limits_t pm_query_clock_limits;
530*c59a5c48SFrançois Tigeot 	cgs_set_camera_voltages_t set_camera_voltages;
531*c59a5c48SFrançois Tigeot 	/* Firmware Info */
532*c59a5c48SFrançois Tigeot 	cgs_get_firmware_info get_firmware_info;
533*c59a5c48SFrançois Tigeot 	/* cg pg interface*/
534*c59a5c48SFrançois Tigeot 	cgs_set_powergating_state set_powergating_state;
535*c59a5c48SFrançois Tigeot 	cgs_set_clockgating_state set_clockgating_state;
536*c59a5c48SFrançois Tigeot 	/* ACPI (TODO) */
537*c59a5c48SFrançois Tigeot };
538*c59a5c48SFrançois Tigeot 
539*c59a5c48SFrançois Tigeot struct cgs_os_ops; /* To be define in OS-specific CGS header */
540*c59a5c48SFrançois Tigeot 
541*c59a5c48SFrançois Tigeot struct cgs_device
542*c59a5c48SFrançois Tigeot {
543*c59a5c48SFrançois Tigeot 	const struct cgs_ops *ops;
544*c59a5c48SFrançois Tigeot 	const struct cgs_os_ops *os_ops;
545*c59a5c48SFrançois Tigeot 	/* to be embedded at the start of driver private structure */
546*c59a5c48SFrançois Tigeot };
547*c59a5c48SFrançois Tigeot 
548*c59a5c48SFrançois Tigeot /* Convenience macros that make CGS indirect function calls look like
549*c59a5c48SFrançois Tigeot  * normal function calls */
550*c59a5c48SFrançois Tigeot #define CGS_CALL(func,dev,...) \
551*c59a5c48SFrançois Tigeot 	(((struct cgs_device *)dev)->ops->func(dev, ##__VA_ARGS__))
552*c59a5c48SFrançois Tigeot #define CGS_OS_CALL(func,dev,...) \
553*c59a5c48SFrançois Tigeot 	(((struct cgs_device *)dev)->os_ops->func(dev, ##__VA_ARGS__))
554*c59a5c48SFrançois Tigeot 
555*c59a5c48SFrançois Tigeot #define cgs_gpu_mem_info(dev,type,mc_start,mc_size,mem_size)		\
556*c59a5c48SFrançois Tigeot 	CGS_CALL(gpu_mem_info,dev,type,mc_start,mc_size,mem_size)
557*c59a5c48SFrançois Tigeot #define cgs_gmap_kmem(dev,kmem,size,min_off,max_off,kmem_handle,mcaddr)	\
558*c59a5c48SFrançois Tigeot 	CGS_CALL(gmap_kmem,dev,kmem,size,min_off,max_off,kmem_handle,mcaddr)
559*c59a5c48SFrançois Tigeot #define cgs_gunmap_kmem(dev,kmem_handle)	\
560*c59a5c48SFrançois Tigeot 	CGS_CALL(gunmap_kmem,dev,keme_handle)
561*c59a5c48SFrançois Tigeot #define cgs_alloc_gpu_mem(dev,type,size,align,min_off,max_off,handle)	\
562*c59a5c48SFrançois Tigeot 	CGS_CALL(alloc_gpu_mem,dev,type,size,align,min_off,max_off,handle)
563*c59a5c48SFrançois Tigeot #define cgs_free_gpu_mem(dev,handle)		\
564*c59a5c48SFrançois Tigeot 	CGS_CALL(free_gpu_mem,dev,handle)
565*c59a5c48SFrançois Tigeot #define cgs_gmap_gpu_mem(dev,handle,mcaddr)	\
566*c59a5c48SFrançois Tigeot 	CGS_CALL(gmap_gpu_mem,dev,handle,mcaddr)
567*c59a5c48SFrançois Tigeot #define cgs_gunmap_gpu_mem(dev,handle)		\
568*c59a5c48SFrançois Tigeot 	CGS_CALL(gunmap_gpu_mem,dev,handle)
569*c59a5c48SFrançois Tigeot #define cgs_kmap_gpu_mem(dev,handle,map)	\
570*c59a5c48SFrançois Tigeot 	CGS_CALL(kmap_gpu_mem,dev,handle,map)
571*c59a5c48SFrançois Tigeot #define cgs_kunmap_gpu_mem(dev,handle)		\
572*c59a5c48SFrançois Tigeot 	CGS_CALL(kunmap_gpu_mem,dev,handle)
573*c59a5c48SFrançois Tigeot 
574*c59a5c48SFrançois Tigeot #define cgs_read_register(dev,offset)		\
575*c59a5c48SFrançois Tigeot 	CGS_CALL(read_register,dev,offset)
576*c59a5c48SFrançois Tigeot #define cgs_write_register(dev,offset,value)		\
577*c59a5c48SFrançois Tigeot 	CGS_CALL(write_register,dev,offset,value)
578*c59a5c48SFrançois Tigeot #define cgs_read_ind_register(dev,space,index)		\
579*c59a5c48SFrançois Tigeot 	CGS_CALL(read_ind_register,dev,space,index)
580*c59a5c48SFrançois Tigeot #define cgs_write_ind_register(dev,space,index,value)		\
581*c59a5c48SFrançois Tigeot 	CGS_CALL(write_ind_register,dev,space,index,value)
582*c59a5c48SFrançois Tigeot 
583*c59a5c48SFrançois Tigeot #define cgs_read_pci_config_byte(dev,addr)	\
584*c59a5c48SFrançois Tigeot 	CGS_CALL(read_pci_config_byte,dev,addr)
585*c59a5c48SFrançois Tigeot #define cgs_read_pci_config_word(dev,addr)	\
586*c59a5c48SFrançois Tigeot 	CGS_CALL(read_pci_config_word,dev,addr)
587*c59a5c48SFrançois Tigeot #define cgs_read_pci_config_dword(dev,addr)		\
588*c59a5c48SFrançois Tigeot 	CGS_CALL(read_pci_config_dword,dev,addr)
589*c59a5c48SFrançois Tigeot #define cgs_write_pci_config_byte(dev,addr,value)	\
590*c59a5c48SFrançois Tigeot 	CGS_CALL(write_pci_config_byte,dev,addr,value)
591*c59a5c48SFrançois Tigeot #define cgs_write_pci_config_word(dev,addr,value)	\
592*c59a5c48SFrançois Tigeot 	CGS_CALL(write_pci_config_word,dev,addr,value)
593*c59a5c48SFrançois Tigeot #define cgs_write_pci_config_dword(dev,addr,value)	\
594*c59a5c48SFrançois Tigeot 	CGS_CALL(write_pci_config_dword,dev,addr,value)
595*c59a5c48SFrançois Tigeot 
596*c59a5c48SFrançois Tigeot #define cgs_atom_get_data_table(dev,table,size,frev,crev)	\
597*c59a5c48SFrançois Tigeot 	CGS_CALL(atom_get_data_table,dev,table,size,frev,crev)
598*c59a5c48SFrançois Tigeot #define cgs_atom_get_cmd_table_revs(dev,table,frev,crev)	\
599*c59a5c48SFrançois Tigeot 	CGS_CALL(atom_get_cmd_table_revs,dev,table,frev,crev)
600*c59a5c48SFrançois Tigeot #define cgs_atom_exec_cmd_table(dev,table,args)		\
601*c59a5c48SFrançois Tigeot 	CGS_CALL(atom_exec_cmd_table,dev,table,args)
602*c59a5c48SFrançois Tigeot 
603*c59a5c48SFrançois Tigeot #define cgs_create_pm_request(dev,request)	\
604*c59a5c48SFrançois Tigeot 	CGS_CALL(create_pm_request,dev,request)
605*c59a5c48SFrançois Tigeot #define cgs_destroy_pm_request(dev,request)		\
606*c59a5c48SFrançois Tigeot 	CGS_CALL(destroy_pm_request,dev,request)
607*c59a5c48SFrançois Tigeot #define cgs_set_pm_request(dev,request,active)		\
608*c59a5c48SFrançois Tigeot 	CGS_CALL(set_pm_request,dev,request,active)
609*c59a5c48SFrançois Tigeot #define cgs_pm_request_clock(dev,request,clock,freq)		\
610*c59a5c48SFrançois Tigeot 	CGS_CALL(pm_request_clock,dev,request,clock,freq)
611*c59a5c48SFrançois Tigeot #define cgs_pm_request_engine(dev,request,engine,powered)	\
612*c59a5c48SFrançois Tigeot 	CGS_CALL(pm_request_engine,dev,request,engine,powered)
613*c59a5c48SFrançois Tigeot #define cgs_pm_query_clock_limits(dev,clock,limits)		\
614*c59a5c48SFrançois Tigeot 	CGS_CALL(pm_query_clock_limits,dev,clock,limits)
615*c59a5c48SFrançois Tigeot #define cgs_set_camera_voltages(dev,mask,voltages)	\
616*c59a5c48SFrançois Tigeot 	CGS_CALL(set_camera_voltages,dev,mask,voltages)
617*c59a5c48SFrançois Tigeot #define cgs_get_firmware_info(dev, type, info)	\
618*c59a5c48SFrançois Tigeot 	CGS_CALL(get_firmware_info, dev, type, info)
619*c59a5c48SFrançois Tigeot #define cgs_set_powergating_state(dev, block_type, state)	\
620*c59a5c48SFrançois Tigeot 	CGS_CALL(set_powergating_state, dev, block_type, state)
621*c59a5c48SFrançois Tigeot #define cgs_set_clockgating_state(dev, block_type, state)	\
622*c59a5c48SFrançois Tigeot 	CGS_CALL(set_clockgating_state, dev, block_type, state)
623*c59a5c48SFrançois Tigeot 
624*c59a5c48SFrançois Tigeot #endif /* _CGS_COMMON_H */
625