Subversion Repositories HelenOS

Rev

Rev 3450 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
418 jermar 1
/*
2071 jermar 2
 * Copyright (c) 2005 Jakub Jermar
418 jermar 3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 *
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
 
1822 jermar 29
/** @addtogroup sparc64mm  
1702 cejka 30
 * @{
31
 */
32
/** @file
33
 */
34
 
1860 jermar 35
#ifndef KERN_sparc64_TLB_H_
36
#define KERN_sparc64_TLB_H_
418 jermar 37
 
3450 rimsky 38
#if defined (US)
569 jermar 39
#define ITLB_ENTRY_COUNT        64
40
#define DTLB_ENTRY_COUNT        64
3450 rimsky 41
#define DTLB_MAX_LOCKED_ENTRIES     DTLB_ENTRY_COUNT
42
#endif
569 jermar 43
 
3493 rimsky 44
/** DT16 is the only of the three DMMUs that can hold locked entries. */
3450 rimsky 45
#if defined (US3)
46
#define DTLB_MAX_LOCKED_ENTRIES     16
47
#endif
48
 
1823 jermar 49
#define MEM_CONTEXT_KERNEL      0
50
#define MEM_CONTEXT_TEMP        1
51
 
619 jermar 52
/** Page sizes. */
53
#define PAGESIZE_8K 0
54
#define PAGESIZE_64K    1
55
#define PAGESIZE_512K   2
56
#define PAGESIZE_4M 3
531 jermar 57
 
901 jermar 58
/** Bit width of the TLB-locked portion of kernel address space. */
59
#define KERNEL_PAGE_WIDTH       22  /* 4M */
60
 
1823 jermar 61
/* TLB Demap Operation types. */
62
#define TLB_DEMAP_PAGE      0
63
#define TLB_DEMAP_CONTEXT   1
3450 rimsky 64
#if defined (US3)
65
#define TLB_DEMAP_ALL       2
66
#endif
1823 jermar 67
 
68
#define TLB_DEMAP_TYPE_SHIFT    6
69
 
70
/* TLB Demap Operation Context register encodings. */
71
#define TLB_DEMAP_PRIMARY   0
72
#define TLB_DEMAP_SECONDARY 1
73
#define TLB_DEMAP_NUCLEUS   2
74
 
3450 rimsky 75
/* There are more TLBs in one MMU in US3, their codes are defined here. */
3440 rimsky 76
#if defined (US3)
3450 rimsky 77
/* D-MMU: one 16-entry TLB and two 512-entry TLBs */
78
#define TLB_DT16    0
79
#define TLB_DT512_0 2
80
#define TLB_DT512_1 3
3440 rimsky 81
 
3450 rimsky 82
/* I-MMU: one 16-entry TLB and one 128-entry TLB */
83
#define TLB_IT16    0
84
#define TLB_IT128   2
3440 rimsky 85
#endif
86
 
1823 jermar 87
#define TLB_DEMAP_CONTEXT_SHIFT 4
88
 
89
/* TLB Tag Access shifts */
90
#define TLB_TAG_ACCESS_CONTEXT_SHIFT    0
2054 jermar 91
#define TLB_TAG_ACCESS_CONTEXT_MASK ((1 << 13) - 1)
1823 jermar 92
#define TLB_TAG_ACCESS_VPN_SHIFT    13
93
 
94
#ifndef __ASM__
95
 
96
#include <arch/mm/tte.h>
97
#include <arch/mm/mmu.h>
98
#include <arch/mm/page.h>
99
#include <arch/asm.h>
100
#include <arch/barrier.h>
101
#include <arch/types.h>
102
 
873 jermar 103
union tlb_context_reg {
1780 jermar 104
    uint64_t v;
873 jermar 105
    struct {
106
        unsigned long : 51;
107
        unsigned context : 13;      /**< Context/ASID. */
108
    } __attribute__ ((packed));
109
};
110
typedef union tlb_context_reg tlb_context_reg_t;
111
 
530 jermar 112
/** I-/D-TLB Data In/Access Register type. */
113
typedef tte_data_t tlb_data_t;
114
 
569 jermar 115
/** I-/D-TLB Data Access Address in Alternate Space. */
3440 rimsky 116
 
117
#if defined (US)
118
 
