00001 /* 00002 * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>. 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License as 00006 * published by the Free Software Foundation; either version 2 of the 00007 * License, or any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, but 00010 * WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 FILE_LICENCE ( GPL2_OR_LATER ); 00020 00021 #include <gpxe/io.h> 00022 #include <pic8259.h> 00023 00024 /** @file 00025 * 00026 * Minimal support for the 8259 Programmable Interrupt Controller 00027 * 00028 */ 00029 00030 /** 00031 * Send non-specific EOI(s) 00032 * 00033 * @v irq IRQ number 00034 * 00035 * This seems to be inherently unsafe. 00036 */ 00037 static inline void send_nonspecific_eoi ( unsigned int irq ) { 00038 DBG ( "Sending non-specific EOI for IRQ %d\n", irq ); 00039 if ( irq >= IRQ_PIC_CUTOFF ) { 00040 outb ( ICR_EOI_NON_SPECIFIC, PIC2_ICR ); 00041 } 00042 outb ( ICR_EOI_NON_SPECIFIC, PIC1_ICR ); 00043 } 00044 00045 /** 00046 * Send specific EOI(s) 00047 * 00048 * @v irq IRQ number 00049 */ 00050 static inline void send_specific_eoi ( unsigned int irq ) { 00051 DBG ( "Sending specific EOI for IRQ %d\n", irq ); 00052 if ( irq >= IRQ_PIC_CUTOFF ) { 00053 outb ( ( ICR_EOI_SPECIFIC | ICR_VALUE ( CHAINED_IRQ ) ), 00054 ICR_REG ( CHAINED_IRQ ) ); 00055 } 00056 outb ( ( ICR_EOI_SPECIFIC | ICR_VALUE ( irq ) ), ICR_REG ( irq ) ); 00057 } 00058 00059 /** 00060 * Send End-Of-Interrupt to the PIC 00061 * 00062 * @v irq IRQ number 00063 */ 00064 void send_eoi ( unsigned int irq ) { 00065 send_specific_eoi ( irq ); 00066 }
1.5.7.1