blob: f216c2320436d70742e256b48fda7b1b331e014e [file] [log] [blame]
wdenk2262cfe2002-11-18 00:14:45 +00001/*
2 * (C) Copyright 2002
Albert ARIBAUDfa82f872011-08-04 18:45:45 +02003 * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
wdenk2262cfe2002-11-18 00:14:45 +00004 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
wdenk2262cfe2002-11-18 00:14:45 +00006 */
7
8/* i8259.h i8259 PIC Registers */
9
10#ifndef _ASMI386_I8259_H_
Bin Meng0a2ea022015-10-22 19:13:28 -070011#define _ASMI386_I8959_H_
wdenk2262cfe2002-11-18 00:14:45 +000012
13/* PIC I/O mapped registers */
wdenk2262cfe2002-11-18 00:14:45 +000014#define IRR 0x0 /* Interrupt Request Register */
15#define ISR 0x0 /* In-Service Register */
16#define ICW1 0x0 /* Initialization Control Word 1 */
17#define OCW2 0x0 /* Operation Control Word 2 */
18#define OCW3 0x0 /* Operation Control Word 3 */
19#define ICW2 0x1 /* Initialization Control Word 2 */
20#define ICW3 0x1 /* Initialization Control Word 3 */
21#define ICW4 0x1 /* Initialization Control Word 4 */
22#define IMR 0x1 /* Interrupt Mask Register */
23
Bin Meng0a2ea022015-10-22 19:13:28 -070024/* IRR, IMR, ISR and ICW3 bits */
wdenk2262cfe2002-11-18 00:14:45 +000025#define IR7 0x80 /* IR7 */
26#define IR6 0x40 /* IR6 */
27#define IR5 0x20 /* IR5 */
28#define IR4 0x10 /* IR4 */
29#define IR3 0x08 /* IR3 */
30#define IR2 0x04 /* IR2 */
31#define IR1 0x02 /* IR1 */
32#define IR0 0x01 /* IR0 */
33
Bin Meng0a2ea022015-10-22 19:13:28 -070034/* SEOI bits */
wdenk2262cfe2002-11-18 00:14:45 +000035#define SEOI_IR7 0x07 /* IR7 */
36#define SEOI_IR6 0x06 /* IR6 */
37#define SEOI_IR5 0x05 /* IR5 */
38#define SEOI_IR4 0x04 /* IR4 */
39#define SEOI_IR3 0x03 /* IR3 */
40#define SEOI_IR2 0x02 /* IR2 */
41#define SEOI_IR1 0x01 /* IR1 */
42#define SEOI_IR0 0x00 /* IR0 */
43
44/* OCW2 bits */
45#define OCW2_RCLR 0x00 /* Rotate/clear */
46#define OCW2_NEOI 0x20 /* Non specific EOI */
47#define OCW2_NOP 0x40 /* NOP */
48#define OCW2_SEOI 0x60 /* Specific EOI */
49#define OCW2_RSET 0x80 /* Rotate/set */
Bin Meng0a2ea022015-10-22 19:13:28 -070050#define OCW2_REOI 0xa0 /* Rotate on non specific EOI */
51#define OCW2_PSET 0xc0 /* Priority Set Command */
52#define OCW2_RSEOI 0xe0 /* Rotate on specific EOI */
wdenk2262cfe2002-11-18 00:14:45 +000053
54/* ICW1 bits */
55#define ICW1_SEL 0x10 /* Select ICW1 */
56#define ICW1_LTIM 0x08 /* Level-Triggered Interrupt Mode */
57#define ICW1_ADI 0x04 /* Address Interval */
58#define ICW1_SNGL 0x02 /* Single PIC */
59#define ICW1_EICW4 0x01 /* Expect initilization ICW4 */
60
Bin Meng0a2ea022015-10-22 19:13:28 -070061/*
62 * ICW2 is the starting vector number
63 *
64 * ICW2 is bit-mask of present slaves for a master device,
65 * or the slave ID for a slave device
66 */
wdenk2262cfe2002-11-18 00:14:45 +000067
68/* ICW4 bits */
Bin Meng0a2ea022015-10-22 19:13:28 -070069#define ICW4_AEOI 0x02 /* Automatic EOI Mode */
wdenk2262cfe2002-11-18 00:14:45 +000070#define ICW4_PM 0x01 /* Microprocessor Mode */
71
Bin Meng0a2ea022015-10-22 19:13:28 -070072#define ELCR1 0x4d0
73#define ELCR2 0x4d1
74
Bin Meng1dae2e02014-11-20 16:11:16 +080075int i8259_init(void);
76
Bin Meng0a2ea022015-10-22 19:13:28 -070077#endif /* _ASMI386_I8959_H_ */