Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ItLpQueue.h |
| 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
Stephen Rothwell | fcee389 | 2005-06-21 17:15:34 -0700 | [diff] [blame] | 4 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
Stephen Rothwell | fcee389 | 2005-06-21 17:15:34 -0700 | [diff] [blame] | 9 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Stephen Rothwell | fcee389 | 2005-06-21 17:15:34 -0700 | [diff] [blame] | 14 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | */ |
| 19 | #ifndef _ITLPQUEUE_H |
| 20 | #define _ITLPQUEUE_H |
| 21 | |
Stephen Rothwell | fcee389 | 2005-06-21 17:15:34 -0700 | [diff] [blame] | 22 | /* |
| 23 | * This control block defines the simple LP queue structure that is |
| 24 | * shared between the hypervisor (PLIC) and the OS in order to send |
| 25 | * events to an LP. |
| 26 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | |
| 28 | #include <asm/types.h> |
| 29 | #include <asm/ptrace.h> |
| 30 | |
| 31 | struct HvLpEvent; |
| 32 | |
Stephen Rothwell | fcee389 | 2005-06-21 17:15:34 -0700 | [diff] [blame] | 33 | #define ITMaxLpQueues 8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
| 35 | #define NotUsed 0 // Queue will not be used by PLIC |
| 36 | #define DedicatedIo 1 // Queue dedicated to IO processor specified |
| 37 | #define DedicatedLp 2 // Queue dedicated to LP specified |
| 38 | #define Shared 3 // Queue shared for both IO and LP |
| 39 | |
Stephen Rothwell | fcee389 | 2005-06-21 17:15:34 -0700 | [diff] [blame] | 40 | #define LpEventStackSize 4096 |
| 41 | #define LpEventMaxSize 256 |
| 42 | #define LpEventAlign 64 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
Stephen Rothwell | fcee389 | 2005-06-21 17:15:34 -0700 | [diff] [blame] | 44 | struct ItLpQueue { |
| 45 | /* |
| 46 | * The xSlicCurEventPtr is the pointer to the next event stack entry |
| 47 | * that will become valid. The OS must peek at this entry to determine |
| 48 | * if it is valid. PLIC will set the valid indicator as the very last |
| 49 | * store into that entry. |
| 50 | * |
| 51 | * When the OS has completed processing of the event then it will mark |
| 52 | * the event as invalid so that PLIC knows it can store into that event |
| 53 | * location again. |
| 54 | * |
| 55 | * If the event stack fills and there are overflow events, then PLIC |
| 56 | * will set the xPlicOverflowIntPending flag in which case the OS will |
| 57 | * have to fetch the additional LP events once they have drained the |
| 58 | * event stack. |
| 59 | * |
| 60 | * The first 16-bytes are known by both the OS and PLIC. The remainder |
| 61 | * of the cache line is for use by the OS. |
| 62 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | u8 xPlicOverflowIntPending;// 0x00 Overflow events are pending |
| 64 | u8 xPlicStatus; // 0x01 DedicatedIo or DedicatedLp or NotUsed |
| 65 | u16 xSlicLogicalProcIndex; // 0x02 Logical Proc Index for correlation |
| 66 | u8 xPlicRsvd[12]; // 0x04 |
Stephen Rothwell | c92877e | 2005-06-21 17:15:39 -0700 | [diff] [blame] | 67 | char *xSlicCurEventPtr; // 0x10 |
| 68 | char *xSlicLastValidEventPtr; // 0x18 |
| 69 | char *xSlicEventStackPtr; // 0x20 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | u8 xIndex; // 0x28 unique sequential index. |
| 71 | u8 xSlicRsvd[3]; // 0x29-2b |
| 72 | u32 xInUseWord; // 0x2C |
| 73 | u64 xLpIntCount; // 0x30 Total Lp Int msgs processed |
| 74 | u64 xLpIntCountByType[9]; // 0x38-0x7F Event counts by type |
| 75 | }; |
| 76 | |
| 77 | extern struct ItLpQueue xItLpQueue; |
| 78 | |
Stephen Rothwell | c92877e | 2005-06-21 17:15:39 -0700 | [diff] [blame] | 79 | extern struct HvLpEvent *ItLpQueue_getNextLpEvent(struct ItLpQueue *); |
Stephen Rothwell | fcee389 | 2005-06-21 17:15:34 -0700 | [diff] [blame] | 80 | extern int ItLpQueue_isLpIntPending(struct ItLpQueue *); |
| 81 | extern unsigned ItLpQueue_process(struct ItLpQueue *, struct pt_regs *); |
| 82 | extern void ItLpQueue_clearValid(struct HvLpEvent *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | #endif /* _ITLPQUEUE_H */ |