blob: e9f831c9a5e507111bfd87362410cbe7835c5d3c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * HvCall.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
Stephen Rothwell45dc76a2005-06-21 17:15:33 -07004 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * 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 Rothwell45dc76a2005-06-21 17:15:33 -07009 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 * 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 Rothwell45dc76a2005-06-21 17:15:33 -070014 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 * 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 */
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070019/*
20 * This file contains the "hypervisor call" interface which is used to
21 * drive the hypervisor from the OS.
22 */
Kelly Dalyecb3ca22005-11-02 15:53:01 +110023#ifndef _ASM_POWERPC_ISERIES_HV_CALL_H
24#define _ASM_POWERPC_ISERIES_HV_CALL_H
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
Kelly Daly50592f52005-11-02 11:37:22 +110026#include <asm/iseries/hv_call_sc.h>
Kelly Daly1ec65d72005-11-02 13:46:07 +110027#include <asm/iseries/hv_types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include <asm/paca.h>
29
Linus Torvalds1da177e2005-04-16 15:20:36 -070030/* Type of yield for HvCallBaseYieldProcessor */
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070031#define HvCall_YieldTimed 0 /* Yield until specified time (tb) */
32#define HvCall_YieldToActive 1 /* Yield until all active procs have run */
33#define HvCall_YieldToProc 2 /* Yield until the specified processor has run */
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
35/* interrupt masks for setEnabledInterrupts */
36#define HvCall_MaskIPI 0x00000001
37#define HvCall_MaskLpEvent 0x00000002
38#define HvCall_MaskLpProd 0x00000004
39#define HvCall_MaskTimeout 0x00000008
40
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070041/* Log buffer formats */
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#define HvCall_LogBuffer_ASCII 0
43#define HvCall_LogBuffer_EBCDIC 1
44
45#define HvCallBaseAckDeferredInts HvCallBase + 0
46#define HvCallBaseCpmPowerOff HvCallBase + 1
47#define HvCallBaseGetHwPatch HvCallBase + 2
48#define HvCallBaseReIplSpAttn HvCallBase + 3
49#define HvCallBaseSetASR HvCallBase + 4
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070050#define HvCallBaseSetASRAndRfi HvCallBase + 5
Linus Torvalds1da177e2005-04-16 15:20:36 -070051#define HvCallBaseSetIMR HvCallBase + 6
52#define HvCallBaseSendIPI HvCallBase + 7
53#define HvCallBaseTerminateMachine HvCallBase + 8
54#define HvCallBaseTerminateMachineSrc HvCallBase + 9
55#define HvCallBaseProcessPlicInterrupts HvCallBase + 10
56#define HvCallBaseIsPrimaryCpmOrMsdIpl HvCallBase + 11
57#define HvCallBaseSetVirtualSIT HvCallBase + 12
58#define HvCallBaseVaryOffThisProcessor HvCallBase + 13
59#define HvCallBaseVaryOffMemoryChunk HvCallBase + 14
60#define HvCallBaseVaryOffInteractivePercentage HvCallBase + 15
61#define HvCallBaseSendLpProd HvCallBase + 16
62#define HvCallBaseSetEnabledInterrupts HvCallBase + 17
63#define HvCallBaseYieldProcessor HvCallBase + 18
64#define HvCallBaseVaryOffSharedProcUnits HvCallBase + 19
65#define HvCallBaseSetVirtualDecr HvCallBase + 20
66#define HvCallBaseClearLogBuffer HvCallBase + 21
67#define HvCallBaseGetLogBufferCodePage HvCallBase + 22
68#define HvCallBaseGetLogBufferFormat HvCallBase + 23
69#define HvCallBaseGetLogBufferLength HvCallBase + 24
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070070#define HvCallBaseReadLogBuffer HvCallBase + 25
Linus Torvalds1da177e2005-04-16 15:20:36 -070071#define HvCallBaseSetLogBufferFormatAndCodePage HvCallBase + 26
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070072#define HvCallBaseWriteLogBuffer HvCallBase + 27
Linus Torvalds1da177e2005-04-16 15:20:36 -070073#define HvCallBaseRouter28 HvCallBase + 28
74#define HvCallBaseRouter29 HvCallBase + 29
75#define HvCallBaseRouter30 HvCallBase + 30
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070076#define HvCallBaseSetDebugBus HvCallBase + 31
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070078#define HvCallCcSetDABR HvCallCc + 7
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070080static inline void HvCall_setVirtualDecr(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070081{
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070082 /*
83 * Ignore any error return codes - most likely means that the
84 * target value for the LP has been increased and this vary off
85 * would bring us below the new target.
86 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 HvCall0(HvCallBaseSetVirtualDecr);
88}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070089
90static inline void HvCall_yieldProcessor(unsigned typeOfYield, u64 yieldParm)
Linus Torvalds1da177e2005-04-16 15:20:36 -070091{
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070092 HvCall2(HvCallBaseYieldProcessor, typeOfYield, yieldParm);
Linus Torvalds1da177e2005-04-16 15:20:36 -070093}
94
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070095static inline void HvCall_setEnabledInterrupts(u64 enabledInterrupts)
Linus Torvalds1da177e2005-04-16 15:20:36 -070096{
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070097 HvCall1(HvCallBaseSetEnabledInterrupts, enabledInterrupts);
Linus Torvalds1da177e2005-04-16 15:20:36 -070098}
99
Stephen Rothwell4a5304f2005-06-21 17:15:40 -0700100static inline void HvCall_setLogBufferFormatAndCodepage(int format,
101 u32 codePage)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102{
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700103 HvCall2(HvCallBaseSetLogBufferFormatAndCodePage, format, codePage);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104}
105
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700106extern void HvCall_writeLogBuffer(const void *buffer, u64 bufLen);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700108static inline void HvCall_sendIPI(struct paca_struct *targetPaca)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109{
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700110 HvCall1(HvCallBaseSendIPI, targetPaca->paca_index);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111}
112
Kelly Dalyecb3ca22005-11-02 15:53:01 +1100113#endif /* _ASM_POWERPC_ISERIES_HV_CALL_H */