backend.h (f4bc335b4fc899509c92c230f746fe90a5aa43d2) backend.h (035ad76b8b45a01cc7fcc184e7e72eed69c0ece5)
1/* SPDX-License-Identifier: Apache-2.0 */
2/* Copyright (C) 2018 IBM Corp. */
3#pragma once
4
5#include <limits.h>
1/* SPDX-License-Identifier: Apache-2.0 */
2/* Copyright (C) 2018 IBM Corp. */
3#pragma once
4
5#include <limits.h>
6#include "pnor_partition_defs.h"
7#include "backend.h"
8
9struct mbox_context;
10struct vpnor_partition_table;
11
12struct vpnor_partition_paths
13{
14 char ro_loc[PATH_MAX];
15 char rw_loc[PATH_MAX];

--- 20 unchanged lines hidden (view full) ---

36void vpnor_default_paths(struct vpnor_partition_paths *paths);
37#else
38static inline void vpnor_default_paths(struct vpnor_partition_paths *paths)
39{
40 memset(paths, 0, sizeof(*paths));
41}
42#endif
43
6
7struct mbox_context;
8struct vpnor_partition_table;
9
10struct vpnor_partition_paths
11{
12 char ro_loc[PATH_MAX];
13 char rw_loc[PATH_MAX];

--- 20 unchanged lines hidden (view full) ---

34void vpnor_default_paths(struct vpnor_partition_paths *paths);
35#else
36static inline void vpnor_default_paths(struct vpnor_partition_paths *paths)
37{
38 memset(paths, 0, sizeof(*paths));
39}
40#endif
41
44#ifdef VIRTUAL_PNOR_ENABLED
45/** @brief Create a virtual PNOR partition table.
46 *
47 * @param[in] backend - The backend context pointer
48 * @param[in] paths - A paths object pointer to initialise vpnor
49 *
50 * This API should be called before calling any other APIs below. If a table
51 * already exists, this function will not do anything further. This function
52 * will not do anything if the context is NULL.
53 *
54 * The content of the paths object is copied out, ownership is retained by the
55 * caller.
56 *
57 * Returns 0 if the call succeeds, else a negative error code.
58 */
59
60int vpnor_init(struct backend *backend,
61 const struct vpnor_partition_paths *paths);
62
63/** @brief Copy bootloader partition (alongwith TOC) to LPC memory
64 *
65 * @param[in] backend - The backend context pointer
66 *
67 * @returns 0 on success, negative error code on failure
68 */
69int vpnor_copy_bootloader_partition(const struct backend *backend, void *buf,
70 uint32_t count);
71
72/** @brief Destroy partition table, if it exists.
73 *
74 * @param[in] backend - The backend context pointer
75 */
76void vpnor_destroy(struct backend *backend);
77
78#ifdef __cplusplus
79}
80#endif
42#ifdef __cplusplus
43}
44#endif
81
82#endif