Index: head/stand/mips/beri/loader/main.c =================================================================== --- head/stand/mips/beri/loader/main.c (revision 359687) +++ head/stand/mips/beri/loader/main.c (revision 359688) @@ -1,247 +1,245 @@ /*- * Copyright (c) 2013-2014 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #ifdef LOADER_USB_SUPPORT #include #endif static int __elfN(exec)(struct preloaded_file *); static void extract_currdev(struct bootinfo *); struct devsw *devsw[] = { &beri_cfi_disk, &beri_sdcard_disk, #ifdef LOADER_USB_SUPPORT &umass_disk, #endif NULL }; -struct arch_switch archsw; - struct file_format *file_formats[] = { &beri_elf, NULL }; struct fs_ops *file_system[] = { #ifdef LOADER_UFS_SUPPORT &ufs_fsops, #endif NULL }; struct console *consoles[] = { &altera_jtag_uart_console, NULL }; extern uint8_t __bss_start, __bss_end; extern uint8_t __heap_start, __heap_end; static int __elfN(exec)(struct preloaded_file *fp) { return (EFTYPE); } /* * Capture arguments from boot2 for later reuse when launching the kernel. * Note that we choose not to maintain a pointer to boo2_bootinfop after * initial argument processing: this is because we might load the kernel over * the spot where boot2 was running, so we can't pass that pointer on to the * kernel. To be on the safe side, never reference it outside of the body of * main(), instead preserving a copy. */ int boot2_argc; char **boot2_argv; char **boot2_envv; struct bootinfo boot2_bootinfo; int main(int argc, char *argv[], char *envv[], struct bootinfo *bootinfop) { struct devsw **dp; /* NB: Must be sure to bzero() before using any globals. */ bzero(&__bss_start, &__bss_end - &__bss_start); boot2_argc = argc; boot2_argv = argv; boot2_envv = envv; boot2_bootinfo = *bootinfop; /* Copy rather than by reference. */ setheap(&__heap_start, &__heap_end); /* * Pick up console settings from boot2; probe console. */ if (bootinfop->bi_boot2opts & RB_MULTIPLE) { if (bootinfop->bi_boot2opts & RB_SERIAL) setenv("console", "comconsole vidconsole", 1); else setenv("console", "vidconsole comconsole", 1); } else if (bootinfop->bi_boot2opts & RB_SERIAL) setenv("console", "comconsole", 1); else if (bootinfop->bi_boot2opts & RB_MUTE) setenv("console", "nullconsole", 1); cons_probe(); setenv("LINES", "24", 1); printf("%s(%d, %p, %p, %p (%p))\n", __func__, argc, argv, envv, bootinfop, (void *)bootinfop->bi_memsize); /* * Initialise devices. */ for (dp = devsw; *dp != NULL; dp++) { if ((*dp)->dv_init != NULL) (*dp)->dv_init(); } extract_currdev(bootinfop); printf("\n%s", bootprog_info); #if 0 printf("bootpath=\"%s\"\n", bootpath); #endif interact(); return (0); } static void extract_currdev(struct bootinfo *bootinfop) { const char *bootdev; /* * Pick up boot device information from boot2. * * XXXRW: Someday: device units. */ switch(bootinfop->bi_boot_dev_type) { case BOOTINFO_DEV_TYPE_DRAM: bootdev = "dram0"; break; case BOOTINFO_DEV_TYPE_CFI: bootdev = "cfi0"; break; case BOOTINFO_DEV_TYPE_SDCARD: bootdev = "sdcard0"; break; default: bootdev = NULL; } if (bootdev != NULL) { env_setenv("currdev", EV_VOLATILE, bootdev, NULL, env_nounset); env_setenv("loaddev", EV_VOLATILE, bootdev, env_noset, env_nounset); } } void abort(void) { printf("error: loader abort\n"); while (1); __unreachable(); } void exit(int code) { printf("error: loader exit\n"); while (1); __unreachable(); } void longjmperror(void) { printf("error: loader longjmp error\n"); while (1); __unreachable(); } time_t time(time_t *tloc) { /* We can't provide time since UTC, so just provide time since boot. */ return (cp0_count_get() / 100000000); } /* * Delay - in usecs * * NOTE: We are assuming that the CPU is running at 100MHz. */ void delay(int usecs) { uint32_t delta; uint32_t curr; uint32_t last; last = cp0_count_get(); while (usecs > 0) { curr = cp0_count_get(); delta = curr - last; while (usecs > 0 && delta >= 100) { usecs--; last += 100; delta -= 100; } } } Index: head/stand/powerpc/ofw/conf.c =================================================================== --- head/stand/powerpc/ofw/conf.c (revision 359687) +++ head/stand/powerpc/ofw/conf.c (revision 359688) @@ -1,125 +1,125 @@ /*- * Copyright (c) 1999 Michael Smith * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include "bootstrap.h" #include "libofw.h" #include "openfirm.h" #if defined(LOADER_NET_SUPPORT) #include "dev_net.h" #endif /* Make sure we have an explicit reference to exit so libsa's panic pulls in the MD exit */ void (*exitfn)(int) = exit; /* * We could use linker sets for some or all of these, but * then we would have to control what ended up linked into * the bootstrap. So it's easier to conditionalise things * here. * * XXX rename these arrays to be consistent and less namespace-hostile */ /* Exported for libstand */ struct devsw *devsw[] = { #if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT) &ofwdisk, #endif #if defined(LOADER_NET_SUPPORT) &netdev, #endif NULL }; struct fs_ops *file_system[] = { #if defined(LOADER_UFS_SUPPORT) &ufs_fsops, #endif #if defined(LOADER_CD9660_SUPPORT) &cd9660_fsops, #endif #if defined(LOADER_EXT2FS_SUPPORT) &ext2fs_fsops, #endif #if defined(LOADER_NFS_SUPPORT) &nfs_fsops, #endif #if defined(LOADER_TFTP_SUPPORT) &tftp_fsops, #endif #if defined(LOADER_GZIP_SUPPORT) &gzipfs_fsops, #endif #if defined(LOADER_BZIP2_SUPPORT) &bzipfs_fsops, #endif NULL }; struct netif_driver *netif_drivers[] = { #if defined(LOADER_NET_SUPPORT) &ofwnet, #endif NULL, }; /* Exported for PowerPC only */ /* * Sort formats so that those that can detect based on arguments * rather than reading the file go first. */ -struct file_format ofw_elf; -struct file_format ofw_elf64; +extern struct file_format ofw_elf; +extern struct file_format ofw_elf64; struct file_format *file_formats[] = { &ofw_elf, &ofw_elf64, NULL }; /* * Consoles * * We don't prototype these in libofw.h because they require * data structures from bootstrap.h as well. */ extern struct console ofwconsole; struct console *consoles[] = { &ofwconsole, NULL }; /* * reloc - our load address */ vm_offset_t reloc = RELOC; Index: head/stand/uboot/lib/glue.h =================================================================== --- head/stand/uboot/lib/glue.h (revision 359687) +++ head/stand/uboot/lib/glue.h (revision 359688) @@ -1,107 +1,107 @@ /*- * Copyright (c) 2008 Semihalf, Rafal Jaworowski * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ /* * This is the header file for conveniency wrapper routines (API glue) */ #ifndef _API_GLUE_H_ #define _API_GLUE_H_ #include "api_public.h" /* * Mask used to align the start address for API signature search to 1MiB */ #define API_SIG_SEARCH_MASK ~0x000fffff #ifdef __mips__ /* * On MIPS, U-Boot passes us a hint address, which is very close to the end of * RAM (less than 1MiB), so searching for the API signature within more than * that leads to exception. */ #define API_SIG_SEARCH_LEN 0x00100000 #else /* * Search for the API signature within 3MiB of the 1MiB-aligned address that * U-Boot has hinted us. */ #define API_SIG_SEARCH_LEN 0x00300000 #endif int syscall(int, int *, ...); -void *syscall_ptr; +extern void *syscall_ptr; int api_parse_cmdline_sig(int argc, char **argv, struct api_signature **sig); int api_search_sig(struct api_signature **sig); #define UB_MAX_MR 16 /* max mem regions number */ #define UB_MAX_DEV 6 /* max devices number */ /* * The ub_ library calls are part of the application, not U-Boot code! They * are front-end wrappers that are used by the consumer application: they * prepare arguments for particular syscall and jump to the low level * syscall() */ /* console */ int ub_getc(void); int ub_tstc(void); void ub_putc(char); void ub_puts(const char *); /* system */ void ub_reset(void) __dead2; struct sys_info *ub_get_sys_info(void); /* time */ void ub_udelay(unsigned long); unsigned long ub_get_timer(unsigned long); /* env vars */ char *ub_env_get(const char *); void ub_env_set(const char *, char *); const char *ub_env_enum(const char *); /* devices */ int ub_dev_enum(void); int ub_dev_open(int); int ub_dev_close(int); int ub_dev_read(int, void *, lbasize_t, lbastart_t, lbasize_t *); int ub_dev_send(int, void *, int); int ub_dev_recv(int, void *, int, int *); struct device_info *ub_dev_get(int); void ub_dump_di(int); void ub_dump_si(struct sys_info *); char *ub_mem_type(int); char *ub_stor_type(int); #endif /* _API_GLUE_H_ */