coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
vpd_decode.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-3-Clause */
2
3
/*
4
* This is a copy from upstream:
5
* https://chromium.googlesource.com/chromiumos/platform/vpd/+/master/include/lib/vpd_decode.h
6
*/
7
8
#ifndef __VPD_DECODE_H
9
#define __VPD_DECODE_H
10
11
#include <
stdint.h
>
12
13
enum
{
14
VPD_DECODE_OK
= 0,
15
VPD_DECODE_FAIL
= 1,
16
};
17
18
enum
{
19
VPD_TYPE_TERMINATOR
= 0,
20
VPD_TYPE_STRING
,
21
VPD_TYPE_INFO
= 0xfe,
22
VPD_TYPE_IMPLICIT_TERMINATOR
= 0xff,
23
};
24
25
/* Callback for vpd_decode_string to invoke. */
26
typedef
int
vpd_decode_callback
(
27
const
u8
*key,
u32
key_len,
const
u8
*
value
,
u32
value_len,
28
void
*
arg
);
29
30
/*
31
* vpd_decode_string
32
*
33
* Given the encoded string, this function invokes callback with extracted
34
* (key, value). The *consumed will be incremented by the number of bytes
35
* consumed in this function.
36
*
37
* The input_buf points to the first byte of the input buffer.
38
*
39
* The *consumed starts from 0, which is actually the next byte to be decoded.
40
* It can be non-zero to be used in multiple calls.
41
*
42
* If one entry is successfully decoded, sends it to callback and returns the
43
* result.
44
*/
45
int
vpd_decode_string
(
46
const
u32
max_len,
const
u8
*input_buf,
u32
*consumed,
47
vpd_decode_callback
callback,
void
*callback_arg);
48
49
#endif
/* __VPD_DECODE_H */
value
pte_t value
Definition:
mmu.c:91
arg
struct bootblock_arg arg
Definition:
decompressor.c:22
stdint.h
u32
uint32_t u32
Definition:
stdint.h:51
u8
uint8_t u8
Definition:
stdint.h:45
VPD_TYPE_IMPLICIT_TERMINATOR
@ VPD_TYPE_IMPLICIT_TERMINATOR
Definition:
vpd_decode.h:22
VPD_TYPE_STRING
@ VPD_TYPE_STRING
Definition:
vpd_decode.h:20
VPD_TYPE_INFO
@ VPD_TYPE_INFO
Definition:
vpd_decode.h:21
VPD_TYPE_TERMINATOR
@ VPD_TYPE_TERMINATOR
Definition:
vpd_decode.h:19
VPD_DECODE_OK
@ VPD_DECODE_OK
Definition:
vpd_decode.h:14
VPD_DECODE_FAIL
@ VPD_DECODE_FAIL
Definition:
vpd_decode.h:15
vpd_decode_string
int vpd_decode_string(const u32 max_len, const u8 *input_buf, u32 *consumed, vpd_decode_callback callback, void *callback_arg)
Definition:
vpd_decode.c:56
vpd_decode_callback
int vpd_decode_callback(const u8 *key, u32 key_len, const u8 *value, u32 value_len, void *arg)
Definition:
vpd_decode.h:26
src
drivers
vpd
vpd_decode.h
Generated by
1.9.1