151053Smsmith/*-
251053Smsmith * Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
351053Smsmith * All rights reserved.
451053Smsmith *
551053Smsmith * Redistribution and use in source and binary forms, with or without
651053Smsmith * modification, are permitted provided that the following conditions
751053Smsmith * are met:
851053Smsmith * 1. Redistributions of source code must retain the above copyright
951053Smsmith *    notice, this list of conditions and the following disclaimer.
1051053Smsmith * 2. Redistributions in binary form must reproduce the above copyright
1151053Smsmith *    notice, this list of conditions and the following disclaimer in the
1251053Smsmith *    documentation and/or other materials provided with the distribution.
1351053Smsmith *
1451053Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1551053Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1651053Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1751053Smsmith * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1851053Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1951053Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2051053Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2151053Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2251053Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2351053Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2451053Smsmith * SUCH DAMAGE.
2551053Smsmith */
2651053Smsmith
27124139Sobrien#include <sys/cdefs.h>
28124139Sobrien__FBSDID("$FreeBSD$");
29124139Sobrien
3051053Smsmith#include <stand.h>
3184617Sbenno#include "bootstrap.h"
3267227Sobrien#include "libofw.h"
3384617Sbenno#include "openfirm.h"
3467227Sobrien
3567227Sobrien#if defined(LOADER_NET_SUPPORT)
3651053Smsmith#include "dev_net.h"
3751053Smsmith#endif
3851053Smsmith
3951053Smsmith/*
4051053Smsmith * We could use linker sets for some or all of these, but
4151053Smsmith * then we would have to control what ended up linked into
4251053Smsmith * the bootstrap.  So it's easier to conditionalise things
4351053Smsmith * here.
4451053Smsmith *
4551053Smsmith * XXX rename these arrays to be consistent and less namespace-hostile
4651053Smsmith */
4751053Smsmith
4851053Smsmith/* Exported for libstand */
4951053Smsmithstruct devsw *devsw[] = {
50123376Sgrehan#if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT)
5167227Sobrien    &ofwdisk,
5251053Smsmith#endif
5367227Sobrien#if defined(LOADER_NET_SUPPORT)
5468548Sbenno    &netdev,
5551053Smsmith#endif
5651053Smsmith    NULL
5751053Smsmith};
5851053Smsmith
5951053Smsmithstruct fs_ops *file_system[] = {
60123376Sgrehan#if defined(LOADER_UFS_SUPPORT)
6151053Smsmith    &ufs_fsops,
6251053Smsmith#endif
63123376Sgrehan#if defined(LOADER_CD9660_SUPPORT)
6451053Smsmith    &cd9660_fsops,
6551053Smsmith#endif
66123376Sgrehan#if defined(LOADER_EXT2FS_SUPPORT)
6759767Sjlemon    &ext2fs_fsops,
6859767Sjlemon#endif
69176185Sraj#if defined(LOADER_NFS_SUPPORT)
7051053Smsmith    &nfs_fsops,
7151053Smsmith#endif
72123376Sgrehan#if defined(LOADER_TFTP_SUPPORT)
73123376Sgrehan    &tftp_fsops,
74123376Sgrehan#endif
75123376Sgrehan#if defined(LOADER_GZIP_SUPPORT)
76108100Sjake    &gzipfs_fsops,
77123376Sgrehan#endif
78123376Sgrehan#if defined(LOADER_BZIP2_SUPPORT)
79123376Sgrehan    &bzipfs_fsops,
80123376Sgrehan#endif
8151053Smsmith    NULL
8251053Smsmith};
8351053Smsmith
8467227Sobrienstruct netif_driver *netif_drivers[] = {
85123376Sgrehan#if defined(LOADER_NET_SUPPORT)
8668548Sbenno	&ofwnet,
8767227Sobrien#endif
8868548Sbenno	NULL,
8951053Smsmith};
9051053Smsmith
9167227Sobrien/* Exported for PowerPC only */
9251053Smsmith/*
9351053Smsmith * Sort formats so that those that can detect based on arguments
9451053Smsmith * rather than reading the file go first.
9551053Smsmith */
9651053Smsmith
9759854Sbpstruct file_format *file_formats[] = {
9884617Sbenno    &ofw_elf,
99209920Snwhitehorn    &ofw_elf64,
10051053Smsmith    NULL
10151053Smsmith};
10251053Smsmith
10351053Smsmith/*
10451053Smsmith * Consoles
10551053Smsmith *
106158467Sjhb * We don't prototype these in libofw.h because they require
10751053Smsmith * data structures from bootstrap.h as well.
10851053Smsmith */
10967227Sobrienextern struct console ofwconsole;
11051053Smsmith
11151053Smsmithstruct console *consoles[] = {
11267227Sobrien    &ofwconsole,
11351053Smsmith    NULL
11451053Smsmith};
11584617Sbenno
11684617Sbenno/*
11784617Sbenno * reloc - our load address
11884617Sbenno */
11984617Sbennovm_offset_t	reloc = RELOC;
120