mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 16:00:39 +01:00
[v1.03][RISCV] Add basic StarFive support
This commit is contained in:
@@ -31,7 +31,8 @@ char* get_soc_name(struct system_on_chip* soc) {
|
||||
}
|
||||
|
||||
static char* soc_trademark_string[] = {
|
||||
[SOC_VENDOR_SIFIVE] = "SiFive "
|
||||
[SOC_VENDOR_SIFIVE] = "SiFive ",
|
||||
[SOC_VENDOR_STARFIVE] = "StarFive "
|
||||
};
|
||||
|
||||
void fill_soc(struct system_on_chip* soc, char* soc_name, SOC soc_model, int32_t process) {
|
||||
@@ -77,8 +78,19 @@ bool match_sifive(char* soc_name, struct system_on_chip* soc) {
|
||||
SOC_END
|
||||
}
|
||||
|
||||
bool match_starfive(char* soc_name, struct system_on_chip* soc) {
|
||||
SOC_START
|
||||
SOC_EQ(soc_name, "jh7110#", "VisionFive 2", SOC_STARFIVE_VF2, soc, 28) // https://blog.bitsofnetworks.org/benchmarking-risc-v-visionfive-2-vs-the-world.html
|
||||
SOC_EQ(soc_name, "jh7110", "VisionFive 2", SOC_STARFIVE_VF2, soc, 28)
|
||||
SOC_END
|
||||
}
|
||||
|
||||
struct system_on_chip* parse_soc_from_string(struct system_on_chip* soc) {
|
||||
char* raw_name = soc->raw_name;
|
||||
|
||||
if(match_starfive(raw_name, soc))
|
||||
return soc;
|
||||
|
||||
match_sifive(raw_name, soc);
|
||||
return soc;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ typedef int32_t SOC;
|
||||
|
||||
enum {
|
||||
SOC_VENDOR_UNKNOWN,
|
||||
SOC_VENDOR_SIFIVE
|
||||
SOC_VENDOR_SIFIVE,
|
||||
SOC_VENDOR_STARFIVE
|
||||
};
|
||||
|
||||
struct system_on_chip {
|
||||
|
||||
@@ -7,12 +7,15 @@
|
||||
enum {
|
||||
// SIFIVE
|
||||
SOC_SIFIVE_U740,
|
||||
// STARFIVE
|
||||
SOC_STARFIVE_VF2,
|
||||
// UNKNOWN
|
||||
SOC_MODEL_UNKNOWN
|
||||
};
|
||||
|
||||
inline static VENDOR get_soc_vendor_from_soc(SOC soc) {
|
||||
if(soc >= SOC_SIFIVE_U740 && soc <= SOC_SIFIVE_U740) return SOC_VENDOR_SIFIVE;
|
||||
if(soc >= SOC_STARFIVE_VF2 && soc <= SOC_STARFIVE_VF2) return SOC_VENDOR_STARFIVE;
|
||||
return SOC_VENDOR_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user