From a5fb124e699f75aebd221cc6066e09fea1c8493a Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Mon, 2 Oct 2023 15:00:12 +0200 Subject: [PATCH] pdmonboard: switch to mmu_map_dma_mem. --- cpu/ppc/ppcmmu.cpp | 22 ---------------------- cpu/ppc/ppcmmu.h | 1 - devices/video/pdmonboard.cpp | 3 ++- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/cpu/ppc/ppcmmu.cpp b/cpu/ppc/ppcmmu.cpp index fd1698f..e02425e 100644 --- a/cpu/ppc/ppcmmu.cpp +++ b/cpu/ppc/ppcmmu.cpp @@ -307,28 +307,6 @@ static PATResult page_address_translation(uint32_t la, bool is_instr_fetch, }; } -uint8_t* mmu_get_dma_mem(uint32_t addr, uint32_t size, bool* is_writable) -{ - if (addr >= last_dma_area.start && (addr + size) <= last_dma_area.end) { - if (is_writable) - *is_writable = last_dma_area.type & RT_RAM; - return last_dma_area.mem_ptr + (addr - last_dma_area.start); - } else { - AddressMapEntry* entry = mem_ctrl_instance->find_range(addr); - if (entry && entry->type & (RT_ROM | RT_RAM)) { - last_dma_area.start = entry->start; - last_dma_area.end = entry->end; - last_dma_area.mem_ptr = entry->mem_ptr; - last_dma_area.type = entry->type; - if (is_writable) - *is_writable = entry->type & RT_RAM; - return last_dma_area.mem_ptr + (addr - last_dma_area.start); - } else { - ABORT_F("SOS: DMA access to unmapped memory %08X!\n", addr); - } - } -} - MapDmaResult mmu_map_dma_mem(uint32_t addr, uint32_t size, bool allow_mmio) { MMIODevice *devobj = nullptr; uint8_t *host_va = nullptr; diff --git a/cpu/ppc/ppcmmu.h b/cpu/ppc/ppcmmu.h index eaebb96..3456189 100644 --- a/cpu/ppc/ppcmmu.h +++ b/cpu/ppc/ppcmmu.h @@ -117,7 +117,6 @@ enum TLBFlags : uint16_t { extern std::function ibat_update; extern std::function dbat_update; -extern uint8_t* mmu_get_dma_mem(uint32_t addr, uint32_t size, bool* is_writable); extern MapDmaResult mmu_map_dma_mem(uint32_t addr, uint32_t size, bool allow_mmio); extern void mmu_change_mode(void); diff --git a/devices/video/pdmonboard.cpp b/devices/video/pdmonboard.cpp index 4398e36..2daa62a 100644 --- a/devices/video/pdmonboard.cpp +++ b/devices/video/pdmonboard.cpp @@ -203,7 +203,8 @@ void PdmOnboardVideo::enable_video_internal() LOG_F(INFO, "PDM-Video: framebuffer phys base addr = 0x%X", fb_base_phys); // set CRTC parameters - this->fb_ptr = mmu_get_dma_mem(fb_base_phys, PDM_FB_SIZE_MAX, nullptr); + MapDmaResult res = mmu_map_dma_mem(fb_base_phys, PDM_FB_SIZE_MAX, false); + this->fb_ptr = res.host_va; this->active_width = new_width; this->active_height = new_height; this->hori_blank = hori_blank;