Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/sparc64 Do not hardcode the assumption that...
details: https://anonhg.NetBSD.org/src/rev/de40a692f36e
branches: trunk
changeset: 338888:de40a692f36e
user: martin <martin%NetBSD.org@localhost>
date: Sun Jun 14 19:05:27 2015 +0000
description:
Do not hardcode the assumption that .data and .bss fit together in a single
4 MB page. This allows booting kernels with options USB_DEBUG again.
diffstat:
sys/arch/sparc64/sparc64/autoconf.c | 13 +++++++++----
sys/arch/sparc64/sparc64/pmap.c | 34 ++++++++++++++--------------------
2 files changed, 23 insertions(+), 24 deletions(-)
diffs (158 lines):
diff -r 3540da3ce35c -r de40a692f36e sys/arch/sparc64/sparc64/autoconf.c
--- a/sys/arch/sparc64/sparc64/autoconf.c Sun Jun 14 18:40:10 2015 +0000
+++ b/sys/arch/sparc64/sparc64/autoconf.c Sun Jun 14 19:05:27 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.202 2015/03/15 10:38:58 nakayama Exp $ */
+/* $NetBSD: autoconf.c,v 1.203 2015/06/14 19:05:27 martin Exp $ */
/*
* Copyright (c) 1996
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.202 2015/03/15 10:38:58 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.203 2015/06/14 19:05:27 martin Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -159,7 +159,8 @@
* Kernel 4MB mappings.
*/
struct tlb_entry *kernel_tlbs;
-int kernel_tlb_slots;
+int kernel_dtlb_slots;
+int kernel_itlb_slots;
/* Global interrupt mappings for all device types. Match against the OBP
* 'device_type' property.
@@ -355,7 +356,11 @@
boothowto = bi_howto->boothowto;
LOOKUP_BOOTINFO(bi_count, BTINFO_DTLB_SLOTS);
- kernel_tlb_slots = bi_count->count;
+ kernel_dtlb_slots = bi_count->count;
+ kernel_itlb_slots = kernel_dtlb_slots-1;
+ bi_count = lookup_bootinfo(BTINFO_ITLB_SLOTS);
+ if (bi_count)
+ kernel_itlb_slots = bi_count->count;
LOOKUP_BOOTINFO(bi_tlb, BTINFO_DTLB);
kernel_tlbs = &bi_tlb->tlb[0];
diff -r 3540da3ce35c -r de40a692f36e sys/arch/sparc64/sparc64/pmap.c
--- a/sys/arch/sparc64/sparc64/pmap.c Sun Jun 14 18:40:10 2015 +0000
+++ b/sys/arch/sparc64/sparc64/pmap.c Sun Jun 14 19:05:27 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.294 2015/04/16 08:58:44 mrg Exp $ */
+/* $NetBSD: pmap.c,v 1.295 2015/06/14 19:05:27 martin Exp $ */
/*
*
* Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.294 2015/04/16 08:58:44 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.295 2015/06/14 19:05:27 martin Exp $");
#undef NO_VCACHE /* Don't forget the locked TLB in dostart */
#define HWREF
@@ -209,7 +209,7 @@
* Kernel 4MB pages.
*/
extern struct tlb_entry *kernel_tlbs;
-extern int kernel_tlb_slots;
+extern int kernel_dtlb_slots, kernel_itlb_slots;
static int npgs;
@@ -525,11 +525,11 @@
}
memcpy(v, mp_tramp_code, mp_tramp_code_len);
- *(u_long *)(v + mp_tramp_tlb_slots) = kernel_tlb_slots;
+ *(u_long *)(v + mp_tramp_tlb_slots) = kernel_dtlb_slots;
*(u_long *)(v + mp_tramp_func) = (u_long)cpu_mp_startup;
*(u_long *)(v + mp_tramp_ci) = (u_long)cpu_args;
tp = (pte_t *)(v + mp_tramp_code_len);
- for (i = 0; i < kernel_tlb_slots; i++) {
+ for (i = 0; i < kernel_dtlb_slots; i++) {
tp[i].tag = kernel_tlbs[i].te_va;
tp[i].data = TSB_DATA(0, /* g */
PGSZ_4M, /* sz */
@@ -542,18 +542,12 @@
0 /* ie */);
tp[i].data |= TLB_L | TLB_CV;
- /*
- * Assuming that the last tlb slot entry is the only data slot.
- *
- * If more than one data slot is required on day, perhaps
- * the bootinfo structure shared between ofwboot and the kernel
- * should be expanded to include the number of data slots.
- */
- if (i == kernel_tlb_slots-1)
+ if (i >= kernel_itlb_slots) {
tp[i].data |= TLB_W;
- else
+ } else {
if (CPU_ISSUN4V)
tp[i].data |= SUN4V_TLB_X;
+ }
DPRINTF(PDB_BOOT1, ("xtlb[%d]: Tag: %" PRIx64 " Data: %"
PRIx64 "\n", i, tp[i].tag, tp[i].data));
@@ -576,7 +570,7 @@
int i;
paddr_t paddr = (paddr_t)-1;
- for (i = 0; i < kernel_tlb_slots; i++) {
+ for (i = 0; i < kernel_dtlb_slots; i++) {
if ((va & ~PAGE_MASK_4M) == kernel_tlbs[i].te_va) {
paddr = kernel_tlbs[i].te_pa +
(paddr_t)(va & PAGE_MASK_4M);
@@ -584,7 +578,7 @@
}
}
- if (i == kernel_tlb_slots) {
+ if (i == kernel_dtlb_slots) {
panic("pmap_kextract: Address %p is not from kernel space.\n"
"Data segment is too small?\n", (void*)va);
}
@@ -2352,7 +2346,7 @@
int sz;
sz = ALIGN(sizeof(kcore_seg_t)) + ALIGN(sizeof(cpu_kcore_hdr_t));
- sz += kernel_tlb_slots * sizeof(struct cpu_kcore_4mbseg);
+ sz += kernel_dtlb_slots * sizeof(struct cpu_kcore_4mbseg);
sz += phys_installed_size * sizeof(phys_ram_seg_t);
return btodb(sz + DEV_BSIZE - 1);
@@ -2428,7 +2422,7 @@
/* new version of locked segments description */
kcpu->newmagic = SPARC64_KCORE_NEWMAGIC;
- kcpu->num4mbsegs = kernel_tlb_slots;
+ kcpu->num4mbsegs = kernel_dtlb_slots;
kcpu->off4mbsegs = ALIGN(sizeof(cpu_kcore_hdr_t));
/* description of per-cpu mappings */
@@ -2440,7 +2434,7 @@
/* Now the memsegs */
kcpu->nmemseg = phys_installed_size;
kcpu->memsegoffset = kcpu->off4mbsegs
- + kernel_tlb_slots * sizeof(struct cpu_kcore_4mbseg);
+ + kernel_dtlb_slots * sizeof(struct cpu_kcore_4mbseg);
/* Now we need to point this at our kernel pmap. */
kcpu->nsegmap = STSZ;
@@ -2450,7 +2444,7 @@
bp = (int *)((long)kcpu + ALIGN(sizeof(cpu_kcore_hdr_t)));
/* write locked kernel 4MB TLBs */
- for (i = 0; i < kernel_tlb_slots; i++) {
+ for (i = 0; i < kernel_dtlb_slots; i++) {
ktlb.va = kernel_tlbs[i].te_va;
ktlb.pa = kernel_tlbs[i].te_pa;
EXPEDITE(&ktlb, sizeof(ktlb));
Home |
Main Index |
Thread Index |
Old Index