xref: /freebsd/stand/i386/common/bootargs.h (revision d3d381b2b194b4d24853e92eecef55f262688d1a)
1 /*-
2  * Copyright (c) 2012 Andriy Gapon <avg@FreeBSD.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are freely
6  * permitted provided that the above copyright notice and this
7  * paragraph and the following disclaimer are duplicated in all
8  * such forms.
9  *
10  * This software is provided "AS IS" and without any express or
11  * implied warranties, including, without limitation, the implied
12  * warranties of merchantability and fitness for a particular
13  * purpose.
14  *
15  * $FreeBSD$
16  */
17 
18 #ifndef _BOOT_I386_ARGS_H_
19 #define	_BOOT_I386_ARGS_H_
20 
21 #define	KARGS_FLAGS_CD		0x1
22 #define	KARGS_FLAGS_PXE		0x2
23 #define	KARGS_FLAGS_ZFS		0x4
24 #define	KARGS_FLAGS_EXTARG	0x8	/* variably sized extended argument */
25 
26 #define	BOOTARGS_SIZE	24	/* sizeof(struct bootargs) */
27 #define	BA_BOOTFLAGS	8	/* offsetof(struct bootargs, bootflags) */
28 #define	BA_BOOTINFO	20	/* offsetof(struct bootargs, bootinfo) */
29 #define	BI_SIZE		48	/* offsetof(struct bootinfo, bi_size) */
30 
31 /*
32  * We reserve some space above BTX allocated stack for the arguments
33  * and certain data that could hang off them.  Currently only struct bootinfo
34  * is supported in that category.  The bootinfo is placed at the top
35  * of the arguments area and the actual arguments are placed at ARGOFF offset
36  * from the top and grow towards the top.  Hopefully we have enough space
37  * for bootinfo and the arguments to not run into each other.
38  * Arguments area below ARGOFF is reserved for future use.
39  */
40 #define	ARGSPACE	0x1000	/* total size of the BTX args area */
41 #define	ARGOFF		0x800	/* actual args offset within the args area */
42 #define	ARGADJ		(ARGSPACE - ARGOFF)
43 
44 #ifndef __ASSEMBLER__
45 
46 struct bootargs
47 {
48 	uint32_t			howto;
49 	uint32_t			bootdev;
50 	uint32_t			bootflags;
51 	union {
52 		struct {
53 			uint32_t	pxeinfo;
54 			uint32_t	reserved;
55 		};
56 		uint64_t		zfspool;
57 	};
58 	uint32_t			bootinfo;
59 
60 	/*
61 	 * If KARGS_FLAGS_EXTARG is set in bootflags, then the above fields
62 	 * are followed by a uint32_t field that specifies a size of the
63 	 * extended arguments (including the size field).
64 	 */
65 };
66 
67 #ifdef LOADER_GELI_SUPPORT
68 #include <crypto/intake.h>
69 #endif
70 
71 struct geli_boot_args
72 {
73     uint32_t		size;
74     union {
75         char            gelipw[256];
76         struct {
77             char                notapw;	/*
78 					 * single null byte to stop keybuf
79 					 * being interpreted as a password
80 					 */
81             uint32_t            keybuf_sentinel;
82 #ifdef LOADER_GELI_SUPPORT
83             struct keybuf       *keybuf;
84 #else
85             void                *keybuf;
86 #endif
87         };
88     };
89 };
90 
91 #endif /*__ASSEMBLER__*/
92 
93 #endif	/* !_BOOT_I386_ARGS_H_ */
94