/*
* Basic support for controlling the 8259 Programmable Interrupt Controllers.
*
* Initially written by Michael Brown (mcb30).
*/
#include <etherboot.h>
#include <pic8259.h>
#ifdef DEBUG_IRQ
#else
#define DBG(...)
#endif
/* Install a handler for the specified IRQ. Address of previous
* of IRQ will be preserved across call, therefore if the handler does
* chaining, ensure that either (a) IRQ is disabled before call, or
* (b) previous_handler points directly to the place that the handler
* picks up its chain-to address.
*/
segoff_t *previous_handler ) {
DBG ( "Invalid IRQ number %d\n" );
return 0;
}
DBG ( "Installing handler at %hx:%hx for IRQ %d, leaving %s\n",
DBG ( "...(previous handler at %hx:%hx)\n",
return 1;
}
/* Remove handler for the specified IRQ. Routine checks that another
* handler has not been installed that chains to handler before
* restored to that specified by previously_enabled.
*/
segoff_t *previous_handler ) {
DBG ( "Invalid IRQ number %d\n" );
return 0;
}
DBG ( "Cannot remove handler for IRQ %d\n" );
return 0;
}
disable_irq ( irq );
return 1;
}
/* Send specific EOI(s).
*/
if ( irq >= IRQ_PIC_CUTOFF ) {
ICR_REG(CHAINED_IRQ) );
}
}
/* Dump current 8259 status: enabled IRQs and handler addresses.
*/
#ifdef DEBUG_IRQ
void dump_irq_status (void) {
int irq = 0;
if ( irq_enabled ( irq ) ) {
}
}
}
#endif
/********************************************************************
* UNDI interrupt handling
* This essentially follows the defintion of the trivial interrupt
* handler routines. The text is assumed to locate in base memory.
*/
/* UNDI entry point and irq, used by interrupt handler
*/
/* Previous trigger count for undi IRQ handler */
/* Install the undi IRQ handler. Don't test as UNDI has not be opened.
*/
if ( undi_irq_installed_on != IRQ_NONE ) {
DBG ( "Can install undi IRQ handler only once\n" );
return 0;
}
DBG ( "Trivial IRQ handler not in base memory\n" );
return 0;
}
*pxenv_undi_irq = irq;
return 0;
disable_irq ( irq );
*undi_irq_trigger_count = 0;
DBG ( "UNDI IRQ handler installed successfully\n" );
return 1;
}
/* Remove the undi IRQ handler.
*/
if ( irq != undi_irq_installed_on ) {
DBG ( "Cannot uninstall undi IRQ handler from IRQ %d; "
"is installed on IRQ %d\n", irq,
return 0;
}
return 0;
if ( undi_irq_triggered ( undi_irq_installed_on ) ) {
DBG ( "Sending EOI for unwanted undi IRQ\n" );
}
return 1;
}
/* Safe method to detect whether or not undi IRQ has been
* triggered. Using this call avoids potential race conditions. This
* call will return success only once per trigger.
*/
/* irq is not used at present, but we have it in the API for
* future-proofing; in case we want the facility to have
* multiple undi IRQ handlers installed simultaneously.
*
* Avoid compiler warning about unused variable.
*/
return triggered ? 1 : 0;
}