1 /* 2 * Copyright (c) 2012-2018 LK Trusty Authors. All Rights Reserved. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining 5 * a copy of this software and associated documentation files 6 * (the "Software"), to deal in the Software without restriction, 7 * including without limitation the rights to use, copy, modify, merge, 8 * publish, distribute, sublicense, and/or sell copies of the Software, 9 * and to permit persons to whom the Software is furnished to do so, 10 * subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be 13 * included in all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 */ 23 24 #pragma once 25 26 #include <platform/interrupts.h> 27 28 #define INT_VECTORS 0x100 29 30 #ifndef INT_PIT 31 #define INT_PIT 0x30 32 #endif 33 34 #define PIC1_BASE_INTR INT_PIT 35 #define PIC2_CASCADE_INTR (PIC1_BASE_INTR + 2) 36 #define PIC2_BASE_INTR (PIC1_BASE_INTR + 8) 37 #define AFTER_PIC_INTR (PIC2_BASE_INTR + 8) 38 #define PIC1 0x20 39 #define PIC2 0xA0 40 #define ICW1 0x11 /* Cascade mode, ICW4 needed */ 41 #define ICW3_PIC1 4 42 #define ICW3_PIC2 2 43 #define ICW4 0x5 /* Non buffered mode, 8086 mode */ 44 #define PIC_EOI 0x20 45 46 struct int_handler_struct { 47 int_handler handler; 48 void* arg; 49 }; 50 51 extern struct int_handler_struct int_handler_table[INT_VECTORS]; 52 53 void x86_init_interrupts(void); 54 enum handler_return default_isr(unsigned int vector); 55