mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-18 06:58:54 +00:00
x86: Add a new global_data member for the cache record
At present we reuse the mrc_output char * to also point to the cache record after it has been set up. This is confusing and doesn't save much data space. Add a new mrc_cache member instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
506f224977
commit
37a508f8b7
2 changed files with 7 additions and 6 deletions
|
@ -10,6 +10,7 @@
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
|
#include <asm/mrccache.h>
|
||||||
|
|
||||||
enum pei_boot_mode_t {
|
enum pei_boot_mode_t {
|
||||||
PEI_BOOT_NONE = 0,
|
PEI_BOOT_NONE = 0,
|
||||||
|
@ -93,6 +94,7 @@ struct arch_global_data {
|
||||||
/* MRC training data to save for the next boot */
|
/* MRC training data to save for the next boot */
|
||||||
char *mrc_output;
|
char *mrc_output;
|
||||||
unsigned int mrc_output_len;
|
unsigned int mrc_output_len;
|
||||||
|
struct mrc_data_container *mrc_cache;
|
||||||
ulong table; /* Table pointer from previous loader */
|
ulong table; /* Table pointer from previous loader */
|
||||||
int turbo_state; /* Current turbo state */
|
int turbo_state; /* Current turbo state */
|
||||||
struct irq_routing_table *pirq_routing_table;
|
struct irq_routing_table *pirq_routing_table;
|
||||||
|
|
|
@ -188,8 +188,7 @@ static void mrccache_setup(void *data)
|
||||||
cache->reserved = 0;
|
cache->reserved = 0;
|
||||||
memcpy(cache->data, gd->arch.mrc_output, cache->data_size);
|
memcpy(cache->data, gd->arch.mrc_output, cache->data_size);
|
||||||
|
|
||||||
/* gd->arch.mrc_output now points to the container */
|
gd->arch.mrc_cache = cache;
|
||||||
gd->arch.mrc_output = (char *)cache;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int mrccache_reserve(void)
|
int mrccache_reserve(void)
|
||||||
|
@ -255,7 +254,7 @@ int mrccache_get_region(struct udevice **devp, struct mrc_region *entry)
|
||||||
|
|
||||||
int mrccache_save(void)
|
int mrccache_save(void)
|
||||||
{
|
{
|
||||||
struct mrc_data_container *data;
|
struct mrc_data_container *cache;
|
||||||
struct mrc_region entry;
|
struct mrc_region entry;
|
||||||
struct udevice *sf;
|
struct udevice *sf;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -271,10 +270,10 @@ int mrccache_save(void)
|
||||||
ret = device_probe(sf);
|
ret = device_probe(sf);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_entry;
|
goto err_entry;
|
||||||
data = (struct mrc_data_container *)gd->arch.mrc_output;
|
cache = gd->arch.mrc_cache;
|
||||||
ret = mrccache_update(sf, &entry, data);
|
ret = mrccache_update(sf, &entry, cache);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
debug("Saved MRC data with checksum %04x\n", data->checksum);
|
debug("Saved MRC data with checksum %04x\n", cache->checksum);
|
||||||
} else if (ret == -EEXIST) {
|
} else if (ret == -EEXIST) {
|
||||||
debug("MRC data is the same as last time, skipping save\n");
|
debug("MRC data is the same as last time, skipping save\n");
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue