/*-
* Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _BOOTSTRAP_H_
#define _BOOTSTRAP_H_
#include <sys/linker_set.h>
/* Commands and return values; nonzero return sets command_errmsg != NULL */
extern const char *command_errmsg;
extern char command_errbuf[COMMAND_ERRBUFSZ];
#define CMD_OK 0
/* interp.c */
int include(const char *filename);
/* interp_backslash.c */
/* interp_parse.c */
/* interp_forth.c */
/* boot.c */
void autoboot_maybe(void);
int getrootmount(char *rootdev);
/* misc.c */
/* bcache.c */
void bcache_add_dev(int);
void *bcache_allocate(void);
void bcache_free(void *);
/*
* Disk block cache
*/
struct bcache_devdata
{
void *dv_devdata;
void *dv_cache;
};
/*
* Modular console support.
*/
struct console
{
const char *c_name;
const char *c_desc;
int c_flags;
void *private; /* private data */
};
void cons_probe(void);
void cons_mode(int);
/*
* Plug-and-play enumerator/configurator interface.
*/
struct pnphandler
{
};
struct pnpident
{
};
struct pnpinfo
{
char **pi_argv;
};
extern struct pnpinfo_stql pnp_devices;
struct pnpinfo *pnp_allocinfo(void);
/*
* < 0 - No ISA in system
* == 0 - Maybe ISA, search for read data port
* > 0 - ISA in system, value is read data port address
*/
extern int isapnp_readport;
/*
* Preloaded file metadata header.
*
* Metadata are allocated on our heap, and copied into kernel space
* before executing the kernel.
*/
struct file_metadata
{
};
struct preloaded_file;
struct mod_depend;
struct kernel_module
{
};
/*
* Preloaded file information. Depending on type, file can contain
* additional units called 'modules'.
*
* At least one file (the kernel) must be loaded in order to boot.
* The kernel is always loaded first.
*
* String fields (m_name, m_type) should be dynamically allocated.
*/
struct preloaded_file
{
};
struct file_format
{
/* Load function must return EFTYPE if it can't handle the module supplied */
/* Only a loader that will load a kernel (first module) should have an exec handler */
};
extern struct preloaded_file *preloaded_files;
void unload(void);
struct preloaded_file *file_alloc(void);
struct kernel_module **newmp);
/* MI module loaders */
#ifdef __elfN
/* Relocation types. */
/* Relocation offset for some architectures */
struct elf_file;
struct preloaded_file **result);
#endif
/*
* Support for commands
*/
struct bootblk_command
{
const char *c_name;
const char *c_desc;
};
static bootblk_cmd_t func; \
/*
* The intention of the architecture switch is to provide a convenient
* encapsulation of the interface between the bootstrap MI and MD code.
* MD code may selectively populate the switch at runtime based on the
* actual configuration of the target system.
*/
struct arch_switch
{
/* Automatically load modules as required by detected hardware */
int (*arch_autoload)(void);
/* Locate the device for (name), return pointer to tail in (*path) */
/* Copy from local address space to module address space, similar to bcopy() */
/* Copy to local address space from module address space, similar to bcopy() */
/* Read from file to module address space, same semantics as read() */
/* Perform ISA byte port I/O (only for systems with ISA) */
/*
* Interface to adjust the load address according to the "object"
* being loaded.
*/
/*
* Interface to inform MD code about a loaded (ELF) segment. This
*/
#ifdef __elfN
#else
#endif
/* Probe ZFS pool(s), if needed. */
void (*arch_zfs_probe)(void);
};
extern struct arch_switch archsw;
/* This must be provided by the MD code, but should it be in the archsw? */
void dev_cleanup(void);
#ifndef CTASSERT /* Allow lint to override */
#endif
#endif /* !_BOOTSTRAP_H_ */