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 | PTE | PAGE_OFFSET |
-----------------------------------
Also the physical address is 64bit.
Signed-off-by: Suzuki K. Poulose <suzuki(a)in.ibm.com>
---
defs.h | 19 +++++++++++++++++++
ppc.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/defs.h b/defs.h
index 0c5558e..6a6011f 100755
--- a/defs.h
+++ b/defs.h
@@ -2654,6 +2654,12 @@ 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)
+
/* PAGE flags */
#define _PAGE_PRESENT (machdep->machspec->_page_present) /* software: pte
contains a translation */
#define _PAGE_USER (machdep->machspec->_page_user) /* matches one of the PP
bits */
@@ -2680,6 +2686,19 @@ struct load_module {
#define DEFAULT_PAGE_HWWRITE 0x200
#define DEFAULT_PAGE_SHARED 0
+/* PPC44x PAGE flags: Values from kernel asm/pte-44x.h */
+#define PPC44x_PAGE_PRESENT 0x001
+#define PPC44x_PAGE_RW 0x002
+#define PPC44x_PAGE_ACCESSED 0x008
+#define PPC44x_PAGE_DIRTY 0x010
+#define PPC44x_PAGE_USER 0x040
+#define PPC44x_PAGE_GUARDED 0x100
+#define PPC44x_PAGE_COHERENT 0x200
+#define PPC44x_PAGE_NO_CACHE 0x400
+#define PPC44x_PAGE_WRITETHRU 0x800
+#define PPC44x_PAGE_HWWRITE 0
+#define PPC44x_PAGE_SHARED 0
+
#define SWP_TYPE(entry) (((entry) >> 1) & 0x7f)
#define SWP_OFFSET(entry) ((entry) >> 8)
#define __swp_type(entry) SWP_TYPE(entry)
diff --git a/ppc.c b/ppc.c
index 9f765b6..2cde018 100755
--- a/ppc.c
+++ b/ppc.c
@@ -73,16 +73,51 @@ static struct line_number_hook ppc_line_number_hooks[];
static struct machine_specific ppc_machine_specific = { 0 };
static int probe_default_platform(char *);
+static int probe_ppc44x_platform(char *);
static void ppc_probe_base_platform(void);
typedef int (*probe_func_t) (char *);
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 machine_specific *machspec = machdep->machspec;
+
+ /* 44x include ppc440* and ppc470 */
+ if (STRNEQ(name, "ppc440") || STREQ(name, "ppc470")) {
+
+ machspec->platform = strdup(name);
+
+ machspec->pgdir_shift = PPC44x_PGDIR_SHIFT;
+ machspec->ptrs_per_pgd = PPC44x_PTRS_PER_PGD;
+ machspec->ptrs_per_pte = PPC44x_PTRS_PER_PTE;
+ machspec->pte_size = PPC44x_PTE_SIZE;
+
+ machspec->_page_present = PPC44x_PAGE_PRESENT;
+ machspec->_page_user = PPC44x_PAGE_USER;
+ machspec->_page_rw = PPC44x_PAGE_RW;
+ machspec->_page_guarded = PPC44x_PAGE_GUARDED;
+ machspec->_page_coherent = PPC44x_PAGE_COHERENT;
+ machspec->_page_no_cache = PPC44x_PAGE_NO_CACHE;
+ machspec->_page_writethru = PPC44x_PAGE_WRITETHRU;
+ machspec->_page_dirty = PPC44x_PAGE_DIRTY;
+ machspec->_page_accessed = PPC44x_PAGE_ACCESSED;
+ machspec->_page_hwwrite = PPC44x_PAGE_HWWRITE;
+ machspec->_page_shared = PPC44x_PAGE_SHARED;
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static int
probe_default_platform(char *name)
{
struct machine_specific *machspec = machdep->machspec;