blob: 428278838821837929ec9764c18afefcf8499242 [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
Stephen Rothwell612f02d2006-06-28 11:49:10 +100030#define IT_LP_MAX_QUEUES 8
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
Stephen Rothwell612f02d2006-06-28 11:49:10 +100032#define IT_LP_NOT_USED 0 /* Queue will not be used by PLIC */
33#define IT_LP_DEDICATED_IO 1 /* Queue dedicated to IO processor specified */
34#define IT_LP_DEDICATED_LP 2 /* Queue dedicated to LP specified */
35#define IT_LP_SHARED 3 /* Queue shared for both IO and LP */
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Stephen Rothwell612f02d2006-06-28 11:49:10 +100037#define IT_LP_EVENT_STACK_SIZE 4096
38#define IT_LP_EVENT_MAX_SIZE 256
39#define IT_LP_EVENT_ALIGN 64
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
Michael Ellermana6187462005-06-30 15:15:32 +100041struct hvlpevent_queue {
Stephen Rothwellfcee3892005-06-21 17:15:34 -070042/*
Stephen Rothwell612f02d2006-06-28 11:49:10 +100043 * The hq_current_event is the pointer to the next event stack entry
Stephen Rothwellfcee3892005-06-21 17:15:34 -070044 * that will become valid. The OS must peek at this entry to determine
45 * if it is valid. PLIC will set the valid indicator as the very last
46 * store into that entry.
47 *
48 * When the OS has completed processing of the event then it will mark
49 * the event as invalid so that PLIC knows it can store into that event
50 * location again.
51 *
52 * If the event stack fills and there are overflow events, then PLIC
Stephen Rothwell612f02d2006-06-28 11:49:10 +100053 * will set the hq_overflow_pending flag in which case the OS will
Stephen Rothwellfcee3892005-06-21 17:15:34 -070054 * have to fetch the additional LP events once they have drained the
55 * event stack.
56 *
57 * The first 16-bytes are known by both the OS and PLIC. The remainder
58 * of the cache line is for use by the OS.
59 */
Stephen Rothwell612f02d2006-06-28 11:49:10 +100060 u8 hq_overflow_pending; /* 0x00 Overflow events are pending */
61 u8 hq_status; /* 0x01 DedicatedIo or DedicatedLp or NotUsed */
62 u16 hq_proc_index; /* 0x02 Logical Proc Index for correlation */
63 u8 hq_reserved1[12]; /* 0x04 */
64 char *hq_current_event; /* 0x10 */
65 char *hq_last_event; /* 0x18 */
66 char *hq_event_stack; /* 0x20 */
67 u8 hq_index; /* 0x28 unique sequential index. */
68 u8 hq_reserved2[3]; /* 0x29-2b */
69 spinlock_t hq_lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -070070};
71
Michael Ellermana6187462005-06-30 15:15:32 +100072extern struct hvlpevent_queue hvlpevent_queue;
Linus Torvalds1da177e2005-04-16 15:20:36 -070073
Michael Ellerman937b31b2005-06-30 15:15:42 +100074extern int hvlpevent_is_pending(void);
Olaf Hering35a84c22006-10-07 22:08:26 +100075extern void process_hvlpevents(void);
Michael Ellerman512d31d2005-06-30 15:08:27 +100076extern void setup_hvlpevent_queue(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
Kelly Dalyecb3ca22005-11-02 15:53:01 +110078#endif /* _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H */