]> err.no Git - linux-2.6/blob - include/asm-s390/sysinfo.h
Merge git://git.infradead.org/battery-2.6
[linux-2.6] / include / asm-s390 / sysinfo.h
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 struct sysinfo_1_1_1 {
18         char reserved_0[32];
19         char manufacturer[16];
20         char type[4];
21         char reserved_1[12];
22         char model_capacity[16];
23         char sequence[16];
24         char plant[4];
25         char model[16];
26         char model_perm_cap[16];
27         char model_temp_cap[16];
28         char model_cap_rating[4];
29         char model_perm_cap_rating[4];
30         char model_temp_cap_rating[4];
31 };
32
33 struct sysinfo_1_2_1 {
34         char reserved_0[80];
35         char sequence[16];
36         char plant[4];
37         char reserved_1[2];
38         unsigned short cpu_address;
39 };
40
41 struct sysinfo_1_2_2 {
42         char format;
43         char reserved_0[1];
44         unsigned short acc_offset;
45         char reserved_1[24];
46         unsigned int secondary_capability;
47         unsigned int capability;
48         unsigned short cpus_total;
49         unsigned short cpus_configured;
50         unsigned short cpus_standby;
51         unsigned short cpus_reserved;
52         unsigned short adjustment[0];
53 };
54
55 struct sysinfo_1_2_2_extension {
56         unsigned int alt_capability;
57         unsigned short alt_adjustment[0];
58 };
59
60 struct sysinfo_2_2_1 {
61         char reserved_0[80];
62         char sequence[16];
63         char plant[4];
64         unsigned short cpu_id;
65         unsigned short cpu_address;
66 };
67
68 struct sysinfo_2_2_2 {
69         char reserved_0[32];
70         unsigned short lpar_number;
71         char reserved_1;
72         unsigned char characteristics;
73         unsigned short cpus_total;
74         unsigned short cpus_configured;
75         unsigned short cpus_standby;
76         unsigned short cpus_reserved;
77         char name[8];
78         unsigned int caf;
79         char reserved_2[16];
80         unsigned short cpus_dedicated;
81         unsigned short cpus_shared;
82 };
83
84 #define LPAR_CHAR_DEDICATED     (1 << 7)
85 #define LPAR_CHAR_SHARED        (1 << 6)
86 #define LPAR_CHAR_LIMITED       (1 << 5)
87
88 struct sysinfo_3_2_2 {
89         char reserved_0[31];
90         unsigned char count;
91         struct {
92                 char reserved_0[4];
93                 unsigned short cpus_total;
94                 unsigned short cpus_configured;
95                 unsigned short cpus_standby;
96                 unsigned short cpus_reserved;
97                 char name[8];
98                 unsigned int caf;
99                 char cpi[16];
100                 char reserved_1[24];
101
102         } vm[8];
103 };
104
105 static inline int stsi(void *sysinfo, int fc, int sel1, int sel2)
106 {
107         register int r0 asm("0") = (fc << 28) | sel1;
108         register int r1 asm("1") = sel2;
109
110         asm volatile(
111                 "   stsi 0(%2)\n"
112                 "0: jz   2f\n"
113                 "1: lhi  %0,%3\n"
114                 "2:\n"
115                 EX_TABLE(0b, 1b)
116                 : "+d" (r0) : "d" (r1), "a" (sysinfo), "K" (-ENOSYS)
117                 : "cc", "memory");
118         return r0;
119 }
120
121 #endif /* __ASM_S390_SYSINFO_H */