Allocating this in m1n1 means we can treat it as a reserved-memory node
and deal with knowing the size in m1n1, instead of the kernel. It also
means we can deal with the firmware version dependency mess here.
Signed-off-by: Hector Martin <marcan@marcan.st>
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>
Add a warning message when overriding the target serial device with
SECDEV variable, just in case one is caught by surprise there.
Signed-off-by: Alexis Deruelle <alexis.deruelle@gmail.com>
Under macOS host, secondary UART device name is different from the linux
device name. Check OS name and chose default device name accordingly.
Signed-off-by: Alexis Deruelle <alexis.deruelle@gmail.com>