Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Cleaned up BTLB support. There are no longer BTLB ...
details: https://anonhg.NetBSD.org/src/rev/2ef62ef2e862
branches: trunk
changeset: 535463:2ef62ef2e862
user: fredette <fredette%NetBSD.org@localhost>
date: Mon Aug 19 18:58:26 2002 +0000
description:
Cleaned up BTLB support. There are no longer BTLB function pointers
in struct hppa_cpu_info or anywhere else, now there are just hppa_btlb_*
functions. Added support for machines with split I/D and variable-range
BTLBs. Added support for purging BTLB entries.
diffstat:
sys/arch/hp700/hp700/machdep.c | 381 ++++++++++++++++++++++++++-------------
sys/arch/hp700/hp700/mainbus.c | 5 +-
sys/arch/hp700/include/cpu.h | 7 +-
sys/arch/hppa/hppa/machdep.h | 7 +-
sys/arch/hppa/hppa/pmap.c | 4 +-
sys/arch/hppa/include/cpufunc.h | 4 +-
6 files changed, 262 insertions(+), 146 deletions(-)
diffs (truncated from 693 to 300 lines):
diff -r 4b07039dd74d -r 2ef62ef2e862 sys/arch/hp700/hp700/machdep.c
--- a/sys/arch/hp700/hp700/machdep.c Mon Aug 19 18:27:31 2002 +0000
+++ b/sys/arch/hp700/hp700/machdep.c Mon Aug 19 18:58:26 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.2 2002/08/05 20:58:36 fredette Exp $ */
+/* $NetBSD: machdep.c,v 1.3 2002/08/19 18:58:29 fredette Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -162,16 +162,31 @@
struct pdc_btlb pdc_btlb PDC_ALIGNMENT;
/*
- * A record of inserted BTLB mappings.
+ * The BTLB slots.
*/
-struct btlb_entry {
- pa_space_t btlb_entry_va_space;
- vaddr_t btlb_entry_va_frame;
- paddr_t btlb_entry_pa_frame;
- vsize_t btlb_entry_frames;
- u_int btlb_entry_tlbprot;
- int btlb_entry_num;
-} btlb_entries[32]; /* XXX assumed to be big enough */
+static struct btlb_slot {
+
+ /* The number associated with this slot. */
+ int btlb_slot_number;
+
+ /* The flags associated with this slot. */
+ int btlb_slot_flags;
+#define BTLB_SLOT_IBTLB (1 << 0)
+#define BTLB_SLOT_DBTLB (1 << 1)
+#define BTLB_SLOT_CBTLB (BTLB_SLOT_IBTLB | BTLB_SLOT_DBTLB)
+#define BTLB_SLOT_VARIABLE_RANGE (1 << 2)
+
+ /*
+ * The mapping information. A mapping is free
+ * if its btlb_slot_frames member is zero.
+ */
+ pa_space_t btlb_slot_va_space;
+ vaddr_t btlb_slot_va_frame;
+ paddr_t btlb_slot_pa_frame;
+ vsize_t btlb_slot_frames;
+ u_int btlb_slot_tlbprot;
+} *btlb_slots;
+int btlb_slots_count;
/* w/ a little deviation should be the same for all installed cpus */
u_int cpu_ticksnum, cpu_ticksdenom, cpu_hzticks;
@@ -189,10 +204,6 @@
*/
int (*cpu_desidhash) __P((void));
int (*cpu_hpt_init) __P((vaddr_t hpt, vsize_t hptsize));
-int (*cpu_ibtlb_ins) __P((int i, pa_space_t sp, vaddr_t va, paddr_t pa,
- vsize_t sz, u_int prot));
-int (*cpu_dbtlb_ins) __P((int i, pa_space_t sp, vaddr_t va, paddr_t pa,
- vsize_t sz, u_int prot));
dev_t bootdev;
int totalphysmem, physmem, esym;
@@ -255,18 +266,6 @@
extern const u_int itlb_s[], dtlb_s[], dtlbna_s[], tlbd_s[];
extern const u_int itlb_t[], dtlb_t[], dtlbna_t[], tlbd_t[];
extern const u_int itlb_l[], dtlb_l[], dtlbna_l[], tlbd_l[];
-int iibtlb_s __P((int i, pa_space_t sp, vaddr_t va, paddr_t pa,
- vsize_t sz, u_int prot));
-int idbtlb_s __P((int i, pa_space_t sp, vaddr_t va, paddr_t pa,
- vsize_t sz, u_int prot));
-int ibtlb_t __P((int i, pa_space_t sp, vaddr_t va, paddr_t pa,
- vsize_t sz, u_int prot));
-int ibtlb_l __P((int i, pa_space_t sp, vaddr_t va, paddr_t pa,
- vsize_t sz, u_int prot));
-int ibtlb_g __P((int i, pa_space_t sp, vaddr_t va, paddr_t pa,
- vsize_t sz, u_int prot));
-int pbtlb_g __P((int i));
-int hpti_l __P((vaddr_t, vsize_t));
int hpti_g __P((vaddr_t, vsize_t));
int desidhash_x __P((void));
int desidhash_s __P((void));
@@ -277,14 +276,14 @@
NULL, \
NULL, 0, \
NULL, NULL, NULL, NULL, NULL, \
- NULL, NULL, NULL
+ NULL
const struct hppa_cpu_info hppa_cpu_pa7000_pcx = {
"PA7000",
#ifdef HP7000_CPU
NULL,
"PCX", HPPA_PA_SPEC_MAKE(1, 0, '\0'),
desidhash_x, itlb_x, dtlb_x, dtlbna_x, tlbd_x,
- ibtlb_g, NULL, pbtlb_g
+ NULL
#else /* !HP7000_CPU */
_HPPA_CPU_UNSUPP
#endif /* !HP7000_CPU */
@@ -295,7 +294,7 @@
NULL,
"PCX-S", HPPA_PA_SPEC_MAKE(1, 1, 'a'),
desidhash_s, itlb_s, dtlb_s, dtlbna_s, tlbd_s,
- ibtlb_g, NULL, pbtlb_g
+ NULL
#else /* !HP7000_CPU */
_HPPA_CPU_UNSUPP
#endif /* !HP7000_CPU */
@@ -306,7 +305,6 @@
"T-Bird",
"PCX-T", HPPA_PA_SPEC_MAKE(1, 1, 'b'),
desidhash_t, itlb_t, dtlb_t, dtlbna_t, tlbd_t,
- ibtlb_g, NULL, pbtlb_g,
hpti_g
#else /* !HP7100_CPU */
_HPPA_CPU_UNSUPP
@@ -318,7 +316,6 @@
"T-Bird",
"PCX-T", HPPA_PA_SPEC_MAKE(1, 1, 'b'),
desidhash_t, itlb_t, dtlb_t, dtlbna_t, tlbd_t,
- ibtlb_g, NULL, pbtlb_g,
hpti_g
#else /* !HP7100_CPU */
_HPPA_CPU_UNSUPP
@@ -330,7 +327,7 @@
"T-Bird",
"PCX-T'", HPPA_PA_SPEC_MAKE(1, 1, 'd'),
desidhash_t, itlb_t, dtlb_t, dtlbna_t, tlbd_t,
- ibtlb_g, NULL, pbtlb_g
+ NULL
#else /* !HP7200_CPU */
_HPPA_CPU_UNSUPP
#endif /* !HP7200_CPU */
@@ -341,7 +338,7 @@
"Hummingbird",
"PCX-L", HPPA_PA_SPEC_MAKE(1, 1, 'c'),
desidhash_l, itlb_l, dtlb_l, dtlbna_l, tlbd_l,
- ibtlb_g, NULL, pbtlb_g, hpti_g
+ hpti_g
#else /* !HP7100LC_CPU */
_HPPA_CPU_UNSUPP
#endif /* !HP7100LC_CPU */
@@ -352,7 +349,7 @@
"Velociraptor",
"PCX-L2", HPPA_PA_SPEC_MAKE(1, 1, 'e'),
desidhash_l, itlb_l, dtlb_l, dtlbna_l, tlbd_l,
- ibtlb_g, NULL, pbtlb_g, hpti_g
+ hpti_g
#else /* !HP7300LC_CPU */
_HPPA_CPU_UNSUPP
#endif /* !HP7300LC_CPU */
@@ -363,7 +360,7 @@
"Onyx",
"PCX-U", HPPA_PA_SPEC_MAKE(2, 0, '\0'),
desidhash_g, itlb_l, dtlb_l, dtlbna_l, tlbd_l,
- ibtlb_g, NULL, pbtlb_g, hpti_g
+ hpti_g
#else /* !HP8000_CPU */
_HPPA_CPU_UNSUPP
#endif /* !HP8000_CPU */
@@ -374,7 +371,7 @@
NULL,
"PCX-W", HPPA_PA_SPEC_MAKE(2, 0, '\0'),
desidhash_g, itlb_l, dtlb_l, dtlbna_l, tlbd_l,
- ibtlb_g, NULL, pbtlb_g, hpti_g
+ hpti_g
#else /* !HP8200_CPU */
_HPPA_CPU_UNSUPP
#endif /* !HP8200_CPU */
@@ -385,7 +382,7 @@
"Barra'Cuda",
"PCX-W", HPPA_PA_SPEC_MAKE(2, 0, '\0'),
desidhash_g, itlb_l, dtlb_l, dtlbna_l, tlbd_l,
- ibtlb_g, NULL, pbtlb_g, hpti_g
+ hpti_g
#else /* !HP8500_CPU */
_HPPA_CPU_UNSUPP
#endif /* !HP8500_CPU */
@@ -396,7 +393,7 @@
NULL,
"PCX-W+", HPPA_PA_SPEC_MAKE(2, 0, '\0'),
desidhash_g, itlb_l, dtlb_l, dtlbna_l, tlbd_l,
- ibtlb_g, NULL, pbtlb_g, hpti_g
+ hpti_g
#else /* !HP8600_CPU */
_HPPA_CPU_UNSUPP
#endif /* !HP8600_CPU */
@@ -413,6 +410,8 @@
u_int *p, *q;
struct pdc_cpuid pdc_cpuid PDC_ALIGNMENT;
const char *model;
+ struct btlb_slot *btlb_slot;
+ int btlb_slot_i;
#ifdef KGDB
boothowto |= RB_KDB; /* go to kgdb early if compiled in. */
@@ -649,8 +648,6 @@
extern u_int trap_ep_T_ITLBMISS[];
extern u_int trap_ep_T_ITLBMISSNA[];
- cpu_ibtlb_ins = hppa_cpu_info->ibtlbins;
- cpu_dbtlb_ins = hppa_cpu_info->dbtlbins;
cpu_hpt_init = hppa_cpu_info->hptinit;
cpu_desidhash = hppa_cpu_info->desidhash;
@@ -707,6 +704,30 @@
EX_NOCOALESCE|EX_NOWAIT);
vstart += DMA24_SIZE;
vstart = hppa_round_page(vstart);
+
+ /* Allocate and initialize the BTLB slots array. */
+ btlb_slots = (struct btlb_slot *) ALIGN(vstart);
+ btlb_slot = btlb_slots;
+#define BTLB_SLOTS(count, flags) \
+do { \
+ for (btlb_slot_i = 0; \
+ btlb_slot_i < pdc_btlb.count; \
+ btlb_slot_i++) { \
+ btlb_slot->btlb_slot_number = (btlb_slot - btlb_slots); \
+ btlb_slot->btlb_slot_flags = flags; \
+ btlb_slot->btlb_slot_frames = 0; \
+ btlb_slot++; \
+ } \
+} while (/* CONSTCOND */ 0)
+ BTLB_SLOTS(finfo.num_i, BTLB_SLOT_IBTLB);
+ BTLB_SLOTS(finfo.num_d, BTLB_SLOT_DBTLB);
+ BTLB_SLOTS(finfo.num_c, BTLB_SLOT_CBTLB);
+ BTLB_SLOTS(vinfo.num_i, BTLB_SLOT_IBTLB | BTLB_SLOT_VARIABLE_RANGE);
+ BTLB_SLOTS(vinfo.num_d, BTLB_SLOT_DBTLB | BTLB_SLOT_VARIABLE_RANGE);
+ BTLB_SLOTS(vinfo.num_c, BTLB_SLOT_CBTLB | BTLB_SLOT_VARIABLE_RANGE);
+#undef BTLB_SLOTS
+ btlb_slots_count = (btlb_slot - btlb_slots);
+ vstart = hppa_round_page((vaddr_t) btlb_slot);
/* Calculate the OS_TOC handler checksum. */
p = (u_int *) &os_toc;
@@ -1017,46 +1038,19 @@
&pdc_hwtlb, hpt, hptsize, PDC_TLB_CURRPDE);
}
-int
-pbtlb_g(i)
- int i;
-{
- return -1;
-}
-
-int
-ibtlb_g(i, sp, va, pa, sz, prot)
- int i;
- pa_space_t sp;
- vaddr_t va;
- paddr_t pa;
- vsize_t sz;
- u_int prot;
-{
- int error;
-
- if ((error = pdc_call((iodcio_t)pdc, 0, PDC_BLOCK_TLB, PDC_BTLB_INSERT,
- sp, va, pa, sz, prot, i)) < 0) {
-#ifdef BTLBDEBUG
- printf("WARNING: BTLB insert failed (%d)\n", error);
-#endif
- }
- return error;
-}
-
/*
- * This inserts a recorded BTLB entry.
+ * This inserts a recorded BTLB slot.
*/
-static int _btlb_insert __P((struct btlb_entry *));
+static int _hp700_btlb_insert __P((struct btlb_slot *));
static int
-_btlb_insert(struct btlb_entry *btlb_entry)
+_hp700_btlb_insert(struct btlb_slot *btlb_slot)
{
int error;
#ifdef DEBUG
const char *prot;
/* Display the protection like a file protection. */
- switch (btlb_entry->btlb_entry_tlbprot & TLB_AR_MASK) {
+ switch (btlb_slot->btlb_slot_tlbprot & TLB_AR_MASK) {
case TLB_AR_NA: prot = "------"; break;
case TLB_AR_KR: prot = "r-----"; break;
case TLB_AR_KRW: prot = "rw----"; break;
@@ -1069,58 +1063,79 @@
default: prot = "??????"; break;
}
- printf(" [ BTLB entry %d: %s 0x%08x @ 0x%x:0x%08x len 0x%08x ] ",
- btlb_entry->btlb_entry_num,
+ printf(" [ BTLB slot %d: %s 0x%08x @ 0x%x:0x%08x len 0x%08x ] ",
+ btlb_slot->btlb_slot_number,
prot,
- (u_int)btlb_entry->btlb_entry_pa_frame << PGSHIFT,
- btlb_entry->btlb_entry_va_space,
- (u_int)btlb_entry->btlb_entry_va_frame << PGSHIFT,
- (u_int)btlb_entry->btlb_entry_frames << PGSHIFT);
+ (u_int)btlb_slot->btlb_slot_pa_frame << PGSHIFT,
+ btlb_slot->btlb_slot_va_space,
Home |
Main Index |
Thread Index |
Old Index