Commit graph

1138 commits

Author SHA1 Message Date
Hector Martin
d381341865 m1n1.trace.asc: Add missing power control messages
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-15 14:05:13 +09:00
Hector Martin
45c3682f60 m1n1.fw.smc: Handle notifications
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-15 14:05:13 +09:00
Hector Martin
a0680a2678 m1n1.adt: Better parse PMU props
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-15 14:05:13 +09:00
Martin Povišer
7bab3d0fc3 exception: Fix silent mode
Do not forget to clear the L2C_ERR flags in silent mode also. This is
necessary for proper recovery.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-14 11:47:04 +09:00
Martin Povišer
41f0874f99 experiments/audio_capture.py: Demonstrate audio capture
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
78aa55f0bc experiments/speaker_amp.py: Revamp hardware setup
Use register definitions where they are now available. Start from full
AUDIO_P reset and set NCO ourselves (instead of relying on iBoot
values).

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
0d4c7af26b m1n1.hw.mca: Add MCA register definitions
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
90c4a1ae46 m1n1.hw.admac: Improve polling
Make sure we read any reports before we start submitting new
descriptors. Also put sleep in busy-wait loop and make speaker_amp.py
exit once EOF is reached.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
9bd84dfbb9 experiments/speaker_amp.py: Drop 'polling console'
Drop the 'polling console' code as there are now better ways to achieve
the same. (One can use USB_VUART for second proxy session, see 85ee2f24)

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
532f260fae m1n1.hw.admac: Label burst size, buswidth registers
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
3a8ae74907 m1n1.hw.admac: Introduce RX channels
Fill in register definitions and extend the driver code to introduce
support for RX channels. This involves change of channel numbering.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
590722b29d m1n1.hw.admac: Use stderr for debug prints
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
64d8f9d1b3 m1n1.loadobjs: Add util for loading objects on target
For those of us who can't write assembly but still need to run code on
the other side.

  >>> from m1n1.loadobjs import *
  >>> lp = LinkedProgram(u)
  >>> lp.debug_printf("hello from the other side (%d)\n", 42)
  TTY> hello from the other side (42)
  0x1f
  >>> lp.load_obj("build/test.o")
  >>> lp.test()
  TTY> hello from loaded object
  0x19
  >>> lp.clear_objs()

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:14:38 +09:00
Hector Martin
6f525fc0f1 smp: Skip missing CPUs and continue
This will probably fix missing CPUs on low-binned machines

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-08 13:35:49 +09:00
Janne Grunau
1903dbd17e kboot: reload dt offset after dt_set_uboot_dm_preloc
Fixes adding "u-boot,dm-pre-reloc" to all required power-management
nodes on t600x.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-02-07 01:02:21 +09:00
Hector Martin
0d35eb3da7 m1n1.proxyutils: Wrap ADT base to 64 bits
This works around a wraparound issue when the virt base ends up causing
the ADT address to go negative, when on 12.1+ using a dummy virt base.

Fixes: #155
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-06 20:49:54 +09:00
Hector Martin
7697e992b0 fb: Fix init message pointer
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-06 15:41:30 +09:00
Hector Martin
e1a7deb2d5 i2c: Increase low-level timeouts to 50ms.
Hopefully this will cover all corner cases of the Ace2s being slow.

Issue: #101
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-06 15:36:22 +09:00
Sven Peter
cad8df30ce nvme: delete IO SQ/CQ when shutting down
This should not be required but it looks like the 12.1 ANS2 firmware
complains when NVME_CC.EN is cleared before the IO queues have been
deleted.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-02-02 22:57:54 +09:00
Sven Peter
768be5bd58 sart: fix sart3_set_entry
writel_relaxed(val, addr) inside Linux but write32(addr, val) inside
m1n1 confused my muscle memory.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-02-02 22:57:54 +09:00
Sven Peter
2ee920d229 sart: fix for 12.1
Looks like Apple decided to change the compatible to sart,coastguard and rely
on the sart-version ADT property to differentiate between M1 and M1 Pro/Max
instead. sart-version is already present in the 11.x ADT so let's just
always decide based on that.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-02-02 22:57:54 +09:00
Hector Martin
fbc15bd77c payload: Consider an IMG4 blob as the end of payloads
When loading m1n1.bin, SEPFW follows m1n1 and thus will show up at
the payload offset if there are no payloads.

