[Crash-utility] [PATCH v3 3/3] [ppc] virtual address translation bits for PPC44x

Suzuki K. Poulose suzuki at in.ibm.com
Mon Feb 13 07:14:12 UTC 2012


This patch adds the definition for PPC44x virtual address translation.

On ppc44x, the virtual-address is split as below :

Bits   |0      10|11      19|20          31|
       -------------------------------------
       |   PGD   |    PMD   | PAGE_OFFSET  |
        -----------------------------------

Also the physical address is 64bit.

Signed-off-by: Suzuki K. Poulose <suzuki at in.ibm.com>
---

 defs.h |    5 +++++
 ppc.c  |   19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/defs.h b/defs.h
index 603a583..094a442 100755
--- a/defs.h
+++ b/defs.h
@@ -2647,6 +2647,11 @@ struct load_module {
 #define DEFAULT_PTRS_PER_PGD	(1024)
 #define DEFAULT_PTE_SIZE	sizeof(ulong)
 
+/* PPC44x translation bits */
+#define PPC44x_PGDIR_SHIFT	(21)
+#define PPC44x_PTRS_PER_PTE	(512)
+#define PPC44x_PTRS_PER_PGD	(2048)
+#define PPC44x_PTE_SIZE   	sizeof(ulonglong)
 
 #define PGDIR_SHIFT		(base_platform.pgdir_shift)
 #define PTRS_PER_PTE		(base_platform.ptrs_per_pte)
diff --git a/ppc.c b/ppc.c
index 0e934ca..b36bffc 100755
--- a/ppc.c
+++ b/ppc.c
@@ -82,17 +82,36 @@ static void ppc_display_machine_stats(void);
 static void ppc_dump_line_number(ulong);
 static struct line_number_hook ppc_line_number_hooks[];
 
+static int probe_ppc44x_platform(char *, struct platform *);
 static int probe_default_platform(char *, struct platform *);
 static void ppc_probe_base_platform(void);
 
 typedef int (*probe_func_t) (char *, struct platform *);
 
 probe_func_t probe_platforms[] = {
+	probe_ppc44x_platform,	/* 44x chipsets */
 	probe_default_platform, /* This should be at the end */
 	NULL
 };
 
 static int
+probe_ppc44x_platform(char *name, struct platform *p)
+{
+	/* 44x include ppc440* and ppc470 */
+	if (STRNEQ(name, "ppc440") || STREQ(name, "ppc470")) {
+		p->pgdir_shift = PPC44x_PGDIR_SHIFT;
+		p->ptrs_per_pgd = PPC44x_PTRS_PER_PGD;
+		p->ptrs_per_pte = PPC44x_PTRS_PER_PTE;
+		p->pte_size = PPC44x_PTE_SIZE;
+		p->name = strdup(name);
+
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+static int
 probe_default_platform(char *name, struct platform *p)
 {
 	/* Use the default definitions */




More information about the Crash-utility mailing list