forked from SDL-Hercules-390/hyperion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathesa390.h
1935 lines (1786 loc) · 112 KB
/
esa390.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*-------------------------------------------------------------------*/
/* Header file containing ESA/390 structure definitions */
/*-------------------------------------------------------------------*/
/* ESA390.H (c) Copyright Roger Bowler, 1994-2005 */
/* ESA/390 Data Areas */
/* Interpretive Execution - (c) Copyright Jan Jaeger, 1999-2005 */
/* z/Architecture support - (c) Copyright Jan Jaeger, 1999-2005 */
#ifndef _ESA390_H
#define _ESA390_H
/* Platform-independent storage operand definitions */
#include "htypes.h" // (need Hercules fixed-size data types)
#if defined(WORDS_BIGENDIAN)
typedef union {
U16 H;
struct { BYTE H; BYTE L; } B;
} HW;
typedef union {
U32 F;
struct { HW H; HW L; } H;
struct { BYTE B; U32 A:24; } A;
} FW;
typedef union {
U64 D;
struct { FW H; FW L; } F;
} DW;
#else // !defined(WORDS_BIGENDIAN)
typedef union {
U16 H;
struct { BYTE L; BYTE H; } B;
} HW;
typedef union {
U32 F;
struct { HW L; HW H; } H;
struct { U32 A:24, B:8; } A;
} FW;
typedef union {
U64 D;
struct { FW L; FW H; } F;
} DW;
#endif // defined(WORDS_BIGENDIAN)
typedef union {
HWORD H;
struct { BYTE H; BYTE L; } B;
} HWORD_U;
typedef union {
FWORD F;
struct { HWORD_U H; HWORD_U L; } H;
} FWORD_U;
typedef union {
DBLWRD D;
struct { FWORD_U H; FWORD_U L; } F;
} DWORD_U;
/* Internal-format PSW structure definition */
typedef struct _PSW {
BYTE sysmask; /* System mask (0 - 7) */
BYTE pkey; /* PSW Key (8 - 11) */
BYTE states; /* EC,M,W,P bits (12 - 15) */
BYTE asc; /* Address space control */
/* (16 - 17) */
BYTE cc; /* Condition code (18 - 19) */
BYTE progmask; /* Program mask (20 - 23) */
BYTE zerobyte; /* Zeroes (24 - 31) */
/* or (esame) (24 - 30) */
U32 zeroword; /* esame only (32 - 63) */
BYTE /* Addressing mode (31 - 32) */
amode64:1, /* 64-bit addressing */
amode:1, /* 31-bit addressing */
zeroilc:1; /* 1=Zero ILC */
DW ia; /* Instruction addrress */
/* (33 - 63) */
/* or (esame) (64 -127) */
DW amask; /* Address wraparound mask */
U16 intcode; /* Interruption code */
U16 unused; /* (unused) */
} PSW; /* 28 bytes */
#define IA_G ia.D
#define IA_H ia.F.H.F
#define IA_L ia.F.L.F
#define IA_LA24 ia.F.L.A.A
#define AMASK_G amask.D
#define AMASK_L amask.F.L.F
#define AMASK_H amask.F.H.F
#define AMASK24 0x00FFFFFF
#define AMASK31 0x7FFFFFFF
#define AMASK64 0xFFFFFFFFFFFFFFFFULL
/* System mask (0 - 7) */
#define PSW_PERMODE 0x40 /* Program event recording */
#define PSW_DATMODE 0x04 /* Dynamic addr translation */
#define PSW_IOMASK 0x02 /* I/O interrupt mask */
#define PSW_EXTMASK 0x01 /* External interrupt mask */
/* PSW key mask (8 - 11) */
#define PSW_KEYMASK 0xF0 /* PSW key mask */
/* (12 - 15) */
#define PSW_EC_BIT 3 /* 0x08 ECMODE */
#define PSW_MACH_BIT 2 /* 0x04 Machine check mask */
#define PSW_WAIT_BIT 1 /* 0x02 Wait state */
#define PSW_PROB_BIT 0 /* 0x01 Problem state */
#define PSW_NOTESAME_BIT PSW_EC_BIT
/* Address space control (16 - 17) */
#define PSW_ASCMASK 0xC0 /* Address space control mask*/
#define PSW_SPACE_BIT 7 /* 0x80 Space mode bit */
#define PSW_AR_BIT 6 /* 0x40 Access register mode bit */
#define PSW_PRIMARY_SPACE_MODE 0x00 /* Primary-space mode */
#define PSW_SECONDARY_SPACE_MODE 0x80 /* Secondary-space mode */
#define PSW_ACCESS_REGISTER_MODE 0x40 /* Access-register mode */
#define PSW_HOME_SPACE_MODE 0xC0 /* Home-space mode */
/* Condition code (18 - 19) */
#define PSW_CCMASK 0x30 /* Condition code mask */
/* Program mask (20 - 23) */
#define PSW_PROGMASK 0x0F /* Program-mask bits */
#define PSW_FOBIT 3 /* 0x08 Fixed-point overflow bit */
#define PSW_DOBIT 2 /* 0x04 Decimal overflow bit */
#define PSW_EUBIT 1 /* 0x02 Exponent underflow bit */
#define PSW_SGBIT 0 /* 0x01 Significance bit */
/* Address mode (31 - 32) */
#define PSW_AMODE64_BIT 0 /* Extended addressing (31) */
#define PSW_AMODE31_BIT 7 /* Basic addressing (32) */
/* Macros for testing states (EC, M, W, P bits) */
#define ECMODE(p) (((p)->states & BIT(PSW_EC_BIT)) != 0)
#define NOTESAME(p) (((p)->states & BIT(PSW_NOTESAME_BIT)) != 0)
#define MACHMASK(p) (((p)->states & BIT(PSW_MACH_BIT)) != 0)
#define WAITSTATE(p) (((p)->states & BIT(PSW_WAIT_BIT)) != 0)
#define PROBSTATE(p) (((p)->states & BIT(PSW_PROB_BIT)) != 0)
/* Macros for testing program mask */
#define FOMASK(p) ( (p)->progmask & BIT(PSW_FOBIT) )
#define DOMASK(p) ( (p)->progmask & BIT(PSW_DOBIT) )
#define EUMASK(p) ( (p)->progmask & BIT(PSW_EUBIT) )
#define SGMASK(p) ( (p)->progmask & BIT(PSW_SGBIT) )
/* Structure definition for translation-lookaside buffer entry */
#define TLBN 1024 /* Number TLB entries */
#define TLB_MASK 0x3FF /* Mask for 1024 entries */
#define TLB_REAL_ASD_L 0xFFFFFFFF /* ASD values for real mode */
#define TLB_REAL_ASD_G 0xFFFFFFFFFFFFFFFFULL
typedef struct _TLB {
DW asd[TLBN]; /* Address space designator */
#define TLB_ASD_G(_n) asd[(_n)].D
#define TLB_ASD_L(_n) asd[(_n)].F.L.F
DW vaddr[TLBN]; /* Virtual page address */
#define TLB_VADDR_G(_n) vaddr[(_n)].D
#define TLB_VADDR_L(_n) vaddr[(_n)].F.L.F
DW pte[TLBN]; /* Copy of page table entry */
#define TLB_PTE_G(_n) pte[(_n)].D
#define TLB_PTE_L(_n) pte[(_n)].F.L.F
BYTE *main[TLBN]; /* Mainstor address */
BYTE *storkey[TLBN]; /* -> Storage key */
BYTE skey[TLBN]; /* Storage key key-value */
BYTE common[TLBN]; /* 1=Page in common segment */
BYTE protect[TLBN]; /* 1=Page in protected segmnt*/
BYTE acc[TLBN]; /* Access type flags */
} TLB;
/* TLB Notes -
* Fields set by translate_addr() are asd, vaddr, pte, id, common and
* protect.
* Fields set by logical_to_main() are main, storkey, skey, read and
* write and are used for accelerated address lookup (formerly AEA).
*/
/* Structure for Dynamic Address Translation */
typedef struct _DAT {
RADR raddr; /* Real address */
RADR aaddr; /* Absolute address */
RADR asd; /* Address space designator: */
/* STD or ASCE */
int stid; /* Address space indicator */
BYTE *storkey; /* ->Storage key */
U16 xcode; /* Translation exception code*/
BYTE private:1, /* 1=Private address space */
protect:2; /* 1=Page prot, 2=ALE prot */
BYTE reserved[1]; /* [alignment] */
} DAT;
/* Bit definitions for control register 0 */
#define CR0_BMPX 0x80000000 /* Block multiplex ctl S/370*/
#define CR0_SSM_SUPP 0x40000000 /* SSM suppression control */
#define CR0_TOD_SYNC 0x20000000 /* TOD clock sync control */
#define CR0_LOW_PROT 0x10000000 /* Low-address protection */
#define CR0_EXT_AUTH 0x08000000 /* Extraction auth control */
#define CR0_SEC_SPACE 0x04000000 /* Secondary space control */
#define CR0_FETCH_OVRD 0x02000000 /* Fetch protection override */
#define CR0_STORE_OVRD 0x01000000 /* Store protection override */
#define CR0_STORKEY_4K 0x01000000 /* Storkey exception control */
#define CR0_TRAN_FMT 0x00F80000 /* Translation format bits...*/
#define CR0_TRAN_ESA390 0x00B00000 /* ...1M/4K ESA/390 format */
#define CR0_PAGE_SIZE 0x00C00000 /* Page size for S/370... */
#define CR0_PAGE_SZ_2K 0x00400000 /* ...2K pages */
#define CR0_PAGE_SZ_4K 0x00800000 /* ...4K pages */
#define CR0_SEG_SIZE 0x00380000 /* Segment size for S/370... */
#define CR0_SEG_SZ_64K 0x00000000 /* ...64K segments */
#define CR0_SEG_SZ_1M 0x00100000 /* ...1M segments */
#define CR0_ASN_LX_REUS 0x00080000 /* ASN-and-LX-reuse control */
#define CR0_AFP 0x00040000 /* AFP register control */
#define CR0_VOP 0x00020000 /* Vector control 390*/
#define CR0_ASF 0x00010000 /* AS function control 390*/
#define CR0_XM_MALFALT 0x00008000 /* Malfunction alert mask */
#define CR0_XM_EMERSIG 0x00004000 /* Emergency signal mask */
#define CR0_XM_EXTCALL 0x00002000 /* External call mask */
#define CR0_XM_TODSYNC 0x00001000 /* TOD clock sync mask */
#define CR0_XM_CLKC 0x00000800 /* Clock comparator mask */
#define CR0_XM_PTIMER 0x00000400 /* CPU timer mask */
#define CR0_XM_SERVSIG 0x00000200 /* Service signal mask */
#define CR0_XM_ITIMER 0x00000080 /* Interval timer mask S/370*/
#define CR0_XM_INTKEY 0x00000040 /* Interrupt key mask */
#define CR0_XM_EXTSIG 0x00000020 /* External signal mask S/370*/
#define CR0_XM_ETR 0x00000010 /* External timer mask */
#define CR0_PC_FAST 0x00000008 /* PC fast control 390*/
#define CR0_CRYPTO 0x00000004 /* Crypto control ESAME*/
#define SERVSIG_PEND 0x00000001 /* Event buffer pending */
#define SERVSIG_ADDR 0xFFFFFFF8 /* Parameter address */
/* Bit definitions for control register 1 */
/* CR1 is the primary segment table descriptor or primary ASCE */
/* Bit definitions for control register 2 */
#define CR2_DUCTO 0x7FFFFFC0 /* DUCT origin */
/* For S/370, CR2 contains channel masks for channels 0-31 */
/* Bit definitions for control register 3 */
#define CR3_SASTEIN 0xFFFFFFFF00000000ULL /* SASN STE instance# */
#define CR3_KEYMASK 0xFFFF0000 /* PSW key mask */
#define CR3_SASN 0x0000FFFF /* Secondary ASN */
/* Bit definitions for control register 4 */
#define CR4_PASTEIN 0xFFFFFFFF00000000ULL /* PASN STE instance# */
#define CR4_AX 0xFFFF0000 /* Authorization index */
#define CR4_PASN 0x0000FFFF /* Primary ASN */
/* Bit definitions for control register 5 */
/* When CR0_ASF=0 (ESA/390): */
#define CR5_SSLINK 0x80000000 /* Subsystem-Linkage control */
#define CR5_LTO 0x7FFFFF80 /* Linkage-Table origin */
#define CR5_LTL 0x0000007F /* Linkage-Table length */
/* When CR0_ASF=1 or ESAME: */
#define CR5_PASTEO 0x7FFFFFC0 /* Primary-ASTE origin */
/* Bit definitions for control register 6 */
/* CR6 is the I/O interruption subclass mask */
/* Bit definitions for control register 7 */
/* CR7 is the secondary segment table descriptor or secondary ASCE */
/* Bit definitions for control register 8 */
#define CR8_EAX 0xFFFF0000 /* Extended auth index */
#define CR8_MCMASK 0x0000FFFF /* Monitor masks */
/* Bit definitions for PER */
#define CR9_SB 0x80000000 /* Successful Branching */
#define CR9_IF 0x40000000 /* Instruction Fetch */
#define CR9_SA 0x20000000 /* Storage Alteration */
#define CR9_GRA 0x10000000 /* General Register Alt. */
#define CR9_STURA 0x08000000 /* Store using real addr */
#define CR9_IFNUL 0x01000000 /* IF nullification @PER3*/
#define CR9_GRMASK 0x0000FFFF /* GR mask bits */
#define CR9_BAC 0x00800000 /* Br addr control PER2 only */
#define CR9_SAC 0x00200000 /* Stor. alter. c. PER2 only */
/* Bit definitions for control register 12 */
#define S_CR12_BRTRACE 0x80000000 /* Branch trace control */
#define Z_CR12_BRTRACE 0x8000000000000000ULL /* Branch trace control*/
#define CR12_MTRACE 0x4000000000000000ULL /* Mode trace control */
#define S_CR12_TRACEEA 0x7FFFFFFC /* Trace entry address */
#define Z_CR12_TRACEEA 0x3FFFFFFFFFFFFFFCULL /* Trace entry address */
#define CR12_ASNTRACE 0x00000002 /* ASN trace control */
#define CR12_EXTRACE 0x00000001 /* Explicit trace control */
/* Bit definitions for control register 13 */
/* CR13 is the home segment table descriptor or home ASCE */
/* Bit definitions for control register 14 */
#define CR14_CHKSTOP 0x80000000 /* Check-stop control S/370*/
#define CR14_SYNCMCEL 0x40000000 /* Synchronous MCEL S/370*/
#define CR14_IOEXTLOG 0x20000000 /* I/O extended logout S/370*/
#define CR14_CHANRPT 0x10000000 /* Channel report mask */
#define CR14_RCVYRPT 0x08000000 /* Recovery report mask */
#define CR14_DGRDRPT 0x04000000 /* Degradation report mask */
#define CR14_XDMGRPT 0x02000000 /* External damage mask */
#define CR14_WARNING 0x01000000 /* Warning mask */
#define CR14_ASYNMCEL 0x00800000 /* Asynchronous MCEL S/370*/
#define CR14_ASYNFIXL 0x00400000 /* Asynch fixed log S/370*/
#define CR14_TODCTLOV 0x00200000 /* TOD clock control override*/
#define CR14_ASN_TRAN 0x00080000 /* ASN translation control */
#define CR14_AFTO 0x0007FFFF /* ASN first table origin */
/* Bit definitions for control register 15 */
#define CR15_LSEA_390 0x7FFFFFF8 /* Linkage stack address 390*/
#define CR15_LSEA_900 0xFFFFFFFFFFFFFFF8ULL /* Linkage stack ESAME*/
#define CR15_MCEL 0x00FFFFF8 /* MCEL address S/370*/
/* Linkage table designation bit definitions */
#define LTD_SSLINK 0x80000000 /* Subsystem-Linkage control */
#define LTD_LTO 0x7FFFFF80 /* Linkage-Table origin */
#define LTD_LTL 0x0000007F /* Linkage-Table length */
/* Linkage first table designation bit definitions (ASN-and-LX-reuse)*/
#define LFTD_SSLINK 0x80000000 /* Subsystem-Linkage control */
#define LFTD_LFTO 0x7FFFFF00 /* Linkage-First-Table origin*/
#define LFTD_LFTL 0x000000FF /* Linkage-First-Table length*/
/* Values for designation type and table type (ESAME mode) */
#define TT_R1TABL 0xC /* Region first table */
#define TT_R2TABL 0x8 /* Region second table */
#define TT_R3TABL 0x4 /* Region third table */
#define TT_SEGTAB 0x0 /* Segment table */
/* Address space control element bit definitions (ESAME mode) */
#define ASCE_TO 0xFFFFFFFFFFFFF000ULL /* Table origin */
#define ASCE_G 0x200 /* Subspace group indicator */
#define ASCE_P 0x100 /* Private space indicator */
#define ASCE_S 0x080 /* Storage alteration event */
#define ASCE_X 0x040 /* Space switch event */
#define ASCE_R 0x020 /* Real space */
#define ASCE_DT 0x00C /* Designation type */
#define ASCE_TL 0x003 /* Table length */
#define ASCE_RESV 0xC10 /* Reserved bits - ignored */
/* Region table entry bit definitions (ESAME mode) */
#define REGTAB_TO 0xFFFFFFFFFFFFF000ULL /* Table origin */
#define REGTAB_TF 0x0C0 /* Table offset */
#define REGTAB_I 0x020 /* Region invalid */
#define REGTAB_TT 0x00C /* Table type */
#define REGTAB_TL 0x003 /* Table length */
#define REGTAB_RESV 0xF10 /* Reserved bits - ignored */
/* Segment table entry bit definitions (ESAME mode) */
#define ZSEGTAB_PTO 0xFFFFFFFFFFFFF800ULL /* Page table origin */
#define ZSEGTAB_P 0x200 /* Page protection bit */
#define ZSEGTAB_I 0x020 /* Invalid segment */
#define ZSEGTAB_C 0x010 /* Common segment */
#define ZSEGTAB_TT 0x00C /* Table type */
#define ZSEGTAB_RESV 0x5C3 /* Reserved bits - ignored */
/* Page table entry bit definitions (ESAME mode) */
#define ZPGETAB_PFRA 0xFFFFFFFFFFFFF000ULL /* Page frame real addr*/
#define ZPGETAB_I 0x400 /* Invalid page */
#define ZPGETAB_P 0x200 /* Protected page */
#define ZPGETAB_ESVALID 0x100 /* Valid in expanded storage */
#define ZPGETAB_ESREF 0x080 /* ES Referenced */
#define ZPGETAB_ESCHA 0x040 /* ES Changed */
#define ZPGETAB_ESLCK 0x020 /* ES Locked */
#define ZPGETAB_RESV 0x900 /* Reserved bits - must be 0 */
/* Segment table designation bit definitions (ESA/390 mode) */
#define STD_SSEVENT 0x80000000 /* Space switch event */
#define STD_STO 0x7FFFF000 /* Segment table origin */
#define STD_RESV 0x00000C00 /* Reserved bits - must be 0 */
#define STD_GROUP 0x00000200 /* Subspace group indicator */
#define STD_PRIVATE 0x00000100 /* Private space indicator */
#define STD_SAEVENT 0x00000080 /* Storage alteration event */
#define STD_STL 0x0000007F /* Segment table length */
/* Segment table entry bit definitions (ESA/390 mode) */
#define SEGTAB_PTO 0x7FFFFFC0 /* Page table origin */
#define SEGTAB_INVALID 0x00000020 /* Invalid segment */
#define SEGTAB_COMMON 0x00000010 /* Common segment */
#define SEGTAB_PTL 0x0000000F /* Page table length */
#define SEGTAB_RESV 0x80000000 /* Reserved bits - must be 0 */
/* Page table entry bit definitions (ESA/390 mode) */
#define PAGETAB_PFRA 0x7FFFF000 /* Page frame real address */
#define PAGETAB_ESNK 0x00000800 /* ES NK bit */
#define PAGETAB_INVALID 0x00000400 /* Invalid page */
#define PAGETAB_PROT 0x00000200 /* Protected page */
#define PAGETAB_ESVALID 0x00000100 /* Valid in expanded storage */
#define PAGETAB_ESREF 0x00000004 /* ES Referenced */
#define PAGETAB_ESCHA 0x00000002 /* ES Changed */
#define PAGETAB_PGLOCK 0x00000001 /* Page lock (LKPG) */
#define PAGETAB_RESV 0x80000900 /* Reserved bits - must be 0 */
/* Segment table designation bit definitions (S/370 mode) */
#define STD_370_STL 0xFF000000 /* 370 segment table length */
#define STD_370_STO 0x00FFFFC0 /* 370 segment table origin */
#define STD_370_SSEVENT 0x00000001 /* 370 space switch event */
/* Segment table entry bit definitions (S/370 mode) */
#define SEGTAB_370_PTL 0xF0000000 /* Page table length */
#define SEGTAB_370_PTO 0x00FFFFF8 /* Page table origin */
#define SEGTAB_370_PROT 0x00000004 /* Protected segment */
#define SEGTAB_370_CMN 0x00000002 /* Common segment */
#define SEGTAB_370_INVL 0x00000001 /* Invalid segment */
#define SEGTAB_370_RSV 0x0F000000 /* Reserved bits - must be 0 */
/* Page table entry bit definitions (S/370 mode) */
#define PAGETAB_PFRA_4K 0xFFF0 /* Page frame real address */
#define PAGETAB_INV_4K 0x0008 /* Invalid page */
#define PAGETAB_EA_4K 0x0006 /* Extended physical address */
#define PAGETAB_PFRA_2K 0xFFF8 /* Page frame real address */
#define PAGETAB_INV_2K 0x0004 /* Invalid page */
#define PAGETAB_RSV_2K 0x0002 /* Reserved bit - must be 0 */
/* Access-list entry token special value definitions */
#define ALET_PRIMARY 0 /* Primary address-space */
#define ALET_SECONDARY 1 /* Secondary address-space */
#define ALET_HOME 2 /* Home address-space */
/* Access-list entry token bit definitions */
#define ALET_RESV 0xFE000000 /* Reserved bits - must be 0 */
#define ALET_PRI_LIST 0x01000000 /* Primary space access-list */
#define ALET_ALESN 0x00FF0000 /* ALE sequence number */
#define ALET_ALEN 0x0000FFFF /* Access-list entry number */
/* Access-list designation bit definitions */
#if FEATURE_ALD_FORMAT == 0 || defined(_900)
#define ALD_ALO 0x7FFFFF80 /* Access-list origin (fmt0) */
#define ALD_ALL 0x0000007F /* Access-list length (fmt0) */
#define ALD_ALL_SHIFT 3 /* Length units are 2**3 */
#else
#define ALD_ALO 0x7FFFFF00 /* Access-list origin (fmt1) */
#define ALD_ALL 0x000000FF /* Access-list length (fmt1) */
#define ALD_ALL_SHIFT 4 /* Length units are 2**4 */
#endif
/* Access-list entry bit definitions */
#define ALE0_INVALID 0x80000000 /* ALEN invalid */
#define ALE0_FETCHONLY 0x02000000 /* Fetch only address space */
#define ALE0_PRIVATE 0x01000000 /* Private address space */
#define ALE0_ALESN 0x00FF0000 /* ALE sequence number */
#define ALE0_ALEAX 0x0000FFFF /* ALE authorization index */
#define ALE2_ASTE 0x7FFFFFC0 /* ASTE address */
#define ALE3_ASTESN 0xFFFFFFFF /* ASTE sequence number */
/* Address-space number (ASN) bit definitions */
#define ASN_AFX 0xFFC0 /* ASN first table index */
#define ASN_ASX 0x003F /* ASN second table index */
/* ASN first table entry bit definitions */
#define AFTE_INVALID 0x80000000 /* ASN invalid */
#define AFTE_ASTO_0 0x7FFFFFF0 /* ASTE origin (CR0_ASF=0) */
#define AFTE_RESV_0 0x0000000F /* Reserved bits (CR0_ASF=0) */
#define AFTE_ASTO_1 0x7FFFFFC0 /* ASTE origin (CR0_ASF=1) */
#define AFTE_RESV_1 0x0000003F /* Reserved bits (CR0_ASF=1) */
/* ASN second table entry bit definitions */
#define ASTE0_INVALID 0x80000000 /* ASX invalid */
#define ASTE0_ATO 0x7FFFFFFC /* Authority-table origin */
#define ASTE0_RESV 0x00000002 /* Must be 0 for ESA/390 */
#define ASTE0_BASE 0x00000001 /* Base space of group */
#define ASTE1_AX 0xFFFF0000 /* Authorization index */
#define ASTE1_ATL 0x0000FFF0 /* Authority-table length */
#define ASTE1_RESV 0x0000000F /* Must be 0 for ESA/390 */
#define ASTE1_CA 0x00000002 /* Controlled ASN */
#define ASTE1_RA 0x00000001 /* Reusable ASN */
/* ASTE word 2 is the segment table designation for ESA/390 */
/* ASTE word 3 is the linkage-table designation for ESA/390 */
/* ASTE words 2 and 3 are the ASCE (RTD, STD, or RSD) for ESAME */
/* ASTE word 4 is the access-list designation */
#define ASTE5_ASTESN 0xFFFFFFFF /* ASTE sequence number */
#define ASTE6_RESV 0xFFFFFFFF /* Must be zero for ESA/390 */
/* ASTE word 6 is the LTD or LFTD for ESAME */
/* ASTE words 7-9 are reserved for control program use */
/* ASTE word 10 is unused */
#define ASTE11_ASTEIN 0xFFFFFFFF /* ASTE instance number */
/* ASTE words 12-15 are unused */
/* Authority table entry bit definitions */
#define ATE_PRIMARY 0x80 /* Primary authority bit */
#define ATE_SECONDARY 0x40 /* Secondary authority bit */
/* Dispatchable unit control table bit definitions */
#define DUCT0_BASTEO 0x7FFFFFC0 /* Base ASTE origin */
#define DUCT1_SA 0x80000000 /* Subspace active */
#define DUCT1_SSASTEO 0x7FFFFFC0 /* Subspace ASTE origin */
/* DUCT word 2 is unused */
#define DUCT3_SSASTESN 0xFFFFFFFF /* Subspace ASTE seq number */
/* DUCT word 4 is the access-list designation */
/* DUCT word 5 is unused for ESA/390 */
/* DUCT word 5 contains PKM/KEY/RA/PROB for ESAME */
/* DUCT word 6 is unused */
/* DUCT word 7 is for control program use */
/* DUCT words 8 and 9 are the return address for ESAME. In 24-bit and
31-bit mode, word 8 contains zero and word 9 contains AM31/IA31 */
/* DUCT word 8 contains AM31/IA31 for ESA/390 */
/* DUCT word 9 contains PKM/KEY/RA/PROB for ESA/390 */
/* DUCT word 10 is unused */
#define DUCT11_TCBA 0x7FFFFFF8 /* Trap control block address*/
#define DUCT11_TE 0x00000001 /* Trap enabled */
/* DUCT word 12 is unused */
/* DUCT word 13 is unused */
/* DUCT word 14 is unused */
/* DUCT word 15 is unused */
/* Bit definitions for DUCT word 5 (ESAME) or word 9 (ESA/390) */
#define DUCT_PKM 0xFFFF0000 /* PSW key mask */
#define DUCT_KEY 0x000000F0 /* PSW key */
#define DUCT_RA 0x00000008 /* Reduced authority state */
#define DUCT_PROB 0x00000001 /* Problem state */
/* Bit definitions for DUCT word 9 (ESAME) or word 8 (ESA/390) */
#define DUCT_AM31 0x80000000 /* 1=31-bit, 0=24-bit address*/
#define DUCT_IA31 0x7FFFFFFF /* 24/31 return address */
#define TCB0_P 0x00040000 /* Bit 13 PSW Control (P) */
#define TCB0_R 0x00020000 /* Bit 14 GR Control (R) */
#define TRAP0_EXECUTE 0x80000000 /* TRAP is target of execute */
#define TRAP0_TRAP4 0x40000000 /* TRAP is TRAP4 */
/* Linkage stack entry descriptor structure definition */
typedef struct _LSED {
BYTE uet; /* U-bit and entry type */
BYTE si; /* Section identification */
HWORD rfs; /* Remaining free space */
HWORD nes; /* Next entry size */
HWORD resv; /* Reserved bits - must be 0 */
} LSED;
/* Stack type definitions */
#define LSED_UET_U 0x80 /* Unstack suppression bit */
#define LSED_UET_ET 0x7F /* Entry type... */
#define S_LSED_UET_HDR 0x01 /* ...header entry */
#define S_LSED_UET_TLR 0x02 /* ...trailer entry */
#define S_LSED_UET_BAKR 0x04 /* ...branch state entry */
#define S_LSED_UET_PC 0x05 /* ...call state entry */
#define Z_LSED_UET_HDR 0x09 /* ...header entry */
#define Z_LSED_UET_TLR 0x0A /* ...trailer entry */
#define Z_LSED_UET_BAKR 0x0C /* ...branch state entry */
#define Z_LSED_UET_PC 0x0D /* ...call state entry */
/* Program call number bit definitions */
#define PC_LFX1 0xFFF00000 /* Linkage first index (high)*/
#define PC_BIT44 0x00080000 /* 1=LFX1 is significant */
#define PC_LFX2 0x0007E000 /* Linkage first index (low) */
#define PC_LSX 0x00001F00 /* Linkage second index */
#define PC_LX 0x000FFF00 /* Linkage index */
#define PC_EX 0x000000FF /* Entry index */
/* Linkage table entry bit definitions */
#define LTE_INVALID 0x80000000 /* LX invalid */
#define LTE_ETO 0x7FFFFFC0 /* Entry table origin */
#define LTE_ETL 0x0000003F /* Entry table length */
/* Linkage first table entry bit definitions (ASN-and-LX-reuse) */
#define LFTE_INVALID 0x80000000 /* LFX invalid */
#define LFTE_LSTO 0x7FFFFF00 /* Linkage second table orig */
/* Linkage second table entry bit definitions (ASN-and-LX-reuse) */
#define LSTE0_INVALID 0x80000000 /* LSX invalid */
#define LSTE0_ETO 0x7FFFFFC0 /* Entry table origin */
#define LSTE0_ETL 0x0000003F /* Entry table length */
#define LSTE1_LSTESN 0xFFFFFFFF /* LSTE sequence number */
/* Entry table bit entry definitions */
/* ETE word 0 is the left half of the EIA for ESAME if ETE4_G is set */
#define ETE0_AKM 0xFFFF0000 /* Authorization key mask 390*/
#define ETE0_ASN 0x0000FFFF /* Address space number 390*/
#define ETE1_AMODE 0x80000000 /* Addressing mode */
#define ETE1_EIA 0x7FFFFFFE /* Instruction address */
#define ETE1_PROB 0x00000001 /* Problem state bit */
/* ETE word 2 is the entry parameter for ESA/390 */
#define ETE2_AKM 0xFFFF0000 /* Auth.key mask ESAME*/
#define ETE2_ASN 0x0000FFFF /* Address space number ESAME*/
#define ETE3_EKM 0xFFFF0000 /* Entry key mask */
#define ETE4_T 0x80000000 /* 0=Basic PC, 1=Stacking PC */
#define ETE4_G 0x40000000 /* 1=64-bit EIA/EPARM ESAME*/
#define ETE4_K 0x10000000 /* 1=Replace PSW key by EK */
#define ETE4_M 0x08000000 /* 1=Replace PKM by EKM, 0=or*/
#define ETE4_E 0x04000000 /* 1=Replace EAX by EEAX */
#define ETE4_C 0x02000000 /* 0=Primary mode, 1=AR mode */
#define ETE4_S 0x01000000 /* SASN:0=old PASN,1=new PASN*/
#define ETE4_EK 0x00F00000 /* Entry key */
#define ETE4_EEAX 0x0000FFFF /* Entry extended AX */
#define ETE5_ASTE 0x7FFFFFC0 /* ASTE address */
/* ETE words 6 and 7 are unused for ESA/390 */
/* ETE words 6 and 7 are the entry parameter for ESAME */
/* SIGP order codes */
#define SIGP_SENSE 0x01 /* Sense */
#define SIGP_EXTCALL 0x02 /* External call */
#define SIGP_EMERGENCY 0x03 /* Emergency signal */
#define SIGP_START 0x04 /* Start */
#define SIGP_STOP 0x05 /* Stop */
#define SIGP_RESTART 0x06 /* Restart */
#define SIGP_IPR 0x07 /* Initial program reset */ /* 370 only */
#define SIGP_PR 0x08 /* Program reset */ /* 370 only */
#define SIGP_STOPSTORE 0x09 /* Stop and store status */
#define SIGP_IMPL 0x0A /* Initial uprogram load */ /* 370 only */
#define SIGP_INITRESET 0x0B /* Initial CPU reset */
#define SIGP_RESET 0x0C /* CPU reset */
#define SIGP_SETPREFIX 0x0D /* Set prefix */
#define SIGP_STORE 0x0E /* Store status at address */
#define SIGP_STOREX 0x11 /* Store ext status at addr */ /* 390 only */
#define SIGP_SETARCH 0x12 /* Set architecture mode */
#define SIGP_COND_EMERGENCY 0x13 /* Conditional Emergency */
#define SIGP_SENSE_RUNNING_STATE 0x15 /* Sense Running State */
#define MAX_SIGPORDER 0x15 /* Maximum SIGP order value */
#define LOG_SIGPORDER 0x03 /* Log any SIGP > this value */
/* SIGP status codes */
#define SIGP_STATUS_EQUIPMENT_CHECK 0x80000000
#define SIGP_STATUS_NOT_RUNNING 0x00000400
#define SIGP_STATUS_INCORRECT_STATE 0x00000200
#define SIGP_STATUS_INVALID_PARAMETER 0x00000100
#define SIGP_STATUS_EXTERNAL_CALL_PENDING 0x00000080
#define SIGP_STATUS_STOPPED 0x00000040
#define SIGP_STATUS_OPERATOR_INTERVENING 0x00000020
#define SIGP_STATUS_CHECK_STOP 0x00000010
#define SIGP_STATUS_INOPERATIVE 0x00000004
#define SIGP_STATUS_INVALID_ORDER 0x00000002
#define SIGP_STATUS_RECEIVER_CHECK 0x00000001
/* Storage key bit definitions */
#define STORKEY_KEY 0xF0 /* Storage key */
#define STORKEY_FETCH 0x08 /* Fetch protect bit */
#define STORKEY_REF 0x04 /* Reference bit */
#define STORKEY_CHANGE 0x02 /* Change bit */
#define STORKEY_BADFRM 0x01 /* Unusable frame */
/* Prefixed storage area structure definition */
typedef struct _PSA_3XX { /* Prefixed storage area */
/*000*/ DBLWRD iplpsw; /* IPL PSW, Restart new PSW */
/*008*/ DBLWRD iplccw1; /* IPL CCW1, Restart old PSW */
/*010*/ DBLWRD iplccw2; /* IPL CCW2 */
/*018*/ DBLWRD extold; /* External old PSW */
/*020*/ DBLWRD svcold; /* SVC old PSW */
/*028*/ DBLWRD pgmold; /* Program check old PSW */
/*030*/ DBLWRD mckold; /* Machine check old PSW */
/*038*/ DBLWRD iopold; /* I/O old PSW */
/*040*/ DBLWRD csw; /* Channel status word (S370)*/
/*048*/ FWORD caw; /* Channel address word(S370)*/
/*04C*/ FWORD resv04C; /* Reserved */
/*050*/ FWORD inttimer; /* Interval timer */
/*054*/ FWORD resv054; /* Reserved */
/*058*/ DBLWRD extnew; /* External new PSW */
/*060*/ DBLWRD svcnew; /* SVC new PSW */
/*068*/ DBLWRD pgmnew; /* Program check new PSW */
/*070*/ DBLWRD mcknew; /* Machine check new PSW */
/*078*/ DBLWRD iopnew; /* I/O new PSW */
/*080*/ FWORD extparm; /* External interrupt param */
/*084*/ HWORD extcpad; /* External interrupt CPU# */
/*086*/ HWORD extint; /* External interrupt code */
/*088*/ FWORD svcint; /* SVC interrupt code */
/*08C*/ FWORD pgmint; /* Program interrupt code */
/*090*/ FWORD tea; /* Translation exception addr*/
/*094*/ HWORD monclass; /* Monitor class */
/*096*/ HWORD perint; /* PER interrupt code */
/*098*/ FWORD peradr; /* PER address */
/*09C*/ FWORD moncode; /* Monitor code */
/*0A0*/ BYTE excarid; /* Exception access id */
/*0A1*/ BYTE perarid; /* PER access id */
/*0A2*/ BYTE opndrid; /* Operand access id */
/*0A3*/ BYTE arch; /* Architecture mode ID */
/*0A4*/ FWORD resv0A4; /* Reserved */
/*0A8*/ FWORD chanid; /* Channel id (S370) */
/*0AC*/ FWORD ioelptr; /* I/O extended logout (S370)*/
/*0B0*/ FWORD lcl; /* Limited chan logout (S370)*/
/*0B4*/ FWORD resv0B0; /* Reserved */
/*0B8*/ FWORD ioid; /* I/O interrupt device id */
/*0BC*/ FWORD ioparm; /* I/O interrupt parameter */
/*0C0*/ FWORD iointid; /* I/O interrupt ID */
/*0C4*/ FWORD resv0C4; /* Reserved */
/*0C8*/ FWORD stfl; /* Facilities list (STFL) */
/*0CC*/ FWORD resv0CC; /* Reserved */
/*0D0*/ DBLWRD resv0D0; /* Reserved */
/*0D8*/ DBLWRD storeptmr; /* CPU timer save area */
/*0E0*/ DBLWRD storeclkc; /* Clock comparator save area*/
/*0E8*/ DBLWRD mckint; /* Machine check int code */
/*0F0*/ FWORD resv0F0; /* Reserved */
/*0F4*/ FWORD xdmgcode; /* External damage code */
/*0F8*/ FWORD mcstorad; /* Failing storage address */
/*0FC*/ FWORD resv0FC; /* Reserved */
/*100*/ DBLWRD storepsw; /* Store status PSW save area*/
/*108*/ FWORD storepfx; /* Prefix register save area */
/*10C*/ FWORD resv10C; /* Reserved */
/*110*/ DBLWRD resv110; /* Reserved */
/*118*/ DBLWRD resv118; /* Reserved */
/*120*/ FWORD storear[16]; /* Access register save area */
/*160*/ FWORD storefpr[8]; /* FP register save area */
/*180*/ FWORD storegpr[16]; /* General register save area*/
/*1C0*/ FWORD storecr[16]; /* Control register save area*/
} PSA_3XX;
/* ESAME Prefixed storage area structure definition */
typedef struct _PSA_900 { /* Prefixed storage area */
/*0000*/ DBLWRD iplpsw; /* IPL PSW */
/*0008*/ DBLWRD iplccw1; /* IPL CCW1 */
/*0010*/ DBLWRD iplccw2; /* IPL CCW2 */
/*0018*/ BYTE resv0018[104]; /* Reserved */
/*0080*/ FWORD extparm; /* External interrupt param */
/*0084*/ HWORD extcpad; /* External interrupt CPU# */
/*0086*/ HWORD extint; /* External interrupt code */
/*0088*/ FWORD svcint; /* SVC interrupt code */
/*008C*/ FWORD pgmint; /* Program interrupt code */
/*0090*/ FWORD dataexc; /* Data exception code */
/*0094*/ HWORD monclass; /* Monitor class */
/*0096*/ HWORD perint; /* PER interrupt code */
/*0098*/ DBLWRD peradr; /* PER address */
/*00A0*/ BYTE excarid; /* Exception access id */
/*00A1*/ BYTE perarid; /* PER access id */
/*00A2*/ BYTE opndrid; /* Operand access id */
/*00A3*/ BYTE arch; /* Architecture mode ID */
/*00A4*/ FWORD mpladdr; /* MPL addr */
/*00A8*/ DWORD_U tea; /* Translation exception addr*/
#define TEA_G tea.D
#define TEA_L tea.F.L.F
#define TEA_H tea.F.H.F
/*00B0*/ DBLWRD moncode; /* Monitor code */
/*00B8*/ FWORD ioid; /* I/O interrupt subsys id */
/*00BC*/ FWORD ioparm; /* I/O interrupt parameter */
/*00C0*/ FWORD iointid; /* I/O interrupt ID */
/*00C4*/ FWORD resv00C0; /* Reserved */
/*00C8*/ FWORD stfl; /* Facilities list (STFL) */
/*00CC*/ FWORD resv00CC; /* Reserved */
/*00D0*/ DBLWRD resv00D0; /* Reserved */
/*00D8*/ DBLWRD resv00D8; /* Reserved */
/*00E0*/ DBLWRD resv00E0; /* Reserved */
/*00E8*/ DBLWRD mckint; /* Machine check int code */
/*00F0*/ FWORD mckext; /* Machine check int code ext*/
/*00F4*/ FWORD xdmgcode; /* External damage code */
/*00F8*/ DBLWRD mcstorad; /* Failing storage address */
/*0100*/ DBLWRD resv0100; /* Reserved */
/*0108*/ DBLWRD resv0108; /* Reserved */
/*0110*/ DBLWRD bea; /* Breaking event address @Z9*/
/*0118*/ DBLWRD resv0118; /* Reserved */
/*0120*/ QWORD rstold; /* Restart old PSW */
/*0130*/ QWORD extold; /* External old PSW */
/*0140*/ QWORD svcold; /* SVC old PSW */
/*0150*/ QWORD pgmold; /* Program check old PSW */
/*0160*/ QWORD mckold; /* Machine check old PSW */
/*0170*/ QWORD iopold; /* I/O old PSW */
/*0180*/ BYTE resv0180[32]; /* Reserved */
/*01A0*/ QWORD rstnew; /* Restart new PSW */
/*01B0*/ QWORD extnew; /* External new PSW */
/*01C0*/ QWORD svcnew; /* SVC new PSW */
/*01D0*/ QWORD pgmnew; /* Program check new PSW */
/*01E0*/ QWORD mcknew; /* Machine check new PSW */
/*01F0*/ QWORD iopnew; /* I/O new PSW */
/*0200*/ BYTE resv0200[4096]; /* Reserved */
/*1200*/ FWORD storefpr[32]; /* FP register save area */
/*1280*/ DBLWRD storegpr[16]; /* General register save area*/
/*1300*/ QWORD storepsw; /* Store status PSW save area*/
/*1310*/ DBLWRD resv1310; /* Reserved */
/*1318*/ FWORD storepfx; /* Prefix register save area */
/*131C*/ FWORD storefpc; /* FP control save area */
/*1320*/ FWORD resv1320; /* Reserved */
/*1324*/ FWORD storetpr; /* TOD prog reg save area */
/*1328*/ DBLWRD storeptmr; /* CPU timer save area */
/*1330*/ DBLWRD storeclkc; /* Clock comparator save area*/
/*1338*/ DBLWRD resv1338; /* Reserved */
/*1340*/ FWORD storear[16]; /* Access register save area */
/*1380*/ DBLWRD storecr[16]; /* Control register save area*/
} PSA_900;
/* Bit settings for translation exception address */
#define TEA_SECADDR 0x80000000 /* Secondary addr (370,390) */
#define TEA_PROT_A 0x008 /* Access-list prot (ESAME) */
#define TEA_PROT_AP 0x004 /* Access-list/page protected*/
#define TEA_MVPG 0x004 /* MVPG exception (ESAME) */
#define TEA_ST 0x003 /* Address space indication..*/
#define TEA_ST_PRIMARY 0x000 /* ..primary STO/ASCE used */
#define TEA_ST_ARMODE 0x001 /* ..access register mode */
#define TEA_ST_SECNDRY 0x002 /* ..secondary STO/ASCE used */
#define TEA_ST_HOME 0x003 /* ..home STO/ASCE used */
#define TEA_SSEVENT 0x80000000 /* Space switch event bit */
#define TEA_ASN 0x0000FFFF /* Address space number */
#define TEA_PCN 0x000FFFFF /* Program call number */
/* Bit settings for machine check interruption code */
#define MCIC_SD 0x8000000000000000ULL /* System damage */
#define MCIC_P 0x4000000000000000ULL /* Instruction proc damage */
#define MCIC_SR 0x2000000000000000ULL /* System recovery */
#define MCIC_CD 0x0800000000000000ULL /* Timing facility damage */
#define MCIC_ED 0x0400000000000000ULL /* External damage */
#define MCIC_VF 0x0200000000000000ULL /* Vector facility failure */
#define MCIC_DG 0x0100000000000000ULL /* Degradation */
#define MCIC_W 0x0080000000000000ULL /* Warning */
#define MCIC_CP 0x0040000000000000ULL /* Channel report pending */
#define MCIC_SP 0x0020000000000000ULL /* Service processor damage */
#define MCIC_CK 0x0010000000000000ULL /* Channel subsystem damage */
#define MCIC_VS 0x0004000000000000ULL /* Vector facility source */
#define MCIC_B 0x0002000000000000ULL /* Backed up */
#define MCIC_SE 0x0000800000000000ULL /* Storage error uncorrected */
#define MCIC_SC 0x0000400000000000ULL /* Storage error corrected */
#define MCIC_KE 0x0000200000000000ULL /* Storkey error uncorrected */
#define MCIC_DS 0x0000100000000000ULL /* Storage degradation */
#define MCIC_WP 0x0000080000000000ULL /* PSW-MWP validity */
#define MCIC_MS 0x0000040000000000ULL /* PSW mask and key validity */
#define MCIC_PM 0x0000020000000000ULL /* PSW pm and cc validity */
#define MCIC_IA 0x0000010000000000ULL /* PSW ia validity */
#define MCIC_FA 0x0000008000000000ULL /* Failing stor addr validity*/
#define MCIC_EC 0x0000002000000000ULL /* External damage code val. */
#define MCIC_FP 0x0000001000000000ULL /* Floating point reg val. */
#define MCIC_GR 0x0000000800000000ULL /* General register validity */
#define MCIC_CR 0x0000000400000000ULL /* Control register validity */
#define MCIC_ST 0x0000000100000000ULL /* Storage logical validity */
#define MCIC_IE 0x0000000080000000ULL /* Indirect storage error */
#define MCIC_AR 0x0000000040000000ULL /* Access register validity */
#define MCIC_DA 0x0000000020000000ULL /* Delayed access exeption */
#define MCIC_PR 0x0000000000200000ULL /* TOD prog. reg. validity */
#define MCIC_XF 0x0000000000100000ULL /* Extended float reg val. */
#define MCIC_AP 0x0000000000080000ULL /* Ancillary report */
#define MCIC_CT 0x0000000000020000ULL /* CPU timer validity */
#define MCIC_CC 0x0000000000010000ULL /* Clock comparator validity */
/* Channel Report Word definitions */
#define CRW_SOL 0x40000000 /* Solicited CRW */
#define CRW_OVER 0x20000000 /* Overflow, CRW's lost */
#define CRW_CHAIN 0x10000000 /* More CRW's describe event */
#define CRW_RSC 0x0F000000 /* Reporting resource mask */
#define CRW_MONIT 0x02000000 /* Channel monitor is source */
#define CRW_SUBCH 0x03000000 /* Subchannel is source */
#define CRW_CHPID 0x04000000 /* Channel path is source */
#define CRW_CAF 0x09000000 /* Configuration alert */
#define CRW_CSS 0x0B000000 /* Channel subsys is source */
#define CRW_AR 0x00800000 /* Ancillary report indicator*/
#define CRW_ERC 0x003F0000 /* Error recovery code */
#define CRW_AVAIL 0x00010000 /* Available */
#define CRW_INIT 0x00020000 /* Initialized no parm. chg. */
#define CRW_TEMP 0x00030000 /* Temporary error */
#define CRW_ALERT 0x00040000 /* Installed, subch changed */
#define CRW_TERM 0x00050000 /* Terminal */
#define CRW_PERM 0x00060000 /* Permanent error / not init*/
#define CRW_PERMI 0x00070000 /* Permanent, initialized */
#define CRW_IPM 0x00080000 /* PIM / PAM / CHPIDs changed*/
#define CRW_RSID 0x0000FFFF /* Resource identifier */
/* Bit settings for channel id */
#define CHANNEL_TYPE 0xF0000000 /* Bits 0-3=Channel type... */
#define CHANNEL_SEL 0x00000000 /* ...selector channel */
#define CHANNEL_MPX 0x10000000 /* ...byte multiplexor */
#define CHANNEL_BMX 0x20000000 /* ...block multiplexor */
#define CHANNEL_MODEL 0x0FFF0000 /* Bits 4-15=Channel model */
#define CHANNEL_MAXIOEL 0x0000FFFF /* Bits 16-31=Max.IOEL length*/
/* Program interruption codes */
#define PGM_OPERATION_EXCEPTION 0x0001
#define PGM_PRIVILEGED_OPERATION_EXCEPTION 0x0002
#define PGM_EXECUTE_EXCEPTION 0x0003
#define PGM_PROTECTION_EXCEPTION 0x0004
#define PGM_ADDRESSING_EXCEPTION 0x0005
#define PGM_SPECIFICATION_EXCEPTION 0x0006
#define PGM_DATA_EXCEPTION 0x0007
#define PGM_FIXED_POINT_OVERFLOW_EXCEPTION 0x0008
#define PGM_FIXED_POINT_DIVIDE_EXCEPTION 0x0009
#define PGM_DECIMAL_OVERFLOW_EXCEPTION 0x000A
#define PGM_DECIMAL_DIVIDE_EXCEPTION 0x000B
#define PGM_EXPONENT_OVERFLOW_EXCEPTION 0x000C
#define PGM_EXPONENT_UNDERFLOW_EXCEPTION 0x000D
#define PGM_SIGNIFICANCE_EXCEPTION 0x000E
#define PGM_FLOATING_POINT_DIVIDE_EXCEPTION 0x000F
#define PGM_SEGMENT_TRANSLATION_EXCEPTION 0x0010
#define PGM_PAGE_TRANSLATION_EXCEPTION 0x0011
#define PGM_TRANSLATION_SPECIFICATION_EXCEPTION 0x0012
#define PGM_SPECIAL_OPERATION_EXCEPTION 0x0013
#define PGM_OPERAND_EXCEPTION 0x0015
#define PGM_TRACE_TABLE_EXCEPTION 0x0016
#define PGM_ASN_TRANSLATION_SPECIFICATION_EXCEPTION 0x0017
#define PGM_VECTOR_OPERATION_EXCEPTION 0x0019
#define PGM_SPACE_SWITCH_EVENT 0x001C
#define PGM_SQUARE_ROOT_EXCEPTION 0x001D
#define PGM_UNNORMALIZED_OPERAND_EXCEPTION 0x001E
#define PGM_PC_TRANSLATION_SPECIFICATION_EXCEPTION 0x001F
#define PGM_AFX_TRANSLATION_EXCEPTION 0x0020
#define PGM_ASX_TRANSLATION_EXCEPTION 0x0021
#define PGM_LX_TRANSLATION_EXCEPTION 0x0022
#define PGM_EX_TRANSLATION_EXCEPTION 0x0023
#define PGM_PRIMARY_AUTHORITY_EXCEPTION 0x0024
#define PGM_SECONDARY_AUTHORITY_EXCEPTION 0x0025
#define PGM_LFX_TRANSLATION_EXCEPTION 0x0026
#define PGM_LSX_TRANSLATION_EXCEPTION 0x0027
#define PGM_ALET_SPECIFICATION_EXCEPTION 0x0028
#define PGM_ALEN_TRANSLATION_EXCEPTION 0x0029
#define PGM_ALE_SEQUENCE_EXCEPTION 0x002A
#define PGM_ASTE_VALIDITY_EXCEPTION 0x002B
#define PGM_ASTE_SEQUENCE_EXCEPTION 0x002C
#define PGM_EXTENDED_AUTHORITY_EXCEPTION 0x002D
#define PGM_LSTE_SEQUENCE_EXCEPTION 0x002E
#define PGM_ASTE_INSTANCE_EXCEPTION 0x002F
#define PGM_STACK_FULL_EXCEPTION 0x0030
#define PGM_STACK_EMPTY_EXCEPTION 0x0031
#define PGM_STACK_SPECIFICATION_EXCEPTION 0x0032
#define PGM_STACK_TYPE_EXCEPTION 0x0033
#define PGM_STACK_OPERATION_EXCEPTION 0x0034
#define PGM_ASCE_TYPE_EXCEPTION 0x0038
#define PGM_REGION_FIRST_TRANSLATION_EXCEPTION 0x0039
#define PGM_REGION_SECOND_TRANSLATION_EXCEPTION 0x003A
#define PGM_REGION_THIRD_TRANSLATION_EXCEPTION 0x003B
#define PGM_MONITOR_EVENT 0x0040
#define PGM_PER_EVENT 0x0080
#define PGM_CRYPTO_OPERATION_EXCEPTION 0x0119
/* External interrupt codes */
#define EXT_INTERRUPT_KEY_INTERRUPT 0x0040
#define EXT_INTERVAL_TIMER_INTERRUPT 0x0080
#define EXT_TOD_CLOCK_SYNC_CHECK_INTERRUPT 0x1003
#define EXT_CLOCK_COMPARATOR_INTERRUPT 0x1004
#define EXT_CPU_TIMER_INTERRUPT 0x1005
#define EXT_MALFUNCTION_ALERT_INTERRUPT 0x1200
#define EXT_EMERGENCY_SIGNAL_INTERRUPT 0x1201
#define EXT_EXTERNAL_CALL_INTERRUPT 0x1202
#define EXT_ETR_INTERRUPT 0x1406
#define EXT_SERVICE_SIGNAL_INTERRUPT 0x2401
#if defined(FEATURE_ECPSVM)
#define EXT_VINTERVAL_TIMER_INTERRUPT 0x0100
#endif
/* Macros for classifying CCW operation codes */
#define IS_CCW_WRITE(c) (((c)&0x03)==0x01)
#define IS_CCW_READ(c) (((c)&0x03)==0x02)
#define IS_CCW_CONTROL(c) (((c)&0x03)==0x03)
#define IS_CCW_NOP(c) ((c)==0x03)
#define IS_CCW_SET_EXTENDED(c) ((c)==0xC3)
#define IS_CCW_SENSE(c) (((c)&0x0F)==0x04)
#define IS_CCW_TIC(c) (((c)&0x0F)==0x08)
#define IS_CCW_RDBACK(c) (((c)&0x0F)==0x0C)
/* Operation request block structure definition */
typedef struct _ORB {
FWORD intparm; /* Interruption parameter */
BYTE flag4; /* Flag byte 4 */
BYTE flag5; /* Flag byte 5 */
BYTE lpm; /* Logical path mask */
BYTE flag7; /* Flag byte 7 */
FWORD ccwaddr; /* CCW address */
} ORB;
/* Bit definitions for ORB flag byte 4 */
#define ORB4_KEY 0xF0 /* Subchannel protection key */
#define ORB4_S 0x08 /* Suspend control */
#define ORB4_C 0x04 /* Streaming mode (FICON) */
#define ORB4_M 0x02 /* Modification (FICON) */
#define ORB4_Y 0x01 /* Synchronization (FICON) */
/* Bit definitions for ORB flag byte 5 */
#define ORB5_F 0x80 /* CCW format */
#define ORB5_P 0x40 /* Prefetch */
#define ORB5_I 0x20 /* Initial status interrupt */
#define ORB5_A 0x10 /* Address limit checking */
#define ORB5_U 0x08 /* Suppress susp interrupt */
#define ORB5_RESV 0x04 /* Reserved bit - must be 0 */
#define ORB5_H 0x02 /* Format-2 IDAW control */
#define ORB5_T 0x01 /* 2K format-2 IDAW control */
/* Bit definitions for ORB flag byte 7 */
#define ORB7_L 0x80 /* Suppress incorrect length */
#define ORB7_D 0x40 /* MIDAW control @MW*/
#define ORB7_RESV 0x3E /* Reserved - must be 0 @MW*/
#define ORB7_X 0x01 /* ORB extension control */
/* Path management control word structure definition */
typedef struct _PMCW {
FWORD intparm; /* Interruption parameter */
BYTE flag4; /* Flag byte 4 */
BYTE flag5; /* Flag byte 5 */
HWORD devnum; /* Device number */
BYTE lpm; /* Logical path mask */
BYTE pnom; /* Path not operational mask */
BYTE lpum; /* Last path used mask */
BYTE pim; /* Path installed mask */
HWORD mbi; /* Measurement block index */
BYTE pom; /* Path operational mask */
BYTE pam; /* Path available mask */
BYTE chpid[8]; /* Channel path identifiers */
BYTE zone; /* SIE zone */
BYTE flag25; /* Flag byte 25 */
BYTE flag26; /* Reserved byte - must be 0 */
BYTE flag27; /* Flag byte 27 */
} PMCW;
/* Bit definitions for PMCW flag byte 4 */
#define PMCW4_Q 0x80 /* QDIO available */
#define PMCW4_ISC 0x38 /* Interruption subclass */
#define PMCW4_A 0x01 /* Alternate Block Control */
#define PMCW4_RESV 0x46 /* Reserved bits - must be 0 */
/* Bit definitions for PMCW flag byte 5 */
#define PMCW5_E 0x80 /* Subchannel enabled */
#define PMCW5_LM 0x60 /* Limit mode... */
#define PMCW5_LM_NONE 0x00 /* ...no limit checking */
#define PMCW5_LM_LOW 0x20 /* ...lower limit specified */
#define PMCW5_LM_HIGH 0x40 /* ...upper limit specified */