1235154Savg/*-
2235154Savg * Copyright (c) 2012 Andriy Gapon <avg@FreeBSD.org>
3235154Savg * All rights reserved.
4235154Savg *
5235154Savg * Redistribution and use in source and binary forms are freely
6235154Savg * permitted provided that the above copyright notice and this
7235154Savg * paragraph and the following disclaimer are duplicated in all
8235154Savg * such forms.
9235154Savg *
10235154Savg * This software is provided "AS IS" and without any express or
11235154Savg * implied warranties, including, without limitation, the implied
12235154Savg * warranties of merchantability and fitness for a particular
13235154Savg * purpose.
14235154Savg *
15235154Savg * $FreeBSD$
16235154Savg */
17235154Savg
18235154Savg#ifndef _BOOT_I386_ARGS_H_
19235154Savg#define	_BOOT_I386_ARGS_H_
20235154Savg
21235154Savg#define	KARGS_FLAGS_CD		0x1
22235154Savg#define	KARGS_FLAGS_PXE		0x2
23235154Savg#define	KARGS_FLAGS_ZFS		0x4
24235154Savg#define	KARGS_FLAGS_EXTARG	0x8	/* variably sized extended argument */
25235154Savg
26235154Savg#define	BOOTARGS_SIZE	24	/* sizeof(struct bootargs) */
27235154Savg#define	BA_BOOTFLAGS	8	/* offsetof(struct bootargs, bootflags) */
28235154Savg#define	BA_BOOTINFO	20	/* offsetof(struct bootargs, bootinfo) */
29235154Savg#define	BI_SIZE		48	/* offsetof(struct bootinfo, bi_size) */
30235154Savg
31235154Savg/*
32235154Savg * We reserve some space above BTX allocated stack for the arguments
33235154Savg * and certain data that could hang off them.  Currently only struct bootinfo
34235154Savg * is supported in that category.  The bootinfo is placed at the top
35235154Savg * of the arguments area and the actual arguments are placed at ARGOFF offset
36235154Savg * from the top and grow towards the top.  Hopefully we have enough space
37235154Savg * for bootinfo and the arguments to not run into each other.
38235154Savg * Arguments area below ARGOFF is reserved for future use.
39235154Savg */
40235154Savg#define	ARGSPACE	0x1000	/* total size of the BTX args area */
41235154Savg#define	ARGOFF		0x800	/* actual args offset within the args area */
42235154Savg#define	ARGADJ		(ARGSPACE - ARGOFF)
43235154Savg
44235154Savg#ifndef __ASSEMBLER__
45235154Savg
46235154Savgstruct bootargs
47235154Savg{
48235154Savg	uint32_t			howto;
49235154Savg	uint32_t			bootdev;
50235154Savg	uint32_t			bootflags;
51235154Savg	union {
52235154Savg		struct {
53235154Savg			uint32_t	pxeinfo;
54235154Savg			uint32_t	reserved;
55235154Savg		};
56235154Savg		uint64_t		zfspool;
57235154Savg	};
58235154Savg	uint32_t			bootinfo;
59235154Savg
60235154Savg	/*
61235154Savg	 * If KARGS_FLAGS_EXTARG is set in bootflags, then the above fields
62235154Savg	 * are followed by a uint32_t field that specifies a size of the
63235154Savg	 * extended arguments (including the size field).
64235154Savg	 */
65235154Savg};
66235154Savg
67235154Savg#endif /*__ASSEMBLER__*/
68235154Savg
69235154Savg#endif	/* !_BOOT_I386_ARGS_H_ */
70