1139738Simp/*-
267204Sobrien * Copyright (C) 2000 Benno Rice.
367204Sobrien * All rights reserved.
467204Sobrien *
567204Sobrien * Redistribution and use in source and binary forms, with or without
667204Sobrien * modification, are permitted provided that the following conditions
767204Sobrien * are met:
867204Sobrien * 1. Redistributions of source code must retain the above copyright
967204Sobrien *    notice, this list of conditions and the following disclaimer.
1067204Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1167204Sobrien *    notice, this list of conditions and the following disclaimer in the
1267204Sobrien *    documentation and/or other materials provided with the distribution.
1367204Sobrien *
1467204Sobrien * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
1567204Sobrien * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1667204Sobrien * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1767204Sobrien * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1867204Sobrien * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
1967204Sobrien * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
2067204Sobrien * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
2167204Sobrien * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
2267204Sobrien * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
2367204Sobrien * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2467204Sobrien *
2567204Sobrien * $FreeBSD$
2667204Sobrien */
2767204Sobrien
2884969Srobert#include "openfirm.h"
2984969Srobert
3067204Sobrien/* Note: Must match the 'struct devdesc' in bootstrap.h */
3167204Sobrienstruct ofw_devdesc {
3267204Sobrien	struct devsw	*d_dev;
3367204Sobrien	int		d_type;
34163897Smarcel	int		d_unit;
35151507Smarius	ihandle_t	d_handle;
36237766Savg	union {
37237766Savg		char			d_path[256];
38237766Savg		struct {
39237766Savg			uint64_t	pool_guid;
40237766Savg			uint64_t	root_guid;
41237766Savg		};
42237766Savg	};
4367204Sobrien};
4467204Sobrien
4567204Sobrienextern int	ofw_getdev(void **vdev, const char *devspec, const char **path);
46123703Sgrehanextern ev_sethook_t ofw_setcurrdev;
4767204Sobrien
4868548Sbennoextern struct devsw		ofwdisk;
4968548Sbennoextern struct netif_driver	ofwnet;
5067204Sobrien
5168548Sbennoint	ofwn_getunit(const char *);
5268548Sbenno
5367204Sobrienssize_t	ofw_copyin(const void *src, vm_offset_t dest, const size_t len);
5467204Sobrienssize_t ofw_copyout(const vm_offset_t src, void *dest, const size_t len);
5567204Sobrienssize_t ofw_readin(const int fd, vm_offset_t dest, const size_t len);
5667204Sobrien
5767204Sobrienextern int	ofw_boot(void);
5867204Sobrienextern int	ofw_autoload(void);
5967204Sobrien
60132996Sgrehanvoid	ofw_memmap(int);
6184617Sbennovoid	*ofw_alloc_heap(unsigned int);
6284617Sbennovoid	ofw_release_heap(void);
6384617Sbenno
6484617Sbennostruct preloaded_file;
6584617Sbennostruct file_format;
6684617Sbenno
6784617Sbennoint	ofw_elf_loadfile(char *, vm_offset_t, struct preloaded_file **);
6884617Sbennoint	ofw_elf_exec(struct preloaded_file *);
6984617Sbenno
7084617Sbennoextern struct file_format	ofw_elf;
71209920Snwhitehorn#ifdef __powerpc__
72209920Snwhitehornextern struct file_format	ofw_elf64;
73209920Snwhitehorn#endif
7484617Sbenno
7567204Sobrienextern void	reboot(void);
7667204Sobrien
7784617Sbennostruct ofw_reg
7884617Sbenno{
7984975Srobert	cell_t		base;
8084975Srobert	cell_t		size;
8184617Sbenno};
82106738Sjake
83132996Sgrehanstruct ofw_reg2
84132996Sgrehan{
85132996Sgrehan	cell_t		base_hi;
86132996Sgrehan	cell_t		base_lo;
87132996Sgrehan	cell_t		size;
88132996Sgrehan};
89132996Sgrehan
90106738Sjakeextern int (*openfirmware)(void *);
91