summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authorjhibbits <jhibbits@FreeBSD.org>2015-08-22 07:27:06 +0000
committerjhibbits <jhibbits@FreeBSD.org>2015-08-22 07:27:06 +0000
commit518b52117aaf0455bc1c41305c2d98602e184a6b (patch)
treec10d3f5b6564f6cf555f4321b9548227cc23cb82 /sys/powerpc
parent83ce86ca5489fc4358f2d347d7f100ac6146d227 (diff)
downloadFreeBSD-src-518b52117aaf0455bc1c41305c2d98602e184a6b.zip
FreeBSD-src-518b52117aaf0455bc1c41305c2d98602e184a6b.tar.gz
Follow up to r287014
Missed these files, from the original diff. Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D3027
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/booke/trap_subr.S8
-rw-r--r--sys/powerpc/include/_types.h4
-rw-r--r--sys/powerpc/include/pte.h9
-rw-r--r--sys/powerpc/include/tlb.h3
-rw-r--r--sys/powerpc/powerpc/uma_machdep.c9
5 files changed, 28 insertions, 5 deletions
diff --git a/sys/powerpc/booke/trap_subr.S b/sys/powerpc/booke/trap_subr.S
index 9e240f4..f2b6c6e 100644
--- a/sys/powerpc/booke/trap_subr.S
+++ b/sys/powerpc/booke/trap_subr.S
@@ -697,8 +697,10 @@ tlb_fill_entry:
/* Setup MAS3 value in r23. */
lwz %r23, PTE_RPN(%r25) /* get pte->rpn */
+ rlwinm %r22, %r23, 12, 0, 20 /* extract MAS3 portion of RPN */
- rlwimi %r23, %r21, 24, 26, 31 /* insert protection bits from pte */
+ rlwimi %r22, %r21, 24, 26, 31 /* insert protection bits from pte */
+ rlwinm %r23, %r23, 12, 28, 31 /* MAS7 portion of RPN */
/* Load MAS registers. */
mtspr SPR_MAS0, %r29
@@ -707,7 +709,9 @@ tlb_fill_entry:
isync
mtspr SPR_MAS2, %r27
isync
- mtspr SPR_MAS3, %r23
+ mtspr SPR_MAS3, %r22
+ isync
+ mtspr SPR_MAS7, %r23
isync
tlbwe
diff --git a/sys/powerpc/include/_types.h b/sys/powerpc/include/_types.h
index 2c5e274..2c92afc 100644
--- a/sys/powerpc/include/_types.h
+++ b/sys/powerpc/include/_types.h
@@ -128,7 +128,11 @@ typedef __uint64_t __vm_size_t;
#else
typedef __uint32_t __u_register_t;
typedef __uint32_t __vm_offset_t;
+#ifdef BOOKE
+typedef __uint64_t __vm_paddr_t;
+#else
typedef __uint32_t __vm_paddr_t;
+#endif
typedef __uint32_t __vm_size_t;
#endif
typedef __int64_t __vm_ooffset_t;
diff --git a/sys/powerpc/include/pte.h b/sys/powerpc/include/pte.h
index b3e103a..3a27929 100644
--- a/sys/powerpc/include/pte.h
+++ b/sys/powerpc/include/pte.h
@@ -207,10 +207,13 @@ typedef struct lpte lpte_t;
/*
* Page Table Entry definitions and macros.
+ *
+ * RPN need only be 32-bit because Book-E has 36-bit addresses, and the smallest
+ * page size is 4k (12-bit mask), so RPN can really fit into 24 bits.
*/
#ifndef LOCORE
struct pte {
- vm_paddr_t rpn;
+ vm_offset_t rpn;
uint32_t flags;
};
typedef struct pte pte_t;
@@ -266,7 +269,9 @@ typedef struct pte pte_t;
#define PTE_REFERENCED 0x04000000 /* Referenced */
/* Macro argument must of pte_t type. */
-#define PTE_PA(pte) ((pte)->rpn & ~PTE_PA_MASK)
+#define PTE_PA_SHIFT 12
+#define PTE_RPN_FROM_PA(pa) ((pa) >> PTE_PA_SHIFT)
+#define PTE_PA(pte) ((vm_paddr_t)((pte)->rpn) << PTE_PA_SHIFT)
#define PTE_ISVALID(pte) ((pte)->flags & PTE_VALID)
#define PTE_ISWIRED(pte) ((pte)->flags & PTE_WIRED)
#define PTE_ISMANAGED(pte) ((pte)->flags & PTE_MANAGED)
diff --git a/sys/powerpc/include/tlb.h b/sys/powerpc/include/tlb.h
index 58a1a01..47f2af2 100644
--- a/sys/powerpc/include/tlb.h
+++ b/sys/powerpc/include/tlb.h
@@ -106,6 +106,8 @@
#define MAS6_SPID0_SHIFT 16
#define MAS6_SAS 0x00000001
+#define MAS7_RPN 0x0000000F
+
#define MAS1_GETTID(mas1) (((mas1) & MAS1_TID_MASK) >> MAS1_TID_SHIFT)
#define MAS2_TLB0_ENTRY_IDX_MASK 0x0007f000
@@ -132,6 +134,7 @@ typedef struct tlb_entry {
uint32_t mas1;
uint32_t mas2;
uint32_t mas3;
+ uint32_t mas7;
} tlb_entry_t;
void tlb0_print_tlbentries(void);
diff --git a/sys/powerpc/powerpc/uma_machdep.c b/sys/powerpc/powerpc/uma_machdep.c
index 1c27e3e..d5a458f 100644
--- a/sys/powerpc/powerpc/uma_machdep.c
+++ b/sys/powerpc/powerpc/uma_machdep.c
@@ -53,6 +53,7 @@ void *
uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait)
{
void *va;
+ vm_paddr_t pa;
vm_page_t m;
int pflags;
@@ -69,7 +70,13 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait)
break;
}
- va = (void *) VM_PAGE_TO_PHYS(m);
+ pa = VM_PAGE_TO_PHYS(m);
+
+ /* On book-e sizeof(void *) < sizeof(vm_paddr_t) */
+ if ((vm_offset_t)pa != pa)
+ return (NULL);
+
+ va = (void *)(vm_offset_t)pa;
if (!hw_direct_map)
pmap_kenter((vm_offset_t)va, VM_PAGE_TO_PHYS(m));
OpenPOWER on IntegriCloud