1 /*
2  *  include/asm-s390/setup.h
3  *
4  *  S390 version
5  *    Copyright IBM Corp. 1999,2010
6  */
7 
8 #ifndef _ASM_S390_SETUP_H
9 #define _ASM_S390_SETUP_H
10 
11 #define COMMAND_LINE_SIZE	4096
12 
13 #define ARCH_COMMAND_LINE_SIZE	896
14 
15 #ifdef __KERNEL__
16 
17 #define PARMAREA		0x10400
18 #define MEMORY_CHUNKS		256
19 
20 #ifndef __ASSEMBLY__
21 
22 #include <asm/lowcore.h>
23 #include <asm/types.h>
24 
25 #ifndef __s390x__
26 #define IPL_DEVICE        (*(unsigned long *)  (0x10404))
27 #define INITRD_START      (*(unsigned long *)  (0x1040C))
28 #define INITRD_SIZE       (*(unsigned long *)  (0x10414))
29 #define OLDMEM_BASE	  (*(unsigned long *)  (0x1041C))
30 #define OLDMEM_SIZE	  (*(unsigned long *)  (0x10424))
31 #else /* __s390x__ */
32 #define IPL_DEVICE        (*(unsigned long *)  (0x10400))
33 #define INITRD_START      (*(unsigned long *)  (0x10408))
34 #define INITRD_SIZE       (*(unsigned long *)  (0x10410))
35 #define OLDMEM_BASE	  (*(unsigned long *)  (0x10418))
36 #define OLDMEM_SIZE	  (*(unsigned long *)  (0x10420))
37 #endif /* __s390x__ */
38 #define COMMAND_LINE      ((char *)            (0x10480))
39 
40 #define CHUNK_READ_WRITE 0
41 #define CHUNK_READ_ONLY  1
42 #define CHUNK_OLDMEM	 4
43 #define CHUNK_CRASHK	 5
44 
45 struct mem_chunk {
46 	unsigned long addr;
47 	unsigned long size;
48 	int type;
49 };
50 
51 extern struct mem_chunk memory_chunk[];
52 extern unsigned long real_memory_size;
53 extern int memory_end_set;
54 extern unsigned long memory_end;
55 
56 void detect_memory_layout(struct mem_chunk chunk[]);
57 void create_mem_hole(struct mem_chunk memory_chunk[], unsigned long addr,
58 		     unsigned long size, int type);
59 
60 #define PRIMARY_SPACE_MODE	0
61 #define ACCESS_REGISTER_MODE	1
62 #define SECONDARY_SPACE_MODE	2
63 #define HOME_SPACE_MODE		3
64 
65 extern unsigned int user_mode;
66 
67 /*
68  * Machine features detected in head.S
69  */
70 
71 #define MACHINE_FLAG_VM		(1UL << 0)
72 #define MACHINE_FLAG_IEEE	(1UL << 1)
73 #define MACHINE_FLAG_CSP	(1UL << 3)
74 #define MACHINE_FLAG_MVPG	(1UL << 4)
75 #define MACHINE_FLAG_DIAG44	(1UL << 5)
76 #define MACHINE_FLAG_IDTE	(1UL << 6)
77 #define MACHINE_FLAG_DIAG9C	(1UL << 7)
78 #define MACHINE_FLAG_MVCOS	(1UL << 8)
79 #define MACHINE_FLAG_KVM	(1UL << 9)
80 #define MACHINE_FLAG_HPAGE	(1UL << 10)
81 #define MACHINE_FLAG_PFMF	(1UL << 11)
82 #define MACHINE_FLAG_LPAR	(1UL << 12)
83 #define MACHINE_FLAG_SPP	(1UL << 13)
84 #define MACHINE_FLAG_TOPOLOGY	(1UL << 14)
85 #define MACHINE_FLAG_STCKF	(1UL << 15)
86 
87 #define MACHINE_IS_VM		(S390_lowcore.machine_flags & MACHINE_FLAG_VM)
88 #define MACHINE_IS_KVM		(S390_lowcore.machine_flags & MACHINE_FLAG_KVM)
89 #define MACHINE_IS_LPAR		(S390_lowcore.machine_flags & MACHINE_FLAG_LPAR)
90 
91 #define MACHINE_HAS_DIAG9C	(S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C)
92 
93 #ifndef __s390x__
94 #define MACHINE_HAS_IEEE	(S390_lowcore.machine_flags & MACHINE_FLAG_IEEE)
95 #define MACHINE_HAS_CSP		(S390_lowcore.machine_flags & MACHINE_FLAG_CSP)
96 #define MACHINE_HAS_IDTE	(0)
97 #define MACHINE_HAS_DIAG44	(1)
98 #define MACHINE_HAS_MVPG	(S390_lowcore.machine_flags & MACHINE_FLAG_MVPG)
99 #define MACHINE_HAS_MVCOS	(0)
100 #define MACHINE_HAS_HPAGE	(0)
101 #define MACHINE_HAS_PFMF	(0)
102 #define MACHINE_HAS_SPP		(0)
103 #define MACHINE_HAS_TOPOLOGY	(0)
104 #define MACHINE_HAS_STCKF	(0)
105 #else /* __s390x__ */
106 #define MACHINE_HAS_IEEE	(1)
107 #define MACHINE_HAS_CSP		(1)
108 #define MACHINE_HAS_IDTE	(S390_lowcore.machine_flags & MACHINE_FLAG_IDTE)
109 #define MACHINE_HAS_DIAG44	(S390_lowcore.machine_flags & MACHINE_FLAG_DIAG44)
110 #define MACHINE_HAS_MVPG	(1)
111 #define MACHINE_HAS_MVCOS	(S390_lowcore.machine_flags & MACHINE_FLAG_MVCOS)
112 #define MACHINE_HAS_HPAGE	(S390_lowcore.machine_flags & MACHINE_FLAG_HPAGE)
113 #define MACHINE_HAS_PFMF	(S390_lowcore.machine_flags & MACHINE_FLAG_PFMF)
114 #define MACHINE_HAS_SPP		(S390_lowcore.machine_flags & MACHINE_FLAG_SPP)
115 #define MACHINE_HAS_TOPOLOGY	(S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY)
116 #define MACHINE_HAS_STCKF	(S390_lowcore.machine_flags & MACHINE_FLAG_STCKF)
117 #endif /* __s390x__ */
118 
119 #define ZFCPDUMP_HSA_SIZE	(32UL<<20)
120 #define ZFCPDUMP_HSA_SIZE_MAX	(64UL<<20)
121 
122 /*
123  * Console mode. Override with conmode=
124  */
125 extern unsigned int console_mode;
126 extern unsigned int console_devno;
127 extern unsigned int console_irq;
128 
129 extern char vmhalt_cmd[];
130 extern char vmpoff_cmd[];
131 
132 #define CONSOLE_IS_UNDEFINED	(console_mode == 0)
133 #define CONSOLE_IS_SCLP		(console_mode == 1)
134 #define CONSOLE_IS_3215		(console_mode == 2)
135 #define CONSOLE_IS_3270		(console_mode == 3)
136 #define SET_CONSOLE_SCLP	do { console_mode = 1; } while (0)
137 #define SET_CONSOLE_3215	do { console_mode = 2; } while (0)
138 #define SET_CONSOLE_3270	do { console_mode = 3; } while (0)
139 
140 #define NSS_NAME_SIZE	8
141 extern char kernel_nss_name[];
142 
143 #ifdef CONFIG_PFAULT
144 extern int pfault_init(void);
145 extern void pfault_fini(void);
146 #else /* CONFIG_PFAULT */
147 #define pfault_init()		({-1;})
148 #define pfault_fini()		do { } while (0)
149 #endif /* CONFIG_PFAULT */
150 
151 extern void cmma_init(void);
152 
153 extern void (*_machine_restart)(char *command);
154 extern void (*_machine_halt)(void);
155 extern void (*_machine_power_off)(void);
156 
157 #else /* __ASSEMBLY__ */
158 
159 #ifndef __s390x__
160 #define IPL_DEVICE        0x10404
161 #define INITRD_START      0x1040C
162 #define INITRD_SIZE       0x10414
163 #define OLDMEM_BASE	  0x1041C
164 #define OLDMEM_SIZE	  0x10424
165 #else /* __s390x__ */
166 #define IPL_DEVICE        0x10400
167 #define INITRD_START      0x10408
168 #define INITRD_SIZE       0x10410
169 #define OLDMEM_BASE	  0x10418
170 #define OLDMEM_SIZE	  0x10420
171 #endif /* __s390x__ */
172 #define COMMAND_LINE      0x10480
173 
174 #endif /* __ASSEMBLY__ */
175 #endif /* __KERNEL__ */
176 #endif /* _ASM_S390_SETUP_H */
177