Commit graph

62 commits

Author SHA1 Message Date
Hector Martin
a0d2ed20be payload: Do cpufreq init before smp_start_secondaries()
This also requires exporting this to the proxy so linux.py can use it.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-06-04 15:56:42 +09:00
Janne Grunau
7a84b2bbf9 tools/run_guest_kernel.sh: Support concatenated initramfs images
This allows booting a kernel with the firmware cpio and a cpio
containing matching modules. The modules initramfs can be prepared from
the kernel source directory with:

`make dir-pkg && usr/gen_initramfs.sh -o initramfs_mod.cpio -u squash -g squash ./tar-install/lib/`

The modules are available in /modules/$(uname -r) and the initramfs can
handle modules in the same way as the vendor firmware to make them
available for itself and the main OS.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-04-27 04:09:49 +09:00
Hector Martin
a81314fe77 run_guest: Implement going to sleep
Getting back from sleep is left as an exercise to the reverse
engineer...

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 03:21:58 +09:00
Hector Martin
3bc3b0131f tools/pmgr_adt2dt.py: Add multidie support
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-09 23:50:42 +09:00
Asahi Lina
8bf08b0ff1 linux.py: Implement TSO
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-03-28 19:06:20 +09:00
Asahi Lina
3d28ac4d6f tools/chainload.py: Properly sleep DCP when chainloading macOS
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-01-20 18:18:13 +09:00
Martin Povišer
2cb6cb46ca tools/run_guest.py: Add -v option for attaching 9P virtio exports
Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-01-13 17:25:25 +09:00
Asahi Lina
fbc04995ab tools/chainload.py: Fix chainloading of xnu
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:17:10 +09:00
Martin Povišer
ce517b10a3 tools/admac_stream.py: Add tool for engaging ADMAC
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-11-04 12:36:49 +09:00
Asahi Lina
3e36d18241 tools/run_guest_kernel.sh: Support --
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-10-17 22:14:21 +09:00
Hector Martin
5e26ae26f8 tools/run_guest_kernel.sh: Allow overriding $TMPDIR
Also use $XDG_RUNTIME_DIR by default if set

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-09-12 17:46:31 +09:00
Javier Alvarez
8a544a8b27
m1n1 entrypoint args for raw binary images (#240)
* tools/run_guest.py: Allow specifying entrypoint for raw images

This allows running images other than m1n1 that don't have the
entrypoint at 0x800. If unspecified, it defaults to 0x800 for m1n1.

Signed-off-by: Javier Alvarez <javier.alvarez@allthingsembedded.net>
2022-08-30 22:39:20 +09:00
Javier Alvarez
6836e8a72f tools/chainload.py: Allow specifying entrypoint for raw images
This allows running images other than m1n1 that don't have the
entrypoint at 0x800. If unspecified, it defaults to 0x800 for m1n1.

Signed-off-by: Javier Alvarez <javier.alvarez@allthingsembedded.net>
2022-08-30 22:38:38 +09:00
Martin Povišer
ff46ca4118 tools/run_guest.py: Add --append-payload
Add command-line option for appending a separate file (or files) to
the payload.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-08-30 22:29:41 +09:00
Martin Povišer
3c012da1ee tools/codecshell.py: Enforce reset (unless given --no-reset)
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-08-30 22:29:41 +09:00
Hector Martin
846b1a4d6a tools/run_guest_kernel.sh: Fix usage without initramfs
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-08-30 21:42:16 +09:00
Hector Martin
90b8a47462 tools/run_guest.py: Start HV with ^D
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-08-30 21:42:00 +09:00
Hector Martin
5456642834 tools/run_guest_kernel.sh: Support specifying kernel
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-08-29 17:14:33 +09:00
Asahi Lina
690ff9bde8 tools/run_guest_kernel.sh: Allow passing HV args
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-08-18 02:05:49 +09:00
Hector Martin
f09c10b5fa tools/run_guest_kernel.sh: Fix initramfs support
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-07-30 15:59:21 +09:00
Hector Martin
12bff05700 tools/run_guest_kernel.sh: New utility script
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-07-30 15:12:55 +09:00
Hector Martin
659093b8bb scripts/picocom-sec.sh: Add convenience script
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-07-30 15:12:55 +09:00
amarioguy
0cf1f393ed Add raw binary support to HV scripts
Signed-off-by: amarioguy <arminders208@outlook.com>
2022-07-30 14:18:39 +09:00
Hector Martin
6075388d31 tools/dump_pmgr.py: Do not dump pwrgate regs
These are gone in newer ADTs

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-07-11 19:02:21 +09:00
Martin Povišer
56d8de66db m1n1.hw.codecs.cs42l84: File the ohmmeter codec regmap
Move the regmap from experiments/ to a handier place. Also add the
codec to trace_codecs.py and codecshell.py.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-06-21 17:20:30 +09:00
Martin Povišer
0da13afda8 tools/codecshell.py: Add codec-poking shell
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-06-21 17:20:30 +09:00
Janne Grunau
b6e9333cd6 m1n1.hw.pmu: Add SPMI PMU support for resetting the panic counter
Replace the handrolled implementation in experiments/agx_1tri.py and
tools/reset_panic_counter.py.
In addition reset the panic counter in reboot.py and run_guest.py. If
can reboot or start guests the boot process works fine and macOS
recovery needs to leave us alone.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-06-05 20:58:15 +09:00
Martin Povišer
d924c97a0c tools/second_proxy.py: Add setup of second proxy stream
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:26:31 +09:00
Janne Grunau
12db5c3910 tools/reset_panic_counter.py: Use ADT to support t600x
In addition make it executable and add python shebang as for the other
tools.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-05-30 22:56:43 +09:00
Janne Grunau
8a90ced4b4 tools/reset_panic_counter.py: minor fixes
- add SPDX-License-Identifier
 - make it executable
 - add python shebang
 - remove unused import

Signed-off-by: Janne Grunau <j@jannau.net>
2022-05-30 22:56:43 +09:00
Asahi Lina
f5ba42e3bb tools/reset_panic_counter.py: New tool
Also adds m1n1.hw.spmi

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Kyle Evans
0ba2027e5e proxyclient: tools: add a FreeBSD loader
The differences are documented in the script itself, but the main odd
bit is that we pass the provided kernel as an initramfs.  Our modified
loader will probe for the initramfs start/end props in FDT and put up
a memdisk that we load the kernel from.  This choice was made for two
reasons:

1.) Avoid ad-hoc interpretations of a memory region in m1n1, it doesn't
    care if we actually passed it an initramfs or not anyways.

