amd_shared.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. #ifndef __AMD_SHARED_H__
  23. #define __AMD_SHARED_H__
  24. #define AMD_MAX_USEC_TIMEOUT 100000 /* 100 ms */
  25. /*
  26. * Supported GPU families (aligned with amdgpu_drm.h)
  27. */
  28. #define AMD_FAMILY_UNKNOWN 0
  29. #define AMD_FAMILY_CI 120 /* Bonaire, Hawaii */
  30. #define AMD_FAMILY_KV 125 /* Kaveri, Kabini, Mullins */
  31. #define AMD_FAMILY_VI 130 /* Iceland, Tonga */
  32. #define AMD_FAMILY_CZ 135 /* Carrizo */
  33. enum amd_ip_block_type {
  34. AMD_IP_BLOCK_TYPE_COMMON,
  35. AMD_IP_BLOCK_TYPE_GMC,
  36. AMD_IP_BLOCK_TYPE_IH,
  37. AMD_IP_BLOCK_TYPE_SMC,
  38. AMD_IP_BLOCK_TYPE_DCE,
  39. AMD_IP_BLOCK_TYPE_GFX,
  40. AMD_IP_BLOCK_TYPE_SDMA,
  41. AMD_IP_BLOCK_TYPE_UVD,
  42. AMD_IP_BLOCK_TYPE_VCE,
  43. };
  44. enum amd_clockgating_state {
  45. AMD_CG_STATE_GATE = 0,
  46. AMD_CG_STATE_UNGATE,
  47. };
  48. enum amd_powergating_state {
  49. AMD_PG_STATE_GATE = 0,
  50. AMD_PG_STATE_UNGATE,
  51. };
  52. struct amd_ip_funcs {
  53. /* sets up early driver state (pre sw_init), does not configure hw - Optional */
  54. int (*early_init)(void *handle);
  55. /* sets up late driver/hw state (post hw_init) - Optional */
  56. int (*late_init)(void *handle);
  57. /* sets up driver state, does not configure hw */
  58. int (*sw_init)(void *handle);
  59. /* tears down driver state, does not configure hw */
  60. int (*sw_fini)(void *handle);
  61. /* sets up the hw state */
  62. int (*hw_init)(void *handle);
  63. /* tears down the hw state */
  64. int (*hw_fini)(void *handle);
  65. /* handles IP specific hw/sw changes for suspend */
  66. int (*suspend)(void *handle);
  67. /* handles IP specific hw/sw changes for resume */
  68. int (*resume)(void *handle);
  69. /* returns current IP block idle status */
  70. bool (*is_idle)(void *handle);
  71. /* poll for idle */
  72. int (*wait_for_idle)(void *handle);
  73. /* soft reset the IP block */
  74. int (*soft_reset)(void *handle);
  75. /* dump the IP block status registers */
  76. void (*print_status)(void *handle);
  77. /* enable/disable cg for the IP block */
  78. int (*set_clockgating_state)(void *handle,
  79. enum amd_clockgating_state state);
  80. /* enable/disable pg for the IP block */
  81. int (*set_powergating_state)(void *handle,
  82. enum amd_powergating_state state);
  83. };
  84. #endif /* __AMD_SHARED_H__ */