- MTRR fixes for x86 boards

- Add a little more info to 'cbsysinfo' command
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEUEWE0gAMrH0ckwrwqSElQ6ZwxhQFAmTIbdEACgkQqSElQ6Zw
 xhSTCg//TESlLII0mIDIP/Ahoac0qBcALRLPiZNzIG8cUtETsLblwQ4ndCyRNohI
 EbRAWdZasVB0mn1wpLX58FjeCpz7u73pS+RIdY4YnkGWCebGO1E04fRPWk1euT6N
 PsJSfQ4WUXbPOsP89AVDmYQ7KgbdgW7CcN4iRp931h5+Xy2OMjMNlHrBE/iXToaL
 wsGU+WM+KPjqt/Z79goyWSm997wXyLzM844f14/Cv+GnZUsaLKDMdW4S7eyM7OSk
 tqkTyq/L5Yf15G3gzVBZzXk5PgcfoXugOelfr5m+yQLUIXJIR5c+yptqwKuQ4MM/
 PEuL7+3ytodpG1lEVtqAxg08/AQYGr6CpTMXPOZXbsaaQYQcVG/V28eMchgQF/YD
 3lE0ZKSv/t6Ar6iRwKsZE5f+8DslnGip5W41mEBEIgSYyt7yXO0p+cQxkPcArK1E
 qyQIESmiPF3GaWarAtNWyoASVFLtIXiUaSne2lnvKP4vNlM36/rB72Ii6OX7sSZZ
 Xm4yEBeDpNqMQ99QjQurSFOzwQY+BULlNL36h4mWZALKNONWhXL0N/0JcWFJBl+t
 ha84lQwr+u/7J+ZSjNNNH4bXJOYyuZBFDl27btSgHN046iJioobf8jgbbx2WxQ5P
 khbcYliKf678Xi/HCQD3CyYmyCYw5VHlUTyQlbgCeC6GQumZwnY=
 =s8Ab
 -----END PGP SIGNATURE-----

Merge tag 'x86-pull-20230801' of https://source.denx.de/u-boot/custodians/u-boot-x86

- MTRR fixes for x86 boards
- Add a little more info to 'cbsysinfo' command
This commit is contained in:
Tom Rini 2023-08-01 11:57:55 -04:00
commit 7755b22007
9 changed files with 24 additions and 20 deletions

View file

@ -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");

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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) {

View file

@ -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");

View file

@ -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);

View file

@ -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;
}

View file

@ -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;
}