cp: make con_printf non-fatal no-op
[hvf.git] / loader / loader.h
blob50d240a75899e2885f387a4130d0e7de188e13cb
1 #ifndef __LOADER_H
2 #define __LOADER_H
4 /*
5 * "Config" values
6 */
7 #define TEMP_BASE ((unsigned char*) 0x400000) /* 4MB */
8 #define SYMTAB_BASE ((unsigned char*) 8192) /* 8kB */
10 /* 3390 with 0 key length, and 4096 data length */
11 #define RECORDS_PER_CYL (15*12)
12 #define RECORDS_PER_TRACK 12
14 /* the nucleus fn ft (in EBCDIC) => HVF ELF */
15 #define CP_FN "\xC8\xE5\xC6\x40\x40\x40\x40\x40"
16 #define CP_FT "\xC5\xD3\xC6\x40\x40\x40\x40\x40"
19 * string manipulation
21 #define memcpy(d,s,l) __builtin_memcpy((d), (s), (l))
22 #define memcmp(d,s,l) __builtin_memcmp((d), (s), (l))
23 #define memset(s,c,n) __builtin_memset((s),(c),(n))
26 * I/O related structs, macros & variables
28 struct ccw {
29 u8 cmd; /* Command code */
30 u8 flags; /* Flags */
31 u16 count; /* Count */
32 u32 addr; /* Data Address */
33 } __attribute__((packed,aligned(8)));
35 #define CCW_FLAG_CD 0x80 /* Chain-Data */
36 #define CCW_FLAG_CC 0x40 /* Chain-Command */
37 #define CCW_FLAG_SLI 0x20 /* Suppress-Length-Indication */
38 #define CCW_FLAG_SKP 0x10 /* Skip */
39 #define CCW_FLAG_PCI 0x08 /* Program-Controlled-Interruption */
40 #define CCW_FLAG_IDA 0x04 /* Indirect-Data-Address */
41 #define CCW_FLAG_S 0x02 /* Suspend */
42 #define CCW_FLAG_MIDA 0x01 /* Modified-Indirect-Data-Address */
44 struct orb {
45 /* word 0 */
46 u32 param; /* Interruption Parameter */
48 /* word 1 */
49 u8 key:4, /* Subchannel Key */
50 s:1, /* Suspend */
51 c:1, /* Streaming-Mode Control */
52 m:1, /* Modification Control */
53 y:1; /* Synchronization Control */
54 u8 f:1, /* Format Control */
55 p:1, /* Prefetch Control */
56 i:1, /* Initial-Status-Interruption Control */
57 a:1, /* Address-Limit-Checking control */
58 u:1, /* Suppress-Suspend-Interruption Control */
59 __zero1:1,
60 h:1, /* Format-2-IDAW Control */
61 t:1; /* 2K-IDAW Control */
62 u8 lpm; /* Logical-Path Mask */
63 u8 l:1, /* Incorrect-Length-Suppression Mode */
64 d:1, /* Modified-CCW-Indirect-Data-Addressing Control */
65 __zero2:5,
66 x:1; /* ORB-Extension Control */
68 /* word 2 */
69 u32 addr; /* Channel-Program Address */
71 /* word 3 */
72 u8 css_prio; /* Channel-Subsystem Priority */
73 u8 __reserved1;
74 u8 cu_prio; /* Control-Unit Priority */
75 u8 __reserved2;
77 /* word 4 - 7 */
78 u32 __reserved3;
79 u32 __reserved4;
80 u32 __reserved5;
81 u32 __reserved6;
82 } __attribute__((packed,aligned(4)));
84 #define ADDR31(x) ((u32) (u64) (x))
86 extern void __do_io();
87 extern void PGMHANDLER();
89 extern void load_nucleus(void);
91 extern struct orb ORB;
94 * EDF related structs & macros
96 #define EDF_LABEL_BLOCK_NO 3
97 #define EDF_SUPPORTED_BLOCK_SIZE 4096
99 struct ADT {
100 u32 IDENT; /* VOL START / LABEL IDENTIFIER */
101 #define __ADTIDENT 0xC3D4E2F1 /* 'CMS1' in EBCDIC */
102 u8 ID[6]; /* VOL START / VOL IDENTIFIER */
103 u8 VER[2]; /* VERSION LEVEL */
104 u32 DBSIZ; /* DISK BLOCK SIZE */
105 u32 DOP; /* DISK ORIGIN POINTER */
106 u32 CYL; /* NUM OF FORMATTED CYL ON DISK */
107 u32 MCYL; /* MAX NUM FORMATTED CYL ON DISK */
108 u32 NUM; /* Number of Blocks on disk */
109 u32 USED; /* Number of Blocks used */
110 u32 FSTSZ; /* SIZE OF FST */
111 u32 NFST; /* NUMBER OF FST'S PER BLOCK */
112 u8 DCRED[6]; /* DISK CREATION DATE (YYMMDDHHMMSS) */
113 u8 FLGL; /* LABEL FLAG BYTE (ADTFLGL) */
114 #define ADTCNTRY 0x01 /* Century for disk creation date (0=19, 1=20),
115 * corresponds to ADTDCRED. */
116 u8 reserved[1];
117 u32 OFFST; /* DISK OFFSET WHEN RESERVED */
118 u32 AMNB; /* ALLOC MAP BLOCK WITH NEXT HOLE */
119 u32 AMND; /* DISP INTO HBLK DATA OF NEXT HOLE */
120 u32 AMUP; /* DISP INTO USER PART OF ALLOC MAP */
121 u32 OFCNT; /* Count of SFS open files for this ADT */
122 u8 SFNAM[8]; /* NAME OF SHARED SEGMENT */
125 struct FST {
126 u8 FNAME[8]; /* filename */
127 u8 FTYPE[8]; /* filetype */
128 u8 DATEW[2]; /* DATE LAST WRITTEN - MMDD */
129 u8 TIMEW[2]; /* TIME LAST WRITTEN - HHMM */
130 u16 WRPNT; /* WRITE POINTER - ITEM NUMBER */
131 u16 RDPNT; /* READ POINTER - ITEM NUMBER */
132 u8 FMODE[2]; /* FILE MODE - LETTER AND NUMBER */
133 u16 RECCT; /* NUMBER OF LOGICAL RECORDS */
134 u16 FCLPT; /* FIRST CHAIN LINK POINTER */
135 u8 RECFM; /* F*1 - RECORD FORMAT - F OR V */
136 #define FSTDFIX 0xC6 /* Fixed record format (EBCDIC 'F') */
137 #define FSTDVAR 0xE5 /* Variable record format (EBCDIC 'V') */
138 u8 FLAGS; /* F*2 - FST FLAG BYTE */
139 #define FSTRWDSK 0x80 /* READ/WRITE DISK */
140 #define FSTRODSK 0x00 /* READ/ONLY DISK */
141 #define FSTDSFS 0x10 /* Shared File FST */
142 #define FSTXRDSK 0x40 /* EXTENSION OF R/O DISK */
143 #define FSTXWDSK 0xC0 /* EXTENSION OF R/W DISK */
144 #define FSTEPL 0x20 /* EXTENDED PLIST */
145 #define FSTDIA 0x40 /* ITEM AVAILABLE */
146 #define FSTDRA 0x01 /* PREVIOUS RECORD NULL */
147 #define FSTCNTRY 0x08 /* Century for date last written (0=19, 1=20),\\
148 corresponds to FSTYEARW, FSTADATI. */
149 #define FSTACTRD 0x04 /* ACTIVE FOR READING */
150 #define FSTACTWR 0x02 /* ACTIVE FOR WRITING */
151 #define FSTACTPT 0x01 /* ACTIVE FROM A POINT */
152 #define FSTFILEA 0x07 /* THE FILE IS ACTIVE */
153 u32 LRECL; /* LOGICAL RECORD LENGTH */
154 u16 BLKCT; /* NUMBER OF 800 BYTE BLOCKS */
155 u16 YEARW; /* YEAR LAST WRITTEN */
156 u32 FOP; /* ALT. FILE ORIGIN POINTER */
157 u32 ADBC; /* ALT. NUMBER OF DATA BLOCKS */
158 u32 AIC; /* ALT. ITEM COUNT */
159 u8 NLVL; /* NUMBER OF POINTER BLOCK LEVELS */
160 u8 PTRSZ; /* LENGTH OF A POINTER ELEMENT */
161 u8 ADATI[6]; /* ALT. DATE/TIME(YY MM DD HH MM SS) */
162 u8 REALM; /* Real filemode */
163 u8 FLAG2; /* F*3 - FST FLAG BYTE 2 FSTFLAG2 */
164 #define FSTPIPEU 0x10 /* Reserved for CMS PIPELINES usage */
165 u8 reserved[2];
168 #endif