blob: e23fb2c8e72f0191f39eefd6dc8a1f0a09797b30 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Graeme Russ0c8c62e2008-12-07 10:29:01 +11002/*
Graeme Russ77290ee2009-02-24 21:13:40 +11003 * (C) Copyright 2009
Graeme Russ0c8c62e2008-12-07 10:29:01 +11004 * Graeme Russ, graeme.russ@gmail.com
5 *
Graeme Russ77290ee2009-02-24 21:13:40 +11006 * (C) Copyright 2002
Albert ARIBAUD60fbc8d2011-08-04 18:45:45 +02007 * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
Graeme Russ0c8c62e2008-12-07 10:29:01 +11008 */
9
10#ifndef __ASM_INTERRUPT_H_
11#define __ASM_INTERRUPT_H_ 1
12
Graeme Russ43261532010-10-07 20:03:23 +110013#include <asm/types.h>
14
Bin Menge7a76e52015-10-22 19:13:26 -070015#define SYS_NUM_IRQS 16
16
Bin Meng9ff054b2015-07-10 10:38:32 +080017/* Architecture defined exceptions */
18enum x86_exception {
19 EXC_DE = 0,
20 EXC_DB,
21 EXC_NMI,
22 EXC_BP,
23 EXC_OF,
24 EXC_BR,
25 EXC_UD,
26 EXC_NM,
27 EXC_DF,
28 EXC_CSO,
29 EXC_TS,
30 EXC_NP,
31 EXC_SS,
32 EXC_GP,
33 EXC_PF,
34 EXC_MF = 16,
35 EXC_AC,
36 EXC_MC,
37 EXC_XM,
38 EXC_VE
39};
40
Simon Glass495afca2020-11-04 09:57:28 -070041/**
42 * struct idt_ptr - Holds the IDT (Interrupt Descriptor Table)
43 *
44 * @size: Size of IDT in bytes
45 */
46struct idt_ptr {
47 unsigned short size;
48 unsigned long address;
49} __packed;
50
Graeme Russcbfce1d2011-04-13 19:43:28 +100051/* arch/x86/cpu/interrupts.c */
Graeme Russ77290ee2009-02-24 21:13:40 +110052void set_vector(u8 intnum, void *routine);
53
Graeme Russ77290ee2009-02-24 21:13:40 +110054/* Architecture specific functions */
55void mask_irq(int irq);
56void unmask_irq(int irq);
57void specific_eoi(int irq);
58
59extern char exception_stack[];
60
Simon Glass0e9c6332014-11-14 18:18:31 -070061/**
62 * configure_irq_trigger() - Configure IRQ triggering
63 *
64 * Switch the given interrupt to be level / edge triggered
65 *
66 * @param int_num legacy interrupt number (3-7, 9-15)
67 * @param is_level_triggered true for level triggered interrupt, false for
68 * edge triggered interrupt
69 */
70void configure_irq_trigger(int int_num, bool is_level_triggered);
71
Simon Glass98d7e982015-04-28 20:25:16 -060072void *x86_get_idt(void);
73
Simon Glass495afca2020-11-04 09:57:28 -070074/**
75 * interrupt_read_idt() - Read the IDT
76 *
77 * @ptr: Place to put IDT contents
78 */
79void interrupt_read_idt(struct idt_ptr *ptr);
80
Graeme Russ0c8c62e2008-12-07 10:29:01 +110081#endif