summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyril Bur <cyrilbur@gmail.com>2018-02-09 15:38:35 +1100
committerAlistair Popple <alistair@popple.id.au>2018-02-12 14:50:47 +1100
commitbe19a48a31d8ed0350e880374fb0e4fe30905f36 (patch)
treee05d9a0a1222fa256c69d7fa1df84831875e55ec
parente995715ad4a9522c4040c2ac7e06b5c8d33977b8 (diff)
downloadpdbg-be19a48a31d8ed0350e880374fb0e4fe30905f36.tar.gz
pdbg-be19a48a31d8ed0350e880374fb0e4fe30905f36.zip
main: Pull out scom functions from main.c
Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
-rw-r--r--Makefile.am2
-rw-r--r--src/main.c22
-rw-r--r--src/scom.c41
-rw-r--r--src/scom.h21
4 files changed, 64 insertions, 22 deletions
diff --git a/Makefile.am b/Makefile.am
index f148ef9..1e645b7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,7 +11,7 @@ ACLOCAL_AMFLAGS = -Im4
AM_CFLAGS = -I$(top_srcdir)/ccan/array_size -Wall -Werror
pdbg_SOURCES = \
- src/main.c src/cfam.c
+ src/main.c src/cfam.c src/scom.c
pdbg_LDADD = fake.dtb.o p8-fsi.dtb.o p8-i2c.dtb.o p9w-fsi.dtb.o p8-host.dtb.o \
p9z-fsi.dtb.o p9r-fsi.dtb.o p9-kernel.dtb.o libpdbg.la libfdt.la \
p9-host.dtb.o \
diff --git a/src/main.c b/src/main.c
index 913fb6d..33ebda3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -32,6 +32,7 @@
#include "bitutils.h"
#include "cfam.h"
+#include "scom.h"
#undef PR_DEBUG
#define PR_DEBUG(...)
@@ -428,27 +429,6 @@ static int for_each_target(char *class, int (*cb)(struct pdbg_target *, uint32_t
return rc;
}
-
-static int getscom(struct pdbg_target *target, uint32_t index, uint64_t *addr, uint64_t *unused)
-{
- uint64_t value;
-
- if (pib_read(target, *addr, &value))
- return 0;
-
- printf("p%d:0x%" PRIx64 " = 0x%016" PRIx64 "\n", index, *addr, value);
-
- return 1;
-}
-
-static int putscom(struct pdbg_target *target, uint32_t index, uint64_t *addr, uint64_t *data)
-{
- if (pib_write(target, *addr, *data))
- return 0;
-
- return 1;
-}
-
static int print_thread_status(struct pdbg_target *target, uint32_t index, uint64_t *status, uint64_t *unused1)
{
*status = SETFIELD(0xf << (index * 4), *status, thread_status(target) & 0xf);
diff --git a/src/scom.c b/src/scom.c
new file mode 100644
index 0000000..f9102cc
--- /dev/null
+++ b/src/scom.c
@@ -0,0 +1,41 @@
+/* Copyright 2017 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <inttypes.h>
+#include <stdio.h>
+
+#include <target.h>
+
+int getscom(struct pdbg_target *target, uint32_t index, uint64_t *addr, uint64_t *unused)
+{
+ uint64_t value;
+
+ if (pib_read(target, *addr, &value))
+ return 0;
+
+ printf("p%d:0x%" PRIx64 " = 0x%016" PRIx64 "\n", index, *addr, value);
+
+ return 1;
+}
+
+int putscom(struct pdbg_target *target, uint32_t index, uint64_t *addr, uint64_t *data)
+{
+ if (pib_write(target, *addr, *data))
+ return 0;
+
+ return 1;
+}
+
+
diff --git a/src/scom.h b/src/scom.h
new file mode 100644
index 0000000..afda6af
--- /dev/null
+++ b/src/scom.h
@@ -0,0 +1,21 @@
+/* Copyright 2017 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <inttypes.h>
+
+#include <target.h>
+
+int getscom(struct pdbg_target *target, uint32_t index, uint64_t *addr, uint64_t *unused);
+int putscom(struct pdbg_target *target, uint32_t index, uint64_t *addr, uint64_t *data);
OpenPOWER on IntegriCloud