1 /* SPDX-License-Identifier: GPL-2.0-only */
5 * Google VPD decoding routines.
7 * Copyright 2017 Google Inc.
10 #ifndef __VPD_DECODE_H
11 #define __VPD_DECODE_H
13 #include <linux/types.h>
21 VPD_TYPE_TERMINATOR
= 0,
24 VPD_TYPE_IMPLICIT_TERMINATOR
= 0xff,
27 /* Callback for vpd_decode_string to invoke. */
28 typedef int vpd_decode_callback(const u8
*key
, u32 key_len
,
29 const u8
*value
, u32 value_len
,
35 * Given the encoded string, this function invokes callback with extracted
36 * (key, value). The *consumed will be plused the number of bytes consumed in
39 * The input_buf points to the first byte of the input buffer.
41 * The *consumed starts from 0, which is actually the next byte to be decoded.
42 * It can be non-zero to be used in multiple calls.
44 * If one entry is successfully decoded, sends it to callback and returns the
47 int vpd_decode_string(const u32 max_len
, const u8
*input_buf
, u32
*consumed
,
48 vpd_decode_callback callback
, void *callback_arg
);
50 #endif /* __VPD_DECODE_H */