blob: ea8c71f100fb9c4f296ce56b42dac2396f46061e [file] [log] [blame]
Patrick Delaunay2111e3c2019-10-14 09:28:06 +02001// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
2/*
3 * Copyright (C) 2019, STMicroelectronics - All Rights Reserved
4 */
5#include <common.h>
6#include <dfu.h>
7#include <errno.h>
8#include <malloc.h>
9
10int __weak dfu_write_medium_virt(struct dfu_entity *dfu, u64 offset,
11 void *buf, long *len)
12{
13 debug("%s: off=0x%llx, len=0x%x\n", __func__, offset, (u32)*len);
14
15 return 0;
16}
17
18int __weak dfu_get_medium_size_virt(struct dfu_entity *dfu, u64 *size)
19{
20 *size = 0;
21
22 return 0;
23}
24
25int __weak dfu_read_medium_virt(struct dfu_entity *dfu, u64 offset,
26 void *buf, long *len)
27{
28 debug("%s: off=0x%llx, len=0x%x\n", __func__, offset, (u32)*len);
29 *len = 0;
30
31 return 0;
32}
33
34int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr, char *s)
35{
36 debug("%s: devstr = %s\n", __func__, devstr);
37
38 dfu->dev_type = DFU_DEV_VIRT;
39 dfu->layout = DFU_RAW_ADDR;
40 dfu->data.virt.dev_num = simple_strtoul(devstr, NULL, 10);
41
42 dfu->write_medium = dfu_write_medium_virt;
43 dfu->get_medium_size = dfu_get_medium_size_virt;
44 dfu->read_medium = dfu_read_medium_virt;
45
46 dfu->inited = 0;
47
48 return 0;
49}