aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/lgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel/lgr.c')
-rw-r--r--arch/s390/kernel/lgr.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/arch/s390/kernel/lgr.c b/arch/s390/kernel/lgr.c
index eca94e74d19a..6ea6d69339b5 100644
--- a/arch/s390/kernel/lgr.c
+++ b/arch/s390/kernel/lgr.c
@@ -51,16 +51,6 @@ static struct lgr_info lgr_info_cur;
51static struct debug_info *lgr_dbf; 51static struct debug_info *lgr_dbf;
52 52
53/* 53/*
54 * Return number of valid stsi levels
55 */
56static inline int stsi_0(void)
57{
58 int rc = stsi(NULL, 0, 0, 0);
59
60 return rc == -ENOSYS ? rc : (((unsigned int) rc) >> 28);
61}
62
63/*
64 * Copy buffer and then convert it to ASCII 54 * Copy buffer and then convert it to ASCII
65 */ 55 */
66static void cpascii(char *dst, char *src, int size) 56static void cpascii(char *dst, char *src, int size)
@@ -76,7 +66,7 @@ static void lgr_stsi_1_1_1(struct lgr_info *lgr_info)
76{ 66{
77 struct sysinfo_1_1_1 *si = (void *) lgr_page; 67 struct sysinfo_1_1_1 *si = (void *) lgr_page;
78 68
79 if (stsi(si, 1, 1, 1) == -ENOSYS) 69 if (stsi(si, 1, 1, 1))
80 return; 70 return;
81 cpascii(lgr_info->manufacturer, si->manufacturer, 71 cpascii(lgr_info->manufacturer, si->manufacturer,
82 sizeof(si->manufacturer)); 72 sizeof(si->manufacturer));
@@ -93,7 +83,7 @@ static void lgr_stsi_2_2_2(struct lgr_info *lgr_info)
93{ 83{
94 struct sysinfo_2_2_2 *si = (void *) lgr_page; 84 struct sysinfo_2_2_2 *si = (void *) lgr_page;
95 85
96 if (stsi(si, 2, 2, 2) == -ENOSYS) 86 if (stsi(si, 2, 2, 2))
97 return; 87 return;
98 cpascii(lgr_info->name, si->name, sizeof(si->name)); 88 cpascii(lgr_info->name, si->name, sizeof(si->name));
99 memcpy(&lgr_info->lpar_number, &si->lpar_number, 89 memcpy(&lgr_info->lpar_number, &si->lpar_number,
@@ -108,7 +98,7 @@ static void lgr_stsi_3_2_2(struct lgr_info *lgr_info)
108 struct sysinfo_3_2_2 *si = (void *) lgr_page; 98 struct sysinfo_3_2_2 *si = (void *) lgr_page;
109 int i; 99 int i;
110 100
111 if (stsi(si, 3, 2, 2) == -ENOSYS) 101 if (stsi(si, 3, 2, 2))
112 return; 102 return;
113 for (i = 0; i < min_t(u8, si->count, VM_LEVEL_MAX); i++) { 103 for (i = 0; i < min_t(u8, si->count, VM_LEVEL_MAX); i++) {
114 cpascii(lgr_info->vm[i].name, si->vm[i].name, 104 cpascii(lgr_info->vm[i].name, si->vm[i].name,
@@ -124,16 +114,17 @@ static void lgr_stsi_3_2_2(struct lgr_info *lgr_info)
124 */ 114 */
125static void lgr_info_get(struct lgr_info *lgr_info) 115static void lgr_info_get(struct lgr_info *lgr_info)
126{ 116{
117 int level;
118
127 memset(lgr_info, 0, sizeof(*lgr_info)); 119 memset(lgr_info, 0, sizeof(*lgr_info));
128 stfle(lgr_info->stfle_fac_list, ARRAY_SIZE(lgr_info->stfle_fac_list)); 120 stfle(lgr_info->stfle_fac_list, ARRAY_SIZE(lgr_info->stfle_fac_list));
129 lgr_info->level = stsi_0(); 121 level = stsi(NULL, 0, 0, 0);
130 if (lgr_info->level == -ENOSYS) 122 lgr_info->level = level;
131 return; 123 if (level >= 1)
132 if (lgr_info->level >= 1)
133 lgr_stsi_1_1_1(lgr_info); 124 lgr_stsi_1_1_1(lgr_info);
134 if (lgr_info->level >= 2) 125 if (level >= 2)
135 lgr_stsi_2_2_2(lgr_info); 126 lgr_stsi_2_2_2(lgr_info);
136 if (lgr_info->level >= 3) 127 if (level >= 3)
137 lgr_stsi_3_2_2(lgr_info); 128 lgr_stsi_3_2_2(lgr_info);
138} 129}
139 130