2015-04-11 07:44:37 +08:00
|
|
|
/* ioapic.h - public IOAPIC APIs */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2012-2015 Wind River Systems, Inc.
|
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __INCioapich
|
|
|
|
#define __INCioapich
|
|
|
|
|
x86: remove dynamically generated IRQ and exception code
We are interested in supporting some XIP x86 platforms which are
unable to fetch CPU instructions from system RAM. This requires
refactoring our dynamic IRQ/exc code which currently synthesizes
assembly language instructions to create IRQ stubs on-the-fly.
Instead, a new approach is taken. Given that the configuration at
build time specifies the number of required stubs, use this
to generate a build time a set of tiny stub functions which simply
push a 'stub id' and then call common dynamic interrupt code.
The handler function and handler argument is saved in a table keyed by
this stub id.
CONFIG_EOI_HANDLER_SUPPORTED removed, the code hasn't been conditionally
compiled for some time and in all cases we call _loapic_eoi() when
finished with an interrupt.
Some other out-of-date verbiage in comments related to supporting
non-APIC removed.
Previously, when dynamic exceptions were created a pointer would
be passed in by the caller reserving ram for the stub code. Since
this is no longer feasible, two new Kconfig options have been added.
CONFIG_NUM_DYNAMIC_EXC_STUBS and CONFIG_NUM_DYNAMIC_EXC_NO_ERR_STUBS
control how many stubs are created for exceptions that push
an error code, and no error code, respectively.
SW Interrupts are no longer triggered by "int <vector>" hard-coded
assembly instructions. Instead this is done by sending a self-directed
inter-processor interrupt from the LOAPIC, using a new API
loapic_int_vect_trigger(). In this way we get rid of dynamically
generated code in irq_test_common.h.
All interrupts call _loapic_eoi() when finished, since this is now
the right thing to do for all IRQs, including SW interrupts.
_irq_handler_set() for x86 no longer requires the old function pointer
to be supplied.
Change-Id: I78993d3d00dd153c9051c518b417cce8d3acee9e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2015-10-20 05:10:53 +08:00
|
|
|
#include <drivers/loapic.h>
|
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Redirection table entry bits: lower 32 bit
|
|
|
|
* Used as flags argument in ioapic_irq_set
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define IOAPIC_INT_MASK 0x00010000
|
|
|
|
#define IOAPIC_TRIGGER_MASK 0x00008000
|
|
|
|
#define IOAPIC_LEVEL 0x00008000
|
|
|
|
#define IOAPIC_EDGE 0x00000000
|
|
|
|
#define IOAPIC_REMOTE 0x00004000
|
|
|
|
#define IOAPIC_LOW 0x00002000
|
|
|
|
#define IOAPIC_HIGH 0x00000000
|
|
|
|
#define IOAPIC_LOGICAL 0x00000800
|
|
|
|
#define IOAPIC_PHYSICAL 0x00000000
|
|
|
|
#define IOAPIC_FIXED 0x00000000
|
|
|
|
#define IOAPIC_LOWEST 0x00000100
|
|
|
|
#define IOAPIC_SMI 0x00000200
|
|
|
|
#define IOAPIC_NMI 0x00000400
|
|
|
|
#define IOAPIC_INIT 0x00000500
|
|
|
|
#define IOAPIC_EXTINT 0x00000700
|
|
|
|
|
|
|
|
#ifdef _ASMLANGUAGE
|
x86: remove dynamically generated IRQ and exception code
We are interested in supporting some XIP x86 platforms which are
unable to fetch CPU instructions from system RAM. This requires
refactoring our dynamic IRQ/exc code which currently synthesizes
assembly language instructions to create IRQ stubs on-the-fly.
Instead, a new approach is taken. Given that the configuration at
build time specifies the number of required stubs, use this
to generate a build time a set of tiny stub functions which simply
push a 'stub id' and then call common dynamic interrupt code.
The handler function and handler argument is saved in a table keyed by
this stub id.
CONFIG_EOI_HANDLER_SUPPORTED removed, the code hasn't been conditionally
compiled for some time and in all cases we call _loapic_eoi() when
finished with an interrupt.
Some other out-of-date verbiage in comments related to supporting
non-APIC removed.
Previously, when dynamic exceptions were created a pointer would
be passed in by the caller reserving ram for the stub code. Since
this is no longer feasible, two new Kconfig options have been added.
CONFIG_NUM_DYNAMIC_EXC_STUBS and CONFIG_NUM_DYNAMIC_EXC_NO_ERR_STUBS
control how many stubs are created for exceptions that push
an error code, and no error code, respectively.
SW Interrupts are no longer triggered by "int <vector>" hard-coded
assembly instructions. Instead this is done by sending a self-directed
inter-processor interrupt from the LOAPIC, using a new API
loapic_int_vect_trigger(). In this way we get rid of dynamically
generated code in irq_test_common.h.
All interrupts call _loapic_eoi() when finished, since this is now
the right thing to do for all IRQs, including SW interrupts.
_irq_handler_set() for x86 no longer requires the old function pointer
to be supplied.
Change-Id: I78993d3d00dd153c9051c518b417cce8d3acee9e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2015-10-20 05:10:53 +08:00
|
|
|
#define ioapic_mkstub loapic_mkstub
|
2015-04-11 07:44:37 +08:00
|
|
|
#else /* _ASMLANGUAGE */
|
2015-10-08 23:52:59 +08:00
|
|
|
#include <device.h>
|
2015-04-11 07:44:37 +08:00
|
|
|
void _ioapic_irq_enable(unsigned int irq);
|
|
|
|
void _ioapic_irq_disable(unsigned int irq);
|
|
|
|
void _ioapic_int_vec_set(unsigned int irq, unsigned int vector);
|
|
|
|
void _ioapic_irq_set(unsigned int irq, unsigned int vector, uint32_t flags);
|
|
|
|
#endif /* _ASMLANGUAGE */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __INCioapich */
|