From f290297bb68dfab9080fff39d47351dd2d7d1331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sat, 21 Aug 2010 00:36:09 +0000 Subject: [PATCH] ppc: Support other memory types Let setting the memory type to B_MTR_UC succeed. Add initial support for those memory types in the translation map, pointed out by Ingo in ticket #5193. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38292 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/arch/ppc/arch_vm.cpp | 2 +- .../kernel/arch/ppc/arch_vm_translation_map.cpp | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/system/kernel/arch/ppc/arch_vm.cpp b/src/system/kernel/arch/ppc/arch_vm.cpp index a3e97ef8b5..39296034a5 100644 --- a/src/system/kernel/arch/ppc/arch_vm.cpp +++ b/src/system/kernel/arch/ppc/arch_vm.cpp @@ -175,5 +175,5 @@ arch_vm_set_memory_type(VMArea *area, phys_addr_t physicalBase, uint32 type) if (type == 0) return B_OK; - return B_ERROR; + return B_OK; } diff --git a/src/system/kernel/arch/ppc/arch_vm_translation_map.cpp b/src/system/kernel/arch/ppc/arch_vm_translation_map.cpp index e62d0e3ce4..9a29113b47 100644 --- a/src/system/kernel/arch/ppc/arch_vm_translation_map.cpp +++ b/src/system/kernel/arch/ppc/arch_vm_translation_map.cpp @@ -201,15 +201,15 @@ ppc_translation_map_change_asid(VMTranslationMap *map) static void fill_page_table_entry(page_table_entry *entry, uint32 virtualSegmentID, addr_t virtualAddress, phys_addr_t physicalAddress, uint8 protection, - bool secondaryHash) + uint32 memoryType, bool secondaryHash) { // lower 32 bit - set at once entry->physical_page_number = physicalAddress / B_PAGE_SIZE; entry->_reserved0 = 0; entry->referenced = false; entry->changed = false; - entry->write_through = false; - entry->caching_inhibited = false; + entry->write_through = (memoryType == B_MTR_UC) || (memoryType == B_MTR_WT); + entry->caching_inhibited = (memoryType == B_MTR_UC); entry->memory_coherent = false; entry->guarded = false; entry->_reserved1 = 0; @@ -389,7 +389,6 @@ status_t PPCVMTranslationMap::Map(addr_t virtualAddress, phys_addr_t physicalAddress, uint32 attributes, uint32 memoryType, vm_page_reservation* reservation) { -// TODO: Support memory types! // lookup the vsid based off the va uint32 virtualSegmentID = VADDR_TO_VSID(fVSIDBase, virtualAddress); uint32 protection = 0; @@ -413,7 +412,7 @@ PPCVMTranslationMap::Map(addr_t virtualAddress, phys_addr_t physicalAddress, continue; fill_page_table_entry(entry, virtualSegmentID, virtualAddress, physicalAddress, - protection, false); + protection, memoryType, false); fMapCount++; return B_OK; } @@ -430,7 +429,7 @@ PPCVMTranslationMap::Map(addr_t virtualAddress, phys_addr_t physicalAddress, continue; fill_page_table_entry(entry, virtualSegmentID, virtualAddress, physicalAddress, - protection, false); + protection, memoryType, false); fMapCount++; return B_OK; } @@ -767,7 +766,8 @@ arch_vm_translation_map_early_map(kernel_args *ka, addr_t virtualAddress, if (group->entry[i].valid) continue; - fill_page_table_entry(&group->entry[i], virtualSegmentID, virtualAddress, physicalAddress, PTE_READ_WRITE, false); + fill_page_table_entry(&group->entry[i], virtualSegmentID, + virtualAddress, physicalAddress, PTE_READ_WRITE, 0, false); return B_OK; } @@ -778,7 +778,8 @@ arch_vm_translation_map_early_map(kernel_args *ka, addr_t virtualAddress, if (group->entry[i].valid) continue; - fill_page_table_entry(&group->entry[i], virtualSegmentID, virtualAddress, physicalAddress, PTE_READ_WRITE, true); + fill_page_table_entry(&group->entry[i], virtualSegmentID, + virtualAddress, physicalAddress, PTE_READ_WRITE, 0, true); return B_OK; }