Merge branch 'master' of git://git.denx.de/u-boot-usb
This commit is contained in:
36
include/fastboot-internal.h
Normal file
36
include/fastboot-internal.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
|
||||
#ifndef _FASTBOOT_INTERNAL_H_
|
||||
#define _FASTBOOT_INTERNAL_H_
|
||||
|
||||
/**
|
||||
* fastboot_buf_addr - base address of the fastboot download buffer
|
||||
*/
|
||||
extern void *fastboot_buf_addr;
|
||||
|
||||
/**
|
||||
* fastboot_buf_size - size of the fastboot download buffer
|
||||
*/
|
||||
extern u32 fastboot_buf_size;
|
||||
|
||||
/**
|
||||
* fastboot_progress_callback - callback executed during long operations
|
||||
*/
|
||||
extern void (*fastboot_progress_callback)(const char *msg);
|
||||
|
||||
/**
|
||||
* fastboot_getvar() - Writes variable indicated by cmd_parameter to response.
|
||||
*
|
||||
* @cmd_parameter: Pointer to command parameter
|
||||
* @response: Pointer to fastboot response buffer
|
||||
*
|
||||
* Look up cmd_parameter first as an environment variable of the form
|
||||
* fastboot.<cmd_parameter>, if that exists return use its value to set
|
||||
* response.
|
||||
*
|
||||
* Otherwise lookup the name of variable and execute the appropriate
|
||||
* function to return the requested value.
|
||||
*/
|
||||
void fastboot_getvar(char *cmd_parameter, char *response);
|
||||
|
||||
#endif
|
||||
@@ -12,10 +12,143 @@
|
||||
#ifndef _FASTBOOT_H_
|
||||
#define _FASTBOOT_H_
|
||||
|
||||
#define FASTBOOT_VERSION "0.4"
|
||||
|
||||
/* The 64 defined bytes plus \0 */
|
||||
#define FASTBOOT_COMMAND_LEN (64 + 1)
|
||||
#define FASTBOOT_RESPONSE_LEN (64 + 1)
|
||||
|
||||
void fastboot_fail(const char *reason);
|
||||
void fastboot_okay(const char *reason);
|
||||
/**
|
||||
* All known commands to fastboot
|
||||
*/
|
||||
enum {
|
||||
FASTBOOT_COMMAND_GETVAR = 0,
|
||||
FASTBOOT_COMMAND_DOWNLOAD,
|
||||
#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
|
||||
FASTBOOT_COMMAND_FLASH,
|
||||
FASTBOOT_COMMAND_ERASE,
|
||||
#endif
|
||||
FASTBOOT_COMMAND_BOOT,
|
||||
FASTBOOT_COMMAND_CONTINUE,
|
||||
FASTBOOT_COMMAND_REBOOT,
|
||||
FASTBOOT_COMMAND_REBOOT_BOOTLOADER,
|
||||
FASTBOOT_COMMAND_SET_ACTIVE,
|
||||
#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
|
||||
FASTBOOT_COMMAND_OEM_FORMAT,
|
||||
#endif
|
||||
|
||||
FASTBOOT_COMMAND_COUNT
|
||||
};
|
||||
|
||||
/**
|
||||
* 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, ...)
|
||||
__attribute__ ((format (__printf__, 3, 4)));
|
||||
|
||||
/**
|
||||
* 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_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);
|
||||
|
||||
/**
|
||||
* 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 fastboot_set_reboot_flag(void);
|
||||
|
||||
/**
|
||||
* fastboot_set_progress_callback() - set progress callback
|
||||
*
|
||||
* @progress: Pointer to progress callback
|
||||
*
|
||||
* Set a callback which is invoked periodically during long running operations
|
||||
* (flash and erase). This can be used (for example) by the UDP transport to
|
||||
* send INFO responses to keep the client alive whilst those commands are
|
||||
* executing.
|
||||
*/
|
||||
void fastboot_set_progress_callback(void (*progress)(const char *msg));
|
||||
|
||||
/*
|
||||
* fastboot_init() - initialise new fastboot protocol session
|
||||
*
|
||||
* @buf_addr: Pointer to download buffer, or NULL for default
|
||||
* @buf_size: Size of download buffer, or zero for default
|
||||
*/
|
||||
void fastboot_init(void *buf_addr, u32 buf_size);
|
||||
|
||||
/**
|
||||
* fastboot_boot() - Execute fastboot boot command
|
||||
*
|
||||
* If ${fastboot_bootcmd} is set, run that command to execute the boot
|
||||
* process, if that returns, then exit the fastboot server and return
|
||||
* control to the caller.
|
||||
*
|
||||
* Otherwise execute "bootm <fastboot_buf_addr>", if that fails, reset
|
||||
* the board.
|
||||
*/
|
||||
void fastboot_boot(void);
|
||||
|
||||
/**
|
||||
* fastboot_handle_command() - Handle fastboot command
|
||||
*
|
||||
* @cmd_string: Pointer to command string
|
||||
* @response: Pointer to fastboot response buffer
|
||||
*
|
||||
* Return: Executed command, or -1 if not recognized
|
||||
*/
|
||||
int fastboot_handle_command(char *cmd_string, char *response);
|
||||
|
||||
/**
|
||||
* fastboot_data_remaining() - return bytes remaining in current transfer
|
||||
*
|
||||
* Return: Number of bytes left in the current download
|
||||
*/
|
||||
u32 fastboot_data_remaining(void);
|
||||
|
||||
/**
|
||||
* fastboot_data_download() - Copy image data to fastboot_buf_addr.
|
||||
*
|
||||
* @fastboot_data: Pointer to received fastboot data
|
||||
* @fastboot_data_len: Length of received fastboot data
|
||||
* @response: Pointer to fastboot response buffer
|
||||
*
|
||||
* Copies image data from fastboot_data to fastboot_buf_addr. Writes to
|
||||
* response. fastboot_bytes_received is updated to indicate the number
|
||||
* of bytes that have been transferred.
|
||||
*/
|
||||
void fastboot_data_download(const void *fastboot_data,
|
||||
unsigned int fastboot_data_len, char *response);
|
||||
|
||||
/**
|
||||
* fastboot_data_complete() - Mark current transfer complete
|
||||
*
|
||||
* @response: Pointer to fastboot response buffer
|
||||
*
|
||||
* Set image_size and ${filesize} to the total size of the downloaded image.
|
||||
*/
|
||||
void fastboot_data_complete(char *response);
|
||||
|
||||
#endif /* _FASTBOOT_H_ */
|
||||
|
||||
@@ -3,6 +3,35 @@
|
||||
* Copyright 2014 Broadcom Corporation.
|
||||
*/
|
||||
|
||||
void fb_mmc_flash_write(const char *cmd, void *download_buffer,
|
||||
unsigned int download_bytes);
|
||||
void fb_mmc_erase(const char *cmd);
|
||||
#ifndef _FB_MMC_H_
|
||||
#define _FB_MMC_H_
|
||||
|
||||
/**
|
||||
* fastboot_mmc_get_part_info() - Lookup eMMC partion by name
|
||||
*
|
||||
* @part_name: Named partition to lookup
|
||||
* @dev_desc: Pointer to returned blk_desc pointer
|
||||
* @part_info: Pointer to returned disk_partition_t
|
||||
* @response: Pointer to fastboot response buffer
|
||||
*/
|
||||
int fastboot_mmc_get_part_info(char *part_name, struct blk_desc **dev_desc,
|
||||
disk_partition_t *part_info, char *response);
|
||||
|
||||
/**
|
||||
* fastboot_mmc_flash_write() - Write image to eMMC for fastboot
|
||||
*
|
||||
* @cmd: Named partition to write image to
|
||||
* @download_buffer: Pointer to image data
|
||||
* @download_bytes: Size of image data
|
||||
* @response: Pointer to fastboot response buffer
|
||||
*/
|
||||
void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
|
||||
u32 download_bytes, char *response);
|
||||
/**
|
||||
* fastboot_mmc_flash_erase() - Erase eMMC for fastboot
|
||||
*
|
||||
* @cmd: Named partition to erase
|
||||
* @response: Pointer to fastboot response buffer
|
||||
*/
|
||||
void fastboot_mmc_erase(const char *cmd, char *response);
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,37 @@
|
||||
* Copyright 2015 Free Electrons.
|
||||
*/
|
||||
|
||||
void fb_nand_flash_write(const char *cmd, void *download_buffer,
|
||||
unsigned int download_bytes);
|
||||
void fb_nand_erase(const char *cmd);
|
||||
#ifndef _FB_NAND_H_
|
||||
#define _FB_NAND_H_
|
||||
|
||||
#include <jffs2/load_kernel.h>
|
||||
|
||||
/**
|
||||
* fastboot_nand_get_part_info() - Lookup NAND partion by name
|
||||
*
|
||||
* @part_name: Named device to lookup
|
||||
* @part_info: Pointer to returned part_info pointer
|
||||
* @response: Pointer to fastboot response buffer
|
||||
*/
|
||||
int fastboot_nand_get_part_info(char *part_name, struct part_info **part_info,
|
||||
char *response);
|
||||
|
||||
/**
|
||||
* fastboot_nand_flash_write() - Write image to NAND for fastboot
|
||||
*
|
||||
* @cmd: Named device to write image to
|
||||
* @download_buffer: Pointer to image data
|
||||
* @download_bytes: Size of image data
|
||||
* @response: Pointer to fastboot response buffer
|
||||
*/
|
||||
void fastboot_nand_flash_write(const char *cmd, void *download_buffer,
|
||||
u32 download_bytes, char *response);
|
||||
|
||||
/**
|
||||
* fastboot_nand_flash_erase() - Erase NAND for fastboot
|
||||
*
|
||||
* @cmd: Named device to erase
|
||||
* @response: Pointer to fastboot response buffer
|
||||
*/
|
||||
void fastboot_nand_erase(const char *cmd, char *response);
|
||||
#endif
|
||||
|
||||
10
include/fs.h
10
include/fs.h
@@ -37,6 +37,16 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype);
|
||||
*/
|
||||
int fs_set_blk_dev_with_part(struct blk_desc *desc, int part);
|
||||
|
||||
/**
|
||||
* fs_get_type_name() - Get type of current filesystem
|
||||
*
|
||||
* Return: Pointer to filesystem name
|
||||
*
|
||||
* Returns a string describing the current filesystem, or the sentinel
|
||||
* "unsupported" for any unrecognised filesystem.
|
||||
*/
|
||||
const char *fs_get_type_name(void);
|
||||
|
||||
/*
|
||||
* Print the list of files on the partition previously set by fs_set_blk_dev(),
|
||||
* in directory "dirname".
|
||||
|
||||
@@ -23,7 +23,7 @@ struct sparse_storage {
|
||||
lbaint_t blk,
|
||||
lbaint_t blkcnt);
|
||||
|
||||
void (*mssg)(const char *str);
|
||||
void (*mssg)(const char *str, char *response);
|
||||
};
|
||||
|
||||
static inline int is_sparse_image(void *buf)
|
||||
@@ -38,4 +38,4 @@ static inline int is_sparse_image(void *buf)
|
||||
}
|
||||
|
||||
int write_sparse_image(struct sparse_storage *info, const char *part_name,
|
||||
void *data);
|
||||
void *data, char *response);
|
||||
|
||||
@@ -535,7 +535,7 @@ extern int net_restart_wrap; /* Tried all network devices */
|
||||
|
||||
enum proto_t {
|
||||
BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
|
||||
TFTPSRV, TFTPPUT, LINKLOCAL
|
||||
TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT
|
||||
};
|
||||
|
||||
extern char net_boot_file_name[1024];/* Boot File name */
|
||||
|
||||
21
include/net/fastboot.h
Normal file
21
include/net/fastboot.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*/
|
||||
|
||||
#ifndef __NET_FASTBOOT_H__
|
||||
#define __NET_FASTBOOT_H__
|
||||
|
||||
/**********************************************************************/
|
||||
/*
|
||||
* Global functions and variables.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wait for incoming fastboot comands.
|
||||
*/
|
||||
void fastboot_start_server(void);
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
#endif /* __NET_FASTBOOT_H__ */
|
||||
Reference in New Issue
Block a user