root/include/linux/sdb.h

/* [<][>][^][v][top][bottom][index][help] */
   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 /*
   3  * This is the official version 1.1 of sdb.h
   4  */
   5 #ifndef __SDB_H__
   6 #define __SDB_H__
   7 #ifdef __KERNEL__
   8 #include <linux/types.h>
   9 #else
  10 #include <stdint.h>
  11 #endif
  12 
  13 /*
  14  * All structures are 64 bytes long and are expected
  15  * to live in an array, one for each interconnect.
  16  * Most fields of the structures are shared among the
  17  * various types, and most-specific fields are at the
  18  * beginning (for alignment reasons, and to keep the
  19  * magic number at the head of the interconnect record
  20  */
  21 
  22 /* Product, 40 bytes at offset 24, 8-byte aligned
  23  *
  24  * device_id is vendor-assigned; version is device-specific,
  25  * date is hex (e.g 0x20120501), name is UTF-8, blank-filled
  26  * and not terminated with a 0 byte.
  27  */
  28 struct sdb_product {
  29         uint64_t                vendor_id;      /* 0x18..0x1f */
  30         uint32_t                device_id;      /* 0x20..0x23 */
  31         uint32_t                version;        /* 0x24..0x27 */
  32         uint32_t                date;           /* 0x28..0x2b */
  33         uint8_t                 name[19];       /* 0x2c..0x3e */
  34         uint8_t                 record_type;    /* 0x3f */
  35 };
  36 
  37 /*
  38  * Component, 56 bytes at offset 8, 8-byte aligned
  39  *
  40  * The address range is first to last, inclusive
  41  * (for example 0x100000 - 0x10ffff)
  42  */
  43 struct sdb_component {
  44         uint64_t                addr_first;     /* 0x08..0x0f */
  45         uint64_t                addr_last;      /* 0x10..0x17 */
  46         struct sdb_product      product;        /* 0x18..0x3f */
  47 };
  48 
  49 /* Type of the SDB record */
  50 enum sdb_record_type {
  51         sdb_type_interconnect   = 0x00,
  52         sdb_type_device         = 0x01,
  53         sdb_type_bridge         = 0x02,
  54         sdb_type_integration    = 0x80,
  55         sdb_type_repo_url       = 0x81,
  56         sdb_type_synthesis      = 0x82,
  57         sdb_type_empty          = 0xFF,
  58 };
  59 
  60 /* Type 0: interconnect (first of the array)
  61  *
  62  * sdb_records is the length of the table including this first
  63  * record, version is 1. The bus type is enumerated later.
  64  */
  65 #define                         SDB_MAGIC       0x5344422d /* "SDB-" */
  66 struct sdb_interconnect {
  67         uint32_t                sdb_magic;      /* 0x00-0x03 */
  68         uint16_t                sdb_records;    /* 0x04-0x05 */
  69         uint8_t                 sdb_version;    /* 0x06 */
  70         uint8_t                 sdb_bus_type;   /* 0x07 */
  71         struct sdb_component    sdb_component;  /* 0x08-0x3f */
  72 };
  73 
  74 /* Type 1: device
  75  *
  76  * class is 0 for "custom device", other values are
  77  * to be standardized; ABI version is for the driver,
  78  * bus-specific bits are defined by each bus (see below)
  79  */
  80 struct sdb_device {
  81         uint16_t                abi_class;      /* 0x00-0x01 */
  82         uint8_t                 abi_ver_major;  /* 0x02 */
  83         uint8_t                 abi_ver_minor;  /* 0x03 */
  84         uint32_t                bus_specific;   /* 0x04-0x07 */
  85         struct sdb_component    sdb_component;  /* 0x08-0x3f */
  86 };
  87 
  88 /* Type 2: bridge
  89  *
  90  * child is the address of the nested SDB table
  91  */
  92 struct sdb_bridge {
  93         uint64_t                sdb_child;      /* 0x00-0x07 */
  94         struct sdb_component    sdb_component;  /* 0x08-0x3f */
  95 };
  96 
  97 /* Type 0x80: integration
  98  *
  99  * all types with bit 7 set are meta-information, so
 100  * software can ignore the types it doesn't know. Here we
 101  * just provide product information for an aggregate device
 102  */
 103 struct sdb_integration {
 104         uint8_t                 reserved[24];   /* 0x00-0x17 */
 105         struct sdb_product      product;        /* 0x08-0x3f */
 106 };
 107 
 108 /* Type 0x81: Top module repository url
 109  *
 110  * again, an informative field that software can ignore
 111  */
 112 struct sdb_repo_url {
 113         uint8_t                 repo_url[63];   /* 0x00-0x3e */
 114         uint8_t                 record_type;    /* 0x3f */
 115 };
 116 
 117 /* Type 0x82: Synthesis tool information
 118  *
 119  * this informative record
 120  */
 121 struct sdb_synthesis {
 122         uint8_t                 syn_name[16];   /* 0x00-0x0f */
 123         uint8_t                 commit_id[16];  /* 0x10-0x1f */
 124         uint8_t                 tool_name[8];   /* 0x20-0x27 */
 125         uint32_t                tool_version;   /* 0x28-0x2b */
 126         uint32_t                date;           /* 0x2c-0x2f */
 127         uint8_t                 user_name[15];  /* 0x30-0x3e */
 128         uint8_t                 record_type;    /* 0x3f */
 129 };
 130 
 131 /* Type 0xff: empty
 132  *
 133  * this allows keeping empty slots during development,
 134  * so they can be filled later with minimal efforts and
 135  * no misleading description is ever shipped -- hopefully.
 136  * It can also be used to pad a table to a desired length.
 137  */
 138 struct sdb_empty {
 139         uint8_t                 reserved[63];   /* 0x00-0x3e */
 140         uint8_t                 record_type;    /* 0x3f */
 141 };
 142 
 143 /* The type of bus, for bus-specific flags */
 144 enum sdb_bus_type {
 145         sdb_wishbone = 0x00,
 146         sdb_data     = 0x01,
 147 };
 148 
 149 #define SDB_WB_WIDTH_MASK       0x0f
 150 #define SDB_WB_ACCESS8                  0x01
 151 #define SDB_WB_ACCESS16                 0x02
 152 #define SDB_WB_ACCESS32                 0x04
 153 #define SDB_WB_ACCESS64                 0x08
 154 #define SDB_WB_LITTLE_ENDIAN    0x80
 155 
 156 #define SDB_DATA_READ           0x04
 157 #define SDB_DATA_WRITE          0x02
 158 #define SDB_DATA_EXEC           0x01
 159 
 160 #endif /* __SDB_H__ */

/* [<][>][^][v][top][bottom][index][help] */