[go: up one dir, main page]

File: boot.h

package info (click to toggle)
s390-tools 1.16.0-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 4,332 kB
  • sloc: ansic: 46,620; sh: 8,560; cpp: 8,185; asm: 5,503; perl: 3,014; makefile: 886
file content (188 lines) | stat: -rw-r--r-- 4,658 bytes parent folder | download
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
/*
 * s390-tools/zipl/include/boot.h
 *   Functions to handle the boot loader data.
 *
 * Copyright IBM Corp. 2001, 2006.
 *
 * Author(s): Carsten Otte <cotte@de.ibm.com>
 *            Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
 */

#ifndef BOOT_H
#define BOOT_H

#include "zipl.h"

#include <sys/types.h>

#include "disk.h"
#include "job.h"


/* Boot data structures for FBA disks */

struct boot_fba_locread {
	uint64_t locate;
	uint64_t read;
} __attribute__ ((packed));

struct boot_fba_locdata {
	uint8_t command;
	uint8_t dummy;
	uint16_t blockct;
	uint32_t blocknr;
} __attribute__ ((packed));

struct boot_fba_stage0 {
	uint64_t PSW;
	uint64_t READ;
	uint64_t TIC;
	uint64_t param1;
	uint64_t param2;
	struct boot_fba_locread locread[16];
	struct boot_fba_locdata locdata[16];
} __attribute__ ((packed));


/* Boot data structures for ECKD disks */

struct boot_eckd_ccw0 {
	uint8_t cmd;
	uint8_t address_hi;
	uint16_t address_lo;
	uint8_t flags;
	uint8_t pad;
	uint16_t count;
} __attribute__ ((packed));

struct boot_eckd_ccw1 {
	uint8_t cmd;
	uint8_t flags;
	uint16_t count;
	uint32_t address;
} __attribute__ ((packed));

struct boot_eckd_ssrt {
	struct boot_eckd_ccw0 seek;
	struct boot_eckd_ccw0 search;
	struct boot_eckd_ccw0 tic;
	struct boot_eckd_ccw0 read;
} __attribute__ ((packed));

struct boot_eckd_seekarg {
	uint16_t pad;
	uint16_t cyl;
	uint16_t head;
	uint8_t sec;
	uint8_t pad2;
} __attribute__ ((packed));

struct boot_eckd_stage0 {
	uint64_t psw;
	struct boot_eckd_ccw0 read;
	struct boot_eckd_ccw0 tic;
} __attribute__ ((packed));

struct boot_eckd_classic_stage1 {
	uint64_t param1;
	uint64_t param2;
	struct boot_eckd_ssrt ssrt[8];
	struct boot_eckd_seekarg seek[8];
} __attribute__ ((packed));

struct boot_eckd_compatible_stage1 {
	uint64_t param1;
	uint64_t param2;
	struct boot_eckd_ccw0 seek;
	struct boot_eckd_ccw0 search;
	struct boot_eckd_ccw0 tic;
	struct boot_eckd_ccw0 read[12];
	struct boot_eckd_seekarg seekarg;
} __attribute__ ((packed));


/* Stage 2 boot menu parameter structure */

#define BOOT_MENU_ENTRIES		62

struct boot_stage2_params {
	uint16_t flag;
	uint16_t timeout;
	uint16_t banner;
	uint16_t config[BOOT_MENU_ENTRIES + 1];
};


/* Stage 3 bootloader parameter structure */

struct boot_stage3_params {
	uint64_t parm_addr;
	uint64_t initrd_addr;
	uint64_t initrd_len;
	uint64_t load_psw;
	uint64_t extra_parm;
};


/* Tape IPL bootloader parameter structure */

#define BOOT_TAPE_IPL_PARAMS_OFFSET	0x100

struct boot_tape_ipl_params {
	uint64_t parm_addr;
	uint64_t initrd_addr;
	uint64_t load_psw;
};

/* Partition parameter table for multi-volume dump */

struct mvdump_param {
	uint16_t	devno;
	uint32_t	start_blk;
	uint32_t	end_blk;
	uint8_t		blocksize;
	uint8_t		end_sec;
	uint8_t		num_heads;
} __attribute__ ((packed));

struct mvdump_parm_table {
	uint64_t	timestamp;
	uint16_t	num_param;
	struct mvdump_param param[MAX_DUMP_VOLUMES];
	unsigned char	reserved[512 - sizeof(uint64_t) - sizeof(uint16_t) -
		(MAX_DUMP_VOLUMES * sizeof(struct mvdump_param))];
} __attribute__ ((packed));


int boot_check_data(void);
int boot_init_fba_stage0(struct boot_fba_stage0* stage0,
			 disk_blockptr_t* stage2_list,
			 blocknum_t stage2_count);
int boot_get_fba_stage2(void** data, size_t* size, struct job_data* job);
void boot_init_eckd_classic_stage0(struct boot_eckd_stage0* stage0);
int boot_init_eckd_classic_stage1(struct boot_eckd_classic_stage1* stage1,
				  disk_blockptr_t* stage2_list,
				  blocknum_t stage2_count);
void boot_init_eckd_compatible_stage0(struct boot_eckd_stage0* stage0);
int boot_init_eckd_compatible_stage1(
			struct boot_eckd_compatible_stage1* stage1,
			struct disk_info* info);
int boot_get_eckd_stage2(void** data, size_t* size, struct job_data* job);
int boot_get_stage3(void** buffer, size_t* bytecount, address_t parm_addr,
		    address_t initrd_addr, size_t initrd_len,
		    address_t image_addr, int extra_parm);
int boot_get_tape_ipl(void** data, size_t* size, address_t parm_addr,
		      address_t initrd_addr, address_t image_addr);
int boot_get_tape_dump(void** data, size_t* size, uint64_t mem);
int boot_get_eckd_dump_stage2(void** data, size_t* size, uint64_t mem);
int boot_get_eckd_mvdump_stage2(void** data, size_t* size, uint64_t mem,
				uint8_t force, struct mvdump_parm_table);
int boot_init_eckd_classic_dump_stage1(struct boot_eckd_classic_stage1* stage1,
				       struct disk_info* info);
int boot_init_eckd_compatible_dump_stage1(
				struct boot_eckd_compatible_stage1* stage1,
				struct disk_info* info,
				int mvdump_switch);
int boot_get_fba_dump_stage2(void** data, size_t* size, uint64_t mem);

#endif /* BOOT_H */