pdmonboard: switch to mmu_map_dma_mem.

This commit is contained in:
Maxim Poliakovski 2023-10-02 15:00:12 +02:00
parent 72d45fb0de
commit a5fb124e69
3 changed files with 2 additions and 24 deletions

View File

@ -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;

View File

@ -117,7 +117,6 @@ enum TLBFlags : uint16_t {
extern std::function<void(uint32_t bat_reg)> ibat_update;
extern std::function<void(uint32_t bat_reg)> 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);

View File

@ -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;