xref: /linux/arch/powerpc/include/asm/firmware.h (revision b8b572e1015f81b4e748417be2629dfe51ab99f9)
1*b8b572e1SStephen Rothwell /*
2*b8b572e1SStephen Rothwell  *  Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
3*b8b572e1SStephen Rothwell  *
4*b8b572e1SStephen Rothwell  *  Modifications for ppc64:
5*b8b572e1SStephen Rothwell  *      Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com>
6*b8b572e1SStephen Rothwell  *
7*b8b572e1SStephen Rothwell  *  This program is free software; you can redistribute it and/or
8*b8b572e1SStephen Rothwell  *  modify it under the terms of the GNU General Public License
9*b8b572e1SStephen Rothwell  *  as published by the Free Software Foundation; either version
10*b8b572e1SStephen Rothwell  *  2 of the License, or (at your option) any later version.
11*b8b572e1SStephen Rothwell  */
12*b8b572e1SStephen Rothwell #ifndef __ASM_POWERPC_FIRMWARE_H
13*b8b572e1SStephen Rothwell #define __ASM_POWERPC_FIRMWARE_H
14*b8b572e1SStephen Rothwell 
15*b8b572e1SStephen Rothwell #ifdef __KERNEL__
16*b8b572e1SStephen Rothwell 
17*b8b572e1SStephen Rothwell #include <asm/asm-compat.h>
18*b8b572e1SStephen Rothwell #include <asm/feature-fixups.h>
19*b8b572e1SStephen Rothwell 
20*b8b572e1SStephen Rothwell /* firmware feature bitmask values */
21*b8b572e1SStephen Rothwell #define FIRMWARE_MAX_FEATURES 63
22*b8b572e1SStephen Rothwell 
23*b8b572e1SStephen Rothwell #define FW_FEATURE_PFT		ASM_CONST(0x0000000000000001)
24*b8b572e1SStephen Rothwell #define FW_FEATURE_TCE		ASM_CONST(0x0000000000000002)
25*b8b572e1SStephen Rothwell #define FW_FEATURE_SPRG0	ASM_CONST(0x0000000000000004)
26*b8b572e1SStephen Rothwell #define FW_FEATURE_DABR		ASM_CONST(0x0000000000000008)
27*b8b572e1SStephen Rothwell #define FW_FEATURE_COPY		ASM_CONST(0x0000000000000010)
28*b8b572e1SStephen Rothwell #define FW_FEATURE_ASR		ASM_CONST(0x0000000000000020)
29*b8b572e1SStephen Rothwell #define FW_FEATURE_DEBUG	ASM_CONST(0x0000000000000040)
30*b8b572e1SStephen Rothwell #define FW_FEATURE_TERM		ASM_CONST(0x0000000000000080)
31*b8b572e1SStephen Rothwell #define FW_FEATURE_PERF		ASM_CONST(0x0000000000000100)
32*b8b572e1SStephen Rothwell #define FW_FEATURE_DUMP		ASM_CONST(0x0000000000000200)
33*b8b572e1SStephen Rothwell #define FW_FEATURE_INTERRUPT	ASM_CONST(0x0000000000000400)
34*b8b572e1SStephen Rothwell #define FW_FEATURE_MIGRATE	ASM_CONST(0x0000000000000800)
35*b8b572e1SStephen Rothwell #define FW_FEATURE_PERFMON	ASM_CONST(0x0000000000001000)
36*b8b572e1SStephen Rothwell #define FW_FEATURE_CRQ		ASM_CONST(0x0000000000002000)
37*b8b572e1SStephen Rothwell #define FW_FEATURE_VIO		ASM_CONST(0x0000000000004000)
38*b8b572e1SStephen Rothwell #define FW_FEATURE_RDMA		ASM_CONST(0x0000000000008000)
39*b8b572e1SStephen Rothwell #define FW_FEATURE_LLAN		ASM_CONST(0x0000000000010000)
40*b8b572e1SStephen Rothwell #define FW_FEATURE_BULK		ASM_CONST(0x0000000000020000)
41*b8b572e1SStephen Rothwell #define FW_FEATURE_XDABR	ASM_CONST(0x0000000000040000)
42*b8b572e1SStephen Rothwell #define FW_FEATURE_MULTITCE	ASM_CONST(0x0000000000080000)
43*b8b572e1SStephen Rothwell #define FW_FEATURE_SPLPAR	ASM_CONST(0x0000000000100000)
44*b8b572e1SStephen Rothwell #define FW_FEATURE_ISERIES	ASM_CONST(0x0000000000200000)
45*b8b572e1SStephen Rothwell #define FW_FEATURE_LPAR		ASM_CONST(0x0000000000400000)
46*b8b572e1SStephen Rothwell #define FW_FEATURE_PS3_LV1	ASM_CONST(0x0000000000800000)
47*b8b572e1SStephen Rothwell #define FW_FEATURE_BEAT		ASM_CONST(0x0000000001000000)
48*b8b572e1SStephen Rothwell #define FW_FEATURE_BULK_REMOVE	ASM_CONST(0x0000000002000000)
49*b8b572e1SStephen Rothwell #define FW_FEATURE_CMO		ASM_CONST(0x0000000004000000)
50*b8b572e1SStephen Rothwell 
51*b8b572e1SStephen Rothwell #ifndef __ASSEMBLY__
52*b8b572e1SStephen Rothwell 
53*b8b572e1SStephen Rothwell enum {
54*b8b572e1SStephen Rothwell #ifdef CONFIG_PPC64
55*b8b572e1SStephen Rothwell 	FW_FEATURE_PSERIES_POSSIBLE = FW_FEATURE_PFT | FW_FEATURE_TCE |
56*b8b572e1SStephen Rothwell 		FW_FEATURE_SPRG0 | FW_FEATURE_DABR | FW_FEATURE_COPY |
57*b8b572e1SStephen Rothwell 		FW_FEATURE_ASR | FW_FEATURE_DEBUG | FW_FEATURE_TERM |
58*b8b572e1SStephen Rothwell 		FW_FEATURE_PERF | FW_FEATURE_DUMP | FW_FEATURE_INTERRUPT |
59*b8b572e1SStephen Rothwell 		FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ |
60*b8b572e1SStephen Rothwell 		FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN |
61*b8b572e1SStephen Rothwell 		FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE |
62*b8b572e1SStephen Rothwell 		FW_FEATURE_SPLPAR | FW_FEATURE_LPAR | FW_FEATURE_CMO,
63*b8b572e1SStephen Rothwell 	FW_FEATURE_PSERIES_ALWAYS = 0,
64*b8b572e1SStephen Rothwell 	FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
65*b8b572e1SStephen Rothwell 	FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
66*b8b572e1SStephen Rothwell 	FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
67*b8b572e1SStephen Rothwell 	FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
68*b8b572e1SStephen Rothwell 	FW_FEATURE_CELLEB_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_BEAT,
69*b8b572e1SStephen Rothwell 	FW_FEATURE_CELLEB_ALWAYS = 0,
70*b8b572e1SStephen Rothwell 	FW_FEATURE_NATIVE_POSSIBLE = 0,
71*b8b572e1SStephen Rothwell 	FW_FEATURE_NATIVE_ALWAYS = 0,
72*b8b572e1SStephen Rothwell 	FW_FEATURE_POSSIBLE =
73*b8b572e1SStephen Rothwell #ifdef CONFIG_PPC_PSERIES
74*b8b572e1SStephen Rothwell 		FW_FEATURE_PSERIES_POSSIBLE |
75*b8b572e1SStephen Rothwell #endif
76*b8b572e1SStephen Rothwell #ifdef CONFIG_PPC_ISERIES
77*b8b572e1SStephen Rothwell 		FW_FEATURE_ISERIES_POSSIBLE |
78*b8b572e1SStephen Rothwell #endif
79*b8b572e1SStephen Rothwell #ifdef CONFIG_PPC_PS3
80*b8b572e1SStephen Rothwell 		FW_FEATURE_PS3_POSSIBLE |
81*b8b572e1SStephen Rothwell #endif
82*b8b572e1SStephen Rothwell #ifdef CONFIG_PPC_CELLEB
83*b8b572e1SStephen Rothwell 		FW_FEATURE_CELLEB_POSSIBLE |
84*b8b572e1SStephen Rothwell #endif
85*b8b572e1SStephen Rothwell #ifdef CONFIG_PPC_NATIVE
86*b8b572e1SStephen Rothwell 		FW_FEATURE_NATIVE_ALWAYS |
87*b8b572e1SStephen Rothwell #endif
88*b8b572e1SStephen Rothwell 		0,
89*b8b572e1SStephen Rothwell 	FW_FEATURE_ALWAYS =
90*b8b572e1SStephen Rothwell #ifdef CONFIG_PPC_PSERIES
91*b8b572e1SStephen Rothwell 		FW_FEATURE_PSERIES_ALWAYS &
92*b8b572e1SStephen Rothwell #endif
93*b8b572e1SStephen Rothwell #ifdef CONFIG_PPC_ISERIES
94*b8b572e1SStephen Rothwell 		FW_FEATURE_ISERIES_ALWAYS &
95*b8b572e1SStephen Rothwell #endif
96*b8b572e1SStephen Rothwell #ifdef CONFIG_PPC_PS3
97*b8b572e1SStephen Rothwell 		FW_FEATURE_PS3_ALWAYS &
98*b8b572e1SStephen Rothwell #endif
99*b8b572e1SStephen Rothwell #ifdef CONFIG_PPC_CELLEB
100*b8b572e1SStephen Rothwell 		FW_FEATURE_CELLEB_ALWAYS &
101*b8b572e1SStephen Rothwell #endif
102*b8b572e1SStephen Rothwell #ifdef CONFIG_PPC_NATIVE
103*b8b572e1SStephen Rothwell 		FW_FEATURE_NATIVE_ALWAYS &
104*b8b572e1SStephen Rothwell #endif
105*b8b572e1SStephen Rothwell 		FW_FEATURE_POSSIBLE,
106*b8b572e1SStephen Rothwell 
107*b8b572e1SStephen Rothwell #else /* CONFIG_PPC64 */
108*b8b572e1SStephen Rothwell 	FW_FEATURE_POSSIBLE = 0,
109*b8b572e1SStephen Rothwell 	FW_FEATURE_ALWAYS = 0,
110*b8b572e1SStephen Rothwell #endif
111*b8b572e1SStephen Rothwell };
112*b8b572e1SStephen Rothwell 
113*b8b572e1SStephen Rothwell /* This is used to identify firmware features which are available
114*b8b572e1SStephen Rothwell  * to the kernel.
115*b8b572e1SStephen Rothwell  */
116*b8b572e1SStephen Rothwell extern unsigned long	powerpc_firmware_features;
117*b8b572e1SStephen Rothwell 
118*b8b572e1SStephen Rothwell #define firmware_has_feature(feature)					\
119*b8b572e1SStephen Rothwell 	((FW_FEATURE_ALWAYS & (feature)) ||				\
120*b8b572e1SStephen Rothwell 		(FW_FEATURE_POSSIBLE & powerpc_firmware_features & (feature)))
121*b8b572e1SStephen Rothwell 
122*b8b572e1SStephen Rothwell extern void system_reset_fwnmi(void);
123*b8b572e1SStephen Rothwell extern void machine_check_fwnmi(void);
124*b8b572e1SStephen Rothwell 
125*b8b572e1SStephen Rothwell /* This is true if we are using the firmware NMI handler (typically LPAR) */
126*b8b572e1SStephen Rothwell extern int fwnmi_active;
127*b8b572e1SStephen Rothwell 
128*b8b572e1SStephen Rothwell extern unsigned int __start___fw_ftr_fixup, __stop___fw_ftr_fixup;
129*b8b572e1SStephen Rothwell 
130*b8b572e1SStephen Rothwell #endif /* __ASSEMBLY__ */
131*b8b572e1SStephen Rothwell #endif /* __KERNEL__ */
132*b8b572e1SStephen Rothwell #endif /* __ASM_POWERPC_FIRMWARE_H */
133