aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/i8259.h13
-rw-r--r--arch/x86/kernel/i8259.c43
2 files changed, 56 insertions, 0 deletions
diff --git a/arch/x86/include/asm/i8259.h b/arch/x86/include/asm/i8259.h
index 58d7091eeb1f..e8a3e05c2882 100644
--- a/arch/x86/include/asm/i8259.h
+++ b/arch/x86/include/asm/i8259.h
@@ -57,6 +57,19 @@ static inline void outb_pic(unsigned char value, unsigned int port)
57 57
58extern struct irq_chip i8259A_chip; 58extern struct irq_chip i8259A_chip;
59 59
60struct legacy_pic {
61 int nr_legacy_irqs;
62 struct irq_chip *chip;
63 void (*mask_all)(void);
64 void (*restore_mask)(void);
65 void (*init)(int auto_eoi);
66 int (*irq_pending)(unsigned int irq);
67 void (*make_irq)(unsigned int irq);
68};
69
70extern struct legacy_pic *legacy_pic;
71extern struct legacy_pic null_legacy_pic;
72
60extern void mask_8259A(void); 73extern void mask_8259A(void);
61extern void unmask_8259A(void); 74extern void unmask_8259A(void);
62 75
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
index df89102bef80..b80987ca33ea 100644
--- a/arch/x86/kernel/i8259.c
+++ b/arch/x86/kernel/i8259.c
@@ -358,3 +358,46 @@ void init_8259A(int auto_eoi)
358 358
359 spin_unlock_irqrestore(&i8259A_lock, flags); 359 spin_unlock_irqrestore(&i8259A_lock, flags);
360} 360}
361/*
362 * make i8259 a driver so that we can select pic functions at run time. the goal
363 * is to make x86 binary compatible among pc compatible and non-pc compatible
364 * platforms, such as x86 MID.
365 */
366
367static void __init legacy_pic_noop(void) { };
368static void __init legacy_pic_uint_noop(unsigned int unused) { };
369static void __init legacy_pic_int_noop(int unused) { };
370
371static struct irq_chip dummy_pic_chip = {
372 .name = "dummy pic",
373 .mask = legacy_pic_uint_noop,
374 .unmask = legacy_pic_uint_noop,
375 .disable = legacy_pic_uint_noop,
376 .mask_ack = legacy_pic_uint_noop,
377};
378static int legacy_pic_irq_pending_noop(unsigned int irq)
379{
380 return 0;
381}
382
383struct legacy_pic null_legacy_pic = {
384 .nr_legacy_irqs = 0,
385 .chip = &dummy_pic_chip,
386 .mask_all = legacy_pic_noop,
387 .restore_mask = legacy_pic_noop,
388 .init = legacy_pic_int_noop,
389 .irq_pending = legacy_pic_irq_pending_noop,
390 .make_irq = legacy_pic_uint_noop,
391};
392
393struct legacy_pic default_legacy_pic = {
394 .nr_legacy_irqs = NR_IRQS_LEGACY,
395 .chip = &i8259A_chip,
396 .mask_all = mask_8259A,
397 .restore_mask = unmask_8259A,
398 .init = init_8259A,
399 .irq_pending = i8259A_irq_pending,
400 .make_irq = make_8259A_irq,
401};
402
403struct legacy_pic *legacy_pic = &default_legacy_pic;