aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm/system.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/include/asm/system.h')
-rw-r--r--arch/s390/include/asm/system.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/s390/include/asm/system.h b/arch/s390/include/asm/system.h
index d73cc6b60000..2e0bb7f0f9b2 100644
--- a/arch/s390/include/asm/system.h
+++ b/arch/s390/include/asm/system.h
@@ -7,8 +7,10 @@
7#ifndef __ASM_SYSTEM_H 7#ifndef __ASM_SYSTEM_H
8#define __ASM_SYSTEM_H 8#define __ASM_SYSTEM_H
9 9
10#include <linux/preempt.h>
10#include <linux/kernel.h> 11#include <linux/kernel.h>
11#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/string.h>
12#include <asm/types.h> 14#include <asm/types.h>
13#include <asm/ptrace.h> 15#include <asm/ptrace.h>
14#include <asm/setup.h> 16#include <asm/setup.h>
@@ -248,6 +250,38 @@ static inline int test_facility(unsigned long nr)
248 return (*ptr & (0x80 >> (nr & 7))) != 0; 250 return (*ptr & (0x80 >> (nr & 7))) != 0;
249} 251}
250 252
253/**
254 * stfle - Store facility list extended
255 * @stfle_fac_list: array where facility list can be stored
256 * @size: size of passed in array in double words
257 */
258static inline void stfle(u64 *stfle_fac_list, int size)
259{
260 unsigned long nr;
261
262 preempt_disable();
263 S390_lowcore.stfl_fac_list = 0;
264 asm volatile(
265 " .insn s,0xb2b10000,0(0)\n" /* stfl */
266 "0:\n"
267 EX_TABLE(0b, 0b)
268 : "=m" (S390_lowcore.stfl_fac_list));
269 nr = 4; /* bytes stored by stfl */
270 memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4);
271 if (S390_lowcore.stfl_fac_list & 0x01000000) {
272 /* More facility bits available with stfle */
273 register unsigned long reg0 asm("0") = size - 1;
274
275 asm volatile(".insn s,0xb2b00000,0(%1)" /* stfle */
276 : "+d" (reg0)
277 : "a" (stfle_fac_list)
278 : "memory", "cc");
279 nr = (reg0 + 1) * 8; /* # bytes stored by stfle */
280 }
281 memset((char *) stfle_fac_list + nr, 0, size * 8 - nr);
282 preempt_enable();
283}
284
251static inline unsigned short stap(void) 285static inline unsigned short stap(void)
252{ 286{
253 unsigned short cpu_address; 287 unsigned short cpu_address;