Merge from vendor branch OPENSSH:
[dragonfly.git] / sys / boot / ofw / libofw / libofw.h
1 /*
2  * Copyright (C) 2000 Benno Rice.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  * $FreeBSD: src/sys/boot/ofw/libofw/libofw.h,v 1.7 2002/11/10 19:17:36 jake Exp $
26  * $DragonFly: src/sys/boot/ofw/libofw/libofw.h,v 1.1 2003/11/10 06:08:37 dillon Exp $
27  */
28
29 #include "openfirm.h"
30
31 /* Note: Must match the 'struct devdesc' in bootstrap.h */
32 struct ofw_devdesc {
33         struct devsw    *d_dev;
34         int             d_type;
35         phandle_t       d_handle;
36         char            d_path[256];
37 };
38
39 extern int      ofw_getdev(void **vdev, const char *devspec, const char **path);
40 extern int      ofw_setcurrdev(struct env_var *ev, int flags, void *value);
41
42 extern struct devsw             ofwdisk;
43 extern struct netif_driver      ofwnet;
44
45 int     ofwn_getunit(const char *);
46
47 ssize_t ofw_copyin(const void *src, vm_offset_t dest, const size_t len);
48 ssize_t ofw_copyout(const vm_offset_t src, void *dest, const size_t len);
49 ssize_t ofw_readin(const int fd, vm_offset_t dest, const size_t len);
50
51 extern int      ofw_boot(void);
52 extern int      ofw_autoload(void);
53
54 void    ofw_memmap(void);
55 void    *ofw_alloc_heap(unsigned int);
56 void    ofw_release_heap(void);
57
58 struct preloaded_file;
59 struct file_format;
60
61 int     ofw_elf_loadfile(char *, vm_offset_t, struct preloaded_file **);
62 int     ofw_elf_exec(struct preloaded_file *);
63
64 extern struct file_format       ofw_elf;
65
66 extern void     reboot(void);
67
68 struct ofw_reg
69 {
70         cell_t          base;
71         cell_t          size;
72 };
73
74 extern int (*openfirmware)(void *);