Fixes: #158
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-01 15:52:08 +09:00
Mikhail Gusarov
88874936c6 proxyclient: utils.py: add ehexdump()
ehexdump is similar to chexdump, and uses CP437 control characters
and Braille to improve eyeballability of character output.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2022-01-26 15:39:23 +09:00
Sven Peter
ccf4b20a1d proxy: add nvme_{read,flush}
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Sven Peter
5f17b4743e nvme: bring up controller and implement nvme_read
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Sven Peter
54ff538df9 asc: use timeout_*
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Sven Peter
2bbf994089 utils: add timeout_{calculate,expired}
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Sven Peter
21fec139bf utils: add write64_lo_hi
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Sven Peter
bbea5167d5 rtkit: fix RTKIT_SYSLOG
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Sven Peter
f44d5db4fa proxyclient/asc: s/Mgmt_StartSyslog/Mgmt_SetAPPower/
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Mark Kettenis
30d6c6374d kboot: Add u-boot,dm-pre-reloc properties
These properties are needed such that U-Boot can enable the
serial port in its early pre-relocation phase.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2022-01-26 15:37:47 +09:00
Sven Peter
2bd7bf4020 afk: use version 3 for epic_sub_hdr
This drops the tx/rxcookie and accepts TYPE_NOTIFY in addition to
TYPE_REPLY for command replies to make the DCP code also work on 11.x.

It'll still complain about an unexpected message during init but work.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-19 03:24:20 +09:00
Sven Peter
6816c151bb proxyclient/epic: Add support for SubHeader.version = 3
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-19 03:24:20 +09:00
Hector Martin
f20a0fbcd5 rtkit: Do not ack prealloc'd buffers
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:23:42 +09:00
Hector Martin
e2b87b695f tools/smccli.py: Shut down cleanly, increase verbosity
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:22:33 +09:00
Hector Martin
434a3b6c78 hv/trace_smc.py: Support RW ops
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:22:16 +09:00
Hector Martin
07c695926d hv/trace_dcp.py: Fix typo
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:21:55 +09:00
Hector Martin
ce2f705b16 m1n1.trace.asc: Handle prealloc'd syslog buffers
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:21:30 +09:00
Hector Martin
293d78fd7f m1n1.hw.asc: Add verbose flag
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:21:15 +09:00
Hector Martin
a79200ef1e m1n1.fw.smc: Many improvements
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:21:04 +09:00
Hector Martin
c7d42837e4 m1n1.fw.asc.mgmt: Fix the IOP/AP power state stuff
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:19:48 +09:00
Hector Martin
db0eaa86ca experiments/dcp_iboot.py: Clean up after shell
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:19:08 +09:00
Hector Martin
9cdf2b5d06 experiments/dcp_iboot.py: Do not dump DART
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:18:55 +09:00
Hector Martin
e468e08603 m1n1.fw.asc.{crashlog,syslog}: Do not ack prealloced bufs
This is wrong and causes IOP crashes due to unacked crashlog msgs.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:18:18 +09:00
Hector Martin
bacb19b301 m1n1.fw.asc: Make DVA_OFFSET dynamic
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:16:12 +09:00
Sven Peter
2c28e13d25 rtkit: add rtkit_{hibernate,sleep} and use them for DCP and ANS2
s/IDLE/HIBERNATE/ to keep in sync with the Linux driver and then
hibernate DCP but send ANS2 to sleep to allow reusing both.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-18 11:35:45 +09:00
Sven Peter
00404e9bc3 afk: propagate failures in afk_epic_rx correctly
If the co-processor crashes afk_epic_poll will always fail which results
in afk_epic_rx getting stuck in an infinite loop calling afk_epic_poll
again and again.
This happens with e.g. old/incompatible DCP firmware.
Make sure the m1n1 proxy still works in those cases by propagating the
error correctly.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-18 11:33:57 +09:00
Janne Grunau
b2cb605832 display: Retry dcp_ib_get_hpd() for up to 2 seconds
After boot DCP will need some time to detect connected displays.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-01-17 23:12:49 +09:00
Vincent Duvert
6736368275 rtkit.c: Add config.h include
Needed for the RTKIT_SYSLOG optional define.

Signed-off-by: Vincent Duvert <vincent@duvert.net>
2022-01-17 23:11:27 +09:00
Hector Martin
b9a7827900 main: Drop copyright year from copyright statement
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 14:41:44 +09:00