Commit graph

1872 commits

Author SHA1 Message Date
Hector Martin
07c7cc09f3 hv_vm: Dynamically allocate top-level page tables
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-17 21:46:55 +09:00
Hector Martin
0d4fb00ceb Makefile: Add a m1n1.bin target that builds a raw binary
This is to be used for the non-macho boot support in 12.1+ kmutil.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-17 21:46:55 +09:00
Hector Martin
bedcc905a3 gxf, smp: Allocate stacks dynamically
This significantly shrinks our .bss section

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-17 21:46:55 +09:00
Hector Martin
e8b30c9325 experiments/spi.py: New experiment to test SPI peripheral
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-09 01:22:38 +09:00
Hector Martin
a05f68d1c8 m1n1.gpiola: New module
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-09 01:22:37 +09:00
Janne Grunau
5e202ab2fe m1n1.trace.dart: initialize DART with correct pte type
Signed-off-by: Janne Grunau <j@jannau.net>
2021-12-08 09:06:07 +09:00
Janne Grunau
d23e09c2f0 m1n1.hw.dart: update pte BIT(1) annotation
BIT(1) of a page table entry is "disable sub-page protection".

Signed-off-by: Janne Grunau <j@jannau.net>
2021-12-08 09:06:07 +09:00
Hector Martin
486ff9ecee aic: t6000: Initialize external IRQ routing
This is used for coprocessors. Do it here so Linux doesn't have to deal
with it.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-08 01:14:44 +09:00
Hector Martin
abee2ecebc pcie: Set link speed capabilities from ADT
This sets both the target and the max link speed of the root ports
to the maximum specified in the ADT.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-07 14:03:26 +09:00
Hector Martin
c9dc4401c0 pcie: Enable port speed controls
This makes PCIe train at >Gen1 by default

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-02 13:55:25 +09:00
Hector Martin
26b55d4b26 pcie: Wait for port PHY to be idle after init before configuring
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-02 13:42:19 +09:00
Hector Martin
9949689a74 pcie: Document APCIE_PHYIF_CTRL
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-02 13:41:56 +09:00
Hector Martin
32515c936f m1n1.proxy: Fix typos in fb_blit/unblit
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-27 01:24:36 +09:00
Martin Povišer
c835b1d2fe experiments/speaker_amp.py: Insert proper header
Add SPDX header, make directly executable.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 17:49:39 +09:00
Martin Povišer
4f7d03addf m1n1.hw.*: Fill in SPDX license headers
Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 17:49:39 +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
Martin Povišer
5e5b83e7a2 m1n1.hw.nco: Add NCO driver
Apple SoCs have an NCO block used for generating audio master clocks.

The block performs fractional division of a higher-rate input clock and
contains a counter which is partially implemented as a LFSR. Credit
goes to Hector for reversing the divisor register semantics.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 17:49:39 +09:00
Martin Povišer
549dcf8b3a m1n1.hw.admac: Add debug print of estimated rate
Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 17:49:39 +09:00
Martin Povišer
99a0741c87 speaker_amp.py: Clean up
Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 17:49:39 +09:00
Martin Povišer
53be0ec40d speaker_amp.py: Note down TAS2770 as best match
Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 17:49:39 +09:00
Martin Povišer
8833696c69 m1n1.hw.admac: Fix descriptor deserialization
Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 17:49:39 +09:00
Martin Povišer
301ba75b6b m1n1.utils: Remove dead formatting
Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 17:49:39 +09:00
Martin Povišer
145b1101c9 m1n1.utils: Add Register32.fields property
Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 17:49:39 +09:00
Martin Povišer
d65526d326 m1n1.hw.admac: Clear underflow counters on reset
Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 17:49:39 +09:00
Martin Povišer
570107629a m1n1.hw.admac: Fix and extend register defs
Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 17:49:39 +09:00
Martin Povišer
2cebfaab73 m1n1.hw.i2c: Reset status before transaction
Reset the status register before each transaction. This is necessary if
we are taking over the peripheral after the Linux driver (e.g. in paused
hypervisor).

Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 17:49:39 +09:00
Martin Povišer
a40840f13c proxy: Expose usb_iodev_vuart_setup
Expose the usb_iodev_vuart_setup function in uartproxy. This opens
the secondary ACM pipe to new uses outside the hypervisor. E.g. it can
be set up as another stream for sending proxy requests.

