1*9dc70af8SWarner Losh /*- 2*9dc70af8SWarner Losh * Copyright (C) 2000 Benno Rice. 3*9dc70af8SWarner Losh * Copyright (C) 2007 Semihalf, Rafal Jaworowski <raj@semihalf.com> 4*9dc70af8SWarner Losh * All rights reserved. 5*9dc70af8SWarner Losh * 6*9dc70af8SWarner Losh * Redistribution and use in source and binary forms, with or without 7*9dc70af8SWarner Losh * modification, are permitted provided that the following conditions 8*9dc70af8SWarner Losh * are met: 9*9dc70af8SWarner Losh * 1. Redistributions of source code must retain the above copyright 10*9dc70af8SWarner Losh * notice, this list of conditions and the following disclaimer. 11*9dc70af8SWarner Losh * 2. Redistributions in binary form must reproduce the above copyright 12*9dc70af8SWarner Losh * notice, this list of conditions and the following disclaimer in the 13*9dc70af8SWarner Losh * documentation and/or other materials provided with the distribution. 14*9dc70af8SWarner Losh * 15*9dc70af8SWarner Losh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16*9dc70af8SWarner Losh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17*9dc70af8SWarner Losh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18*9dc70af8SWarner Losh * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19*9dc70af8SWarner Losh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20*9dc70af8SWarner Losh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21*9dc70af8SWarner Losh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22*9dc70af8SWarner Losh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23*9dc70af8SWarner Losh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24*9dc70af8SWarner Losh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25*9dc70af8SWarner Losh * SUCH DAMAGE. 26*9dc70af8SWarner Losh */ 27*9dc70af8SWarner Losh 28*9dc70af8SWarner Losh #include <disk.h> 29*9dc70af8SWarner Losh #include <readin.h> 30*9dc70af8SWarner Losh 31*9dc70af8SWarner Losh struct uboot_devdesc { 32*9dc70af8SWarner Losh union { 33*9dc70af8SWarner Losh struct devdesc dd; 34*9dc70af8SWarner Losh struct disk_devdesc d_disk; 35*9dc70af8SWarner Losh }; 36*9dc70af8SWarner Losh }; 37*9dc70af8SWarner Losh 38*9dc70af8SWarner Losh /* 39*9dc70af8SWarner Losh * Default network packet alignment in memory. On arm arches packets must be 40*9dc70af8SWarner Losh * aligned to cacheline boundaries. 41*9dc70af8SWarner Losh */ 42*9dc70af8SWarner Losh #if defined(__aarch64__) 43*9dc70af8SWarner Losh #define PKTALIGN 128 44*9dc70af8SWarner Losh #elif defined(__arm__) 45*9dc70af8SWarner Losh #define PKTALIGN 64 46*9dc70af8SWarner Losh #else 47*9dc70af8SWarner Losh #define PKTALIGN 32 48*9dc70af8SWarner Losh #endif 49*9dc70af8SWarner Losh 50*9dc70af8SWarner Losh int uboot_getdev(void **vdev, const char *devspec, const char **path); 51*9dc70af8SWarner Losh int uboot_setcurrdev(struct env_var *ev, int flags, const void *value); 52*9dc70af8SWarner Losh 53*9dc70af8SWarner Losh extern int devs_no; 54*9dc70af8SWarner Losh extern struct netif_driver uboot_net; 55*9dc70af8SWarner Losh extern struct devsw uboot_storage; 56*9dc70af8SWarner Losh 57*9dc70af8SWarner Losh extern uintptr_t uboot_heap_start; 58*9dc70af8SWarner Losh extern uintptr_t uboot_heap_end; 59*9dc70af8SWarner Losh 60*9dc70af8SWarner Losh ssize_t uboot_copyin(const void *src, vm_offset_t dest, const size_t len); 61*9dc70af8SWarner Losh ssize_t uboot_copyout(const vm_offset_t src, void *dest, const size_t len); 62*9dc70af8SWarner Losh ssize_t uboot_readin(readin_handle_t fd, vm_offset_t dest, const size_t len); 63*9dc70af8SWarner Losh extern int uboot_autoload(void); 64*9dc70af8SWarner Losh 65*9dc70af8SWarner Losh struct preloaded_file; 66*9dc70af8SWarner Losh struct file_format; 67*9dc70af8SWarner Losh 68*9dc70af8SWarner Losh extern struct file_format uboot_elf; 69*9dc70af8SWarner Losh 70*9dc70af8SWarner Losh void reboot(void); 71*9dc70af8SWarner Losh 72*9dc70af8SWarner Losh int uboot_diskgetunit(int type, int type_unit); 73*9dc70af8SWarner Losh 74