aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/i8259.c
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-06-11 15:44:48 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-06-11 15:44:48 +0100
commit3bc0cc4ae09620741451b53c13a055227bbb727a (patch)
tree9af20956b11daf17fef808cb22bc84c4763d51c5 /xen/arch/x86/i8259.c
parent094a44fe8f2f4012dc870c5f34ffe517ffb4f0db (diff)
downloadxen-3bc0cc4ae09620741451b53c13a055227bbb727a.tar.gz
xen-3bc0cc4ae09620741451b53c13a055227bbb727a.tar.bz2
xen-3bc0cc4ae09620741451b53c13a055227bbb727a.zip
Add suspend/resume to devices owned by Xen.
Signed-off-by: Ke Yu <ke.yu@intel.com> Signed-off-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/arch/x86/i8259.c')
-rw-r--r--xen/arch/x86/i8259.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/xen/arch/x86/i8259.c b/xen/arch/x86/i8259.c
index 76c47b5592..2069319ce4 100644
--- a/xen/arch/x86/i8259.c
+++ b/xen/arch/x86/i8259.c
@@ -306,6 +306,36 @@ static void mask_and_ack_8259A_vector(unsigned int vector)
}
}
+static char irq_trigger[2];
+/**
+ * ELCR registers (0x4d0, 0x4d1) control edge/level of IRQ
+ */
+static void restore_ELCR(char *trigger)
+{
+ outb(trigger[0], 0x4d0);
+ outb(trigger[1], 0x4d1);
+}
+
+static void save_ELCR(char *trigger)
+{
+ /* IRQ 0,1,2,8,13 are marked as reserved */
+ trigger[0] = inb(0x4d0) & 0xF8;
+ trigger[1] = inb(0x4d1) & 0xDE;
+}
+
+int i8259A_resume(void)
+{
+ init_8259A(0);
+ restore_ELCR(irq_trigger);
+ return 0;
+}
+
+int i8259A_suspend(void)
+{
+ save_ELCR(irq_trigger);
+ return 0;
+}
+
void __init init_8259A(int auto_eoi)
{
unsigned long flags;