Commit d2fec595 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Heiko Carstens

[S390] stp support.

Add support for clock synchronization with the server time protocol.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent 761cdf6a
This diff is collapsed.
...@@ -874,3 +874,52 @@ exit: ...@@ -874,3 +874,52 @@ exit:
EXPORT_SYMBOL_GPL(css_general_characteristics); EXPORT_SYMBOL_GPL(css_general_characteristics);
EXPORT_SYMBOL_GPL(css_chsc_characteristics); EXPORT_SYMBOL_GPL(css_chsc_characteristics);
int chsc_sstpc(void *page, unsigned int op, u16 ctrl)
{
struct {
struct chsc_header request;
unsigned int rsvd0;
unsigned int op : 8;
unsigned int rsvd1 : 8;
unsigned int ctrl : 16;
unsigned int rsvd2[5];
struct chsc_header response;
unsigned int rsvd3[7];
} __attribute__ ((packed)) *rr;
int rc;
memset(page, 0, PAGE_SIZE);
rr = page;
rr->request.length = 0x0020;
rr->request.code = 0x0033;
rr->op = op;
rr->ctrl = ctrl;
rc = chsc(rr);
if (rc)
return -EIO;
rc = (rr->response.code == 0x0001) ? 0 : -EIO;
return rc;
}
int chsc_sstpi(void *page, void *result, size_t size)
{
struct {
struct chsc_header request;
unsigned int rsvd0[3];
struct chsc_header response;
char data[size];
} __attribute__ ((packed)) *rr;
int rc;
memset(page, 0, PAGE_SIZE);
rr = page;
rr->request.length = 0x0010;
rr->request.code = 0x0038;
rc = chsc(rr);
if (rc)
return -EIO;
memcpy(result, &rr->data, size);
return (rr->response.code == 0x0001) ? 0 : -EIO;
}
...@@ -458,6 +458,10 @@ s390_do_machine_check(struct pt_regs *regs) ...@@ -458,6 +458,10 @@ s390_do_machine_check(struct pt_regs *regs)
etr_sync_check(); etr_sync_check();
if (S390_lowcore.external_damage_code & (1U << ED_ETR_SWITCH)) if (S390_lowcore.external_damage_code & (1U << ED_ETR_SWITCH))
etr_switch_to_local(); etr_switch_to_local();
if (S390_lowcore.external_damage_code & (1U << ED_STP_SYNC))
stp_sync_check();
if (S390_lowcore.external_damage_code & (1U << ED_STP_ISLAND))
stp_island_check();
} }
if (mci->se) if (mci->se)
......
...@@ -112,6 +112,9 @@ static inline int stcrw(struct crw *pcrw ) ...@@ -112,6 +112,9 @@ static inline int stcrw(struct crw *pcrw )
#define ED_ETR_SYNC 12 /* External damage ETR sync check */ #define ED_ETR_SYNC 12 /* External damage ETR sync check */
#define ED_ETR_SWITCH 13 /* External damage ETR switch to local */ #define ED_ETR_SWITCH 13 /* External damage ETR switch to local */
#define ED_STP_SYNC 7 /* External damage STP sync check */
#define ED_STP_ISLAND 6 /* External damage STP island check */
struct pt_regs; struct pt_regs;
void s390_handle_mcck(void); void s390_handle_mcck(void);
......
...@@ -122,7 +122,7 @@ struct etr_aib { ...@@ -122,7 +122,7 @@ struct etr_aib {
} __attribute__ ((packed,aligned(8))); } __attribute__ ((packed,aligned(8)));
/* ETR interruption parameter */ /* ETR interruption parameter */
struct etr_interruption_parameter { struct etr_irq_parm {
unsigned int _pad0 : 8; unsigned int _pad0 : 8;
unsigned int pc0 : 1; /* port 0 state change */ unsigned int pc0 : 1; /* port 0 state change */
unsigned int pc1 : 1; /* port 1 state change */ unsigned int pc1 : 1; /* port 1 state change */
...@@ -213,7 +213,46 @@ static inline int etr_ptff(void *ptff_block, unsigned int func) ...@@ -213,7 +213,46 @@ static inline int etr_ptff(void *ptff_block, unsigned int func)
#define ETR_PTFF_SGS 0x43 /* set gross steering rate */ #define ETR_PTFF_SGS 0x43 /* set gross steering rate */
/* Functions needed by the machine check handler */ /* Functions needed by the machine check handler */
extern void etr_switch_to_local(void); void etr_switch_to_local(void);
extern void etr_sync_check(void); void etr_sync_check(void);
/* STP interruption parameter */
struct stp_irq_parm {
unsigned int _pad0 : 14;
unsigned int tsc : 1; /* Timing status change */
unsigned int lac : 1; /* Link availability change */
unsigned int tcpc : 1; /* Time control parameter change */
unsigned int _pad2 : 15;
} __attribute__ ((packed));
#define STP_OP_SYNC 1
#define STP_OP_CTRL 3
struct stp_sstpi {
unsigned int rsvd0;
unsigned int rsvd1 : 8;
unsigned int stratum : 8;
unsigned int vbits : 16;
unsigned int leaps : 16;
unsigned int tmd : 4;
unsigned int ctn : 4;
unsigned int rsvd2 : 3;
unsigned int c : 1;
unsigned int tst : 4;
unsigned int tzo : 16;
unsigned int dsto : 16;
unsigned int ctrl : 16;
unsigned int rsvd3 : 16;
unsigned int tto;
unsigned int rsvd4;
unsigned int ctnid[3];
unsigned int rsvd5;
unsigned int todoff[4];
unsigned int rsvd6[48];
} __attribute__ ((packed));
/* Functions needed by the machine check handler */
void stp_sync_check(void);
void stp_island_check(void);
#endif /* __S390_ETR_H */ #endif /* __S390_ETR_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment