2012-10-15 10:28:53 +00:00
|
|
|
#ifndef __INCLUDE_BBU_H
|
|
|
|
#define __INCLUDE_BBU_H
|
|
|
|
|
2014-07-28 20:25:15 +00:00
|
|
|
#include <asm-generic/errno.h>
|
2015-03-03 19:46:18 +00:00
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/types.h>
|
2015-06-30 06:23:42 +00:00
|
|
|
#include <filetype.h>
|
2014-07-28 20:25:15 +00:00
|
|
|
|
2012-10-15 10:28:53 +00:00
|
|
|
struct bbu_data {
|
|
|
|
#define BBU_FLAG_FORCE (1 << 0)
|
|
|
|
#define BBU_FLAG_YES (1 << 1)
|
|
|
|
unsigned long flags;
|
|
|
|
int force;
|
|
|
|
void *image;
|
|
|
|
const char *imagefile;
|
|
|
|
const char *devicefile;
|
|
|
|
size_t len;
|
|
|
|
const char *handler_name;
|
2016-03-17 15:15:11 +00:00
|
|
|
struct imd_header *imd_data;
|
2012-10-15 10:28:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct bbu_handler {
|
|
|
|
int (*handler)(struct bbu_handler *, struct bbu_data *);
|
|
|
|
const char *name;
|
|
|
|
struct list_head list;
|
|
|
|
#define BBU_HANDLER_FLAG_DEFAULT (1 << 0)
|
2016-03-10 15:24:10 +00:00
|
|
|
#define BBU_HANDLER_CAN_REFRESH (1 << 1)
|
2012-10-15 10:28:53 +00:00
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
/* default device file, can be overwritten on the command line */
|
|
|
|
const char *devicefile;
|
|
|
|
};
|
|
|
|
|
|
|
|
int bbu_force(struct bbu_data *, const char *fmt, ...)
|
|
|
|
__attribute__ ((format(__printf__, 2, 3)));
|
|
|
|
|
|
|
|
int bbu_confirm(struct bbu_data *);
|
|
|
|
|
|
|
|
int barebox_update(struct bbu_data *);
|
|
|
|
|
2016-02-17 11:28:18 +00:00
|
|
|
bool barebox_update_handler_exists(struct bbu_data *);
|
|
|
|
|
2012-10-15 10:28:53 +00:00
|
|
|
void bbu_handlers_list(void);
|
|
|
|
|
|
|
|
#ifdef CONFIG_BAREBOX_UPDATE
|
|
|
|
|
|
|
|
int bbu_register_handler(struct bbu_handler *);
|
|
|
|
|
2015-06-30 06:23:42 +00:00
|
|
|
int bbu_register_std_file_update(const char *name, unsigned long flags,
|
|
|
|
char *devicefile, enum filetype imagetype);
|
|
|
|
|
2012-10-15 10:28:53 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
static inline int bbu_register_handler(struct bbu_handler *unused)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2015-06-30 06:23:42 +00:00
|
|
|
static inline int bbu_register_std_file_update(const char *name, unsigned long flags,
|
|
|
|
char *devicefile, enum filetype imagetype)
|
|
|
|
{
|
|
|
|
return -ENOSYS;
|
|
|
|
}
|
2012-10-15 10:28:53 +00:00
|
|
|
#endif
|
|
|
|
|
2015-06-12 04:07:32 +00:00
|
|
|
#if defined(CONFIG_BAREBOX_UPDATE_IMX_NAND_FCB)
|
|
|
|
int imx6_bbu_nand_register_handler(const char *name, unsigned long flags);
|
2015-06-10 13:13:16 +00:00
|
|
|
int imx28_bbu_nand_register_handler(const char *name, unsigned long flags);
|
2015-06-12 04:07:32 +00:00
|
|
|
#else
|
|
|
|
static inline int imx6_bbu_nand_register_handler(const char *name, unsigned long flags)
|
|
|
|
{
|
|
|
|
return -ENOSYS;
|
|
|
|
}
|
2015-06-10 13:13:16 +00:00
|
|
|
static inline int imx28_bbu_nand_register_handler(const char *name, unsigned long flags)
|
|
|
|
{
|
|
|
|
return -ENOSYS;
|
|
|
|
}
|
2015-06-12 04:07:32 +00:00
|
|
|
#endif
|
|
|
|
|
2012-10-15 10:28:53 +00:00
|
|
|
#endif /* __INCLUDE_BBU_H */
|