Skip to content

Commit 4b28a8f

Browse files
heicarstMartin Schwidefsky
authored andcommitted
[S390] sclp: convert channel path configure code to use sync interface.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent 08d0796 commit 4b28a8f

3 files changed

Lines changed: 123 additions & 202 deletions

File tree

‎drivers/s390/char/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
obj-y += ctrlchar.o keyboard.o defkeymap.o sclp.o sclp_rw.o sclp_quiesce.o \
6-
sclp_cmd.o sclp_config.o sclp_chp.o sclp_cpi_sys.o
6+
sclp_cmd.o sclp_config.o sclp_cpi_sys.o
77

88
obj-$(CONFIG_TN3270) += raw3270.o
99
obj-$(CONFIG_TN3270_CONSOLE) += con3270.o

‎drivers/s390/char/sclp_chp.c‎

Lines changed: 0 additions & 200 deletions
This file was deleted.

‎drivers/s390/char/sclp_cmd.c‎

Lines changed: 122 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
* drivers/s390/char/sclp_cmd.c
33
*
44
* Copyright IBM Corp. 2007
5-
* Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
5+
* Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
6+
* Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
67
*/
78

89
#include <linux/completion.h>
910
#include <linux/init.h>
1011
#include <linux/errno.h>
1112
#include <linux/slab.h>
1213
#include <linux/string.h>
14+
#include <asm/chpid.h>
1315
#include <asm/sclp.h>
1416
#include "sclp.h"
1517

@@ -317,3 +319,122 @@ int sclp_cpu_deconfigure(u8 cpu)
317319
{
318320
return do_cpu_configure(SCLP_CMDW_DECONFIGURE_CPU | cpu << 8);
319321
}
322+
323+
/*
324+
* Channel path configuration related functions.
325+
*/
326+
327+
#define SCLP_CMDW_CONFIGURE_CHPATH 0x000f0001
328+
#define SCLP_CMDW_DECONFIGURE_CHPATH 0x000e0001
329+
#define SCLP_CMDW_READ_CHPATH_INFORMATION 0x00030001
330+
331+
struct chp_cfg_sccb {
332+
struct sccb_header header;
333+
u8 ccm;
334+
u8 reserved[6];
335+
u8 cssid;
336+
} __attribute__((packed));
337+
338+
static int do_chp_configure(sclp_cmdw_t cmd)
339+
{
340+
struct chp_cfg_sccb *sccb;
341+
int rc;
342+
343+
if (!SCLP_HAS_CHP_RECONFIG)
344+
return -EOPNOTSUPP;
345+
/* Prepare sccb. */
346+
sccb = (struct chp_cfg_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
347+
if (!sccb)
348+
return -ENOMEM;
349+
sccb->header.length = sizeof(*sccb);
350+
rc = do_sync_request(cmd, sccb);
351+
if (rc)
352+
goto out;
353+
switch (sccb->header.response_code) {
354+
case 0x0020:
355+
case 0x0120:
356+
case 0x0440:
357+
case 0x0450:
358+
break;
359+
default:
360+
printk(KERN_WARNING TAG "configure channel-path failed "
361+
"(cmd=0x%08x, response=0x%04x)\n", cmd,
362+
sccb->header.response_code);
363+
rc = -EIO;
364+
break;
365+
}
366+
out:
367+
free_page((unsigned long) sccb);
368+
return rc;
369+
}
370+
371+
/**
372+
* sclp_chp_configure - perform configure channel-path sclp command
373+
* @chpid: channel-path ID
374+
*
375+
* Perform configure channel-path command sclp command for specified chpid.
376+
* Return 0 after command successfully finished, non-zero otherwise.
377+
*/
378+
int sclp_chp_configure(struct chp_id chpid)
379+
{
380+
return do_chp_configure(SCLP_CMDW_CONFIGURE_CHPATH | chpid.id << 8);
381+
}
382+
383+
/**
384+
* sclp_chp_deconfigure - perform deconfigure channel-path sclp command
385+
* @chpid: channel-path ID
386+
*
387+
* Perform deconfigure channel-path command sclp command for specified chpid
388+
* and wait for completion. On success return 0. Return non-zero otherwise.
389+
*/
390+
int sclp_chp_deconfigure(struct chp_id chpid)
391+
{
392+
return do_chp_configure(SCLP_CMDW_DECONFIGURE_CHPATH | chpid.id << 8);
393+
}
394+
395+
struct chp_info_sccb {
396+
struct sccb_header header;
397+
u8 recognized[SCLP_CHP_INFO_MASK_SIZE];
398+
u8 standby[SCLP_CHP_INFO_MASK_SIZE];
399+
u8 configured[SCLP_CHP_INFO_MASK_SIZE];
400+
u8 ccm;
401+
u8 reserved[6];
402+
u8 cssid;
403+
} __attribute__((packed));
404+
405+
/**
406+
* sclp_chp_read_info - perform read channel-path information sclp command
407+
* @info: resulting channel-path information data
408+
*
409+
* Perform read channel-path information sclp command and wait for completion.
410+
* On success, store channel-path information in @info and return 0. Return
411+
* non-zero otherwise.
412+
*/
413+
int sclp_chp_read_info(struct sclp_chp_info *info)
414+
{
415+
struct chp_info_sccb *sccb;
416+
int rc;
417+
418+
if (!SCLP_HAS_CHP_INFO)
419+
return -EOPNOTSUPP;
420+
/* Prepare sccb. */
421+
sccb = (struct chp_info_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
422+
if (!sccb)
423+
return -ENOMEM;
424+
sccb->header.length = sizeof(*sccb);
425+
rc = do_sync_request(SCLP_CMDW_READ_CHPATH_INFORMATION, sccb);
426+
if (rc)
427+
goto out;
428+
if (sccb->header.response_code != 0x0010) {
429+
printk(KERN_WARNING TAG "read channel-path info failed "
430+
"(response=0x%04x)\n", sccb->header.response_code);
431+
rc = -EIO;
432+
goto out;
433+
}
434+
memcpy(info->recognized, sccb->recognized, SCLP_CHP_INFO_MASK_SIZE);
435+
memcpy(info->standby, sccb->standby, SCLP_CHP_INFO_MASK_SIZE);
436+
memcpy(info->configured, sccb->configured, SCLP_CHP_INFO_MASK_SIZE);
437+
out:
438+
free_page((unsigned long) sccb);
439+
return rc;
440+
}

0 commit comments

Comments
 (0)