Skip to content

Commit

Permalink
Removed 'fu540' specific cache driver references.
Browse files Browse the repository at this point in the history
Replaced with more generic cache driver defines for hifive unleashed.
  • Loading branch information
NandkumarJoshi committed Sep 1, 2020
1 parent 85b16a6 commit ca50b77
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 210 deletions.
3 changes: 0 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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++ \
Expand Down Expand Up @@ -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 \
Expand Down
22 changes: 0 additions & 22 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -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++ \
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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@
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions bare_header/freedom-bare_header-generator.c++
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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));
Expand Down
68 changes: 43 additions & 25 deletions bare_header/sifive_ccache0.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,63 @@
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); }

void emit_defines() {
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;
});
}

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;
}
Expand Down
40 changes: 0 additions & 40 deletions bare_header/sifive_fu540_c000_l2.h

This file was deleted.

6 changes: 0 additions & 6 deletions metal_header/freedom-metal_header-generator.c++
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
#include <sifive_fe310_g000_pll.h>
#include <sifive_fe310_g000_prci.h>

/* FU540-C000 Devices */
#include <sifive_fu540_c000_l2.h>

/* STL */
#include <ctime>
#include <fstream>
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions metal_header/sifive_ccache0.c++
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#include <regex>

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() {
Expand Down
88 changes: 0 additions & 88 deletions metal_header/sifive_fu540_c000_l2.c++

This file was deleted.

22 changes: 0 additions & 22 deletions metal_header/sifive_fu540_c000_l2.h

This file was deleted.

0 comments on commit ca50b77

Please sign in to comment.