[coreboot] New patch to review for coreboot: c19b79a amd CPU: add funtion disable_cache_as_ram_and_enable_cache()

Siyuan Wang (wangsiyuanbuaa@gmail.com) gerrit at coreboot.org
Mon Oct 29 11:07:07 CET 2012


Siyuan Wang (wangsiyuanbuaa at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1653

-gerrit

commit c19b79a8ee4348d6c6897a60adec124f8a41a7f2
Author: Siyuan Wang <wangsiyuanbuaa at gmail.com>
Date:   Mon Oct 29 18:34:42 2012 +0800

    amd CPU: add funtion disable_cache_as_ram_and_enable_cache()
    
    Now, the mainboard use two functions disable_cache_as_ram()
    and enable_cache(). someone think enable_cache() should move to
    disable_cache_as_ram(). but there are 2 problems:
    1) disable_cache_as_ram is written by assembler language and
    enable_cache. if we put them in one function, we have to use
    inline assembler. also, enable_cache does not waste time because
    it is inline function. so we don't need to rewrite this function
    by inline.
    2) if we put these two function together, the name disable_cache_as_ram
    would not suitable.
    3) some boards have use these two functions. if we changed, these
    boards may run into problem
    
    I think src/cpu/amd/car/ is the right place to add this function.
    
    let the coreboot community to decide which one is better,
    my new method or using two functions.
    
    Change-Id: I99b381e183b80b7b202428ad796e623e9de016fe
    Signed-off-by: Siyuan Wang <SiYuan.Wang at amd.com>
    Signed-off-by: Siyuan Wang <wangsiyuanbuaa at gmail.com>
---
 .../car/disable_cache_as_ram_and_enable_cache.h    | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/src/cpu/amd/car/disable_cache_as_ram_and_enable_cache.h b/src/cpu/amd/car/disable_cache_as_ram_and_enable_cache.h
new file mode 100644
index 0000000..0921a53
--- /dev/null
+++ b/src/cpu/amd/car/disable_cache_as_ram_and_enable_cache.h
@@ -0,0 +1,29 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * original idea yhlu 6.2005 (assembler code)
+ *
+ * Copyright (C) 2010 Rudolf Marek <r.marek at assembler.cz>
+ *
+ * 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
+ *
+ * be warned, this file will be used other cores and core 0 / node 0
+ */
+
+extern void disable_cache_as_ram(void); /* cache_as_ram.inc */
+static inline __attribute__((always_inline)) void disable_cache_as_ram_and_enable_cache(void)
+{
+	disable_cache_as_ram();
+	enable_cache();
+}




More information about the coreboot mailing list