mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-11-03 21:48:15 +00:00 
			
		
		
		
	Rename fb_set_reboot_flag to fastboot_set_reboot_flag so it matches all other fastboot code in the global name space. Fix the guards around them so that they're dependent on FASTBOOT, not just USB_FUNCTION_FASTBOOT. Move the weak implementation of fastboot_set_reboot_flag to fb_common.c so we can call it from non-USB fastboot code. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
		
			
				
	
	
		
			77 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			77 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
// SPDX-License-Identifier: GPL-2.0+
 | 
						|
/*
 | 
						|
 * (C) Copyright 2008 - 2009
 | 
						|
 * Windriver, <www.windriver.com>
 | 
						|
 * Tom Rix <Tom.Rix@windriver.com>
 | 
						|
 *
 | 
						|
 * Copyright 2011 Sebastian Andrzej Siewior <bigeasy@linutronix.de>
 | 
						|
 *
 | 
						|
 * Copyright 2014 Linaro, Ltd.
 | 
						|
 * Rob Herring <robh@kernel.org>
 | 
						|
 */
 | 
						|
 | 
						|
#include <common.h>
 | 
						|
#include <fastboot.h>
 | 
						|
 | 
						|
/**
 | 
						|
 * fastboot_response() - Writes a response of the form "$tag$reason".
 | 
						|
 *
 | 
						|
 * @tag: The first part of the response
 | 
						|
 * @response: Pointer to fastboot response buffer
 | 
						|
 * @format: printf style format string
 | 
						|
 */
 | 
						|
void fastboot_response(const char *tag, char *response,
 | 
						|
		       const char *format, ...)
 | 
						|
{
 | 
						|
	va_list args;
 | 
						|
 | 
						|
	strlcpy(response, tag, FASTBOOT_RESPONSE_LEN);
 | 
						|
	if (format) {
 | 
						|
		va_start(args, format);
 | 
						|
		vsnprintf(response + strlen(response),
 | 
						|
			  FASTBOOT_RESPONSE_LEN - strlen(response) - 1,
 | 
						|
			  format, args);
 | 
						|
		va_end(args);
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * fastboot_fail() - Write a FAIL response of the form "FAIL$reason".
 | 
						|
 *
 | 
						|
 * @reason: Pointer to returned reason string
 | 
						|
 * @response: Pointer to fastboot response buffer
 | 
						|
 */
 | 
						|
void fastboot_fail(const char *reason, char *response)
 | 
						|
{
 | 
						|
	fastboot_response("FAIL", response, "%s", reason);
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * fastboot_okay() - Write an OKAY response of the form "OKAY$reason".
 | 
						|
 *
 | 
						|
 * @reason: Pointer to returned reason string, or NULL to send a bare "OKAY"
 | 
						|
 * @response: Pointer to fastboot response buffer
 | 
						|
 */
 | 
						|
void fastboot_okay(const char *reason, char *response)
 | 
						|
{
 | 
						|
	if (reason)
 | 
						|
		fastboot_response("OKAY", response, "%s", reason);
 | 
						|
	else
 | 
						|
		fastboot_response("OKAY", response, NULL);
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * fastboot_set_reboot_flag() - Set flag to indicate reboot-bootloader
 | 
						|
 *
 | 
						|
 * Set flag which indicates that we should reboot into the bootloader
 | 
						|
 * following the reboot that fastboot executes after this function.
 | 
						|
 *
 | 
						|
 * This function should be overridden in your board file with one
 | 
						|
 * which sets whatever flag your board specific Android bootloader flow
 | 
						|
 * requires in order to re-enter the bootloader.
 | 
						|
 */
 | 
						|
int __weak fastboot_set_reboot_flag(void)
 | 
						|
{
 | 
						|
	return -ENOSYS;
 | 
						|
}
 |