aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm/timex.h
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2016-05-31 12:47:03 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2016-06-13 15:58:20 +0200
commit936cc855ffe808b428cf75116fe031af9f12237e (patch)
tree48be65e1168b3ce87dba556cfca3f95f647c95c8 /arch/s390/include/asm/timex.h
parents390/time: LPAR offset handling (diff)
downloadlinux-dev-936cc855ffe808b428cf75116fe031af9f12237e.tar.xz
linux-dev-936cc855ffe808b428cf75116fe031af9f12237e.zip
s390/time: add leap seconds to initial system time
The PTFF instruction can be used to retrieve information about UTC including the current number of leap seconds. Use this value to convert the coordinated server time value of the TOD clock to a proper UTC timestamp to initialize the system time. Without this correction the system time will be off by the number of leap seonds until it has been corrected via NTP. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include/asm/timex.h')
-rw-r--r--arch/s390/include/asm/timex.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
index 0f34db4238da..0bb08f341c09 100644
--- a/arch/s390/include/asm/timex.h
+++ b/arch/s390/include/asm/timex.h
@@ -56,11 +56,13 @@ void __init ptff_init(void);
extern unsigned char ptff_function_mask[16];
extern unsigned long lpar_offset;
+extern unsigned long initial_leap_seconds;
/* Function codes for the ptff instruction. */
#define PTFF_QAF 0x00 /* query available functions */
#define PTFF_QTO 0x01 /* query tod offset */
#define PTFF_QSI 0x02 /* query steering information */
+#define PTFF_QUI 0x04 /* query UTC information */
#define PTFF_ATO 0x40 /* adjust tod offset */
#define PTFF_STO 0x41 /* set tod offset */
#define PTFF_SFS 0x42 /* set fine steering rate */
@@ -82,6 +84,22 @@ static inline int ptff_query(unsigned int nr)
return (*ptr & (0x80 >> (nr & 7))) != 0;
}
+/* Query UTC information result */
+struct ptff_qui {
+ unsigned int tm : 2;
+ unsigned int ts : 2;
+ unsigned int : 28;
+ unsigned int pad_0x04;
+ unsigned long leap_event;
+ short old_leap;
+ short new_leap;
+ unsigned int pad_0x14;
+ unsigned long prt[5];
+ unsigned long cst[3];
+ unsigned int skew;
+ unsigned int pad_0x5c[41];
+} __packed;
+
static inline int ptff(void *ptff_block, size_t len, unsigned int func)
{
typedef struct { char _[len]; } addrtype;