569 jermar 119
union tlb_data_access_addr {
1780 jermar 120
    uint64_t value;
569 jermar 121
    struct {
1780 jermar 122
        uint64_t : 55;
569 jermar 123
        unsigned tlb_entry : 6;
124
        unsigned : 3;
125
    } __attribute__ ((packed));
126
};
3440 rimsky 127
typedef union tlb_data_access_addr dtlb_data_access_addr_t;
128
typedef union tlb_data_access_addr dtlb_tag_read_addr_t;
129
typedef union tlb_data_access_addr itlb_data_access_addr_t;
130
typedef union tlb_data_access_addr itlb_tag_read_addr_t;
418 jermar 131
 
3440 rimsky 132
#elif defined (US3)
133
 
134
/*
135
 * In US3, I-MMU and D-MMU have different formats of the data
136
 * access register virtual address. In the corresponding
137
 * structures the member variable for the entry number is
138
 * called "local_tlb_entry" - it contrast with the "tlb_entry"
139
 * for the US data access register VA structure. The rationale
140
 * behind this is to prevent careless mistakes in the code
141
 * caused by setting only the entry number and not the TLB
142
 * number in the US3 code (when taking the code from US).
143
 */
144
 
145
union dtlb_data_access_addr {
146
    uint64_t value;
147
    struct {
148
        uint64_t : 45;
149
        unsigned : 1;
150
        unsigned tlb_number : 2;
151
        unsigned : 4;
152
        unsigned local_tlb_entry : 9;
153
        unsigned : 3;
154
    } __attribute__ ((packed));
155
};
156
typedef union dtlb_data_access_addr dtlb_data_access_addr_t;
157
typedef union dtlb_data_access_addr dtlb_tag_read_addr_t;
158
 
159
union itlb_data_access_addr {
160
    uint64_t value;
161
    struct {
162
        uint64_t : 45;
163
        unsigned : 1;
164
        unsigned tlb_number : 2;
165
        unsigned : 6;
166
        unsigned local_tlb_entry : 7;
167
        unsigned : 3;
168
    } __attribute__ ((packed));
169
};
170
typedef union itlb_data_access_addr itlb_data_access_addr_t;
171
typedef union itlb_data_access_addr itlb_tag_read_addr_t;
172
 
173
#endif
174
 
569 jermar 175
/** I-/D-TLB Tag Read Register. */
176
union tlb_tag_read_reg {
3450 rimsky 177
    // TODO have a look at how non-8kB pages will be treated
1780 jermar 178
    uint64_t value;
569 jermar 179
    struct {
2054 jermar 180
        uint64_t vpn : 51;  /**< Virtual Address bits 63:13. */
181
        unsigned context : 13;  /**< Context identifier. */
569 jermar 182
    } __attribute__ ((packed));
183
};
184
typedef union tlb_tag_read_reg tlb_tag_read_reg_t;
613 jermar 185
typedef union tlb_tag_read_reg tlb_tag_access_reg_t;
569 jermar 186
 
617 jermar 187
 
188
/** TLB Demap Operation Address. */
189
union tlb_demap_addr {
1780 jermar 190
    uint64_t value;
617 jermar 191
    struct {
1851 jermar 192
        uint64_t vpn: 51;   /**< Virtual Address bits 63:13. */
3450 rimsky 193
#if defined (US)
617 jermar 194
        unsigned : 6;       /**< Ignored. */
195
        unsigned type : 1;  /**< The type of demap operation. */
3450 rimsky 196
#elif defined (US3)
197
        unsigned : 5;       /**< Ignored. */
198
        unsigned type: 2;   /**< The type of demap operation. */
199
#endif
617 jermar 200
        unsigned context : 2;   /**< Context register selection. */
201
        unsigned : 4;       /**< Zero. */
202
    } __attribute__ ((packed));
203
};
204
typedef union tlb_demap_addr tlb_demap_addr_t;
205
 
