xive-internal.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright 2016,2017 IBM Corporation.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #ifndef __XIVE_INTERNAL_H
  10. #define __XIVE_INTERNAL_H
  11. /* Each CPU carry one of these with various per-CPU state */
  12. struct xive_cpu {
  13. #ifdef CONFIG_SMP
  14. /* HW irq number and data of IPI */
  15. u32 hw_ipi;
  16. struct xive_irq_data ipi_data;
  17. #endif /* CONFIG_SMP */
  18. int chip_id;
  19. /* Queue datas. Only one is populated */
  20. #define XIVE_MAX_QUEUES 8
  21. struct xive_q queue[XIVE_MAX_QUEUES];
  22. /*
  23. * Pending mask. Each bit corresponds to a priority that
  24. * potentially has pending interrupts.
  25. */
  26. u8 pending_prio;
  27. /* Cache of HW CPPR */
  28. u8 cppr;
  29. };
  30. /* Backend ops */
  31. struct xive_ops {
  32. int (*populate_irq_data)(u32 hw_irq, struct xive_irq_data *data);
  33. int (*configure_irq)(u32 hw_irq, u32 target, u8 prio, u32 sw_irq);
  34. int (*setup_queue)(unsigned int cpu, struct xive_cpu *xc, u8 prio);
  35. void (*cleanup_queue)(unsigned int cpu, struct xive_cpu *xc, u8 prio);
  36. void (*setup_cpu)(unsigned int cpu, struct xive_cpu *xc);
  37. void (*teardown_cpu)(unsigned int cpu, struct xive_cpu *xc);
  38. bool (*match)(struct device_node *np);
  39. void (*shutdown)(void);
  40. void (*update_pending)(struct xive_cpu *xc);
  41. void (*eoi)(u32 hw_irq);
  42. void (*sync_source)(u32 hw_irq);
  43. #ifdef CONFIG_SMP
  44. int (*get_ipi)(unsigned int cpu, struct xive_cpu *xc);
  45. void (*put_ipi)(unsigned int cpu, struct xive_cpu *xc);
  46. #endif
  47. const char *name;
  48. };
  49. bool xive_core_init(const struct xive_ops *ops, void __iomem *area, u32 offset,
  50. u8 max_prio);
  51. extern bool xive_cmdline_disabled;
  52. #endif /* __XIVE_INTERNAL_H */