board_inspector: more verbose messages
It is quite common to meet permissions errors when opening a specific region of /dev/mem due to kernel configurations. This patch adds a bit more logs on this for eaiser debugging. Tracked-On: #6287 Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
parent
26021bd467
commit
879c6c11ca
|
@ -310,7 +310,12 @@ class OperationRegion(Object):
|
|||
logging.info(f"Open system memory space {name}: [{hex(offset)}, {hex(offset + length - 1)}]")
|
||||
offset_page_aligned = (offset >> 12) << 12
|
||||
length_page_aligned = ceil(((offset & 0xFFF) + length) / 0x1000) * 0x1000
|
||||
try:
|
||||
mm = mmap.mmap(cls.devmem.fileno(), length_page_aligned, flags=mmap.MAP_PRIVATE, prot=mmap.PROT_READ, offset=offset_page_aligned)
|
||||
except PermissionError as e:
|
||||
logging.warning(f"Do not have permission to access [{hex(offset_page_aligned)}, {hex(offset_page_aligned + length_page_aligned)}] by /dev/mem.")
|
||||
logging.warning(f"You may need to add `iomem=relaxed` to the Linux kernel command line in your bootloader configuration file.")
|
||||
raise
|
||||
iobuf = StreamIOBuffer(mm, offset & 0xFFF, length)
|
||||
return OperationRegion(iobuf)
|
||||
|
||||
|
|
Loading…
Reference in New Issue