aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/chsc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/cio/chsc.c')
-rw-r--r--drivers/s390/cio/chsc.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index cb36f7929786..62b0b16fe3d3 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -874,3 +874,52 @@ exit:
874 874
875EXPORT_SYMBOL_GPL(css_general_characteristics); 875EXPORT_SYMBOL_GPL(css_general_characteristics);
876EXPORT_SYMBOL_GPL(css_chsc_characteristics); 876EXPORT_SYMBOL_GPL(css_chsc_characteristics);
877
878int chsc_sstpc(void *page, unsigned int op, u16 ctrl)
879{
880 struct {
881 struct chsc_header request;
882 unsigned int rsvd0;
883 unsigned int op : 8;
884 unsigned int rsvd1 : 8;
885 unsigned int ctrl : 16;
886 unsigned int rsvd2[5];
887 struct chsc_header response;
888 unsigned int rsvd3[7];
889 } __attribute__ ((packed)) *rr;
890 int rc;
891
892 memset(page, 0, PAGE_SIZE);
893 rr = page;
894 rr->request.length = 0x0020;
895 rr->request.code = 0x0033;
896 rr->op = op;
897 rr->ctrl = ctrl;
898 rc = chsc(rr);
899 if (rc)
900 return -EIO;
901 rc = (rr->response.code == 0x0001) ? 0 : -EIO;
902 return rc;
903}
904
905int chsc_sstpi(void *page, void *result, size_t size)
906{
907 struct {
908 struct chsc_header request;
909 unsigned int rsvd0[3];
910 struct chsc_header response;
911 char data[size];
912 } __attribute__ ((packed)) *rr;
913 int rc;
914
915 memset(page, 0, PAGE_SIZE);
916 rr = page;
917 rr->request.length = 0x0010;
918 rr->request.code = 0x0038;
919 rc = chsc(rr);
920 if (rc)
921 return -EIO;
922 memcpy(result, &rr->data, size);
923 return (rr->response.code == 0x0001) ? 0 : -EIO;
924}
925