4 * Google VPD decoding routines.
6 * Copyright 2017 Google Inc.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License v2.0 as published by
10 * the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
18 #ifndef __VPD_DECODE_H
19 #define __VPD_DECODE_H
21 #include <linux/types.h>
29 VPD_TYPE_TERMINATOR
= 0,
32 VPD_TYPE_IMPLICIT_TERMINATOR
= 0xff,
35 /* Callback for vpd_decode_string to invoke. */
36 typedef int vpd_decode_callback(const u8
*key
, s32 key_len
,
37 const u8
*value
, s32 value_len
,
43 * Given the encoded string, this function invokes callback with extracted
44 * (key, value). The *consumed will be plused the number of bytes consumed in
47 * The input_buf points to the first byte of the input buffer.
49 * The *consumed starts from 0, which is actually the next byte to be decoded.
50 * It can be non-zero to be used in multiple calls.
52 * If one entry is successfully decoded, sends it to callback and returns the
55 int vpd_decode_string(const s32 max_len
, const u8
*input_buf
, s32
*consumed
,
56 vpd_decode_callback callback
, void *callback_arg
);
58 #endif /* __VPD_DECODE_H */