cpu/amd/model_10xxx: Move GFXUMA size calculation to separate function
This is required for early CBMEM support. Change-Id: I31d9b6a04ef963a7d3e045d9c5201ae64604218a Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com> Reviewed-on: http://review.coreboot.org/8663 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
This commit is contained in:
parent
447240808c
commit
4916880511
|
@ -3,6 +3,8 @@ ramstage-y += model_10xxx_init.c
|
||||||
ramstage-y += processor_name.c
|
ramstage-y += processor_name.c
|
||||||
|
|
||||||
romstage-y += update_microcode.c
|
romstage-y += update_microcode.c
|
||||||
|
romstage-y += ram_calc.c
|
||||||
|
ramstage-y += ram_calc.c
|
||||||
ramstage-y += monotonic_timer.c
|
ramstage-y += monotonic_timer.c
|
||||||
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += powernow_acpi.c
|
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += powernow_acpi.c
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the coreboot project.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering
|
||||||
|
* Copyright (C) 2007 Advanced Micro Devices, Inc.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; version 2 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <cpu/cpu.h>
|
||||||
|
#include <cpu/x86/msr.h>
|
||||||
|
#include <cpu/amd/mtrr.h>
|
||||||
|
|
||||||
|
#include "ram_calc.h"
|
||||||
|
|
||||||
|
uint64_t get_uma_memory_size(uint64_t topmem)
|
||||||
|
{
|
||||||
|
uint64_t uma_size = 0;
|
||||||
|
if (IS_ENABLED(CONFIG_GFXUMA)) {
|
||||||
|
/* refer to UMA Size Consideration in 780 BDG. */
|
||||||
|
if (topmem > 0x40000000) /* 1GB and above system memory */
|
||||||
|
uma_size = 0x10000000; /* 256M recommended UMA */
|
||||||
|
|
||||||
|
else if (topmem > 0x20000000) /* 512M - 1023M system memory */
|
||||||
|
uma_size = 0x8000000; /* 128M recommended UMA */
|
||||||
|
|
||||||
|
else if (topmem > 0x10000000) /* 256M - 511M system memory */
|
||||||
|
uma_size = 0x4000000; /* 64M recommended UMA */
|
||||||
|
}
|
||||||
|
|
||||||
|
return uma_size;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the coreboot project.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; version 2 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _AMD_MODEL_10XXX_RAM_CALC_H_
|
||||||
|
#define _AMD_MODEL_10XXX_RAM_CALC_H_
|
||||||
|
|
||||||
|
uint64_t get_uma_memory_size(uint64_t topmem);
|
||||||
|
|
||||||
|
#endif
|
|
@ -33,6 +33,7 @@
|
||||||
#include <cpu/x86/lapic.h>
|
#include <cpu/x86/lapic.h>
|
||||||
#include <cpu/amd/mtrr.h>
|
#include <cpu/amd/mtrr.h>
|
||||||
#include <cpu/amd/amdfam10_sysconf.h>
|
#include <cpu/amd/amdfam10_sysconf.h>
|
||||||
|
#include <cpu/amd/model_10xxx/ram_calc.h>
|
||||||
|
|
||||||
#if CONFIG_LOGICAL_CPUS
|
#if CONFIG_LOGICAL_CPUS
|
||||||
#include <cpu/amd/multicore.h>
|
#include <cpu/amd/multicore.h>
|
||||||
|
@ -740,21 +741,7 @@ static void setup_uma_memory(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_GFXUMA
|
#if CONFIG_GFXUMA
|
||||||
uint32_t topmem = (uint32_t) bsp_topmem();
|
uint32_t topmem = (uint32_t) bsp_topmem();
|
||||||
/* refer to UMA Size Consideration in 780 BDG. */
|
uma_memory_size = get_uma_memory_size(topmem);
|
||||||
switch (topmem) {
|
|
||||||
case 0x10000000: /* 256M system memory */
|
|
||||||
uma_memory_size = 0x4000000; /* 64M recommended UMA */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x20000000: /* 512M system memory */
|
|
||||||
uma_memory_size = 0x8000000; /* 128M recommended UMA */
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: /* 1GB and above system memory */
|
|
||||||
uma_memory_size = 0x10000000; /* 256M recommended UMA */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
uma_memory_base = topmem - uma_memory_size; /* TOP_MEM1 */
|
uma_memory_base = topmem - uma_memory_size; /* TOP_MEM1 */
|
||||||
printk(BIOS_INFO, "%s: uma size 0x%08llx, memory start 0x%08llx\n",
|
printk(BIOS_INFO, "%s: uma size 0x%08llx, memory start 0x%08llx\n",
|
||||||
__func__, uma_memory_size, uma_memory_base);
|
__func__, uma_memory_size, uma_memory_base);
|
||||||
|
|
Loading…
Reference in New Issue