irq.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. * @actl_8bit: ACTL register width is 8-bit (for ICH series chipset)
  34. * @actl_addr: ACTL register offset
  35. */
  36. struct irq_router {
  37. int config;
  38. u32 link_base;
  39. u16 irq_mask;
  40. u32 bdf;
  41. u32 ibase;
  42. bool actl_8bit;
  43. int actl_addr;
  44. };
  45. struct pirq_routing {
  46. int bdf;
  47. int pin;
  48. int pirq;
  49. };
  50. /* PIRQ link number and value conversion */
  51. #define LINK_V2N(link, base) (link - base)
  52. #define LINK_N2V(link, base) (link + base)
  53. #define PIRQ_BITMAP 0xdef8
  54. /**
  55. * irq_router_common_init() - Perform common x86 interrupt init
  56. *
  57. * This creates the PIRQ routing table and routes the IRQs
  58. */
  59. int irq_router_common_init(struct udevice *dev);
  60. #endif /* _ARCH_IRQ_H_ */