Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:09

0001 /*
0002  * Copyright (c) 2005 Jakub Jermar
0003  * All rights reserved.
0004  *
0005  * Redistribution and use in source and binary forms, with or without
0006  * modification, are permitted provided that the following conditions
0007  * are met:
0008  *
0009  * - Redistributions of source code must retain the above copyright
0010  *   notice, this list of conditions and the following disclaimer.
0011  * - Redistributions in binary form must reproduce the above copyright
0012  *   notice, this list of conditions and the following disclaimer in the
0013  *   documentation and/or other materials provided with the distribution.
0014  * - The name of the author may not be used to endorse or promote products
0015  *   derived from this software without specific prior written permission.
0016  *
0017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
0018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
0021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
0026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0027  */
0028 
0029 /** @addtogroup RTEMSBSPsSPARC64mm  
0030  * @{
0031  */
0032 /** @file
0033  */
0034 
0035 #ifndef KERN_sparc64_TLB_sun4u_H_
0036 #define KERN_sparc64_TLB_sun4u_H_
0037 
0038 #if defined (US)
0039 #define ITLB_ENTRY_COUNT        64
0040 #define DTLB_ENTRY_COUNT        64
0041 #define DTLB_MAX_LOCKED_ENTRIES     DTLB_ENTRY_COUNT
0042 #endif
0043 
0044 /** TLB_DSMALL is the only of the three DMMUs that can hold locked entries. */
0045 #if defined (US3)
0046 #define DTLB_MAX_LOCKED_ENTRIES     16
0047 #endif
0048 
0049 #define MEM_CONTEXT_KERNEL      0
0050 #define MEM_CONTEXT_TEMP        1
0051 
0052 /** Page sizes. */
0053 #define PAGESIZE_8K 0
0054 #define PAGESIZE_64K    1
0055 #define PAGESIZE_512K   2
0056 #define PAGESIZE_4M 3
0057 
0058 /** Bit width of the TLB-locked portion of kernel address space. */
0059 #define KERNEL_PAGE_WIDTH       22  /* 4M */
0060 
0061 /* TLB Demap Operation types. */
0062 #define TLB_DEMAP_PAGE      0
0063 #define TLB_DEMAP_CONTEXT   1
0064 #if defined (US3)
0065 #define TLB_DEMAP_ALL       2
0066 #endif
0067 
0068 #define TLB_DEMAP_TYPE_SHIFT    6
0069 
0070 /* TLB Demap Operation Context register encodings. */
0071 #define TLB_DEMAP_PRIMARY   0
0072 #define TLB_DEMAP_SECONDARY 1
0073 #define TLB_DEMAP_NUCLEUS   2
0074 
0075 /* There are more TLBs in one MMU in US3, their codes are defined here. */
0076 #if defined (US3)
0077 /* D-MMU: one small (16-entry) TLB and two big (512-entry) TLBs */
0078 #define TLB_DSMALL  0
0079 #define TLB_DBIG_0  2
0080 #define TLB_DBIG_1  3
0081     
0082 /* I-MMU: one small (16-entry) TLB and one big TLB */
0083 #define TLB_ISMALL  0
0084 #define TLB_IBIG    2
0085 #endif
0086 
0087 #define TLB_DEMAP_CONTEXT_SHIFT 4
0088 
0089 /* TLB Tag Access shifts */
0090 #define TLB_TAG_ACCESS_CONTEXT_SHIFT    0
0091 #define TLB_TAG_ACCESS_CONTEXT_MASK ((1 << 13) - 1)
0092 #define TLB_TAG_ACCESS_VPN_SHIFT    13
0093 
0094 #ifndef __ASM__
0095 
0096 #include <arch/mm/tte.h>
0097 #include <arch/mm/mmu.h>
0098 #include <arch/mm/page.h>
0099 #include <arch/asm.h>
0100 #include <arch/barrier.h>
0101 #include <arch/types.h>
0102 #include <arch/register.h>
0103 #include <arch/cpu.h>
0104 
0105 union tlb_context_reg {
0106     uint64_t v;
0107     struct {
0108         unsigned long : 51;
0109         unsigned context : 13;      /**< Context/ASID. */
0110     } __attribute__ ((packed));
0111 };
0112 typedef union tlb_context_reg tlb_context_reg_t;
0113 
0114 /** I-/D-TLB Data In/Access Register type. */
0115 typedef tte_data_t tlb_data_t;
0116 
0117 /** I-/D-TLB Data Access Address in Alternate Space. */
0118 
0119 #if defined (US)
0120 
0121 union tlb_data_access_addr {
0122     uint64_t value;
0123     struct {
0124         uint64_t : 55;
0125         unsigned tlb_entry : 6;
0126         unsigned : 3;
0127     } __attribute__ ((packed));
0128 };
0129 typedef union tlb_data_access_addr dtlb_data_access_addr_t;
0130 typedef union tlb_data_access_addr dtlb_tag_read_addr_t;
0131 typedef union tlb_data_access_addr itlb_data_access_addr_t;
0132 typedef union tlb_data_access_addr itlb_tag_read_addr_t;
0133 
0134 #elif defined (US3)
0135 
0136 /*
0137  * In US3, I-MMU and D-MMU have different formats of the data
0138  * access register virtual address. In the corresponding
0139  * structures the member variable for the entry number is
0140  * called "local_tlb_entry" - it contrasts with the "tlb_entry"
0141  * for the US data access register VA structure. The rationale
0142  * behind this is to prevent careless mistakes in the code
0143  * caused by setting only the entry number and not the TLB
0144  * number in the US3 code (when taking the code from US). 
0145  */
0146 
0147 union dtlb_data_access_addr {
0148     uint64_t value;
0149     struct {
0150         uint64_t : 45;
0151         unsigned : 1;
0152         unsigned tlb_number : 2;
0153         unsigned : 4;
0154         unsigned local_tlb_entry : 9;
0155         unsigned : 3;
0156     } __attribute__ ((packed));
0157 };
0158 typedef union dtlb_data_access_addr dtlb_data_access_addr_t;
0159 typedef union dtlb_data_access_addr dtlb_tag_read_addr_t;
0160 
0161 union itlb_data_access_addr {
0162     uint64_t value;
0163     struct {
0164         uint64_t : 45;
0165         unsigned : 1;
0166         unsigned tlb_number : 2;
0167         unsigned : 6;
0168         unsigned local_tlb_entry : 7;
0169         unsigned : 3;
0170     } __attribute__ ((packed));
0171 };
0172 typedef union itlb_data_access_addr itlb_data_access_addr_t;
0173 typedef union itlb_data_access_addr itlb_tag_read_addr_t;
0174 
0175 #endif
0176 
0177 /** I-/D-TLB Tag Read Register. */
0178 union tlb_tag_read_reg {
0179     uint64_t value;
0180     struct {
0181         uint64_t vpn : 51;  /**< Virtual Address bits 63:13. */
0182         unsigned context : 13;  /**< Context identifier. */
0183     } __attribute__ ((packed));
0184 };
0185 typedef union tlb_tag_read_reg tlb_tag_read_reg_t;
0186 typedef union tlb_tag_read_reg tlb_tag_access_reg_t;
0187 
0188 
0189 /** TLB Demap Operation Address. */
0190 union tlb_demap_addr {
0191     uint64_t value;
0192     struct {
0193         uint64_t vpn: 51;   /**< Virtual Address bits 63:13. */
0194 #if defined (US)
0195         unsigned : 6;       /**< Ignored. */
0196         unsigned type : 1;  /**< The type of demap operation. */
0197 #elif defined (US3)
0198         unsigned : 5;       /**< Ignored. */
0199         unsigned type: 2;   /**< The type of demap operation. */
0200 #endif
0201         unsigned context : 2;   /**< Context register selection. */
0202         unsigned : 4;       /**< Zero. */
0203     } __attribute__ ((packed));
0204 };
0205 typedef union tlb_demap_addr tlb_demap_addr_t;
0206 
0207 /** TLB Synchronous Fault Status Register. */
0208 union tlb_sfsr_reg {
0209     uint64_t value;
0210     struct {
0211 #if defined (US)
0212         unsigned long : 40; /**< Implementation dependent. */
0213         unsigned asi : 8;   /**< ASI. */
0214         unsigned : 2;
0215         unsigned ft : 7;    /**< Fault type. */
0216 #elif defined (US3)
0217         unsigned long : 39; /**< Implementation dependent. */
0218         unsigned nf : 1;    /**< Non-faulting load. */
0219         unsigned asi : 8;   /**< ASI. */
0220         unsigned tm : 1;    /**< I-TLB miss. */
0221         unsigned : 3;       /**< Reserved. */
0222         unsigned ft : 5;    /**< Fault type. */
0223 #endif
0224         unsigned e : 1;     /**< Side-effect bit. */
0225         unsigned ct : 2;    /**< Context Register selection. */
0226         unsigned pr : 1;    /**< Privilege bit. */
0227         unsigned w : 1;     /**< Write bit. */
0228         unsigned ow : 1;    /**< Overwrite bit. */
0229         unsigned fv : 1;    /**< Fault Valid bit. */
0230     } __attribute__ ((packed));
0231 };
0232 typedef union tlb_sfsr_reg tlb_sfsr_reg_t;
0233 
0234 #if defined (US3)
0235 
0236 /*
0237  * Functions for determining the number of entries in TLBs. They either return
0238  * a constant value or a value based on the CPU autodetection.
0239  */
0240 
0241 /**
0242  * Determine the number of entries in the DMMU's small TLB. 
0243  */
0244 static inline uint16_t tlb_dsmall_size(void)
0245 {
0246     return 16;
0247 }
0248 
0249 /**
0250  * Determine the number of entries in each DMMU's big TLB. 
0251  */
0252 static inline uint16_t tlb_dbig_size(void)
0253 {
0254     return 512;
0255 }
0256 
0257 /**
0258  * Determine the number of entries in the IMMU's small TLB. 
0259  */
0260 static inline uint16_t tlb_ismall_size(void)
0261 {
0262     return 16;
0263 }
0264 
0265 /**
0266  * Determine the number of entries in the IMMU's big TLB. 
0267  */
0268 static inline uint16_t tlb_ibig_size(void)
0269 {
0270     if (((ver_reg_t) ver_read()).impl == IMPL_ULTRASPARCIV_PLUS)
0271         return 512;
0272     else
0273         return 128;
0274 }
0275 
0276 #endif
0277 
0278 /** Read MMU Primary Context Register.
0279  *
0280  * @return      Current value of Primary Context Register.
0281  */
0282 static inline uint64_t mmu_primary_context_read(void)
0283 {
0284     return asi_u64_read(ASI_DMMU, VA_PRIMARY_CONTEXT_REG);
0285 }
0286 
0287 /** Write MMU Primary Context Register.
0288  *
0289  * @param v     New value of Primary Context Register.
0290  */
0291 static inline void mmu_primary_context_write(uint64_t v)
0292 {
0293     asi_u64_write(ASI_DMMU, VA_PRIMARY_CONTEXT_REG, v);
0294     flush_pipeline();
0295 }
0296 
0297 /** Read MMU Secondary Context Register.
0298  *
0299  * @return      Current value of Secondary Context Register.
0300  */
0301 static inline uint64_t mmu_secondary_context_read(void)
0302 {
0303     return asi_u64_read(ASI_DMMU, VA_SECONDARY_CONTEXT_REG);
0304 }
0305 
0306 /** Write MMU Primary Context Register.
0307  *
0308  * @param v     New value of Primary Context Register.
0309  */
0310 static inline void mmu_secondary_context_write(uint64_t v)
0311 {
0312     asi_u64_write(ASI_DMMU, VA_SECONDARY_CONTEXT_REG, v);
0313     flush_pipeline();
0314 }
0315 
0316 #if defined (US)
0317 
0318 /** Read IMMU TLB Data Access Register.
0319  *
0320  * @param entry     TLB Entry index.
0321  *
0322  * @return      Current value of specified IMMU TLB Data Access
0323  *          Register.
0324  */
0325 static inline uint64_t itlb_data_access_read(size_t entry)
0326 {
0327     itlb_data_access_addr_t reg;
0328     
0329     reg.value = 0;
0330     reg.tlb_entry = entry;
0331     return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value);
0332 }
0333 
0334 /** Write IMMU TLB Data Access Register.
0335  *
0336  * @param entry     TLB Entry index.
0337  * @param value     Value to be written.
0338  */
0339 static inline void itlb_data_access_write(size_t entry, uint64_t value)
0340 {
0341     itlb_data_access_addr_t reg;
0342     
0343     reg.value = 0;
0344     reg.tlb_entry = entry;
0345     asi_u64_write(ASI_ITLB_DATA_ACCESS_REG, reg.value, value);
0346     flush_pipeline();
0347 }
0348 
0349 /** Read DMMU TLB Data Access Register.
0350  *
0351  * @param entry     TLB Entry index.
0352  *
0353  * @return      Current value of specified DMMU TLB Data Access
0354  *          Register.
0355  */
0356 static inline uint64_t dtlb_data_access_read(size_t entry)
0357 {
0358     dtlb_data_access_addr_t reg;
0359     
0360     reg.value = 0;
0361     reg.tlb_entry = entry;
0362     return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value);
0363 }
0364 
0365 /** Write DMMU TLB Data Access Register.
0366  *
0367  * @param entry     TLB Entry index.
0368  * @param value     Value to be written.
0369  */
0370 static inline void dtlb_data_access_write(size_t entry, uint64_t value)
0371 {
0372     dtlb_data_access_addr_t reg;
0373     
0374     reg.value = 0;
0375     reg.tlb_entry = entry;
0376     asi_u64_write(ASI_DTLB_DATA_ACCESS_REG, reg.value, value);
0377     membar();
0378 }
0379 
0380 /** Read IMMU TLB Tag Read Register.
0381  *
0382  * @param entry     TLB Entry index.
0383  *
0384  * @return      Current value of specified IMMU TLB Tag Read Register.
0385  */
0386 static inline uint64_t itlb_tag_read_read(size_t entry)
0387 {
0388     itlb_tag_read_addr_t tag;
0389 
0390     tag.value = 0;
0391     tag.tlb_entry = entry;
0392     return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value);
0393 }
0394 
0395 /** Read DMMU TLB Tag Read Register.
0396  *
0397  * @param entry     TLB Entry index.
0398  *
0399  * @return      Current value of specified DMMU TLB Tag Read Register.
0400  */
0401 static inline uint64_t dtlb_tag_read_read(size_t entry)
0402 {
0403     dtlb_tag_read_addr_t tag;
0404 
0405     tag.value = 0;
0406     tag.tlb_entry = entry;
0407     return asi_u64_read(ASI_DTLB_TAG_READ_REG, tag.value);
0408 }
0409 
0410 #elif defined (US3)
0411 
0412 
0413 /** Read IMMU TLB Data Access Register.
0414  *
0415  * @param tlb       TLB number (one of TLB_ISMALL or TLB_IBIG)
0416  * @param entry     TLB Entry index.
0417  *
0418  * @return      Current value of specified IMMU TLB Data Access
0419  *          Register.
0420  */
0421 static inline uint64_t itlb_data_access_read(int tlb, size_t entry)
0422 {
0423     itlb_data_access_addr_t reg;
0424     
0425     reg.value = 0;
0426     reg.tlb_number = tlb;
0427     reg.local_tlb_entry = entry;
0428     return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value);
0429 }
0430 
0431 /** Write IMMU TLB Data Access Register.
0432  * @param tlb       TLB number (one of TLB_ISMALL or TLB_IBIG)
0433  * @param entry     TLB Entry index.
0434  * @param value     Value to be written.
0435  */
0436 static inline void itlb_data_access_write(int tlb, size_t entry,
0437     uint64_t value)
0438 {
0439     itlb_data_access_addr_t reg;
0440     
0441     reg.value = 0;
0442     reg.tlb_number = tlb;
0443     reg.local_tlb_entry = entry;
0444     asi_u64_write(ASI_ITLB_DATA_ACCESS_REG, reg.value, value);
0445     flush_pipeline();
0446 }
0447 
0448 /** Read DMMU TLB Data Access Register.
0449  *
0450  * @param tlb       TLB number (one of TLB_DSMALL, TLB_DBIG, TLB_DBIG) 
0451  * @param entry     TLB Entry index.
0452  *
0453  * @return      Current value of specified DMMU TLB Data Access
0454  *          Register.
0455  */
0456 static inline uint64_t dtlb_data_access_read(int tlb, size_t entry)
0457 {
0458     dtlb_data_access_addr_t reg;
0459     
0460     reg.value = 0;
0461     reg.tlb_number = tlb;
0462     reg.local_tlb_entry = entry;
0463     return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value);
0464 }
0465 
0466 /** Write DMMU TLB Data Access Register.
0467  *
0468  * @param tlb       TLB number (one of TLB_DSMALL, TLB_DBIG_0, TLB_DBIG_1)  
0469  * @param entry     TLB Entry index.
0470  * @param value     Value to be written.
0471  */
0472 static inline void dtlb_data_access_write(int tlb, size_t entry,
0473     uint64_t value)
0474 {
0475     dtlb_data_access_addr_t reg;
0476     
0477     reg.value = 0;
0478     reg.tlb_number = tlb;
0479     reg.local_tlb_entry = entry;
0480     asi_u64_write(ASI_DTLB_DATA_ACCESS_REG, reg.value, value);
0481     membar();
0482 }
0483 
0484 /** Read IMMU TLB Tag Read Register.
0485  *
0486  * @param tlb       TLB number (one of TLB_ISMALL or TLB_IBIG) 
0487  * @param entry     TLB Entry index.
0488  *
0489  * @return      Current value of specified IMMU TLB Tag Read Register.
0490  */
0491 static inline uint64_t itlb_tag_read_read(int tlb, size_t entry)
0492 {
0493     itlb_tag_read_addr_t tag;
0494 
0495     tag.value = 0;
0496     tag.tlb_number = tlb;
0497     tag.local_tlb_entry = entry;
0498     return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value);
0499 }
0500 
0501 /** Read DMMU TLB Tag Read Register.
0502  *
0503  * @param tlb       TLB number (one of TLB_DSMALL, TLB_DBIG_0, TLB_DBIG_1)
0504  * @param entry     TLB Entry index.
0505  *
0506  * @return      Current value of specified DMMU TLB Tag Read Register.
0507  */
0508 static inline uint64_t dtlb_tag_read_read(int tlb, size_t entry)
0509 {
0510     dtlb_tag_read_addr_t tag;
0511 
0512     tag.value = 0;
0513     tag.tlb_number = tlb;
0514     tag.local_tlb_entry = entry;
0515     return asi_u64_read(ASI_DTLB_TAG_READ_REG, tag.value);
0516 }
0517 
0518 #endif
0519 
0520 
0521 /** Write IMMU TLB Tag Access Register.
0522  *
0523  * @param v     Value to be written.
0524  */
0525 static inline void itlb_tag_access_write(uint64_t v)
0526 {
0527     asi_u64_write(ASI_IMMU, VA_IMMU_TAG_ACCESS, v);
0528     flush_pipeline();
0529 }
0530 
0531 /** Read IMMU TLB Tag Access Register.
0532  *
0533  * @return      Current value of IMMU TLB Tag Access Register.
0534  */
0535 static inline uint64_t itlb_tag_access_read(void)
0536 {
0537     return asi_u64_read(ASI_IMMU, VA_IMMU_TAG_ACCESS);
0538 }
0539 
0540 /** Write DMMU TLB Tag Access Register.
0541  *
0542  * @param v     Value to be written.
0543  */
0544 static inline void dtlb_tag_access_write(uint64_t v)
0545 {
0546     asi_u64_write(ASI_DMMU, VA_DMMU_TAG_ACCESS, v);
0547     membar();
0548 }
0549 
0550 /** Read DMMU TLB Tag Access Register.
0551  *
0552  * @return      Current value of DMMU TLB Tag Access Register.
0553  */
0554 static inline uint64_t dtlb_tag_access_read(void)
0555 {
0556     return asi_u64_read(ASI_DMMU, VA_DMMU_TAG_ACCESS);
0557 }
0558 
0559 
0560 /** Write IMMU TLB Data in Register.
0561  *
0562  * @param v     Value to be written.
0563  */
0564 static inline void itlb_data_in_write(uint64_t v)
0565 {
0566     asi_u64_write(ASI_ITLB_DATA_IN_REG, 0, v);
0567     flush_pipeline();
0568 }
0569 
0570 /** Write DMMU TLB Data in Register.
0571  *
0572  * @param v     Value to be written.
0573  */
0574 static inline void dtlb_data_in_write(uint64_t v)
0575 {
0576     asi_u64_write(ASI_DTLB_DATA_IN_REG, 0, v);
0577     membar();
0578 }
0579 
0580 /** Read ITLB Synchronous Fault Status Register.
0581  *
0582  * @return      Current content of I-SFSR register.
0583  */
0584 static inline uint64_t itlb_sfsr_read(void)
0585 {
0586     return asi_u64_read(ASI_IMMU, VA_IMMU_SFSR);
0587 }
0588 
0589 /** Write ITLB Synchronous Fault Status Register.
0590  *
0591  * @param v     New value of I-SFSR register.
0592  */
0593 static inline void itlb_sfsr_write(uint64_t v)
0594 {
0595     asi_u64_write(ASI_IMMU, VA_IMMU_SFSR, v);
0596     flush_pipeline();
0597 }
0598 
0599 /** Read DTLB Synchronous Fault Status Register.
0600  *
0601  * @return      Current content of D-SFSR register.
0602  */
0603 static inline uint64_t dtlb_sfsr_read(void)
0604 {
0605     return asi_u64_read(ASI_DMMU, VA_DMMU_SFSR);
0606 }
0607 
0608 /** Write DTLB Synchronous Fault Status Register.
0609  *
0610  * @param v     New value of D-SFSR register.
0611  */
0612 static inline void dtlb_sfsr_write(uint64_t v)
0613 {
0614     asi_u64_write(ASI_DMMU, VA_DMMU_SFSR, v);
0615     membar();
0616 }
0617 
0618 /** Read DTLB Synchronous Fault Address Register.
0619  *
0620  * @return      Current content of D-SFAR register.
0621  */
0622 static inline uint64_t dtlb_sfar_read(void)
0623 {
0624     return asi_u64_read(ASI_DMMU, VA_DMMU_SFAR);
0625 }
0626 
0627 /** Perform IMMU TLB Demap Operation.
0628  *
0629  * @param type      Selects between context and page demap (and entire MMU
0630  *          demap on US3).
0631  * @param context_encoding Specifies which Context register has Context ID for
0632  *          demap.
0633  * @param page      Address which is on the page to be demapped.
0634  */
0635 static inline void itlb_demap(int type, int context_encoding, uintptr_t page)
0636 {
0637     tlb_demap_addr_t da;
0638     page_address_t pg;
0639     
0640     da.value = 0;
0641     pg.address = page;
0642     
0643     da.type = type;
0644     da.context = context_encoding;
0645     da.vpn = pg.vpn;
0646     
0647     /* da.value is the address within the ASI */ 
0648     asi_u64_write(ASI_IMMU_DEMAP, da.value, 0);
0649 
0650     flush_pipeline();
0651 }
0652 
0653 /** Perform DMMU TLB Demap Operation.
0654  *
0655  * @param type      Selects between context and page demap (and entire MMU
0656  *          demap on US3).
0657  * @param context_encoding Specifies which Context register has Context ID for
0658  *          demap.
0659  * @param page      Address which is on the page to be demapped.
0660  */
0661 static inline void dtlb_demap(int type, int context_encoding, uintptr_t page)
0662 {
0663     tlb_demap_addr_t da;
0664     page_address_t pg;
0665     
0666     da.value = 0;
0667     pg.address = page;
0668     
0669     da.type = type;
0670     da.context = context_encoding;
0671     da.vpn = pg.vpn;
0672     
0673     /* da.value is the address within the ASI */ 
0674     asi_u64_write(ASI_DMMU_DEMAP, da.value, 0);
0675 
0676     membar();
0677 }
0678 
0679 extern void fast_instruction_access_mmu_miss(unative_t, istate_t *);
0680 extern void fast_data_access_mmu_miss(tlb_tag_access_reg_t, istate_t *);
0681 extern void fast_data_access_protection(tlb_tag_access_reg_t , istate_t *);
0682 
0683 extern void dtlb_insert_mapping(uintptr_t, uintptr_t, int, bool, bool);
0684 
0685 extern void dump_sfsr_and_sfar(void);
0686 extern void describe_dmmu_fault(void);
0687 
0688 #endif /* !def __ASM__ */
0689 
0690 #endif
0691 
0692 /** @}
0693  */