boards/intel_adsp: Update cavs-fw.py, robustify vs. Linux PM

Add support for the extended manifest blocks that recent versions of
rimage are including as a prefix on the firmware blob.

Also include some PCI runtime PM tricks to reliably enable the DSP
device on kernels that have turned off the DSP device automatically
(e.g. systems that have PM enabled by default but where the SOF driver
is not loaded -- chromebooks work this way, potentially other
distros).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2021-06-25 12:12:44 -07:00 committed by Anas Nashif
commit eca7cc7a4a

View file

@ -30,6 +30,10 @@ def main():
with open(FW_FILE, "rb") as f:
fw_bytes = f.read()
(magic, sz) = struct.unpack("4sI", fw_bytes[0:8])
if magic == b'XMan':
fw_bytes = fw_bytes[sz:len(fw_bytes)]
(hda, sd, dsp) = map_regs() # Device register mappings
# Turn on HDA "global processing enable" first, which actually
@ -121,6 +125,16 @@ def map_regs():
pcidir = os.path.dirname(p)
break
# Disengage runtime power management so the kernel doesn't put it to sleep
with open(pcidir + b"/power/control", "w") as ctrl:
ctrl.write("on")
# Make sure PCI memory space access and busmastering are enabled.
# Also disable interrupts so as not to confuse the kernel.
with open(pcidir + b"/config", "wb+") as cfg:
cfg.seek(4)
cfg.write(b'\x06\x04')
hdamem = bar_map(pcidir, 0)
# Standard HD Audio Registers