blob: b7c6fc12cce22e0cb90da14178f9071693a82bc6 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Copyright (C) 2001 Mike Corrigan IBM Corporation
Stephen Rothwellfcee3892005-06-21 17:15:34 -07003 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
Stephen Rothwellfcee3892005-06-21 17:15:34 -07008 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
Stephen Rothwellfcee3892005-06-21 17:15:34 -070013 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070014 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
Kelly Dalyecb3ca22005-11-02 15:53:01 +110018#ifndef _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H
19#define _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Stephen Rothwellfcee3892005-06-21 17:15:34 -070021/*
22 * This control block defines the simple LP queue structure that is
23 * shared between the hypervisor (PLIC) and the OS in order to send
24 * events to an LP.
25 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
27#include <asm/types.h>
28#include <asm/ptrace.h>
29
30struct HvLpEvent;
31
Stephen Rothwellfcee3892005-06-21 17:15:34 -070032#define ITMaxLpQueues 8
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
34#define NotUsed 0 // Queue will not be used by PLIC
35#define DedicatedIo 1 // Queue dedicated to IO processor specified
36#define DedicatedLp 2 // Queue dedicated to LP specified
37#define Shared 3 // Queue shared for both IO and LP
38
Stephen Rothwellfcee3892005-06-21 17:15:34 -070039#define LpEventStackSize 4096
40#define LpEventMaxSize 256
41#define LpEventAlign 64
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
Michael Ellermana6187462005-06-30 15:15:32 +100043struct hvlpevent_queue {
Stephen Rothwellfcee3892005-06-21 17:15:34 -070044/*
45 * The xSlicCurEventPtr is the pointer to the next event stack entry
46 * that will become valid. The OS must peek at this entry to determine
47 * if it is valid. PLIC will set the valid indicator as the very last
48 * store into that entry.
49 *
50 * When the OS has completed processing of the event then it will mark
51 * the event as invalid so that PLIC knows it can store into that event
52 * location again.
53 *
54 * If the event stack fills and there are overflow events, then PLIC
55 * will set the xPlicOverflowIntPending flag in which case the OS will
56 * have to fetch the additional LP events once they have drained the
57 * event stack.
58 *
59 * The first 16-bytes are known by both the OS and PLIC. The remainder
60 * of the cache line is for use by the OS.
61 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 u8 xPlicOverflowIntPending;// 0x00 Overflow events are pending
63 u8 xPlicStatus; // 0x01 DedicatedIo or DedicatedLp or NotUsed
64 u16 xSlicLogicalProcIndex; // 0x02 Logical Proc Index for correlation
65 u8 xPlicRsvd[12]; // 0x04
Stephen Rothwellc92877e2005-06-21 17:15:39 -070066 char *xSlicCurEventPtr; // 0x10
67 char *xSlicLastValidEventPtr; // 0x18
68 char *xSlicEventStackPtr; // 0x20
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 u8 xIndex; // 0x28 unique sequential index.
70 u8 xSlicRsvd[3]; // 0x29-2b
Michael Ellerman719d1cd2005-06-30 15:17:02 +100071 spinlock_t lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -070072};
73
Michael Ellermana6187462005-06-30 15:15:32 +100074extern struct hvlpevent_queue hvlpevent_queue;
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
Michael Ellerman937b31b2005-06-30 15:15:42 +100076extern int hvlpevent_is_pending(void);
Michael Ellerman74889802005-06-30 15:15:53 +100077extern void process_hvlpevents(struct pt_regs *);
Michael Ellerman512d31d2005-06-30 15:08:27 +100078extern void setup_hvlpevent_queue(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
Kelly Dalyecb3ca22005-11-02 15:53:01 +110080#endif /* _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H */