CVS commit: [netbsd-8] src/sys/arch/cats/cats

2019-04-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 28 08:45:31 UTC 2019

Modified Files:
src/sys/arch/cats/cats [netbsd-8]: cats_machdep.c

Log Message:
Redo previous, this time actually using the patch requested in the ticket:
pull up following revision(s) (requested by skrl in ticket #1249):

sys/arch/cats/cats/cats_machdep.c: revision 1.87 (via patch)

The free block after the kernel from arm32_bootmem_init doesn't
account for bt_memavail.  Adjust for this.


To generate a diff of this commit:
cvs rdiff -u -r1.83.6.2 -r1.83.6.3 src/sys/arch/cats/cats/cats_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/cats/cats/cats_machdep.c
diff -u src/sys/arch/cats/cats/cats_machdep.c:1.83.6.2 src/sys/arch/cats/cats/cats_machdep.c:1.83.6.3
--- src/sys/arch/cats/cats/cats_machdep.c:1.83.6.2	Fri Apr 26 20:44:07 2019
+++ src/sys/arch/cats/cats/cats_machdep.c	Sun Apr 28 08:45:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cats_machdep.c,v 1.83.6.2 2019/04/26 20:44:07 martin Exp $	*/
+/*	$NetBSD: cats_machdep.c,v 1.83.6.3 2019/04/28 08:45:31 martin Exp $	*/
 
 /*
  * Copyright (c) 1997,1998 Mark Brinicombe.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cats_machdep.c,v 1.83.6.2 2019/04/26 20:44:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cats_machdep.c,v 1.83.6.3 2019/04/28 08:45:31 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_modular.h"
@@ -232,6 +232,9 @@ void footbridge_pci_bs_tag_init(void);
  *   Relocating the kernel to the bottom of physical memory
  */
 
+#define KERN_PHYSTOV(bmi, pa) \
+	((vaddr_t)((paddr_t)(pa) - (bmi)->bmi_start + KERNEL_BASE))
+
 u_int
 initarm(void *arm_bootargs)
 {
@@ -335,7 +338,7 @@ initarm(void *arm_bootargs)
 	ebsabootinfo.bt_memstart);
 
 	/*
-	 * The free block after the kernel from arm32_bootmem_init doesn't
+	 * The free blocks after the kernel from arm32_bootmem_init doesn't
 	 * account for bt_memavail.  Adjust for this.
 	 */
 	extern struct bootmem_info bootmem_info;
@@ -346,7 +349,7 @@ initarm(void *arm_bootargs)
 	"pv_pa %#lx kernelend %#lx", pv0->pv_pa, bmi->bmi_kernelend);
 
 	pv0->pv_pa = ebsabootinfo.bt_memavail;
-	pv0->pv_va = KERN_PHYSTOV(pv0->pv_pa);
+	pv0->pv_va = KERN_PHYSTOV(bmi, pv0->pv_pa);
 	pv0->pv_size = bmi->bmi_end - pv0->pv_pa;
 
 	printf("First freeblock adjusted to: %lx -> %lx\n", pv0->pv_pa,



CVS commit: [netbsd-8] src/sys/arch/cats/cats

2019-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 26 20:44:07 UTC 2019

Modified Files:
src/sys/arch/cats/cats [netbsd-8]: cats_machdep.c

Log Message:
Pull up following revision(s) (requested by skrl in ticket #1249):

sys/arch/cats/cats/cats_machdep.c: revision 1.87

The free block after the kernel from arm32_bootmem_init doesn't
account for bt_memavail.  Adjust for this.


To generate a diff of this commit:
cvs rdiff -u -r1.83.6.1 -r1.83.6.2 src/sys/arch/cats/cats/cats_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/cats/cats/cats_machdep.c
diff -u src/sys/arch/cats/cats/cats_machdep.c:1.83.6.1 src/sys/arch/cats/cats/cats_machdep.c:1.83.6.2
--- src/sys/arch/cats/cats/cats_machdep.c:1.83.6.1	Wed Jul  5 15:48:01 2017
+++ src/sys/arch/cats/cats/cats_machdep.c	Fri Apr 26 20:44:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cats_machdep.c,v 1.83.6.1 2017/07/05 15:48:01 martin Exp $	*/
+/*	$NetBSD: cats_machdep.c,v 1.83.6.2 2019/04/26 20:44:07 martin Exp $	*/
 
 /*
  * Copyright (c) 1997,1998 Mark Brinicombe.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cats_machdep.c,v 1.83.6.1 2017/07/05 15:48:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cats_machdep.c,v 1.83.6.2 2019/04/26 20:44:07 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_modular.h"
@@ -334,6 +334,24 @@ initarm(void *arm_bootargs)
 	arm32_bootmem_init(ebsabootinfo.bt_memstart, ram_size,
 	ebsabootinfo.bt_memstart);
 
+	/*
+	 * The free block after the kernel from arm32_bootmem_init doesn't
+	 * account for bt_memavail.  Adjust for this.
+	 */
+	extern struct bootmem_info bootmem_info;
+	struct bootmem_info * const bmi = _info;
+
+	pv_addr_t *pv0 = >bmi_freeblocks[0];
+	KASSERTMSG(pv0->pv_pa == bmi->bmi_kernelend,
+	"pv_pa %#lx kernelend %#lx", pv0->pv_pa, bmi->bmi_kernelend);
+
+	pv0->pv_pa = ebsabootinfo.bt_memavail;
+	pv0->pv_va = KERN_PHYSTOV(pv0->pv_pa);
+	pv0->pv_size = bmi->bmi_end - pv0->pv_pa;
+
+	printf("First freeblock adjusted to: %lx -> %lx\n", pv0->pv_pa,
+	pv0->pv_pa + pv0->pv_size - 1);
+
 	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_LOW, 0, cats_devmap,
 	mapallmem_p);
 
@@ -365,9 +383,6 @@ initarm(void *arm_bootargs)
 		ebsabootinfo.bt_pargp, VM_PROT_READ, PTE_CACHE);
 	}
 
-	extern struct bootmem_info bootmem_info;
-	struct bootmem_info * const bmi = _info;
-
 	printf("Doing freeblocks: %d\n", bmi->bmi_nfreeblocks);
 
 	for (size_t i = 0; i < bmi->bmi_nfreeblocks; i++) {