amd_shared.h 3.6 KB

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