873 jermar 206
/** TLB Synchronous Fault Status Register. */
207
union tlb_sfsr_reg {
1780 jermar 208
    uint64_t value;
873 jermar 209
    struct {
3450 rimsky 210
#if defined (US)
1851 jermar 211
        unsigned long : 40; /**< Implementation dependent. */
873 jermar 212
        unsigned asi : 8;   /**< ASI. */
1851 jermar 213
        unsigned : 2;
877 jermar 214
        unsigned ft : 7;    /**< Fault type. */
3450 rimsky 215
#elif defined (US3)
216
        unsigned long : 39; /**< Implementation dependent. */
217
        unsigned nf : 1;    /**< Non-faulting load. */
218
        unsigned asi : 8;   /**< ASI. */
219
        unsigned tm : 1;    /**< I-TLB miss. */
220
        unsigned : 3;       /**< Reserved. */
221
        unsigned ft : 5;    /**< Fault type. */
222
#endif
873 jermar 223
        unsigned e : 1;     /**< Side-effect bit. */
224
        unsigned ct : 2;    /**< Context Register selection. */
225
        unsigned pr : 1;    /**< Privilege bit. */
226
        unsigned w : 1;     /**< Write bit. */
227
        unsigned ow : 1;    /**< Overwrite bit. */
877 jermar 228
        unsigned fv : 1;    /**< Fault Valid bit. */
873 jermar 229
    } __attribute__ ((packed));
230
};
231
typedef union tlb_sfsr_reg tlb_sfsr_reg_t;
232
 
233
/** Read MMU Primary Context Register.
234
 *
235
 * @return Current value of Primary Context Register.
236
 */
1780 jermar 237
static inline uint64_t mmu_primary_context_read(void)
873 jermar 238
{
239
    return asi_u64_read(ASI_DMMU, VA_PRIMARY_CONTEXT_REG);
240
}
241
 
242
/** Write MMU Primary Context Register.
243
 *
244
 * @param v New value of Primary Context Register.
245
 */
1780 jermar 246
static inline void mmu_primary_context_write(uint64_t v)
873 jermar 247
{
248
    asi_u64_write(ASI_DMMU, VA_PRIMARY_CONTEXT_REG, v);
3145 jermar 249
    flush_pipeline();
873 jermar 250
}
251
 
252
/** Read MMU Secondary Context Register.
253
 *
254
 * @return Current value of Secondary Context Register.
255
 */
1780 jermar 256
static inline uint64_t mmu_secondary_context_read(void)
873 jermar 257
{
258
    return asi_u64_read(ASI_DMMU, VA_SECONDARY_CONTEXT_REG);
259
}
260
 
261
/** Write MMU Primary Context Register.
262
 *
263
 * @param v New value of Primary Context Register.
264
 */
1780 jermar 265
static inline void mmu_secondary_context_write(uint64_t v)
873 jermar 266
{
1864 jermar 267
    asi_u64_write(ASI_DMMU, VA_SECONDARY_CONTEXT_REG, v);
3145 jermar 268
    flush_pipeline();
873 jermar 269
}
270
 
3440 rimsky 271
#if defined (US)
272
 
569 jermar 273
/** Read IMMU TLB Data Access Register.
274
 *
275
 * @param entry TLB Entry index.
276
 *
277
 * @return Current value of specified IMMU TLB Data Access Register.
278
 */
1780 jermar 279
static inline uint64_t itlb_data_access_read(index_t entry)
569 jermar 280
{
3440 rimsky 281
    itlb_data_access_addr_t reg;
569 jermar 282
 
283
    reg.value = 0;
284
    reg.tlb_entry = entry;
285
    return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value);
286
}
287
 
617 jermar 288
/** Write IMMU TLB Data Access Register.
289
 *
290
 * @param entry TLB Entry index.
291
 * @param value Value to be written.
292
 */
1780 jermar 293
static inline void itlb_data_access_write(index_t entry, uint64_t value)
617 jermar 294
{
3440 rimsky 295
    itlb_data_access_addr_t reg;
617 jermar 296
 
297
    reg.value = 0;
298
    reg.tlb_entry = entry;
299
    asi_u64_write(ASI_ITLB_DATA_ACCESS_REG, reg.value, value);
3145 jermar 300
    flush_pipeline();
617 jermar 301
}
302
 
569 jermar 303
/** Read DMMU TLB Data Access Register.
304
 *
305
 * @param entry TLB Entry index.
306
 *
307
 * @return Current value of specified DMMU TLB Data Access Register.
308
 */
1780 jermar 309
static inline uint64_t dtlb_data_access_read(index_t entry)
569 jermar 310
{
3440 rimsky 311
    dtlb_data_access_addr_t reg;
569 jermar 312
 
313
    reg.value = 0;
314
    reg.tlb_entry = entry;
315
    return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value);
316
}
317
 
