Rev 3618 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3618 | Rev 3742 | ||
---|---|---|---|
Line 135... | Line 135... | ||
135 | 135 | ||
136 | /* |
136 | /* |
137 | * In US3, I-MMU and D-MMU have different formats of the data |
137 | * In US3, I-MMU and D-MMU have different formats of the data |
138 | * access register virtual address. In the corresponding |
138 | * access register virtual address. In the corresponding |
139 | * structures the member variable for the entry number is |
139 | * structures the member variable for the entry number is |
140 | * called "local_tlb_entry" - it contrast with the "tlb_entry" |
140 | * called "local_tlb_entry" - it contrasts with the "tlb_entry" |
141 | * for the US data access register VA structure. The rationale |
141 | * for the US data access register VA structure. The rationale |
142 | * behind this is to prevent careless mistakes in the code |
142 | * behind this is to prevent careless mistakes in the code |
143 | * caused by setting only the entry number and not the TLB |
143 | * caused by setting only the entry number and not the TLB |
144 | * number in the US3 code (when taking the code from US). |
144 | * number in the US3 code (when taking the code from US). |
145 | */ |
145 | */ |
Line 237... | Line 237... | ||
237 | * Functions for determining the number of entries in TLBs. They either return |
237 | * Functions for determining the number of entries in TLBs. They either return |
238 | * a constant value or a value based on the CPU autodetection. |
238 | * a constant value or a value based on the CPU autodetection. |
239 | */ |
239 | */ |
240 | 240 | ||
241 | /** |
241 | /** |
242 | * Determine the number od entries in the DMMU's small TLB. |
242 | * Determine the number of entries in the DMMU's small TLB. |
243 | */ |
243 | */ |
244 | static inline uint16_t tlb_dsmall_size(void) |
244 | static inline uint16_t tlb_dsmall_size(void) |
245 | { |
245 | { |
246 | return 16; |
246 | return 16; |
247 | } |
247 | } |
248 | 248 | ||
249 | /** |
249 | /** |
250 | * Determine the number od entries in each DMMU's big TLB. |
250 | * Determine the number of entries in each DMMU's big TLB. |
251 | */ |
251 | */ |
252 | static inline uint16_t tlb_dbig_size(void) |
252 | static inline uint16_t tlb_dbig_size(void) |
253 | { |
253 | { |
254 | return 512; |
254 | return 512; |
255 | } |
255 | } |
256 | 256 | ||
257 | /** |
257 | /** |
258 | * Determine the number od entries in the IMMU's small TLB. |
258 | * Determine the number of entries in the IMMU's small TLB. |
259 | */ |
259 | */ |
260 | static inline uint16_t tlb_ismall_size(void) |
260 | static inline uint16_t tlb_ismall_size(void) |
261 | { |
261 | { |
262 | return 16; |
262 | return 16; |
263 | } |
263 | } |
264 | 264 | ||
265 | /** |
265 | /** |
266 | * Determine the number od entries in the IMMU's big TLB. |
266 | * Determine the number of entries in the IMMU's big TLB. |
267 | */ |
267 | */ |
268 | static inline uint16_t tlb_ibig_size(void) |
268 | static inline uint16_t tlb_ibig_size(void) |
269 | { |
269 | { |
270 | if (((ver_reg_t) ver_read()).impl == IMPL_ULTRASPARCIV_PLUS) |
270 | if (((ver_reg_t) ver_read()).impl == IMPL_ULTRASPARCIV_PLUS) |
271 | return 512; |
271 | return 512; |
Line 275... | Line 275... | ||
275 | 275 | ||
276 | #endif |
276 | #endif |
277 | 277 | ||
278 | /** Read MMU Primary Context Register. |
278 | /** Read MMU Primary Context Register. |
279 | * |
279 | * |
280 | * @return Current value of Primary Context Register. |
280 | * @return Current value of Primary Context Register. |
281 | */ |
281 | */ |
282 | static inline uint64_t mmu_primary_context_read(void) |
282 | static inline uint64_t mmu_primary_context_read(void) |
283 | { |
283 | { |
284 | return asi_u64_read(ASI_DMMU, VA_PRIMARY_CONTEXT_REG); |
284 | return asi_u64_read(ASI_DMMU, VA_PRIMARY_CONTEXT_REG); |
285 | } |
285 | } |
286 | 286 | ||
287 | /** Write MMU Primary Context Register. |
287 | /** Write MMU Primary Context Register. |
288 | * |
288 | * |
289 | * @param v New value of Primary Context Register. |
289 | * @param v New value of Primary Context Register. |
290 | */ |
290 | */ |
291 | static inline void mmu_primary_context_write(uint64_t v) |
291 | static inline void mmu_primary_context_write(uint64_t v) |
292 | { |
292 | { |
293 | asi_u64_write(ASI_DMMU, VA_PRIMARY_CONTEXT_REG, v); |
293 | asi_u64_write(ASI_DMMU, VA_PRIMARY_CONTEXT_REG, v); |
294 | flush_pipeline(); |
294 | flush_pipeline(); |
295 | } |
295 | } |
296 | 296 | ||
297 | /** Read MMU Secondary Context Register. |
297 | /** Read MMU Secondary Context Register. |
298 | * |
298 | * |
299 | * @return Current value of Secondary Context Register. |
299 | * @return Current value of Secondary Context Register. |
300 | */ |
300 | */ |
301 | static inline uint64_t mmu_secondary_context_read(void) |
301 | static inline uint64_t mmu_secondary_context_read(void) |
302 | { |
302 | { |
303 | return asi_u64_read(ASI_DMMU, VA_SECONDARY_CONTEXT_REG); |
303 | return asi_u64_read(ASI_DMMU, VA_SECONDARY_CONTEXT_REG); |
304 | } |
304 | } |
305 | 305 | ||
306 | /** Write MMU Primary Context Register. |
306 | /** Write MMU Primary Context Register. |
307 | * |
307 | * |
308 | * @param v New value of Primary Context Register. |
308 | * @param v New value of Primary Context Register. |
309 | */ |
309 | */ |
310 | static inline void mmu_secondary_context_write(uint64_t v) |
310 | static inline void mmu_secondary_context_write(uint64_t v) |
311 | { |
311 | { |
312 | asi_u64_write(ASI_DMMU, VA_SECONDARY_CONTEXT_REG, v); |
312 | asi_u64_write(ASI_DMMU, VA_SECONDARY_CONTEXT_REG, v); |
313 | flush_pipeline(); |
313 | flush_pipeline(); |
Line 315... | Line 315... | ||
315 | 315 | ||
316 | #if defined (US) |
316 | #if defined (US) |
317 | 317 | ||
318 | /** Read IMMU TLB Data Access Register. |
318 | /** Read IMMU TLB Data Access Register. |
319 | * |
319 | * |
320 | * @param entry TLB Entry index. |
320 | * @param entry TLB Entry index. |
321 | * |
321 | * |
322 | * @return Current value of specified IMMU TLB Data Access Register. |
322 | * @return Current value of specified IMMU TLB Data Access |
- | 323 | * Register. |
|
323 | */ |
324 | */ |
324 | static inline uint64_t itlb_data_access_read(index_t entry) |
325 | static inline uint64_t itlb_data_access_read(index_t entry) |
325 | { |
326 | { |
326 | itlb_data_access_addr_t reg; |
327 | itlb_data_access_addr_t reg; |
327 | 328 | ||
Line 330... | Line 331... | ||
330 | return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value); |
331 | return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value); |
331 | } |
332 | } |
332 | 333 | ||
333 | /** Write IMMU TLB Data Access Register. |
334 | /** Write IMMU TLB Data Access Register. |
334 | * |
335 | * |
335 | * @param entry TLB Entry index. |
336 | * @param entry TLB Entry index. |
336 | * @param value Value to be written. |
337 | * @param value Value to be written. |
337 | */ |
338 | */ |
338 | static inline void itlb_data_access_write(index_t entry, uint64_t value) |
339 | static inline void itlb_data_access_write(index_t entry, uint64_t value) |
339 | { |
340 | { |
340 | itlb_data_access_addr_t reg; |
341 | itlb_data_access_addr_t reg; |
341 | 342 | ||
Line 345... | Line 346... | ||
345 | flush_pipeline(); |
346 | flush_pipeline(); |
346 | } |
347 | } |
347 | 348 | ||
348 | /** Read DMMU TLB Data Access Register. |
349 | /** Read DMMU TLB Data Access Register. |
349 | * |
350 | * |
350 | * @param entry TLB Entry index. |
351 | * @param entry TLB Entry index. |
351 | * |
352 | * |
352 | * @return Current value of specified DMMU TLB Data Access Register. |
353 | * @return Current value of specified DMMU TLB Data Access |
- | 354 | * Register. |
|
353 | */ |
355 | */ |
354 | static inline uint64_t dtlb_data_access_read(index_t entry) |
356 | static inline uint64_t dtlb_data_access_read(index_t entry) |
355 | { |
357 | { |
356 | dtlb_data_access_addr_t reg; |
358 | dtlb_data_access_addr_t reg; |
357 | 359 | ||
Line 360... | Line 362... | ||
360 | return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value); |
362 | return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value); |
361 | } |
363 | } |
362 | 364 | ||
363 | /** Write DMMU TLB Data Access Register. |
365 | /** Write DMMU TLB Data Access Register. |
364 | * |
366 | * |
365 | * @param entry TLB Entry index. |
367 | * @param entry TLB Entry index. |
366 | * @param value Value to be written. |
368 | * @param value Value to be written. |
367 | */ |
369 | */ |
368 | static inline void dtlb_data_access_write(index_t entry, uint64_t value) |
370 | static inline void dtlb_data_access_write(index_t entry, uint64_t value) |
369 | { |
371 | { |
370 | dtlb_data_access_addr_t reg; |
372 | dtlb_data_access_addr_t reg; |
371 | 373 | ||
Line 375... | Line 377... | ||
375 | membar(); |
377 | membar(); |
376 | } |
378 | } |
377 | 379 | ||
378 | /** Read IMMU TLB Tag Read Register. |
380 | /** Read IMMU TLB Tag Read Register. |
379 | * |
381 | * |
380 | * @param entry TLB Entry index. |
382 | * @param entry TLB Entry index. |
381 | * |
383 | * |
382 | * @return Current value of specified IMMU TLB Tag Read Register. |
384 | * @return Current value of specified IMMU TLB Tag Read Register. |
383 | */ |
385 | */ |
384 | static inline uint64_t itlb_tag_read_read(index_t entry) |
386 | static inline uint64_t itlb_tag_read_read(index_t entry) |
385 | { |
387 | { |
386 | itlb_tag_read_addr_t tag; |
388 | itlb_tag_read_addr_t tag; |
387 | 389 | ||
Line 390... | Line 392... | ||
390 | return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value); |
392 | return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value); |
391 | } |
393 | } |
392 | 394 | ||
393 | /** Read DMMU TLB Tag Read Register. |
395 | /** Read DMMU TLB Tag Read Register. |
394 | * |
396 | * |
395 | * @param entry TLB Entry index. |
397 | * @param entry TLB Entry index. |
396 | * |
398 | * |
397 | * @return Current value of specified DMMU TLB Tag Read Register. |
399 | * @return Current value of specified DMMU TLB Tag Read Register. |
398 | */ |
400 | */ |
399 | static inline uint64_t dtlb_tag_read_read(index_t entry) |
401 | static inline uint64_t dtlb_tag_read_read(index_t entry) |
400 | { |
402 | { |
401 | dtlb_tag_read_addr_t tag; |
403 | dtlb_tag_read_addr_t tag; |
402 | 404 | ||
Line 408... | Line 410... | ||
408 | #elif defined (US3) |
410 | #elif defined (US3) |
409 | 411 | ||
410 | 412 | ||
411 | /** Read IMMU TLB Data Access Register. |
413 | /** Read IMMU TLB Data Access Register. |
412 | * |
414 | * |
413 | * @param tlb TLB number (one of TLB_ISMALL or TLB_IBIG) |
415 | * @param tlb TLB number (one of TLB_ISMALL or TLB_IBIG) |
414 | * @param entry TLB Entry index. |
416 | * @param entry TLB Entry index. |
415 | * |
417 | * |
416 | * @return Current value of specified IMMU TLB Data Access Register. |
418 | * @return Current value of specified IMMU TLB Data Access |
- | 419 | * Register. |
|
417 | */ |
420 | */ |
418 | static inline uint64_t itlb_data_access_read(int tlb, index_t entry) |
421 | static inline uint64_t itlb_data_access_read(int tlb, index_t entry) |
419 | { |
422 | { |
420 | itlb_data_access_addr_t reg; |
423 | itlb_data_access_addr_t reg; |
421 | 424 | ||
Line 424... | Line 427... | ||
424 | reg.local_tlb_entry = entry; |
427 | reg.local_tlb_entry = entry; |
425 | return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value); |
428 | return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value); |
426 | } |
429 | } |
427 | 430 | ||
428 | /** Write IMMU TLB Data Access Register. |
431 | /** Write IMMU TLB Data Access Register. |
429 | * @param tlb TLB number (one of TLB_ISMALL or TLB_IBIG) |
432 | * @param tlb TLB number (one of TLB_ISMALL or TLB_IBIG) |
430 | * @param entry TLB Entry index. |
433 | * @param entry TLB Entry index. |
431 | * @param value Value to be written. |
434 | * @param value Value to be written. |
432 | */ |
435 | */ |
433 | static inline void itlb_data_access_write(int tlb, index_t entry, |
436 | static inline void itlb_data_access_write(int tlb, index_t entry, |
434 | uint64_t value) |
437 | uint64_t value) |
435 | { |
438 | { |
436 | itlb_data_access_addr_t reg; |
439 | itlb_data_access_addr_t reg; |
Line 442... | Line 445... | ||
442 | flush_pipeline(); |
445 | flush_pipeline(); |
443 | } |
446 | } |
444 | 447 | ||
445 | /** Read DMMU TLB Data Access Register. |
448 | /** Read DMMU TLB Data Access Register. |
446 | * |
449 | * |
447 | * @param tlb TLB number (one of TLB_DSMALL, TLB_DBIG, TLB_DBIG) |
450 | * @param tlb TLB number (one of TLB_DSMALL, TLB_DBIG, TLB_DBIG) |
448 | * @param entry TLB Entry index. |
451 | * @param entry TLB Entry index. |
449 | * |
452 | * |
450 | * @return Current value of specified DMMU TLB Data Access Register. |
453 | * @return Current value of specified DMMU TLB Data Access |
- | 454 | * Register. |
|
451 | */ |
455 | */ |
452 | static inline uint64_t dtlb_data_access_read(int tlb, index_t entry) |
456 | static inline uint64_t dtlb_data_access_read(int tlb, index_t entry) |
453 | { |
457 | { |
454 | dtlb_data_access_addr_t reg; |
458 | dtlb_data_access_addr_t reg; |
455 | 459 | ||
Line 459... | Line 463... | ||
459 | return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value); |
463 | return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value); |
460 | } |
464 | } |
461 | 465 | ||
462 | /** Write DMMU TLB Data Access Register. |
466 | /** Write DMMU TLB Data Access Register. |
463 | * |
467 | * |
464 | * @param tlb TLB number (one of TLB_DSMALL, TLB_DBIG_0, TLB_DBIG_1) |
468 | * @param tlb TLB number (one of TLB_DSMALL, TLB_DBIG_0, TLB_DBIG_1) |
465 | * @param entry TLB Entry index. |
469 | * @param entry TLB Entry index. |
466 | * @param value Value to be written. |
470 | * @param value Value to be written. |
467 | */ |
471 | */ |
468 | static inline void dtlb_data_access_write(int tlb, index_t entry, |
472 | static inline void dtlb_data_access_write(int tlb, index_t entry, |
469 | uint64_t value) |
473 | uint64_t value) |
470 | { |
474 | { |
471 | dtlb_data_access_addr_t reg; |
475 | dtlb_data_access_addr_t reg; |
Line 477... | Line 481... | ||
477 | membar(); |
481 | membar(); |
478 | } |
482 | } |
479 | 483 | ||
480 | /** Read IMMU TLB Tag Read Register. |
484 | /** Read IMMU TLB Tag Read Register. |
481 | * |
485 | * |
482 | * @param tlb TLB number (one of TLB_ISMALL or TLB_IBIG) |
486 | * @param tlb TLB number (one of TLB_ISMALL or TLB_IBIG) |
483 | * @param entry TLB Entry index. |
487 | * @param entry TLB Entry index. |
484 | * |
488 | * |
485 | * @return Current value of specified IMMU TLB Tag Read Register. |
489 | * @return Current value of specified IMMU TLB Tag Read Register. |
486 | */ |
490 | */ |
487 | static inline uint64_t itlb_tag_read_read(int tlb, index_t entry) |
491 | static inline uint64_t itlb_tag_read_read(int tlb, index_t entry) |
488 | { |
492 | { |
489 | itlb_tag_read_addr_t tag; |
493 | itlb_tag_read_addr_t tag; |
490 | 494 | ||
Line 494... | Line 498... | ||
494 | return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value); |
498 | return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value); |
495 | } |
499 | } |
496 | 500 | ||
497 | /** Read DMMU TLB Tag Read Register. |
501 | /** Read DMMU TLB Tag Read Register. |
498 | * |
502 | * |
499 | * @param tlb TLB number (one of TLB_DSMALL, TLB_DBIG_0, TLB_DBIG_1) |
503 | * @param tlb TLB number (one of TLB_DSMALL, TLB_DBIG_0, TLB_DBIG_1) |
500 | * @param entry TLB Entry index. |
504 | * @param entry TLB Entry index. |
501 | * |
505 | * |
502 | * @return Current value of specified DMMU TLB Tag Read Register. |
506 | * @return Current value of specified DMMU TLB Tag Read Register. |
503 | */ |
507 | */ |
504 | static inline uint64_t dtlb_tag_read_read(int tlb, index_t entry) |
508 | static inline uint64_t dtlb_tag_read_read(int tlb, index_t entry) |
505 | { |
509 | { |
506 | dtlb_tag_read_addr_t tag; |
510 | dtlb_tag_read_addr_t tag; |
507 | 511 | ||
Line 514... | Line 518... | ||
514 | #endif |
518 | #endif |
515 | 519 | ||
516 | 520 | ||
517 | /** Write IMMU TLB Tag Access Register. |
521 | /** Write IMMU TLB Tag Access Register. |
518 | * |
522 | * |
519 | * @param v Value to be written. |
523 | * @param v Value to be written. |
520 | */ |
524 | */ |
521 | static inline void itlb_tag_access_write(uint64_t v) |
525 | static inline void itlb_tag_access_write(uint64_t v) |
522 | { |
526 | { |
523 | asi_u64_write(ASI_IMMU, VA_IMMU_TAG_ACCESS, v); |
527 | asi_u64_write(ASI_IMMU, VA_IMMU_TAG_ACCESS, v); |
524 | flush_pipeline(); |
528 | flush_pipeline(); |
525 | } |
529 | } |
526 | 530 | ||
527 | /** Read IMMU TLB Tag Access Register. |
531 | /** Read IMMU TLB Tag Access Register. |
528 | * |
532 | * |
529 | * @return Current value of IMMU TLB Tag Access Register. |
533 | * @return Current value of IMMU TLB Tag Access Register. |
530 | */ |
534 | */ |
531 | static inline uint64_t itlb_tag_access_read(void) |
535 | static inline uint64_t itlb_tag_access_read(void) |
532 | { |
536 | { |
533 | return asi_u64_read(ASI_IMMU, VA_IMMU_TAG_ACCESS); |
537 | return asi_u64_read(ASI_IMMU, VA_IMMU_TAG_ACCESS); |
534 | } |
538 | } |
535 | 539 | ||
536 | /** Write DMMU TLB Tag Access Register. |
540 | /** Write DMMU TLB Tag Access Register. |
537 | * |
541 | * |
538 | * @param v Value to be written. |
542 | * @param v Value to be written. |
539 | */ |
543 | */ |
540 | static inline void dtlb_tag_access_write(uint64_t v) |
544 | static inline void dtlb_tag_access_write(uint64_t v) |
541 | { |
545 | { |
542 | asi_u64_write(ASI_DMMU, VA_DMMU_TAG_ACCESS, v); |
546 | asi_u64_write(ASI_DMMU, VA_DMMU_TAG_ACCESS, v); |
543 | membar(); |
547 | membar(); |
544 | } |
548 | } |
545 | 549 | ||
546 | /** Read DMMU TLB Tag Access Register. |
550 | /** Read DMMU TLB Tag Access Register. |
547 | * |
551 | * |
548 | * @return Current value of DMMU TLB Tag Access Register. |
552 | * @return Current value of DMMU TLB Tag Access Register. |
549 | */ |
553 | */ |
550 | static inline uint64_t dtlb_tag_access_read(void) |
554 | static inline uint64_t dtlb_tag_access_read(void) |
551 | { |
555 | { |
552 | return asi_u64_read(ASI_DMMU, VA_DMMU_TAG_ACCESS); |
556 | return asi_u64_read(ASI_DMMU, VA_DMMU_TAG_ACCESS); |
553 | } |
557 | } |
554 | 558 | ||
555 | 559 | ||
556 | /** Write IMMU TLB Data in Register. |
560 | /** Write IMMU TLB Data in Register. |
557 | * |
561 | * |
558 | * @param v Value to be written. |
562 | * @param v Value to be written. |
559 | */ |
563 | */ |
560 | static inline void itlb_data_in_write(uint64_t v) |
564 | static inline void itlb_data_in_write(uint64_t v) |
561 | { |
565 | { |
562 | asi_u64_write(ASI_ITLB_DATA_IN_REG, 0, v); |
566 | asi_u64_write(ASI_ITLB_DATA_IN_REG, 0, v); |
563 | flush_pipeline(); |
567 | flush_pipeline(); |
564 | } |
568 | } |
565 | 569 | ||
566 | /** Write DMMU TLB Data in Register. |
570 | /** Write DMMU TLB Data in Register. |
567 | * |
571 | * |
568 | * @param v Value to be written. |
572 | * @param v Value to be written. |
569 | */ |
573 | */ |
570 | static inline void dtlb_data_in_write(uint64_t v) |
574 | static inline void dtlb_data_in_write(uint64_t v) |
571 | { |
575 | { |
572 | asi_u64_write(ASI_DTLB_DATA_IN_REG, 0, v); |
576 | asi_u64_write(ASI_DTLB_DATA_IN_REG, 0, v); |
573 | membar(); |
577 | membar(); |
574 | } |
578 | } |
575 | 579 | ||
576 | /** Read ITLB Synchronous Fault Status Register. |
580 | /** Read ITLB Synchronous Fault Status Register. |
577 | * |
581 | * |
578 | * @return Current content of I-SFSR register. |
582 | * @return Current content of I-SFSR register. |
579 | */ |
583 | */ |
580 | static inline uint64_t itlb_sfsr_read(void) |
584 | static inline uint64_t itlb_sfsr_read(void) |
581 | { |
585 | { |
582 | return asi_u64_read(ASI_IMMU, VA_IMMU_SFSR); |
586 | return asi_u64_read(ASI_IMMU, VA_IMMU_SFSR); |
583 | } |
587 | } |
584 | 588 | ||
585 | /** Write ITLB Synchronous Fault Status Register. |
589 | /** Write ITLB Synchronous Fault Status Register. |
586 | * |
590 | * |
587 | * @param v New value of I-SFSR register. |
591 | * @param v New value of I-SFSR register. |
588 | */ |
592 | */ |
589 | static inline void itlb_sfsr_write(uint64_t v) |
593 | static inline void itlb_sfsr_write(uint64_t v) |
590 | { |
594 | { |
591 | asi_u64_write(ASI_IMMU, VA_IMMU_SFSR, v); |
595 | asi_u64_write(ASI_IMMU, VA_IMMU_SFSR, v); |
592 | flush_pipeline(); |
596 | flush_pipeline(); |
593 | } |
597 | } |
594 | 598 | ||
595 | /** Read DTLB Synchronous Fault Status Register. |
599 | /** Read DTLB Synchronous Fault Status Register. |
596 | * |
600 | * |
597 | * @return Current content of D-SFSR register. |
601 | * @return Current content of D-SFSR register. |
598 | */ |
602 | */ |
599 | static inline uint64_t dtlb_sfsr_read(void) |
603 | static inline uint64_t dtlb_sfsr_read(void) |
600 | { |
604 | { |
601 | return asi_u64_read(ASI_DMMU, VA_DMMU_SFSR); |
605 | return asi_u64_read(ASI_DMMU, VA_DMMU_SFSR); |
602 | } |
606 | } |
603 | 607 | ||
604 | /** Write DTLB Synchronous Fault Status Register. |
608 | /** Write DTLB Synchronous Fault Status Register. |
605 | * |
609 | * |
606 | * @param v New value of D-SFSR register. |
610 | * @param v New value of D-SFSR register. |
607 | */ |
611 | */ |
608 | static inline void dtlb_sfsr_write(uint64_t v) |
612 | static inline void dtlb_sfsr_write(uint64_t v) |
609 | { |
613 | { |
610 | asi_u64_write(ASI_DMMU, VA_DMMU_SFSR, v); |
614 | asi_u64_write(ASI_DMMU, VA_DMMU_SFSR, v); |
611 | membar(); |
615 | membar(); |
612 | } |
616 | } |
613 | 617 | ||
614 | /** Read DTLB Synchronous Fault Address Register. |
618 | /** Read DTLB Synchronous Fault Address Register. |
615 | * |
619 | * |
616 | * @return Current content of D-SFAR register. |
620 | * @return Current content of D-SFAR register. |
617 | */ |
621 | */ |
618 | static inline uint64_t dtlb_sfar_read(void) |
622 | static inline uint64_t dtlb_sfar_read(void) |
619 | { |
623 | { |
620 | return asi_u64_read(ASI_DMMU, VA_DMMU_SFAR); |
624 | return asi_u64_read(ASI_DMMU, VA_DMMU_SFAR); |
621 | } |
625 | } |
622 | 626 | ||
623 | /** Perform IMMU TLB Demap Operation. |
627 | /** Perform IMMU TLB Demap Operation. |
624 | * |
628 | * |
625 | * @param type |
- | |
626 | * Selects between context and page demap |
629 | * @param type Selects between context and page demap (and entire MMU |
627 | * (and entire MMU demap on US3). |
630 | * demap on US3). |
628 | * @param context_encoding Specifies which Context register has Context ID for |
631 | * @param context_encoding Specifies which Context register has Context ID for |
629 | * demap. |
632 | * demap. |
630 | * @param page Address which is on the page to be demapped. |
633 | * @param page Address which is on the page to be demapped. |
631 | */ |
634 | */ |
632 | static inline void itlb_demap(int type, int context_encoding, uintptr_t page) |
635 | static inline void itlb_demap(int type, int context_encoding, uintptr_t page) |
633 | { |
636 | { |
634 | tlb_demap_addr_t da; |
637 | tlb_demap_addr_t da; |
635 | page_address_t pg; |
638 | page_address_t pg; |
Line 639... | Line 642... | ||
639 | 642 | ||
640 | da.type = type; |
643 | da.type = type; |
641 | da.context = context_encoding; |
644 | da.context = context_encoding; |
642 | da.vpn = pg.vpn; |
645 | da.vpn = pg.vpn; |
643 | 646 | ||
644 | asi_u64_write(ASI_IMMU_DEMAP, da.value, 0); /* da.value is the |
- | |
645 | * address within the |
647 | /* da.value is the address within the ASI */ |
646 | * ASI */ |
648 | asi_u64_write(ASI_IMMU_DEMAP, da.value, 0); |
- | 649 | ||
647 | flush_pipeline(); |
650 | flush_pipeline(); |
648 | } |
651 | } |
649 | 652 | ||
650 | /** Perform DMMU TLB Demap Operation. |
653 | /** Perform DMMU TLB Demap Operation. |
651 | * |
654 | * |
652 | * @param type |
- | |
653 | * Selects between context and page demap |
655 | * @param type Selects between context and page demap (and entire MMU |
654 | * (and entire MMU demap on US3). |
656 | * demap on US3). |
655 | * @param context_encoding Specifies which Context register has Context ID for |
657 | * @param context_encoding Specifies which Context register has Context ID for |
656 | * demap. |
658 | * demap. |
657 | * @param page Address which is on the page to be demapped. |
659 | * @param page Address which is on the page to be demapped. |
658 | */ |
660 | */ |
659 | static inline void dtlb_demap(int type, int context_encoding, uintptr_t page) |
661 | static inline void dtlb_demap(int type, int context_encoding, uintptr_t page) |
660 | { |
662 | { |
661 | tlb_demap_addr_t da; |
663 | tlb_demap_addr_t da; |
662 | page_address_t pg; |
664 | page_address_t pg; |
Line 666... | Line 668... | ||
666 | 668 | ||
667 | da.type = type; |
669 | da.type = type; |
668 | da.context = context_encoding; |
670 | da.context = context_encoding; |
669 | da.vpn = pg.vpn; |
671 | da.vpn = pg.vpn; |
670 | 672 | ||
671 | asi_u64_write(ASI_DMMU_DEMAP, da.value, 0); /* da.value is the |
- | |
672 | * address within the |
673 | /* da.value is the address within the ASI */ |
673 | * ASI */ |
674 | asi_u64_write(ASI_DMMU_DEMAP, da.value, 0); |
- | 675 | ||
674 | membar(); |
676 | membar(); |
675 | } |
677 | } |
676 | 678 | ||
677 | extern void fast_instruction_access_mmu_miss(unative_t unused, istate_t *istate); |
679 | extern void fast_instruction_access_mmu_miss(unative_t, istate_t *); |
678 | extern void fast_data_access_mmu_miss(tlb_tag_access_reg_t tag, istate_t *istate); |
680 | extern void fast_data_access_mmu_miss(tlb_tag_access_reg_t, istate_t *); |
679 | extern void fast_data_access_protection(tlb_tag_access_reg_t tag , istate_t *istate); |
681 | extern void fast_data_access_protection(tlb_tag_access_reg_t , istate_t *); |
680 | 682 | ||
681 | extern void dtlb_insert_mapping(uintptr_t page, uintptr_t frame, int pagesize, bool locked, bool cacheable); |
683 | extern void dtlb_insert_mapping(uintptr_t, uintptr_t, int, bool, bool); |
682 | 684 | ||
683 | extern void dump_sfsr_and_sfar(void); |
685 | extern void dump_sfsr_and_sfar(void); |
684 | 686 | ||
685 | #endif /* !def __ASM__ */ |
687 | #endif /* !def __ASM__ */ |
686 | 688 |