Author: jhibbits
Date: Sat Aug 22 07:27:06 2015
New Revision: 287015
URL: https://svnweb.freebsd.org/changeset/base/287015

Log:
  Follow up to r287014
  
  Missed these files, from the original diff.
  Sponsored by: Alex Perez/Inertial Computing
  Differential Revision:        https://reviews.freebsd.org/D3027

Modified:
  head/sys/powerpc/booke/trap_subr.S
  head/sys/powerpc/include/_types.h
  head/sys/powerpc/include/pte.h
  head/sys/powerpc/include/tlb.h
  head/sys/powerpc/powerpc/uma_machdep.c

Modified: head/sys/powerpc/booke/trap_subr.S
==============================================================================
--- head/sys/powerpc/booke/trap_subr.S  Sat Aug 22 07:20:03 2015        
(r287014)
+++ head/sys/powerpc/booke/trap_subr.S  Sat Aug 22 07:27:06 2015        
(r287015)
@@ -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

Modified: head/sys/powerpc/include/_types.h
==============================================================================
--- head/sys/powerpc/include/_types.h   Sat Aug 22 07:20:03 2015        
(r287014)
+++ head/sys/powerpc/include/_types.h   Sat Aug 22 07:27:06 2015        
(r287015)
@@ -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;

Modified: head/sys/powerpc/include/pte.h
==============================================================================
--- head/sys/powerpc/include/pte.h      Sat Aug 22 07:20:03 2015        
(r287014)
+++ head/sys/powerpc/include/pte.h      Sat Aug 22 07:27:06 2015        
(r287015)
@@ -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)

Modified: head/sys/powerpc/include/tlb.h
==============================================================================
--- head/sys/powerpc/include/tlb.h      Sat Aug 22 07:20:03 2015        
(r287014)
+++ head/sys/powerpc/include/tlb.h      Sat Aug 22 07:27:06 2015        
(r287015)
@@ -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);

Modified: head/sys/powerpc/powerpc/uma_machdep.c
==============================================================================
--- head/sys/powerpc/powerpc/uma_machdep.c      Sat Aug 22 07:20:03 2015        
(r287014)
+++ head/sys/powerpc/powerpc/uma_machdep.c      Sat Aug 22 07:27:06 2015        
(r287015)
@@ -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
                        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));
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to