blob: bab7a7e80d1d3e121a9531f610a8465d8a6a4624 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2022, Linaro Limited
*/
#define LOG_CATEGORY UCLASS_FWU_MDATA
#include <dm.h>
#include <efi_loader.h>
#include <fwu.h>
#include <fwu_mdata.h>
#include <log.h>
#include <linux/errno.h>
#include <linux/types.h>
/**
* fwu_read_mdata() - Wrapper around fwu_mdata_ops.read_mdata()
*
* Return: 0 if OK, -ve on error
*/
int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary)
{
const struct fwu_mdata_ops *ops = device_get_ops(dev);
if (!ops->read_mdata) {
log_debug("read_mdata() method not defined\n");
return -ENOSYS;
}
return ops->read_mdata(dev, mdata, primary);
}
/**
* fwu_write_mdata() - Wrapper around fwu_mdata_ops.write_mdata()
*
* Return: 0 if OK, -ve on error
*/
int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary)
{
const struct fwu_mdata_ops *ops = device_get_ops(dev);
if (!ops->write_mdata) {
log_debug("write_mdata() method not defined\n");
return -ENOSYS;
}
return ops->write_mdata(dev, mdata, primary);
}
UCLASS_DRIVER(fwu_mdata) = {
.id = UCLASS_FWU_MDATA,
.name = "fwu-mdata",
};
|