xref: /openbmc/u-boot/include/eeprom_layout.h (revision a7da6f8c)
1 /*
2  * (C) Copyright 2009-2016 CompuLab, Ltd.
3  *
4  * Authors: Nikita Kiryanov <nikita@compulab.co.il>
5  *	    Igor Grinberg <grinberg@compulab.co.il>
6  *
7  * SPDX-License-Identifier:	GPL-2.0+
8  */
9 
10 #ifndef _LAYOUT_
11 #define _LAYOUT_
12 
13 #define RESERVED_FIELDS			NULL
14 #define LAYOUT_VERSION_UNRECOGNIZED	-1
15 #define LAYOUT_VERSION_AUTODETECT	-2
16 
17 struct eeprom_layout {
18 	struct eeprom_field *fields;
19 	int num_of_fields;
20 	int layout_version;
21 	unsigned char *data;
22 	int data_size;
23 	void (*print)(const struct eeprom_layout *eeprom_layout);
24 	int (*update)(struct eeprom_layout *eeprom_layout, char *field_name,
25 		      char *new_data);
26 };
27 
28 void eeprom_layout_setup(struct eeprom_layout *layout, unsigned char *buf,
29 			 unsigned int buf_size, int layout_version);
30 __weak void __eeprom_layout_assign(struct eeprom_layout *layout,
31 				   int layout_version);
32 
33 #endif
34