1 /*
2  * definition for store system information stsi
3  *
4  * Copyright IBM Corp. 2001,2008
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License (version 2 only)
8  * as published by the Free Software Foundation.
9  *
10  *    Author(s): Ulrich Weigand <weigand@de.ibm.com>
11  *		 Christian Borntraeger <borntraeger@de.ibm.com>
12  */
13 
14 #ifndef __ASM_S390_SYSINFO_H
15 #define __ASM_S390_SYSINFO_H
16 
17 #include <asm/bitsperlong.h>
18 
19 struct sysinfo_1_1_1 {
20 	unsigned short :16;
21 	unsigned char ccr;
22 	unsigned char cai;
23 	char reserved_0[28];
24 	char manufacturer[16];
25 	char type[4];
26 	char reserved_1[12];
27 	char model_capacity[16];
28 	char sequence[16];
29 	char plant[4];
30 	char model[16];
31 	char model_perm_cap[16];
32 	char model_temp_cap[16];
33 	char model_cap_rating[4];
34 	char model_perm_cap_rating[4];
35 	char model_temp_cap_rating[4];
36 };
37 
38 struct sysinfo_1_2_1 {
39 	char reserved_0[80];
40 	char sequence[16];
41 	char plant[4];
42 	char reserved_1[2];
43 	unsigned short cpu_address;
44 };
45 
46 struct sysinfo_1_2_2 {
47 	char format;
48 	char reserved_0[1];
49 	unsigned short acc_offset;
50 	char reserved_1[24];
51 	unsigned int secondary_capability;
52 	unsigned int capability;
53 	unsigned short cpus_total;
54 	unsigned short cpus_configured;
55 	unsigned short cpus_standby;
56 	unsigned short cpus_reserved;
57 	unsigned short adjustment[0];
58 };
59 
60 struct sysinfo_1_2_2_extension {
61 	unsigned int alt_capability;
62 	unsigned short alt_adjustment[0];
63 };
64 
65 struct sysinfo_2_2_1 {
66 	char reserved_0[80];
67 	char sequence[16];
68 	char plant[4];
69 	unsigned short cpu_id;
70 	unsigned short cpu_address;
71 };
72 
73 struct sysinfo_2_2_2 {
74 	char reserved_0[32];
75 	unsigned short lpar_number;
76 	char reserved_1;
77 	unsigned char characteristics;
78 	unsigned short cpus_total;
79 	unsigned short cpus_configured;
80 	unsigned short cpus_standby;
81 	unsigned short cpus_reserved;
82 	char name[8];
83 	unsigned int caf;
84 	char reserved_2[16];
85 	unsigned short cpus_dedicated;
86 	unsigned short cpus_shared;
87 };
88 
89 #define LPAR_CHAR_DEDICATED	(1 << 7)
90 #define LPAR_CHAR_SHARED	(1 << 6)
91 #define LPAR_CHAR_LIMITED	(1 << 5)
92 
93 struct sysinfo_3_2_2 {
94 	char reserved_0[31];
95 	unsigned char :4;
96 	unsigned char count:4;
97 	struct {
98 		char reserved_0[4];
99 		unsigned short cpus_total;
100 		unsigned short cpus_configured;
101 		unsigned short cpus_standby;
102 		unsigned short cpus_reserved;
103 		char name[8];
104 		unsigned int caf;
105 		char cpi[16];
106 		char reserved_1[24];
107 
108 	} vm[8];
109 	char reserved_544[3552];
110 };
111 
112 #define TOPOLOGY_CPU_BITS	64
113 #define TOPOLOGY_NR_MAG		6
114 
115 struct topology_cpu {
116 	unsigned char reserved0[4];
117 	unsigned char :6;
118 	unsigned char pp:2;
119 	unsigned char reserved1;
120 	unsigned short origin;
121 	unsigned long mask[TOPOLOGY_CPU_BITS / BITS_PER_LONG];
122 };
123 
124 struct topology_container {
125 	unsigned char reserved[7];
126 	unsigned char id;
127 };
128 
129 union topology_entry {
130 	unsigned char nl;
131 	struct topology_cpu cpu;
132 	struct topology_container container;
133 };
134 
135 struct sysinfo_15_1_x {
136 	unsigned char reserved0[2];
137 	unsigned short length;
138 	unsigned char mag[TOPOLOGY_NR_MAG];
139 	unsigned char reserved1;
140 	unsigned char mnest;
141 	unsigned char reserved2[4];
142 	union topology_entry tle[0];
143 };
144 
stsi(void * sysinfo,int fc,int sel1,int sel2)145 static inline int stsi(void *sysinfo, int fc, int sel1, int sel2)
146 {
147 	register int r0 asm("0") = (fc << 28) | sel1;
148 	register int r1 asm("1") = sel2;
149 
150 	asm volatile(
151 		"   stsi 0(%2)\n"
152 		"0: jz   2f\n"
153 		"1: lhi  %0,%3\n"
154 		"2:\n"
155 		EX_TABLE(0b, 1b)
156 		: "+d" (r0) : "d" (r1), "a" (sysinfo), "K" (-ENOSYS)
157 		: "cc", "memory");
158 	return r0;
159 }
160 
161 /*
162  * Service level reporting interface.
163  */
164 struct service_level {
165 	struct list_head list;
166 	void (*seq_print)(struct seq_file *, struct service_level *);
167 };
168 
169 int register_service_level(struct service_level *);
170 int unregister_service_level(struct service_level *);
171 
172 #endif /* __ASM_S390_SYSINFO_H */
173