Add logic to sync/preserve MAC and UUID - openbmc-v1.0-stable

This is a port from functionality on master into the stable branch.

The MAC and UUID values are written in the VPD eeprom by the manufacturer.
These values are mirrored to u-boot. During BMC boot, check that the
values in the VPD eeprom and u-boot are the same. If they are different,
use the VPD eeprom value to update u-boot.
Exception is the MAC when it's been set by the admin to have a locally
administered address. In this case the MAC is not updated.
Updating the MAC takes effect immediately, updating the UUID requires a
BMC reboot.

Also add a state dependency between collecting the vpd info into the
inventory, and reading the inventory, by creating a new BMC_STARTING1
state. Creating a BMC_STARTING3 state does not enforce a dependency
because BMC_STARTING2 exits automatically already when some processes
are started up.

Change-Id: I35ca0b96ea645bc2e9a8dc5dd57410fe66f5c841
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/configs/Barreleye.py b/configs/Barreleye.py
index 6403ed6..a4b3203 100644
--- a/configs/Barreleye.py
+++ b/configs/Barreleye.py
@@ -14,6 +14,7 @@
 SYSTEM_STATES = [
 	'BASE_APPS',
 	'BMC_STARTING',
+	'BMC_STARTING1',
 	'BMC_STARTING2',
 	'BMC_READY',
 	'HOST_POWERING_ON',
@@ -198,33 +199,47 @@
 		'process_name'    : 'chassis_control.py',
 	},
 	'board_vpd' : {
-		'system_state'    : 'BMC_STARTING2',
+		'system_state'    : 'BMC_STARTING1',
 		'start_process'   : True,
 		'monitor_process' : False,
-		'process_name'    : 'phosphor-read-eeprom',
-		'args'            : ['--eeprom','/sys/bus/i2c/devices/0-0050/eeprom','--fruid','64'],
+		'process_name'    : 'goto_system_state.py',
+		'args'            : ['BMC_STARTING2','phosphor-read-eeprom','--eeprom','/sys/bus/i2c/devices/0-0050/eeprom','--fruid','64']
 	},
 	'motherboard_vpd' : {
-		'system_state'    : 'BMC_STARTING2',
+		'system_state'    : 'BMC_STARTING1',
 		'start_process'   : True,
 		'monitor_process' : False,
 		'process_name'    : 'phosphor-read-eeprom',
 		'args'            : ['--eeprom','/sys/bus/i2c/devices/4-0054/eeprom','--fruid','3'],
 	},
 	'exp_vpd' : {
-		'system_state'    : 'BMC_STARTING2',
+		'system_state'    : 'BMC_STARTING1',
 		'start_process'   : True,
 		'monitor_process' : False,
 		'process_name'    : 'phosphor-read-eeprom',
 		'args'            : ['--eeprom','/sys/bus/i2c/devices/6-0051/eeprom','--fruid','65'],
 	},
 	'hdd_vpd' : {
-		'system_state'    : 'BMC_STARTING2',
+		'system_state'    : 'BMC_STARTING1',
 		'start_process'   : True,
 		'monitor_process' : False,
 		'process_name'    : 'phosphor-read-eeprom',
 		'args'            : ['--eeprom','/sys/bus/i2c/devices/6-0055/eeprom','--fruid','66'],
 	},
+	'sync_mac' : {
+		'system_state'    : 'BMC_READY',
+		'start_process'   : True,
+		'monitor_process' : False,
+		'process_name'    : 'sync_inventory_items.py',
+		'args'            : ['-t','DAUGHTER_CARD','-n','io_board','-p','Custom Field 2','-s','mac'],
+	},
+	'sync_uuid' : {
+		'system_state'    : 'BMC_READY',
+		'start_process'   : True,
+		'monitor_process' : False,
+		'process_name'    : 'sync_inventory_items.py',
+		'args'            : ['-t','MAIN_PLANAR','-n','motherboard','-p','Custom Field 1','-s','uuid'],
+	},
 	'restore' : {
 		'system_state'    : 'BMC_READY',
 		'start_process'   : True,