617 jermar 318
/** Write DMMU TLB Data Access Register.
319
 *
320
 * @param entry TLB Entry index.
321
 * @param value Value to be written.
322
 */
1780 jermar 323
static inline void dtlb_data_access_write(index_t entry, uint64_t value)
617 jermar 324
{
3440 rimsky 325
    dtlb_data_access_addr_t reg;
617 jermar 326
 
327
    reg.value = 0;
328
    reg.tlb_entry = entry;
329
    asi_u64_write(ASI_DTLB_DATA_ACCESS_REG, reg.value, value);
1822 jermar 330
    membar();
617 jermar 331
}
332
 
569 jermar 333
/** Read IMMU TLB Tag Read Register.
334
 *
335
 * @param entry TLB Entry index.
336
 *
337
 * @return Current value of specified IMMU TLB Tag Read Register.
338
 */
1780 jermar 339
static inline uint64_t itlb_tag_read_read(index_t entry)
569 jermar 340
{
3440 rimsky 341
    itlb_tag_read_addr_t tag;
569 jermar 342
 
343
    tag.value = 0;
344
    tag.tlb_entry = entry;
345
    return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value);
346
}
347
 
348
/** Read DMMU TLB Tag Read Register.
349
 *
350
 * @param entry TLB Entry index.
351
 *
352
 * @return Current value of specified DMMU TLB Tag Read Register.
353
 */
1780 jermar 354
static inline uint64_t dtlb_tag_read_read(index_t entry)
569 jermar 355
{
3440 rimsky 356
    dtlb_tag_read_addr_t tag;
569 jermar 357
 
358
    tag.value = 0;
359
    tag.tlb_entry = entry;
360
    return asi_u64_read(ASI_DTLB_TAG_READ_REG, tag.value);
361
}
362
 
3440 rimsky 363
#elif defined (US3)
364
 
365
 
366
/** Read IMMU TLB Data Access Register.
367
 *
368
 * @param tlb TLB number (one of TLB_IT16 or TLB_IT128)
369
 * @param entry TLB Entry index.
370
 *
371
 * @return Current value of specified IMMU TLB Data Access Register.
372
 */
373
static inline uint64_t itlb_data_access_read(int tlb, index_t entry)
374
{
375
    itlb_data_access_addr_t reg;
376
 
377
    reg.value = 0;
378
    reg.tlb_number = tlb;
379
    reg.local_tlb_entry = entry;
380
    return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value);
381
}
382
 
383
/** Write IMMU TLB Data Access Register.
384
 * @param tlb TLB number (one of TLB_IT16 or TLB_IT128)
385
 * @param entry TLB Entry index.
386
 * @param value Value to be written.
387
 */
388
static inline void itlb_data_access_write(int tlb, index_t entry, uint64_t value)
389
{
390
    itlb_data_access_addr_t reg;
391
 
392
    reg.value = 0;
393
    reg.tlb_number = tlb;
394
    reg.local_tlb_entry = entry;
395
    asi_u64_write(ASI_ITLB_DATA_ACCESS_REG, reg.value, value);
396
    flush_pipeline();
397
}
398
 
399
/** Read DMMU TLB Data Access Register.
400
 *
3450 rimsky 401
 * @param tlb TLB number (one of TLB_DT16, TLB_DT512_0, TLB_DT512_1)
3440 rimsky 402
 * @param entry TLB Entry index.
403
 *
404
 * @return Current value of specified DMMU TLB Data Access Register.
405
 */
406
static inline uint64_t dtlb_data_access_read(int tlb, index_t entry)
407
{
408
    dtlb_data_access_addr_t reg;
409
 
410
    reg.value = 0;
411
    reg.tlb_number = tlb;
412
    reg.local_tlb_entry = entry;
413
    return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value);
414
}
415
 
416
/** Write DMMU TLB Data Access Register.
417
 *
3450 rimsky 418
 * @param tlb TLB number (one of TLB_DT16, TLB_DT512_0, TLB_DT512_1)  
3440 rimsky 419
 * @param entry TLB Entry index.
420
 * @param value Value to be written.
421
 */
422
static inline void dtlb_data_access_write(int tlb, index_t entry, uint64_t value)
423
{
424
    dtlb_data_access_addr_t reg;
425
 
426
    reg.value = 0;
427
    reg.tlb_number = tlb;
428
    reg.local_tlb_entry = entry;
429
    asi_u64_write(ASI_DTLB_DATA_ACCESS_REG, reg.value, value);
430
    membar();
431
}
432
 
