Lines Matching +full:0 +full:xfffffff0
27 # Window 0 is the FW_STATUS area, and 4k after that the IPC "outbox"
32 WINDOW_BASE = 0x80000
33 WINDOW_STRIDE = 0x20000
35 WINDOW_BASE_ACE = 0x180000
36 WINDOW_STRIDE_ACE = 0x8000
39 DEBUG_SLOT_SHELL = 0
46 CRST = 0
55 self.base = hdamem + 0x0080 + (stream_id * 0x20)
59 self.hda.GCAP = 0x0000
60 self.hda.GCTL = 0x0008
61 self.hda.DPLBASE = 0x0070
62 self.hda.DPUBASE = 0x0074
63 self.hda.SPBFCH = 0x0700
64 self.hda.SPBFCTL = 0x0704
65 self.hda.PPCH = 0x0800
66 self.hda.PPCTL = 0x0804
67 self.hda.PPSTS = 0x0808
68 self.hda.SPIB = 0x0708 + stream_id*0x08
72 self.regs.CTL = 0x00
73 self.regs.STS = 0x03
74 self.regs.LPIB = 0x04
75 self.regs.CBL = 0x08
76 self.regs.LVI = 0x0c
77 self.regs.FIFOW = 0x0e
78 self.regs.FIFOS = 0x10
79 self.regs.FMT = 0x12
80 self.regs.FIFOL= 0x14
81 self.regs.BDPL = 0x18
82 self.regs.BDPU = 0x1c
85 self.dbg0 = Regs(hdamem + 0x0084 + (0x20*stream_id))
86 self.dbg0.DPIB = 0x00
87 self.dbg0.EFIFOS = 0x10
102 …self.regs.CTL = ((self.stream_id & 0xFF) << 20) | (1 << 18) # must be set to something other than …
103 self.regs.BDPU = (self.buf_list_addr >> 32) & 0xffffffff
104 self.regs.BDPL = self.buf_list_addr & 0xffffffff
107 self.mem.seek(0)
115 self.mem[0:bufl] = data[0:bufl]
116 self.mem[bufl:bufl+bufl] = data[0:bufl]
136 log.info(f"Mapped 2M huge page at 0x{phys_addr:x} for buf size ({buf_len})")
152 for i in range(0, buf_len*2):
153 mem[i] = 0
159 log.debug("HDA %d: PPROC %d, CTL 0x%x, LPIB 0x%x, BDPU 0x%x, BDPL 0x%x, CBL 0x%x, LVI 0x%x",
163 …self.regs.FIFOW & 0x7, self.regs.FIFOS, self.regs.FMT, self.regs.FIFOL, self.dbg0.DPIB, self.dbg0.…
181 while (self.regs.CTL & 1) == 0: pass
183 self.regs.CTL = 0
186 log.info(f"Disable SPIB and set position 0 of stream {self.stream_id}")
187 self.hda.SPBFCTL = 0
188 self.hda.SPIB = 0
191 #self.hda.DPUBASE = self.pos_buf_addr >> 32 & 0xffffffff
192 #self.hda.DPLBASE = self.pos_buf_addr & 0xfffffff0 | 1
214 p = runx(f"grep -iEl 'PCI_CLASS=40(10|38)0' /sys/bus/pci/devices/*/uevent")
220 cavs25 = did in [ 0x43c8, 0x4b55, 0x4b58, 0x51c8, 0x51ca, 0x51cb, 0x51ce, 0x51cf, 0x54c8,
221 0x7ad0, 0xa0c8 ]
222 ace15 = did in [ 0x7728, 0x7f50, 0x7e28 ]
223 ace20 = did in [ 0xa828 ]
224 ace30 = did in [ 0xe428 ]
248 (hdamem, _) = bar_map(pcidir, 0)
250 hda.GCAP = 0x0000
251 hda.GCTL = 0x0008
252 hda.SPBFCTL = 0x0704
253 hda.PPCTL = 0x0804
256 hda_ostream_id = (hda.GCAP >> 8) & 0x0f # number of input streams
257 log.info(f"Selected output stream {hda_ostream_id} (GCAP = 0x{hda.GCAP:x})")
258 hda.SD_SPIB = 0x0708 + (8 * hda_ostream_id)
263 sd = Regs(hdamem + 0x0080 + (hda_ostream_id * 0x20))
264 sd.CTL = 0x00
265 sd.CBL = 0x08
266 sd.LVI = 0x0c
267 sd.BDPL = 0x18
268 sd.BDPU = 0x1c
277 dsp.HFDSSCS = 0x1000
278 dsp.HFPWRCTL = 0x1d18 if ace15 or ace20 else 0x1d20
279 dsp.HFPWRSTS = 0x1d1c if ace15 or ace20 else 0x1d24
280 dsp.DSP2CXCTL_PRIMARY = 0x178d04
281 dsp.HFIPCXTDR = 0x73200
282 dsp.HFIPCXTDA = 0x73204
283 dsp.HFIPCXIDR = 0x73210
284 dsp.HFIPCXIDA = 0x73214
285 dsp.HFIPCXCTL = 0x73228
286 dsp.HFIPCXTDDY = 0x73300
287 dsp.HFIPCXIDDY = 0x73380
288 dsp.ROM_STATUS = 0x163200 if ace15 else 0x160200
291 dsp.ADSPCS = 0x00004
292 dsp.HIPCTDR = 0x000c0
293 dsp.HIPCTDA = 0x000c4
294 dsp.HIPCTDD = 0x000c8
295 dsp.HIPCIDR = 0x000d0
296 dsp.HIPCIDA = 0x000d4
297 dsp.HIPCIDD = 0x000d8
306 mem[0:len(fw_bytes)] = fw_bytes
308 log.info("Mapped 2M huge page at 0x%x to contain %d bytes of firmware"
336 if free == 0:
351 mem[0] = 0 # Fault the page in so it has an address!
357 paddr = (struct.unpack("Q", pent)[0] & ((1 << 55) - 1)) * PAGESZ
394 return 0b1 << bit
404 (magic, sz) = struct.unpack("4sI", fw_bytes[0:8])
413 hda.GCTL = 0
418 log.info(f"Stalling and Resetting DSP cores, ADSPCS = 0x{dsp.ADSPCS:x}")
421 while (dsp.ADSPCS & mask(CRST)) == 0: pass
423 log.info(f"Powering down DSP cores, ADSPCS = 0x{dsp.ADSPCS:x}")
430 while (sd.CTL & 1) == 0: pass
431 sd.CTL = 0
434 sd.BDPU = (buf_list_addr >> 32) & 0xffffffff
435 sd.BDPL = buf_list_addr & 0xffffffff
447 # Start DSP. Only start up core 0, reset is managed by DSP.
448 log.info(f"Starting DSP, ADSPCS = 0x{dsp.ADSPCS:x}")
450 while (dsp.ADSPCS & mask(CPA)) == 0: pass
452 log.info(f"Unresetting DSP cores, ADSPCS = 0x{dsp.ADSPCS:x}")
454 while (dsp.ADSPCS & 1) != 0: pass
456 log.info(f"Running DSP cores, ADSPCS = 0x{dsp.ADSPCS:x}")
463 log.info(f"Wait for ROM startup, ADSPCS = 0x{dsp.ADSPCS:x}")
471 stream_idx = 0
473 | (0x01 << 24) # type = PURGE_FW
476 log.info(f"Sending IPC command, HIPIDR = 0x{ipcval:x}")
479 log.info(f"Starting DMA, FW_STATUS = 0x{dsp.SRAM_FW_STATUS:x}")
507 (magic, sz) = struct.unpack("4sI", fw_bytes[0:8])
516 hda.GCTL = 0
538 dsp.HFPWRCTL |= 0x1 # set SPA bit
541 while not dsp.HFPWRSTS & 0x1:
546 dsp.DSP2CXCTL_PRIMARY &= ~(0x1) # clear SPA
555 while (sd.CTL & 1) == 0: pass
556 sd.CTL = 0
559 sd.BDPU = (buf_list_addr >> 32) & 0xffffffff
560 sd.BDPL = buf_list_addr & 0xffffffff
577 stream_idx = 0
579 | (0x01 << 24) # type = PURGE_FW
582 log.info(f"Sending IPC command, HFIPCXIDR = 0x{ipcval:x}")
586 dsp.DSP2CXCTL_PRIMARY |= 0x1 # clear SPA
600 log.info(f"Starting DMA, FW_STATUS = 0x{dsp.ROM_STATUS:x}")
621 log.info("Waiting %s for firmware handoff, ROM_STATUS = 0x%x",
632 if attempts < 0:
637 log.warning("Load failed? ROM_STATUS = 0x%x", dsp.ROM_STATUS)
639 log.info("FW alive, ROM_STATUS = 0x%x", dsp.ROM_STATUS)
660 hdr.WLEN = 0x00
661 hdr.START = 0x04
662 hdr.END = 0x08
663 hdr.SEQ = 0x0c
679 if wlen == 0:
681 if last_seq == 0:
715 if wlen == 0:
723 if seq != 0:
732 for c in range(0, suffix):
735 for c in range(0, lenmsg - suffix):
751 while attempts > 0:
752 data = win_read(debug_offset(), 0, ADSP_DW_SLOT_COUNT * 3 * 4)
759 log.info("found desc %u resource_id 0x%08x type_id 0x%08x vma 0x%08x",
779 if len(msg) > 0:
804 ipc_timestamp = 0
811 if data == 0: # noop, with synchronous DONE
826 elif data == 5: # copy word at outbox[ext_data >> 16] to inbox[ext_data & 0xffff]
828 dst = inbox_offset() + 4 * (ext_data & 0xffff)
832 stream_id = ext_data & 0xff
839 stream_id = ext_data & 0xFF
840 buf_len = ext_data >> 8 & 0xFFFF
844 stream_id = ext_data & 0xFF
846 hda_streams[stream_id].mem.seek(0)
849 stream_id = ext_data & 0xFF
852 stream_id = ext_data & 0xFF
856 hda_str.mem.seek(0)
866 stream_id = ext_data & 0xff
868 for i in range(0, 256):
872 stream_id = ext_data & 0xFF
873 buf_len = ext_data >> 8 & 0xFFFF
877 read_lens = [buf_len, 0]
879 read_lens[0] = hda_str.buf_len*2 - pos
880 read_lens[1] = buf_len - read_lens[0]
882 assert (read_lens[0] + pos) <= (hda_str.buf_len*2)
883 assert read_lens[0] % 128 == 0
884 assert read_lens[1] % 128 == 0
885 buf_data0 = hda_str.mem.read(read_lens[0])
888 if read_lens[1] != 0:
889 hda_str.mem.seek(0)
896 log.warning(f"cavstool: Unrecognized IPC command 0x{data:x} ext 0x{ext_data:x}")
912 log.debug("ipc: sending msg 0x%08x" % ext_data)
925 if dsp.HFIPCXIDA & 0x80000000:
928 if dsp.HFIPCXTDR & 0x80000000:
929 ipc_command(dsp.HFIPCXTDR & ~0x80000000, dsp.HFIPCXTDDY)
932 if dsp.HIPCIDA & 0x80000000:
934 if dsp.HIPCTDR & 0x80000000:
935 ipc_command(dsp.HIPCTDR & ~0x80000000, dsp.HIPCTDD)
971 last_seq = 0
972 last_seq_shell = 0