2.) We already had some code on hand to do this in our loader, so I
    suspect we've done similar shenanigans elsewhere anyways.

This also requires a U-Boot change to allow bootefi of an arbitrary
location, as long the size is provided.

The alignment constraints for loader/kernel were kept arbitrarily.  The
kernel will be bounced anyways by loader. I don't recall what
alignment requirements UEFI payloads have, but 2M seems reasonable.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
2022-04-16 19:22:55 +09:00
Kyle Evans
3b68165900 proxyclient: tools: fix linux U-Boot support
-t is optional, we may not have a tty_dev, so we can avoid trying to
grab the baudrate from it if it's unspecified.

We don't want to use dtb_addr for booti; this is the unmodified payload.
m1n1 will load it and add bits to it at a separate address for passing
on to U-Boot.  For booti purposes, we actually want the augmented FDT
rather than the user-specified.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
2022-04-16 19:18:06 +09:00
Davide Cavalca
eeebd9dad3 Make scripts executable
Signed-off-by: Davide Cavalca <davide@cavalca.name>
2022-04-16 19:17:33 +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
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
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
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
1fd1a467e1 chainload.py: Do not set secondary RVBARs if --no-sepfw
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-21 12:08:32 +09:00
Hector Martin
f2eac15ca7 tools/chainload.py: Default to copying SEPFW
This doesn't really take any significant time and is the correct thing
to do. Use --no-sepfw for e.g. serial bring-up where doing the ADT dance
costs measurable time.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-17 22:30:42 +09:00
Martin Povišer
f71397abb7 tools/dump_pmgr.py: Show calculated NCO rate
Show the calculated rate for NCO channels' output based on the present
register values.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 17:49:39 +09:00
Hector Martin
98d6e9bb4f tools/chainload.py: Fix 8b/16b copy confusion
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-26 13:58:39 +09:00
Hector Martin
b86574e410 tools/pmgr_adt2dt.py: New script to convert ADT PMGR devs to DT nodes
This still requires manual editing to fix up some issues, since our idea
of always-on devices and parent-child relationships doesn't always match
Apple's.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-24 16:19:01 +09:00
Jean-Marc Ranger
45a62144ff Set missing execute bits in proxyclient/{experiments|tools}/*.py
Currently, only some scripts in proxyclient/experiments and
proxyclient/tools have their execute bit set. Set it for those
that miss it.

Signed-off-by: Jean-Marc Ranger <jmranger@hotmail.com>
2021-11-23 01:23:11 +09:00
Hector Martin
ccbe181d75 m1n1.adt: Improve PMGR props parsing, add to dump_pmgr.py
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-16 17:19:42 +09:00
Hector Martin
9d2be299a4 tools/smccli.py: Simple shell for an instantiated SMCClient
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-10 20:43:51 +09:00
Hector Martin
74dece703e m1n1.hv: Add support for dumping MMIO accesses in Python syntax to a log
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 04:03:50 +09:00
Hector Martin
9fab740a77 tools/chainload.py: Add --quiet arg to suppress FB
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 19:00:34 +09:00
Hector Martin
f590ef73d0 m1n1.adt: Add field to pmgr devices
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 19:00:34 +09:00