Debian Codegraph @

purgatory/arch/i386/pic.c

raw
1 /*
2 * kexec: Linux boots Linux
3 *
4 * Copyright (C) 2003,2004 Eric Biederman ([email protected])
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation (version 2 of the License).
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 #include <sys/io.h>
20 #include <purgatory.h>
21 #include "purgatory-x86.h"
22
23
24 void x86_setup_legacy_pic(void)
25 {
26 /* Load the legacy dos settings into the 8259A pic */
27 outb(0xff, 0x21); /* mask all of 8259A-1 */
28 outb(0xff, 0xa1); /* mask all of 8259A-2 */
29
30 outb(0x11, 0x20); /* ICW1: select 8259A-1 init */
31 outb(0x11, 0x80); /* A short delay */
32
33 outb(0x08, 0x21); /* ICW2: 8259A-1 IR0-7 mappend to 0x8-0xf */
34 outb(0x08, 0x80); /* A short delay */
35
36 outb(0x01, 0x21); /* Normal 8086 auto EOI mode */
37 outb(0x01, 0x80); /* A short delay */
38
39 outb(0x11, 0xa0); /* ICW1: select 8259A-2 init */
40 outb(0x11, 0x80); /* A short delay */
41
42 outb(0x70, 0xa1); /* ICW2: 8259A-2 IR0-7 mappend to 0x70-0x77 */
43 outb(0x70, 0x80); /* A short delay */
44
45 outb(0x01, 0xa1); /* Normal 8086 auto EOI mode */
46 outb(0x01, 0x80); /* A short delay */
47
48 outb(0x00, 0x21); /* Unmask all of 8259A-1 */
49 outb(0x00, 0xa1); /* Unmask all of 8259A-2 */
50 }
51