When booting via SBI, the hartid is available in a1. When booting via
EFI, the hartid is present in the FDT as /chosen/boot-hartid. There is
no other way to retrieve this information, as mhartid is an M-mode CSR
and no S-mode equivalent exists (nor is there an SBI call to get it).
Currently we extract boot-hartid from the FDT in the kernel. This works
if the FDT provided to the kernel is the one from EFI, but if a custom
FDT is loaded then it will no longer have /chosen/boot-hartid, causing
the kernel to be unable to get the hartid and thus panic. Instead, pass
it in metadata from loader (and put the SBI-provided value in the fake
metadata for SBI booting) as it always has access to the EFI-provided
FDT.