From b30d7ed8f09d4d5d75bf68f3ba74674fe65c4b4f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 16 Oct 2015 14:24:06 -0500 Subject: cpu/amd: Move model_10xxx to family_10h-family_15h Change-Id: I34501d3fc68b71db7781dad11d5b883868932a60 Signed-off-by: Timothy Pearson Reviewed-on: http://review.coreboot.org/11965 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- src/cpu/amd/family_10h-family_15h/ram_calc.c | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/cpu/amd/family_10h-family_15h/ram_calc.c (limited to 'src/cpu/amd/family_10h-family_15h/ram_calc.c') diff --git a/src/cpu/amd/family_10h-family_15h/ram_calc.c b/src/cpu/amd/family_10h-family_15h/ram_calc.c new file mode 100644 index 0000000000..9ac2c993f8 --- /dev/null +++ b/src/cpu/amd/family_10h-family_15h/ram_calc.c @@ -0,0 +1,50 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2015 Timothy Pearson , 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. + */ + +#include +#include +#include + +#include + +#include "ram_calc.h" + +#if !IS_ENABLED(CONFIG_LATE_CBMEM_INIT) +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; +} + +void *cbmem_top(void) +{ + uint32_t topmem = rdmsr(TOP_MEM).lo; + + return (void *) topmem - get_uma_memory_size(topmem); +} +#endif -- cgit v1.2.3