aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/x86/cpu/mtrr.c6
-rw-r--r--arch/x86/include/asm/cb_sysinfo.h4
-rw-r--r--arch/x86/lib/coreboot/cb_sysinfo.c4
-rw-r--r--arch/x86/lib/fsp/fsp_graphics.c3
-rw-r--r--arch/x86/lib/init_helpers.c6
-rw-r--r--cmd/x86/cbsysinfo.c5
-rw-r--r--drivers/video/broadwell_igd.c10
-rw-r--r--drivers/video/ivybridge_igd.c3
-rw-r--r--drivers/video/vesa.c3
9 files changed, 24 insertions, 20 deletions
diff --git a/arch/x86/cpu/mtrr.c b/arch/x86/cpu/mtrr.c
index d57fcface01..9c24ae984e9 100644
--- a/arch/x86/cpu/mtrr.c
+++ b/arch/x86/cpu/mtrr.c
@@ -166,8 +166,12 @@ int mtrr_commit(bool do_caches)
debug("open done\n");
qsort(req, gd->arch.mtrr_req_count, sizeof(*req), h_comp_mtrr);
for (i = 0; i < gd->arch.mtrr_req_count; i++, req++)
- mtrr_set_next_var(req->type, req->start, req->size);
+ set_var_mtrr(i, req->type, req->start, req->size);
+ /* Clear the ones that are unused */
+ debug("clear\n");
+ for (; i < mtrr_get_var_count(); i++)
+ wrmsrl(MTRR_PHYS_MASK_MSR(i), 0);
debug("close\n");
mtrr_close(&state, do_caches);
debug("mtrr done\n");
diff --git a/arch/x86/include/asm/cb_sysinfo.h b/arch/x86/include/asm/cb_sysinfo.h
index 2c78b22d0d2..12fa395ffd2 100644
--- a/arch/x86/include/asm/cb_sysinfo.h
+++ b/arch/x86/include/asm/cb_sysinfo.h
@@ -138,6 +138,8 @@
* @rsdp: Pointer to ACPI RSDP table
* @unimpl_count: Number of entries in unimpl_map[]
* @unimpl: List of unimplemented IDs (bottom 8 bits only)
+ * @table_size: Number of bytes taken up by the sysinfo table
+ * @rec_count: Number of records in the sysinfo table
*/
struct sysinfo_t {
unsigned int cpu_khz;
@@ -219,6 +221,8 @@ struct sysinfo_t {
void *rsdp;
u32 unimpl_count;
u8 unimpl[SYSINFO_MAX_UNIMPL];
+ uint table_size;
+ uint rec_count;
};
extern struct sysinfo_t lib_sysinfo;
diff --git a/arch/x86/lib/coreboot/cb_sysinfo.c b/arch/x86/lib/coreboot/cb_sysinfo.c
index 42cc3a128d9..dfbc80c430e 100644
--- a/arch/x86/lib/coreboot/cb_sysinfo.c
+++ b/arch/x86/lib/coreboot/cb_sysinfo.c
@@ -447,6 +447,8 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
ptr += rec->size;
}
+ info->table_size += (void *)ptr - (void *)header;
+ info->rec_count += header->table_entries;
return 1;
}
@@ -462,6 +464,8 @@ int get_coreboot_info(struct sysinfo_t *info)
addr = locate_coreboot_table();
if (addr < 0)
return addr;
+ info->table_size = 0;
+ info->rec_count = 0;
ret = cb_parse_header((void *)addr, 0x1000, info);
if (!ret)
return -ENOENT;
diff --git a/arch/x86/lib/fsp/fsp_graphics.c b/arch/x86/lib/fsp/fsp_graphics.c
index 2bcc49f6051..09d5da8c841 100644
--- a/arch/x86/lib/fsp/fsp_graphics.c
+++ b/arch/x86/lib/fsp/fsp_graphics.c
@@ -110,8 +110,7 @@ static int fsp_video_probe(struct udevice *dev)
if (ret)
goto err;
- mtrr_add_request(MTRR_TYPE_WRCOMB, vesa->phys_base_ptr, 256 << 20);
- mtrr_commit(true);
+ mtrr_set_next_var(MTRR_TYPE_WRCOMB, vesa->phys_base_ptr, 256 << 20);
printf("%dx%dx%d @ %x\n", uc_priv->xsize, uc_priv->ysize,
vesa->bits_per_pixel, vesa->phys_base_ptr);
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
index f33194045f9..60a2707dcf1 100644
--- a/arch/x86/lib/init_helpers.c
+++ b/arch/x86/lib/init_helpers.c
@@ -21,8 +21,7 @@ int init_cache_f_r(void)
/*
* Supported configurations:
*
- * booting from slimbootloader - in that case the MTRRs are already set
- * up
+ * booting from slimbootloader - MTRRs are already set up
* booting with FSPv1 - MTRRs are already set up
* booting with FSPv2 - MTRRs must be set here
* booting from coreboot - in this case there is no SPL, so we set up
@@ -30,8 +29,7 @@ int init_cache_f_r(void)
* Note: if there is an SPL, then it has already set up MTRRs so we
* don't need to do that here
*/
- do_mtrr &= !IS_ENABLED(CONFIG_SPL) &&
- !IS_ENABLED(CONFIG_FSP_VERSION1) &&
+ do_mtrr &= !IS_ENABLED(CONFIG_FSP_VERSION1) &&
!IS_ENABLED(CONFIG_SYS_SLIMBOOTLOADER);
if (do_mtrr) {
diff --git a/cmd/x86/cbsysinfo.c b/cmd/x86/cbsysinfo.c
index 2b8d3b0a435..84822a3e321 100644
--- a/cmd/x86/cbsysinfo.c
+++ b/cmd/x86/cbsysinfo.c
@@ -190,8 +190,9 @@ static void show_table(struct sysinfo_t *info, bool verbose)
struct cb_serial *ser = info->serial;
int i;
- printf("Coreboot table at %lx, decoded to %p",
- gd->arch.coreboot_table, info);
+ printf("Coreboot table at %lx, size %x, records %x (dec %d), decoded to %p",
+ gd->arch.coreboot_table, info->table_size, info->rec_count,
+ info->rec_count, info);
if (info->header)
printf(", forwarded to %p\n", info->header);
printf("\n");
diff --git a/drivers/video/broadwell_igd.c b/drivers/video/broadwell_igd.c
index 6aa4e27071d..83b6c908a8d 100644
--- a/drivers/video/broadwell_igd.c
+++ b/drivers/video/broadwell_igd.c
@@ -693,13 +693,9 @@ static int broadwell_igd_probe(struct udevice *dev)
/* Use write-combining for the graphics memory, 256MB */
fbbase = IS_ENABLED(CONFIG_VIDEO_COPY) ? plat->copy_base : plat->base;
- ret = mtrr_add_request(MTRR_TYPE_WRCOMB, fbbase, 256 << 20);
- if (!ret)
- ret = mtrr_commit(true);
- if (ret && ret != -ENOSYS) {
- printf("Failed to add MTRR: Display will be slow (err %d)\n",
- ret);
- }
+ ret = mtrr_set_next_var(MTRR_TYPE_WRCOMB, fbbase, 256 << 20);
+ if (ret)
+ printf("Failed to add MTRR: Display will be slow (err %d)\n", ret);
debug("fb=%lx, size %x, display size=%d %d %d\n", plat->base,
plat->size, uc_priv->xsize, uc_priv->ysize, uc_priv->bpix);
diff --git a/drivers/video/ivybridge_igd.c b/drivers/video/ivybridge_igd.c
index 9264dd6770d..c2cc976618a 100644
--- a/drivers/video/ivybridge_igd.c
+++ b/drivers/video/ivybridge_igd.c
@@ -774,8 +774,7 @@ static int bd82x6x_video_probe(struct udevice *dev)
/* Use write-combining for the graphics memory, 256MB */
fbbase = IS_ENABLED(CONFIG_VIDEO_COPY) ? plat->copy_base : plat->base;
- mtrr_add_request(MTRR_TYPE_WRCOMB, fbbase, 256 << 20);
- mtrr_commit(true);
+ mtrr_set_next_var(MTRR_TYPE_WRCOMB, fbbase, 256 << 20);
return 0;
}
diff --git a/drivers/video/vesa.c b/drivers/video/vesa.c
index cac3bb0c331..50912c5c8bc 100644
--- a/drivers/video/vesa.c
+++ b/drivers/video/vesa.c
@@ -23,8 +23,7 @@ static int vesa_video_probe(struct udevice *dev)
/* Use write-combining for the graphics memory, 256MB */
fbbase = IS_ENABLED(CONFIG_VIDEO_COPY) ? plat->copy_base : plat->base;
- mtrr_add_request(MTRR_TYPE_WRCOMB, fbbase, 256 << 20);
- mtrr_commit(true);
+ mtrr_set_next_var(MTRR_TYPE_WRCOMB, fbbase, 256 << 20);
return 0;
}