irq_service.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright 2012-15 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. * Authors: AMD
  23. *
  24. */
  25. #ifndef __DAL_IRQ_SERVICE_H__
  26. #define __DAL_IRQ_SERVICE_H__
  27. #include "include/irq_service_interface.h"
  28. #include "irq_types.h"
  29. struct irq_service;
  30. struct irq_source_info;
  31. struct irq_source_info_funcs {
  32. bool (*set)(
  33. struct irq_service *irq_service,
  34. const struct irq_source_info *info,
  35. bool enable);
  36. bool (*ack)(
  37. struct irq_service *irq_service,
  38. const struct irq_source_info *info);
  39. };
  40. struct irq_source_info {
  41. uint32_t src_id;
  42. uint32_t ext_id;
  43. uint32_t enable_reg;
  44. uint32_t enable_mask;
  45. uint32_t enable_value[2];
  46. uint32_t ack_reg;
  47. uint32_t ack_mask;
  48. uint32_t ack_value;
  49. uint32_t status_reg;
  50. const struct irq_source_info_funcs *funcs;
  51. };
  52. struct irq_service_funcs {
  53. enum dc_irq_source (*to_dal_irq_source)(
  54. struct irq_service *irq_service,
  55. uint32_t src_id,
  56. uint32_t ext_id);
  57. };
  58. struct irq_service {
  59. struct dc_context *ctx;
  60. const struct irq_source_info *info;
  61. const struct irq_service_funcs *funcs;
  62. };
  63. void dal_irq_service_construct(
  64. struct irq_service *irq_service,
  65. struct irq_service_init_data *init_data);
  66. void dal_irq_service_ack_generic(
  67. struct irq_service *irq_service,
  68. const struct irq_source_info *info);
  69. void dal_irq_service_set_generic(
  70. struct irq_service *irq_service,
  71. const struct irq_source_info *info,
  72. bool enable);
  73. #endif