2013-11-04 13:04:59 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2013
|
|
|
|
* Heiko Schocher, DENX Software Engineering, hs@denx.de.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2017-08-03 18:22:08 +00:00
|
|
|
#include <environment.h>
|
2013-11-04 13:04:59 +00:00
|
|
|
|
|
|
|
void bootcount_store(ulong a)
|
|
|
|
{
|
2017-08-03 18:22:13 +00:00
|
|
|
int upgrade_available = env_get_ulong("upgrade_available", 10, 0);
|
2013-11-04 13:04:59 +00:00
|
|
|
|
|
|
|
if (upgrade_available) {
|
2017-08-03 18:22:10 +00:00
|
|
|
env_set_ulong("bootcount", a);
|
2017-08-03 18:22:08 +00:00
|
|
|
env_save();
|
2013-11-04 13:04:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ulong bootcount_load(void)
|
|
|
|
{
|
2017-08-03 18:22:13 +00:00
|
|
|
int upgrade_available = env_get_ulong("upgrade_available", 10, 0);
|
2013-11-04 13:04:59 +00:00
|
|
|
ulong val = 0;
|
|
|
|
|
|
|
|
if (upgrade_available)
|
2017-08-03 18:22:13 +00:00
|
|
|
val = env_get_ulong("bootcount", 10, 0);
|
2013-11-04 13:04:59 +00:00
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|