1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * This file is separate from sdb.h, because I want that one to remain
4 * unchanged (as far as possible) from the official sdb distribution
5 *
6 * This file and associated functionality are a playground for me to
7 * understand stuff which will later be implemented in more generic places.
8 */
9#include <linux/sdb.h>
10
11/* This is the union of all currently defined types */
12union sdb_record {
13 struct sdb_interconnect ic;
14 struct sdb_device dev;
15 struct sdb_bridge bridge;
16 struct sdb_integration integr;
17 struct sdb_empty empty;
18 struct sdb_synthesis synthesis;
19 struct sdb_repo_url repo_url;
20};
21
22struct fmc_device;
23
24/* Every sdb table is turned into this structure */
25struct sdb_array {
26 int len;
27 int level;
28 unsigned long baseaddr;
29 struct fmc_device *fmc; /* the device that hosts it */
30 struct sdb_array *parent; /* NULL at root */
31 union sdb_record *record; /* copies of the struct */
32 struct sdb_array **subtree; /* only valid for bridge items */
33};
34
35extern int fmc_scan_sdb_tree(struct fmc_device *fmc, unsigned long address);
36extern void fmc_show_sdb_tree(const struct fmc_device *fmc);
37extern signed long fmc_find_sdb_device(struct sdb_array *tree, uint64_t vendor,
38 uint32_t device, unsigned long *sz);
39extern int fmc_free_sdb_tree(struct fmc_device *fmc);
40