aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/s390/sysinfo.c100
-rw-r--r--include/asm-s390/sysinfo.h111
2 files changed, 112 insertions, 99 deletions
diff --git a/drivers/s390/sysinfo.c b/drivers/s390/sysinfo.c
index 291ff6235fe2..43fffa3b099d 100644
--- a/drivers/s390/sysinfo.c
+++ b/drivers/s390/sysinfo.c
@@ -11,111 +11,13 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/delay.h> 12#include <linux/delay.h>
13#include <asm/ebcdic.h> 13#include <asm/ebcdic.h>
14#include <asm/sysinfo.h>
14 15
15/* Sigh, math-emu. Don't ask. */ 16/* Sigh, math-emu. Don't ask. */
16#include <asm/sfp-util.h> 17#include <asm/sfp-util.h>
17#include <math-emu/soft-fp.h> 18#include <math-emu/soft-fp.h>
18#include <math-emu/single.h> 19#include <math-emu/single.h>
19 20
20struct sysinfo_1_1_1 {
21 char reserved_0[32];
22 char manufacturer[16];
23 char type[4];
24 char reserved_1[12];
25 char model_capacity[16];
26 char sequence[16];
27 char plant[4];
28 char model[16];
29};
30
31struct sysinfo_1_2_1 {
32 char reserved_0[80];
33 char sequence[16];
34 char plant[4];
35 char reserved_1[2];
36 unsigned short cpu_address;
37};
38
39struct sysinfo_1_2_2 {
40 char format;
41 char reserved_0[1];
42 unsigned short acc_offset;
43 char reserved_1[24];
44 unsigned int secondary_capability;
45 unsigned int capability;
46 unsigned short cpus_total;
47 unsigned short cpus_configured;
48 unsigned short cpus_standby;
49 unsigned short cpus_reserved;
50 unsigned short adjustment[0];
51};
52
53struct sysinfo_1_2_2_extension {
54 unsigned int alt_capability;
55 unsigned short alt_adjustment[0];
56};
57
58struct sysinfo_2_2_1 {
59 char reserved_0[80];
60 char sequence[16];
61 char plant[4];
62 unsigned short cpu_id;
63 unsigned short cpu_address;
64};
65
66struct sysinfo_2_2_2 {
67 char reserved_0[32];
68 unsigned short lpar_number;
69 char reserved_1;
70 unsigned char characteristics;
71 unsigned short cpus_total;
72 unsigned short cpus_configured;
73 unsigned short cpus_standby;
74 unsigned short cpus_reserved;
75 char name[8];
76 unsigned int caf;
77 char reserved_2[16];
78 unsigned short cpus_dedicated;
79 unsigned short cpus_shared;
80};
81
82#define LPAR_CHAR_DEDICATED (1 << 7)
83#define LPAR_CHAR_SHARED (1 << 6)
84#define LPAR_CHAR_LIMITED (1 << 5)
85
86struct sysinfo_3_2_2 {
87 char reserved_0[31];
88 unsigned char count;
89 struct {
90 char reserved_0[4];
91 unsigned short cpus_total;
92 unsigned short cpus_configured;
93 unsigned short cpus_standby;
94 unsigned short cpus_reserved;
95 char name[8];
96 unsigned int caf;
97 char cpi[16];
98 char reserved_1[24];
99
100 } vm[8];
101};
102
103static inline int stsi(void *sysinfo, int fc, int sel1, int sel2)
104{
105 register int r0 asm("0") = (fc << 28) | sel1;
106 register int r1 asm("1") = sel2;
107
108 asm volatile(
109 " stsi 0(%2)\n"
110 "0: jz 2f\n"
111 "1: lhi %0,%3\n"
112 "2:\n"
113 EX_TABLE(0b,1b)
114 : "+d" (r0) : "d" (r1), "a" (sysinfo), "K" (-ENOSYS)
115 : "cc", "memory" );
116 return r0;
117}
118
119static inline int stsi_0(void) 21static inline int stsi_0(void)
120{ 22{
121 int rc = stsi (NULL, 0, 0, 0); 23 int rc = stsi (NULL, 0, 0, 0);
diff --git a/include/asm-s390/sysinfo.h b/include/asm-s390/sysinfo.h
new file mode 100644
index 000000000000..014f2a24664e
--- /dev/null
+++ b/include/asm-s390/sysinfo.h
@@ -0,0 +1,111 @@
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
14struct sysinfo_1_1_1 {
15 char reserved_0[32];
16 char manufacturer[16];
17 char type[4];
18 char reserved_1[12];
19 char model_capacity[16];
20 char sequence[16];
21 char plant[4];
22 char model[16];
23};
24
25struct sysinfo_1_2_1 {
26 char reserved_0[80];
27 char sequence[16];
28 char plant[4];
29 char reserved_1[2];
30 unsigned short cpu_address;
31};
32
33struct sysinfo_1_2_2 {
34 char format;
35 char reserved_0[1];
36 unsigned short acc_offset;
37 char reserved_1[24];
38 unsigned int secondary_capability;
39 unsigned int capability;
40 unsigned short cpus_total;
41 unsigned short cpus_configured;
42 unsigned short cpus_standby;
43 unsigned short cpus_reserved;
44 unsigned short adjustment[0];
45};
46
47struct sysinfo_1_2_2_extension {
48 unsigned int alt_capability;
49 unsigned short alt_adjustment[0];
50};
51
52struct sysinfo_2_2_1 {
53 char reserved_0[80];
54 char sequence[16];
55 char plant[4];
56 unsigned short cpu_id;
57 unsigned short cpu_address;
58};
59
60struct sysinfo_2_2_2 {
61 char reserved_0[32];
62 unsigned short lpar_number;
63 char reserved_1;
64 unsigned char characteristics;
65 unsigned short cpus_total;
66 unsigned short cpus_configured;
67 unsigned short cpus_standby;
68 unsigned short cpus_reserved;
69 char name[8];
70 unsigned int caf;
71 char reserved_2[16];
72 unsigned short cpus_dedicated;
73 unsigned short cpus_shared;
74};
75
76#define LPAR_CHAR_DEDICATED (1 << 7)
77#define LPAR_CHAR_SHARED (1 << 6)
78#define LPAR_CHAR_LIMITED (1 << 5)
79
80struct sysinfo_3_2_2 {
81 char reserved_0[31];
82 unsigned char count;
83 struct {
84 char reserved_0[4];
85 unsigned short cpus_total;
86 unsigned short cpus_configured;
87 unsigned short cpus_standby;
88 unsigned short cpus_reserved;
89 char name[8];
90 unsigned int caf;
91 char cpi[16];
92 char reserved_1[24];
93
94 } vm[8];
95};
96
97static inline int stsi(void *sysinfo, int fc, int sel1, int sel2)
98{
99 register int r0 asm("0") = (fc << 28) | sel1;
100 register int r1 asm("1") = sel2;
101
102 asm volatile(
103 " stsi 0(%2)\n"
104 "0: jz 2f\n"
105 "1: lhi %0,%3\n"
106 "2:\n"
107 EX_TABLE(0b, 1b)
108 : "+d" (r0) : "d" (r1), "a" (sysinfo), "K" (-ENOSYS)
109 : "cc", "memory");
110 return r0;
111}