Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #456 from sifive/bus-error-unit
Browse files Browse the repository at this point in the history
Add SiFive Bus Error Unit support and example
  • Loading branch information
nategraff-sifive authored Apr 3, 2020
2 parents 337216c + d9bc6c7 commit 18678e1
Show file tree
Hide file tree
Showing 25 changed files with 199 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,6 @@
[submodule "software/example-freertos-pmp-blinky"]
path = software/example-freertos-pmp-blinky
url = https://github.com/sifive/example-freertos-pmp-blinky.git
[submodule "software/example-buserror"]
path = software/example-buserror
url = https://github.com/sifive/example-buserror.git
4 changes: 4 additions & 0 deletions bsp/freedom-e310-arty/metal-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extern __inline__ int __metal_driver_cpu_hartid(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_timebase(struct metal_cpu *cpu);
extern __inline__ struct metal_interrupt * __metal_driver_cpu_interrupt_controller(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu);
extern __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu);


/* --------------------- sifive_plic0 ------------ */
Expand All @@ -43,6 +44,9 @@ extern __inline__ int __metal_driver_sifive_plic0_interrupt_lines(struct metal_i
extern __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid);


/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
13 changes: 13 additions & 0 deletions bsp/freedom-e310-arty/metal.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@ static __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu)
}
}

static __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu)
{
if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_0) {
return NULL;
}
else {
return NULL;
}
}



/* --------------------- sifive_plic0 ------------ */
Expand Down Expand Up @@ -318,6 +328,9 @@ static __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid)



/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
4 changes: 4 additions & 0 deletions bsp/qemu-sifive-e31/metal-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extern __inline__ int __metal_driver_cpu_hartid(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_timebase(struct metal_cpu *cpu);
extern __inline__ struct metal_interrupt * __metal_driver_cpu_interrupt_controller(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu);
extern __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu);


/* --------------------- sifive_plic0 ------------ */
Expand All @@ -43,6 +44,9 @@ extern __inline__ int __metal_driver_sifive_plic0_interrupt_lines(struct metal_i
extern __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid);


/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
13 changes: 13 additions & 0 deletions bsp/qemu-sifive-e31/metal.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,16 @@ static __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu)
}
}

static __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu)
{
if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_0) {
return NULL;
}
else {
return NULL;
}
}



/* --------------------- sifive_plic0 ------------ */
Expand Down Expand Up @@ -370,6 +380,9 @@ static __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid)



/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
4 changes: 4 additions & 0 deletions bsp/qemu-sifive-s51/metal-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extern __inline__ int __metal_driver_cpu_hartid(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_timebase(struct metal_cpu *cpu);
extern __inline__ struct metal_interrupt * __metal_driver_cpu_interrupt_controller(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu);
extern __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu);


/* --------------------- sifive_plic0 ------------ */
Expand All @@ -43,6 +44,9 @@ extern __inline__ int __metal_driver_sifive_plic0_interrupt_lines(struct metal_i
extern __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid);


/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
13 changes: 13 additions & 0 deletions bsp/qemu-sifive-s51/metal.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,16 @@ static __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu)
}
}

static __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu)
{
if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_0) {
return NULL;
}
else {
return NULL;
}
}



/* --------------------- sifive_plic0 ------------ */
Expand Down Expand Up @@ -370,6 +380,9 @@ static __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid)



/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
4 changes: 4 additions & 0 deletions bsp/qemu-sifive-u54/metal-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ extern __inline__ int __metal_driver_cpu_hartid(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_timebase(struct metal_cpu *cpu);
extern __inline__ struct metal_interrupt * __metal_driver_cpu_interrupt_controller(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu);
extern __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu);


/* --------------------- sifive_plic0 ------------ */
Expand All @@ -42,6 +43,9 @@ extern __inline__ int __metal_driver_sifive_plic0_interrupt_lines(struct metal_i
extern __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid);


/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
13 changes: 13 additions & 0 deletions bsp/qemu-sifive-u54/metal.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ static __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu)
}
}

static __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu)
{
if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_0) {
return NULL;
}
else {
return NULL;
}
}



/* --------------------- sifive_plic0 ------------ */
Expand Down Expand Up @@ -291,6 +301,9 @@ static __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid)



/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
4 changes: 4 additions & 0 deletions bsp/qemu-sifive-u54mc/metal-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extern __inline__ int __metal_driver_cpu_hartid(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_timebase(struct metal_cpu *cpu);
extern __inline__ struct metal_interrupt * __metal_driver_cpu_interrupt_controller(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu);
extern __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu);


/* --------------------- sifive_plic0 ------------ */
Expand All @@ -43,6 +44,9 @@ extern __inline__ int __metal_driver_sifive_plic0_interrupt_lines(struct metal_i
extern __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid);


