]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[S390] sclp: Test facility list before executing a service call.
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Tue, 10 Jul 2007 09:24:10 +0000 (11:24 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 10 Jul 2007 09:24:43 +0000 (11:24 +0200)
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>
arch/s390/kernel/early.c
drivers/s390/char/sclp.h
drivers/s390/char/sclp_chp.c
drivers/s390/char/sclp_info.c
include/asm-s390/sclp.h

index 9fcf3f1f47b6c266bad365a8e16a65154ae114ac..e6289ee74ecd400bcfaf606d8f9585191225462f 100644 (file)
@@ -275,6 +275,7 @@ void __init startup_init(void)
        sort_main_extable();
        setup_lowcore_early();
        sclp_readinfo_early();
+       sclp_facilities_detect();
        memsize = sclp_memory_detect();
 #ifndef CONFIG_64BIT
        /*
index cb5888f790077ff479e5c3a95889c81a3b985efb..c7318a125852e37c94f0359ba2ce0d7e7d4d8912 100644 (file)
@@ -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;
index a66b914519b5c7dfeb74d780ff60148c870786e5..c68f5e7e63a08a694a61fa54507bad3be20811e6 100644 (file)
@@ -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)
index 7d21dbb12fcd1d821b6e92c257173b576224a7a7..a1136e052750565803b90ac478d69d3e46a70218 100644 (file)
@@ -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;
index ddfaa8db47be3f17058d122ecdb77e1ebb62a113..cb9faf1ea5cfd5db60a602e45af058bceddc06f2 100644 (file)
@@ -28,6 +28,7 @@ struct sclp_ipl_info {
 };
 
 void sclp_readinfo_early(void);
+void sclp_facilities_detect(void);
 unsigned long long sclp_memory_detect(void);
 int sclp_sdias_blk_count(void);
 int sclp_sdias_copy(void *dest, int blk_num, int nr_blks);