intel / FdtBusPkg

Device Tree-based Platform Device Driver Development for Tiano UEFI
https://wiki.riseproject.dev/display/HOME/EDK2_00_03+-+FdtBusDxe+support
11 stars 1 forks source link

GetReg & friends should ensure Reg is mapped #76

Closed andreiw closed 7 months ago

andreiw commented 7 months ago

FS0:> dtreg /soc/rtc@101000 0 Dumping 1 bytes at offset 0x0 of reg via CPU 0x101000(1000): !!!! RISCV64 Exception Type - 000000000000000D(EXCEPT_RISCV_LOAD_ACCESS_PAGE_FAULT) !!!!

E.g, for EFI_DT_REG that translate to a CPU address, the code should ensure the range is registered with the gDS (e.g. AddMemorySpace + SetMemorySpaceAttributes)

Doing this in ParseProp/GetReg/GetRegByName is better then forcing callers to use yet another call (e.g. SetRegAttrs). And doing this for every (functional) device enumerated by FdtBusDxe is not a good idea because of overhead. GetReg seems like an okay compromise - it's rarely called, for one (once per driver per device, ideally).