Commit graph

581 commits

Author SHA1 Message Date
Asahi Lina
cf8be42aa9 hv: Fix bug when unmapping IO ranges
Sometimes ranges were not properly unmapped if they did not overlap the
currently defined range maps.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-04-16 19:06:22 +09:00
Asahi Lina
302a9ec4c0 m1n1.hv: Add BYPASS trace mode
Forces SW mapping but does not do any hooking. This can be useful for
testing the emulation or to work around issues with HW/SW map
differences.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-04-16 19:06:22 +09:00
Hector Martin
9af9e834bf chainload.py: Pad image to terminate payloads
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-27 18:34:53 +09:00
Janne Grunau
df53f16f76 m1n1.hv: Copy /chosen/memory-map/preoslog if it exists
preoslog was added in macos 12.3 and seems to contain iBootStage1 log
output. Since macos 12.3 accesses it it has to be copied to after the
guest image.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-20 03:04:13 +09:00
Hector Martin
94d640aa20 tools/run_guest.py: Support restricting CPU list available to guest
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-14 21:08:23 +09:00
Hector Martin
be1421d2ad m1n1.hw.spi: Update register definitions
This had been sitting in my worktree...

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-11 22:14:46 +09:00
Hector Martin
822b3c3cca m1n1.trace.spi: Remove UNBUF mode
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-11 22:13:27 +09:00
Janne Grunau
c2a48da4c1 m1n1.hv: Add trace script keyboard/trackpad
Input devices use HID over SPI. HID communication is obscured by "sio"
DMA.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:06:01 +09:00
Janne Grunau
387fab6132 m1n1.utils: Add CRC-16 (polygon 0xA001)
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:06:01 +09:00
Janne Grunau
025fa41e90 m1n1.trace: Add SPI tracer
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:06:01 +09:00
Janne Grunau
45824d2676 m1n1: move SPI register to m1n1.hw
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:06:01 +09:00
Janne Grunau
e90be797a8 m1n1.trace.gpio: Update register description based on the Linux driver
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:06:01 +09:00
Janne Grunau
9c80a69266 m1n1.hv: Use dynamic pin maps in trace_gpio.py
Hardcoded pin maps do not make sense with additional HW support.
Allows tracing of a single pin in another tracing module, for example
for tracing the SPI cs pin.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:06:01 +09:00
Janne Grunau
5e8beca9fe experiments/dcp.py: Upload fb in 512k chunks for slow (v)UARTs
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:05:21 +09:00
Janne Grunau
f297decfb4 experiments/dcp.py: Use display size for frame buffers
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:05:21 +09:00
Janne Grunau
6a8016a8e3 experiments/dcp.py: set DVA offset from ADT
This does not appear to be necessary. It worked on t8103 before and I
see no different behavior on t6001.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:05:21 +09:00
Janne Grunau
66f4d625b8 experiments/dcp.py: Use t8103/t600x specific code paths
MMIO space differes between t8103 and t600x so the hardcoded RegMonitor
addresses make only sens on the former.
set_display_device difference is taken from macOS trace on t6001.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:05:21 +09:00
Janne Grunau
d1d93eb2b5 m1n1.fw.dcp: Add callbacks used by t600x-dcp
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:05:21 +09:00
Janne Grunau
7028f3e2d8 m1n1.fw.dcp: Zero dcpep's shared memeory
Fixes a crash of DCP with experiments/dcp.py after chainloading m1n1 on
j314c.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:05:21 +09:00
Hector Martin
99124a41fe tools/chainload.py: Support chainloading raw binaries
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-10 00:30:15 +09:00
Hector Martin
123d1df1a7 kboot: Replace kboot_set_bootargs with kboot_set_chosen
This allows setting arbitrary /chosen string props

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-09 20:55:34 +09:00
Hector Martin
adb1cb943e proxy: Export smp_set_wfe_mode
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-08 00:02:06 +09:00
Janne Grunau
d76f3a6631 m1n1.hw.DART: coalesce continuos l2 ptes
Signed-off-by: Janne Grunau <j@jannau.net>
2022-02-24 23:55:46 +09:00
Janne Grunau
e1c5df5037 experiments/dart_dump.py: Use DART.from_adt()
The label of the ADT node is easier to use. Uses the proper DART type on
t600x SoCs.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-02-24 23:55:46 +09:00
Janne Grunau
a57696366f hv/trace_dcp.py: Update to macOS 12.x API
DCP API seems to be mostly unchanged from 12 beta to 12.2.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-02-24 23:55:46 +09:00
Janne Grunau
fb49d88d90 m1n1.fw.dcp.ipc: annotate swap_complete_intent_gated
Signed-off-by: Janne Grunau <j@jannau.net>
2022-02-24 23:55:46 +09:00
Sven Peter
53af416b07 hv.py: Add helper to break on symbols
We already have breakpoints and symbols, let's make our life easier
by also allowing to break on symbols.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-02-24 23:55:25 +09:00
Hector Martin
08b77c2b1b m1n1.adt: Handle underscores in properties as __
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-21 15:31:31 +09:00
Hector Martin
5bf8c5ac83 m1n1.hv: Use p.mcc_hv_unmap_carveouts()
Fixes random SErrors due to the guest issuing speculative instruction
fetches into TZ regions.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-21 15:30:25 +09:00
Hector Martin
50a9593034 mcc: Add mcc_hv_unmap_carveouts() and proxy op
This is necessary to stop the guest from speculating into carveouts.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-21 15:30:21 +09:00
Hector Martin
a8a93a3b5f hv/trace_smc.py: Add GetKeyByIndex decoding
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-15 14:05:13 +09:00
Hector Martin
ec126bb16a experiments/smc.py: Turn into SMC key dumper
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-15 14:05:13 +09:00
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
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
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
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
f44d5db4fa proxyclient/asc: s/Mgmt_StartSyslog/Mgmt_SetAPPower/
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +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
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