amd_shared.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. /*
  34. * Supported ASIC types
  35. */
  36. enum amd_asic_type {
  37. CHIP_BONAIRE = 0,
  38. CHIP_KAVERI,
  39. CHIP_KABINI,
  40. CHIP_HAWAII,
  41. CHIP_MULLINS,
  42. CHIP_TOPAZ,
  43. CHIP_TONGA,
  44. CHIP_FIJI,
  45. CHIP_CARRIZO,
  46. CHIP_LAST,
  47. };
  48. /*
  49. * Chip flags
  50. */
  51. enum amd_chip_flags {
  52. AMD_ASIC_MASK = 0x0000ffffUL,
  53. AMD_FLAGS_MASK = 0xffff0000UL,
  54. AMD_IS_MOBILITY = 0x00010000UL,
  55. AMD_IS_APU = 0x00020000UL,
  56. AMD_IS_PX = 0x00040000UL,
  57. AMD_EXP_HW_SUPPORT = 0x00080000UL,
  58. };
  59. enum amd_ip_block_type {
  60. AMD_IP_BLOCK_TYPE_COMMON,
  61. AMD_IP_BLOCK_TYPE_GMC,
  62. AMD_IP_BLOCK_TYPE_IH,
  63. AMD_IP_BLOCK_TYPE_SMC,
  64. AMD_IP_BLOCK_TYPE_DCE,
  65. AMD_IP_BLOCK_TYPE_GFX,
  66. AMD_IP_BLOCK_TYPE_SDMA,
  67. AMD_IP_BLOCK_TYPE_UVD,
  68. AMD_IP_BLOCK_TYPE_VCE,
  69. };
  70. enum amd_clockgating_state {
  71. AMD_CG_STATE_GATE = 0,
  72. AMD_CG_STATE_UNGATE,
  73. };
  74. enum amd_powergating_state {
  75. AMD_PG_STATE_GATE = 0,
  76. AMD_PG_STATE_UNGATE,
  77. };
  78. struct amd_ip_funcs {
  79. /* sets up early driver state (pre sw_init), does not configure hw - Optional */
  80. int (*early_init)(void *handle);
  81. /* sets up late driver/hw state (post hw_init) - Optional */
  82. int (*late_init)(void *handle);
  83. /* sets up driver state, does not configure hw */
  84. int (*sw_init)(void *handle);
  85. /* tears down driver state, does not configure hw */
  86. int (*sw_fini)(void *handle);
  87. /* sets up the hw state */
  88. int (*hw_init)(void *handle);
  89. /* tears down the hw state */
  90. int (*hw_fini)(void *handle);
  91. /* handles IP specific hw/sw changes for suspend */
  92. int (*suspend)(void *handle);
  93. /* handles IP specific hw/sw changes for resume */
  94. int (*resume)(void *handle);
  95. /* returns current IP block idle status */
  96. bool (*is_idle)(void *handle);
  97. /* poll for idle */
  98. int (*wait_for_idle)(void *handle);
  99. /* soft reset the IP block */
  100. int (*soft_reset)(void *handle);
  101. /* dump the IP block status registers */
  102. void (*print_status)(void *handle);
  103. /* enable/disable cg for the IP block */
  104. int (*set_clockgating_state)(void *handle,
  105. enum amd_clockgating_state state);
  106. /* enable/disable pg for the IP block */
  107. int (*set_powergating_state)(void *handle,
  108. enum amd_powergating_state state);
  109. };
  110. #endif /* __AMD_SHARED_H__ */