irq.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #ifndef _ARCH_IRQ_H_
  7. #define _ARCH_IRQ_H_
  8. #include <dt-bindings/interrupt-router/intel-irq.h>
  9. /**
  10. * Intel interrupt router configuration mechanism
  11. *
  12. * There are two known ways of Intel interrupt router configuration mechanism
  13. * so far. On most cases, the IRQ routing configuraiton is controlled by PCI
  14. * configuraiton registers on the legacy bridge, normally PCI BDF(0, 31, 0).
  15. * On some newer platforms like BayTrail and Braswell, the IRQ routing is now
  16. * in the IBASE register block where IBASE is memory-mapped.
  17. */
  18. enum pirq_config {
  19. PIRQ_VIA_PCI,
  20. PIRQ_VIA_IBASE
  21. };
  22. /**
  23. * Intel interrupt router control block
  24. *
  25. * Its members' value will be filled in based on device tree's input.
  26. *
  27. * @config: PIRQ_VIA_PCI or PIRQ_VIA_IBASE
  28. * @link_base: link value base number
  29. * @irq_mask: IRQ mask reprenting the 16 IRQs in 8259, bit N is 1 means
  30. * IRQ N is available to be routed
  31. * @lb_bdf: irq router's PCI bus/device/function number encoding
  32. * @ibase: IBASE register block base address
  33. */
  34. struct irq_router {
  35. int config;
  36. u32 link_base;
  37. u16 irq_mask;
  38. u32 bdf;
  39. u32 ibase;
  40. };
  41. struct pirq_routing {
  42. int bdf;
  43. int pin;
  44. int pirq;
  45. };
  46. /* PIRQ link number and value conversion */
  47. #define LINK_V2N(link, base) (link - base)
  48. #define LINK_N2V(link, base) (link + base)
  49. #define PIRQ_BITMAP 0xdef8
  50. /**
  51. * irq_router_common_init() - Perform common x86 interrupt init
  52. *
  53. * This creates the PIRQ routing table and routes the IRQs
  54. */
  55. int irq_router_common_init(struct udevice *dev);
  56. #endif /* _ARCH_IRQ_H_ */