bcm: try ATAGS/DTB pointer from R2 on entry

This commit is contained in:
cinap_lenrek 2021-04-25 17:36:11 +02:00
parent 6b4b8e405a
commit 9f54c28317
6 changed files with 13 additions and 3 deletions

View file

@ -76,6 +76,9 @@ TEXT _startpg(SB), 1, $-4
MOVW $1, R1
MCR CpSC, 0, R1, C(CpSPM), C(CpSPMperf), CpSPMctl
/* first arg to main is saved R2 */
MOVW R10, R0
/*
* call main and loop forever if it returns
*/

View file

@ -126,6 +126,9 @@ TEXT _startpg(SB), 1, $-4
MOVW $1, R1
MCR CpSC, 0, R1, C(CpCLD), C(CpCLDena), CpCLDenapmnc
/* first arg to main is saved R2 */
MOVW R10, R0
/*
* call main and loop forever if it returns
*/

View file

@ -265,7 +265,7 @@ bootargsinit(uintptr pa)
uintptr len;
/*
* kernel gets DTB/ATAGS pointer in R0 on entry
* kernel gets DTB/ATAGS pointer on entry
*/
if(pa != 0 && (len = cankaddr(pa)) != 0){
void *va = KADDR(pa);

View file

@ -10,6 +10,9 @@
* other cpus enter at cpureset in armv7.s
*/
TEXT _start(SB), 1, $-4
/* save R2 in extern register R10 (Mach *m) */
MOVW R2, R10
/*
* load physical base for SB addressing while mmu is off
* keep a handy zero in R0 until first function call

View file

@ -75,7 +75,7 @@ launchinit(void)
}
void
main(void)
main(uintptr arg0)
{
extern char edata[], end[];
uint fw, board;
@ -84,7 +84,7 @@ main(void)
memset(edata, 0, end - edata); /* clear bss */
mach0init();
quotefmtinstall();
bootargsinit(0);
bootargsinit(arg0);
confinit(); /* figures out amount of memory */
xinit();
uartconsinit();

View file

@ -84,6 +84,7 @@ dowfi:
BEQ dowfi /* if zero, wait again */
bootcpu:
MOVW $0, R2 /* no ATAGS/DTB pointer */
BIC $KSEGM, R8 /* entry to physical */
ORR $PHYSDRAM, R8
BL (R8)