libuboot.h revision 263052
1205194Sdelphij/*- 2205194Sdelphij * Copyright (C) 2000 Benno Rice. 3205194Sdelphij * Copyright (C) 2007 Semihalf, Rafal Jaworowski <raj@semihalf.com> 4205194Sdelphij * All rights reserved. 5205194Sdelphij * 6205194Sdelphij * Redistribution and use in source and binary forms, with or without 7205194Sdelphij * modification, are permitted provided that the following conditions 8205194Sdelphij * are met: 9205194Sdelphij * 1. Redistributions of source code must retain the above copyright 10205194Sdelphij * notice, this list of conditions and the following disclaimer. 11205194Sdelphij * 2. Redistributions in binary form must reproduce the above copyright 12205194Sdelphij * notice, this list of conditions and the following disclaimer in the 13205194Sdelphij * documentation and/or other materials provided with the distribution. 14205194Sdelphij * 15205194Sdelphij * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16205194Sdelphij * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17205194Sdelphij * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18205194Sdelphij * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19205194Sdelphij * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20205194Sdelphij * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21205194Sdelphij * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22205194Sdelphij * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23205194Sdelphij * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24205194Sdelphij * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25205194Sdelphij * SUCH DAMAGE. 26205194Sdelphij * 27205194Sdelphij * $FreeBSD: head/sys/boot/uboot/lib/libuboot.h 263052 2014-03-11 22:02:49Z ian $ 28205194Sdelphij */ 29205194Sdelphij 30205194Sdelphijstruct uboot_devdesc 31205194Sdelphij{ 32205194Sdelphij struct devsw *d_dev; 33205194Sdelphij int d_type; 34205194Sdelphij int d_unit; 35205194Sdelphij void *d_opendata; 36205194Sdelphij union { 37205194Sdelphij struct { 38205194Sdelphij int slice; 39205194Sdelphij int partition; 40205194Sdelphij off_t offset; 41205194Sdelphij } disk; 42205194Sdelphij } d_kind; 43205194Sdelphij}; 44205194Sdelphij 45205194Sdelphij#define d_disk d_kind.disk 46205194Sdelphij 47205194Sdelphij/* 48205194Sdelphij * Default network packet alignment in memory 49205194Sdelphij */ 50205194Sdelphij#define PKTALIGN 32 51205194Sdelphij 52int uboot_getdev(void **vdev, const char *devspec, const char **path); 53char *uboot_fmtdev(void *vdev); 54int uboot_setcurrdev(struct env_var *ev, int flags, const void *value); 55 56extern int devs_no; 57extern struct netif_driver uboot_net; 58extern struct devsw uboot_storage; 59 60void *uboot_vm_translate(vm_offset_t); 61ssize_t uboot_copyin(const void *src, vm_offset_t dest, const size_t len); 62ssize_t uboot_copyout(const vm_offset_t src, void *dest, const size_t len); 63ssize_t uboot_readin(const int fd, vm_offset_t dest, const size_t len); 64extern int uboot_autoload(void); 65 66struct preloaded_file; 67struct file_format; 68 69extern struct file_format uboot_elf; 70 71void reboot(void); 72 73int uboot_diskgetunit(int type, int type_unit); 74 75#if defined(LOADER_FDT_SUPPORT) 76extern int fdt_setup_fdtp(); 77extern int fdt_copy(vm_offset_t); 78#endif 79 80