Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Martyn Welch | b418dfe | 2017-11-08 15:35:15 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2016 General Electric Company |
Martyn Welch | b418dfe | 2017-11-08 15:35:15 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include "common.h" |
| 7 | |
Denis Zalevskiy | 4dcbccf | 2018-10-17 10:33:30 +0200 | [diff] [blame] | 8 | struct vpd_cache; |
| 9 | |
Martyn Welch | b418dfe | 2017-11-08 15:35:15 +0000 | [diff] [blame] | 10 | /* |
Denis Zalevskiy | 4dcbccf | 2018-10-17 10:33:30 +0200 | [diff] [blame] | 11 | * Read VPD from given data, verify content, call callback for each vital |
| 12 | * product data block. |
| 13 | * |
| 14 | * cache: structure used by process block to store VPD information |
| 15 | * process_block: callback called for each VPD data block |
Martyn Welch | b418dfe | 2017-11-08 15:35:15 +0000 | [diff] [blame] | 16 | * |
| 17 | * Returns Non-zero on error. Negative numbers encode errno. |
| 18 | */ |
Sebastian Reichel | def6f53 | 2020-09-02 19:31:45 +0200 | [diff] [blame] | 19 | int read_i2c_vpd(struct vpd_cache *cache, |
| 20 | int (*process_block)(struct vpd_cache *, u8 id, u8 version, |
| 21 | u8 type, size_t size, u8 const *data)); |
| 22 | |
| 23 | /* |
| 24 | * Read VPD from given data, verify content, call callback for each vital |
| 25 | * product data block. |
| 26 | * |
| 27 | * size: size of the raw VPD data in bytes |
| 28 | * data: raw VPD data read from device |
| 29 | * cache: structure used by process block to store VPD information |
| 30 | * process_block: callback called for each VPD data block |
| 31 | * |
| 32 | * Returns Non-zero on error. Negative numbers encode errno. |
| 33 | */ |
| 34 | |
| 35 | int vpd_reader(size_t size, u8 *data, struct vpd_cache *cache, |
| 36 | int (*process_block)(struct vpd_cache *, u8 id, u8 version, u8 type, |
| 37 | size_t size, u8 const *data)); |