cgs_common.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. /*
  2. * Copyright 2015 Advanced Micro Devices, Inc.
  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 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.
  21. *
  22. *
  23. */
  24. #ifndef _CGS_COMMON_H
  25. #define _CGS_COMMON_H
  26. #include "amd_shared.h"
  27. struct cgs_device;
  28. /**
  29. * enum cgs_gpu_mem_type - GPU memory types
  30. */
  31. enum cgs_gpu_mem_type {
  32. CGS_GPU_MEM_TYPE__VISIBLE_FB,
  33. CGS_GPU_MEM_TYPE__INVISIBLE_FB,
  34. CGS_GPU_MEM_TYPE__VISIBLE_CONTIG_FB,
  35. CGS_GPU_MEM_TYPE__INVISIBLE_CONTIG_FB,
  36. CGS_GPU_MEM_TYPE__GART_CACHEABLE,
  37. CGS_GPU_MEM_TYPE__GART_WRITECOMBINE
  38. };
  39. /**
  40. * enum cgs_ind_reg - Indirect register spaces
  41. */
  42. enum cgs_ind_reg {
  43. CGS_IND_REG__MMIO,
  44. CGS_IND_REG__PCIE,
  45. CGS_IND_REG__SMC,
  46. CGS_IND_REG__UVD_CTX,
  47. CGS_IND_REG__DIDT,
  48. CGS_IND_REG_GC_CAC,
  49. CGS_IND_REG_SE_CAC,
  50. CGS_IND_REG__AUDIO_ENDPT
  51. };
  52. /**
  53. * enum cgs_engine - Engines that can be statically power-gated
  54. */
  55. enum cgs_engine {
  56. CGS_ENGINE__UVD,
  57. CGS_ENGINE__VCE,
  58. CGS_ENGINE__VP8,
  59. CGS_ENGINE__ACP_DMA,
  60. CGS_ENGINE__ACP_DSP0,
  61. CGS_ENGINE__ACP_DSP1,
  62. CGS_ENGINE__ISP,
  63. /* ... */
  64. };
  65. /*
  66. * enum cgs_ucode_id - Firmware types for different IPs
  67. */
  68. enum cgs_ucode_id {
  69. CGS_UCODE_ID_SMU = 0,
  70. CGS_UCODE_ID_SMU_SK,
  71. CGS_UCODE_ID_SDMA0,
  72. CGS_UCODE_ID_SDMA1,
  73. CGS_UCODE_ID_CP_CE,
  74. CGS_UCODE_ID_CP_PFP,
  75. CGS_UCODE_ID_CP_ME,
  76. CGS_UCODE_ID_CP_MEC,
  77. CGS_UCODE_ID_CP_MEC_JT1,
  78. CGS_UCODE_ID_CP_MEC_JT2,
  79. CGS_UCODE_ID_GMCON_RENG,
  80. CGS_UCODE_ID_RLC_G,
  81. CGS_UCODE_ID_STORAGE,
  82. CGS_UCODE_ID_MAXIMUM,
  83. };
  84. enum cgs_system_info_id {
  85. CGS_SYSTEM_INFO_ADAPTER_BDF_ID = 1,
  86. CGS_SYSTEM_INFO_PCIE_GEN_INFO,
  87. CGS_SYSTEM_INFO_PCIE_MLW,
  88. CGS_SYSTEM_INFO_PCIE_DEV,
  89. CGS_SYSTEM_INFO_PCIE_REV,
  90. CGS_SYSTEM_INFO_CG_FLAGS,
  91. CGS_SYSTEM_INFO_PG_FLAGS,
  92. CGS_SYSTEM_INFO_GFX_CU_INFO,
  93. CGS_SYSTEM_INFO_GFX_SE_INFO,
  94. CGS_SYSTEM_INFO_PCIE_SUB_SYS_ID,
  95. CGS_SYSTEM_INFO_PCIE_SUB_SYS_VENDOR_ID,
  96. CGS_SYSTEM_INFO_ID_MAXIMUM,
  97. };
  98. struct cgs_system_info {
  99. uint64_t size;
  100. enum cgs_system_info_id info_id;
  101. union {
  102. void *ptr;
  103. uint64_t value;
  104. };
  105. uint64_t padding[13];
  106. };
  107. /*
  108. * enum cgs_resource_type - GPU resource type
  109. */
  110. enum cgs_resource_type {
  111. CGS_RESOURCE_TYPE_MMIO = 0,
  112. CGS_RESOURCE_TYPE_FB,
  113. CGS_RESOURCE_TYPE_IO,
  114. CGS_RESOURCE_TYPE_DOORBELL,
  115. CGS_RESOURCE_TYPE_ROM,
  116. };
  117. /**
  118. * struct cgs_firmware_info - Firmware information
  119. */
  120. struct cgs_firmware_info {
  121. uint16_t version;
  122. uint16_t fw_version;
  123. uint16_t feature_version;
  124. uint32_t image_size;
  125. uint64_t mc_addr;
  126. /* only for smc firmware */
  127. uint32_t ucode_start_address;
  128. void *kptr;
  129. bool is_kicker;
  130. };
  131. struct cgs_mode_info {
  132. uint32_t refresh_rate;
  133. uint32_t ref_clock;
  134. uint32_t vblank_time_us;
  135. };
  136. struct cgs_display_info {
  137. uint32_t display_count;
  138. uint32_t active_display_mask;
  139. struct cgs_mode_info *mode_info;
  140. };
  141. typedef unsigned long cgs_handle_t;
  142. #define CGS_ACPI_METHOD_ATCS 0x53435441
  143. #define CGS_ACPI_METHOD_ATIF 0x46495441
  144. #define CGS_ACPI_METHOD_ATPX 0x58505441
  145. #define CGS_ACPI_FIELD_METHOD_NAME 0x00000001
  146. #define CGS_ACPI_FIELD_INPUT_ARGUMENT_COUNT 0x00000002
  147. #define CGS_ACPI_MAX_BUFFER_SIZE 256
  148. #define CGS_ACPI_TYPE_ANY 0x00
  149. #define CGS_ACPI_TYPE_INTEGER 0x01
  150. #define CGS_ACPI_TYPE_STRING 0x02
  151. #define CGS_ACPI_TYPE_BUFFER 0x03
  152. #define CGS_ACPI_TYPE_PACKAGE 0x04
  153. struct cgs_acpi_method_argument {
  154. uint32_t type;
  155. uint32_t data_length;
  156. union{
  157. uint32_t value;
  158. void *pointer;
  159. };
  160. };
  161. struct cgs_acpi_method_info {
  162. uint32_t size;
  163. uint32_t field;
  164. uint32_t input_count;
  165. uint32_t name;
  166. struct cgs_acpi_method_argument *pinput_argument;
  167. uint32_t output_count;
  168. struct cgs_acpi_method_argument *poutput_argument;
  169. uint32_t padding[9];
  170. };
  171. /**
  172. * cgs_alloc_gpu_mem() - Allocate GPU memory
  173. * @cgs_device: opaque device handle
  174. * @type: memory type
  175. * @size: size in bytes
  176. * @align: alignment in bytes
  177. * @min_offset: minimum offset from start of heap
  178. * @max_offset: maximum offset from start of heap
  179. * @handle: memory handle (output)
  180. *
  181. * The memory types CGS_GPU_MEM_TYPE_*_CONTIG_FB force contiguous
  182. * memory allocation. This guarantees that the MC address returned by
  183. * cgs_gmap_gpu_mem is not mapped through the GART. The non-contiguous
  184. * FB memory types may be GART mapped depending on memory
  185. * fragmentation and memory allocator policies.
  186. *
  187. * If min/max_offset are non-0, the allocation will be forced to
  188. * reside between these offsets in its respective memory heap. The
  189. * base address that the offset relates to, depends on the memory
  190. * type.
  191. *
  192. * - CGS_GPU_MEM_TYPE__*_CONTIG_FB: FB MC base address
  193. * - CGS_GPU_MEM_TYPE__GART_*: GART aperture base address
  194. * - others: undefined, don't use with max_offset
  195. *
  196. * Return: 0 on success, -errno otherwise
  197. */
  198. typedef int (*cgs_alloc_gpu_mem_t)(struct cgs_device *cgs_device, enum cgs_gpu_mem_type type,
  199. uint64_t size, uint64_t align,
  200. uint64_t min_offset, uint64_t max_offset,
  201. cgs_handle_t *handle);
  202. /**
  203. * cgs_free_gpu_mem() - Free GPU memory
  204. * @cgs_device: opaque device handle
  205. * @handle: memory handle returned by alloc or import
  206. *
  207. * Return: 0 on success, -errno otherwise
  208. */
  209. typedef int (*cgs_free_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle);
  210. /**
  211. * cgs_gmap_gpu_mem() - GPU-map GPU memory
  212. * @cgs_device: opaque device handle
  213. * @handle: memory handle returned by alloc or import
  214. * @mcaddr: MC address (output)
  215. *
  216. * Ensures that a buffer is GPU accessible and returns its MC address.
  217. *
  218. * Return: 0 on success, -errno otherwise
  219. */
  220. typedef int (*cgs_gmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle,
  221. uint64_t *mcaddr);
  222. /**
  223. * cgs_gunmap_gpu_mem() - GPU-unmap GPU memory
  224. * @cgs_device: opaque device handle
  225. * @handle: memory handle returned by alloc or import
  226. *
  227. * Allows the buffer to be migrated while it's not used by the GPU.
  228. *
  229. * Return: 0 on success, -errno otherwise
  230. */
  231. typedef int (*cgs_gunmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle);
  232. /**
  233. * cgs_kmap_gpu_mem() - Kernel-map GPU memory
  234. *
  235. * @cgs_device: opaque device handle
  236. * @handle: memory handle returned by alloc or import
  237. * @map: Kernel virtual address the memory was mapped to (output)
  238. *
  239. * Return: 0 on success, -errno otherwise
  240. */
  241. typedef int (*cgs_kmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle,
  242. void **map);
  243. /**
  244. * cgs_kunmap_gpu_mem() - Kernel-unmap GPU memory
  245. * @cgs_device: opaque device handle
  246. * @handle: memory handle returned by alloc or import
  247. *
  248. * Return: 0 on success, -errno otherwise
  249. */
  250. typedef int (*cgs_kunmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle);
  251. /**
  252. * cgs_read_register() - Read an MMIO register
  253. * @cgs_device: opaque device handle
  254. * @offset: register offset
  255. *
  256. * Return: register value
  257. */
  258. typedef uint32_t (*cgs_read_register_t)(struct cgs_device *cgs_device, unsigned offset);
  259. /**
  260. * cgs_write_register() - Write an MMIO register
  261. * @cgs_device: opaque device handle
  262. * @offset: register offset
  263. * @value: register value
  264. */
  265. typedef void (*cgs_write_register_t)(struct cgs_device *cgs_device, unsigned offset,
  266. uint32_t value);
  267. /**
  268. * cgs_read_ind_register() - Read an indirect register
  269. * @cgs_device: opaque device handle
  270. * @offset: register offset
  271. *
  272. * Return: register value
  273. */
  274. typedef uint32_t (*cgs_read_ind_register_t)(struct cgs_device *cgs_device, enum cgs_ind_reg space,
  275. unsigned index);
  276. /**
  277. * cgs_write_ind_register() - Write an indirect register
  278. * @cgs_device: opaque device handle
  279. * @offset: register offset
  280. * @value: register value
  281. */
  282. typedef void (*cgs_write_ind_register_t)(struct cgs_device *cgs_device, enum cgs_ind_reg space,
  283. unsigned index, uint32_t value);
  284. /**
  285. * cgs_get_pci_resource() - provide access to a device resource (PCI BAR)
  286. * @cgs_device: opaque device handle
  287. * @resource_type: Type of Resource (MMIO, IO, ROM, FB, DOORBELL)
  288. * @size: size of the region
  289. * @offset: offset from the start of the region
  290. * @resource_base: base address (not including offset) returned
  291. *
  292. * Return: 0 on success, -errno otherwise
  293. */
  294. typedef int (*cgs_get_pci_resource_t)(struct cgs_device *cgs_device,
  295. enum cgs_resource_type resource_type,
  296. uint64_t size,
  297. uint64_t offset,
  298. uint64_t *resource_base);
  299. /**
  300. * cgs_atom_get_data_table() - Get a pointer to an ATOM BIOS data table
  301. * @cgs_device: opaque device handle
  302. * @table: data table index
  303. * @size: size of the table (output, may be NULL)
  304. * @frev: table format revision (output, may be NULL)
  305. * @crev: table content revision (output, may be NULL)
  306. *
  307. * Return: Pointer to start of the table, or NULL on failure
  308. */
  309. typedef const void *(*cgs_atom_get_data_table_t)(
  310. struct cgs_device *cgs_device, unsigned table,
  311. uint16_t *size, uint8_t *frev, uint8_t *crev);
  312. /**
  313. * cgs_atom_get_cmd_table_revs() - Get ATOM BIOS command table revisions
  314. * @cgs_device: opaque device handle
  315. * @table: data table index
  316. * @frev: table format revision (output, may be NULL)
  317. * @crev: table content revision (output, may be NULL)
  318. *
  319. * Return: 0 on success, -errno otherwise
  320. */
  321. typedef int (*cgs_atom_get_cmd_table_revs_t)(struct cgs_device *cgs_device, unsigned table,
  322. uint8_t *frev, uint8_t *crev);
  323. /**
  324. * cgs_atom_exec_cmd_table() - Execute an ATOM BIOS command table
  325. * @cgs_device: opaque device handle
  326. * @table: command table index
  327. * @args: arguments
  328. *
  329. * Return: 0 on success, -errno otherwise
  330. */
  331. typedef int (*cgs_atom_exec_cmd_table_t)(struct cgs_device *cgs_device,
  332. unsigned table, void *args);
  333. /**
  334. * cgs_get_firmware_info - Get the firmware information from core driver
  335. * @cgs_device: opaque device handle
  336. * @type: the firmware type
  337. * @info: returend firmware information
  338. *
  339. * Return: 0 on success, -errno otherwise
  340. */
  341. typedef int (*cgs_get_firmware_info)(struct cgs_device *cgs_device,
  342. enum cgs_ucode_id type,
  343. struct cgs_firmware_info *info);
  344. typedef int (*cgs_rel_firmware)(struct cgs_device *cgs_device,
  345. enum cgs_ucode_id type);
  346. typedef int(*cgs_set_powergating_state)(struct cgs_device *cgs_device,
  347. enum amd_ip_block_type block_type,
  348. enum amd_powergating_state state);
  349. typedef int(*cgs_set_clockgating_state)(struct cgs_device *cgs_device,
  350. enum amd_ip_block_type block_type,
  351. enum amd_clockgating_state state);
  352. typedef int(*cgs_get_active_displays_info)(
  353. struct cgs_device *cgs_device,
  354. struct cgs_display_info *info);
  355. typedef int (*cgs_notify_dpm_enabled)(struct cgs_device *cgs_device, bool enabled);
  356. typedef int (*cgs_call_acpi_method)(struct cgs_device *cgs_device,
  357. uint32_t acpi_method,
  358. uint32_t acpi_function,
  359. void *pinput, void *poutput,
  360. uint32_t output_count,
  361. uint32_t input_size,
  362. uint32_t output_size);
  363. typedef int (*cgs_query_system_info)(struct cgs_device *cgs_device,
  364. struct cgs_system_info *sys_info);
  365. typedef int (*cgs_is_virtualization_enabled_t)(void *cgs_device);
  366. typedef int (*cgs_enter_safe_mode)(struct cgs_device *cgs_device, bool en);
  367. typedef void (*cgs_lock_grbm_idx)(struct cgs_device *cgs_device, bool lock);
  368. struct cgs_ops {
  369. /* memory management calls (similar to KFD interface) */
  370. cgs_alloc_gpu_mem_t alloc_gpu_mem;
  371. cgs_free_gpu_mem_t free_gpu_mem;
  372. cgs_gmap_gpu_mem_t gmap_gpu_mem;
  373. cgs_gunmap_gpu_mem_t gunmap_gpu_mem;
  374. cgs_kmap_gpu_mem_t kmap_gpu_mem;
  375. cgs_kunmap_gpu_mem_t kunmap_gpu_mem;
  376. /* MMIO access */
  377. cgs_read_register_t read_register;
  378. cgs_write_register_t write_register;
  379. cgs_read_ind_register_t read_ind_register;
  380. cgs_write_ind_register_t write_ind_register;
  381. /* PCI resources */
  382. cgs_get_pci_resource_t get_pci_resource;
  383. /* ATOM BIOS */
  384. cgs_atom_get_data_table_t atom_get_data_table;
  385. cgs_atom_get_cmd_table_revs_t atom_get_cmd_table_revs;
  386. cgs_atom_exec_cmd_table_t atom_exec_cmd_table;
  387. /* Firmware Info */
  388. cgs_get_firmware_info get_firmware_info;
  389. cgs_rel_firmware rel_firmware;
  390. /* cg pg interface*/
  391. cgs_set_powergating_state set_powergating_state;
  392. cgs_set_clockgating_state set_clockgating_state;
  393. /* display manager */
  394. cgs_get_active_displays_info get_active_displays_info;
  395. /* notify dpm enabled */
  396. cgs_notify_dpm_enabled notify_dpm_enabled;
  397. /* ACPI */
  398. cgs_call_acpi_method call_acpi_method;
  399. /* get system info */
  400. cgs_query_system_info query_system_info;
  401. cgs_is_virtualization_enabled_t is_virtualization_enabled;
  402. cgs_enter_safe_mode enter_safe_mode;
  403. cgs_lock_grbm_idx lock_grbm_idx;
  404. };
  405. struct cgs_os_ops; /* To be define in OS-specific CGS header */
  406. struct cgs_device
  407. {
  408. const struct cgs_ops *ops;
  409. const struct cgs_os_ops *os_ops;
  410. /* to be embedded at the start of driver private structure */
  411. };
  412. /* Convenience macros that make CGS indirect function calls look like
  413. * normal function calls */
  414. #define CGS_CALL(func,dev,...) \
  415. (((struct cgs_device *)dev)->ops->func(dev, ##__VA_ARGS__))
  416. #define CGS_OS_CALL(func,dev,...) \
  417. (((struct cgs_device *)dev)->os_ops->func(dev, ##__VA_ARGS__))
  418. #define cgs_alloc_gpu_mem(dev,type,size,align,min_off,max_off,handle) \
  419. CGS_CALL(alloc_gpu_mem,dev,type,size,align,min_off,max_off,handle)
  420. #define cgs_free_gpu_mem(dev,handle) \
  421. CGS_CALL(free_gpu_mem,dev,handle)
  422. #define cgs_gmap_gpu_mem(dev,handle,mcaddr) \
  423. CGS_CALL(gmap_gpu_mem,dev,handle,mcaddr)
  424. #define cgs_gunmap_gpu_mem(dev,handle) \
  425. CGS_CALL(gunmap_gpu_mem,dev,handle)
  426. #define cgs_kmap_gpu_mem(dev,handle,map) \
  427. CGS_CALL(kmap_gpu_mem,dev,handle,map)
  428. #define cgs_kunmap_gpu_mem(dev,handle) \
  429. CGS_CALL(kunmap_gpu_mem,dev,handle)
  430. #define cgs_read_register(dev,offset) \
  431. CGS_CALL(read_register,dev,offset)
  432. #define cgs_write_register(dev,offset,value) \
  433. CGS_CALL(write_register,dev,offset,value)
  434. #define cgs_read_ind_register(dev,space,index) \
  435. CGS_CALL(read_ind_register,dev,space,index)
  436. #define cgs_write_ind_register(dev,space,index,value) \
  437. CGS_CALL(write_ind_register,dev,space,index,value)
  438. #define cgs_atom_get_data_table(dev,table,size,frev,crev) \
  439. CGS_CALL(atom_get_data_table,dev,table,size,frev,crev)
  440. #define cgs_atom_get_cmd_table_revs(dev,table,frev,crev) \
  441. CGS_CALL(atom_get_cmd_table_revs,dev,table,frev,crev)
  442. #define cgs_atom_exec_cmd_table(dev,table,args) \
  443. CGS_CALL(atom_exec_cmd_table,dev,table,args)
  444. #define cgs_get_firmware_info(dev, type, info) \
  445. CGS_CALL(get_firmware_info, dev, type, info)
  446. #define cgs_rel_firmware(dev, type) \
  447. CGS_CALL(rel_firmware, dev, type)
  448. #define cgs_set_powergating_state(dev, block_type, state) \
  449. CGS_CALL(set_powergating_state, dev, block_type, state)
  450. #define cgs_set_clockgating_state(dev, block_type, state) \
  451. CGS_CALL(set_clockgating_state, dev, block_type, state)
  452. #define cgs_notify_dpm_enabled(dev, enabled) \
  453. CGS_CALL(notify_dpm_enabled, dev, enabled)
  454. #define cgs_get_active_displays_info(dev, info) \
  455. CGS_CALL(get_active_displays_info, dev, info)
  456. #define cgs_call_acpi_method(dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size) \
  457. CGS_CALL(call_acpi_method, dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size)
  458. #define cgs_query_system_info(dev, sys_info) \
  459. CGS_CALL(query_system_info, dev, sys_info)
  460. #define cgs_get_pci_resource(cgs_device, resource_type, size, offset, \
  461. resource_base) \
  462. CGS_CALL(get_pci_resource, cgs_device, resource_type, size, offset, \
  463. resource_base)
  464. #define cgs_is_virtualization_enabled(cgs_device) \
  465. CGS_CALL(is_virtualization_enabled, cgs_device)
  466. #define cgs_enter_safe_mode(cgs_device, en) \
  467. CGS_CALL(enter_safe_mode, cgs_device, en)
  468. #define cgs_lock_grbm_idx(cgs_device, lock) \
  469. CGS_CALL(lock_grbm_idx, cgs_device, lock)
  470. #endif /* _CGS_COMMON_H */