Added a fix for newly-initialized NVR on the Lucky Star 486 and AMI Apollo.

This commit is contained in:
OBattler
2021-04-25 18:47:33 +02:00
parent 4fb1c8e51f
commit b4c2a657a1
3 changed files with 15 additions and 6 deletions

View File

@@ -262,13 +262,15 @@ nvr_load(void)
path = nvr_path(saved_nvr->fn);
nvr_log("NVR: loading from '%s'\n", path);
fp = plat_fopen(path, "rb");
saved_nvr->new = (fp == NULL);
if (fp != NULL) {
/* Read NVR contents from file. */
if (fread(saved_nvr->regs, 1, saved_nvr->size, fp) != saved_nvr->size)
fatal("nvr_load(): Error reading data\n");
(void)fclose(fp);
}
}
} else
saved_nvr->new = 1;
/* Get the local RTC running! */
if (saved_nvr->start != NULL)