/ *
* ( C) C o p y r i g h t 2 0 0 2
* Daniel E n g s t r <EFBFBD> m , O m i c r o n C e t i A B < d a n i e l @omicron.se>.
*
* See f i l e C R E D I T S f o r l i s t o f p e o p l e w h o c o n t r i b u t e d t o t h i s
* project.
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or
* modify i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n ; either version 2 of
* the L i c e n s e , o r ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n .
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
*
* You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e
* along w i t h t h i s p r o g r a m ; if not, write to the Free Software
* Foundation, I n c . , 5 9 T e m p l e P l a c e , S u i t e 3 3 0 , B o s t o n ,
* MA 0 2 1 1 1 - 1 3 0 7 U S A
* /
/ *
* 1 6 bit i n i t i a l i z a t i o n c o d e .
* This c o d e h a v e t o m a p t h e a r e a o f t h e b o o t f l a s h
* that i s u s e d b y U - b o o t t o i t s f i n a l d e s t i n a t i o n .
* /
.text
.section .start16 , " ax"
.code16
.globl board_init16
board_init16 :
/* Alias MMCR to 0xdf000 */
movw $ 0 x f f f c , % d x
movl $ 0 x80 0 d f0 c b , % e a x
outl % e a x , % d x
/* Set ds to point to MMCR alias */
movw $ 0 x d f00 , % a x
movw % a x , % d s
/ * Map t h e e n t i r e f l a s h a t 0 x38 0 0 0 0 0 0
* ( with B O O T C S a n d P A R 1 4 , u s e 0 x a b f f f80 0 f o r R O M C S 1 ) * /
movl $ 0 x c0 , % e d i
movl $ 0 x8 b f f f80 0 , % e a x
movl % e a x , ( % d i )
/* Disable SDRAM write buffer */
movw $ 0 x40 ,% d i
xorw % a x ,% a x
movb % a l , ( % d i )
/* Disabe MMCR alias */
movw $ 0 x f f f c , % d x
movl $ 0 x00 0 0 0 0 c b , % e a x
outl % e a x , % d x
/* the return address is stored in bp */
jmp * % b p
.section .bios , " ax"
.code16
.globl realmode_reset
realmode_reset :
/* Alias MMCR to 0xdf000 */
movw $ 0 x f f f c , % d x
movl $ 0 x80 0 d f0 c b , % e a x
outl % e a x , % d x
/* Set ds to point to MMCR alias */
movw $ 0 x d f00 , % a x
movw % a x , % d s
/* issue software reset thorugh MMCR */
movl $ 0 x d72 , % e d i
movb $ 0 x01 , % a l
movb % a l , ( % d i )
1 : hlt
jmp 1