[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 25/32] PPC: Add dump_mmu() for 6xx
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 25/32] PPC: Add dump_mmu() for 6xx |
Date: |
Sun, 30 Jun 2013 03:45:02 +0200 |
From: Fabien Chouteau <address@hidden>
"(qemu) info tlb" is a very useful tool for debugging, so I implemented
the missing 6xx version.
Signed-off-by: Fabien Chouteau <address@hidden>
[agraf: fix printfs on hwaddr to PRI]
Signed-off-by: Alexander Graf <address@hidden>
---
target-ppc/mmu_helper.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c
index 68d5415..34330dc 100644
--- a/target-ppc/mmu_helper.c
+++ b/target-ppc/mmu_helper.c
@@ -1176,6 +1176,94 @@ static void mmubooke206_dump_mmu(FILE *f,
fprintf_function cpu_fprintf,
}
}
+static void mmu6xx_dump_BATs(FILE *f, fprintf_function cpu_fprintf,
+ CPUPPCState *env, int type)
+{
+ target_ulong *BATlt, *BATut, *BATu, *BATl;
+ target_ulong BEPIl, BEPIu, bl;
+ int i;
+
+ switch (type) {
+ case ACCESS_CODE:
+ BATlt = env->IBAT[1];
+ BATut = env->IBAT[0];
+ break;
+ default:
+ BATlt = env->DBAT[1];
+ BATut = env->DBAT[0];
+ break;
+ }
+
+ for (i = 0; i < env->nb_BATs; i++) {
+ BATu = &BATut[i];
+ BATl = &BATlt[i];
+ BEPIu = *BATu & 0xF0000000;
+ BEPIl = *BATu & 0x0FFE0000;
+ bl = (*BATu & 0x00001FFC) << 15;
+ cpu_fprintf(f, "%s BAT%d BATu " TARGET_FMT_lx
+ " BATl " TARGET_FMT_lx "\n\t" TARGET_FMT_lx " "
+ TARGET_FMT_lx " " TARGET_FMT_lx "\n",
+ type == ACCESS_CODE ? "code" : "data", i,
+ *BATu, *BATl, BEPIu, BEPIl, bl);
+ }
+}
+
+static void mmu6xx_dump_mmu(FILE *f, fprintf_function cpu_fprintf,
+ CPUPPCState *env)
+{
+ ppc6xx_tlb_t *tlb;
+ target_ulong sr;
+ int type, way, entry, i;
+
+ cpu_fprintf(f, "HTAB base = 0x%"HWADDR_PRIx"\n", env->htab_base);
+ cpu_fprintf(f, "HTAB mask = 0x%"HWADDR_PRIx"\n", env->htab_mask);
+
+ cpu_fprintf(f, "\nSegment registers:\n");
+ for (i = 0; i < 32; i++) {
+ sr = env->sr[i];
+ if (sr & 0x80000000) {
+ cpu_fprintf(f, "%02d T=%d Ks=%d Kp=%d BUID=0x%03x "
+ "CNTLR_SPEC=0x%05x\n", i,
+ sr & 0x80000000 ? 1 : 0, sr & 0x40000000 ? 1 : 0,
+ sr & 0x20000000 ? 1 : 0, (uint32_t)((sr >> 20) &
0x1FF),
+ (uint32_t)(sr & 0xFFFFF));
+ } else {
+ cpu_fprintf(f, "%02d T=%d Ks=%d Kp=%d N=%d VSID=0x%06x\n", i,
+ sr & 0x80000000 ? 1 : 0, sr & 0x40000000 ? 1 : 0,
+ sr & 0x20000000 ? 1 : 0, sr & 0x10000000 ? 1 : 0,
+ (uint32_t)(sr & 0x00FFFFFF));
+ }
+ }
+
+ cpu_fprintf(f, "\nBATs:\n");
+ mmu6xx_dump_BATs(f, cpu_fprintf, env, ACCESS_INT);
+ mmu6xx_dump_BATs(f, cpu_fprintf, env, ACCESS_CODE);
+
+ if (env->id_tlbs != 1) {
+ cpu_fprintf(f, "ERROR: 6xx MMU should have separated TLB"
+ " for code and data\n");
+ }
+
+ cpu_fprintf(f, "\nTLBs [EPN EPN + SIZE]\n");
+
+ for (type = 0; type < 2; type++) {
+ for (way = 0; way < env->nb_ways; way++) {
+ for (entry = env->nb_tlb * type + env->tlb_per_way * way;
+ entry < (env->nb_tlb * type + env->tlb_per_way * (way + 1));
+ entry++) {
+
+ tlb = &env->tlb.tlb6[entry];
+ cpu_fprintf(f, "%s TLB %02d/%02d way:%d %s ["
+ TARGET_FMT_lx " " TARGET_FMT_lx "]\n",
+ type ? "code" : "data", entry % env->nb_tlb,
+ env->nb_tlb, way,
+ pte_is_valid(tlb->pte0) ? "valid" : "inval",
+ tlb->EPN, tlb->EPN + TARGET_PAGE_SIZE);
+ }
+ }
+ }
+}
+
void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env)
{
switch (env->mmu_model) {
@@ -1185,6 +1273,10 @@ void dump_mmu(FILE *f, fprintf_function cpu_fprintf,
CPUPPCState *env)
case POWERPC_MMU_BOOKE206:
mmubooke206_dump_mmu(f, cpu_fprintf, env);
break;
+ case POWERPC_MMU_SOFT_6xx:
+ case POWERPC_MMU_SOFT_74xx:
+ mmu6xx_dump_mmu(f, cpu_fprintf, env);
+ break;
#if defined(TARGET_PPC64)
case POWERPC_MMU_64B:
case POWERPC_MMU_2_06:
--
1.8.1.4
- [Qemu-ppc] [PATCH 10/32] intc/openpic: Convert to QOM realize, (continued)
- [Qemu-ppc] [PATCH 10/32] intc/openpic: Convert to QOM realize, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 22/32] Graphics: Switch to 800x600x32 as default mode, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 23/32] booke_ppc: limit booke timer to max when timeout overflow, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 11/32] intc/openpic_kvm: Fix QOM and build issues, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 30/32] PPC: Newworld: Add second uninorth control register set, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 28/32] PPC: Add clock-frequency export for Mac machines, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 21/32] pseries: Update MAINTAINERS information, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 04/32] openpic: factor out some common defines into openpic.h, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 20/32] target-ppc kvm: save cr register, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 17/32] target-ppc: Change default machine for 64-bit, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 25/32] PPC: Add dump_mmu() for 6xx,
Alexander Graf <=
- [Qemu-ppc] [PATCH 31/32] mac-io: Add escc-legacy memory alias region, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 24/32] target-ppc: Introduce unrealizefn for PowerPCCPU, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 27/32] PPC: Introduce an alias cache for faster lookups, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 32/32] PPC: Ignore writes to L2CR, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 18/32] spapr-rtas: add CPU argument to RTAS calls, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 15/32] target-ppc: Drop redundant flags assignments from CPU families, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 08/32] kvm/openpic: in-kernel mpic support, Alexander Graf, 2013/06/29