433
/** Read IMMU TLB Tag Read Register.
434
 *
435
 * @param tlb TLB number (one of TLB_IT16 or TLB_IT128)
436
 * @param entry TLB Entry index.
437
 *
438
 * @return Current value of specified IMMU TLB Tag Read Register.
439
 */
440
static inline uint64_t itlb_tag_read_read(int tlb, index_t entry)
441
{
442
    itlb_tag_read_addr_t tag;
443
 
444
    tag.value = 0;
445
    tag.tlb_number = tlb;
446
    tag.local_tlb_entry = entry;
447
    return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value);
448
}
449
 
450
/** Read DMMU TLB Tag Read Register.
451
 *
3450 rimsky 452
 * @param tlb TLB number (one of TLB_DT16, TLB_DT512_0, TLB_DT512_1)  
3440 rimsky 453
 * @param entry TLB Entry index.
454
 *
455
 * @return Current value of specified DMMU TLB Tag Read Register.
456
 */
457
static inline uint64_t dtlb_tag_read_read(int tlb, index_t entry)
458
{
459
    dtlb_tag_read_addr_t tag;
460
 
461
    tag.value = 0;
462
    tag.tlb_number = tlb;
463
    tag.local_tlb_entry = entry;
464
    return asi_u64_read(ASI_DTLB_TAG_READ_REG, tag.value);
465
}
466
 
467
#endif
468
 
469
 
613 jermar 470
/** Write IMMU TLB Tag Access Register.
471
 *
472
 * @param v Value to be written.
473
 */
1780 jermar 474
static inline void itlb_tag_access_write(uint64_t v)
613 jermar 475
{
476
    asi_u64_write(ASI_IMMU, VA_IMMU_TAG_ACCESS, v);
3145 jermar 477
    flush_pipeline();
613 jermar 478
}
479
 
877 jermar 480
/** Read IMMU TLB Tag Access Register.
481
 *
482
 * @return Current value of IMMU TLB Tag Access Register.
483
 */
1780 jermar 484
static inline uint64_t itlb_tag_access_read(void)
877 jermar 485
{
486
    return asi_u64_read(ASI_IMMU, VA_IMMU_TAG_ACCESS);
487
}
488
 
613 jermar 489
/** Write DMMU TLB Tag Access Register.
490
 *
491
 * @param v Value to be written.
492
 */
1780 jermar 493
static inline void dtlb_tag_access_write(uint64_t v)
613 jermar 494
{
495
    asi_u64_write(ASI_DMMU, VA_DMMU_TAG_ACCESS, v);
1822 jermar 496
    membar();
613 jermar 497
}
498
 
877 jermar 499
/** Read DMMU TLB Tag Access Register.
500
 *
501
 * @return Current value of DMMU TLB Tag Access Register.
502
 */
1780 jermar 503
static inline uint64_t dtlb_tag_access_read(void)
877 jermar 504
{
505
    return asi_u64_read(ASI_DMMU, VA_DMMU_TAG_ACCESS);
506
}
507
 
508
 
613 jermar 509
/** Write IMMU TLB Data in Register.
510
 *
511
 * @param v Value to be written.
512
 */
1780 jermar 513
static inline void itlb_data_in_write(uint64_t v)
613 jermar 514
{
515
    asi_u64_write(ASI_ITLB_DATA_IN_REG, 0, v);
3145 jermar 516
    flush_pipeline();
613 jermar 517
}
518
 
519
/** Write DMMU TLB Data in Register.
520
 *
521
 * @param v Value to be written.
522
 */
1780 jermar 523
static inline void dtlb_data_in_write(uint64_t v)
613 jermar 524
{
525
    asi_u64_write(ASI_DTLB_DATA_IN_REG, 0, v);
1822 jermar 526
    membar();
613 jermar 527
}
528
 
873 jermar 529
/** Read ITLB Synchronous Fault Status Register.
530
 *
531
 * @return Current content of I-SFSR register.
532
 */
1780 jermar 533
static inline uint64_t itlb_sfsr_read(void)
873 jermar 534
{
535
    return asi_u64_read(ASI_IMMU, VA_IMMU_SFSR);
536
}
537
 
