diff options
Diffstat (limited to 'include/asm-powerpc/dcr-native.h')
-rw-r--r-- | include/asm-powerpc/dcr-native.h | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/include/asm-powerpc/dcr-native.h b/include/asm-powerpc/dcr-native.h index fd4a5f5e33d1..d7a1bc1551c6 100644 --- a/include/asm-powerpc/dcr-native.h +++ b/include/asm-powerpc/dcr-native.h | |||
@@ -20,8 +20,7 @@ | |||
20 | #ifndef _ASM_POWERPC_DCR_NATIVE_H | 20 | #ifndef _ASM_POWERPC_DCR_NATIVE_H |
21 | #define _ASM_POWERPC_DCR_NATIVE_H | 21 | #define _ASM_POWERPC_DCR_NATIVE_H |
22 | #ifdef __KERNEL__ | 22 | #ifdef __KERNEL__ |
23 | 23 | #ifndef __ASSEMBLY__ | |
24 | #include <asm/reg.h> | ||
25 | 24 | ||
26 | typedef struct {} dcr_host_t; | 25 | typedef struct {} dcr_host_t; |
27 | 26 | ||
@@ -32,7 +31,41 @@ typedef struct {} dcr_host_t; | |||
32 | #define dcr_read(host, dcr_n) mfdcr(dcr_n) | 31 | #define dcr_read(host, dcr_n) mfdcr(dcr_n) |
33 | #define dcr_write(host, dcr_n, value) mtdcr(dcr_n, value) | 32 | #define dcr_write(host, dcr_n, value) mtdcr(dcr_n, value) |
34 | 33 | ||
34 | /* Device Control Registers */ | ||
35 | void __mtdcr(int reg, unsigned int val); | ||
36 | unsigned int __mfdcr(int reg); | ||
37 | #define mfdcr(rn) \ | ||
38 | ({unsigned int rval; \ | ||
39 | if (__builtin_constant_p(rn)) \ | ||
40 | asm volatile("mfdcr %0," __stringify(rn) \ | ||
41 | : "=r" (rval)); \ | ||
42 | else \ | ||
43 | rval = __mfdcr(rn); \ | ||
44 | rval;}) | ||
45 | |||
46 | #define mtdcr(rn, v) \ | ||
47 | do { \ | ||
48 | if (__builtin_constant_p(rn)) \ | ||
49 | asm volatile("mtdcr " __stringify(rn) ",%0" \ | ||
50 | : : "r" (v)); \ | ||
51 | else \ | ||
52 | __mtdcr(rn, v); \ | ||
53 | } while (0) | ||
54 | |||
55 | /* R/W of indirect DCRs make use of standard naming conventions for DCRs */ | ||
56 | #define mfdcri(base, reg) \ | ||
57 | ({ \ | ||
58 | mtdcr(base ## _CFGADDR, base ## _ ## reg); \ | ||
59 | mfdcr(base ## _CFGDATA); \ | ||
60 | }) | ||
61 | |||
62 | #define mtdcri(base, reg, data) \ | ||
63 | do { \ | ||
64 | mtdcr(base ## _CFGADDR, base ## _ ## reg); \ | ||
65 | mtdcr(base ## _CFGDATA, data); \ | ||
66 | } while (0) | ||
35 | 67 | ||
68 | #endif /* __ASSEMBLY__ */ | ||
36 | #endif /* __KERNEL__ */ | 69 | #endif /* __KERNEL__ */ |
37 | #endif /* _ASM_POWERPC_DCR_NATIVE_H */ | 70 | #endif /* _ASM_POWERPC_DCR_NATIVE_H */ |
38 | 71 | ||