1 /* 2 * (C) Copyright 2013 3 * Heiko Schocher, DENX Software Engineering, hs@denx.de. 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8 #include <common.h> 9 10 void bootcount_store(ulong a) 11 { 12 int upgrade_available = getenv_ulong("upgrade_available", 10, 0); 13 14 if (upgrade_available) { 15 setenv_ulong("bootcount", a); 16 saveenv(); 17 } 18 } 19 20 ulong bootcount_load(void) 21 { 22 int upgrade_available = getenv_ulong("upgrade_available", 10, 0); 23 ulong val = 0; 24 25 if (upgrade_available) 26 val = getenv_ulong("bootcount", 10, 0); 27 28 return val; 29 } 30