aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/s390/include/asm/sclp.h4
-rw-r--r--drivers/s390/char/sclp_early.c46
2 files changed, 32 insertions, 18 deletions
diff --git a/arch/s390/include/asm/sclp.h b/arch/s390/include/asm/sclp.h
index 2f390956c7c1..220e171413f8 100644
--- a/arch/s390/include/asm/sclp.h
+++ b/arch/s390/include/asm/sclp.h
@@ -52,8 +52,8 @@ int sclp_chp_configure(struct chp_id chpid);
52int sclp_chp_deconfigure(struct chp_id chpid); 52int sclp_chp_deconfigure(struct chp_id chpid);
53int sclp_chp_read_info(struct sclp_chp_info *info); 53int sclp_chp_read_info(struct sclp_chp_info *info);
54void sclp_get_ipl_info(struct sclp_ipl_info *info); 54void sclp_get_ipl_info(struct sclp_ipl_info *info);
55bool sclp_has_linemode(void); 55bool __init sclp_has_linemode(void);
56bool sclp_has_vt220(void); 56bool __init sclp_has_vt220(void);
57int sclp_pci_configure(u32 fid); 57int sclp_pci_configure(u32 fid);
58int sclp_pci_deconfigure(u32 fid); 58int sclp_pci_deconfigure(u32 fid);
59int memcpy_hsa(void *dest, unsigned long src, size_t count, int mode); 59int memcpy_hsa(void *dest, unsigned long src, size_t count, int mode);
diff --git a/drivers/s390/char/sclp_early.c b/drivers/s390/char/sclp_early.c
index 1af3555c096d..82f2c389b4d1 100644
--- a/drivers/s390/char/sclp_early.c
+++ b/drivers/s390/char/sclp_early.c
@@ -36,6 +36,8 @@ struct read_info_sccb {
36} __packed __aligned(PAGE_SIZE); 36} __packed __aligned(PAGE_SIZE);
37 37
38static char sccb_early[PAGE_SIZE] __aligned(PAGE_SIZE) __initdata; 38static char sccb_early[PAGE_SIZE] __aligned(PAGE_SIZE) __initdata;
39static unsigned int sclp_con_has_vt220 __initdata;
40static unsigned int sclp_con_has_linemode __initdata;
39static unsigned long sclp_hsa_size; 41static unsigned long sclp_hsa_size;
40static struct sclp_ipl_info sclp_ipl_info; 42static struct sclp_ipl_info sclp_ipl_info;
41 43
@@ -109,26 +111,12 @@ static void __init sclp_facilities_detect(struct read_info_sccb *sccb)
109 111
110bool __init sclp_has_linemode(void) 112bool __init sclp_has_linemode(void)
111{ 113{
112 struct init_sccb *sccb = (void *) &sccb_early; 114 return !!sclp_con_has_linemode;
113
114 if (sccb->header.response_code != 0x20)
115 return 0;
116 if (!(sccb->sclp_send_mask & (EVTYP_OPCMD_MASK | EVTYP_PMSGCMD_MASK)))
117 return 0;
118 if (!(sccb->sclp_receive_mask & (EVTYP_MSG_MASK | EVTYP_PMSGCMD_MASK)))
119 return 0;
120 return 1;
121} 115}
122 116
123bool __init sclp_has_vt220(void) 117bool __init sclp_has_vt220(void)
124{ 118{
125 struct init_sccb *sccb = (void *) &sccb_early; 119 return !!sclp_con_has_vt220;
126
127 if (sccb->header.response_code != 0x20)
128 return 0;
129 if (sccb->sclp_send_mask & EVTYP_VT220MSG_MASK)
130 return 1;
131 return 0;
132} 120}
133 121
134unsigned long long sclp_get_rnmax(void) 122unsigned long long sclp_get_rnmax(void)
@@ -240,11 +228,37 @@ out:
240 sclp_hsa_size = size; 228 sclp_hsa_size = size;
241} 229}
242 230
231static unsigned int __init sclp_con_check_linemode(struct init_sccb *sccb)
232{
233 if (!(sccb->sclp_send_mask & (EVTYP_OPCMD_MASK | EVTYP_PMSGCMD_MASK)))
234 return 0;
235 if (!(sccb->sclp_receive_mask & (EVTYP_MSG_MASK | EVTYP_PMSGCMD_MASK)))
236 return 0;
237 return 1;
238}
239
240static void __init sclp_console_detect(struct init_sccb *sccb)
241{
242 if (sccb->header.response_code != 0x20)
243 return;
244
245 if (sccb->sclp_send_mask & EVTYP_VT220MSG_MASK)
246 sclp_con_has_vt220 = 1;
247
248 if (sclp_con_check_linemode(sccb))
249 sclp_con_has_linemode = 1;
250}
251
243void __init sclp_early_detect(void) 252void __init sclp_early_detect(void)
244{ 253{
245 void *sccb = &sccb_early; 254 void *sccb = &sccb_early;
246 255
247 sclp_facilities_detect(sccb); 256 sclp_facilities_detect(sccb);
248 sclp_hsa_size_detect(sccb); 257 sclp_hsa_size_detect(sccb);
258
259 /* Turn off SCLP event notifications. Also save remote masks in the
260 * sccb. These are sufficient to detect sclp console capabilities.
261 */
249 sclp_set_event_mask(sccb, 0, 0); 262 sclp_set_event_mask(sccb, 0, 0);
263 sclp_console_detect(sccb);
250} 264}