Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Graeme Russ | 9933d60 | 2008-12-07 10:29:01 +1100 | [diff] [blame] | 2 | /* |
Graeme Russ | abf0cd3 | 2009-02-24 21:13:40 +1100 | [diff] [blame] | 3 | * (C) Copyright 2009 |
Graeme Russ | 9933d60 | 2008-12-07 10:29:01 +1100 | [diff] [blame] | 4 | * Graeme Russ, graeme.russ@gmail.com |
| 5 | * |
Graeme Russ | abf0cd3 | 2009-02-24 21:13:40 +1100 | [diff] [blame] | 6 | * (C) Copyright 2002 |
Albert ARIBAUD | fa82f87 | 2011-08-04 18:45:45 +0200 | [diff] [blame] | 7 | * Daniel Engström, Omicron Ceti AB, daniel@omicron.se |
Graeme Russ | 9933d60 | 2008-12-07 10:29:01 +1100 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #ifndef __ASM_INTERRUPT_H_ |
| 11 | #define __ASM_INTERRUPT_H_ 1 |
| 12 | |
Graeme Russ | 7228efa | 2010-10-07 20:03:23 +1100 | [diff] [blame] | 13 | #include <asm/types.h> |
| 14 | |
Bin Meng | 6c50527 | 2015-10-22 19:13:26 -0700 | [diff] [blame] | 15 | #define SYS_NUM_IRQS 16 |
| 16 | |
Bin Meng | 013cf48 | 2015-07-10 10:38:32 +0800 | [diff] [blame] | 17 | /* Architecture defined exceptions */ |
| 18 | enum 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 Glass | a0ed800 | 2020-11-04 09:57:28 -0700 | [diff] [blame] | 41 | /** |
| 42 | * struct idt_ptr - Holds the IDT (Interrupt Descriptor Table) |
| 43 | * |
| 44 | * @size: Size of IDT in bytes |
| 45 | */ |
| 46 | struct idt_ptr { |
| 47 | unsigned short size; |
| 48 | unsigned long address; |
| 49 | } __packed; |
| 50 | |
Graeme Russ | fea2572 | 2011-04-13 19:43:28 +1000 | [diff] [blame] | 51 | /* arch/x86/cpu/interrupts.c */ |
Graeme Russ | abf0cd3 | 2009-02-24 21:13:40 +1100 | [diff] [blame] | 52 | void set_vector(u8 intnum, void *routine); |
| 53 | |
Graeme Russ | abf0cd3 | 2009-02-24 21:13:40 +1100 | [diff] [blame] | 54 | /* Architecture specific functions */ |
| 55 | void mask_irq(int irq); |
| 56 | void unmask_irq(int irq); |
| 57 | void specific_eoi(int irq); |
| 58 | |
| 59 | extern char exception_stack[]; |
| 60 | |
Simon Glass | a0bd851 | 2014-11-14 18:18:31 -0700 | [diff] [blame] | 61 | /** |
| 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 | */ |
| 70 | void configure_irq_trigger(int int_num, bool is_level_triggered); |
| 71 | |
Simon Glass | 6f41e0e7b | 2015-04-28 20:25:16 -0600 | [diff] [blame] | 72 | void *x86_get_idt(void); |
| 73 | |
Simon Glass | a0ed800 | 2020-11-04 09:57:28 -0700 | [diff] [blame] | 74 | /** |
| 75 | * interrupt_read_idt() - Read the IDT |
| 76 | * |
| 77 | * @ptr: Place to put IDT contents |
| 78 | */ |
| 79 | void interrupt_read_idt(struct idt_ptr *ptr); |
| 80 | |
Graeme Russ | 9933d60 | 2008-12-07 10:29:01 +1100 | [diff] [blame] | 81 | #endif |