Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Bin Meng | 9c7dea6 | 2015-05-25 22:35:04 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com> |
Bin Meng | 9c7dea6 | 2015-05-25 22:35:04 +0800 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef _ARCH_IRQ_H_ |
| 7 | #define _ARCH_IRQ_H_ |
| 8 | |
| 9 | #include <dt-bindings/interrupt-router/intel-irq.h> |
| 10 | |
| 11 | /** |
| 12 | * Intel interrupt router configuration mechanism |
| 13 | * |
| 14 | * There are two known ways of Intel interrupt router configuration mechanism |
Wolfgang Wallner | 4911358 | 2020-07-21 13:01:45 +0200 | [diff] [blame^] | 15 | * so far. On most cases, the IRQ routing configuration is controlled by PCI |
| 16 | * configuration registers on the legacy bridge, normally PCI BDF(0, 31, 0). |
Bin Meng | 9c7dea6 | 2015-05-25 22:35:04 +0800 | [diff] [blame] | 17 | * On some newer platforms like BayTrail and Braswell, the IRQ routing is now |
| 18 | * in the IBASE register block where IBASE is memory-mapped. |
| 19 | */ |
| 20 | enum pirq_config { |
| 21 | PIRQ_VIA_PCI, |
| 22 | PIRQ_VIA_IBASE |
| 23 | }; |
| 24 | |
Bin Meng | 51050ff | 2018-06-12 01:26:46 -0700 | [diff] [blame] | 25 | struct pirq_regmap { |
| 26 | int link; |
| 27 | int offset; |
| 28 | }; |
| 29 | |
Bin Meng | 9c7dea6 | 2015-05-25 22:35:04 +0800 | [diff] [blame] | 30 | /** |
| 31 | * Intel interrupt router control block |
| 32 | * |
| 33 | * Its members' value will be filled in based on device tree's input. |
| 34 | * |
| 35 | * @config: PIRQ_VIA_PCI or PIRQ_VIA_IBASE |
| 36 | * @link_base: link value base number |
Bin Meng | dcec5d5 | 2018-06-12 01:26:45 -0700 | [diff] [blame] | 37 | * @link_num: number of PIRQ links supported |
Bin Meng | 51050ff | 2018-06-12 01:26:46 -0700 | [diff] [blame] | 38 | * @has_regmap: has mapping table between PIRQ link and routing register offset |
Wolfgang Wallner | 4911358 | 2020-07-21 13:01:45 +0200 | [diff] [blame^] | 39 | * @irq_mask: IRQ mask representing the 16 IRQs in 8259, bit N is 1 means |
Bin Meng | 9c7dea6 | 2015-05-25 22:35:04 +0800 | [diff] [blame] | 40 | * IRQ N is available to be routed |
| 41 | * @lb_bdf: irq router's PCI bus/device/function number encoding |
| 42 | * @ibase: IBASE register block base address |
Bin Meng | d4e61f5 | 2016-05-07 07:46:14 -0700 | [diff] [blame] | 43 | * @actl_8bit: ACTL register width is 8-bit (for ICH series chipset) |
| 44 | * @actl_addr: ACTL register offset |
Bin Meng | 9c7dea6 | 2015-05-25 22:35:04 +0800 | [diff] [blame] | 45 | */ |
| 46 | struct irq_router { |
| 47 | int config; |
| 48 | u32 link_base; |
Bin Meng | dcec5d5 | 2018-06-12 01:26:45 -0700 | [diff] [blame] | 49 | int link_num; |
Bin Meng | 51050ff | 2018-06-12 01:26:46 -0700 | [diff] [blame] | 50 | bool has_regmap; |
| 51 | struct pirq_regmap *regmap; |
Bin Meng | 9c7dea6 | 2015-05-25 22:35:04 +0800 | [diff] [blame] | 52 | u16 irq_mask; |
| 53 | u32 bdf; |
| 54 | u32 ibase; |
Bin Meng | d4e61f5 | 2016-05-07 07:46:14 -0700 | [diff] [blame] | 55 | bool actl_8bit; |
| 56 | int actl_addr; |
Bin Meng | 9c7dea6 | 2015-05-25 22:35:04 +0800 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | struct pirq_routing { |
| 60 | int bdf; |
| 61 | int pin; |
| 62 | int pirq; |
| 63 | }; |
| 64 | |
Bin Meng | 9c7dea6 | 2015-05-25 22:35:04 +0800 | [diff] [blame] | 65 | #define PIRQ_BITMAP 0xdef8 |
| 66 | |
Bin Meng | 9c7dea6 | 2015-05-25 22:35:04 +0800 | [diff] [blame] | 67 | #endif /* _ARCH_IRQ_H_ */ |