iPXE
pic8259.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301, USA.
18  */
19 
20 FILE_LICENCE ( GPL2_OR_LATER );
21 
22 #include <ipxe/io.h>
23 #include <pic8259.h>
24 
25 /** @file
26  *
27  * Minimal support for the 8259 Programmable Interrupt Controller
28  *
29  */
30 
31 /**
32  * Send non-specific EOI(s)
33  *
34  * @v irq IRQ number
35  *
36  * This seems to be inherently unsafe.
37  */
38 static inline void send_nonspecific_eoi ( unsigned int irq ) {
39  DBG ( "Sending non-specific EOI for IRQ %d\n", irq );
40  if ( irq >= IRQ_PIC_CUTOFF ) {
42  }
44 }
45 
46 /**
47  * Send specific EOI(s)
48  *
49  * @v irq IRQ number
50  */
51 static inline void send_specific_eoi ( unsigned int irq ) {
52  DBG ( "Sending specific EOI for IRQ %d\n", irq );
53  if ( irq >= IRQ_PIC_CUTOFF ) {
55  ICR_REG ( CHAINED_IRQ ) );
56  }
57  outb ( ( ICR_EOI_SPECIFIC | ICR_VALUE ( irq ) ), ICR_REG ( irq ) );
58 }
59 
60 /**
61  * Send End-Of-Interrupt to the PIC
62  *
63  * @v irq IRQ number
64  */
65 void send_eoi ( unsigned int irq ) {
66  send_specific_eoi ( irq );
67 }
iPXE I/O API
static void send_nonspecific_eoi(unsigned int irq)
Send non-specific EOI(s)
Definition: pic8259.c:38
#define ICR_EOI_NON_SPECIFIC
Definition: pic8259.h:42
void send_eoi(unsigned int irq)
Send End-Of-Interrupt to the PIC.
Definition: pic8259.c:65
static void send_specific_eoi(unsigned int irq)
Send specific EOI(s)
Definition: pic8259.c:51
#define PIC2_ICR
Definition: pic8259.h:30
#define ICR_VALUE(irq)
Definition: pic8259.h:56
#define ICR_REG(irq)
Definition: pic8259.h:55
#define outb(data, io_addr)
Definition: io.h:309
FILE_LICENCE(GPL2_OR_LATER)
#define IRQ_PIC_CUTOFF
Definition: pic8259.h:14
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define CHAINED_IRQ
Definition: pic8259.h:57
#define PIC1_ICR
Definition: pic8259.h:20
#define ICR_EOI_SPECIFIC
Definition: pic8259.h:44