2020-10-23 08:52:22 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 Eugeniu Rosca <rosca.eugeniu@gmail.com>
|
|
|
|
*
|
|
|
|
* Android Bootloader Control Block Header
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __BCB_H__
|
|
|
|
#define __BCB_H__
|
|
|
|
|
2023-11-10 05:59:55 +00:00
|
|
|
#include <part.h>
|
|
|
|
|
|
|
|
enum bcb_field {
|
|
|
|
BCB_FIELD_COMMAND,
|
|
|
|
BCB_FIELD_STATUS,
|
|
|
|
BCB_FIELD_RECOVERY,
|
|
|
|
BCB_FIELD_STAGE
|
|
|
|
};
|
|
|
|
|
2023-02-05 22:36:21 +00:00
|
|
|
#if IS_ENABLED(CONFIG_CMD_BCB)
|
2023-11-10 05:59:55 +00:00
|
|
|
|
|
|
|
int bcb_find_partition_and_load(const char *iface,
|
|
|
|
int devnum, char *partp);
|
|
|
|
int bcb_load(struct blk_desc *block_description,
|
|
|
|
struct disk_partition *disk_partition);
|
|
|
|
int bcb_set(enum bcb_field field, const char *value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bcb_get() - get the field value.
|
|
|
|
* @field: field to get
|
|
|
|
* @value_out: buffer to copy bcb field value to
|
|
|
|
* @value_size: buffer size to avoid overflow in case
|
|
|
|
* value_out is smaller then the field value
|
|
|
|
*/
|
|
|
|
int bcb_get(enum bcb_field field, char *value_out, size_t value_size);
|
|
|
|
|
|
|
|
int bcb_store(void);
|
|
|
|
void bcb_reset(void);
|
|
|
|
|
2020-10-23 08:52:22 +00:00
|
|
|
#else
|
2023-11-10 05:59:55 +00:00
|
|
|
|
2020-10-23 08:52:22 +00:00
|
|
|
#include <linux/errno.h>
|
2023-11-10 05:59:55 +00:00
|
|
|
|
|
|
|
static inline int bcb_load(struct blk_desc *block_description,
|
|
|
|
struct disk_partition *disk_partition)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int bcb_find_partition_and_load(const char *iface,
|
|
|
|
int devnum, char *partp)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int bcb_set(enum bcb_field field, const char *value)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int bcb_get(enum bcb_field field, char *value_out)
|
2020-10-23 08:52:22 +00:00
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
2023-11-10 05:59:55 +00:00
|
|
|
|
|
|
|
static inline int bcb_store(void)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void bcb_reset(void)
|
|
|
|
{
|
|
|
|
}
|
2020-10-23 08:52:22 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __BCB_H__ */
|