amd_shared.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. enum amd_ip_block_type {
  25. AMD_IP_BLOCK_TYPE_COMMON,
  26. AMD_IP_BLOCK_TYPE_GMC,
  27. AMD_IP_BLOCK_TYPE_IH,
  28. AMD_IP_BLOCK_TYPE_SMC,
  29. AMD_IP_BLOCK_TYPE_DCE,
  30. AMD_IP_BLOCK_TYPE_GFX,
  31. AMD_IP_BLOCK_TYPE_SDMA,
  32. AMD_IP_BLOCK_TYPE_UVD,
  33. AMD_IP_BLOCK_TYPE_VCE,
  34. };
  35. enum amd_clockgating_state {
  36. AMD_CG_STATE_GATE = 0,
  37. AMD_CG_STATE_UNGATE,
  38. };
  39. enum amd_powergating_state {
  40. AMD_PG_STATE_GATE = 0,
  41. AMD_PG_STATE_UNGATE,
  42. };
  43. struct amd_ip_funcs {
  44. /* sets up early driver state (pre sw_init), does not configure hw - Optional */
  45. int (*early_init)(void *handle);
  46. /* sets up late driver/hw state (post hw_init) - Optional */
  47. int (*late_init)(void *handle);
  48. /* sets up driver state, does not configure hw */
  49. int (*sw_init)(void *handle);
  50. /* tears down driver state, does not configure hw */
  51. int (*sw_fini)(void *handle);
  52. /* sets up the hw state */
  53. int (*hw_init)(void *handle);
  54. /* tears down the hw state */
  55. int (*hw_fini)(void *handle);
  56. /* handles IP specific hw/sw changes for suspend */
  57. int (*suspend)(void *handle);
  58. /* handles IP specific hw/sw changes for resume */
  59. int (*resume)(void *handle);
  60. /* returns current IP block idle status */
  61. bool (*is_idle)(void *handle);
  62. /* poll for idle */
  63. int (*wait_for_idle)(void *handle);
  64. /* soft reset the IP block */
  65. int (*soft_reset)(void *handle);
  66. /* dump the IP block status registers */
  67. void (*print_status)(void *handle);
  68. /* enable/disable cg for the IP block */
  69. int (*set_clockgating_state)(void *handle,
  70. enum amd_clockgating_state state);
  71. /* enable/disable pg for the IP block */
  72. int (*set_powergating_state)(void *handle,
  73. enum amd_powergating_state state);
  74. };
  75. #endif /* __AMD_SHARED_H__ */