diff options
-rw-r--r-- | arch/s390/include/asm/sclp.h | 4 | ||||
-rw-r--r-- | drivers/s390/char/sclp_early.c | 46 |
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); | |||
52 | int sclp_chp_deconfigure(struct chp_id chpid); | 52 | int sclp_chp_deconfigure(struct chp_id chpid); |
53 | int sclp_chp_read_info(struct sclp_chp_info *info); | 53 | int sclp_chp_read_info(struct sclp_chp_info *info); |
54 | void sclp_get_ipl_info(struct sclp_ipl_info *info); | 54 | void sclp_get_ipl_info(struct sclp_ipl_info *info); |
55 | bool sclp_has_linemode(void); | 55 | bool __init sclp_has_linemode(void); |
56 | bool sclp_has_vt220(void); | 56 | bool __init sclp_has_vt220(void); |
57 | int sclp_pci_configure(u32 fid); | 57 | int sclp_pci_configure(u32 fid); |
58 | int sclp_pci_deconfigure(u32 fid); | 58 | int sclp_pci_deconfigure(u32 fid); |
59 | int memcpy_hsa(void *dest, unsigned long src, size_t count, int mode); | 59 | int 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 | ||
38 | static char sccb_early[PAGE_SIZE] __aligned(PAGE_SIZE) __initdata; | 38 | static char sccb_early[PAGE_SIZE] __aligned(PAGE_SIZE) __initdata; |
39 | static unsigned int sclp_con_has_vt220 __initdata; | ||
40 | static unsigned int sclp_con_has_linemode __initdata; | ||
39 | static unsigned long sclp_hsa_size; | 41 | static unsigned long sclp_hsa_size; |
40 | static struct sclp_ipl_info sclp_ipl_info; | 42 | static 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 | ||
110 | bool __init sclp_has_linemode(void) | 112 | bool __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 | ||
123 | bool __init sclp_has_vt220(void) | 117 | bool __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 | ||
134 | unsigned long long sclp_get_rnmax(void) | 122 | unsigned 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 | ||
231 | static 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 | |||
240 | static 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 | |||
243 | void __init sclp_early_detect(void) | 252 | void __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 | } |