Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Sukadev Bhattiprolu | 2392c8c | 2017-08-28 23:23:40 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2016-17 IBM Corp. |
Sukadev Bhattiprolu | 2392c8c | 2017-08-28 23:23:40 -0700 | [diff] [blame] | 4 | */ |
| 5 | #include <asm/ppc-opcode.h> |
Simon Guo | ab3759b | 2018-05-23 15:01:45 +0800 | [diff] [blame] | 6 | #include <asm/reg.h> |
Sukadev Bhattiprolu | 2392c8c | 2017-08-28 23:23:40 -0700 | [diff] [blame] | 7 | |
Sukadev Bhattiprolu | 2392c8c | 2017-08-28 23:23:40 -0700 | [diff] [blame] | 8 | /* |
| 9 | * Copy/paste instructions: |
| 10 | * |
| 11 | * copy RA,RB |
| 12 | * Copy contents of address (RA) + effective_address(RB) |
| 13 | * to internal copy-buffer. |
| 14 | * |
| 15 | * paste RA,RB |
| 16 | * Paste contents of internal copy-buffer to the address |
| 17 | * (RA) + effective_address(RB) |
| 18 | */ |
| 19 | static inline int vas_copy(void *crb, int offset) |
| 20 | { |
| 21 | asm volatile(PPC_COPY(%0, %1)";" |
| 22 | : |
| 23 | : "b" (offset), "b" (crb) |
| 24 | : "memory"); |
| 25 | |
| 26 | return 0; |
| 27 | } |
| 28 | |
| 29 | static inline int vas_paste(void *paste_address, int offset) |
| 30 | { |
| 31 | u32 cr; |
| 32 | |
| 33 | cr = 0; |
| 34 | asm volatile(PPC_PASTE(%1, %2)";" |
| 35 | "mfocrf %0, 0x80;" |
| 36 | : "=r" (cr) |
| 37 | : "b" (offset), "b" (paste_address) |
| 38 | : "memory", "cr0"); |
| 39 | |
Haren Myneni | 7574364 | 2018-06-04 18:33:38 +1000 | [diff] [blame] | 40 | /* We mask with 0xE to ignore SO */ |
| 41 | return (cr >> CR0_SHIFT) & 0xE; |
Sukadev Bhattiprolu | 2392c8c | 2017-08-28 23:23:40 -0700 | [diff] [blame] | 42 | } |