Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Define and use VPRINTF
details: https://anonhg.NetBSD.org/src/rev/9ad9be39b94b
branches: trunk
changeset: 365074:9ad9be39b94b
user: skrll <skrll%NetBSD.org@localhost>
date: Tue Jul 31 07:00:48 2018 +0000
description:
Define and use VPRINTF
diffstat:
sys/arch/aarch64/aarch64/cpu.c | 18 +-
sys/arch/aarch64/aarch64/pmap.c | 17 +-
sys/arch/arm/arm32/arm32_boot.c | 87 +++++----------
sys/arch/arm/arm32/arm32_kvminit.c | 205 ++++++++++++------------------------
sys/arch/arm/arm32/arm32_machdep.c | 20 ++-
sys/arch/arm/arm32/pmap.c | 71 ++++--------
6 files changed, 154 insertions(+), 264 deletions(-)
diffs (truncated from 1128 to 300 lines):
diff -r c85570c0f8da -r 9ad9be39b94b sys/arch/aarch64/aarch64/cpu.c
--- a/sys/arch/aarch64/aarch64/cpu.c Tue Jul 31 06:46:25 2018 +0000
+++ b/sys/arch/aarch64/aarch64/cpu.c Tue Jul 31 07:00:48 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.3 2018/07/17 00:29:55 christos Exp $ */
+/* $NetBSD: cpu.c,v 1.4 2018/07/31 07:00:48 skrll Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.3 2018/07/17 00:29:55 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.4 2018/07/31 07:00:48 skrll Exp $");
#include "locators.h"
#include "opt_arm_debug.h"
@@ -50,6 +50,12 @@
#include <arm/fdt/arm_fdtvar.h>
#endif
+#ifdef VERBOSE_INIT_ARM
+#define VPRINTF(...) printf(__VA_ARGS__)
+#else
+#define VPRINTF(...) do { } while (/* CONSTCOND */ 0)
+#endif
+
void cpu_attach(device_t, cpuid_t);
static void identify_aarch64_model(uint32_t, char *, size_t);
static void cpu_identify(device_t self, struct cpu_info *, uint32_t, uint64_t);
@@ -495,9 +501,7 @@
{
mutex_init(&cpu_hatch_lock, MUTEX_DEFAULT, IPL_NONE);
-#ifdef VERBOSE_INIT_ARM
- printf("%s: writing mbox with %#x\n", __func__, arm_cpu_hatched);
-#endif
+ VPRINTF("%s: writing mbox with %#x\n", __func__, arm_cpu_hatched);
/* send mbox to have secondary processors do cpu_hatch() */
atomic_or_32(&arm_cpu_mbox, arm_cpu_hatched);
@@ -508,9 +512,7 @@
__asm __volatile ("wfe");
}
-#ifdef VERBOSE_INIT_ARM
- printf("%s: secondary processors hatched\n", __func__);
-#endif
+ VPRINTF("%s: secondary processors hatched\n", __func__);
/* add available processors to kcpuset */
uint32_t mbox = arm_cpu_hatched;
diff -r c85570c0f8da -r 9ad9be39b94b sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c Tue Jul 31 06:46:25 2018 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c Tue Jul 31 07:00:48 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.15 2018/07/27 07:04:04 ryo Exp $ */
+/* $NetBSD: pmap.c,v 1.16 2018/07/31 07:00:48 skrll Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.15 2018/07/27 07:04:04 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.16 2018/07/31 07:00:48 skrll Exp $");
#include "opt_arm_debug.h"
#include "opt_ddb.h"
@@ -50,6 +50,11 @@
//#define PMAP_DEBUG
//#define PMAP_PV_DEBUG
+#ifdef VERBOSE_INIT_ARM
+#define VPRINTF(...) printf(__VA_ARGS__)
+#else
+#define VPRINTF(...) do { } while (/* CONSTCOND */ 0)
+#endif
UVMHIST_DEFINE(pmaphist);
#ifdef UVMHIST
@@ -289,16 +294,12 @@
l0 = (void *)AARCH64_PA_TO_KVA(reg_ttbr1_el1_read());
-#ifdef VERBOSE_INIT_ARM
- printf("%s:\n", __func__);
-#endif
+ VPRINTF("%s:\n", __func__);
for (i = 0; table[i].pd_size != 0; i++) {
-#ifdef VERBOSE_INIT_ARM
- printf(" devmap: pa %08lx-%08lx = va %016lx\n",
+ VPRINTF(" devmap: pa %08lx-%08lx = va %016lx\n",
table[i].pd_pa,
table[i].pd_pa + table[i].pd_size - 1,
table[i].pd_va);
-#endif
va = table[i].pd_va;
/* update and check virtual_devmap_addr */
diff -r c85570c0f8da -r 9ad9be39b94b sys/arch/arm/arm32/arm32_boot.c
--- a/sys/arch/arm/arm32/arm32_boot.c Tue Jul 31 06:46:25 2018 +0000
+++ b/sys/arch/arm/arm32/arm32_boot.c Tue Jul 31 07:00:48 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm32_boot.c,v 1.19 2017/07/02 16:16:44 skrll Exp $ */
+/* $NetBSD: arm32_boot.c,v 1.20 2018/07/31 07:00:48 skrll Exp $ */
/*
* Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved.
@@ -123,8 +123,9 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.19 2017/07/02 16:16:44 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.20 2018/07/31 07:00:48 skrll Exp $");
+#include "opt_arm_debug.h"
#include "opt_ddb.h"
#include "opt_kgdb.h"
#include "opt_multiprocessor.h"
@@ -151,6 +152,12 @@
#include <sys/kgdb.h>
#endif
+#ifdef VERBOSE_INIT_ARM
+#define VPRINTF(...) printf(__VA_ARGS__)
+#else
+#define VPRINTF(...) do { } while (/* CONSTCOND */ 0)
+#endif
+
#ifdef MULTIPROCESSOR
static kmutex_t cpu_hatch_lock;
#endif
@@ -161,11 +168,9 @@
{
struct bootmem_info * const bmi = &bootmem_info;
-#ifdef VERBOSE_INIT_ARM
- printf("nfreeblocks = %u, free_pages = %d (%#x)\n",
+ VPRINTF("nfreeblocks = %u, free_pages = %d (%#x)\n",
bmi->bmi_nfreeblocks, bmi->bmi_freepages,
bmi->bmi_freepages);
-#endif
/*
* Moved from cpu_startup() as data_abort_handler() references
@@ -194,17 +199,11 @@
tf->tf_spsr = PSR_USR32_MODE;
#endif
-#ifdef VERBOSE_INIT_ARM
- printf("bootstrap done.\n");
-#endif
+ VPRINTF("bootstrap done.\n");
-#ifdef VERBOSE_INIT_ARM
- printf("vectors");
-#endif
+ VPRINTF("vectors");
arm32_vector_init(systempage.pv_va, ARM_VEC_ALL);
-#ifdef VERBOSE_INIT_ARM
- printf(" %#"PRIxVADDR"\n", vector_page);
-#endif
+ VPRINTF(" %#"PRIxVADDR"\n", vector_page);
/*
* Pages were allocated during the secondary bootstrap for the
@@ -214,9 +213,7 @@
* Since the ARM stacks use STMFD etc. we must set r13 to the top end
* of the stack memory.
*/
-#ifdef VERBOSE_INIT_ARM
- printf("init subsystems: stacks ");
-#endif
+ VPRINTF("init subsystems: stacks ");
set_stackptr(PSR_FIQ32_MODE,
fiqstack.pv_va + FIQ_STACK_SIZE * PAGE_SIZE);
set_stackptr(PSR_IRQ32_MODE,
@@ -235,28 +232,20 @@
* Initialisation of the vectors will just panic on a data abort.
* This just fills in a slightly better one.
*/
-#ifdef VERBOSE_INIT_ARM
- printf("vectors ");
-#endif
+ VPRINTF("vectors ");
data_abort_handler_address = (u_int)data_abort_handler;
prefetch_abort_handler_address = (u_int)prefetch_abort_handler;
undefined_handler_address = (u_int)undefinedinstruction_bounce;
/* Initialise the undefined instruction handlers */
-#ifdef VERBOSE_INIT_ARM
- printf("undefined ");
-#endif
+ VPRINTF("undefined ");
undefined_init();
/* Load memory into UVM. */
-#ifdef VERBOSE_INIT_ARM
- printf("page ");
-#endif
+ VPRINTF("page ");
uvm_md_init();
-#ifdef VERBOSE_INIT_ARM
- printf("pmap_physload ");
-#endif
+ VPRINTF("pmap_physload ");
KASSERT(bp != NULL || nbp == 0);
KASSERT(bp == NULL || nbp != 0);
@@ -297,9 +286,7 @@
}
/* Boot strap pmap telling it where the kernel page table is */
-#ifdef VERBOSE_INIT_ARM
- printf("pmap ");
-#endif
+ VPRINTF("pmap ");
pmap_bootstrap(kvm_base, kvm_base + kvm_size);
#ifdef __HAVE_MEMORY_DISK__
@@ -329,9 +316,7 @@
mutex_init(&cpu_hatch_lock, MUTEX_DEFAULT, IPL_NONE);
#endif
-#ifdef VERBOSE_INIT_ARM
- printf("done.\n");
-#endif
+ VPRINTF("done.\n");
/* We return the new stack pointer address */
return pcb->pcb_ksp;
@@ -359,9 +344,7 @@
#endif
#endif
-#ifdef VERBOSE_INIT_ARM
- printf("%s(%s): ", __func__, ci->ci_data.cpu_name);
-#endif
+ VPRINTF("%s(%s): ", __func__, ci->ci_data.cpu_name);
uint32_t mpidr = armreg_mpidr_read();
if (mpidr & MPIDR_MT) {
ci->ci_data.cpu_smt_id = mpidr & MPIDR_AFF0;
@@ -375,18 +358,14 @@
/*
* Make sure we have the right vector page.
*/
-#ifdef VERBOSE_INIT_ARM
- printf(" vectors");
-#endif
+ VPRINTF(" vectors");
arm32_vector_init(systempage.pv_va, ARM_VEC_ALL);
/*
* Initialize the stack for each mode (we are already running on the
* SVC32 stack of the idlelwp).
*/
-#ifdef VERBOSE_INIT_ARM
- printf(" stacks");
-#endif
+ VPRINTF(" stacks");
set_stackptr(PSR_FIQ32_MODE,
fiqstack.pv_va + (cpu_index(ci) + 1) * FIQ_STACK_SIZE * PAGE_SIZE);
set_stackptr(PSR_IRQ32_MODE,
@@ -399,9 +378,7 @@
ci->ci_lastlwp = NULL;
ci->ci_pmap_lastuser = NULL;
#ifdef ARM_MMU_EXTENDED
-#ifdef VERBOSE_INIT_ARM
- printf(" tlb");
-#endif
+ VPRINTF(" tlb");
/*
* Attach to the tlb.
*/
@@ -424,30 +401,22 @@
aprint_naive("%s", device_xname(ci->ci_dev));
aprint_normal("%s", device_xname(ci->ci_dev));
identify_arm_cpu(ci->ci_dev, ci);
-#ifdef VERBOSE_INIT_ARM
- printf(" vfp");
-#endif
+ VPRINTF(" vfp");
vfp_attach(ci);
mutex_exit(&cpu_hatch_lock);
-#ifdef VERBOSE_INIT_ARM
- printf(" interrupts");
-#endif
+ VPRINTF(" interrupts");
/*
* Let the interrupts do what they need to on this CPU.
*/
intr_cpu_init(ci);
-#ifdef VERBOSE_INIT_ARM
Home |
Main Index |
Thread Index |
Old Index