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