diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2018-06-03 19:04:23 -0700 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2018-06-13 09:50:57 +0800 |
commit | 594d089c8a6439910b7df784e8929b65229b9e91 (patch) | |
tree | 55b9efb69b0e06cc5215e266e0020ce46c6db33b /arch/x86/include | |
parent | bc728b1bc0091e5614e82a499820ee8983c7a0b3 (diff) |
x86: irq: Change LINK_V2N and LINK_N2V to inline functions
LINK_V2N and LINK_N2V are currently defines, so they cannot handle
complex logics. Change to inline functions for future extension.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/irq.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h index ad95bb4927..bfa58cf589 100644 --- a/arch/x86/include/asm/irq.h +++ b/arch/x86/include/asm/irq.h @@ -52,9 +52,29 @@ struct pirq_routing { int pirq; }; -/* PIRQ link number and value conversion */ -#define LINK_V2N(link, base) (link - base) -#define LINK_N2V(link, base) (link + base) +/** + * pirq_reg_to_linkno() - Convert a PIRQ routing register offset to link number + * + * @reg: PIRQ routing register offset from the base address + * @base: PIRQ routing register block base address + * @return: PIRQ link number (0 for PIRQA, 1 for PIRQB, etc) + */ +static inline int pirq_reg_to_linkno(int reg, int base) +{ + return reg - base; +} + +/** + * pirq_linkno_to_reg() - Convert a PIRQ link number to routing register offset + * + * @linkno: PIRQ link number (0 for PIRQA, 1 for PIRQB, etc) + * @base: PIRQ routing register block base address + * @return: PIRQ routing register offset from the base address + */ +static inline int pirq_linkno_to_reg(int linkno, int base) +{ + return linkno + base; +} #define PIRQ_BITMAP 0xdef8 |