199767f8919635c4928607450d9e0abb932109ceToomas Soome/*-
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 2012 Andriy Gapon <avg@FreeBSD.org>
199767f8919635c4928607450d9e0abb932109ceToomas Soome * All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms are freely
199767f8919635c4928607450d9e0abb932109ceToomas Soome * permitted provided that the above copyright notice and this
199767f8919635c4928607450d9e0abb932109ceToomas Soome * paragraph and the following disclaimer are duplicated in all
199767f8919635c4928607450d9e0abb932109ceToomas Soome * such forms.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * This software is provided "AS IS" and without any express or
199767f8919635c4928607450d9e0abb932109ceToomas Soome * implied warranties, including, without limitation, the implied
199767f8919635c4928607450d9e0abb932109ceToomas Soome * warranties of merchantability and fitness for a particular
199767f8919635c4928607450d9e0abb932109ceToomas Soome * purpose.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * $FreeBSD$
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _BOOT_I386_ARGS_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _BOOT_I386_ARGS_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define KARGS_FLAGS_CD 0x1
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define KARGS_FLAGS_PXE 0x2
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define KARGS_FLAGS_ZFS 0x4
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define KARGS_FLAGS_EXTARG 0x8 /* variably sized extended argument */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define BOOTARGS_SIZE 24 /* sizeof(struct bootargs) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define BA_BOOTFLAGS 8 /* offsetof(struct bootargs, bootflags) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define BA_BOOTINFO 20 /* offsetof(struct bootargs, bootinfo) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define BI_SIZE 48 /* offsetof(struct bootinfo, bi_size) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * We reserve some space above BTX allocated stack for the arguments
199767f8919635c4928607450d9e0abb932109ceToomas Soome * and certain data that could hang off them. Currently only struct bootinfo
199767f8919635c4928607450d9e0abb932109ceToomas Soome * is supported in that category. The bootinfo is placed at the top
199767f8919635c4928607450d9e0abb932109ceToomas Soome * of the arguments area and the actual arguments are placed at ARGOFF offset
199767f8919635c4928607450d9e0abb932109ceToomas Soome * from the top and grow towards the top. Hopefully we have enough space
199767f8919635c4928607450d9e0abb932109ceToomas Soome * for bootinfo and the arguments to not run into each other.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Arguments area below ARGOFF is reserved for future use.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define ARGSPACE 0x1000 /* total size of the BTX args area */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define ARGOFF 0x800 /* actual args offset within the args area */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define ARGADJ (ARGSPACE - ARGOFF)
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef __ASSEMBLER__
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct bootargs
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t howto;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t bootdev;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t bootflags;
199767f8919635c4928607450d9e0abb932109ceToomas Soome union {
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct {
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t pxeinfo;
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t reserved;
199767f8919635c4928607450d9e0abb932109ceToomas Soome };
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint64_t zfspool;
199767f8919635c4928607450d9e0abb932109ceToomas Soome };
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t bootinfo;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * If KARGS_FLAGS_EXTARG is set in bootflags, then the above fields
199767f8919635c4928607450d9e0abb932109ceToomas Soome * are followed by a uint32_t field that specifies a size of the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * extended arguments (including the size field).
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /*__ASSEMBLER__*/
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !_BOOT_I386_ARGS_H_ */