libuboot.h revision 185099
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: head/sys/boot/uboot/lib/libuboot.h 185099 2008-11-19 17:34:28Z raj $
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;
38177108Sraj			int	partition;
39177108Sraj		} disk;
40177108Sraj	} d_kind;
41176348Smarcel};
42176348Smarcel
43185099Sraj#define d_disk d_kind.disk
44185099Sraj
45176348Smarcel/*
46176348Smarcel * Default network packet alignment in memory
47176348Smarcel */
48177152Sobrien#define	PKTALIGN	32
49176348Smarcel
50185099Srajint uboot_getdev(void **vdev, const char *devspec, const char **path);
51185099Srajchar *uboot_fmtdev(void *vdev);
52185099Srajint uboot_setcurrdev(struct env_var *ev, int flags, const void *value);
53176348Smarcel
54185099Srajextern int devs_no;
55177152Sobrienextern struct netif_driver uboot_net;
56185099Srajextern struct devsw uboot_storage;
57176348Smarcel
58176348Smarcelssize_t	uboot_copyin(const void *src, vm_offset_t dest, const size_t len);
59177152Sobrienssize_t	uboot_copyout(const vm_offset_t src, void *dest, const size_t len);
60177152Sobrienssize_t	uboot_readin(const int fd, vm_offset_t dest, const size_t len);
61176348Smarcelextern int uboot_autoload(void);
62176348Smarcel
63176348Smarcelstruct preloaded_file;
64176348Smarcelstruct file_format;
65176348Smarcel
66177152Sobrienextern struct file_format uboot_elf;
67176348Smarcel
68185099Srajvoid reboot(void);
69