1*261d2760SDarwin Rambo/* 2*261d2760SDarwin Rambo * Copyright 2014 Broadcom Corporation. 3*261d2760SDarwin Rambo * 4*261d2760SDarwin Rambo * SPDX-License-Identifier: GPL-2.0+ 5*261d2760SDarwin Rambo */ 6*261d2760SDarwin Rambo 7*261d2760SDarwin RamboSemihosting is ARM's way of having a real or virtual target communicate 8*261d2760SDarwin Rambowith a host or host debugger for basic operations such as file I/O, 9*261d2760SDarwin Ramboconsole I/O, etc. Please see 10*261d2760SDarwin Rambohttp://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0471c/Bgbjjgij.html for more information. 11*261d2760SDarwin Rambo 12*261d2760SDarwin RamboFor developing on armv8 virtual fastmodel platforms, semihosting is a 13*261d2760SDarwin Rambovaluable tool since it allows access to image/configuration files before 14*261d2760SDarwin RamboeMMC or other NV media are available. 15*261d2760SDarwin Rambo 16*261d2760SDarwin RamboThere are two main ARM virtual Fixed Virtual Platform (FVP) models, 17*261d2760SDarwin RamboVersatile Express (VE) FVP and BASE FVP (See 18*261d2760SDarwin Rambohttp://www.arm.com/products/tools/models/fast-models/foundation-model.php) 19*261d2760SDarwin RamboThe initial vexpress64 u-boot board created here runs on the VE virtual 20*261d2760SDarwin Ramboplatform using the license-free Foundation_v8 simulator. Fortunately, 21*261d2760SDarwin Rambothe Foundation_v8 simulator also supports the BASE_FVP model which 22*261d2760SDarwin Rambocompanies can purchase licenses for and contain much more functionality. 23*261d2760SDarwin RamboSo we can, in u-boot, run either model by either using the VE FVP (default), 24*261d2760SDarwin Ramboor turning on CONFIG_BASE_FVP for the more full featured model. 25*261d2760SDarwin Rambo 26*261d2760SDarwin RamboRather than create a new armv8 board similar to armltd/vexpress64, add 27*261d2760SDarwin Rambosemihosting calls to the existing one, enabled with CONFIG_SEMIHOSTING 28*261d2760SDarwin Ramboand CONFIG_BASE_FVP both set. Also reuse the existing board config file 29*261d2760SDarwin Rambovexpress_aemv8a.h but differentiate the two models by the presence or 30*261d2760SDarwin Ramboabsence of CONFIG_BASE_FVP. This change is tested and works on both the 31*261d2760SDarwin RamboFoundation and Base fastmodel simulators. 32*261d2760SDarwin Rambo 33*261d2760SDarwin RamboThe level of semihosting support is minimal, restricted to just what it 34*261d2760SDarwin Rambotakes to load images to memory. If more semihosting functionality is 35*261d2760SDarwin Ramborequired, such as file seek, outputting strings, reading characters, etc, 36*261d2760SDarwin Rambothen it can be easily added later. 37*261d2760SDarwin Rambo 38*261d2760SDarwin RamboWe require that the board include file define these env variables: 39*261d2760SDarwin Rambo- kernel_name e.g. "uImage" 40*261d2760SDarwin Rambo- kernel_addr_r e.g. "0x80000000" 41*261d2760SDarwin Rambo- initrd_name e.g. "ramdisk.img" 42*261d2760SDarwin Rambo- initrd_addr_r e.g. "0x88000000" 43*261d2760SDarwin Rambo- fdt_name e.g. "devtree.dtb" 44*261d2760SDarwin Rambo- fdt_addr_r e.g. "0x83000000" 45*261d2760SDarwin Rambo 46*261d2760SDarwin RamboOptionally, "fdt_high" and "initrd_high" can be specified as per 47*261d2760SDarwin Rambotheir rules for allowing or preventing copying of these images. 48*261d2760SDarwin Rambo 49*261d2760SDarwin RamboFor the "fdt chosen" startup macro, this code will then define: 50*261d2760SDarwin Rambo- initrd_end (based on retrieving initrd_addr_r plus actual initrd_size) 51*261d2760SDarwin Rambo 52*261d2760SDarwin RamboWe will then load the kernel, initrd, and fdt into the specified 53*261d2760SDarwin Rambolocations in memory in a similar way that the ATF fastmodel code 54*261d2760SDarwin Rambouses semihosting calls to load other boot stages and u-boot itself. 55