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$ 26 */ 27 28 #include "openfirm.h" 29 #include <readin.h> 30 31 #define DEVT_OFDISK 1001 32 33 struct ofw_devdesc { 34 struct devdesc dd; 35 union { 36 struct { 37 ihandle_t d_handle; 38 char d_path[256]; 39 }; 40 struct { 41 uint64_t pool_guid; 42 uint64_t root_guid; 43 }; 44 }; 45 }; 46 47 extern int ofw_getdev(void **vdev, const char *devspec, const char **path); 48 49 extern struct devsw ofwdisk; 50 extern struct devsw ofw_netdev; 51 extern struct netif_driver ofwnet; 52 53 int ofwn_getunit(const char *); 54 55 ssize_t ofw_copyin(const void *src, vm_offset_t dest, const size_t len); 56 ssize_t ofw_copyout(const vm_offset_t src, void *dest, const size_t len); 57 ssize_t ofw_readin(readin_handle_t fd, vm_offset_t dest, const size_t len); 58 59 extern int ofw_boot(void); 60 extern int ofw_autoload(void); 61 62 void ofw_memmap(int); 63 64 phandle_t ofw_path_to_handle(const char *ofwpath, const char *want_type, const char **path); 65 int ofw_common_parsedev(struct devdesc **dev, const char *devspec, const char **path, 66 const char *ofwtype); 67 68 struct preloaded_file; 69 struct file_format; 70 71 extern void reboot(void); 72 73 struct ofw_reg 74 { 75 cell_t base; 76 cell_t size; 77 }; 78 79 struct ofw_reg2 80 { 81 cell_t base_hi; 82 cell_t base_lo; 83 cell_t size; 84 }; 85 86 extern int (*openfirmware)(void *); 87