irq.h 1.7 KB

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