xref: /illumos-gate/usr/src/boot/i386/common/bootargs.h (revision 22028508fd28d36ff74dc02c5774a8ba1f0db045)
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 
16 #ifndef _BOOT_I386_ARGS_H_
17 #define	_BOOT_I386_ARGS_H_
18 
19 #define	KARGS_FLAGS_CD		0x1
20 #define	KARGS_FLAGS_PXE		0x2
21 #define	KARGS_FLAGS_ZFS		0x4
22 #define	KARGS_FLAGS_EXTARG	0x8	/* variably sized extended argument */
23 
24 #define	BOOTARGS_SIZE	24	/* sizeof(struct bootargs) */
25 #define	BA_BOOTFLAGS	8	/* offsetof(struct bootargs, bootflags) */
26 #define	BA_BOOTINFO	20	/* offsetof(struct bootargs, bootinfo) */
27 #define	BI_SIZE		48	/* offsetof(struct bootinfo, bi_size) */
28 
29 /*
30  * We reserve some space above BTX allocated stack for the arguments
31  * and certain data that could hang off them.  Currently only struct bootinfo
32  * is supported in that category.  The bootinfo is placed at the top
33  * of the arguments area and the actual arguments are placed at ARGOFF offset
34  * from the top and grow towards the top.  Hopefully we have enough space
35  * for bootinfo and the arguments to not run into each other.
36  * Arguments area below ARGOFF is reserved for future use.
37  */
38 #define	ARGSPACE	0x1000	/* total size of the BTX args area */
39 #define	ARGOFF		0x800	/* actual args offset within the args area */
40 #define	ARGADJ		(ARGSPACE - ARGOFF)
41 
42 #ifndef __ASSEMBLER__
43 
44 struct bootargs {
45 	uint32_t			howto;
46 	uint32_t			bootdev;
47 	uint32_t			bootflags;
48 	union {
49 		struct {
50 			uint32_t	pxeinfo;
51 			uint32_t	reserved;
52 		};
53 		uint64_t		zfspool;
54 	};
55 	uint32_t			bootinfo;
56 
57 	/*
58 	 * If KARGS_FLAGS_EXTARG is set in bootflags, then the above fields
59 	 * are followed by a uint32_t field that specifies a size of the
60 	 * extended arguments (including the size field).
61 	 */
62 };
63 
64 struct zfs_boot_args {
65 	uint32_t		size;
66 	uint32_t		reserved;
67 	uint64_t		pool;
68 	uint64_t		root;
69 	uint64_t		primary_pool;
70 	uint64_t		primary_vdev;
71 };
72 
73 #endif /* __ASSEMBLER__ */
74 
75 #endif	/* !_BOOT_I386_ARGS_H_ */
76