The BIOS driver must set EFI_RUNTIME_MEMORY attribute for the EfiGcdMemoryTypeMemoryMappedIo region with GCD service gDS->SetMemorySpaceAttributes(). Then DXE will report EfiMemoryMappedIO with EFI_RUNTIME_MEMORY attribute in UEFI memory map. The OS will gBS->GetMemoryMap() and assign virtual address for the MMIO, and gRT->SetVirtualAddressMap() back to the BIOS.
Finally, the BIOS driver can gRT->ConvertPointer() the MMIO physical address to virtual address, then access it at runtime. Thank you Yao Jiewen > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd > Hoffmann > Sent: Monday, August 30, 2021 6:24 PM > To: devel@edk2.groups.io > Subject: [edk2-devel] mmio mappings for runtime service > > Hi, > > What is the correct way to make sure runtime services can access > mmio registers, i.e. that there is a mapping in the page tables > for the mmio page needed? > > Is that the job of the firmware? > Or should the OS calling the runtime service handle that? > In case of the latter: How does the OS figure which pages are needed? > > thanks, > Gerd > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#79953): https://edk2.groups.io/g/devel/message/79953 Mute This Topic: https://groups.io/mt/85247585/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-