538
/** Write ITLB Synchronous Fault Status Register.
539
 *
540
 * @param v New value of I-SFSR register.
541
 */
1780 jermar 542
static inline void itlb_sfsr_write(uint64_t v)
873 jermar 543
{
544
    asi_u64_write(ASI_IMMU, VA_IMMU_SFSR, v);
3145 jermar 545
    flush_pipeline();
873 jermar 546
}
547
 
548
/** Read DTLB Synchronous Fault Status Register.
549
 *
550
 * @return Current content of D-SFSR register.
551
 */
1780 jermar 552
static inline uint64_t dtlb_sfsr_read(void)
873 jermar 553
{
554
    return asi_u64_read(ASI_DMMU, VA_DMMU_SFSR);
555
}
556
 
557
/** Write DTLB Synchronous Fault Status Register.
558
 *
559
 * @param v New value of D-SFSR register.
560
 */
1780 jermar 561
static inline void dtlb_sfsr_write(uint64_t v)
873 jermar 562
{
563
    asi_u64_write(ASI_DMMU, VA_DMMU_SFSR, v);
1822 jermar 564
    membar();
873 jermar 565
}
566
 
567
/** Read DTLB Synchronous Fault Address Register.
568
 *
569
 * @return Current content of D-SFAR register.
570
 */
1780 jermar 571
static inline uint64_t dtlb_sfar_read(void)
873 jermar 572
{
573
    return asi_u64_read(ASI_DMMU, VA_DMMU_SFAR);
574
}
575
 
617 jermar 576
/** Perform IMMU TLB Demap Operation.
577
 *
3450 rimsky 578
 * @param type
579
 *  Selects between context and page demap
580
 *  (and entire MMU demap on US-III).
2054 jermar 581
 * @param context_encoding Specifies which Context register has Context ID for
582
 *  demap.
617 jermar 583
 * @param page Address which is on the page to be demapped.
584
 */
1780 jermar 585
static inline void itlb_demap(int type, int context_encoding, uintptr_t page)
617 jermar 586
{
587
    tlb_demap_addr_t da;
588
    page_address_t pg;
589
 
590
    da.value = 0;
591
    pg.address = page;
592
 
593
    da.type = type;
594
    da.context = context_encoding;
595
    da.vpn = pg.vpn;
596
 
2054 jermar 597
    asi_u64_write(ASI_IMMU_DEMAP, da.value, 0); /* da.value is the
598
                             * address within the
599
                             * ASI */
3145 jermar 600
    flush_pipeline();
617 jermar 601
}
602
 
603
/** Perform DMMU TLB Demap Operation.
604
 *
3450 rimsky 605
 * @param type
606
 *  Selects between context and page demap
607
 *  (and entire MMU demap on US-III).
2054 jermar 608
 * @param context_encoding Specifies which Context register has Context ID for
609
 *   demap.
617 jermar 610
 * @param page Address which is on the page to be demapped.
611
 */
1780 jermar 612
static inline void dtlb_demap(int type, int context_encoding, uintptr_t page)
617 jermar 613
{
614
    tlb_demap_addr_t da;
615
    page_address_t pg;
616
 
617
    da.value = 0;
618
    pg.address = page;
619
 
620
    da.type = type;
621
    da.context = context_encoding;
622
    da.vpn = pg.vpn;
623
 
2054 jermar 624
    asi_u64_write(ASI_DMMU_DEMAP, da.value, 0); /* da.value is the
625
                             * address within the
626
                             * ASI */
1822 jermar 627
    membar();
617 jermar 628
}
629
 
2231 jermar 630
extern void fast_instruction_access_mmu_miss(unative_t unused, istate_t *istate);
631
extern void fast_data_access_mmu_miss(tlb_tag_access_reg_t tag, istate_t *istate);
632
extern void fast_data_access_protection(tlb_tag_access_reg_t tag , istate_t *istate);
863 jermar 633
 
1780 jermar 634
extern void dtlb_insert_mapping(uintptr_t page, uintptr_t frame, int pagesize, bool locked, bool cacheable);
897 jermar 635
 
1946 jermar 636
extern void dump_sfsr_and_sfar(void);
637
 
1823 jermar 638
#endif /* !def __ASM__ */
639
 
418 jermar 640
#endif
1702 cejka 641
 
1822 jermar 642
/** @}
3493 rimsky 643
 */