/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
22 changes: 22 additions & 0 deletions bsp/qemu-sifive-u54mc/metal.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,25 @@ static __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu)
}
}

static __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu)
{
if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_0) {
return NULL;
}
else if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_1) {
return NULL;
}
else if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_2) {
return NULL;
}
else if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_3) {
return NULL;
}
else {
return NULL;
}
}



/* --------------------- sifive_plic0 ------------ */
Expand Down Expand Up @@ -436,6 +455,9 @@ static __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid)



/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
4 changes: 4 additions & 0 deletions bsp/sifive-hifive-unleashed/metal-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ extern __inline__ int __metal_driver_cpu_hartid(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_timebase(struct metal_cpu *cpu);
extern __inline__ struct metal_interrupt * __metal_driver_cpu_interrupt_controller(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu);
extern __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu);


/* --------------------- sifive_plic0 ------------ */
Expand All @@ -46,6 +47,9 @@ extern __inline__ int __metal_driver_sifive_plic0_interrupt_lines(struct metal_i
extern __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid);


/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
8 changes: 8 additions & 0 deletions bsp/sifive-hifive-unleashed/metal-platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@
#define METAL_RISCV_PLIC0_CONTEXT_THRESHOLD 0UL
#define METAL_RISCV_PLIC0_CONTEXT_CLAIM 4UL

/* From error_device@18000000 */
#define METAL_SIFIVE_ERROR0_18000000_BASE_ADDRESS 402653184UL
#define METAL_SIFIVE_ERROR0_0_BASE_ADDRESS 402653184UL
#define METAL_SIFIVE_ERROR0_18000000_SIZE 134217728UL
#define METAL_SIFIVE_ERROR0_0_SIZE 134217728UL

#define METAL_SIFIVE_ERROR0

/* From cache_controller@2010000 */
#define METAL_SIFIVE_FU540_C000_L2_2010000_BASE_ADDRESS 33619968UL
#define METAL_SIFIVE_FU540_C000_L2_0_BASE_ADDRESS 33619968UL
Expand Down
25 changes: 25 additions & 0 deletions bsp/sifive-hifive-unleashed/metal.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,28 @@ static __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu)
}
}

static __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu)
{
if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_0) {
return NULL;
}
else if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_1) {
return NULL;
}
else if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_2) {
return NULL;
}
else if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_3) {
return NULL;
}
else if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_4) {
return NULL;
}
else {
return NULL;
}
}



/* --------------------- sifive_plic0 ------------ */
Expand Down Expand Up @@ -568,6 +590,9 @@ static __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid)



/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
4 changes: 4 additions & 0 deletions bsp/sifive-hifive1-revb/metal-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extern __inline__ int __metal_driver_cpu_hartid(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_timebase(struct metal_cpu *cpu);
extern __inline__ struct metal_interrupt * __metal_driver_cpu_interrupt_controller(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu);
extern __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu);


/* --------------------- sifive_plic0 ------------ */
Expand All @@ -43,6 +44,9 @@ extern __inline__ int __metal_driver_sifive_plic0_interrupt_lines(struct metal_i
extern __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid);


/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
13 changes: 13 additions & 0 deletions bsp/sifive-hifive1-revb/metal.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,16 @@ static __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu)
}
}

static __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu)
{
if ((uintptr_t)cpu == (uintptr_t)&__metal_dt_cpu_0) {
return NULL;
}
else {
return NULL;
}
}



/* --------------------- sifive_plic0 ------------ */
Expand Down Expand Up @@ -401,6 +411,9 @@ static __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid)



/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
4 changes: 4 additions & 0 deletions bsp/sifive-hifive1/metal-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extern __inline__ int __metal_driver_cpu_hartid(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_timebase(struct metal_cpu *cpu);
extern __inline__ struct metal_interrupt * __metal_driver_cpu_interrupt_controller(struct metal_cpu *cpu);
extern __inline__ int __metal_driver_cpu_num_pmp_regions(struct metal_cpu *cpu);
extern __inline__ struct metal_buserror * __metal_driver_cpu_buserror(struct metal_cpu *cpu);


/* --------------------- sifive_plic0 ------------ */
Expand All @@ -43,6 +44,9 @@ extern __inline__ int __metal_driver_sifive_plic0_interrupt_lines(struct metal_i
extern __inline__ int __metal_driver_sifive_plic0_context_ids(int hartid);


/* --------------------- sifive_buserror0 ------------ */


/* --------------------- sifive_ccache0 ------------ */


Expand Down
Loading

0 comments on commit 18678e1

Please sign in to comment.