Sample usage from proxyclient:

    p.usb_iodev_vuart_setup(p.iodev_whoami())
    p.iodev_set_usage(IODEV.USB_VUART, USAGE.UARTPROXY)
    # the second virtual serial now also serves proxy

Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 15:31:21 +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
95ef45fd11 usb: Squelch DART error for missing USB devices
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-24 17:17:54 +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
Hector Martin
de6979fc7b Revert "usb: Add usb_idx_from_address() to find a dev by its MMIO addr"
This is no longer needed, so put things back the way they were.

This reverts commit e689ceb263.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-23 23:36:14 +09:00
Hector Martin
be7ff3a062 kboot: Generalize device disable logic, disable i2c & usb devs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-23 23:36:14 +09:00
Hector Martin
0e3ee31254 m1n1.fw.asc.kdebug: Handle prealloc messages (partially)
Not sure if these need a reply...

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-23 17:27:37 +09:00
Hector Martin
99acc2675b m1n1.fw.asc: Add support for shutting down RTKit links
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-23 17:20:09 +09:00
Hector Martin
0446838460 m1n1.fw.asc.crash: Add a basic crashlog parser
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-23 17:19:38 +09:00
Hector Martin
10dda2550d m1n1.hv: Automatically lower BRKs
This makes Linux BUG()s work out of the box without breaking into the
HV.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-23 14:05:26 +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
Jean-Marc Ranger
d4f750cb22 experiments/smc.py: Adapt to API change in SMCEndpoint
Update experiments/smc.py to use fw/smc.py's new API.

Fixes: b9ddd74c02 ("hv/trace_smc.py: Add SMC tracer")

Signed-off-by: Jean-Marc Ranger <jmranger@hotmail.com>
2021-11-23 01:22:57 +09:00
Hector Martin
6906af06cc experiments/dcp.py: Use new ADT DART constructor
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 18:13:51 +09:00
Hector Martin
8778819831 m1n1.hw.dart: Fix typo
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 18:13:32 +09:00
Hector Martin
c8a8946e82 m1n1.hw.dart: Add a constructor that figures out DART type from the ADT
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 18:13:10 +09:00
Hector Martin
01e84ecef6 pcie: Document reg ranges better
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 16:43:22 +09:00
Hector Martin
555965e98a pcie: Calculate the number of reg entries per port
Turns out this isn't hardware-specific, but rather a change Apple made
retroactively in 12.0 RC. Doesn't look like there's a saner way than
this...

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 16:24:37 +09:00
Hector Martin
4027c34c7a proxy: Add proxy ops for pcie_init/shutdown
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 16:04:35 +09:00
Hector Martin
660d7482b9 hv/trace_pmgr.py: New script
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 07:21:07 +09:00
Hector Martin
23c3617cf2 payload: Complain loudly about devicetree platform mismatches.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-20 02:26:24 +09:00
Hector Martin
f4e11a78c6 i2c: Add explicit delay to the i2c_xfer_read timeout loop
We now set the timeout at 10ms without any bytes received.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-18 22:29:51 +09:00
Hector Martin
850a669436 tps6598x: Add a delay in the command poll loop
It seems that if we poll too fast, we DoS the poor thing...

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-18 22:15:38 +09:00
Hector Martin
cc1fa67ff2 i2c: Use Repeat-Start condition for SMBus reads
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-18 22:15:13 +09:00
Hector Martin
26f636dbbb fb: Use 128-bitwise copies to speed up FB updates
This makes it almost as fast as it was before the switch to an
uncached framebuffer, as far as I can tell.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-17 19:23:44 +09:00