From 83119ad4a1ceacd99f380086c2855ae2c4268afc Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Tue, 10 Jul 2007 11:24:10 +0200 Subject: [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 Signed-off-by: Martin Schwidefsky --- drivers/s390/char/sclp.h | 5 +++++ drivers/s390/char/sclp_chp.c | 4 ++++ drivers/s390/char/sclp_info.c | 9 +++++++++ 3 files changed, 18 insertions(+) (limited to 'drivers/s390/char') 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 { u16 response_code; } __attribute__((packed)); +extern u64 sclp_facilities; + +#define SCLP_HAS_CHP_INFO (sclp_facilities & 0x8000000000000000ULL) +#define SCLP_HAS_CHP_RECONFIG (sclp_facilities & 0x2000000000000000ULL) + struct gds_subvector { u8 length; 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) struct chp_cfg_data *data; int rc; + if (!SCLP_HAS_CHP_RECONFIG) + return -EOPNOTSUPP; /* Prepare sccb. */ data = (struct chp_cfg_data *) get_zeroed_page(GFP_KERNEL | GFP_DMA); if (!data) @@ -152,6 +154,8 @@ int sclp_chp_read_info(struct sclp_chp_info *info) struct chp_info_data *data; int rc; + if (!SCLP_HAS_CHP_INFO) + return -EOPNOTSUPP; /* Prepare sccb. */ data = (struct chp_info_data *) get_zeroed_page(GFP_KERNEL | GFP_DMA); 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 { static struct sclp_readinfo_sccb __initdata early_readinfo_sccb; static int __initdata early_readinfo_sccb_valid; +u64 sclp_facilities; + void __init sclp_readinfo_early(void) { int ret; @@ -70,6 +72,13 @@ void __init sclp_readinfo_early(void) __ctl_clear_bit(0, 9); } +void __init sclp_facilities_detect(void) +{ + if (!early_readinfo_sccb_valid) + return; + sclp_facilities = early_readinfo_sccb.facilities; +} + unsigned long long __init sclp_memory_detect(void) { unsigned long long memsize; -- cgit v1.2.3