blob: bec899f0867c75197221b7a5b627dab466309a10 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Alessandro Rubinie34fae72013-06-12 09:13:36 +02002/*
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;
Alessandro Rubini2e70efd2014-02-22 09:11:24 +010018 struct sdb_synthesis synthesis;
19 struct sdb_repo_url repo_url;
Alessandro Rubinie34fae72013-06-12 09:13:36 +020020};
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);