forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disintegrate asm/system.h for S390. Signed-off-by: David Howells <[email protected]> cc: [email protected]
- Loading branch information
Showing
39 changed files
with
369 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright IBM Corp. 1999, 2009 | ||
* | ||
* Author(s): Martin Schwidefsky <[email protected]> | ||
*/ | ||
|
||
#ifndef __ASM_BARRIER_H | ||
#define __ASM_BARRIER_H | ||
|
||
/* | ||
* Force strict CPU ordering. | ||
* And yes, this is required on UP too when we're talking | ||
* to devices. | ||
* | ||
* This is very similar to the ppc eieio/sync instruction in that is | ||
* does a checkpoint syncronisation & makes sure that | ||
* all memory ops have completed wrt other CPU's ( see 7-15 POP DJB ). | ||
*/ | ||
|
||
#define eieio() asm volatile("bcr 15,0" : : : "memory") | ||
#define SYNC_OTHER_CORES(x) eieio() | ||
#define mb() eieio() | ||
#define rmb() eieio() | ||
#define wmb() eieio() | ||
#define read_barrier_depends() do { } while(0) | ||
#define smp_mb() mb() | ||
#define smp_rmb() rmb() | ||
#define smp_wmb() wmb() | ||
#define smp_read_barrier_depends() read_barrier_depends() | ||
#define smp_mb__before_clear_bit() smp_mb() | ||
#define smp_mb__after_clear_bit() smp_mb() | ||
|
||
#define set_mb(var, value) do { var = value; mb(); } while (0) | ||
|
||
#endif /* __ASM_BARRIER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright IBM Corp. 1999, 2009 | ||
* | ||
* Author(s): Martin Schwidefsky <[email protected]> | ||
*/ | ||
|
||
#ifndef __ASM_CTL_REG_H | ||
#define __ASM_CTL_REG_H | ||
|
||
#ifdef __s390x__ | ||
|
||
#define __ctl_load(array, low, high) ({ \ | ||
typedef struct { char _[sizeof(array)]; } addrtype; \ | ||
asm volatile( \ | ||
" lctlg %1,%2,%0\n" \ | ||
: : "Q" (*(addrtype *)(&array)), \ | ||
"i" (low), "i" (high)); \ | ||
}) | ||
|
||
#define __ctl_store(array, low, high) ({ \ | ||
typedef struct { char _[sizeof(array)]; } addrtype; \ | ||
asm volatile( \ | ||
" stctg %1,%2,%0\n" \ | ||
: "=Q" (*(addrtype *)(&array)) \ | ||
: "i" (low), "i" (high)); \ | ||
}) | ||
|
||
#else /* __s390x__ */ | ||
|
||
#define __ctl_load(array, low, high) ({ \ | ||
typedef struct { char _[sizeof(array)]; } addrtype; \ | ||
asm volatile( \ | ||
" lctl %1,%2,%0\n" \ | ||
: : "Q" (*(addrtype *)(&array)), \ | ||
"i" (low), "i" (high)); \ | ||
}) | ||
|
||
#define __ctl_store(array, low, high) ({ \ | ||
typedef struct { char _[sizeof(array)]; } addrtype; \ | ||
asm volatile( \ | ||
" stctl %1,%2,%0\n" \ | ||
: "=Q" (*(addrtype *)(&array)) \ | ||
: "i" (low), "i" (high)); \ | ||
}) | ||
|
||
#endif /* __s390x__ */ | ||
|
||
#define __ctl_set_bit(cr, bit) ({ \ | ||
unsigned long __dummy; \ | ||
__ctl_store(__dummy, cr, cr); \ | ||
__dummy |= 1UL << (bit); \ | ||
__ctl_load(__dummy, cr, cr); \ | ||
}) | ||
|
||
#define __ctl_clear_bit(cr, bit) ({ \ | ||
unsigned long __dummy; \ | ||
__ctl_store(__dummy, cr, cr); \ | ||
__dummy &= ~(1UL << (bit)); \ | ||
__ctl_load(__dummy, cr, cr); \ | ||
}) | ||
|
||
#ifdef CONFIG_SMP | ||
|
||
extern void smp_ctl_set_bit(int cr, int bit); | ||
extern void smp_ctl_clear_bit(int cr, int bit); | ||
#define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit) | ||
#define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit) | ||
|
||
#else | ||
|
||
#define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit) | ||
#define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit) | ||
|
||
#endif /* CONFIG_SMP */ | ||
|
||
#endif /* __ASM_CTL_REG_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright IBM Corp. 1999, 2009 | ||
* | ||
* Author(s): Martin Schwidefsky <[email protected]> | ||
*/ | ||
|
||
#ifndef __ASM_EXEC_H | ||
#define __ASM_EXEC_H | ||
|
||
extern unsigned long arch_align_stack(unsigned long sp); | ||
|
||
#endif /* __ASM_EXEC_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright IBM Corp. 1999, 2009 | ||
* | ||
* Author(s): Martin Schwidefsky <[email protected]> | ||
*/ | ||
|
||
#ifndef __ASM_FACILITY_H | ||
#define __ASM_FACILITY_H | ||
|
||
#include <linux/string.h> | ||
#include <linux/preempt.h> | ||
#include <asm/lowcore.h> | ||
|
||
#define MAX_FACILITY_BIT (256*8) /* stfle_fac_list has 256 bytes */ | ||
|
||
/* | ||
* The test_facility function uses the bit odering where the MSB is bit 0. | ||
* That makes it easier to query facility bits with the bit number as | ||
* documented in the Principles of Operation. | ||
*/ | ||
static inline int test_facility(unsigned long nr) | ||
{ | ||
unsigned char *ptr; | ||
|
||
if (nr >= MAX_FACILITY_BIT) | ||
return 0; | ||
ptr = (unsigned char *) &S390_lowcore.stfle_fac_list + (nr >> 3); | ||
return (*ptr & (0x80 >> (nr & 7))) != 0; | ||
} | ||
|
||
/** | ||
* stfle - Store facility list extended | ||
* @stfle_fac_list: array where facility list can be stored | ||
* @size: size of passed in array in double words | ||
*/ | ||
static inline void stfle(u64 *stfle_fac_list, int size) | ||
{ | ||
unsigned long nr; | ||
|
||
preempt_disable(); | ||
S390_lowcore.stfl_fac_list = 0; | ||
asm volatile( | ||
" .insn s,0xb2b10000,0(0)\n" /* stfl */ | ||
"0:\n" | ||
EX_TABLE(0b, 0b) | ||
: "=m" (S390_lowcore.stfl_fac_list)); | ||
nr = 4; /* bytes stored by stfl */ | ||
memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4); | ||
if (S390_lowcore.stfl_fac_list & 0x01000000) { | ||
/* More facility bits available with stfle */ | ||
register unsigned long reg0 asm("0") = size - 1; | ||
|
||
asm volatile(".insn s,0xb2b00000,0(%1)" /* stfle */ | ||
: "+d" (reg0) | ||
: "a" (stfle_fac_list) | ||
: "memory", "cc"); | ||
nr = (reg0 + 1) * 8; /* # bytes stored by stfle */ | ||
} | ||
memset((char *) stfle_fac_list + nr, 0, size * 8 - nr); | ||
preempt_enable(); | ||
} | ||
|
||
#endif /* __ASM_FACILITY_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.