From ca50b77decfb39b1bd8f75f5b21643e7394768e8 Mon Sep 17 00:00:00 2001 From: Nandkumar Joshi Date: Fri, 21 Aug 2020 01:32:05 +0530 Subject: [PATCH] Removed 'fu540' specific cache driver references. Replaced with more generic cache driver defines for hifive unleashed. --- Makefile.am | 3 - Makefile.in | 22 ----- bare_header/freedom-bare_header-generator.c++ | 2 - bare_header/sifive_ccache0.h | 68 ++++++++------ bare_header/sifive_fu540_c000_l2.h | 40 --------- .../freedom-metal_header-generator.c++ | 6 -- metal_header/sifive_ccache0.c++ | 4 +- metal_header/sifive_fu540_c000_l2.c++ | 88 ------------------- metal_header/sifive_fu540_c000_l2.h | 22 ----- 9 files changed, 45 insertions(+), 210 deletions(-) delete mode 100644 bare_header/sifive_fu540_c000_l2.h delete mode 100644 metal_header/sifive_fu540_c000_l2.c++ delete mode 100644 metal_header/sifive_fu540_c000_l2.h diff --git a/Makefile.am b/Makefile.am index b66ba4f6..ceed83fd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,8 +46,6 @@ freedom_metal_header_generator_SOURCES = \ metal_header/sifive_fe310_g000_pll.h \ metal_header/sifive_fe310_g000_prci.c++ \ metal_header/sifive_fe310_g000_prci.h \ - metal_header/sifive_fu540_c000_l2.c++ \ - metal_header/sifive_fu540_c000_l2.h \ metal_header/sifive_global_external_interrupts0.c++ \ metal_header/sifive_global_external_interrupts0.h \ metal_header/sifive_gpio0.c++ \ @@ -109,7 +107,6 @@ freedom_bare_header_generator_SOURCES = \ bare_header/sifive_fe310_g000_lfrosc.h \ bare_header/sifive_fe310_g000_prci.h \ bare_header/sifive_fe310_g000_pll.h \ - bare_header/sifive_fu540_c000_l2.h \ bare_header/sifive_global_external_interrupts0.h \ bare_header/sifive_gpio0.h \ bare_header/sifive_gpio_buttons.h \ diff --git a/Makefile.in b/Makefile.in index 73cc1e01..1d242ddb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -136,7 +136,6 @@ am_freedom_metal_header_generator_OBJECTS = \ metal_header/freedom_metal_header_generator-sifive_fe310_g000_lfrosc.$(OBJEXT) \ metal_header/freedom_metal_header_generator-sifive_fe310_g000_pll.$(OBJEXT) \ metal_header/freedom_metal_header_generator-sifive_fe310_g000_prci.$(OBJEXT) \ - metal_header/freedom_metal_header_generator-sifive_fu540_c000_l2.$(OBJEXT) \ metal_header/freedom_metal_header_generator-sifive_global_external_interrupts0.$(OBJEXT) \ metal_header/freedom_metal_header_generator-sifive_gpio0.$(OBJEXT) \ metal_header/freedom_metal_header_generator-sifive_gpio_button.$(OBJEXT) \ @@ -590,8 +589,6 @@ freedom_metal_header_generator_SOURCES = \ metal_header/sifive_fe310_g000_pll.h \ metal_header/sifive_fe310_g000_prci.c++ \ metal_header/sifive_fe310_g000_prci.h \ - metal_header/sifive_fu540_c000_l2.c++ \ - metal_header/sifive_fu540_c000_l2.h \ metal_header/sifive_global_external_interrupts0.c++ \ metal_header/sifive_global_external_interrupts0.h \ metal_header/sifive_gpio0.c++ \ @@ -652,7 +649,6 @@ freedom_bare_header_generator_SOURCES = \ bare_header/sifive_fe310_g000_lfrosc.h \ bare_header/sifive_fe310_g000_prci.h \ bare_header/sifive_fe310_g000_pll.h \ - bare_header/sifive_fu540_c000_l2.h \ bare_header/sifive_global_external_interrupts0.h \ bare_header/sifive_gpio0.h \ bare_header/sifive_gpio_buttons.h \ @@ -1009,9 +1005,6 @@ metal_header/freedom_metal_header_generator-sifive_fe310_g000_pll.$(OBJEXT): \ metal_header/freedom_metal_header_generator-sifive_fe310_g000_prci.$(OBJEXT): \ metal_header/$(am__dirstamp) \ metal_header/$(DEPDIR)/$(am__dirstamp) -metal_header/freedom_metal_header_generator-sifive_fu540_c000_l2.$(OBJEXT): \ - metal_header/$(am__dirstamp) \ - metal_header/$(DEPDIR)/$(am__dirstamp) metal_header/freedom_metal_header_generator-sifive_global_external_interrupts0.$(OBJEXT): \ metal_header/$(am__dirstamp) \ metal_header/$(DEPDIR)/$(am__dirstamp) @@ -1105,7 +1098,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_fe310_g000_lfrosc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_fe310_g000_pll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_fe310_g000_prci.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_fu540_c000_l2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_global_external_interrupts0.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_gpio0.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_gpio_button.Po@am__quote@ @@ -1464,20 +1456,6 @@ metal_header/freedom_metal_header_generator-sifive_fe310_g000_prci.obj: metal_he @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(freedom_metal_header_generator_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o metal_header/freedom_metal_header_generator-sifive_fe310_g000_prci.obj `if test -f 'metal_header/sifive_fe310_g000_prci.c++'; then $(CYGPATH_W) 'metal_header/sifive_fe310_g000_prci.c++'; else $(CYGPATH_W) '$(srcdir)/metal_header/sifive_fe310_g000_prci.c++'; fi` -metal_header/freedom_metal_header_generator-sifive_fu540_c000_l2.o: metal_header/sifive_fu540_c000_l2.c++ -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(freedom_metal_header_generator_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT metal_header/freedom_metal_header_generator-sifive_fu540_c000_l2.o -MD -MP -MF metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_fu540_c000_l2.Tpo -c -o metal_header/freedom_metal_header_generator-sifive_fu540_c000_l2.o `test -f 'metal_header/sifive_fu540_c000_l2.c++' || echo '$(srcdir)/'`metal_header/sifive_fu540_c000_l2.c++ -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_fu540_c000_l2.Tpo metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_fu540_c000_l2.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='metal_header/sifive_fu540_c000_l2.c++' object='metal_header/freedom_metal_header_generator-sifive_fu540_c000_l2.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(freedom_metal_header_generator_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o metal_header/freedom_metal_header_generator-sifive_fu540_c000_l2.o `test -f 'metal_header/sifive_fu540_c000_l2.c++' || echo '$(srcdir)/'`metal_header/sifive_fu540_c000_l2.c++ - -metal_header/freedom_metal_header_generator-sifive_fu540_c000_l2.obj: metal_header/sifive_fu540_c000_l2.c++ -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(freedom_metal_header_generator_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT metal_header/freedom_metal_header_generator-sifive_fu540_c000_l2.obj -MD -MP -MF metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_fu540_c000_l2.Tpo -c -o metal_header/freedom_metal_header_generator-sifive_fu540_c000_l2.obj `if test -f 'metal_header/sifive_fu540_c000_l2.c++'; then $(CYGPATH_W) 'metal_header/sifive_fu540_c000_l2.c++'; else $(CYGPATH_W) '$(srcdir)/metal_header/sifive_fu540_c000_l2.c++'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_fu540_c000_l2.Tpo metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_fu540_c000_l2.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='metal_header/sifive_fu540_c000_l2.c++' object='metal_header/freedom_metal_header_generator-sifive_fu540_c000_l2.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(freedom_metal_header_generator_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o metal_header/freedom_metal_header_generator-sifive_fu540_c000_l2.obj `if test -f 'metal_header/sifive_fu540_c000_l2.c++'; then $(CYGPATH_W) 'metal_header/sifive_fu540_c000_l2.c++'; else $(CYGPATH_W) '$(srcdir)/metal_header/sifive_fu540_c000_l2.c++'; fi` - metal_header/freedom_metal_header_generator-sifive_global_external_interrupts0.o: metal_header/sifive_global_external_interrupts0.c++ @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(freedom_metal_header_generator_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT metal_header/freedom_metal_header_generator-sifive_global_external_interrupts0.o -MD -MP -MF metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_global_external_interrupts0.Tpo -c -o metal_header/freedom_metal_header_generator-sifive_global_external_interrupts0.o `test -f 'metal_header/sifive_global_external_interrupts0.c++' || echo '$(srcdir)/'`metal_header/sifive_global_external_interrupts0.c++ @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_global_external_interrupts0.Tpo metal_header/$(DEPDIR)/freedom_metal_header_generator-sifive_global_external_interrupts0.Po diff --git a/bare_header/freedom-bare_header-generator.c++ b/bare_header/freedom-bare_header-generator.c++ index f80ec2cc..d219b159 100644 --- a/bare_header/freedom-bare_header-generator.c++ +++ b/bare_header/freedom-bare_header-generator.c++ @@ -35,7 +35,6 @@ #include "bare_header/sifive_fe310_g000_lfrosc.h" #include "bare_header/sifive_fe310_g000_pll.h" #include "bare_header/sifive_fe310_g000_prci.h" -#include "bare_header/sifive_fu540_c000_l2.h" #include "bare_header/sifive_global_external_interrupts0.h" #include "bare_header/sifive_gpio0.h" #include "bare_header/sifive_gpio_buttons.h" @@ -159,7 +158,6 @@ static void write_config_file(const fdt &dtb, fstream &os, std::string cfg_file, devices.push_back(new sifive_fe310_g000_lfrosc(os, dtb)); devices.push_back(new sifive_fe310_g000_prci(os, dtb)); devices.push_back(new sifive_fe310_g000_pll(os, dtb)); - devices.push_back(new sifive_fu540_c000_l2(os, dtb)); devices.push_back(new sifive_global_external_interrupts0(os, dtb)); devices.push_back(new sifive_gpio0(os, dtb)); devices.push_back(new sifive_gpio_buttons(os, dtb)); diff --git a/bare_header/sifive_ccache0.h b/bare_header/sifive_ccache0.h index 18e8d785..0f25b9f5 100644 --- a/bare_header/sifive_ccache0.h +++ b/bare_header/sifive_ccache0.h @@ -11,7 +11,7 @@ class sifive_ccache0 : public Device { public: sifive_ccache0(std::ostream &os, const fdt &dtb) - : Device(os, dtb, "sifive,ccache0") {} + : Device(os, dtb, "sifive,(ccache0|fu540-c000,l2)") {} int get_index(const node &n) { return Device::get_index(n, compat_string); } @@ -19,8 +19,8 @@ class sifive_ccache0 : public Device { dtb.match(std::regex(compat_string), [&](node n) { emit_comment(n); - emit_base(n); - emit_size(n); + emit_base("sifive,ccache0", n); + emit_size("sifive,ccache0", n); os << std::endl; }); @@ -28,28 +28,46 @@ class sifive_ccache0 : public Device { void emit_offsets() { if (dtb.match(std::regex(compat_string), [](const node n) {}) != 0) { - emit_compat(); - emit_offset(METAL_SIFIVE_CCACHE_CONFIG_LABEL, 0x0000); - emit_offset(METAL_SIFIVE_CCACHE_WAYENABLE_LABEL, 0x0008); - emit_offset(METAL_SIFIVE_CCACHE_ECCINJECTERROR_LABEL, 0X0040); - emit_offset(METAL_SIFIVE_CCACHE_DIRECCFIXLOW_LABEL, 0X0100); - emit_offset(METAL_SIFIVE_CCACHE_DIRECCFIXHIGH_LABEL, 0X0104); - emit_offset(METAL_SIFIVE_CCACHE_DIRECCFIXCOUNT_LABEL, 0X0108); - emit_offset(METAL_SIFIVE_CCACHE_DIRECCFAILLOW_LABEL, 0X0120); - emit_offset(METAL_SIFIVE_CCACHE_DIRECCFAILHIGH_LABEL, 0X0124); - emit_offset(METAL_SIFIVE_CCACHE_DIRECCFAILCOUNT_LABEL, 0X0128); - emit_offset(METAL_SIFIVE_CCACHE_DATECCFIXLOW_LABEL, 0X0140); - emit_offset(METAL_SIFIVE_CCACHE_DATECCFIXHIGH_LABEL, 0X0144); - emit_offset(METAL_SIFIVE_CCACHE_DATECCFIXCOUNT_LABEL, 0X0148); - emit_offset(METAL_SIFIVE_CCACHE_DATECCFAILLOW_LABEL, 0X0160); - emit_offset(METAL_SIFIVE_CCACHE_DATECCFAILHIGH_LABEL, 0X0164); - emit_offset(METAL_SIFIVE_CCACHE_DATECCFAILCOUNT_LABEL, 0X0168); - emit_offset(METAL_SIFIVE_CCACHE_FLUSH64_LABEL, 0X0200); - emit_offset(METAL_SIFIVE_CCACHE_FLUSH32_LABEL, 0X0240); - emit_offset(METAL_SIFIVE_CCACHE_WAYMASK0_LABEL, 0X0800); - emit_offset(METAL_SIFIVE_CCACHE_PMEVENTSELECT0_LABEL, 0X2000); - emit_offset(METAL_SIFIVE_CCACHE_PMCLIENTFILTER_LABEL, 0X2800); - emit_offset(METAL_SIFIVE_CCACHE_PMEVENTCOUNTER0_LABEL, 0X3000); + + emit_compat("sifive,ccache0"); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_CONFIG_LABEL, 0x0000); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_WAYENABLE_LABEL, + 0x0008); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_ECCINJECTERROR_LABEL, + 0X0040); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_DIRECCFIXLOW_LABEL, + 0X0100); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_DIRECCFIXHIGH_LABEL, + 0X0104); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_DIRECCFIXCOUNT_LABEL, + 0X0108); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_DIRECCFAILLOW_LABEL, + 0X0120); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_DIRECCFAILHIGH_LABEL, + 0X0124); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_DIRECCFAILCOUNT_LABEL, + 0X0128); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_DATECCFIXLOW_LABEL, + 0X0140); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_DATECCFIXHIGH_LABEL, + 0X0144); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_DATECCFIXCOUNT_LABEL, + 0X0148); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_DATECCFAILLOW_LABEL, + 0X0160); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_DATECCFAILHIGH_LABEL, + 0X0164); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_DATECCFAILCOUNT_LABEL, + 0X0168); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_FLUSH64_LABEL, 0X0200); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_FLUSH32_LABEL, 0X0240); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_WAYMASK0_LABEL, 0X0800); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_PMEVENTSELECT0_LABEL, + 0X2000); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_PMCLIENTFILTER_LABEL, + 0X2800); + emit_offset("sifive,ccache0", METAL_SIFIVE_CCACHE_PMEVENTCOUNTER0_LABEL, + 0X3000); os << std::endl; } diff --git a/bare_header/sifive_fu540_c000_l2.h b/bare_header/sifive_fu540_c000_l2.h deleted file mode 100644 index 617ecb93..00000000 --- a/bare_header/sifive_fu540_c000_l2.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright 2019 SiFive, Inc */ -/* SPDX-License-Identifier: Apache-2.0 */ - -#ifndef __BARE_HEADER_SIFIVE_FU540_C000_L2__H -#define __BARE_HEADER_SIFIVE_FU540_C000_L2__H - -#include "bare_header/device.h" - -#include - -class sifive_fu540_c000_l2 : public Device { -public: - sifive_fu540_c000_l2(std::ostream &os, const fdt &dtb) - : Device(os, dtb, "sifive,fu540-c000,l2") {} - - int get_index(const node &n) { return Device::get_index(n, compat_string); } - - void emit_defines() { - dtb.match(std::regex(compat_string), [&](node n) { - emit_comment(n); - - emit_base(n); - emit_size(n); - - os << std::endl; - }); - } - - void emit_offsets() { - if (dtb.match(std::regex(compat_string), [](const node n) {}) != 0) { - emit_compat(); - emit_offset(METAL_SIFIVE_FU540_C000_L2_CONFIG_LABEL, 0x0); - emit_offset(METAL_SIFIVE_FU540_C000_L2_WAYENABLE_LABEL, 0x8); - - os << std::endl; - } - } -}; - -#endif diff --git a/metal_header/freedom-metal_header-generator.c++ b/metal_header/freedom-metal_header-generator.c++ index 7c5e1e8e..478763ab 100644 --- a/metal_header/freedom-metal_header-generator.c++ +++ b/metal_header/freedom-metal_header-generator.c++ @@ -48,9 +48,6 @@ #include #include -/* FU540-C000 Devices */ -#include - /* STL */ #include #include @@ -178,9 +175,6 @@ static void prepare_devices(const fdt &dtb, fstream &os, devices.push_back(new sifive_fe310_g000_lfrosc(os, dtb)); devices.push_back(new sifive_fe310_g000_pll(os, dtb)); devices.push_back(new sifive_fe310_g000_prci(os, dtb)); - - /* FU540-C000 Devices */ - devices.push_back(new sifive_fu540_c000_l2(os, dtb)); } static void write_h_file(const fdt &dtb, fstream &os, std::string h_file, diff --git a/metal_header/sifive_ccache0.c++ b/metal_header/sifive_ccache0.c++ index fb078097..e7454d87 100644 --- a/metal_header/sifive_ccache0.c++ +++ b/metal_header/sifive_ccache0.c++ @@ -6,11 +6,11 @@ #include sifive_ccache0::sifive_ccache0(std::ostream &os, const fdt &dtb) - : Device(os, dtb, "sifive,ccache0") {} + : Device(os, dtb, "sifive,(ccache0|fu540-c000,l2)") {} void sifive_ccache0::include_headers() { dtb.match(std::regex(compat_string), - [&](node n) { emit_include(compat_string); }); + [&](node n) { emit_include("sifive,ccache0"); }); } void sifive_ccache0::create_defines() { diff --git a/metal_header/sifive_fu540_c000_l2.c++ b/metal_header/sifive_fu540_c000_l2.c++ deleted file mode 100644 index 4faacb47..00000000 --- a/metal_header/sifive_fu540_c000_l2.c++ +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright 2019 SiFive, Inc */ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include - -#include - -sifive_fu540_c000_l2::sifive_fu540_c000_l2(std::ostream &os, const fdt &dtb) - : Device(os, dtb, "sifive,fu540-c000,l2") {} - -void sifive_fu540_c000_l2::include_headers() { - dtb.match(std::regex(compat_string), - [&](node n) { emit_include(compat_string); }); -} - -void sifive_fu540_c000_l2::declare_inlines() { - Inline *func; - std::list extern_inlines; - int count = 0; - - dtb.match(std::regex(compat_string), [&](node n) { - if (count == 0) { - func = create_inline_dec("control_base", "uintptr_t", - "struct metal_cache *cache"); - extern_inlines.push_back(func); - } - count++; - }); - os << "\n"; - os << "/* --------------------- sifive_fu540_c000_l2 ------------ */\n"; - while (!extern_inlines.empty()) { - func = extern_inlines.front(); - extern_inlines.pop_front(); - emit_inline_dec(func, "sifive_fu540_c000_l2"); - delete func; - } - os << "\n"; -} - -void sifive_fu540_c000_l2::define_inlines() { - Inline *func; - std::list extern_inlines; - - int count = 0; - dtb.match(std::regex(compat_string), [&](node n) { - if (count == 0) { - func = create_inline_def("control_base", "uintptr_t", - "(uintptr_t)cache == (uintptr_t)&__metal_dt_" + - n.handle(), - platform_define(n, METAL_BASE_ADDRESS_LABEL), - "struct metal_cache *cache"); - add_inline_body(func, "else", "0"); - extern_inlines.push_back(func); - } - count++; - }); - os << "\n"; - os << "/* --------------------- sifive_fu540_c000_l2 ------------ */\n"; - while (!extern_inlines.empty()) { - func = extern_inlines.front(); - extern_inlines.pop_front(); - emit_inline_def(func, "sifive_fu540_c000_l2"); - delete func; - } - os << "\n"; -} - -void sifive_fu540_c000_l2::declare_structs() { - dtb.match(std::regex(compat_string), - [&](node n) { emit_struct_decl("sifive_fu540_c000_l2", n); }); -} - -void sifive_fu540_c000_l2::define_structs() { - dtb.match(std::regex(compat_string), [&](node n) { - emit_struct_begin("sifive_fu540_c000_l2", n); - - emit_struct_field("cache.vtable", - "&__metal_driver_vtable_sifive_fu540_c000_l2.cache"); - - emit_struct_end(); - }); -} - -void sifive_fu540_c000_l2::create_handles() { - dtb.match(std::regex(compat_string), [&](node n) { - emit_def_handle("__METAL_DT_SIFIVE_FU540_C000_L2_HANDLE", n, ".cache"); - }); -} diff --git a/metal_header/sifive_fu540_c000_l2.h b/metal_header/sifive_fu540_c000_l2.h deleted file mode 100644 index e788248a..00000000 --- a/metal_header/sifive_fu540_c000_l2.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright 2019 SiFive, Inc */ -/* SPDX-License-Identifier: Apache-2.0 */ - -#ifndef __METAL_HEADER_TEMPLATE_DEVICE__H -#define __METAL_HEADER_TEMPLATE_DEVICE__H - -#include - -#include - -class sifive_fu540_c000_l2 : public Device { -public: - sifive_fu540_c000_l2(std::ostream &os, const fdt &dtb); - void include_headers(); - void declare_inlines(); - void define_inlines(); - void declare_structs(); - void define_structs(); - void create_handles(); -}; - -#endif