diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2007-07-10 05:24:10 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2007-07-10 05:24:43 -0400 |
commit | 83119ad4a1ceacd99f380086c2855ae2c4268afc (patch) | |
tree | 6da1d5cdba6e5bcd8fcdf5332700e8353b4e79a8 | |
parent | 05dd25307ca67cbfa0207bbba2e6c79fa97d125b (diff) |
[S390] sclp: Test facility list before executing a service call.
Check if a command is available before executing. Saves some
superfluous service calls that won't succeed anyway.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/kernel/early.c | 1 | ||||
-rw-r--r-- | drivers/s390/char/sclp.h | 5 | ||||
-rw-r--r-- | drivers/s390/char/sclp_chp.c | 4 | ||||
-rw-r--r-- | drivers/s390/char/sclp_info.c | 9 | ||||
-rw-r--r-- | include/asm-s390/sclp.h | 1 |
5 files changed, 20 insertions, 0 deletions
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c index 9fcf3f1f47b6..e6289ee74ecd 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c | |||
@@ -275,6 +275,7 @@ void __init startup_init(void) | |||
275 | sort_main_extable(); | 275 | sort_main_extable(); |
276 | setup_lowcore_early(); | 276 | setup_lowcore_early(); |
277 | sclp_readinfo_early(); | 277 | sclp_readinfo_early(); |
278 | sclp_facilities_detect(); | ||
278 | memsize = sclp_memory_detect(); | 279 | memsize = sclp_memory_detect(); |
279 | #ifndef CONFIG_64BIT | 280 | #ifndef CONFIG_64BIT |
280 | /* | 281 | /* |
diff --git a/drivers/s390/char/sclp.h b/drivers/s390/char/sclp.h index cb5888f79007..c7318a125852 100644 --- a/drivers/s390/char/sclp.h +++ b/drivers/s390/char/sclp.h | |||
@@ -79,6 +79,11 @@ struct sccb_header { | |||
79 | u16 response_code; | 79 | u16 response_code; |
80 | } __attribute__((packed)); | 80 | } __attribute__((packed)); |
81 | 81 | ||
82 | extern u64 sclp_facilities; | ||
83 | |||
84 | #define SCLP_HAS_CHP_INFO (sclp_facilities & 0x8000000000000000ULL) | ||
85 | #define SCLP_HAS_CHP_RECONFIG (sclp_facilities & 0x2000000000000000ULL) | ||
86 | |||
82 | struct gds_subvector { | 87 | struct gds_subvector { |
83 | u8 length; | 88 | u8 length; |
84 | u8 key; | 89 | u8 key; |
diff --git a/drivers/s390/char/sclp_chp.c b/drivers/s390/char/sclp_chp.c index a66b914519b5..c68f5e7e63a0 100644 --- a/drivers/s390/char/sclp_chp.c +++ b/drivers/s390/char/sclp_chp.c | |||
@@ -55,6 +55,8 @@ static int do_configure(sclp_cmdw_t cmd) | |||
55 | struct chp_cfg_data *data; | 55 | struct chp_cfg_data *data; |
56 | int rc; | 56 | int rc; |
57 | 57 | ||
58 | if (!SCLP_HAS_CHP_RECONFIG) | ||
59 | return -EOPNOTSUPP; | ||
58 | /* Prepare sccb. */ | 60 | /* Prepare sccb. */ |
59 | data = (struct chp_cfg_data *) get_zeroed_page(GFP_KERNEL | GFP_DMA); | 61 | data = (struct chp_cfg_data *) get_zeroed_page(GFP_KERNEL | GFP_DMA); |
60 | if (!data) | 62 | if (!data) |
@@ -152,6 +154,8 @@ int sclp_chp_read_info(struct sclp_chp_info *info) | |||
152 | struct chp_info_data *data; | 154 | struct chp_info_data *data; |
153 | int rc; | 155 | int rc; |
154 | 156 | ||
157 | if (!SCLP_HAS_CHP_INFO) | ||
158 | return -EOPNOTSUPP; | ||
155 | /* Prepare sccb. */ | 159 | /* Prepare sccb. */ |
156 | data = (struct chp_info_data *) get_zeroed_page(GFP_KERNEL | GFP_DMA); | 160 | data = (struct chp_info_data *) get_zeroed_page(GFP_KERNEL | GFP_DMA); |
157 | if (!data) | 161 | if (!data) |
diff --git a/drivers/s390/char/sclp_info.c b/drivers/s390/char/sclp_info.c index 7d21dbb12fcd..a1136e052750 100644 --- a/drivers/s390/char/sclp_info.c +++ b/drivers/s390/char/sclp_info.c | |||
@@ -30,6 +30,8 @@ struct sclp_readinfo_sccb { | |||
30 | static struct sclp_readinfo_sccb __initdata early_readinfo_sccb; | 30 | static struct sclp_readinfo_sccb __initdata early_readinfo_sccb; |
31 | static int __initdata early_readinfo_sccb_valid; | 31 | static int __initdata early_readinfo_sccb_valid; |
32 | 32 | ||
33 | u64 sclp_facilities; | ||
34 | |||
33 | void __init sclp_readinfo_early(void) | 35 | void __init sclp_readinfo_early(void) |
34 | { | 36 | { |
35 | int ret; | 37 | int ret; |
@@ -70,6 +72,13 @@ void __init sclp_readinfo_early(void) | |||
70 | __ctl_clear_bit(0, 9); | 72 | __ctl_clear_bit(0, 9); |
71 | } | 73 | } |
72 | 74 | ||
75 | void __init sclp_facilities_detect(void) | ||
76 | { | ||
77 | if (!early_readinfo_sccb_valid) | ||
78 | return; | ||
79 | sclp_facilities = early_readinfo_sccb.facilities; | ||
80 | } | ||
81 | |||
73 | unsigned long long __init sclp_memory_detect(void) | 82 | unsigned long long __init sclp_memory_detect(void) |
74 | { | 83 | { |
75 | unsigned long long memsize; | 84 | unsigned long long memsize; |
diff --git a/include/asm-s390/sclp.h b/include/asm-s390/sclp.h index ddfaa8db47be..cb9faf1ea5cf 100644 --- a/include/asm-s390/sclp.h +++ b/include/asm-s390/sclp.h | |||
@@ -28,6 +28,7 @@ struct sclp_ipl_info { | |||
28 | }; | 28 | }; |
29 | 29 | ||
30 | void sclp_readinfo_early(void); | 30 | void sclp_readinfo_early(void); |
31 | void sclp_facilities_detect(void); | ||
31 | unsigned long long sclp_memory_detect(void); | 32 | unsigned long long sclp_memory_detect(void); |
32 | int sclp_sdias_blk_count(void); | 33 | int sclp_sdias_blk_count(void); |
33 | int sclp_sdias_copy(void *dest, int blk_num, int nr_blks); | 34 | int sclp_sdias_copy(void *dest, int blk_num, int nr_blks); |