libuboot.h revision 176348
138494Sobrien/*- 2174294Sobrien * Copyright (C) 2000 Benno Rice. 338494Sobrien * Copyright (C) 2007 Semihalf, Rafal Jaworowski <raj@semihalf.com> 438494Sobrien * All rights reserved. 538494Sobrien * 638494Sobrien * Redistribution and use in source and binary forms, with or without 738494Sobrien * modification, are permitted provided that the following conditions 838494Sobrien * are met: 938494Sobrien * 1. Redistributions of source code must retain the above copyright 1038494Sobrien * notice, this list of conditions and the following disclaimer. 1138494Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1238494Sobrien * notice, this list of conditions and the following disclaimer in the 1338494Sobrien * documentation and/or other materials provided with the distribution. 1438494Sobrien * 1538494Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1638494Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1738494Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1838494Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1938494Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2042629Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2138494Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2238494Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2338494Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2438494Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2538494Sobrien * SUCH DAMAGE. 2638494Sobrien * 2738494Sobrien * $FreeBSD: head/sys/boot/uboot/lib/libuboot.h 176348 2008-02-16 22:13:11Z marcel $ 2838494Sobrien */ 2938494Sobrien 3038494Sobrien/* 3138494Sobrien * Fully-qualified device descriptor. 3238494Sobrien * Note, this must match the 'struct devdesc' declaration 3338494Sobrien * in bootstrap.h. 3438494Sobrien */ 3538494Sobrienstruct uboot_devdesc 3638494Sobrien{ 3738494Sobrien struct devsw *d_dev; 3838494Sobrien int d_type; 3938494Sobrien int d_unit; 40174294Sobrien union 4138494Sobrien { 4238494Sobrien struct 4338494Sobrien { 4438494Sobrien void *data; 4538494Sobrien int slice; 4638494Sobrien int partition; 4738494Sobrien } disk; 4838494Sobrien } d_kind; 4938494Sobrien}; 5038494Sobrien 5138494Sobrien/* 5238494Sobrien * Default network packet alignment in memory 5338494Sobrien */ 5438494Sobrien#define PKTALIGN 32 5538494Sobrien 5638494Sobrienextern int uboot_getdev(void **vdev, const char *devspec, const char **path); 5738494Sobrienextern char *uboot_fmtdev(void *vdev); 5838494Sobrienextern int uboot_setcurrdev(struct env_var *ev, int flags, const void *value); 5938494Sobrien 6038494Sobrienextern struct netif_driver uboot_net; 6138494Sobrienextern struct devsw uboot_disk; 6238494Sobrien 6338494Sobrienssize_t uboot_copyin(const void *src, vm_offset_t dest, const size_t len); 6438494Sobrienssize_t uboot_copyout(const vm_offset_t src, void *dest, const size_t len); 6538494Sobrienssize_t uboot_readin(const int fd, vm_offset_t dest, const size_t len); 6638494Sobrien 6738494Sobrienextern int uboot_autoload(void); 6838494Sobrien 6938494Sobrienstruct preloaded_file; 7038494Sobrienstruct file_format; 7138494Sobrien 7238494Sobrienextern struct file_format uboot_elf; 73174294Sobrien 7438494Sobrienextern void reboot(void); 7538494Sobrien