blob: 45d4df3e51e6919a7632dd1e06eda5728378143c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __ASM_I8259_H__
2#define __ASM_I8259_H__
3
David P. Reedbc0a7332008-02-18 13:58:34 -05004#include <linux/delay.h>
5
Linus Torvalds1da177e2005-04-16 15:20:36 -07006extern unsigned int cached_irq_mask;
7
Joe Perchesace4fdb2008-03-23 01:02:19 -07008#define __byte(x, y) (((unsigned char *)&(y))[x])
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#define cached_master_mask (__byte(0, cached_irq_mask))
10#define cached_slave_mask (__byte(1, cached_irq_mask))
11
Thomas Gleixnerf20ebee2008-01-30 13:30:29 +010012/* i8259A PIC registers */
13#define PIC_MASTER_CMD 0x20
14#define PIC_MASTER_IMR 0x21
15#define PIC_MASTER_ISR PIC_MASTER_CMD
16#define PIC_MASTER_POLL PIC_MASTER_ISR
17#define PIC_MASTER_OCW3 PIC_MASTER_ISR
18#define PIC_SLAVE_CMD 0xa0
19#define PIC_SLAVE_IMR 0xa1
20
21/* i8259A PIC related value */
22#define PIC_CASCADE_IR 2
23#define MASTER_ICW4_DEFAULT 0x01
24#define SLAVE_ICW4_DEFAULT 0x01
25#define PIC_ICW4_AEOI 2
26
Linus Torvalds1da177e2005-04-16 15:20:36 -070027extern spinlock_t i8259A_lock;
28
29extern void init_8259A(int auto_eoi);
30extern void enable_8259A_irq(unsigned int irq);
31extern void disable_8259A_irq(unsigned int irq);
32extern unsigned int startup_8259A_irq(unsigned int irq);
33
David P. Reedbc0a7332008-02-18 13:58:34 -050034/* the PIC may need a careful delay on some platforms, hence specific calls */
35static inline unsigned char inb_pic(unsigned int port)
36{
37 unsigned char value = inb(port);
38
39 /*
40 * delay for some accesses to PIC on motherboard or in chipset
41 * must be at least one microsecond, so be safe here:
42 */
43 udelay(2);
44
45 return value;
46}
47
48static inline void outb_pic(unsigned char value, unsigned int port)
49{
50 outb(value, port);
51 /*
52 * delay for some accesses to PIC on motherboard or in chipset
53 * must be at least one microsecond, so be safe here:
54 */
55 udelay(2);
56}
Alan Cox466eed22008-01-30 13:33:14 +010057
Linus Torvalds1da177e2005-04-16 15:20:36 -070058#endif /* __ASM_I8259_H__ */