From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bin Meng Date: Sun, 3 Jun 2018 19:04:25 -0700 Subject: [U-Boot] [PATCH 12/13] x86: ivybridge: Implement IvyBridge-specific IRQ converting logic In-Reply-To: <1528077866-2850-1-git-send-email-bmeng.cn@gmail.com> References: <1528077866-2850-1-git-send-email-bmeng.cn@gmail.com> Message-ID: <1528077866-2850-13-git-send-email-bmeng.cn@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This adds pirq_reg_to_linkno() and pirq_linkno_to_reg() for IvyBridge. Signed-off-by: Bin Meng --- arch/x86/cpu/ivybridge/Kconfig | 4 +++ arch/x86/include/asm/arch-ivybridge/irq.h | 45 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 arch/x86/include/asm/arch-ivybridge/irq.h diff --git a/arch/x86/cpu/ivybridge/Kconfig b/arch/x86/cpu/ivybridge/Kconfig index eec92df..e31c33c 100644 --- a/arch/x86/cpu/ivybridge/Kconfig +++ b/arch/x86/cpu/ivybridge/Kconfig @@ -58,6 +58,10 @@ config ENABLE_VMX will be unable to support virtualisation, or it will run very slowly. +config DISCRETE_PIRQ_ROUT + bool + default y + config FSP_ADDR hex default 0xfff80000 diff --git a/arch/x86/include/asm/arch-ivybridge/irq.h b/arch/x86/include/asm/arch-ivybridge/irq.h new file mode 100644 index 0000000..d8ddf55 --- /dev/null +++ b/arch/x86/include/asm/arch-ivybridge/irq.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2018, Bin Meng + * + * IvyBridge specific IRQ converting logic + */ + +#ifndef _IVYBRIDGE_IRQ_H_ +#define _IVYBRIDGE_IRQ_H_ + +/** + * 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) +{ + int linkno = reg - base; + + if (linkno > PIRQH) + linkno -= 4; + + return linkno; +} + +/** + * 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) +{ + int reg = linkno + base; + + if (linkno > PIRQD) + reg += 4; + + return reg; +} + +#endif /* _IVYBRIDGE_IRQ_H_ */ -- 2.7.4