int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry)
{
const char *prop;
- u32 reg[2];
- if (ofnode_read_u32_array(node, "reg", reg, 2)) {
- debug("Node '%s' has bad/missing 'reg' property\n",
+ if (ofnode_read_u32(node, "image-pos", &entry->offset)) {
+ debug("Node '%s' has bad/missing 'image-pos' property\n",
ofnode_get_name(node));
- return -log_ret(ENOENT);
+ return log_ret(-ENOENT);
+ }
+ if (ofnode_read_u32(node, "size", &entry->length)) {
+ debug("Node '%s' has bad/missing 'size' property\n",
+ ofnode_get_name(node));
+ return log_ret(-ENOENT);
}
- entry->offset = reg[0];
- entry->length = reg[1];
entry->used = ofnode_read_s32_default(node, "used", entry->length);
prop = ofnode_read_string(node, "compress");
- entry->compress_algo = prop && !strcmp(prop, "lzo") ?
- FMAP_COMPRESS_LZO : FMAP_COMPRESS_NONE;
+ if (prop) {
+ if (!strcmp(prop, "lz4"))
+ entry->compress_algo = FMAP_COMPRESS_LZ4;
+ else
+ return log_msg_ret("Unknown compression algo",
+ -EINVAL);
+ } else {
+ entry->compress_algo = FMAP_COMPRESS_NONE;
+ }
+ entry->unc_length = ofnode_read_s32_default(node, "uncomp-size",
+ entry->length);
prop = ofnode_read_string(node, "hash");
if (prop)
entry->hash_size = strlen(prop);
* @return number of bytes in response, or -ve on error
*/
static int ec_command_inptr(struct cros_ec_dev *dev, uint8_t cmd,
- int cmd_version, const void *dout, int dout_len, uint8_t **dinp,
- int din_len)
+ int cmd_version, const void *dout, int dout_len,
+ uint8_t **dinp, int din_len)
{
uint8_t *din = NULL;
int len;
}
int cros_ec_read_current_image(struct cros_ec_dev *dev,
- enum ec_current_image *image)
+ enum ec_current_image *image)
{
struct ec_response_get_version *r;
}
static int cros_ec_wait_on_hash_done(struct cros_ec_dev *dev,
- struct ec_response_vboot_hash *hash)
+ struct ec_response_vboot_hash *hash)
{
struct ec_params_vboot_hash p;
ulong start;
int cros_ec_read_hash(struct cros_ec_dev *dev,
- struct ec_response_vboot_hash *hash)
+ struct ec_response_vboot_hash *hash)
{
struct ec_params_vboot_hash p;
int rv;
}
int cros_ec_reboot(struct cros_ec_dev *dev, enum ec_reboot_cmd cmd,
- uint8_t flags)
+ uint8_t flags)
{
struct ec_params_reboot_ec p;
}
int cros_ec_flash_protect(struct cros_ec_dev *dev,
- uint32_t set_mask, uint32_t set_flags,
- struct ec_response_flash_protect *resp)
+ uint32_t set_mask, uint32_t set_flags,
+ struct ec_response_flash_protect *resp)
{
struct ec_params_flash_protect params;
* @return 0 if ok, -1 on error
*/
static int cros_ec_flash_write_block(struct cros_ec_dev *dev,
- const uint8_t *data, uint32_t offset, uint32_t size)
+ const uint8_t *data, uint32_t offset,
+ uint32_t size)
{
struct ec_params_flash_write *p;
int ret;
* @param info Pointer to output flash info struct
*/
int cros_ec_read_flashinfo(struct cros_ec_dev *dev,
- struct ec_response_flash_info *info)
+ struct ec_response_flash_info *info)
{
int ret;
}
int cros_ec_flash_write(struct cros_ec_dev *dev, const uint8_t *data,
- uint32_t offset, uint32_t size)
+ uint32_t offset, uint32_t size)
{
uint32_t burst = cros_ec_flash_write_burst_size(dev);
uint32_t end, off;
/* If the data is empty, there is no point in programming it */
todo = min(end - off, burst);
if (dev->optimise_flash_write &&
- cros_ec_data_is_erased((uint32_t *)data, todo))
+ cros_ec_data_is_erased((uint32_t *)data, todo))
continue;
ret = cros_ec_flash_write_block(dev, data, off, todo);
* @return 0 if ok, -1 on error
*/
static int cros_ec_flash_read_block(struct cros_ec_dev *dev, uint8_t *data,
- uint32_t offset, uint32_t size)
+ uint32_t offset, uint32_t size)
{
struct ec_params_flash_read p;
}
int cros_ec_flash_read(struct cros_ec_dev *dev, uint8_t *data, uint32_t offset,
- uint32_t size)
+ uint32_t size)
{
uint32_t burst = cros_ec_flash_write_burst_size(dev);
uint32_t end, off;
return 0;
}
-int cros_ec_flash_update_rw(struct cros_ec_dev *dev,
- const uint8_t *image, int image_size)
+int cros_ec_flash_update_rw(struct cros_ec_dev *dev, const uint8_t *image,
+ int image_size)
{
uint32_t rw_offset, rw_size;
int ret;