1 /* 2 * Copyright 2021, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #ifndef _PLIC_H_ 7 #define _PLIC_H_ 8 9 #include <SupportDefs.h> 10 11 12 // platform-level interrupt controller 13 struct PlicRegs 14 { 15 // context = hart * 2 + mode, mode: 0 - machine, 1 - supervisor 16 uint32 priority[1024]; // 0x000000 17 uint32 pending[1024 / 32]; // 0x001000, bitfield 18 uint8 unused1[0x2000 - 0x1080]; 19 uint32 enable[15872][1024 / 32]; // 0x002000, bitfield, [context][enable] 20 uint8 unused2[0xe000]; 21 struct { 22 uint32 priorityThreshold; 23 uint32 claimAndComplete; 24 uint8 unused[0xff8]; 25 } contexts[15872]; // 0x200000 26 }; 27 28 extern PlicRegs* volatile gPlicRegs; 29 30 31 #endif // _PLIC_H_ 32