@ -25,11 +25,11 @@
.globl _x86boot_start
_x86boot_start :
/ *
* This i s t h e f a i l s a f e 3 2 - b i t b o o t s t r a p e n t r y p o i n t . T h e
* following c o d e i s n o t e x e c u t e d f r o m a c o l d - r e s e t ( a c t u a l l y , a
* lot o f i t i s , b u t f r o m r e a l - m o d e a f t e r c o l d r e s e t . I t i s
* repeated h e r e t o p u t t h e b o a r d i n t o a s t a t e a s c l o s e t o c o l d
* reset a s n e c e s s a r y )
* This i s t h e f a i l - s a f e 3 2 - b i t b o o t s t r a p e n t r y p o i n t .
*
* This c o d e i s u s e d w h e n b o o t i n g f r o m a n o t h e r b o o t l o a d e r l i k e
* coreboot o r E F I . S o w e r e p e a t s o m e o f t h e s a m e i n i t f o u n d i n
* start1 6 .
* /
cli
cld
@ -45,15 +45,15 @@ _x86boot_start:
jmp 1 f
_start :
/ *
* This i s t h e 3 2 - b i t c o l d - r e s e t e n t r y p o i n t . I n i t i a l i z e % b x t o 0
* in c a s e w e ' r e p r e c e e d e d b y s o m e s o r t o f b o o t s t u b .
* This i s t h e 3 2 - b i t c o l d - r e s e t e n t r y p o i n t , c o m i n g f r o m s t a r t 1 6 .
* Set % b x t o 0 t o i n d i c a t e t h i s .
* /
movw $ G D _ F L G _ C O L D _ B O O T , % b x
1 :
/* Save BIST */
movl % e a x , % e b p
/* Load the segement registes to match the gdt loaded in start16.S */
/* Load the segement registers to match the GDT loaded in start16.S */
movl $ ( X 8 6 _ G D T _ E N T R Y _ 3 2 B I T _ D S * X 8 6 _ G D T _ E N T R Y _ S I Z E ) , % e a x
movw % a x , % f s
movw % a x , % d s
@ -64,7 +64,11 @@ _start:
/* Clear the interrupt vectors */
lidt b l a n k _ i d t _ p t r
/* Early platform init (setup gpio, etc ) */
/ *
* Critical e a r l y p l a t f o r m i n i t - g e n e r a l l y n o t u s e d , w e p r e f e r i n i t
* to h a p p e n l a t e r w h e n w e h a v e a c o n s o l e , i n c a s e s o m e t h i n g g o e s
* wrong.
* /
jmp e a r l y _ b o a r d _ i n i t
.globl early_board_init_ret
early_board_init_ret :
@ -79,7 +83,7 @@ car_init_ret:
* We n o w h a v e C O N F I G _ S Y S _ C A R _ S I Z E b y t e s o f C a c h e - A s - R A M ( o r S R A M ,
* or f u l l y i n i t i a l i s e d S D R A M - w e r e a l l y d o n ' t c a r e w h i c h )
* starting a t C O N F I G _ S Y S _ C A R _ A D D R t o b e u s e d a s a t e m p o r a r y s t a c k
* and e a r l y m a l l o c a r e a . T h e M R C r e q u i r e s s o m e s p a c e a t t h e t o p .
* and e a r l y m a l l o c ( ) a r e a . T h e M R C r e q u i r e s s o m e s p a c e a t t h e t o p .
*
* Stack g r o w s d o w n f r o m t o p o f C A R . W e h a v e :
*
@ -97,7 +101,7 @@ car_init_ret:
# endif
# else
/ *
* When w e g e t h e r e a f t e r c a r _ i n i t , e s p p o i n t s t o a t e m p o r a r y s t a c k
* When w e g e t h e r e a f t e r c a r _ i n i t ( ) , e s p p o i n t s t o a t e m p o r a r y s t a c k
* and e s i h o l d s t h e H O B l i s t a d d r e s s r e t u r n e d b y t h e F S P .
* /
# endif
@ -137,17 +141,18 @@ skip_hob:
movl % e s p , % e c x
# if d e f i n e d ( C O N F I G _ S Y S _ M A L L O C _ F _ L E N )
/* Set up the pre-relocation malloc pool */
subl $ C O N F I G _ S Y S _ M A L L O C _ F _ L E N , % e s p
movl % e a x , % e d x
addl $ G D _ M A L L O C _ B A S E , % e d x
movl % e s p , ( % e d x )
# endif
/* Store BIST */
/* Store BIST into global_data */
movl % e a x , % e d x
addl $ G D _ B I S T , % e d x
movl % e b p , ( % e d x )
/* Set second parameter to setup_gdt */
/* Set second parameter to setup_gdt() */
movl % e c x , % e d x
/* Setup global descriptor table so gd->xyz works */
@ -157,7 +162,7 @@ skip_hob:
post_ c o d e ( P O S T _ S T A R T _ D O N E )
xorl % e a x , % e a x
/* Enter, U-b oot! */
/* Enter, U-B oot! */
call b o a r d _ i n i t _ f
/* indicate (lack of) progress */
@ -184,13 +189,13 @@ board_init_f_r_trampoline:
/* Align global data to 16-byte boundary */
andl $ 0 x f f f f f f f0 , % e s p
/* Setup first parameter to memcpy ( and setup_gdt) */
/* Setup first parameter to memcpy() and setup_gdt( ) */
movl % e s p , % e a x
/* Setup second parameter to memcpy */
/* Setup second parameter to memcpy() */
fs m o v l 0 , % e d x
/* Set third parameter to memcpy */
/* Set third parameter to memcpy() */
movl $ G E N E R A T E D _ G B L _ D A T A _ S I Z E , % e c x
/* Copy global data from CAR to SDRAM stack */
@ -202,7 +207,7 @@ board_init_f_r_trampoline:
/* Align global descriptor table to 16-byte boundary */
andl $ 0 x f f f f f f f0 , % e s p
/* Set second parameter to setup_gdt */
/* Set second parameter to setup_gdt() */
movl % e s p , % e d x
/* Setup global descriptor table so gd->xyz works */
@ -216,7 +221,7 @@ board_init_f_r_trampoline:
call c a r _ u n i n i t
1 :
/* Re-enter U-Boot by calling board_init_f_r */
/* Re-enter U-Boot by calling board_init_f_r() */
call b o a r d _ i n i t _ f _ r
die :
@ -230,9 +235,10 @@ blank_idt_ptr:
.p2align 2 /* force 4-byte alignment */
/* Add a multiboot header so U-Boot can be loaded by GRUB2 */
multiboot_header :
/* magic */
.long 0x1BADB 002
.long 0x1badb 002
/* flags */
.long ( 1 < < 1 6 )
/* checksum */