/* SPDX-License-Identifier: GPL-2.0-only */1/*2* vpd_decode.h3*4* Google VPD decoding routines.5*6* Copyright 2017 Google Inc.7*/89#ifndef __VPD_DECODE_H10#define __VPD_DECODE_H1112#include <linux/types.h>1314enum {15VPD_OK = 0,16VPD_FAIL,17};1819enum {20VPD_TYPE_TERMINATOR = 0,21VPD_TYPE_STRING,22VPD_TYPE_INFO = 0xfe,23VPD_TYPE_IMPLICIT_TERMINATOR = 0xff,24};2526/* Callback for vpd_decode_string to invoke. */27typedef int vpd_decode_callback(const u8 *key, u32 key_len,28const u8 *value, u32 value_len,29void *arg);3031/*32* vpd_decode_string33*34* Given the encoded string, this function invokes callback with extracted35* (key, value). The *consumed will be plused the number of bytes consumed in36* this function.37*38* The input_buf points to the first byte of the input buffer.39*40* The *consumed starts from 0, which is actually the next byte to be decoded.41* It can be non-zero to be used in multiple calls.42*43* If one entry is successfully decoded, sends it to callback and returns the44* result.45*/46int vpd_decode_string(const u32 max_len, const u8 *input_buf, u32 *consumed,47vpd_decode_callback callback, void *callback_arg);4849#endif /* __VPD_DECODE_H */505152