]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - arch/s390/include/asm/ctl_reg.h
Merge remote-tracking branches 'asoc/topic/ac97', 'asoc/topic/ac97-mfd', 'asoc/topic...
[mirror_ubuntu-focal-kernel.git] / arch / s390 / include / asm / ctl_reg.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
a0616cde
DH
2/*
3 * Copyright IBM Corp. 1999, 2009
4 *
5 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
6 */
7
8#ifndef __ASM_CTL_REG_H
9#define __ASM_CTL_REG_H
10
acf6a004
MH
11#include <linux/bug.h>
12
1228f7be 13#define __ctl_load(array, low, high) do { \
12325f09
HC
14 typedef struct { char _[sizeof(array)]; } addrtype; \
15 \
16 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
17 asm volatile( \
5a79859a 18 " lctlg %1,%2,%0\n" \
e991c24d
HC
19 : \
20 : "Q" (*(addrtype *)(&array)), "i" (low), "i" (high) \
21 : "memory"); \
1228f7be 22} while (0)
12325f09 23
1228f7be 24#define __ctl_store(array, low, high) do { \
12325f09
HC
25 typedef struct { char _[sizeof(array)]; } addrtype; \
26 \
27 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
28 asm volatile( \
5a79859a 29 " stctg %1,%2,%0\n" \
12325f09
HC
30 : "=Q" (*(addrtype *)(&array)) \
31 : "i" (low), "i" (high)); \
1228f7be 32} while (0)
12325f09
HC
33
34static inline void __ctl_set_bit(unsigned int cr, unsigned int bit)
35{
36 unsigned long reg;
37
38 __ctl_store(reg, cr, cr);
39 reg |= 1UL << bit;
40 __ctl_load(reg, cr, cr);
41}
42
43static inline void __ctl_clear_bit(unsigned int cr, unsigned int bit)
44{
45 unsigned long reg;
46
47 __ctl_store(reg, cr, cr);
48 reg &= ~(1UL << bit);
49 __ctl_load(reg, cr, cr);
50}
51
52void smp_ctl_set_bit(int cr, int bit);
53void smp_ctl_clear_bit(int cr, int bit);
a0616cde 54
5f4e87a2
HC
55union ctlreg0 {
56 unsigned long val;
57 struct {
5f4e87a2 58 unsigned long : 32;
5f4e87a2
HC
59 unsigned long : 3;
60 unsigned long lap : 1; /* Low-address-protection control */
61 unsigned long : 4;
62 unsigned long edat : 1; /* Enhanced-DAT-enablement control */
6ae1574c
CB
63 unsigned long : 2;
64 unsigned long iep : 1; /* Instruction-Execution-Protection */
65 unsigned long : 1;
cad49cfc
HC
66 unsigned long afp : 1; /* AFP-register control */
67 unsigned long vx : 1; /* Vector enablement control */
742dc577
HC
68 unsigned long : 7;
69 unsigned long sssm : 1; /* Service signal subclass mask */
70 unsigned long : 9;
5f4e87a2
HC
71 };
72};
73
a0616cde 74#ifdef CONFIG_SMP
12325f09
HC
75# define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
76# define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
a0616cde 77#else
12325f09
HC
78# define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit)
79# define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit)
80#endif
a0616cde
DH
81
82#endif /* __ASM_CTL_REG_H */