summaryrefslogtreecommitdiff
path: root/software/smp
diff options
context:
space:
mode:
authorNathaniel Graff <nathaniel.graff@sifive.com>2019-03-07 21:32:52 +0000
committerGitHub <noreply@github.com>2019-03-07 21:32:52 +0000
commit7b036c07e40a6f3d3cf1ddfc5d88d3a36beb4e46 (patch)
treec1459952c20e4534d33016d4fc2cf6729228c0e6 /software/smp
parent84781219c87c0b9148e318f3e358ef7de03e251c (diff)
parentdef12d50a686774196c613a819e6afb744ee290e (diff)
Merge pull request #195 from sifive/remove-legacy
Remove legacy BSPs and Software
Diffstat (limited to 'software/smp')
-rw-r--r--software/smp/Makefile6
-rw-r--r--software/smp/atomic.h29
-rw-r--r--software/smp/smp.c40
3 files changed, 0 insertions, 75 deletions
diff --git a/software/smp/Makefile b/software/smp/Makefile
deleted file mode 100644
index 4131ffc..0000000
--- a/software/smp/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-TARGET = smp
-C_SRCS += smp.c
-CFLAGS += -O2 -fno-builtin-printf -DENABLE_SMP
-
-BSP_BASE = ../../bsp
-include $(BSP_BASE)/env/common.mk
diff --git a/software/smp/atomic.h b/software/smp/atomic.h
deleted file mode 100644
index 074c6a2..0000000
--- a/software/smp/atomic.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef SIFIVE_ATOMIC_H
-#define SIFIVE_ATOMIC_H
-
-#define ATOMIC_INIT(x) \
- { \
- .counter = (x), \
- }
-
-typedef struct {
- int counter;
-} atomic_t;
-
-static inline int atomic_xchg(atomic_t *v, int n)
-{
- register int c;
-
- __asm__ __volatile__ (
- "amoswap.w.aqrl %0, %2, %1"
- : "=r" (c), "+A" (v->counter)
- : "r" (n));
- return c;
-}
-
-static inline void mb(void)
-{
- __asm__ __volatile__ ("fence");
-}
-
-#endif
diff --git a/software/smp/smp.c b/software/smp/smp.c
deleted file mode 100644
index 36c9db9..0000000
--- a/software/smp/smp.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include "atomic.h"
-void write_hex(int, unsigned long);
-
-atomic_t tty_lock = ATOMIC_INIT(0);
-
-void get_lock(atomic_t *lock)
-{
- while (atomic_xchg(lock, 1) == 1);
- mb();
-}
-
-void put_lock(atomic_t *lock)
-{
- mb();
- atomic_xchg(lock, 0);
-}
-
-int secondary_main(int hartid)
-{
- volatile int counter;
-
- while (1) {
- get_lock(&tty_lock);
- write(1, "hello world from hart ", 22);
- char s[] = {'0', '\n', '\0'};
- s[0] += hartid;
- write(1, s, 2);
- put_lock(&tty_lock);
-
- for (counter = 0; counter < 10000 + 100*hartid; ++counter)
- mb();
- }
-}
-
-int main()
-{
- return secondary_main(0);
-}