mpmm.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2021, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MPMM_H
  7. #define MPMM_H
  8. #include <stdbool.h>
  9. #include <platform_def.h>
  10. /*
  11. * Enable the Maximum Power Mitigation Mechanism.
  12. *
  13. * This function will enable MPMM for the current core. The AMU counters
  14. * representing the MPMM gears must have been configured and enabled prior to
  15. * calling this function.
  16. */
  17. void mpmm_enable(void);
  18. /*
  19. * MPMM core data.
  20. *
  21. * This structure represents per-core data retrieved from the hardware
  22. * configuration device tree.
  23. */
  24. struct mpmm_core {
  25. /*
  26. * Whether MPMM is supported.
  27. *
  28. * Cores with support for MPMM offer one or more auxiliary AMU counters
  29. * representing MPMM gears.
  30. */
  31. bool supported;
  32. };
  33. /*
  34. * MPMM topology.
  35. *
  36. * This topology structure describes the system-wide representation of the
  37. * information retrieved from the hardware configuration device tree.
  38. */
  39. struct mpmm_topology {
  40. struct mpmm_core cores[PLATFORM_CORE_COUNT]; /* Per-core data */
  41. };
  42. #if !ENABLE_MPMM_FCONF
  43. /*
  44. * Retrieve the platform's MPMM topology. A `NULL` return value is treated as a
  45. * non-fatal error, in which case MPMM will not be enabled for any core.
  46. */
  47. const struct mpmm_topology *plat_mpmm_topology(void);
  48. #endif /* ENABLE_MPMM_FCONF */
  49. #endif /* MPMM_H */