Skip to content

Commit

Permalink
[v1.04][RISCV] Add Lichee PI 4a SoC (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Noob committed Nov 1, 2023
1 parent 9a578d3 commit a43b700
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/common/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ static char* soc_trademark_string[] = {
// RISC-V
[SOC_VENDOR_SIFIVE] = "SiFive ",
[SOC_VENDOR_STARFIVE] = "StarFive ",
[SOC_VENDOR_SIPEED] = "Sipeed ",

This comment has been minimized.

Copy link
@Icenowy

Icenowy Jan 26, 2024

The SoC vendor is T-Head, Sipeed is only the SBC vendor. BeagleBoard has a board called BeagleV-Ahead that uses the same SoC.

This comment has been minimized.

Copy link
@Dr-Noob

Dr-Noob Jan 29, 2024

Author Owner

The SoC vendor is T-Head, Sipeed is only the SBC vendor.

Thanks! I created #219 to track this issue.

// ARM & RISC-V
[SOC_VENDOR_ALLWINNER] = "Allwinner "
};
Expand Down
1 change: 1 addition & 0 deletions src/common/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ enum {
// RISC-V
SOC_VENDOR_SIFIVE,
SOC_VENDOR_STARFIVE,
SOC_VENDOR_SIPEED,
// ARM & RISC-V
SOC_VENDOR_ALLWINNER
};
Expand Down
11 changes: 10 additions & 1 deletion src/riscv/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ bool match_allwinner(char* soc_name, struct system_on_chip* soc) {
SOC_END
}

bool match_sipeed(char* soc_name, struct system_on_chip* soc) {
SOC_START
SOC_EQ(soc_name, "light", "Lichee Pi 4A", SOC_SIPEED_LICHEEPI4A, soc, 12) // https://github.com/Dr-Noob/cpufetch/issues/200, https://sipeed.com/licheepi4a
SOC_END
}

struct system_on_chip* parse_soc_from_string(struct system_on_chip* soc) {
char* raw_name = soc->raw_name;

Expand All @@ -41,7 +47,10 @@ struct system_on_chip* parse_soc_from_string(struct system_on_chip* soc) {
if(match_allwinner(raw_name, soc))
return soc;

match_sifive(raw_name, soc);
if(match_sifive(raw_name, soc))
return soc;

match_sipeed(raw_name, soc);
return soc;
}

Expand Down
3 changes: 3 additions & 0 deletions src/riscv/socs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ enum {
SOC_STARFIVE_VF2,
// ALLWINNER
SOC_ALLWINNER_D1H,
// SIPEED
SOC_SIPEED_LICHEEPI4A,
// UNKNOWN
SOC_MODEL_UNKNOWN
};
Expand All @@ -19,6 +21,7 @@ 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;
if(soc >= SOC_ALLWINNER_D1H && soc <= SOC_ALLWINNER_D1H) return SOC_VENDOR_ALLWINNER;
if(soc >= SOC_SIPEED_LICHEEPI4A && soc <= SOC_SIPEED_LICHEEPI4A) return SOC_VENDOR_SIPEED;
return SOC_VENDOR_UNKNOWN;
}

Expand Down

0 comments on commit a43b700

Please sign in to comment.