interrupt_controller: allow for indeterminate faulting vectors

You can't query the LOAPIC for every kind of interrupt that fires,
it has no idea about IRQs that were generated by an 'int' instruction
for example. Extend the semantics of _irq_controller_isr_vector_get()
to return -1 if the vector can't be identified.

Issue: ZEP-602
Change-Id: I1174aa62fbedffdcd329d60da8ef14fabb042dc3
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2016-09-08 11:01:23 -07:00
commit eec13ca8c1
3 changed files with 14 additions and 7 deletions

View file

@ -406,23 +406,25 @@ void _loapic_irq_disable(unsigned int irq)
* | 0170H | 224:255 |
* --------------------
*
* @return The vector of the interrupt that is currently being processed.
* @return The vector of the interrupt that is currently being processed, or -1
* if no IRQ is being serviced.
*/
int __irq_controller_isr_vector_get(void)
{
int pReg, block;
for (block = 7; ; block--) {
/* Block 0 bits never lit up as these are all exception or reserved
* vectors
*/
for (block = 7; likely(block > 0); block--) {
pReg = sys_read32(CONFIG_LOAPIC_BASE_ADDRESS + LOAPIC_ISR +
(block * 0x10));
if (pReg) {
return (block * 32) + (find_msb_set(pReg) - 1);
}
__ASSERT(block >= 0,
"_loapic_isr_vector_get called but no ISR in service");
}
CODE_UNREACHABLE;
return -1;
}
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT

View file

@ -219,7 +219,8 @@ void __irq_controller_irq_config(unsigned int vector, unsigned int irq,
* | 0110H | 32:63 |
* --------------------
*
* @return The vector of the interrupt that is currently being processed.
* @return The vector of the interrupt that is currently being processed, or
* -1 if this can't be determined
*/
int __irq_controller_isr_vector_get(void)
{
@ -227,5 +228,8 @@ int __irq_controller_isr_vector_get(void)
int isr;
isr = sys_read32(MVIC_ISR);
if (unlikely(!isr)) {
return -1;
}
return 32 + (find_msb_set(isr) - 1);
}