// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /* Copyright (C) 2015-2017 Netronome Systems, Inc. */
/* Parse the hwinfo table that the ARM firmware builds in the ARM scratch SRAM * after chip reset. * * Examples of the fields: * me.count = 40 * me.mask = 0x7f_ffff_ffff * * me.count is the total number of MEs on the system. * me.mask is the bitmask of MEs that are available for application usage. * * (ie, in this example, ME 39 has been reserved by boardconfig.)
*/
/* The Hardware Info Table defines the properties of the system. * * HWInfo v1 Table (fixed size) * * 0x0000: u32 version Hardware Info Table version (1.0) * 0x0004: u32 size Total size of the table, including * the CRC32 (IEEE 802.3) * 0x0008: u32 jumptab Offset of key/value table * 0x000c: u32 keys Total number of keys in the key/value table * NNNNNN: Key/value jump table and string data * (size - 4): u32 crc32 CRC32 (same as IEEE 802.3, POSIX csum, etc) * CRC32("",0) = ~0, CRC32("a",1) = 0x48C279FE * * HWInfo v2 Table (variable size) * * 0x0000: u32 version Hardware Info Table version (2.0) * 0x0004: u32 size Current size of the data area, excluding CRC32 * 0x0008: u32 limit Maximum size of the table * 0x000c: u32 reserved Unused, set to zero * NNNNNN: Key/value data * (size - 4): u32 crc32 CRC32 (same as IEEE 802.3, POSIX csum, etc) * CRC32("",0) = ~0, CRC32("a",1) = 0x48C279FE * * If the HWInfo table is in the process of being updated, the low bit * of version will be set. * * HWInfo v1 Key/Value Table * ------------------------- * * The key/value table is a set of offsets to ASCIIZ strings which have * been strcmp(3) sorted (yes, please use bsearch(3) on the table). * * All keys are guaranteed to be unique. * * N+0: u32 key_1 Offset to the first key * N+4: u32 val_1 Offset to the first value * N+8: u32 key_2 Offset to the second key * N+c: u32 val_2 Offset to the second value * ... * * HWInfo v2 Key/Value Table * ------------------------- * * Packed UTF8Z strings, ie 'key1\000value1\000key2\000value2\000' * * Unsorted.
*/
/** * nfp_hwinfo_lookup() - Find a value in the HWInfo table by name * @hwinfo: NFP HWinfo table * @lookup: HWInfo name to search for * * Return: Value of the HWInfo name, or NULL
*/ constchar *nfp_hwinfo_lookup(struct nfp_hwinfo *hwinfo, constchar *lookup)
{ constchar *key, *val, *end;
if (!hwinfo || !lookup) return NULL;
end = hwinfo->data + le32_to_cpu(hwinfo->size) - sizeof(u32);
for (key = hwinfo->data; *key && key < end;
key = val + strlen(val) + 1) {
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.