zephyr/include/drivers/loapic.h
Andrew Boie e98ac235e6 x86: declare internal API for interrupt controllers
Originally, x86 just supported APIC. Then later support
for the Mint Valley Interrupt Controller was added. This
controller is mostly similar to the APIC with some differences,
but was integrated in a somewhat hacked-up fashion.

Now we define irq_controller.h, which is a layer of abstraction
between the core arch code and the interrupt controller
implementation.

Contents of the API:

- Controllers with a fixed irq-to-vector mapping define
_IRQ_CONTROLLER_VECTOR_MAPPING(irq) to obtain a compile-time
map between the two.

- _irq_controller_program() notifies the interrupt controller
what vector will be used for a particular IRQ along with triggering
flags

- _irq_controller_isr_vector_get() reports the vector number of
the IRQ currently being serviced

- In assembly language domain, _irq_controller_eoi implements
EOI handling.

- Since triggering options can vary, some common defines for
triggering IRQ_TRIGGER_EDGE, IRQ_TRIGGER_LEVEL, IRQ_POLARITY_HIGH,
IRQ_POLARITY_LOW introduced.

Specific changes made:

- New Kconfig X86_FIXED_IRQ_MAPPING for those interrupt controllers
that have a fixed relationship between IRQ lines and IDT vectors.

- MVIC driver rewritten per the HAS instead of the tortuous methods
used to get it to behave like LOAPIC. We are no longer writing values
to reserved registers. Additional assertions added.

- Some cleanup in the loapic_timer driver to make the MVIC differences
clearer.

- Unused APIs removed, or folded into calling code when used just once.

- MVIC doesn't bother to write a -1 to the intList priority field since
it gets ignored anyway

Issue: ZEP-48
Change-Id: I071a477ea68c36e00c3d0653ce74b3583454154d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-06 18:35:47 +00:00

75 lines
2.5 KiB
C

/* loapic.h - public LOAPIC APIs */
/*
* Copyright (c) 2015 Wind River Systems, Inc.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/
#ifndef __INCloapich
#define __INCloapich
#ifdef __cplusplus
extern "C" {
#endif
/* Local APIC Register Offset */
#define LOAPIC_ID 0x020 /* Local APIC ID Reg */
#define LOAPIC_VER 0x030 /* Local APIC Version Reg */
#define LOAPIC_TPR 0x080 /* Task Priority Reg */
#define LOAPIC_APR 0x090 /* Arbitration Priority Reg */
#define LOAPIC_PPR 0x0a0 /* Processor Priority Reg */
#define LOAPIC_EOI 0x0b0 /* EOI Reg */
#define LOAPIC_LDR 0x0d0 /* Logical Destination Reg */
#define LOAPIC_DFR 0x0e0 /* Destination Format Reg */
#define LOAPIC_SVR 0x0f0 /* Spurious Interrupt Reg */
#define LOAPIC_ISR 0x100 /* In-service Reg */
#define LOAPIC_TMR 0x180 /* Trigger Mode Reg */
#define LOAPIC_IRR 0x200 /* Interrupt Request Reg */
#define LOAPIC_ESR 0x280 /* Error Status Reg */
#define LOAPIC_ICRLO 0x300 /* Interrupt Command Reg */
#define LOAPIC_ICRHI 0x310 /* Interrupt Command Reg */
#define LOAPIC_TIMER 0x320 /* LVT (Timer) */
#define LOAPIC_THERMAL 0x330 /* LVT (Thermal) */
#define LOAPIC_PMC 0x340 /* LVT (PMC) */
#define LOAPIC_LINT0 0x350 /* LVT (LINT0) */
#define LOAPIC_LINT1 0x360 /* LVT (LINT1) */
#define LOAPIC_ERROR 0x370 /* LVT (ERROR) */
#define LOAPIC_TIMER 0x320 /* LVT (Timer) */
#define LOAPIC_TIMER_ICR 0x380 /* Timer Initial Count Reg */
#define LOAPIC_TIMER_CCR 0x390 /* Timer Current Count Reg */
#define LOAPIC_TIMER_CONFIG 0x3e0 /* Timer Divide Config Reg */
/* Local APIC Vector Table Bits */
#define LOAPIC_LVT_MASKED 0x00010000 /* mask */
#ifndef _ASMLANGUAGE
#include <device.h>
extern void _loapic_int_vec_set(unsigned int irq, unsigned int vector);
extern void _loapic_irq_enable(unsigned int irq);
extern void _loapic_irq_disable(unsigned int irq);
#if CONFIG_EOI_FORWARDING_BUG
extern void _lakemont_eoi(void);
#endif
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCloapich */