1176348Smarcel/*-
2176348Smarcel * Copyright (C) 2000 Benno Rice.
3176348Smarcel * Copyright (C) 2007 Semihalf, Rafal Jaworowski <raj@semihalf.com>
4176348Smarcel * All rights reserved.
5176348Smarcel *
6176348Smarcel * Redistribution and use in source and binary forms, with or without
7176348Smarcel * modification, are permitted provided that the following conditions
8176348Smarcel * are met:
9176348Smarcel * 1. Redistributions of source code must retain the above copyright
10176348Smarcel *    notice, this list of conditions and the following disclaimer.
11176348Smarcel * 2. Redistributions in binary form must reproduce the above copyright
12176348Smarcel *    notice, this list of conditions and the following disclaimer in the
13176348Smarcel *    documentation and/or other materials provided with the distribution.
14176348Smarcel *
15176348Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16176348Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17176348Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18176348Smarcel * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19176348Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20176348Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21176348Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22176348Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23176348Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24176348Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25176348Smarcel * SUCH DAMAGE.
26176348Smarcel *
27176348Smarcel * $FreeBSD$
28176348Smarcel */
29176348Smarcel
30176348Smarcelstruct uboot_devdesc
31176348Smarcel{
32177108Sraj	struct devsw	*d_dev;
33177108Sraj	int		d_type;
34177108Sraj	int		d_unit;
35177108Sraj	union {
36177108Sraj		struct {
37177108Sraj			void	*data;
38240272Sae			int	slice;
39240272Sae			int	partition;
40240272Sae			off_t	offset;
41177108Sraj		} disk;
42177108Sraj	} d_kind;
43176348Smarcel};
44176348Smarcel
45185099Sraj#define d_disk d_kind.disk
46185099Sraj
47176348Smarcel/*
48176348Smarcel * Default network packet alignment in memory
49176348Smarcel */
50177152Sobrien#define	PKTALIGN	32
51176348Smarcel
52185099Srajint uboot_getdev(void **vdev, const char *devspec, const char **path);
53185099Srajchar *uboot_fmtdev(void *vdev);
54185099Srajint uboot_setcurrdev(struct env_var *ev, int flags, const void *value);
55176348Smarcel
56185099Srajextern int devs_no;
57177152Sobrienextern struct netif_driver uboot_net;
58185099Srajextern struct devsw uboot_storage;
59176348Smarcel
60235694Skientzlevoid *uboot_vm_translate(vm_offset_t);
61176348Smarcelssize_t	uboot_copyin(const void *src, vm_offset_t dest, const size_t len);
62177152Sobrienssize_t	uboot_copyout(const vm_offset_t src, void *dest, const size_t len);
63177152Sobrienssize_t	uboot_readin(const int fd, vm_offset_t dest, const size_t len);
64176348Smarcelextern int uboot_autoload(void);
65176348Smarcel
66176348Smarcelstruct preloaded_file;
67176348Smarcelstruct file_format;
68176348Smarcel
69177152Sobrienextern struct file_format uboot_elf;
70176348Smarcel
71185099Srajvoid reboot(void);
72