1ca987d46SWarner Losh /*- 2ca987d46SWarner Losh * Copyright (c) 2010 Rui Paulo <rpaulo@FreeBSD.org> 3ca987d46SWarner Losh * All rights reserved. 4ca987d46SWarner Losh * 5ca987d46SWarner Losh * Redistribution and use in source and binary forms, with or without 6ca987d46SWarner Losh * modification, are permitted provided that the following conditions 7ca987d46SWarner Losh * are met: 8ca987d46SWarner Losh * 9ca987d46SWarner Losh * 1. Redistributions of source code must retain the above copyright 10ca987d46SWarner Losh * notice, this list of conditions and the following disclaimer. 11ca987d46SWarner Losh * 2. Redistributions in binary form must reproduce the above copyright 12ca987d46SWarner Losh * notice, this list of conditions and the following disclaimer in the 13ca987d46SWarner Losh * documentation and/or other materials provided with the distribution. 14ca987d46SWarner Losh * 15ca987d46SWarner Losh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16ca987d46SWarner Losh * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17ca987d46SWarner Losh * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18ca987d46SWarner Losh * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19ca987d46SWarner Losh * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20ca987d46SWarner Losh * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21ca987d46SWarner Losh * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22ca987d46SWarner Losh * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23ca987d46SWarner Losh * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24ca987d46SWarner Losh * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25ca987d46SWarner Losh */ 26ca987d46SWarner Losh 27ca987d46SWarner Losh #include <sys/cdefs.h> 28ca987d46SWarner Losh __FBSDID("$FreeBSD$"); 29ca987d46SWarner Losh 30*35437b1fSKyle Evans #if defined(LOADER_FDT_SUPPORT) 31*35437b1fSKyle Evans #include <sys/param.h> 32*35437b1fSKyle Evans #include <fdt_platform.h> 33*35437b1fSKyle Evans #endif 34*35437b1fSKyle Evans 35ca987d46SWarner Losh #include "loader_efi.h" 36ca987d46SWarner Losh 37ca987d46SWarner Losh int 38ca987d46SWarner Losh efi_autoload(void) 39ca987d46SWarner Losh { 40ca987d46SWarner Losh 41*35437b1fSKyle Evans #if defined(LOADER_FDT_SUPPORT) 42*35437b1fSKyle Evans /* 43*35437b1fSKyle Evans * Setup the FDT early so that we're not loading files during bi_load. 44*35437b1fSKyle Evans * Any such loading is inherently broken since bi_load uses the space 45*35437b1fSKyle Evans * just after all currently loaded files for the data that will be 46*35437b1fSKyle Evans * passed to the kernel and newly loaded files will be positioned in 47*35437b1fSKyle Evans * that same space. 48*35437b1fSKyle Evans * 49*35437b1fSKyle Evans * We're glossing over errors here because LOADER_FDT_SUPPORT does not 50*35437b1fSKyle Evans * imply that we're on a platform where FDT is a requirement. If we 51*35437b1fSKyle Evans * fix this, then the error handling here should be fixed accordingly. 52*35437b1fSKyle Evans */ 53*35437b1fSKyle Evans fdt_setup_fdtp(); 54*35437b1fSKyle Evans #endif 55ca987d46SWarner Losh return (0); 56ca987d46SWarner Losh } 57