aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/chsc.c
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2008-07-14 03:58:56 -0400
committerHeiko Carstens <heiko.carstens@de.ibm.com>2008-07-14 04:02:09 -0400
commitd2fec595511b5718bdb65645b3d5d99800d97943 (patch)
treea94c3560fc2ad6aa89d61d646f73f4d7c1dfcc9b /drivers/s390/cio/chsc.c
parent761cdf6aacdb76f819050f4938cdab1f4cdcb945 (diff)
[S390] stp support.
Add support for clock synchronization with the server time protocol. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
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