1*4882a593Smuzhiyun/* 2*4882a593Smuzhiyun * Copyright 2014 Broadcom Corporation. 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * SPDX-License-Identifier: GPL-2.0+ 5*4882a593Smuzhiyun */ 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunSemihosting is ARM's way of having a real or virtual target communicate 8*4882a593Smuzhiyunwith a host or host debugger for basic operations such as file I/O, 9*4882a593Smuzhiyunconsole I/O, etc. Please see 10*4882a593Smuzhiyunhttp://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0471c/Bgbjjgij.html for more information. 11*4882a593Smuzhiyun 12*4882a593SmuzhiyunFor developing on armv8 virtual fastmodel platforms, semihosting is a 13*4882a593Smuzhiyunvaluable tool since it allows access to image/configuration files before 14*4882a593SmuzhiyuneMMC or other NV media are available. 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunThere are two main ARM virtual Fixed Virtual Platform (FVP) models, 17*4882a593SmuzhiyunVersatile Express (VE) FVP and BASE FVP (See 18*4882a593Smuzhiyunhttp://www.arm.com/products/tools/models/fast-models/foundation-model.php) 19*4882a593SmuzhiyunThe initial vexpress64 u-boot board created here runs on the VE virtual 20*4882a593Smuzhiyunplatform using the license-free Foundation_v8 simulator. Fortunately, 21*4882a593Smuzhiyunthe Foundation_v8 simulator also supports the BASE_FVP model which 22*4882a593Smuzhiyuncompanies can purchase licenses for and contain much more functionality. 23*4882a593SmuzhiyunSo we can, in u-boot, run either model by either using the VE FVP (default), 24*4882a593Smuzhiyunor turning on CONFIG_BASE_FVP for the more full featured model. 25*4882a593Smuzhiyun 26*4882a593SmuzhiyunRather than create a new armv8 board similar to armltd/vexpress64, add 27*4882a593Smuzhiyunsemihosting calls to the existing one, enabled with CONFIG_SEMIHOSTING 28*4882a593Smuzhiyunand CONFIG_BASE_FVP both set. Also reuse the existing board config file 29*4882a593Smuzhiyunvexpress_aemv8a.h but differentiate the two models by the presence or 30*4882a593Smuzhiyunabsence of CONFIG_BASE_FVP. This change is tested and works on both the 31*4882a593SmuzhiyunFoundation and Base fastmodel simulators. 32*4882a593Smuzhiyun 33*4882a593SmuzhiyunThe semihosting code adds a command: 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun smhload <image> <address> [env var] 36*4882a593Smuzhiyun 37*4882a593SmuzhiyunThat will load an image from the host filesystem into RAM at the specified 38*4882a593Smuzhiyunaddress and optionally store the load end address in the specified 39*4882a593Smuzhiyunenvironment variable. 40