Basic HPET MSI setup code. Routines to perform basic MSI read write
in HPET memory map and setting up irq_chip for HPET MSI.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
---
arch/x86/kernel/hpet.c | 54 ++++++++++++++++++++++++++++++++++++++
arch/x86/kernel/io_apic.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++
include/asm-x86/hpet.h | 21 +++++++++++++++
3 files changed, 139 insertions(+)
Index: tip/arch/x86/kernel/hpet.c
===================================================================
--- tip.orig/arch/x86/kernel/hpet.c 2008-09-05 17:04:12.000000000 -0700
+++ tip/arch/x86/kernel/hpet.c 2008-09-05 17:20:03.000000000 -0700
@@ -6,6 +6,8 @@
#include <linux/init.h>
#include <linux/sysdev.h>
#include <linux/pm.h>
+#include <linux/interrupt.h>
+#include <linux/cpu.h>
#include <asm/fixmap.h>
#include <asm/hpet.h>
@@ -25,6 +27,15 @@
unsigned long hpet_address;
static void __iomem *hpet_virt_address;
+struct hpet_dev {
+ struct clock_event_device evt;
+ unsigned int num;
+ int cpu;
+ unsigned int irq;
+ unsigned int flags;
+ char name[10];
+};
+
unsigned long hpet_readl(unsigned long a)
{
return readl(hpet_virt_address + a);
@@ -298,6 +309,49 @@ static int hpet_legacy_next_event(unsign
}
/*
+ * HPET MSI Support
+ */
+
+void hpet_msi_unmask(unsigned int irq)
+{
+ struct hpet_dev *hdev = get_irq_data(irq);
+ unsigned long cfg;
+
+ /* unmask it */
+ cfg = hpet_readl(HPET_Tn_CFG(hdev->num));
+ cfg |= HPET_TN_FSB;
+ hpet_writel(cfg, HPET_Tn_CFG(hdev->num));
+}
+
+void hpet_msi_mask(unsigned int irq)
+{
+ unsigned long cfg;
+ struct hpet_dev *hdev = get_irq_data(irq);
+
+ /* mask it */
+ cfg = hpet_readl(HPET_Tn_CFG(hdev->num));
+ cfg &= ~HPET_TN_FSB;
+ hpet_writel(cfg, HPET_Tn_CFG(hdev->num));
+}
+
+void hpet_msi_write(unsigned int irq, struct msi_msg *msg)
+{
+ struct hpet_dev *hdev = get_irq_data(irq);
+
+ hpet_writel(msg->data, ...