2 * Copyright 2015 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
27 #include "amd_shared.h"
32 * enum cgs_gpu_mem_type - GPU memory types
34 enum cgs_gpu_mem_type {
35 CGS_GPU_MEM_TYPE__VISIBLE_FB,
36 CGS_GPU_MEM_TYPE__INVISIBLE_FB,
37 CGS_GPU_MEM_TYPE__VISIBLE_CONTIG_FB,
38 CGS_GPU_MEM_TYPE__INVISIBLE_CONTIG_FB,
39 CGS_GPU_MEM_TYPE__GART_CACHEABLE,
40 CGS_GPU_MEM_TYPE__GART_WRITECOMBINE
44 * enum cgs_ind_reg - Indirect register spaces
53 CGS_IND_REG__AUDIO_ENDPT
57 * enum cgs_clock - Clocks controlled by the SMU
71 * enum cgs_engine - Engines that can be statically power-gated
85 * enum cgs_voltage_planes - Voltage planes for external camera HW
87 enum cgs_voltage_planes {
88 CGS_VOLTAGE_PLANE__SENSOR0,
89 CGS_VOLTAGE_PLANE__SENSOR1,
94 * enum cgs_ucode_id - Firmware types for different IPs
105 CGS_UCODE_ID_CP_MEC_JT1,
106 CGS_UCODE_ID_CP_MEC_JT2,
107 CGS_UCODE_ID_GMCON_RENG,
109 CGS_UCODE_ID_STORAGE,
110 CGS_UCODE_ID_MAXIMUM,
113 enum cgs_system_info_id {
114 CGS_SYSTEM_INFO_ADAPTER_BDF_ID = 1,
115 CGS_SYSTEM_INFO_PCIE_GEN_INFO,
116 CGS_SYSTEM_INFO_PCIE_MLW,
117 CGS_SYSTEM_INFO_PCIE_DEV,
118 CGS_SYSTEM_INFO_PCIE_REV,
119 CGS_SYSTEM_INFO_CG_FLAGS,
120 CGS_SYSTEM_INFO_PG_FLAGS,
121 CGS_SYSTEM_INFO_GFX_CU_INFO,
122 CGS_SYSTEM_INFO_GFX_SE_INFO,
123 CGS_SYSTEM_INFO_PCIE_SUB_SYS_ID,
124 CGS_SYSTEM_INFO_PCIE_SUB_SYS_VENDOR_ID,
125 CGS_SYSTEM_INFO_ID_MAXIMUM,
128 struct cgs_system_info {
130 enum cgs_system_info_id info_id;
135 uint64_t padding[13];
139 * enum cgs_resource_type - GPU resource type
141 enum cgs_resource_type {
142 CGS_RESOURCE_TYPE_MMIO = 0,
143 CGS_RESOURCE_TYPE_FB,
144 CGS_RESOURCE_TYPE_IO,
145 CGS_RESOURCE_TYPE_DOORBELL,
146 CGS_RESOURCE_TYPE_ROM,
150 * struct cgs_clock_limits - Clock limits
152 * Clocks are specified in 10KHz units.
154 struct cgs_clock_limits {
155 unsigned min; /**< Minimum supported frequency */
156 unsigned max; /**< Maxumim supported frequency */
157 unsigned sustainable; /**< Thermally sustainable frequency */
161 * struct cgs_firmware_info - Firmware information
163 struct cgs_firmware_info {
166 uint16_t feature_version;
170 /* only for smc firmware */
171 uint32_t ucode_start_address;
177 struct cgs_mode_info {
178 uint32_t refresh_rate;
180 uint32_t vblank_time_us;
183 struct cgs_display_info {
184 uint32_t display_count;
185 uint32_t active_display_mask;
186 struct cgs_mode_info *mode_info;
189 typedef unsigned long cgs_handle_t;
191 #define CGS_ACPI_METHOD_ATCS 0x53435441
192 #define CGS_ACPI_METHOD_ATIF 0x46495441
193 #define CGS_ACPI_METHOD_ATPX 0x58505441
194 #define CGS_ACPI_FIELD_METHOD_NAME 0x00000001
195 #define CGS_ACPI_FIELD_INPUT_ARGUMENT_COUNT 0x00000002
196 #define CGS_ACPI_MAX_BUFFER_SIZE 256
197 #define CGS_ACPI_TYPE_ANY 0x00
198 #define CGS_ACPI_TYPE_INTEGER 0x01
199 #define CGS_ACPI_TYPE_STRING 0x02
200 #define CGS_ACPI_TYPE_BUFFER 0x03
201 #define CGS_ACPI_TYPE_PACKAGE 0x04
203 struct cgs_acpi_method_argument {
205 uint32_t data_length;
212 struct cgs_acpi_method_info {
215 uint32_t input_count;
217 struct cgs_acpi_method_argument *pinput_argument;
218 uint32_t output_count;
219 struct cgs_acpi_method_argument *poutput_argument;
224 * cgs_gpu_mem_info() - Return information about memory heaps
225 * @cgs_device: opaque device handle
227 * @mc_start: Start MC address of the heap (output)
228 * @mc_size: MC address space size (output)
229 * @mem_size: maximum amount of memory available for allocation (output)
231 * This function returns information about memory heaps. The type
232 * parameter is used to select the memory heap. The mc_start and
233 * mc_size for GART heaps may be bigger than the memory available for
236 * mc_start and mc_size are undefined for non-contiguous FB memory
237 * types, since buffers allocated with these types may or may not be
240 * Return: 0 on success, -errno otherwise
242 typedef int (*cgs_gpu_mem_info_t)(struct cgs_device *cgs_device, enum cgs_gpu_mem_type type,
243 uint64_t *mc_start, uint64_t *mc_size,
247 * cgs_gmap_kmem() - map kernel memory to GART aperture
248 * @cgs_device: opaque device handle
249 * @kmem: pointer to kernel memory
251 * @min_offset: minimum offset from start of GART aperture
252 * @max_offset: maximum offset from start of GART aperture
253 * @kmem_handle: kernel memory handle (output)
254 * @mcaddr: MC address (output)
256 * Return: 0 on success, -errno otherwise
258 typedef int (*cgs_gmap_kmem_t)(struct cgs_device *cgs_device, void *kmem, uint64_t size,
259 uint64_t min_offset, uint64_t max_offset,
260 cgs_handle_t *kmem_handle, uint64_t *mcaddr);
263 * cgs_gunmap_kmem() - unmap kernel memory
264 * @cgs_device: opaque device handle
265 * @kmem_handle: kernel memory handle returned by gmap_kmem
267 * Return: 0 on success, -errno otherwise
269 typedef int (*cgs_gunmap_kmem_t)(struct cgs_device *cgs_device, cgs_handle_t kmem_handle);
272 * cgs_alloc_gpu_mem() - Allocate GPU memory
273 * @cgs_device: opaque device handle
275 * @size: size in bytes
276 * @align: alignment in bytes
277 * @min_offset: minimum offset from start of heap
278 * @max_offset: maximum offset from start of heap
279 * @handle: memory handle (output)
281 * The memory types CGS_GPU_MEM_TYPE_*_CONTIG_FB force contiguous
282 * memory allocation. This guarantees that the MC address returned by
283 * cgs_gmap_gpu_mem is not mapped through the GART. The non-contiguous
284 * FB memory types may be GART mapped depending on memory
285 * fragmentation and memory allocator policies.
287 * If min/max_offset are non-0, the allocation will be forced to
288 * reside between these offsets in its respective memory heap. The
289 * base address that the offset relates to, depends on the memory
292 * - CGS_GPU_MEM_TYPE__*_CONTIG_FB: FB MC base address
293 * - CGS_GPU_MEM_TYPE__GART_*: GART aperture base address
294 * - others: undefined, don't use with max_offset
296 * Return: 0 on success, -errno otherwise
298 typedef int (*cgs_alloc_gpu_mem_t)(struct cgs_device *cgs_device, enum cgs_gpu_mem_type type,
299 uint64_t size, uint64_t align,
300 uint64_t min_offset, uint64_t max_offset,
301 cgs_handle_t *handle);
304 * cgs_free_gpu_mem() - Free GPU memory
305 * @cgs_device: opaque device handle
306 * @handle: memory handle returned by alloc or import
308 * Return: 0 on success, -errno otherwise
310 typedef int (*cgs_free_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle);
313 * cgs_gmap_gpu_mem() - GPU-map GPU memory
314 * @cgs_device: opaque device handle
315 * @handle: memory handle returned by alloc or import
316 * @mcaddr: MC address (output)
318 * Ensures that a buffer is GPU accessible and returns its MC address.
320 * Return: 0 on success, -errno otherwise
322 typedef int (*cgs_gmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle,
326 * cgs_gunmap_gpu_mem() - GPU-unmap GPU memory
327 * @cgs_device: opaque device handle
328 * @handle: memory handle returned by alloc or import
330 * Allows the buffer to be migrated while it's not used by the GPU.
332 * Return: 0 on success, -errno otherwise
334 typedef int (*cgs_gunmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle);
337 * cgs_kmap_gpu_mem() - Kernel-map GPU memory
339 * @cgs_device: opaque device handle
340 * @handle: memory handle returned by alloc or import
341 * @map: Kernel virtual address the memory was mapped to (output)
343 * Return: 0 on success, -errno otherwise
345 typedef int (*cgs_kmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle,
349 * cgs_kunmap_gpu_mem() - Kernel-unmap GPU memory
350 * @cgs_device: opaque device handle
351 * @handle: memory handle returned by alloc or import
353 * Return: 0 on success, -errno otherwise
355 typedef int (*cgs_kunmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle);
358 * cgs_read_register() - Read an MMIO register
359 * @cgs_device: opaque device handle
360 * @offset: register offset
362 * Return: register value
364 typedef uint32_t (*cgs_read_register_t)(struct cgs_device *cgs_device, unsigned offset);
367 * cgs_write_register() - Write an MMIO register
368 * @cgs_device: opaque device handle
369 * @offset: register offset
370 * @value: register value
372 typedef void (*cgs_write_register_t)(struct cgs_device *cgs_device, unsigned offset,
376 * cgs_read_ind_register() - Read an indirect register
377 * @cgs_device: opaque device handle
378 * @offset: register offset
380 * Return: register value
382 typedef uint32_t (*cgs_read_ind_register_t)(struct cgs_device *cgs_device, enum cgs_ind_reg space,
386 * cgs_write_ind_register() - Write an indirect register
387 * @cgs_device: opaque device handle
388 * @offset: register offset
389 * @value: register value
391 typedef void (*cgs_write_ind_register_t)(struct cgs_device *cgs_device, enum cgs_ind_reg space,
392 unsigned index, uint32_t value);
395 * cgs_read_pci_config_byte() - Read byte from PCI configuration space
396 * @cgs_device: opaque device handle
401 typedef uint8_t (*cgs_read_pci_config_byte_t)(struct cgs_device *cgs_device, unsigned addr);
404 * cgs_read_pci_config_word() - Read word from PCI configuration space
405 * @cgs_device: opaque device handle
406 * @addr: address, must be word-aligned
410 typedef uint16_t (*cgs_read_pci_config_word_t)(struct cgs_device *cgs_device, unsigned addr);
413 * cgs_read_pci_config_dword() - Read dword from PCI configuration space
414 * @cgs_device: opaque device handle
415 * @addr: address, must be dword-aligned
419 typedef uint32_t (*cgs_read_pci_config_dword_t)(struct cgs_device *cgs_device,
423 * cgs_write_pci_config_byte() - Write byte to PCI configuration space
424 * @cgs_device: opaque device handle
426 * @value: value to write
428 typedef void (*cgs_write_pci_config_byte_t)(struct cgs_device *cgs_device, unsigned addr,
432 * cgs_write_pci_config_word() - Write byte to PCI configuration space
433 * @cgs_device: opaque device handle
434 * @addr: address, must be word-aligned
435 * @value: value to write
437 typedef void (*cgs_write_pci_config_word_t)(struct cgs_device *cgs_device, unsigned addr,
441 * cgs_write_pci_config_dword() - Write byte to PCI configuration space
442 * @cgs_device: opaque device handle
443 * @addr: address, must be dword-aligned
444 * @value: value to write
446 typedef void (*cgs_write_pci_config_dword_t)(struct cgs_device *cgs_device, unsigned addr,
451 * cgs_get_pci_resource() - provide access to a device resource (PCI BAR)
452 * @cgs_device: opaque device handle
453 * @resource_type: Type of Resource (MMIO, IO, ROM, FB, DOORBELL)
454 * @size: size of the region
455 * @offset: offset from the start of the region
456 * @resource_base: base address (not including offset) returned
458 * Return: 0 on success, -errno otherwise
460 typedef int (*cgs_get_pci_resource_t)(struct cgs_device *cgs_device,
461 enum cgs_resource_type resource_type,
464 uint64_t *resource_base);
467 * cgs_atom_get_data_table() - Get a pointer to an ATOM BIOS data table
468 * @cgs_device: opaque device handle
469 * @table: data table index
470 * @size: size of the table (output, may be NULL)
471 * @frev: table format revision (output, may be NULL)
472 * @crev: table content revision (output, may be NULL)
474 * Return: Pointer to start of the table, or NULL on failure
476 typedef const void *(*cgs_atom_get_data_table_t)(
477 struct cgs_device *cgs_device, unsigned table,
478 uint16_t *size, uint8_t *frev, uint8_t *crev);
481 * cgs_atom_get_cmd_table_revs() - Get ATOM BIOS command table revisions
482 * @cgs_device: opaque device handle
483 * @table: data table index
484 * @frev: table format revision (output, may be NULL)
485 * @crev: table content revision (output, may be NULL)
487 * Return: 0 on success, -errno otherwise
489 typedef int (*cgs_atom_get_cmd_table_revs_t)(struct cgs_device *cgs_device, unsigned table,
490 uint8_t *frev, uint8_t *crev);
493 * cgs_atom_exec_cmd_table() - Execute an ATOM BIOS command table
494 * @cgs_device: opaque device handle
495 * @table: command table index
498 * Return: 0 on success, -errno otherwise
500 typedef int (*cgs_atom_exec_cmd_table_t)(struct cgs_device *cgs_device,
501 unsigned table, void *args);
504 * cgs_create_pm_request() - Create a power management request
505 * @cgs_device: opaque device handle
506 * @request: handle of created PM request (output)
508 * Return: 0 on success, -errno otherwise
510 typedef int (*cgs_create_pm_request_t)(struct cgs_device *cgs_device, cgs_handle_t *request);
513 * cgs_destroy_pm_request() - Destroy a power management request
514 * @cgs_device: opaque device handle
515 * @request: handle of created PM request
517 * Return: 0 on success, -errno otherwise
519 typedef int (*cgs_destroy_pm_request_t)(struct cgs_device *cgs_device, cgs_handle_t request);
522 * cgs_set_pm_request() - Activate or deactiveate a PM request
523 * @cgs_device: opaque device handle
524 * @request: PM request handle
525 * @active: 0 = deactivate, non-0 = activate
527 * While a PM request is active, its minimum clock requests are taken
528 * into account as the requested engines are powered up. When the
529 * request is inactive, the engines may be powered down and clocks may
530 * be lower, depending on other PM requests by other driver
533 * Return: 0 on success, -errno otherwise
535 typedef int (*cgs_set_pm_request_t)(struct cgs_device *cgs_device, cgs_handle_t request,
539 * cgs_pm_request_clock() - Request a minimum frequency for a specific clock
540 * @cgs_device: opaque device handle
541 * @request: PM request handle
542 * @clock: which clock?
543 * @freq: requested min. frequency in 10KHz units (0 to clear request)
545 * Return: 0 on success, -errno otherwise
547 typedef int (*cgs_pm_request_clock_t)(struct cgs_device *cgs_device, cgs_handle_t request,
548 enum cgs_clock clock, unsigned freq);
551 * cgs_pm_request_engine() - Request an engine to be powered up
552 * @cgs_device: opaque device handle
553 * @request: PM request handle
554 * @engine: which engine?
555 * @powered: 0 = powered down, non-0 = powered up
557 * Return: 0 on success, -errno otherwise
559 typedef int (*cgs_pm_request_engine_t)(struct cgs_device *cgs_device, cgs_handle_t request,
560 enum cgs_engine engine, int powered);
563 * cgs_pm_query_clock_limits() - Query clock frequency limits
564 * @cgs_device: opaque device handle
565 * @clock: which clock?
566 * @limits: clock limits
568 * Return: 0 on success, -errno otherwise
570 typedef int (*cgs_pm_query_clock_limits_t)(struct cgs_device *cgs_device,
571 enum cgs_clock clock,
572 struct cgs_clock_limits *limits);
575 * cgs_set_camera_voltages() - Apply specific voltages to PMIC voltage planes
576 * @cgs_device: opaque device handle
577 * @mask: bitmask of voltages to change (1<<CGS_VOLTAGE_PLANE__xyz|...)
578 * @voltages: pointer to array of voltage values in 1mV units
580 * Return: 0 on success, -errno otherwise
582 typedef int (*cgs_set_camera_voltages_t)(struct cgs_device *cgs_device, uint32_t mask,
583 const uint32_t *voltages);
585 * cgs_get_firmware_info - Get the firmware information from core driver
586 * @cgs_device: opaque device handle
587 * @type: the firmware type
588 * @info: returend firmware information
590 * Return: 0 on success, -errno otherwise
592 typedef int (*cgs_get_firmware_info)(struct cgs_device *cgs_device,
593 enum cgs_ucode_id type,
594 struct cgs_firmware_info *info);
596 typedef int (*cgs_rel_firmware)(struct cgs_device *cgs_device,
597 enum cgs_ucode_id type);
599 typedef int(*cgs_set_powergating_state)(struct cgs_device *cgs_device,
600 enum amd_ip_block_type block_type,
601 enum amd_powergating_state state);
603 typedef int(*cgs_set_clockgating_state)(struct cgs_device *cgs_device,
604 enum amd_ip_block_type block_type,
605 enum amd_clockgating_state state);
607 typedef int(*cgs_get_active_displays_info)(
608 struct cgs_device *cgs_device,
609 struct cgs_display_info *info);
611 typedef int (*cgs_notify_dpm_enabled)(struct cgs_device *cgs_device, bool enabled);
613 typedef int (*cgs_call_acpi_method)(struct cgs_device *cgs_device,
614 uint32_t acpi_method,
615 uint32_t acpi_function,
616 void *pinput, void *poutput,
617 uint32_t output_count,
619 uint32_t output_size);
621 typedef int (*cgs_query_system_info)(struct cgs_device *cgs_device,
622 struct cgs_system_info *sys_info);
624 typedef int (*cgs_is_virtualization_enabled_t)(void *cgs_device);
626 typedef int (*cgs_enter_safe_mode)(struct cgs_device *cgs_device, bool en);
629 /* memory management calls (similar to KFD interface) */
630 cgs_gpu_mem_info_t gpu_mem_info;
631 cgs_gmap_kmem_t gmap_kmem;
632 cgs_gunmap_kmem_t gunmap_kmem;
633 cgs_alloc_gpu_mem_t alloc_gpu_mem;
634 cgs_free_gpu_mem_t free_gpu_mem;
635 cgs_gmap_gpu_mem_t gmap_gpu_mem;
636 cgs_gunmap_gpu_mem_t gunmap_gpu_mem;
637 cgs_kmap_gpu_mem_t kmap_gpu_mem;
638 cgs_kunmap_gpu_mem_t kunmap_gpu_mem;
640 cgs_read_register_t read_register;
641 cgs_write_register_t write_register;
642 cgs_read_ind_register_t read_ind_register;
643 cgs_write_ind_register_t write_ind_register;
644 /* PCI configuration space access */
645 cgs_read_pci_config_byte_t read_pci_config_byte;
646 cgs_read_pci_config_word_t read_pci_config_word;
647 cgs_read_pci_config_dword_t read_pci_config_dword;
648 cgs_write_pci_config_byte_t write_pci_config_byte;
649 cgs_write_pci_config_word_t write_pci_config_word;
650 cgs_write_pci_config_dword_t write_pci_config_dword;
652 cgs_get_pci_resource_t get_pci_resource;
654 cgs_atom_get_data_table_t atom_get_data_table;
655 cgs_atom_get_cmd_table_revs_t atom_get_cmd_table_revs;
656 cgs_atom_exec_cmd_table_t atom_exec_cmd_table;
657 /* Power management */
658 cgs_create_pm_request_t create_pm_request;
659 cgs_destroy_pm_request_t destroy_pm_request;
660 cgs_set_pm_request_t set_pm_request;
661 cgs_pm_request_clock_t pm_request_clock;
662 cgs_pm_request_engine_t pm_request_engine;
663 cgs_pm_query_clock_limits_t pm_query_clock_limits;
664 cgs_set_camera_voltages_t set_camera_voltages;
666 cgs_get_firmware_info get_firmware_info;
667 cgs_rel_firmware rel_firmware;
669 cgs_set_powergating_state set_powergating_state;
670 cgs_set_clockgating_state set_clockgating_state;
671 /* display manager */
672 cgs_get_active_displays_info get_active_displays_info;
673 /* notify dpm enabled */
674 cgs_notify_dpm_enabled notify_dpm_enabled;
676 cgs_call_acpi_method call_acpi_method;
677 /* get system info */
678 cgs_query_system_info query_system_info;
679 cgs_is_virtualization_enabled_t is_virtualization_enabled;
680 cgs_enter_safe_mode enter_safe_mode;
683 struct cgs_os_ops; /* To be define in OS-specific CGS header */
687 const struct cgs_ops *ops;
688 const struct cgs_os_ops *os_ops;
689 /* to be embedded at the start of driver private structure */
692 /* Convenience macros that make CGS indirect function calls look like
693 * normal function calls */
694 #define CGS_CALL(func,dev,...) \
695 (((struct cgs_device *)dev)->ops->func(dev, ##__VA_ARGS__))
696 #define CGS_OS_CALL(func,dev,...) \
697 (((struct cgs_device *)dev)->os_ops->func(dev, ##__VA_ARGS__))
699 #define cgs_gpu_mem_info(dev,type,mc_start,mc_size,mem_size) \
700 CGS_CALL(gpu_mem_info,dev,type,mc_start,mc_size,mem_size)
701 #define cgs_gmap_kmem(dev,kmem,size,min_off,max_off,kmem_handle,mcaddr) \
702 CGS_CALL(gmap_kmem,dev,kmem,size,min_off,max_off,kmem_handle,mcaddr)
703 #define cgs_gunmap_kmem(dev,kmem_handle) \
704 CGS_CALL(gunmap_kmem,dev,keme_handle)
705 #define cgs_alloc_gpu_mem(dev,type,size,align,min_off,max_off,handle) \
706 CGS_CALL(alloc_gpu_mem,dev,type,size,align,min_off,max_off,handle)
707 #define cgs_free_gpu_mem(dev,handle) \
708 CGS_CALL(free_gpu_mem,dev,handle)
709 #define cgs_gmap_gpu_mem(dev,handle,mcaddr) \
710 CGS_CALL(gmap_gpu_mem,dev,handle,mcaddr)
711 #define cgs_gunmap_gpu_mem(dev,handle) \
712 CGS_CALL(gunmap_gpu_mem,dev,handle)
713 #define cgs_kmap_gpu_mem(dev,handle,map) \
714 CGS_CALL(kmap_gpu_mem,dev,handle,map)
715 #define cgs_kunmap_gpu_mem(dev,handle) \
716 CGS_CALL(kunmap_gpu_mem,dev,handle)
718 #define cgs_read_register(dev,offset) \
719 CGS_CALL(read_register,dev,offset)
720 #define cgs_write_register(dev,offset,value) \
721 CGS_CALL(write_register,dev,offset,value)
722 #define cgs_read_ind_register(dev,space,index) \
723 CGS_CALL(read_ind_register,dev,space,index)
724 #define cgs_write_ind_register(dev,space,index,value) \
725 CGS_CALL(write_ind_register,dev,space,index,value)
727 #define cgs_read_pci_config_byte(dev,addr) \
728 CGS_CALL(read_pci_config_byte,dev,addr)
729 #define cgs_read_pci_config_word(dev,addr) \
730 CGS_CALL(read_pci_config_word,dev,addr)
731 #define cgs_read_pci_config_dword(dev,addr) \
732 CGS_CALL(read_pci_config_dword,dev,addr)
733 #define cgs_write_pci_config_byte(dev,addr,value) \
734 CGS_CALL(write_pci_config_byte,dev,addr,value)
735 #define cgs_write_pci_config_word(dev,addr,value) \
736 CGS_CALL(write_pci_config_word,dev,addr,value)
737 #define cgs_write_pci_config_dword(dev,addr,value) \
738 CGS_CALL(write_pci_config_dword,dev,addr,value)
740 #define cgs_atom_get_data_table(dev,table,size,frev,crev) \
741 CGS_CALL(atom_get_data_table,dev,table,size,frev,crev)
742 #define cgs_atom_get_cmd_table_revs(dev,table,frev,crev) \
743 CGS_CALL(atom_get_cmd_table_revs,dev,table,frev,crev)
744 #define cgs_atom_exec_cmd_table(dev,table,args) \
745 CGS_CALL(atom_exec_cmd_table,dev,table,args)
747 #define cgs_create_pm_request(dev,request) \
748 CGS_CALL(create_pm_request,dev,request)
749 #define cgs_destroy_pm_request(dev,request) \
750 CGS_CALL(destroy_pm_request,dev,request)
751 #define cgs_set_pm_request(dev,request,active) \
752 CGS_CALL(set_pm_request,dev,request,active)
753 #define cgs_pm_request_clock(dev,request,clock,freq) \
754 CGS_CALL(pm_request_clock,dev,request,clock,freq)
755 #define cgs_pm_request_engine(dev,request,engine,powered) \
756 CGS_CALL(pm_request_engine,dev,request,engine,powered)
757 #define cgs_pm_query_clock_limits(dev,clock,limits) \
758 CGS_CALL(pm_query_clock_limits,dev,clock,limits)
759 #define cgs_set_camera_voltages(dev,mask,voltages) \
760 CGS_CALL(set_camera_voltages,dev,mask,voltages)
761 #define cgs_get_firmware_info(dev, type, info) \
762 CGS_CALL(get_firmware_info, dev, type, info)
763 #define cgs_rel_firmware(dev, type) \
764 CGS_CALL(rel_firmware, dev, type)
765 #define cgs_set_powergating_state(dev, block_type, state) \
766 CGS_CALL(set_powergating_state, dev, block_type, state)
767 #define cgs_set_clockgating_state(dev, block_type, state) \
768 CGS_CALL(set_clockgating_state, dev, block_type, state)
769 #define cgs_notify_dpm_enabled(dev, enabled) \
770 CGS_CALL(notify_dpm_enabled, dev, enabled)
772 #define cgs_get_active_displays_info(dev, info) \
773 CGS_CALL(get_active_displays_info, dev, info)
775 #define cgs_call_acpi_method(dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size) \
776 CGS_CALL(call_acpi_method, dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size)
777 #define cgs_query_system_info(dev, sys_info) \
778 CGS_CALL(query_system_info, dev, sys_info)
779 #define cgs_get_pci_resource(cgs_device, resource_type, size, offset, \
781 CGS_CALL(get_pci_resource, cgs_device, resource_type, size, offset, \
784 #define cgs_is_virtualization_enabled(cgs_device) \
785 CGS_CALL(is_virtualization_enabled, cgs_device)
787 #define cgs_enter_safe_mode(cgs_device, en) \
788 CGS_CALL(enter_safe_mode, cgs_device, en)
790 #endif /* _CGS_COMMON_H */