libofw.h revision 84617
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: head/sys/boot/ofw/libofw/libofw.h 84617 2001-10-07 13:22:25Z benno $ 26 */ 27 28/* Note: Must match the 'struct devdesc' in bootstrap.h */ 29struct ofw_devdesc { 30 struct devsw *d_dev; 31 int d_type; 32 union { 33 struct { 34 int unit; 35 char path[64]; 36 int partition; 37 int slice; 38 int bsize; 39 } ofwdisk; 40 struct { 41 int unit; 42 char path[64]; 43 void *dmabuf; 44 } netif; 45 } d_kind; 46/* 47 * Keeping this around so I know what came from the NetBSD stuff. 48 * I've made a wild guess as to what goes where, but I have no idea if it's 49 * right. 50 * 51 * u_long partoff; 52 * int bsize; 53 * void *dmabuf; 54 */ 55}; 56 57#define MAXDEV 31 /* Maximum number of devices. */ 58 59/* Known types. Use the same as alpha for consistancy. */ 60#define DEVT_NONE 0 61#define DEVT_DISK 1 62#define DEVT_NET 2 63 64extern int ofw_getdev(void **vdev, const char *devspec, const char **path); 65extern char *ofw_fmtdev(void *vdev); 66extern int ofw_setcurrdev(struct env_var *ev, int flags, void *value); 67 68extern struct devsw ofwdisk; 69extern struct netif_driver ofwnet; 70 71int ofwd_getunit(const char *); 72int ofwn_getunit(const char *); 73 74ssize_t ofw_copyin(const void *src, vm_offset_t dest, const size_t len); 75ssize_t ofw_copyout(const vm_offset_t src, void *dest, const size_t len); 76ssize_t ofw_readin(const int fd, vm_offset_t dest, const size_t len); 77 78void ofw_devsearch_init(void); 79int ofw_devsearch(const char *, char *); 80int ofw_devicetype(char *); 81 82extern int ofw_boot(void); 83extern int ofw_autoload(void); 84 85void ofw_memmap(void); 86void *ofw_alloc_heap(unsigned int); 87void ofw_release_heap(void); 88 89struct preloaded_file; 90struct file_format; 91 92int ofw_elf_loadfile(char *, vm_offset_t, struct preloaded_file **); 93int ofw_elf_exec(struct preloaded_file *); 94 95extern struct file_format ofw_elf; 96 97extern void reboot(void); 98 99extern int main(int (*openfirm)(void *)); 100 101struct ofw_reg 102{ 103 uint32_t base; 104 uint32_t size; 105}; 106