1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Netronome Systems, Inc.
6 #ifndef __NFP_HWINFO_H__
7 #define __NFP_HWINFO_H__
11 #define HWINFO_SIZE_MIN 0x100
14 * The Hardware Info Table defines the properties of the system.
16 * HWInfo v1 Table (fixed size)
18 * 0x0000: uint32_t version Hardware Info Table version (1.0)
19 * 0x0004: uint32_t size Total size of the table, including the
21 * 0x0008: uint32_t jumptab Offset of key/value table
22 * 0x000c: uint32_t keys Total number of keys in the key/value
24 * NNNNNN: Key/value jump table and string data
25 * (size - 4): uint32_t crc32 CRC32 (same as IEEE 802.3, POSIX csum, etc)
26 * CRC32("",0) = ~0, CRC32("a",1) = 0x48C279FE
28 * HWInfo v2 Table (variable size)
30 * 0x0000: uint32_t version Hardware Info Table version (2.0)
31 * 0x0004: uint32_t size Current size of the data area, excluding
33 * 0x0008: uint32_t limit Maximum size of the table
34 * 0x000c: uint32_t reserved Unused, set to zero
35 * NNNNNN: Key/value data
36 * (size - 4): uint32_t crc32 CRC32 (same as IEEE 802.3, POSIX csum, etc)
37 * CRC32("",0) = ~0, CRC32("a",1) = 0x48C279FE
39 * If the HWInfo table is in the process of being updated, the low bit of
40 * version will be set.
42 * HWInfo v1 Key/Value Table
43 * -------------------------
45 * The key/value table is a set of offsets to ASCIIZ strings which have
46 * been strcmp(3) sorted (yes, please use bsearch(3) on the table).
48 * All keys are guaranteed to be unique.
50 * N+0: uint32_t key_1 Offset to the first key
51 * N+4: uint32_t val_1 Offset to the first value
52 * N+8: uint32_t key_2 Offset to the second key
53 * N+c: uint32_t val_2 Offset to the second value
56 * HWInfo v2 Key/Value Table
57 * -------------------------
59 * Packed UTF8Z strings, ie 'key1\000value1\000key2\000value2\000'
64 #define NFP_HWINFO_VERSION_1 ('H' << 24 | 'I' << 16 | 1 << 8 | 0 << 1 | 0)
65 #define NFP_HWINFO_VERSION_2 ('H' << 24 | 'I' << 16 | 2 << 8 | 0 << 1 | 0)
66 #define NFP_HWINFO_VERSION_UPDATING BIT(0)
74 /* v2 specific fields */
81 struct nfp_hwinfo *nfp_hwinfo_read(struct nfp_cpp *cpp);
83 const char *nfp_hwinfo_lookup(struct nfp_hwinfo *hwinfo, const char *lookup);