"nvram" size depends on the iboot version. Monterey (12.3) and earlier
used 128k nvram partition but Ventura since at least 13.2 increased the
size to 1M. Parse the values from the ADT and fill and enable the node
in the device tree.
Signed-off-by: Janne Grunau <j@jannau.net>
There is at least on Macbook Pro (M1, 13-inch) with missing
"multi-touch-calibration" in the ADT. Disabling the device as error
handling instead of refusing to boot the kernel.
Signed-off-by: Janne Grunau <j@jannau.net>
Following the general "do more in stage2/kboot, do less in stage1/proxy"
rule. In case something goes wrong here we want to be able to fix it in
stage2.
Thanks to the stupid bug, the past year+ of stage1 installs has had this
codepath disabled, so that works well with this change.
Signed-off-by: Hector Martin <marcan@marcan.st>
Redo the checks to make sure we never cause rptr==wptr, because that
signifies an empty buffer, not a full one.
Signed-off-by: Martin Povišer <povik@cutebit.org>
Both 'DT:' and 'FDT:' are in use as prefices in prints that relate to
the non-Apple devicetree. Put in 'FDT:' everywhere for consistence.
Signed-off-by: Martin Povišer <povik@cutebit.org>
Postpone the setting of the /memory node so that any allocations made
in course of the devicetree prep (e.g. the SIO reservations allocated
from the top of memory) are reflected in the usable memory span that's
set on the /memory node.
Signed-off-by: Martin Povišer <povik@cutebit.org>
On kboot, parse the ADT for SIO firmware parameters, set up the expected
data structures for SIO consumption in reserved memory, and pass those
in properties of the SIO FDT node.
Signed-off-by: Martin Povišer <povik@cutebit.org>
Make dt_device_set_reserved_mem take in an explicit iova instead of
reading it off from a DART. Add a separate 'from_dart' variety of the
function for getting the iova from DART.
Signed-off-by: Martin Povišer <povik@cutebit.org>
The new function parses ADT's segment-ranges and builds up nodes in
/reserved-memory representing the appropriate physical and device
address spans. This is to describe the memory placement of ASC firmware.
Signed-off-by: Martin Povišer <povik@cutebit.org>
This doesn't make any sense... M2 Ultra should be 2x M2 Max, so there's
no reason for this constant to be different.
I get the feeling Apple messed this one up too...
Also clean up some other constants.
Signed-off-by: Asahi Lina <lina@asahilina.net>
At least some of this fixes hangs when overheating on j413. We still
don't know exactly what most of this is, but let's try to get closet to
the init that macOS does.
Signed-off-by: Hector Martin <marcan@marcan.st>