Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 3 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * 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 Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 8 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * 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 Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 13 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | * 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 |
Stephen Rothwell | 5110610 | 2006-01-12 13:51:42 +1100 | [diff] [blame] | 17 | * |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 18 | * This file contains the "hypervisor call" interface which is used to |
| 19 | * drive the hypervisor from the OS. |
| 20 | */ |
Kelly Daly | ecb3ca2 | 2005-11-02 15:53:01 +1100 | [diff] [blame] | 21 | #ifndef _ASM_POWERPC_ISERIES_HV_CALL_H |
| 22 | #define _ASM_POWERPC_ISERIES_HV_CALL_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
Kelly Daly | 50592f5 | 2005-11-02 11:37:22 +1100 | [diff] [blame] | 24 | #include <asm/iseries/hv_call_sc.h> |
Kelly Daly | 1ec65d7 | 2005-11-02 13:46:07 +1100 | [diff] [blame] | 25 | #include <asm/iseries/hv_types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <asm/paca.h> |
| 27 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | /* Type of yield for HvCallBaseYieldProcessor */ |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 29 | #define HvCall_YieldTimed 0 /* Yield until specified time (tb) */ |
| 30 | #define HvCall_YieldToActive 1 /* Yield until all active procs have run */ |
| 31 | #define HvCall_YieldToProc 2 /* Yield until the specified processor has run */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | |
| 33 | /* interrupt masks for setEnabledInterrupts */ |
| 34 | #define HvCall_MaskIPI 0x00000001 |
| 35 | #define HvCall_MaskLpEvent 0x00000002 |
| 36 | #define HvCall_MaskLpProd 0x00000004 |
| 37 | #define HvCall_MaskTimeout 0x00000008 |
| 38 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 39 | /* Log buffer formats */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | #define HvCall_LogBuffer_ASCII 0 |
| 41 | #define HvCall_LogBuffer_EBCDIC 1 |
| 42 | |
| 43 | #define HvCallBaseAckDeferredInts HvCallBase + 0 |
| 44 | #define HvCallBaseCpmPowerOff HvCallBase + 1 |
| 45 | #define HvCallBaseGetHwPatch HvCallBase + 2 |
| 46 | #define HvCallBaseReIplSpAttn HvCallBase + 3 |
| 47 | #define HvCallBaseSetASR HvCallBase + 4 |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 48 | #define HvCallBaseSetASRAndRfi HvCallBase + 5 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #define HvCallBaseSetIMR HvCallBase + 6 |
| 50 | #define HvCallBaseSendIPI HvCallBase + 7 |
| 51 | #define HvCallBaseTerminateMachine HvCallBase + 8 |
| 52 | #define HvCallBaseTerminateMachineSrc HvCallBase + 9 |
| 53 | #define HvCallBaseProcessPlicInterrupts HvCallBase + 10 |
| 54 | #define HvCallBaseIsPrimaryCpmOrMsdIpl HvCallBase + 11 |
| 55 | #define HvCallBaseSetVirtualSIT HvCallBase + 12 |
| 56 | #define HvCallBaseVaryOffThisProcessor HvCallBase + 13 |
| 57 | #define HvCallBaseVaryOffMemoryChunk HvCallBase + 14 |
| 58 | #define HvCallBaseVaryOffInteractivePercentage HvCallBase + 15 |
| 59 | #define HvCallBaseSendLpProd HvCallBase + 16 |
| 60 | #define HvCallBaseSetEnabledInterrupts HvCallBase + 17 |
| 61 | #define HvCallBaseYieldProcessor HvCallBase + 18 |
| 62 | #define HvCallBaseVaryOffSharedProcUnits HvCallBase + 19 |
| 63 | #define HvCallBaseSetVirtualDecr HvCallBase + 20 |
| 64 | #define HvCallBaseClearLogBuffer HvCallBase + 21 |
| 65 | #define HvCallBaseGetLogBufferCodePage HvCallBase + 22 |
| 66 | #define HvCallBaseGetLogBufferFormat HvCallBase + 23 |
| 67 | #define HvCallBaseGetLogBufferLength HvCallBase + 24 |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 68 | #define HvCallBaseReadLogBuffer HvCallBase + 25 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | #define HvCallBaseSetLogBufferFormatAndCodePage HvCallBase + 26 |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 70 | #define HvCallBaseWriteLogBuffer HvCallBase + 27 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | #define HvCallBaseRouter28 HvCallBase + 28 |
| 72 | #define HvCallBaseRouter29 HvCallBase + 29 |
| 73 | #define HvCallBaseRouter30 HvCallBase + 30 |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 74 | #define HvCallBaseSetDebugBus HvCallBase + 31 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 76 | #define HvCallCcSetDABR HvCallCc + 7 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 78 | static inline void HvCall_setVirtualDecr(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | { |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 80 | /* |
| 81 | * Ignore any error return codes - most likely means that the |
| 82 | * target value for the LP has been increased and this vary off |
| 83 | * would bring us below the new target. |
| 84 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | HvCall0(HvCallBaseSetVirtualDecr); |
| 86 | } |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 87 | |
| 88 | static inline void HvCall_yieldProcessor(unsigned typeOfYield, u64 yieldParm) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | { |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 90 | HvCall2(HvCallBaseYieldProcessor, typeOfYield, yieldParm); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | } |
| 92 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 93 | static inline void HvCall_setEnabledInterrupts(u64 enabledInterrupts) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | { |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 95 | HvCall1(HvCallBaseSetEnabledInterrupts, enabledInterrupts); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | } |
| 97 | |
Stephen Rothwell | 4a5304f | 2005-06-21 17:15:40 -0700 | [diff] [blame] | 98 | static inline void HvCall_setLogBufferFormatAndCodepage(int format, |
| 99 | u32 codePage) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | { |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 101 | HvCall2(HvCallBaseSetLogBufferFormatAndCodePage, format, codePage); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | } |
| 103 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 104 | extern void HvCall_writeLogBuffer(const void *buffer, u64 bufLen); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 106 | static inline void HvCall_sendIPI(struct paca_struct *targetPaca) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | { |
Stephen Rothwell | 45dc76a | 2005-06-21 17:15:33 -0700 | [diff] [blame] | 108 | HvCall1(HvCallBaseSendIPI, targetPaca->paca_index); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | } |
| 110 | |
Kelly Daly | ecb3ca2 | 2005-11-02 15:53:01 +1100 | [diff] [blame] | 111 | #endif /* _ASM_POWERPC_ISERIES_HV_CALL_H */ |