repo_id
stringlengths
5
115
size
int64
590
5.01M
file_path
stringlengths
4
212
content
stringlengths
590
5.01M
4ms/metamodule-plugin-sdk
1,507
plugin-libc/newlib/libc/sys/a29khif/_ioctl.S
; @(#)_ioctl.s 1.2 90/10/14 21:57:25, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _ioctl.s ; _ioctl( int fd ); ; .file "_ioctl.s" .include "sys/sysmac.h" .text .word 0x00030000 ; Debugger tag word .global __ioctl __ioctl: const tav,HIF_ioctl @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,982
plugin-libc/newlib/libc/sys/a29khif/alloc.S
; ;(#)_alloc.s 1.4 90/10/14 21:57:19, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1989, 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; 07/06/89 (JS) Replaced call to const tav,HIF_macro ; and deleted call to reterr macro as a NULL needs to be ; returned on failure. ; _alloc.s ; void *vp = _sysalloc( int size ); ; .file "_alloc.s" .include "sys/sysmac.h" .text .word 0x00030000 ; Debugger tag word .global __sysalloc __sysalloc: const tav,HIF_alloc asneq V_SYSCALL,gr1,gr1 jmpti tav, lr0 const tpc, _errno consth tpc, _errno store 0, 0, tav, tpc jmpi lr0 const v0, 0 ; return NULL on error. ; ; int errret = _sysfree( void *addr, int size ); ; .global __sysfree __sysfree: const tav,HIF_free asneq V_SYSCALL,gr1,gr1 jmpti tav,lr0 const tpc,_errno consth tpc,_errno store 0,0,tav,tpc jmpi lr0 constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,721
plugin-libc/newlib/libc/sys/a29khif/getenv.S
; @(#)getenv.s 1.4 90/10/14 21:57:45, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; getenv.s ; char *value = getenv( const char *name ); ; .file "getenv.s" .include "sys/sysmac.h" .text .word 0x00030000 ; Debugger tag word .global _getenv .global __getenv _getenv: __getenv: const tav,HIF_getenv @ asneq V_SYSCALL,gr1,gr1 ; HIF service trap jmpti tav, lr0 ; If tav is true, were finished, return. const tpc, _errno consth tpc, _errno ; Otherwise, store 0, 0, tav, tpc ; store error code in _errno, jmpi lr0 ; then return const v0, 0 ; with a value of 0 (NULL pointer). .end
4ms/metamodule-plugin-sdk
1,557
plugin-libc/newlib/libc/sys/a29khif/_setvec.S
; @(#)_setvec.s 1.2 90/10/14 21:57:35, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _setvec.s ; int success = _setvec( int trap_no, void (*handler)( void ) ); ; .file "_setvec.s" .include "sys/sysmac.h" .text .word 0x00040000 ; Debugger tag word .global __setvec __setvec: const tav,HIF_setvec @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
2,125
plugin-libc/newlib/libc/sys/a29khif/_alloc.S
; @(#)_alloc.s 1.4 90/10/14 21:57:19, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1989, 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; 07/06/89 (JS) Replaced call to const tav,HIF_macro @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 to syscall macro, ; and deleted call to reterr macro as a NULL needs to be ; returned on failure. ; _alloc.s ; void *vp = _sysalloc( int size ); ; .file "_alloc.s" .include "sys/sysmac.h" .text .word 0x00030000 ; Debugger tag word .global __sysalloc __sysalloc: const tav,HIF_alloc @ asneq V_SYSCALL,gr1,gr1 jmpti tav, lr0 const tpc, _errno consth tpc, _errno store 0, 0, tav, tpc jmpi lr0 const v0, 0 ; return NULL on error. ; ; int errret = _sysfree( void *addr, int size ); ; .global __sysfree __sysfree: const tav,HIF_free @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,514
plugin-libc/newlib/libc/sys/a29khif/_iowait.S
; @(#)_iowait.s 1.3 90/10/14 21:57:27, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _iowait.s ; _iowait( int fd ); ; .file "_iowait.s" .include "sys/sysmac.h" .text .word 0x00030000 ; Debugger tag word .global __iowait __iowait: const tav,HIF_iowait @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,533
plugin-libc/newlib/libc/sys/a29khif/_read.S
; @(#)_read.s 1.4 90/10/14 21:57:32, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _read.s ; int nread = _read( int fd, char *buf, int count ); ; .file "_read.s" .include "sys/sysmac.h" .text .word 0x00050000 ; Debugger tag word .global __read __read: const tav,HIF_read @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,655
plugin-libc/newlib/libc/sys/a29khif/_tmpnam.S
; @(#)_tmpnam.s 1.2 90/10/14 21:57:36, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _tmpnam.s ; char *cp = _khif_tmpnam( char *bufr ); ; /* same as ANSI tmpnam(), but NULL arg is not allowed */ ; NOTE - Will not work on BSD (no tmpnam sys call) ; .file "_tmpnam.s" .include "sys/sysmac.h" .text .word 0x00030000 ; Debugger tag word .global __khif_tmpnam __khif_tmpnam: const tav,HIF_tmpnam @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
2,124
plugin-libc/newlib/libc/sys/a29khif/stubs.S
; ; ; File of stubs so that unix applications can link into a HIF monitor ; ; sac@cygnus.com .text .global _sysalloc _sysalloc: const gr121,__sysalloc consth gr121,__sysalloc jmpi gr121 .global _sysfree _sysfree: const gr121,__sysfree consth gr121,__sysfree jmpi gr121 .global _cycles _cycles: const gr121,__cycles consth gr121,__cycles jmpi gr121 ; .global _exit ;_exit: ; const gr121,__exit ; consth gr121,__exit ; jmpi gr121 .global _getpsiz _getpsiz: const gr121,__getpsiz consth gr121,__getpsiz jmpi gr121 .global _gettz _gettz: const gr121,__gettz consth gr121,__gettz jmpi gr121 .global _ioctl _ioctl: const gr121,__ioctl consth gr121,__ioctl jmpi gr121 .global _iowait _iowait: const gr121,__iowait consth gr121,__iowait jmpi gr121 ;; syscalls used now -- .global _open ;; syscalls used now -- _open: ;; syscalls used now -- const gr121,__open ;; syscalls used now -- consth gr121,__open ;; syscalls used now -- jmpi gr121 .global _query _query: const gr121,__query consth gr121,__query jmpi gr121 .global _setim _setim: const gr121,__setim consth gr121,__setim jmpi gr121 .global _settrap _settrap: const gr121,__settrap consth gr121,__settrap jmpi gr121 .global _setvec _setvec: const gr121,__setvec consth gr121,__setvec jmpi gr121 .global _getargs _getargs: const gr121,__getargs consth gr121,__getargs jmpi gr121 ;; syscalls used now -- .global _unlink ;; syscalls used now -- _unlink: ;; syscalls used now -- const gr121,__unlink ;; syscalls used now -- consth gr121,__unlink ;; syscalls used now -- jmpi gr121 .global _sigret _sigret: const gr121,__sigret consth gr121,__sigret jmpi gr121 .global _sigdfl _sigdfl: const gr121,__sigdfl consth gr121,__sigdfl jmpi gr121 .global _sigrep _sigrep: const gr121,__sigrep consth gr121,__sigrep jmpi gr121 .global _sigskp _sigskp: const gr121,__sigskp consth gr121,__sigskp jmpi gr121 .global _sendsig _sendsig: const gr121,__sendsig consth gr121,__sendsig jmpi gr121 ; fill this jmpi delay slot ; the others are not done since they do not matter constn lr0,-1
4ms/metamodule-plugin-sdk
1,560
plugin-libc/newlib/libc/sys/a29khif/_cycles.S
; @(#)_cycles.s 1.2 90/10/14 21:57:21, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _cycles.s ; struct { unsigned long low_ticks, long hi_ticks } = _cycles( ); ; .file "_cycles.s" .include "sys/sysmac.h" .text .word 0x00020000 ; Debugger tag word .global __cycles __cycles: const tav,HIF_cycles @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,528
plugin-libc/newlib/libc/sys/a29khif/_getpsiz.S
; @(#)_getpsiz.s 1.2 90/10/14 21:57:23, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _getpsiz.s ; int size = _getpsiz( ); ; .file "_getpsiz.s" .include "sys/sysmac.h" .text .word 0x00020000 ; Debugger tag word .global __getpsiz __getpsiz: const tav,HIF_getpagesize @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,334
plugin-libc/newlib/libc/sys/a29khif/vec.S
; @(#)vec.s 1.2 90/10/14 21:58:01, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .global V_SPILL, V_FILL .global V_EPI_OS, V_BSD_OS .equ V_SPILL, 64 .equ V_FILL, 65 .equ V_BSD_OS, 66 .equ V_EPI_OS, 69 .end
4ms/metamodule-plugin-sdk
1,579
plugin-libc/newlib/libc/sys/a29khif/_iostat.S
;---------------------------------------------------------------------------- ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _iostat.s ; _iostat( int fd ); ; .file "_iostat.s" .include "sys/sysmac.h" .text .word 0x00030000 ; Debugger tag word .global __iostat .global _iostat __iostat: _iostat: const tav,HIF_iostat @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,558
plugin-libc/newlib/libc/sys/a29khif/_settrap.S
; @(#)_settrap.s 2.2 90/10/14 21:57:34, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _settrap.s ; void *prevaddr = _settrap( int trapno, void *trapaddr ); ; .file "_settrap.s" .include "sys/sysmac.h" .text .word 0x00040000 ; Debugger tag word .global __settrap __settrap: const tav,HIF_settrap @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,511
plugin-libc/newlib/libc/sys/a29khif/_query.S
; @(#)_query.s 2.2 90/10/14 21:57:31, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _query.s ; _query( query_code ); ; .file "_query.s" .include "sys/sysmac.h" .text .word 0x00030000 ; Debugger tag word .global __query __query: const tav,HIF_query @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,543
plugin-libc/newlib/libc/sys/a29khif/systime.S
; @(#)systime.s 1.2 90/10/14 21:57:59, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _time.s ; time_t secs = time( time_t *secs ); ; ; NOTE - Will not work on BSD (no time sys call) ; .file "systime.s" .include "sys/sysmac.h" .text .word 0x00030000 ; Debugger tag word .global _time _time: const tav,HIF_time @ asneq V_SYSCALL,gr1,gr1 cpeq gr97, lr2, 0 jmpti gr97, lr0 nop jmpi lr0 store 0, 0, gr96, lr2 .end
4ms/metamodule-plugin-sdk
1,538
plugin-libc/newlib/libc/sys/a29khif/_open.S
; @(#)_open.s 1.4 90/10/14 21:57:30, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _open.s ; int fd = _open( char *path, int oflag [, int mode ] ); ; .file "_open.s" .include "sys/sysmac.h" .text .word 0x00050000 ; Debugger tag word .global __open __open: const tav,HIF_open @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
2,081
plugin-libc/newlib/libc/sys/a29khif/read.S
; @(#)_read.s 1.4 90/10/14 21:57:32, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _read.s ; int nread = _read( int fd, char *buf, int count ); ; .file "_read.s" .include "sys/sysmac.h" .text .word 0x00050000 ; Debugger tag word .global __read ;; syscalls used now -- .global _read __read: ;; syscalls used now -- _read: .ifdef _BSD_OS ; BSD version - uses readv const tav,HIF_call @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 sub msp, msp, 8 store 0, 0, lr3, msp add tav, msp, 4 add lr3, msp, 0 store 0, 0, lr4, tav const lr4, 1 const tav,HIF_readv @ asneq V_SYSCALL,gr1,gr1 jmpti tav, lr0 add msp, msp, 8 const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .else const tav,HIF_read @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .endif .end
4ms/metamodule-plugin-sdk
1,500
plugin-libc/newlib/libc/sys/a29khif/_exit.S
; @(#)_exit.s 1.2 90/10/14 21:57:22, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _exit.s ; _exit( int rc ); ; .file "_exit.s" .include "sys/sysmac.h" .text .word 0x00030000 ; Debugger tag word .global __exit __exit: const tav,HIF_exit @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,577
plugin-libc/newlib/libc/sys/a29khif/remove.S
; @(#)remove.s 1.3 90/10/14 21:57:53, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; remove.s ; int cc = remove( char *path ); ; .file "remove.s" .include "sys/sysmac.h" .text .word 0x00030000 ; Debugger tag word .global _remove .global __remove .global __unlink _remove: __remove: __unlink: const tav,HIF_remove @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,614
plugin-libc/newlib/libc/sys/a29khif/_lseek.S
; @(#)_lseek.s 1.4 90/10/14 21:57:28, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _lseek.s ; int cc = _lseek( int fd, long offset, int whence ); ; .file "_lseek.s" .include "sys/sysmac.h" .text .word 0x00050000 ; Debugger tag word .global __lseek ;; syscalls used now -- .global _lseek __lseek: ;; syscalls used now -- _lseek: const tav,HIF_lseek @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,559
plugin-libc/newlib/libc/sys/a29khif/rename.S
; @(#)rename.s 1.3 90/10/14 21:57:54, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; rename.s ; int cc = rename( char *from, char *to ); ; .file "rename.s" .include "sys/sysmac.h" .text .word 0x00040000 ; Debugger tag word .global _rename .global __rename _rename: __rename: const tav,HIF_rename @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
7,204
plugin-libc/newlib/libc/sys/a29khif/crt0.S
; @(#)crt0.s 2.7 90/10/15 13:17:57, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1988, 1989, 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .file "crt0.s" ; crt0.s version 2.1-7 ; ; This module gets control from the OS. ; It saves away the Am29027 Mode register settings and ; then sets up the pointers to the resident spill and fill ; trap handlers. It then establishes argv and argc for passing ; to main. It then calls _main. If main returns, it calls _exit. ; ; void = start( ); ; NOTE - not C callable (no lead underscore) ; .include "sys/sysmac.h" ; ; .extern V_SPILL, V_FILL .comm __29027Mode, 8 ; A shadow of the mode register .comm __LibInit, 4 .comm __environ, 4 ; Environment variables, currently none. .text .extern _main, _exit .extern _memset .word 0 ; Terminating tag word .global start start: sub gr1, gr1, 6 * 4 asgeu V_SPILL, gr1, rab ; better not ever happen add lr1, gr1, 6 * 4 ; ; Initialize the .bss section to zero by using the memset library function. ; The .bss initialization section below has been commented out as it breaks ; XRAY29K that has been released. The operators sizeof and startof create ; new sections that are not recognized by XRAY29k, but will be implemented ; in the next release (2.0). ; ; const lr4, $sizeof(.bss) ; get size of .bss section to zero out ; consth lr4, $sizeof(.bss) ; const lr2, $startof(.bss) ; Get start address of .bss section ; consth lr2, $startof(.bss) ; const lr0, _memset ; address of memset function ; consth lr0, _memset ; calli lr0, lr0 ; call memset function ; const lr3, 0 ; Save the initial value of the Am29027's Mode register ; If your const tav,HIF_does @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 not enter crt0 with value for Am29027's Mode register ; in gr96 and gr97, and also if the coprocessor is active uncomment the ; next 4 lines. ; const gr96, 0xfc00820 ; consth gr96, 0xfc00820 ; const gr97, 0x1375 ; store 1, 3, gr96, gr97 ; const gr98, __29027Mode consth gr98, __29027Mode store 0, 0, gr96, gr98 add gr98, gr98, 4 store 0, 0, gr97, gr98 ; ; Now call the const tav,HIF_to @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 setup the spill and fill trap handlers ; const lr3, spill consth lr3, spill const lr2, V_SPILL const tav,HIF_setvec @ asneq V_SYSCALL,gr1,gr1 const lr3, fill consth lr3, fill const lr2, V_FILL const tav,HIF_setvec @ asneq V_SYSCALL,gr1,gr1 ; ; Set up dividu handler, since native one don't work?! ; Set it up by hand (FIXME) since HIF_settrap doesn't work either! ; ; const lr3,Edividu ; consth lr3,Edividu ; ; const lr2,35 ; const tav,HIF_settrap @ asneq V_SYSCALL,gr1,gr1 ; asge 0x50,gr121,0 ; check whether it failed ; const lr2,0x8000008c ; abs addr of dividu trap handler on EB ; consth lr2,0x8000008c ; store 0,0,lr3,lr2 ; Clobber vector FIXME ; ; Get the argv base address and calculate argc. ; const tav,HIF_getargs @ asneq V_SYSCALL,gr1,gr1 add lr3, v0, 0 ; argv add lr4, v0, 0 constn lr2, -1 argcloop: ; scan for NULL terminator load 0, 0, gr97, lr4 add lr4, lr4, 4 cpeq gr97, gr97, 0 jmpf gr97, argcloop add lr2, lr2, 1 ; ; Now call LibInit, if there is one. To aid runtime libraries ; that need to do some startup initialization, we have created ; a bss variable called LibInit. If the library doesn't need ; any run-time initialization, the variable is still 0. If the ; library does need run-time initialization, the library will ; contain a definition like ; void (*_LibInit)(void) = LibInitFunction; ; The linker will match up our bss LibInit with this data LibInit ; and the variable will not be 0. ; const lr0, __LibInit consth lr0, __LibInit load 0, 0, lr0, lr0 cpeq gr96, lr0, 0 jmpt gr96, NoLibInit nop calli lr0, lr0 nop NoLibInit: ; ; call main, passing it 2 arguments. main( argc, argv ) ; const lr0, _main consth lr0, _main calli lr0, lr0 nop ; ; call exit ; const lr0, _exit consth lr0, _exit calli lr0, lr0 add lr2, gr96, 0 ; ; Should never get here, but just in case ; loop: const tav,HIF_exit @ asneq V_SYSCALL,gr1,gr1 jmp loop nop .sbttl "Spill and Fill trap handlers" .eject ; ; SPILL, FILL trap handlers ; ; Note that these Spill and Fill trap handlers allow the OS to ; assume that the only registers of use are between gr1 and rfb. ; Therefore, if the OS desires to, it may simply preserve from ; lr0 for (rfb-gr1)/4 registers when doing a context save. ; ; ; Here is the spill handler ; ; spill registers from [*gr1..*rab) ; and move rab downto where gr1 points ; ; rab must change before rfb for signals to work ; ; On entry: rfb - rab = windowsize, gr1 < rab ; Near the end: rfb - rab > windowsize, gr1 == rab ; On exit: rfb - rab = windowsize, gr1 == rab ; .global spill spill: sub tav, rab, gr1 ; tav = number of bytes to spill srl tav, tav, 2 ; change byte count to word count sub tav, tav, 1 ; make count zero based mtsr cr, tav ; set Count Remaining register sub tav, rab, gr1 sub tav, rfb, tav ; pull down free bound and save it in rab add rab, gr1, 0 ; first pull down allocate bound storem 0, 0, lr0, tav ; store lr0..lr(tav) into rfb jmpi tpc ; return... add rfb, tav, 0 ; ; Here is the fill handler ; ; fill registers from [*rfb..*lr1) ; and move rfb upto where lr1 points. ; ; rab must change before rfb for signals to work ; ; On entry: rfb - rab = windowsize, lr1 > rfb ; Near the end: rfb - rab < windowsize, lr1 == rab + windowsize ; On exit: rfb - rab = windowsize, lr1 == rfb ; .global fill fill: const tav, 0x80 << 2 or tav, tav, rfb ; tav = ((rfb>>2) | 0x80)<<2 == [rfb]<<2 mtsr ipa, tav ; ipa = [rfb]<<2 == 1st reg to fill ; gr0 is now the first reg to spill sub tav, lr1, rfb ; tav = number of bytes to spill add rab, rab, tav ; push up allocate bound srl tav, tav, 2 ; change byte count to word count sub tav, tav, 1 ; make count zero based mtsr cr, tav ; set Count Remaining register loadm 0, 0, gr0, rfb ; load registers jmpi tpc ; return... add rfb, lr1, 0 ; ... first pushing up free bound .end
4ms/metamodule-plugin-sdk
1,306
plugin-libc/newlib/libc/sys/a29khif/_fstat.S
.file "_fstat.c" .sect .lit,lit gcc2_compiled.: .text .align 4 .global __fstat ;; syscalls used now -- .global _fstat .word 0x40000 __fstat: ;; syscalls used now -- _fstat: sub gr1,gr1,32 asgeu V_SPILL,gr1,gr126 add lr1,gr1,48 sll lr5,lr10,0 const gr116,__iostat consth gr116,__iostat calli lr0,gr116 sll lr2,lr5,0 sll lr10,gr96,0 jmpt lr10,L8 sll gr116,lr10,30 jmpf gr116,L3 add gr116,lr11,12 add gr117,lr11,12 const gr116,4096 store 0,0,gr116,gr117 add gr117,lr11,4 const gr116,1 jmp L4 store 0,0,gr116,gr117 L3: const gr117,8192 store 0,0,gr117,gr116 add gr116,lr11,4 store 0,0,gr117,gr116 L4: add gr117,lr11,20 const gr116,0 store 0,0,gr116,gr117 store 0,0,gr116,lr11 const gr116,_time consth gr116,_time calli lr0,gr116 const lr2,0 add gr116,lr11,16 store 0,0,gr96,gr116 sll lr2,lr5,0 const lr3,0 const lr7,__lseek consth lr7,__lseek calli lr0,lr7 const lr4,1 sll lr10,gr96,0 constn lr6,65535 cpneq gr116,lr10,lr6 jmpf gr116,L7 sll lr2,lr5,0 const lr3,0 calli lr0,lr7 const lr4,2 add gr116,lr11,8 store 0,0,gr96,gr116 cpneq gr96,gr96,lr6 jmpf gr96,L7 sll lr2,lr5,0 sll lr3,lr10,0 calli lr0,lr7 const lr4,0 cpneq gr96,gr96,lr6 jmpt gr96,L8 const gr96,0 L7: constn gr96,65535 L8: add gr1,gr1,32 nop jmpi lr0 asleu V_FILL,lr1,gr127
4ms/metamodule-plugin-sdk
1,533
plugin-libc/newlib/libc/sys/a29khif/clock.S
; @(#)clock.s 1.3 90/10/14 21:57:43, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; clock.s ; long ticks = clock( ); ; .file "clock.s" .include "sys/sysmac.h" .text .word 0x00020000 ; Debugger tag word .global _clock .global __clock _clock: __clock: const tav,HIF_clock @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,587
plugin-libc/newlib/libc/sys/a29khif/_close.S
; @(#)_close.s 1.4 90/10/14 21:57:20, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc.; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _close.s ; int cc = _close( int fd ); ; .file "_close.s" .include "sys/sysmac.h" .text .word 0x00030000 ; Debugger tag word .global __close ;; syscalls used now -- .global _close __close: ;; syscalls used now -- _close: const tav,HIF_close @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,614
plugin-libc/newlib/libc/sys/a29khif/_write.S
; @(#)_write.s 1.4 90/10/14 21:57:37, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _write.s ; int written = _write( int fd, char *buf, int count ); ; .file "_write.s" .include "sys/sysmac.h" .text .word 0x00050000 ; Debugger tag word .global __write ;; syscalls used now -- .global _write __write: ;; syscalls used now -- _write: const tav,HIF_write @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
12,702
plugin-libc/newlib/libc/sys/a29khif/signal.S
;@(#)signal.s 2.15 90/10/14 21:57:55, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .file "signal.s" ; SigEntry is the address of an array of C-level user code signal handlers. ; They must return to the top-level before doing a sigret() return function. ; Nested signals are supported. .extern V_SPILL, V_FILL .extern fill ; In crt0.s .align 4 .comm WindowSize, 4 .data SigEntry: .word 0 ; reserved .word 0 ; adds. of #2 SIGINT handler .word 0 ; reserved .word 0 ; reserved .word 0 ; reserved .word 0 ; reserved .word 0 ; reserved .word 0 ; adds. of #8 SIGFPE handler .text .reg v0, gr96 .reg v1, gr97 .reg v2, gr98 .reg v3, gr99 .reg tav, gr121 .reg tpc, gr122 .reg lrp, gr123 .reg slp, gr124 .reg msp, gr125 .reg rab, gr126 .reg rfb, gr127 ;=================================================================== setjmp() ; int ; setjmp(label_t jmpbuf) ; { ; *jmpbuf = {gr1, msp, lr0, lr1}; ; return 0; ; } ; .global _setjmp _setjmp: store 0, 0, gr1, lr2 add lr2, lr2, 4 store 0, 0, msp, lr2 add lr2, lr2, 4 store 0, 0, lr0, lr2 add lr2, lr2, 4 store 0, 0, lr1, lr2 jmpi lr0 const v0, 0 ; ;==================================================================== longjmp() ; int ; longjmp(label_t jmpbuf, int value) ; { ; /* BUG: check for this ; if (msp > jmpbuf->msp || gr1 > jmpbuf->gr1) ; longjmperror(); ; */ ; ; gr1 = jmpbuf->gr1; ; lr2addr = jmpbuf->gr1 + 8; ; msp = jmpbuf->msp; ; ; /* saved lr1 is invalid if saved lr2addr > rfb */ ; if (lr2addr > rfb) { ; /* ; * None of the registers are useful. ; * Set rfb to lr2addr - 512 & rab to rfb - 512. ; * the FILL assert will take care of filling ; */ ; lr1 = jmpbuf->lr1; ; rab = lr2addr - windowsize; ; rfb = lr2addr; ; } ; ; lr0 = jmpbuf->lr0; ; if (rfb < lr1) ; raise V_FILL; ; return value; ; } ; .global _longjmp _longjmp: load 0, 0, tav, lr2 ; copy in gr1 add v1, lr2, 4 ; v1 points to msp ; make sure we return a non-zero value cpeq v0, lr3, 0 srl v0, v0, 31 or v0, lr3, v0 add gr1, tav, 0 ; now update gr1 add tav, tav, 8 ; calculate lr2addr load 0, 0, msp, v1 ; update msp from jmpbuf cpleu v3, tav, rfb ; if (lr2addr > rfb) jmpt v3, $1 ; { add v1, v1, 4 ; v1 points to lr0 add v2, v1, 4 ; v2 points to lr1 load 0, 0, lr1, v2 ; lr1 = value from jmpbuf sub v3, rfb, rab ; sub rab, tav, v3 ; rab = lr2addr - windowsize add rfb, tav, 0 ; rfb = lr2addr $1: ; } load 0, 0, lr0, v1 jmpi lr0 asgeu V_FILL, rfb, lr1 ; may fill from rfb to lr1 ; ;================================================================== sigcode ; About to deliver a signal to a user mode signal handler. ; msp+(15*4) = signal_number ; msp+(14*4) = gr1 ; msp+(13*4) = rab ; msp+(12*4) = PC0 ; msp+(11*4) = PC1 ; msp+(10*4) = PC2 ; msp+( 9*4) = CHA ; msp+( 8*4) = CHD ; msp+( 7*4) = CHC ; msp+( 6*4) = ALU ; msp+( 5*4) = OPS ; msp+( 4*4) = gr121 ; msp+( 3*4) = gr99 ; msp+( 2*4) = gr98 ; msp+( 1*4) = gr97 ; msp = gr96 ; The state of all the registers (except for msp, chc and rab) ; is the same as when the process was interrupted. ; ; We must make the stack and window consistent before calling the handler ; The orignal rab value is on the stack. The interrupt handler placed ; rfb-Windowsize in rab. This is required to support nested interrupts. ; ; Note that the window becomes incosistent only during certain ; critical sections in spill, fill, longjmp and sigcode. ; rfb - rab > windowsize => we are in spill ; rfb - rab < windowsize => we are in fill ; gr1 + 8 > rfb => we are in long-longjmp case ; In case of spill, fill and lonjmp; rab is modified first, ; so if we are in one of these critical sections, ; we set rab to rfb - WINDOWSIZE. ; .equ SIGCTX_SIZE, (16)*4 .equ SIGCTX_SIGNUMB, (15)*4 .equ SIGCTX_GR1_OFFSET, (14)*4 .equ SIGCTX_RAB_OFFSET, (13)*4 .equ SIGCTX_PC0_OFFSET, (12)*4 .equ SIGCTX_PC1_OFFSET, (11)*4 .equ SIGCTX_PC2_OFFSET, (10)*4 .equ SIGCTX_CHC_OFFSET, (7)*4 .equ SIGCTX_OPS_OFFSET, (5)*4 .equ SIGCTX_TAV_OFFSET, (4)*4 .global sigcode sigcode: ; -------------------------------------------------------- R-Stack fixup const v0, WindowSize ; get register cache size consth v0, WindowSize load 0, 0, v0, v0 add v2, msp, SIGCTX_RAB_OFFSET load 0, 0, v2, v2 ; get interrupted rab value sub v1, rfb, v2 ; determine if rfb-rab <= WINDOW_SIZE cpgeu v1, v1, v0 ; jmpt v1, nfill ; jmp if spill or 'normal' interrupt add v1, gr1, 8 cpgt v1, v1, rfb ; interrupted longjmp can look like fill jmpf v1, nfill ; test for long-longjmp interruption nop ; jmp if gr1+8 <= rfb ; Fixup signal stack to re-start interrupted fill ; backup pc1 -- this is needed for the partial fill case. ; Clear chc so an interrupted load/store does not restart. ; Reset rab to a window distance below rfb, rab shall be ; decremented again on re-starting the interrupted fill. ; The interrupt handler set rab=rfb-WindowSize. ; add v0, msp, SIGCTX_RAB_OFFSET store 0, 0, rab, v0 ; re-store (rfb-WindowSize) for rab const v2, fill consth v2, fill add v0, msp, SIGCTX_PC1_OFFSET store 0, 0, v2, v0 sub v2, v2, 4 ; determine pc0 add v0, msp, SIGCTX_PC0_OFFSET store 0, 0, v2, v0 const v2, 0 ; clear chc add v0, msp, SIGCTX_CHC_OFFSET store 0, 0, v2, v0 nfill: cpgt v0, gr1, rfb ; if gr1 > rfb then gr1 = rfb jmpt v0, lower cplt v0, gr1, rab ; if gr1 < rab then gr1 = rab jmpt v0, raise nop ; -------------------------------------------------------- save_regs sig1: sub msp, msp, (4+2+25)*4 ; reserve space for regs mfsr gr96, ipc mfsr gr97, ipa mfsr gr98, ipb mfsr gr99, q mtsrim cr, 4-1 storem 0, 0, gr96, msp ; "push" registers stack support add gr96, lr1, 0 add gr97, rfb, 0 mtsrim cr, 2-1 add gr99, msp, 2*4 storem 0, 0, gr96, gr99 ; "push" remaining global registers mtsrim cr, 25-1 ; gr100-gr124 add gr96, msp, (4+2)*4 storem 0, 0, gr100, gr96 ; ; -------------------------------------------------------- Dummy Call .equ RALLOC, 4*4 ; make space for function calls add v0, rfb, 0 ; store original rfb sub gr1, gr1, RALLOC asgeu V_SPILL, gr1, rab add lr1, v0, 0 ; set lr1 = original rfb add v1, msp, (4+2+25)*4 + SIGCTX_SIGNUMB load 0, 0, lr2, v1 ; restore signal number sub v1, lr2, 1 ; get handler index sll v1, v1, 2 ; point to addresses ; ; -------------------------------------------------------- call C-level ; Handler must not use HIF services other than the _sigret() type. const v0, SigEntry consth v0, SigEntry add v0, v0, v1 load 0, 0, v0, v0 ; determine if handler registered cpeq v1, v0, 0 jmpt v1, NoHandler nop calli lr0, v0 ; call C-level signal handler nop ; ; -------------------------------------------------------- default return NoHandler: jmp __sigdfl nop ; -------------------------------------------------------- support bits lower: sll gr1, rfb, 0 jmp sig1 nop raise: sll gr1, rab, 0 jmp sig1 nop /* ; -------------------------------------------------------- repair_regs mtsrim cr, 4-1 loadm 0, 0, gr96, msp mtsr ipc, gr96 mtsr ipa, gr97 mtsr ipb, gr98 mtsr Q, gr99 ; "pop" registers stack support mtsrim cr, 2-1 add gr99, msp, 2*4 loadm 0, 0, gr96, gr99 add lr1, gr96, 0 add rfb, gr97, 0 ; "pop" remaining global registers mtsrim cr, 25-1 ; gr100-gr124 add gr96, msp, (4+2)*4 loadm 0, 0, gr100, gr96 add msp, msp, (4+2+25)*4 ; repair msp to save_regs entry value ; -------------------------------------------------------- end repair */ ; ======================================================== _sigret() .global __sigret __sigret: ; repair_regs ; -------------------------------------------------------- repair_regs mtsrim cr, 4-1 loadm 0, 0, gr96, msp mtsr ipc, gr96 mtsr ipa, gr97 mtsr ipb, gr98 mtsr q, gr99 ; "pop" registers stack support mtsrim cr, 2-1 add gr99, msp, 2*4 loadm 0, 0, gr96, gr99 add lr1, gr96, 0 add rfb, gr97, 0 ; "pop" remaining global registers mtsrim cr, 25-1 ; gr100-gr124 add gr96, msp, (4+2)*4 loadm 0, 0, gr100, gr96 add msp, msp, (4+2+25)*4 ; repair msp to save_regs entry value ; -------------------------------------------------------- end repair const tav, 323 ; HIF _sigret asneq 69, gr1,gr1 halt ; commit suicide if returns ; ======================================================== _sigdfl() .global __sigdfl __sigdfl: ; repair_regs ; -------------------------------------------------------- repair_regs mtsrim cr, 4-1 loadm 0, 0, gr96, msp mtsr ipc, gr96 mtsr ipa, gr97 mtsr ipb, gr98 mtsr q, gr99 ; "pop" registers stack support mtsrim cr, 2-1 add gr99, msp, 2*4 loadm 0, 0, gr96, gr99 add lr1, gr96, 0 add rfb, gr97, 0 ; "pop" remaining global registers mtsrim cr, 25-1 ; gr100-gr124 add gr96, msp, (4+2)*4 loadm 0, 0, gr100, gr96 add msp, msp, (4+2+25)*4 ; repair msp to save_regs entry value ; -------------------------------------------------------- end repair const tav, 322 ; HIF _sigdfl asneq 69, gr1,gr1 halt ; commit suicide if returns ; ======================================================== _sigrep() __sigrep: .global __sigrep ; repair_regs ; -------------------------------------------------------- repair_regs mtsrim cr, 4-1 loadm 0, 0, gr96, msp mtsr ipc, gr96 mtsr ipa, gr97 mtsr ipb, gr98 mtsr q, gr99 ; "pop" registers stack support mtsrim cr, 2-1 add gr99, msp, 2*4 loadm 0, 0, gr96, gr99 add lr1, gr96, 0 add rfb, gr97, 0 ; "pop" remaining global registers mtsrim cr, 25-1 ; gr100-gr124 add gr96, msp, (4+2)*4 loadm 0, 0, gr100, gr96 add msp, msp, (4+2+25)*4 ; repair msp to save_regs entry value ; -------------------------------------------------------- end repair const tav, 324 ; HIF _sigrep asneq 69, gr1,gr1 halt ; commit suicide if returns ; ======================================================== _sigskp() .global __sigskp __sigskp: ; repair_regs ; -------------------------------------------------------- repair_regs mtsrim cr, 4-1 loadm 0, 0, gr96, msp mtsr ipc, gr96 mtsr ipa, gr97 mtsr ipb, gr98 mtsr q, gr99 ; "pop" registers stack support mtsrim cr, 2-1 add gr99, msp, 2*4 loadm 0, 0, gr96, gr99 add lr1, gr96, 0 add rfb, gr97, 0 ; "pop" remaining global registers mtsrim cr, 25-1 ; gr100-gr124 add gr96, msp, (4+2)*4 loadm 0, 0, gr100, gr96 add msp, msp, (4+2+25)*4 ; repair msp to save_regs entry value ; -------------------------------------------------------- end repair const tav, 325 ; HIF _sigskp asneq 69, gr1,gr1 halt ; commit suicide if returns ; ======================================================== _sendsig() ; lr2 = signal number .global _raise .global __sendsig _raise: __sendsig: const tav, 326 ; HIF sendsig asneq 69, gr1,gr1 jmpi lr0 nop ; ; ======================================================== signal() ; lr2 = signal number ; lr3 = handler address .global _signal _signal: ; the memory variable WindowSize must be initalised at the ; start when rfb and rab are a window size apart. const v0, WindowSize ; get register cache size consth v0, WindowSize load 0, 0, v1, v0 cpeq v1, v1, 0 jmpf v1, WindowSizeOK sub v1, rfb, rab ; rfb-rab = WINDOW_SIZE store 0, 0, v1, v0 WindowSizeOK: const v1, SigEntry consth v1, SigEntry sub v3, lr2, 1 ; get handler index sll v3, v3, 2 ; pointer to addresses add v1, v1, v3 store 0,0, lr3, v1 ; save new handler const lr2, sigcode consth lr2, sigcode ;Fall through to __signal ; ======================================================== _signal() .global __signal __signal: const tav, 321 ; HIF signal asneq 69, gr1,gr1 jmpi lr0 nop
4ms/metamodule-plugin-sdk
1,507
plugin-libc/newlib/libc/sys/a29khif/_setim.S
; @(#)_setim.s 2.2 90/10/14 21:57:33, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _setim.s ; _setim( im, di ); ; .file "_setim.s" .include "sys/sysmac.h" .text .word 0x00040000 ; Debugger tag word .global __setim __setim: const tav,HIF_setim @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,505
plugin-libc/newlib/libc/sys/a29khif/_gettz.S
; @(#)_gettz.s 2.2 90/10/14 21:57:24, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _gettz.s ; _gettz( void ); ; .file "_gettz.s" .include "sys/sysmac.h" .text .word 0x00020000 ; Debugger tag word .global __gettz __gettz: const tav,HIF_gettz @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
1,522
plugin-libc/newlib/libc/sys/a29khif/getargs.S
; @(#)getargs.s 1.2 90/10/14 21:57:44, AMD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 1990 Advanced Micro Devices, Inc. ; ; This software is the property of Advanced Micro Devices, Inc (AMD) which ; specifically grants the user the right to modify, use and distribute this ; software provided this notice is not removed or altered. All other rights ; are reserved by AMD. ; ; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS ; SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL ; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR ; USE OF THIS SOFTWARE. ; ; So that all may benefit from your experience, please report any problems ; or suggestions about this software to the 29K Technical Support Center at ; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or ; 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. ; ; Advanced Micro Devices, Inc. ; 29K Support Products ; Mail Stop 573 ; 5900 E. Ben White Blvd. ; Austin, TX 78741 ; 800-292-9263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _getargs.s ; void _getargs( void ); ; .file "_getargs.s" .include "sys/sysmac.h" .text .word 0x00020000 ; Debugger tag word .global __getargs __getargs: const tav,HIF_getargs @ asneq V_SYSCALL,gr1,gr1 @ jmpti tav,lr0 @ const tpc,_errno @ consth tpc,_errno @ store 0,0,tav,tpc @ jmpi lr0 @ constn v0,-1 .end
4ms/metamodule-plugin-sdk
2,372
plugin-libc/newlib/libc/sys/mmixware/setjmp.S
/* Setjmp and longjmp for mmix. Copyright (C) 2001 Hans-Peter Nilsson Permission to use, copy, modify, and distribute this software is freely granted, provided that the above copyright notice, this notice and the following disclaimer are preserved with no changes. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. jmp_buf[5]: 0: fp 1: rJ (return-address) 2: sp 3: rO *before* the setjmp call. 4: temporary storage. Reserved between setjmp and longjmp. */ #ifdef __MMIX_ABI_GNU__ #define arg1 $231 #define arg2 $232 #define outret $231 #define popval 0 #else #define arg1 $0 #define arg2 $1 #define outret $0 #define popval 1 #endif .section .text.setjmp,"ax",@progbits .global setjmp setjmp: % Store fp, sp and return address. Recycle the static-chain and % structure-return registers as temporary register, since we need to keep % the jmp_buf (parameter 1) and the return address across a "POP". SET $251,arg1 STOU $253,$251,0 GET $252,rJ STOU $252,$251,8 STOU $254,$251,16 SETL outret,0 % Jump through hoops to get the value of rO *before* the setjmp call. GETA $255,0f PUT rJ,$255 POP popval,0 0: GET $255,rO STOU $255,$251,24 GO $255,$252,0 .size setjmp,.-setjmp .section .text.longjmp,"ax",@progbits .global longjmp longjmp: % Reset arg2 to 1 if it is 0 (see longjmp(2)) and store it in jmp_buf. % Save arg1 in a global register, since it will be destroyed by the POPs % (in the mmixware ABI). CSZ arg2,arg2,1 STOU arg2,arg1,32 SET $251,arg1 % Loop and "POP 0,0" until rO is the expected value, like % the expansion of nonlocal_goto_receiver, except that we put the return % value in the right register and make sure that the POP causes it to % enter the right return-value register as seen by the caller. For the % GNU ABI, it is unnecessary to do this in the loop and perhaps the memory % access can be hoisted outside the loop, but this is safe and simple and % I see no need to optimize longjmps. GETA $255,0f PUT rJ,$255 LDOU $255,$251,24 0: GET $252,rO CMPU $252,$252,$255 BNP $252,1f LDOU outret,$251,32 POP popval,0 1: LDOU $253,$251,0 LDOU $255,$251,8 LDOU $254,$251,16 GO $255,$255,0 .size longjmp,.-longjmp
4ms/metamodule-plugin-sdk
1,596
plugin-libc/newlib/libc/sys/h8300hms/crt0.S
; h8/300 and h8/300h start up file. #include "setarch.h" #ifdef __H8300__ .section .text .global _start _start: mov.w #_stack,sp mov.w #_edata,r0 mov.w #_end,r1 sub.w r2,r2 .Loop: mov.w r2,@r0 adds #2,r0 cmp r1,r0 blo .Loop #ifdef __ELF__ mov.l #__fini,r0 jsr @_atexit #ifdef __SIMULATOR__ jsr @0xcc #endif jsr @__init #else #ifdef __SIMULATOR__ jsr @0xcc #endif jsr @___main #endif jsr @_main jsr @_exit .section .stack _stack: .word 1 #endif #ifdef __H8300H__ .section .text .global _start _start: mov.l #_stack,sp mov.l #_edata,er0 mov.l #_end,er1 sub.w r2,r2 ; not sure about alignment requirements .Loop: mov.w r2,@er0 ; playing it safe for now adds #2,er0 cmp.l er1,er0 blo .Loop #ifdef __ELF__ mov.l #__fini,er0 jsr @_atexit #ifdef __SIMULATOR__ jsr @0xcc #endif jsr @__init #else #ifdef __SIMULATOR__ jsr @0xcc #endif jsr @___main #endif jsr @_main jsr @_exit .section .stack _stack: .long 1 #endif #if defined (__H8300S__) || defined (__H8300SX__) .section .text .global _start _start: mov.l #_stack,sp mov.l #_edata,er0 mov.l #_end,er1 sub.w r2,r2 ; not sure about alignment requirements .Loop: mov.w r2,@er0 ; playing it safe for now adds #2,er0 cmp.l er1,er0 blo .Loop #ifdef __ELF__ mov.l #__fini,er0 jsr @_atexit #ifdef __SIMULATOR__ jsr @0xcc #endif jsr @__init #else #ifdef __SIMULATOR__ jsr @0xcc #endif jsr @___main #endif jsr @_main jsr @_exit .section .stack _stack: .long 1 #endif
4ms/stm32mp1-baremetal
4,916
third-party/u-boot/u-boot-stm32mp1-baremetal/board/armltd/integrator/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Board specific setup info * * (C) Copyright 2004, ARM Ltd. * Philippe Robin, <philippe.robin@arm.com> */ #include <config.h> /* Reset using CM control register */ .global reset_cpu reset_cpu: mov r0, #CM_BASE ldr r1,[r0,#OS_CTRL] orr r1,r1,#CMMASK_RESET str r1,[r0,#OS_CTRL] reset_failed: b reset_failed /* Set up the platform, once the cpu has been initialized */ .globl lowlevel_init lowlevel_init: /* If U-Boot has been run after the ARM boot monitor * then all the necessary actions have been done * otherwise we are running from user flash mapped to 0x00000000 * --- DO NOT REMAP BEFORE THE CODE HAS BEEN RELOCATED -- * Changes to the (possibly soft) reset defaults of the processor * itself should be performed in cpu/arm<>/start.S * This function affects only the core module or board settings */ #ifdef CONFIG_CM_INIT /* CM has an initialization register * - bits in it are wired into test-chip pins to force * reset defaults * - may need to change its contents for U-Boot */ /* set the desired CM specific value */ mov r2,#CMMASK_LOWVEC /* Vectors at 0x00000000 for all */ #if defined (CONFIG_CM10200E) || defined (CONFIG_CM10220E) orr r2,r2,#CMMASK_INIT_102 #else #if !defined (CONFIG_CM920T) && !defined (CONFIG_CM920T_ETM) && \ !defined (CONFIG_CM940T) #ifdef CONFIG_CM_MULTIPLE_SSRAM /* set simple mapping */ and r2,r2,#CMMASK_MAP_SIMPLE #endif /* #ifdef CONFIG_CM_MULTIPLE_SSRAM */ #ifdef CONFIG_CM_TCRAM /* disable TCRAM */ and r2,r2,#CMMASK_TCRAM_DISABLE #endif /* #ifdef CONFIG_CM_TCRAM */ #if defined (CONFIG_CM926EJ_S) || defined (CONFIG_CM1026EJ_S) || \ defined (CONFIG_CM1136JF_S) and r2,r2,#CMMASK_LE #endif /* cpu with little endian initialization */ orr r2,r2,#CMMASK_CMxx6_COMMON #endif /* CMxx6 code */ #endif /* ARM102xxE value */ /* read CM_INIT */ mov r0, #CM_BASE ldr r1, [r0, #OS_INIT] /* check against desired bit setting */ and r3,r1,r2 cmp r3,r2 beq init_reg_OK /* lock for change */ mov r3, #CMVAL_LOCK1 add r3,r3,#CMVAL_LOCK2 str r3, [r0, #OS_LOCK] /* set desired value */ orr r1,r1,r2 /* write & relock CM_INIT */ str r1, [r0, #OS_INIT] mov r1, #CMVAL_UNLOCK str r1, [r0, #OS_LOCK] /* soft reset so new values used */ b reset_cpu init_reg_OK: #endif /* CONFIG_CM_INIT */ mov pc, lr #ifdef CONFIG_CM_SPD_DETECT /* Fast memory is available for the DRAM data * - ensure it has been transferred, then summarize the data * into a CM register */ .globl dram_query dram_query: stmfd r13!,{r4-r6,lr} /* set up SDRAM info */ /* - based on example code from the CM User Guide */ mov r0, #CM_BASE readspdbit: ldr r1, [r0, #OS_SDRAM] /* read the SDRAM register */ and r1, r1, #0x20 /* mask SPD bit (5) */ cmp r1, #0x20 /* test if set */ bne readspdbit setupsdram: add r0, r0, #OS_SPD /* address the copy of the SDP data */ ldrb r1, [r0, #3] /* number of row address lines */ ldrb r2, [r0, #4] /* number of column address lines */ ldrb r3, [r0, #5] /* number of banks */ ldrb r4, [r0, #31] /* module bank density */ mul r5, r4, r3 /* size of SDRAM (MB divided by 4) */ mov r5, r5, ASL#2 /* size in MB */ mov r0, #CM_BASE /* reload for later code */ cmp r5, #0x10 /* is it 16MB? */ bne not16 mov r6, #0x2 /* store size and CAS latency of 2 */ b writesize not16: cmp r5, #0x20 /* is it 32MB? */ bne not32 mov r6, #0x6 b writesize not32: cmp r5, #0x40 /* is it 64MB? */ bne not64 mov r6, #0xa b writesize not64: cmp r5, #0x80 /* is it 128MB? */ bne not128 mov r6, #0xe b writesize not128: /* if it is none of these sizes then it is either 256MB, or * there is no SDRAM fitted so default to 256MB */ mov r6, #0x12 writesize: mov r1, r1, ASL#8 /* row addr lines from SDRAM reg */ orr r2, r1, r2, ASL#12 /* OR in column address lines */ orr r3, r2, r3, ASL#16 /* OR in number of banks */ orr r6, r6, r3 /* OR in size and CAS latency */ str r6, [r0, #OS_SDRAM] /* store SDRAM parameters */ #endif /* #ifdef CONFIG_CM_SPD_DETECT */ ldmfd r13!,{r4-r6,pc} /* back to caller */ #ifdef CONFIG_CM_REMAP /* CM remap bit is operational * - use it to map writeable memory at 0x00000000, in place of flash */ .globl cm_remap cm_remap: stmfd r13!,{r4-r10,lr} mov r0, #CM_BASE ldr r1, [r0, #OS_CTRL] orr r1, r1, #CMMASK_REMAP /* set remap and led bits */ str r1, [r0, #OS_CTRL] /* Now 0x00000000 is writeable, replace the vectors */ ldr r0, =_start /* r0 <- start of vectors */ add r2, r0, #64 /* r2 <- past vectors */ sub r1,r1,r1 /* destination 0x00000000 */ copy_vec: ldmia r0!, {r3-r10} /* copy from source address [r0] */ stmia r1!, {r3-r10} /* copy to target address [r1] */ cmp r0, r2 /* until source end address [r2] */ ble copy_vec ldmfd r13!,{r4-r10,pc} /* back to caller */ #endif /* #ifdef CONFIG_CM_REMAP */
4ms/stm32mp1-baremetal
6,395
third-party/u-boot/u-boot-stm32mp1-baremetal/board/imgtec/malta/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2013 Gabor Juhos <juhosg@openwrt.org> */ #include <config.h> #include <gt64120.h> #include <msc01.h> #include <pci.h> #include <asm/addrspace.h> #include <asm/asm.h> #include <asm/regdef.h> #include <asm/malta.h> #include <asm/mipsregs.h> #ifdef CONFIG_SYS_BIG_ENDIAN #define CPU_TO_GT32(_x) ((_x)) #else #define CPU_TO_GT32(_x) ( \ (((_x) & 0xff) << 24) | (((_x) & 0xff00) << 8) | \ (((_x) & 0xff0000) >> 8) | (((_x) & 0xff000000) >> 24)) #endif .text .set noreorder .globl lowlevel_init lowlevel_init: /* detect the core card */ PTR_LI t0, CKSEG1ADDR(MALTA_REVISION) lw t0, 0(t0) srl t0, t0, MALTA_REVISION_CORID_SHF andi t0, t0, (MALTA_REVISION_CORID_MSK >> \ MALTA_REVISION_CORID_SHF) /* core cards using the gt64120 system controller */ li t1, MALTA_REVISION_CORID_CORE_LV beq t0, t1, _gt64120 /* core cards using the MSC01 system controller */ li t1, MALTA_REVISION_CORID_CORE_FPGA6 beq t0, t1, _msc01 nop /* unknown system controller */ b . nop /* * Load BAR registers of GT64120 as done by YAMON * * based on a patch sent by Antony Pavlov <antonynpavlov@gmail.com> * to the barebox mailing list. * The subject of the original patch: * 'MIPS: qemu-malta: add YAMON-style GT64120 memory map' * URL: * http://www.mail-archive.com/barebox@lists.infradead.org/msg06128.html * * based on write_bootloader() in qemu.git/hw/mips_malta.c * see GT64120 manual and qemu.git/hw/gt64xxx.c for details */ _gt64120: /* move GT64120 registers from 0x14000000 to 0x1be00000 */ PTR_LI t1, CKSEG1ADDR(GT_DEF_BASE) li t0, CPU_TO_GT32(0xdf000000) sw t0, GT_ISD_OFS(t1) /* setup MEM-to-PCI0 mapping */ PTR_LI t1, CKSEG1ADDR(MALTA_GT_BASE) /* setup PCI0 io window to 0x18000000-0x181fffff */ li t0, CPU_TO_GT32(0xc0000000) sw t0, GT_PCI0IOLD_OFS(t1) li t0, CPU_TO_GT32(0x40000000) sw t0, GT_PCI0IOHD_OFS(t1) /* setup PCI0 mem windows */ li t0, CPU_TO_GT32(0x80000000) sw t0, GT_PCI0M0LD_OFS(t1) li t0, CPU_TO_GT32(0x3f000000) sw t0, GT_PCI0M0HD_OFS(t1) li t0, CPU_TO_GT32(0xc1000000) sw t0, GT_PCI0M1LD_OFS(t1) li t0, CPU_TO_GT32(0x5e000000) sw t0, GT_PCI0M1HD_OFS(t1) jr ra nop /* * */ _msc01: /* setup peripheral bus controller clock divide */ PTR_LI t0, CKSEG1ADDR(MALTA_MSC01_PBC_BASE) li t1, 0x1 << MSC01_PBC_CLKCFG_SHF sw t1, MSC01_PBC_CLKCFG_OFS(t0) /* tweak peripheral bus controller timings */ li t1, (0x1 << MSC01_PBC_CS0TIM_CDT_SHF) | \ (0x1 << MSC01_PBC_CS0TIM_CAT_SHF) sw t1, MSC01_PBC_CS0TIM_OFS(t0) li t1, (0x0 << MSC01_PBC_CS0RW_RDT_SHF) | \ (0x2 << MSC01_PBC_CS0RW_RAT_SHF) | \ (0x0 << MSC01_PBC_CS0RW_WDT_SHF) | \ (0x2 << MSC01_PBC_CS0RW_WAT_SHF) sw t1, MSC01_PBC_CS0RW_OFS(t0) lw t1, MSC01_PBC_CS0CFG_OFS(t0) li t2, MSC01_PBC_CS0CFG_DTYP_MSK and t1, t2 ori t1, (0x0 << MSC01_PBC_CS0CFG_ADM_SHF) | \ (0x3 << MSC01_PBC_CS0CFG_WSIDLE_SHF) | \ (0x10 << MSC01_PBC_CS0CFG_WS_SHF) sw t1, MSC01_PBC_CS0CFG_OFS(t0) /* setup basic address decode */ PTR_LI t0, CKSEG1ADDR(MALTA_MSC01_BIU_BASE) li t1, 0x0 li t2, -CONFIG_SYS_MEM_SIZE sw t1, MSC01_BIU_MCBAS1L_OFS(t0) sw t2, MSC01_BIU_MCMSK1L_OFS(t0) sw t1, MSC01_BIU_MCBAS2L_OFS(t0) sw t2, MSC01_BIU_MCMSK2L_OFS(t0) /* initialise IP1 - unused */ li t1, MALTA_MSC01_IP1_BASE li t2, -MALTA_MSC01_IP1_SIZE sw t1, MSC01_BIU_IP1BAS1L_OFS(t0) sw t2, MSC01_BIU_IP1MSK1L_OFS(t0) sw t1, MSC01_BIU_IP1BAS2L_OFS(t0) sw t2, MSC01_BIU_IP1MSK2L_OFS(t0) /* initialise IP2 - PCI */ li t1, MALTA_MSC01_IP2_BASE1 li t2, -MALTA_MSC01_IP2_SIZE1 sw t1, MSC01_BIU_IP2BAS1L_OFS(t0) sw t2, MSC01_BIU_IP2MSK1L_OFS(t0) li t1, MALTA_MSC01_IP2_BASE2 li t2, -MALTA_MSC01_IP2_SIZE2 sw t1, MSC01_BIU_IP2BAS2L_OFS(t0) sw t2, MSC01_BIU_IP2MSK2L_OFS(t0) /* initialise IP3 - peripheral bus controller */ li t1, MALTA_MSC01_IP3_BASE li t2, -MALTA_MSC01_IP3_SIZE sw t1, MSC01_BIU_IP3BAS1L_OFS(t0) sw t2, MSC01_BIU_IP3MSK1L_OFS(t0) sw t1, MSC01_BIU_IP3BAS2L_OFS(t0) sw t2, MSC01_BIU_IP3MSK2L_OFS(t0) /* setup PCI memory */ PTR_LI t0, CKSEG1ADDR(MALTA_MSC01_PCI_BASE) li t1, MALTA_MSC01_PCIMEM_BASE li t2, (-MALTA_MSC01_PCIMEM_SIZE) & MSC01_PCI_SC2PMMSKL_MSK_MSK li t3, MALTA_MSC01_PCIMEM_MAP sw t1, MSC01_PCI_SC2PMBASL_OFS(t0) sw t2, MSC01_PCI_SC2PMMSKL_OFS(t0) sw t3, MSC01_PCI_SC2PMMAPL_OFS(t0) /* setup PCI I/O */ li t1, MALTA_MSC01_PCIIO_BASE li t2, (-MALTA_MSC01_PCIIO_SIZE) & MSC01_PCI_SC2PIOMSKL_MSK_MSK li t3, MALTA_MSC01_PCIIO_MAP sw t1, MSC01_PCI_SC2PIOBASL_OFS(t0) sw t2, MSC01_PCI_SC2PIOMSKL_OFS(t0) sw t3, MSC01_PCI_SC2PIOMAPL_OFS(t0) /* setup PCI_BAR0 memory window */ li t1, -CONFIG_SYS_MEM_SIZE sw t1, MSC01_PCI_BAR0_OFS(t0) /* setup PCI to SysCon/CPU translation */ sw t1, MSC01_PCI_P2SCMSKL_OFS(t0) sw zero, MSC01_PCI_P2SCMAPL_OFS(t0) /* setup PCI vendor & device IDs */ li t1, (PCI_VENDOR_ID_MIPS << MSC01_PCI_HEAD0_VENDORID_SHF) | \ (PCI_DEVICE_ID_MIPS_MSC01 << MSC01_PCI_HEAD0_DEVICEID_SHF) sw t1, MSC01_PCI_HEAD0_OFS(t0) /* setup PCI subsystem vendor & device IDs */ sw t1, MSC01_PCI_HEAD11_OFS(t0) /* setup PCI class, revision */ li t1, (PCI_CLASS_BRIDGE_HOST << MSC01_PCI_HEAD2_CLASS_SHF) | \ (0x1 << MSC01_PCI_HEAD2_REV_SHF) sw t1, MSC01_PCI_HEAD2_OFS(t0) /* ensure a sane setup */ sw zero, MSC01_PCI_HEAD3_OFS(t0) sw zero, MSC01_PCI_HEAD4_OFS(t0) sw zero, MSC01_PCI_HEAD5_OFS(t0) sw zero, MSC01_PCI_HEAD6_OFS(t0) sw zero, MSC01_PCI_HEAD7_OFS(t0) sw zero, MSC01_PCI_HEAD8_OFS(t0) sw zero, MSC01_PCI_HEAD9_OFS(t0) sw zero, MSC01_PCI_HEAD10_OFS(t0) sw zero, MSC01_PCI_HEAD12_OFS(t0) sw zero, MSC01_PCI_HEAD13_OFS(t0) sw zero, MSC01_PCI_HEAD14_OFS(t0) sw zero, MSC01_PCI_HEAD15_OFS(t0) /* setup PCI command register */ li t1, (PCI_COMMAND_FAST_BACK | \ PCI_COMMAND_SERR | \ PCI_COMMAND_PARITY | \ PCI_COMMAND_MASTER | \ PCI_COMMAND_MEMORY) sw t1, MSC01_PCI_HEAD1_OFS(t0) /* setup PCI byte swapping */ #ifdef CONFIG_SYS_BIG_ENDIAN li t1, (0x1 << MSC01_PCI_SWAP_BAR0_BSWAP_SHF) | \ (0x1 << MSC01_PCI_SWAP_IO_BSWAP_SHF) sw t1, MSC01_PCI_SWAP_OFS(t0) #else sw zero, MSC01_PCI_SWAP_OFS(t0) #endif /* enable PCI host configuration cycles */ lw t1, MSC01_PCI_CFG_OFS(t0) li t2, MSC01_PCI_CFG_RA_MSK | \ MSC01_PCI_CFG_G_MSK | \ MSC01_PCI_CFG_EN_MSK or t1, t1, t2 sw t1, MSC01_PCI_CFG_OFS(t0) jr ra nop
4ms/stm32mp1-baremetal
1,785
third-party/u-boot/u-boot-stm32mp1-baremetal/board/freescale/m54455evb/sbf_dram_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Board-specific sbf ddr/sdram init. * * (C) Copyright 2017 Angelo Dureghello <angelo@sysam.it> */ #include <config.h> .global sbf_dram_init .text sbf_dram_init: /* Dram Initialization a1, a2, and d0 */ /* mscr sdram */ move.l #0xFC0A4074, %a1 move.b #(CONFIG_SYS_SDRAM_DRV_STRENGTH), (%a1) nop /* SDRAM Chip 0 and 1 */ move.l #0xFC0B8110, %a1 move.l #0xFC0B8114, %a2 /* calculate the size */ move.l #0x13, %d1 move.l #(CONFIG_SYS_SDRAM_SIZE), %d2 #ifdef CONFIG_SYS_SDRAM_BASE1 lsr.l #1, %d2 #endif dramsz_loop: lsr.l #1, %d2 add.l #1, %d1 cmp.l #1, %d2 bne dramsz_loop #ifdef CONFIG_SYS_NAND_BOOT beq asm_nand_chk_status #endif /* SDRAM Chip 0 and 1 */ move.l #(CONFIG_SYS_SDRAM_BASE), (%a1) or.l %d1, (%a1) #ifdef CONFIG_SYS_SDRAM_BASE1 move.l #(CONFIG_SYS_SDRAM_BASE1), (%a2) or.l %d1, (%a2) #endif nop /* dram cfg1 and cfg2 */ move.l #0xFC0B8008, %a1 move.l #(CONFIG_SYS_SDRAM_CFG1), (%a1) nop move.l #0xFC0B800C, %a2 move.l #(CONFIG_SYS_SDRAM_CFG2), (%a2) nop move.l #0xFC0B8000, %a1 /* Mode */ move.l #0xFC0B8004, %a2 /* Ctrl */ /* Issue PALL */ move.l #(CONFIG_SYS_SDRAM_CTRL + 2), (%a2) nop /* Issue LEMR */ move.l #(CONFIG_SYS_SDRAM_EMOD + 0x408), (%a1) nop move.l #(CONFIG_SYS_SDRAM_MODE + 0x300), (%a1) nop move.l #1000, %d1 bsr asm_delay /* Issue PALL */ move.l #(CONFIG_SYS_SDRAM_CTRL + 2), (%a2) nop /* Perform two refresh cycles */ move.l #(CONFIG_SYS_SDRAM_CTRL + 4), %d0 nop move.l %d0, (%a2) move.l %d0, (%a2) nop move.l #(CONFIG_SYS_SDRAM_MODE + 0x200), (%a1) nop move.l #500, %d1 bsr asm_delay move.l #(CONFIG_SYS_SDRAM_CTRL), %d1 and.l #0x7FFFFFFF, %d1 or.l #0x10000C00, %d1 move.l %d1, (%a2) nop move.l #2000, %d1 bsr asm_delay rts
4ms/stm32mp1-baremetal
2,541
third-party/u-boot/u-boot-stm32mp1-baremetal/board/freescale/mx31pdk/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2009 Magnus Lilja <lilja.magnus@gmail.com> */ #include <config.h> #include <asm/arch/imx-regs.h> #include <asm/macro.h> .globl lowlevel_init lowlevel_init: /* Also setup the Peripheral Port Remap register inside the core */ ldr r0, =ARM_PPMRR /* start from AIPS 2GB region */ mcr p15, 0, r0, c15, c2, 4 write32 IPU_CONF, IPU_CONF_DI_EN write32 CCM_CCMR, CCM_CCMR_SETUP wait_timer 0x40000 write32 CCM_CCMR, CCM_CCMR_SETUP | CCMR_MPE write32 CCM_CCMR, (CCM_CCMR_SETUP | CCMR_MPE) & ~CCMR_MDS /* Set up clock to 532MHz */ write32 CCM_PDR0, CCM_PDR0_SETUP_532MHZ write32 CCM_MPCTL, CCM_MPCTL_SETUP_532MHZ write32 CCM_SPCTL, PLL_PD(1) | PLL_MFD(4) | PLL_MFI(12) | PLL_MFN(1) /* Set up MX31 DDR pins */ write32 IOMUXC_SW_PAD_CTL_SDCKE1_SDCLK_SDCLK_B, 0 write32 IOMUXC_SW_PAD_CTL_CAS_SDWE_SDCKE0, 0 write32 IOMUXC_SW_PAD_CTL_BCLK_RW_RAS, 0 write32 IOMUXC_SW_PAD_CTL_CS2_CS3_CS4, 0x1000 write32 IOMUXC_SW_PAD_CTL_DQM3_EB0_EB1, 0 write32 IOMUXC_SW_PAD_CTL_DQM0_DQM1_DQM2, 0 write32 IOMUXC_SW_PAD_CTL_SD29_SD30_SD31, 0 write32 IOMUXC_SW_PAD_CTL_SD26_SD27_SD28, 0 write32 IOMUXC_SW_PAD_CTL_SD23_SD24_SD25, 0 write32 IOMUXC_SW_PAD_CTL_SD20_SD21_SD22, 0 write32 IOMUXC_SW_PAD_CTL_SD17_SD18_SD19, 0 write32 IOMUXC_SW_PAD_CTL_SD14_SD15_SD16, 0 write32 IOMUXC_SW_PAD_CTL_SD11_SD12_SD13, 0 write32 IOMUXC_SW_PAD_CTL_SD8_SD9_SD10, 0 write32 IOMUXC_SW_PAD_CTL_SD5_SD6_SD7, 0 write32 IOMUXC_SW_PAD_CTL_SD2_SD3_SD4, 0 write32 IOMUXC_SW_PAD_CTL_SDBA0_SD0_SD1, 0 write32 IOMUXC_SW_PAD_CTL_A24_A25_SDBA1, 0 write32 IOMUXC_SW_PAD_CTL_A21_A22_A23, 0 write32 IOMUXC_SW_PAD_CTL_A18_A19_A20, 0 write32 IOMUXC_SW_PAD_CTL_A15_A16_A17, 0 write32 IOMUXC_SW_PAD_CTL_A12_A13_A14, 0 write32 IOMUXC_SW_PAD_CTL_A10_MA10_A11, 0 write32 IOMUXC_SW_PAD_CTL_A7_A8_A9, 0 write32 IOMUXC_SW_PAD_CTL_A4_A5_A6, 0 write32 IOMUXC_SW_PAD_CTL_A1_A2_A3, 0 write32 IOMUXC_SW_PAD_CTL_VPG0_VPG1_A0, 0 /* Set up MX31 DDR Memory Controller */ write32 WEIM_ESDMISC, ESDMISC_MDDR_SETUP write32 WEIM_ESDCFG0, ESDCFG0_MDDR_SETUP /* Perform DDR init sequence */ write32 WEIM_ESDCTL0, ESDCTL_PRECHARGE write32 CSD0_BASE | 0x0f00, 0x12344321 write32 WEIM_ESDCTL0, ESDCTL_AUTOREFRESH write32 CSD0_BASE, 0x12344321 write32 CSD0_BASE, 0x12344321 write32 WEIM_ESDCTL0, ESDCTL_LOADMODEREG write8 CSD0_BASE | 0x00000033, 0xda write8 CSD0_BASE | 0x01000000, 0xff write32 WEIM_ESDCTL0, ESDCTL_RW write32 CSD0_BASE, 0xDEADBEEF write32 WEIM_ESDMISC, ESDMISC_MDDR_RESET_DL mov pc, lr
4ms/stm32mp1-baremetal
3,007
third-party/u-boot/u-boot-stm32mp1-baremetal/board/freescale/mx6sllevk/plugin.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2016 Freescale Semiconductor, Inc. */ #include <config.h> /* DDR script */ .macro imx6sll_evk_ddr_setting ldr r0, =IOMUXC_BASE_ADDR ldr r1, =0x00080000 str r1, [r0, #0x550] ldr r1, =0x00000000 str r1, [r0, #0x534] ldr r1, =0x00000030 str r1, [r0, #0x2AC] str r1, [r0, #0x548] str r1, [r0, #0x52C] ldr r1, =0x00020000 str r1, [r0, #0x530] ldr r1, =0x00003030 str r1, [r0, #0x2B0] str r1, [r0, #0x2B4] str r1, [r0, #0x2B8] str r1, [r0, #0x2BC] ldr r1, =0x00020000 str r1, [r0, #0x540] ldr r1, =0x00000030 str r1, [r0, #0x544] str r1, [r0, #0x54C] str r1, [r0, #0x554] str r1, [r0, #0x558] str r1, [r0, #0x294] str r1, [r0, #0x298] str r1, [r0, #0x29C] str r1, [r0, #0x2A0] ldr r1, =0x00082030 str r1, [r0, #0x2C0] ldr r0, =MMDC_P0_BASE_ADDR ldr r1, =0x00008000 str r1, [r0, #0x1C] ldr r1, =0xA1390003 str r1, [r0, #0x800] ldr r1, =0x084700C7 str r1, [r0, #0x85C] ldr r1, =0x00400000 str r1, [r0, #0x890] ldr r1, =0x3F393B3C str r1, [r0, #0x848] ldr r1, =0x262C3826 str r1, [r0, #0x850] ldr r1, =0x33333333 str r1, [r0, #0x81C] str r1, [r0, #0x820] str r1, [r0, #0x824] str r1, [r0, #0x828] ldr r1, =0xf3333333 str r1, [r0, #0x82C] str r1, [r0, #0x830] str r1, [r0, #0x834] str r1, [r0, #0x838] ldr r1, =0x24922492 str r1, [r0, #0x8C0] ldr r1, =0x00000800 str r1, [r0, #0x8B8] ldr r1, =0x00020052 str r1, [r0, #0x004] ldr r1, =0x53574333 str r1, [r0, #0x00C] ldr r1, =0x00100B22 str r1, [r0, #0x010] ldr r1, =0x00170778 str r1, [r0, #0x038] ldr r1, =0x00C700DB str r1, [r0, #0x014] ldr r1, =0x00201718 str r1, [r0, #0x018] ldr r1, =0x0F9F26D2 str r1, [r0, #0x02C] ldr r1, =0x009F0E10 str r1, [r0, #0x030] ldr r1, =0x0000005F str r1, [r0, #0x040] ldr r1, =0xC4190000 str r1, [r0, #0x000] ldr r1, =0x20000000 str r1, [r0, #0x83C] ldr r1, =0x00008050 str r1, [r0, #0x01C] ldr r1, =0x00008058 str r1, [r0, #0x01C] ldr r1, =0x003F8030 str r1, [r0, #0x01C] ldr r1, =0x003F8038 str r1, [r0, #0x01C] ldr r1, =0xFF0A8030 str r1, [r0, #0x01C] ldr r1, =0xFF0A8038 str r1, [r0, #0x01C] ldr r1, =0x04028030 str r1, [r0, #0x01C] ldr r1, =0x04028038 str r1, [r0, #0x01C] ldr r1, =0x83018030 str r1, [r0, #0x01C] ldr r1, =0x83018038 str r1, [r0, #0x01C] ldr r1, =0x01038030 str r1, [r0, #0x01C] ldr r1, =0x01038038 str r1, [r0, #0x01C] ldr r1, =0x00001800 str r1, [r0, #0x020] ldr r1, =0xA1390003 str r1, [r0, #0x800] ldr r1, =0x00020052 str r1, [r0, #0x004] ldr r1, =0x00011006 str r1, [r0, #0x404] ldr r1, =0x00000000 str r1, [r0, #0x01C] .endm .macro imx6_clock_gating ldr r0, =CCM_BASE_ADDR ldr r1, =0xffffffff str r1, [r0, #0x068] str r1, [r0, #0x06c] str r1, [r0, #0x070] str r1, [r0, #0x074] str r1, [r0, #0x078] str r1, [r0, #0x07c] str r1, [r0, #0x080] .endm .macro imx6_qos_setting .endm .macro imx6_ddr_setting imx6sll_evk_ddr_setting .endm /* include the common plugin code here */ #include <asm/arch/mx6_plugin.S>
4ms/stm32mp1-baremetal
4,370
third-party/u-boot/u-boot-stm32mp1-baremetal/board/freescale/mx35pdk/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de> * * (C) Copyright 2008-2010 Freescale Semiconductor, Inc. */ #include <config.h> #include <asm/arch/imx-regs.h> #include <generated/asm-offsets.h> #include "mx35pdk.h" #include <asm/arch/lowlevel_macro.S> /* * return soc version * 0x10: TO1 * 0x20: TO2 * 0x30: TO3 */ .macro check_soc_version ret, tmp ldr \tmp, =IIM_BASE_ADDR ldr \ret, [\tmp, #IIM_SREV] cmp \ret, #0x00 moveq \tmp, #ROMPATCH_REV ldreq \ret, [\tmp] moveq \ret, \ret, lsl #4 addne \ret, \ret, #0x10 .endm /* CPLD on CS5 setup */ .macro init_debug_board ldr r0, =DBG_BASE_ADDR ldr r1, =DBG_CSCR_U_CONFIG str r1, [r0, #0x00] ldr r1, =DBG_CSCR_L_CONFIG str r1, [r0, #0x04] ldr r1, =DBG_CSCR_A_CONFIG str r1, [r0, #0x08] .endm /* clock setup */ .macro init_clock ldr r0, =CCM_BASE_ADDR /* default CLKO to 1/32 of the ARM core*/ ldr r1, [r0, #CLKCTL_COSR] bic r1, r1, #0x00000FF00 bic r1, r1, #0x0000000FF mov r2, #0x00006C00 add r2, r2, #0x67 orr r1, r1, r2 str r1, [r0, #CLKCTL_COSR] ldr r2, =CCM_CCMR_CONFIG str r2, [r0, #CLKCTL_CCMR] check_soc_version r1, r2 cmp r1, #CHIP_REV_2_0 ldrhs r3, =CCM_MPLL_532_HZ bhs 1f ldr r2, [r0, #CLKCTL_PDR0] tst r2, #CLKMODE_CONSUMER ldrne r3, =CCM_MPLL_532_HZ /* consumer path*/ ldreq r3, =CCM_MPLL_399_HZ /* auto path*/ 1: str r3, [r0, #CLKCTL_MPCTL] ldr r1, =CCM_PPLL_300_HZ str r1, [r0, #CLKCTL_PPCTL] ldr r1, =CCM_PDR0_CONFIG bic r1, r1, #0x800000 str r1, [r0, #CLKCTL_PDR0] ldr r1, [r0, #CLKCTL_CGR0] orr r1, r1, #0x0C300000 str r1, [r0, #CLKCTL_CGR0] ldr r1, [r0, #CLKCTL_CGR1] orr r1, r1, #0x00000C00 orr r1, r1, #0x00000003 str r1, [r0, #CLKCTL_CGR1] ldr r1, [r0, #CLKCTL_CGR2] orr r1, r1, #0x00C00000 str r1, [r0, #CLKCTL_CGR2] .endm .macro setup_sdram ldr r0, =ESDCTL_BASE_ADDR mov r3, #0x2000 str r3, [r0, #0x0] str r3, [r0, #0x8] /*ip(r12) has used to save lr register in upper calling*/ mov fp, lr mov r5, #0x00 mov r2, #0x00 mov r1, #CSD0_BASE_ADDR bl setup_sdram_bank mov r5, #0x00 mov r2, #0x00 mov r1, #CSD1_BASE_ADDR bl setup_sdram_bank mov lr, fp 1: ldr r3, =ESDCTL_DELAY_LINE5 str r3, [r0, #0x30] .endm .globl lowlevel_init lowlevel_init: mov r10, lr core_init init_aips init_max init_m3if init_clock init_debug_board cmp pc, #PHYS_SDRAM_1 blo init_sdram_start cmp pc, #(PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE) blo skip_sdram_setup init_sdram_start: /*init_sdram*/ setup_sdram skip_sdram_setup: mov lr, r10 mov pc, lr /* * r0: ESDCTL control base, r1: sdram slot base * r2: DDR type(0:DDR2, 1:MDDR) r3, r4:working base */ setup_sdram_bank: mov r3, #0xE tst r2, #0x1 orreq r3, r3, #0x300 /*DDR2*/ str r3, [r0, #0x10] bic r3, r3, #0x00A str r3, [r0, #0x10] beq 2f mov r3, #0x20000 1: subs r3, r3, #1 bne 1b 2: tst r2, #0x1 ldreq r3, =ESDCTL_DDR2_CONFIG ldrne r3, =ESDCTL_MDDR_CONFIG cmp r1, #CSD1_BASE_ADDR strlo r3, [r0, #0x4] strhs r3, [r0, #0xC] ldr r3, =ESDCTL_0x92220000 strlo r3, [r0, #0x0] strhs r3, [r0, #0x8] mov r3, #0xDA ldr r4, =ESDCTL_PRECHARGE strb r3, [r1, r4] tst r2, #0x1 bne skip_set_mode cmp r1, #CSD1_BASE_ADDR ldr r3, =ESDCTL_0xB2220000 strlo r3, [r0, #0x0] strhs r3, [r0, #0x8] mov r3, #0xDA ldr r4, =ESDCTL_DDR2_EMR2 strb r3, [r1, r4] ldr r4, =ESDCTL_DDR2_EMR3 strb r3, [r1, r4] ldr r4, =ESDCTL_DDR2_EN_DLL strb r3, [r1, r4] ldr r4, =ESDCTL_DDR2_RESET_DLL strb r3, [r1, r4] ldr r3, =ESDCTL_0x92220000 strlo r3, [r0, #0x0] strhs r3, [r0, #0x8] mov r3, #0xDA ldr r4, =ESDCTL_PRECHARGE strb r3, [r1, r4] skip_set_mode: cmp r1, #CSD1_BASE_ADDR ldr r3, =ESDCTL_0xA2220000 strlo r3, [r0, #0x0] strhs r3, [r0, #0x8] mov r3, #0xDA strb r3, [r1] strb r3, [r1] ldr r3, =ESDCTL_0xB2220000 strlo r3, [r0, #0x0] strhs r3, [r0, #0x8] tst r2, #0x1 ldreq r4, =ESDCTL_DDR2_MR ldrne r4, =ESDCTL_MDDR_MR mov r3, #0xDA strb r3, [r1, r4] ldreq r4, =ESDCTL_DDR2_OCD_DEFAULT streqb r3, [r1, r4] ldreq r4, =ESDCTL_DDR2_EN_DLL ldrne r4, =ESDCTL_MDDR_EMR strb r3, [r1, r4] cmp r1, #CSD1_BASE_ADDR ldr r3, =ESDCTL_0x82228080 strlo r3, [r0, #0x0] strhs r3, [r0, #0x8] tst r2, #0x1 moveq r4, #0x20000 movne r4, #0x200 1: subs r4, r4, #1 bne 1b str r3, [r1, #0x100] ldr r4, [r1, #0x100] cmp r3, r4 movne r3, #1 moveq r3, #0 mov pc, lr
4ms/stm32mp1-baremetal
2,439
third-party/u-boot/u-boot-stm32mp1-baremetal/board/freescale/m54418twr/sbf_dram_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Board-specific sbf ddr/sdram init. * * (C) Copyright 2017 Angelo Dureghello <angelo@sysam.it> */ .global sbf_dram_init .text sbf_dram_init: move.l #0xFC04002D, %a1 move.b #46, (%a1) /* DDR */ /* slew settings */ move.l #0xEC094060, %a1 move.b #0, (%a1) /* use vco instead of cpu*2 clock for ddr clock */ move.l #0xEC09001A, %a1 move.w #0xE01D, (%a1) /* DDR settings */ move.l #0xFC0B8180, %a1 move.l #0x00000000, (%a1) move.l #0x40000000, (%a1) move.l #0xFC0B81AC, %a1 move.l #0x01030203, (%a1) move.l #0xFC0B8000, %a1 move.l #0x01010101, (%a1)+ /* 0x00 */ move.l #0x00000101, (%a1)+ /* 0x04 */ move.l #0x01010100, (%a1)+ /* 0x08 */ move.l #0x01010000, (%a1)+ /* 0x0C */ move.l #0x00010101, (%a1)+ /* 0x10 */ move.l #0xFC0B8018, %a1 move.l #0x00010100, (%a1)+ /* 0x18 */ move.l #0x00000001, (%a1)+ /* 0x1C */ move.l #0x01000001, (%a1)+ /* 0x20 */ move.l #0x00000100, (%a1)+ /* 0x24 */ move.l #0x00010001, (%a1)+ /* 0x28 */ move.l #0x00000200, (%a1)+ /* 0x2C */ move.l #0x01000002, (%a1)+ /* 0x30 */ move.l #0x00000000, (%a1)+ /* 0x34 */ move.l #0x00000100, (%a1)+ /* 0x38 */ move.l #0x02000100, (%a1)+ /* 0x3C */ move.l #0x02000407, (%a1)+ /* 0x40 */ move.l #0x02030007, (%a1)+ /* 0x44 */ move.l #0x02000100, (%a1)+ /* 0x48 */ move.l #0x0A030203, (%a1)+ /* 0x4C */ move.l #0x00020708, (%a1)+ /* 0x50 */ move.l #0x00050008, (%a1)+ /* 0x54 */ move.l #0x04030002, (%a1)+ /* 0x58 */ move.l #0x00000004, (%a1)+ /* 0x5C */ move.l #0x020A0000, (%a1)+ /* 0x60 */ move.l #0x0C00000E, (%a1)+ /* 0x64 */ move.l #0x00002004, (%a1)+ /* 0x68 */ move.l #0x00000000, (%a1)+ /* 0x6C */ move.l #0x00100010, (%a1)+ /* 0x70 */ move.l #0x00100010, (%a1)+ /* 0x74 */ move.l #0x00000000, (%a1)+ /* 0x78 */ move.l #0x07990000, (%a1)+ /* 0x7C */ move.l #0xFC0B80A0, %a1 move.l #0x00000000, (%a1)+ /* 0xA0 */ move.l #0x00C80064, (%a1)+ /* 0xA4 */ move.l #0x44520002, (%a1)+ /* 0xA8 */ move.l #0x00C80023, (%a1)+ /* 0xAC */ move.l #0xFC0B80B4, %a1 move.l #0x0000C350, (%a1) /* 0xB4 */ move.l #0xFC0B80E0, %a1 move.l #0x04000000, (%a1)+ /* 0xE0 */ move.l #0x03000304, (%a1)+ /* 0xE4 */ move.l #0x40040000, (%a1)+ /* 0xE8 */ move.l #0xC0004004, (%a1)+ /* 0xEC */ move.l #0x0642C000, (%a1)+ /* 0xF0 */ move.l #0x00000642, (%a1)+ /* 0xF4 */ move.l #0xFC0B8024, %a1 tpf move.l #0x01000100, (%a1) /* 0x24 */ move.l #0x2000, %d1 bsr asm_delay rts
4ms/stm32mp1-baremetal
3,952
third-party/u-boot/u-boot-stm32mp1-baremetal/board/freescale/mx7ulp_evk/plugin.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2016 Freescale Semiconductor, Inc. * Copyright 2019 NXP */ #include <config.h> .macro imx7ulp_ddr_freq_decrease ldr r2, =0x403f0000 ldr r3, =0x00000000 str r3, [r2, #0xdc] ldr r2, =0x403e0000 ldr r3, =0x01000020 str r3, [r2, #0x40] ldr r3, =0x01000000 str r3, [r2, #0x500] ldr r3, =0x80808080 str r3, [r2, #0x50c] ldr r3, =0x00160002 str r3, [r2, #0x508] ldr r3, =0x00000001 str r3, [r2, #0x510] ldr r3, =0x00000014 str r3, [r2, #0x514] ldr r3, =0x00000001 str r3, [r2, #0x500] ldr r3, =0x01000000 wait1: ldr r4, [r2, #0x500] and r4, r3 cmp r4, r3 bne wait1 ldr r3, =0x8080801B str r3, [r2, #0x50c] ldr r3, =0x00000040 wait2: ldr r4, [r2, #0x50c] and r4, r3 cmp r4, r3 bne wait2 ldr r3, =0x00000001 str r3, [r2, #0x30] ldr r3, =0x11000020 str r3, [r2, #0x40] ldr r2, =0x403f0000 ldr r3, =0x42000000 str r3, [r2, #0xdc] .endm .macro imx7ulp_evk_ddr_setting imx7ulp_ddr_freq_decrease /* Enable MMDC PCC clock */ ldr r2, =0x40b30000 ldr r3, =0x40000000 str r3, [r2, #0xac] /* Configure DDR pad */ ldr r0, =0x40ad0000 ldr r1, =0x00040000 str r1, [r0, #0x128] ldr r1, =0x0 str r1, [r0, #0xf8] ldr r1, =0x00000180 str r1, [r0, #0xd8] ldr r1, =0x00000180 str r1, [r0, #0x108] ldr r1, =0x00000180 str r1, [r0, #0x104] ldr r1, =0x00010000 str r1, [r0, #0x124] ldr r1, =0x0000018C str r1, [r0, #0x80] ldr r1, =0x0000018C str r1, [r0, #0x84] ldr r1, =0x0000018C str r1, [r0, #0x88] ldr r1, =0x0000018C str r1, [r0, #0x8c] ldr r1, =0x00010000 str r1, [r0, #0x120] ldr r1, =0x00000180 str r1, [r0, #0x10c] ldr r1, =0x00000180 str r1, [r0, #0x110] ldr r1, =0x00000180 str r1, [r0, #0x114] ldr r1, =0x00000180 str r1, [r0, #0x118] ldr r1, =0x00000180 str r1, [r0, #0x90] ldr r1, =0x00000180 str r1, [r0, #0x94] ldr r1, =0x00000180 str r1, [r0, #0x98] ldr r1, =0x00000180 str r1, [r0, #0x9c] ldr r1, =0x00040000 str r1, [r0, #0xe0] ldr r1, =0x00040000 str r1, [r0, #0xe4] ldr r0, =0x40ab0000 ldr r1, =0x00008000 str r1, [r0, #0x1c] ldr r1, =0xA1390003 str r1, [r0, #0x800] ldr r1, =0x0D3900A0 str r1, [r0, #0x85c] ldr r1, =0x00400000 str r1, [r0, #0x890] ldr r1, =0x40404040 str r1, [r0, #0x848] ldr r1, =0x40404040 str r1, [r0, #0x850] ldr r1, =0x33333333 str r1, [r0, #0x81c] ldr r1, =0x33333333 str r1, [r0, #0x820] ldr r1, =0x33333333 str r1, [r0, #0x824] ldr r1, =0x33333333 str r1, [r0, #0x828] ldr r1, =0x24922492 str r1, [r0, #0x8c0] ldr r1, =0x00000800 str r1, [r0, #0x8b8] ldr r1, =0x00020052 str r1, [r0, #0x4] ldr r1, =0x292C42F3 str r1, [r0, #0xc] ldr r1, =0x00100A22 str r1, [r0, #0x10] ldr r1, =0x00120556 str r1, [r0, #0x38] ldr r1, =0x00C700DB str r1, [r0, #0x14] ldr r1, =0x00211718 str r1, [r0, #0x18] ldr r1, =0x0F9F26D2 str r1, [r0, #0x2c] ldr r1, =0x009F0E10 str r1, [r0, #0x30] ldr r1, =0x0000003F str r1, [r0, #0x40] ldr r1, =0xC3190000 str r1, [r0, #0x0] ldr r1, =0x00008010 str r1, [r0, #0x1c] ldr r1, =0x00008018 str r1, [r0, #0x1c] ldr r1, =0x003F8030 str r1, [r0, #0x1c] ldr r1, =0x003F8038 str r1, [r0, #0x1c] ldr r1, =0xFF0A8030 str r1, [r0, #0x1c] ldr r1, =0xFF0A8038 str r1, [r0, #0x1c] ldr r1, =0x04028030 str r1, [r0, #0x1c] ldr r1, =0x04028038 str r1, [r0, #0x1c] ldr r1, =0x83018030 str r1, [r0, #0x1c] ldr r1, =0x83018038 str r1, [r0, #0x1c] ldr r1, =0x01038030 str r1, [r0, #0x1c] ldr r1, =0x01038038 str r1, [r0, #0x1c] ldr r1, =0x20000000 str r1, [r0, #0x83c] ldr r1, =0x00001800 str r1, [r0, #0x20] ldr r1, =0xA1310000 str r1, [r0, #0x800] ldr r1, =0x00020052 str r1, [r0, #0x4] ldr r1, =0x00011006 str r1, [r0, #0x404] ldr r1, =0x00000000 str r1, [r0, #0x1c] .endm .macro imx7ulp_clock_gating .endm .macro imx7ulp_qos_setting .endm .macro imx7ulp_ddr_setting imx7ulp_evk_ddr_setting .endm /* include the common plugin code here */ #include <asm/arch/mx7ulp_plugin.S>
4ms/stm32mp1-baremetal
1,710
third-party/u-boot/u-boot-stm32mp1-baremetal/board/freescale/m54451evb/sbf_dram_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Board-specific sbf ddr/sdram init. * * (C) Copyright 2017 Angelo Dureghello <angelo@sysam.it> */ #include <config.h> .global sbf_dram_init .text sbf_dram_init: /* Dram Initialization a1, a2, and d0 */ /* mscr sdram */ move.l #0xFC0A4074, %a1 move.b #(CONFIG_SYS_SDRAM_DRV_STRENGTH), (%a1) nop /* SDRAM Chip 0 and 1 */ move.l #0xFC0B8110, %a1 move.l #0xFC0B8114, %a2 /* calculate the size */ move.l #0x13, %d1 move.l #(CONFIG_SYS_SDRAM_SIZE), %d2 #ifdef CONFIG_SYS_SDRAM_BASE1 lsr.l #1, %d2 #endif dramsz_loop: lsr.l #1, %d2 add.l #1, %d1 cmp.l #1, %d2 bne dramsz_loop #ifdef CONFIG_SYS_NAND_BOOT beq asm_nand_chk_status #endif /* SDRAM Chip 0 and 1 */ move.l #(CONFIG_SYS_SDRAM_BASE), (%a1) or.l %d1, (%a1) #ifdef CONFIG_SYS_SDRAM_BASE1 move.l #(CONFIG_SYS_SDRAM_BASE1), (%a2) or.l %d1, (%a2) #endif nop /* dram cfg1 and cfg2 */ move.l #0xFC0B8008, %a1 move.l #(CONFIG_SYS_SDRAM_CFG1), (%a1) nop move.l #0xFC0B800C, %a2 move.l #(CONFIG_SYS_SDRAM_CFG2), (%a2) nop move.l #0xFC0B8000, %a1 /* Mode */ move.l #0xFC0B8004, %a2 /* Ctrl */ /* Issue PALL */ move.l #(CONFIG_SYS_SDRAM_CTRL + 2), (%a2) nop move.l #1000, %d1 bsr asm_delay /* Issue PALL */ move.l #(CONFIG_SYS_SDRAM_CTRL + 2), (%a2) nop /* Perform two refresh cycles */ move.l #(CONFIG_SYS_SDRAM_CTRL + 4), %d0 nop move.l %d0, (%a2) move.l %d0, (%a2) nop /* Issue LEMR */ move.l #(CONFIG_SYS_SDRAM_MODE), (%a1) nop move.l #(CONFIG_SYS_SDRAM_EMOD), (%a1) move.l #500, %d1 bsr asm_delay move.l #(CONFIG_SYS_SDRAM_CTRL), %d1 and.l #0x7FFFFFFF, %d1 or.l #0x10000C00, %d1 move.l %d1, (%a2) nop move.l #2000, %d1 bsr asm_delay rts
4ms/stm32mp1-baremetal
2,715
third-party/u-boot/u-boot-stm32mp1-baremetal/board/freescale/mx6ullevk/plugin.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2016 Freescale Semiconductor, Inc. */ #include <config.h> /* DDR script */ .macro imx6ull_ddr3_evk_setting ldr r0, =IOMUXC_BASE_ADDR ldr r1, =0x000C0000 str r1, [r0, #0x4B4] ldr r1, =0x00000000 str r1, [r0, #0x4AC] ldr r1, =0x00000030 str r1, [r0, #0x27C] ldr r1, =0x00000030 str r1, [r0, #0x250] str r1, [r0, #0x24C] str r1, [r0, #0x490] ldr r1, =0x000C0030 str r1, [r0, #0x288] ldr r1, =0x00000000 str r1, [r0, #0x270] ldr r1, =0x00000030 str r1, [r0, #0x260] str r1, [r0, #0x264] str r1, [r0, #0x4A0] ldr r1, =0x00020000 str r1, [r0, #0x494] ldr r1, =0x00000030 str r1, [r0, #0x280] ldr r1, =0x00000030 str r1, [r0, #0x284] ldr r1, =0x00020000 str r1, [r0, #0x4B0] ldr r1, =0x00000030 str r1, [r0, #0x498] str r1, [r0, #0x4A4] str r1, [r0, #0x244] str r1, [r0, #0x248] ldr r0, =MMDC_P0_BASE_ADDR ldr r1, =0x00008000 str r1, [r0, #0x1C] ldr r1, =0xA1390003 str r1, [r0, #0x800] ldr r1, =0x00000004 str r1, [r0, #0x80C] ldr r1, =0x41640158 str r1, [r0, #0x83C] ldr r1, =0x40403237 str r1, [r0, #0x848] ldr r1, =0x40403C33 str r1, [r0, #0x850] ldr r1, =0x33333333 str r1, [r0, #0x81C] str r1, [r0, #0x820] ldr r1, =0xF3333333 str r1, [r0, #0x82C] str r1, [r0, #0x830] ldr r1, =0x00944009 str r1, [r0, #0x8C0] ldr r1, =0x00000800 str r1, [r0, #0x8B8] ldr r1, =0x0002002D str r1, [r0, #0x004] ldr r1, =0x1B333030 str r1, [r0, #0x008] ldr r1, =0x676B52F3 str r1, [r0, #0x00C] ldr r1, =0xB66D0B63 str r1, [r0, #0x010] ldr r1, =0x01FF00DB str r1, [r0, #0x014] ldr r1, =0x00201740 str r1, [r0, #0x018] ldr r1, =0x00008000 str r1, [r0, #0x01C] ldr r1, =0x000026D2 str r1, [r0, #0x02C] ldr r1, =0x006B1023 str r1, [r0, #0x030] ldr r1, =0x0000004F str r1, [r0, #0x040] ldr r1, =0x84180000 str r1, [r0, #0x000] ldr r1, =0x00400000 str r1, [r0, #0x890] ldr r1, =0x02008032 str r1, [r0, #0x01C] ldr r1, =0x00008033 str r1, [r0, #0x01C] ldr r1, =0x00048031 str r1, [r0, #0x01C] ldr r1, =0x15208030 str r1, [r0, #0x01C] ldr r1, =0x04008040 str r1, [r0, #0x01C] ldr r1, =0x00000800 str r1, [r0, #0x020] ldr r1, =0x00000227 str r1, [r0, #0x818] ldr r1, =0x0002552D str r1, [r0, #0x004] ldr r1, =0x00011006 str r1, [r0, #0x404] ldr r1, =0x00000000 str r1, [r0, #0x01C] .endm .macro imx6_clock_gating ldr r0, =CCM_BASE_ADDR ldr r1, =0xFFFFFFFF str r1, [r0, #0x68] str r1, [r0, #0x6C] str r1, [r0, #0x70] str r1, [r0, #0x74] str r1, [r0, #0x78] str r1, [r0, #0x7C] str r1, [r0, #0x80] .endm .macro imx6_qos_setting .endm .macro imx6_ddr_setting imx6ull_ddr3_evk_setting .endm /* include the common plugin code here */ #include <asm/arch/mx6_plugin.S>
4ms/stm32mp1-baremetal
2,612
third-party/u-boot/u-boot-stm32mp1-baremetal/board/renesas/r2dplus/lowlevel_init.S
/* * modified from SH-IPL+g (init-r0p751rlc0011rl.S) * Initial Register Data for R0P751RLC0011RL (SH7751R 240MHz/120MHz/60MHz) * Coyright (c) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> */ #include <config.h> #include <asm/processor.h> #include <asm/macro.h> .global lowlevel_init .text .align 2 lowlevel_init: write32 CCR_A, CCR_D_D write32 MMUCR_A, MMUCR_D write32 BCR1_A, BCR1_D write16 BCR2_A, BCR2_D write16 BCR3_A, BCR3_D write32 BCR4_A, BCR4_D write32 WCR1_A, WCR1_D write32 WCR2_A, WCR2_D write32 WCR3_A, WCR3_D write16 PCR_A, PCR_D write16 LED_A, LED_D write32 MCR_A, MCR_D1 write16 RTCNT_A, RTCNT_D write16 RTCOR_A, RTCOR_D write16 RFCR_A, RFCR_D write16 RTCSR_A, RTCSR_D write8 SDMR3_A, SDMR3_D0 /* Wait DRAM refresh 30 times */ mov.l RFCR_A, r1 mov #30, r3 1: mov.w @r1, r0 extu.w r0, r2 cmp/hi r3, r2 bf 1b write32 MCR_A, MCR_D2 write8 SDMR3_A, SDMR3_D1 write32 IRLMASK_A, IRLMASK_D write32 CCR_A, CCR_D_E rts nop .align 2 CCR_A: .long CCR /* Cache Control Register */ CCR_D_D: .long 0x0808 /* Flush the cache, disable */ CCR_D_E: .long 0x8000090B FRQCR_A: .long FRQCR /* FRQCR Address */ FRQCR_D: .long 0x00000e0a /* 03/07/15 modify */ BCR1_A: .long BCR1 /* BCR1 Address */ BCR1_D: .long 0x00180008 BCR2_A: .long BCR2 /* BCR2 Address */ BCR2_D: .long 0xabe8 BCR3_A: .long BCR3 /* BCR3 Address */ BCR3_D: .long 0x0000 BCR4_A: .long BCR4 /* BCR4 Address */ BCR4_D: .long 0x00000010 WCR1_A: .long WCR1 /* WCR1 Address */ WCR1_D: .long 0x33343333 WCR2_A: .long WCR2 /* WCR2 Address */ WCR2_D: .long 0xcff86fbf WCR3_A: .long WCR3 /* WCR3 Address */ WCR3_D: .long 0x07777707 LED_A: .long 0x04000036 /* LED Address */ LED_D: .long 0xFF /* LED Data */ RTCNT_A: .long RTCNT /* RTCNT Address */ RTCNT_D: .word 0xA500 /* RTCNT Write Code A5h Data 00h */ .align 2 RTCOR_A: .long RTCOR /* RTCOR Address */ RTCOR_D: .word 0xA534 /* RTCOR Write Code */ .align 2 RTCSR_A: .long RTCSR /* RTCSR Address */ RTCSR_D: .word 0xA510 /* RTCSR Write Code */ .align 2 SDMR3_A: .long 0xFF9400CC /* SDMR3 Address */ SDMR3_D0: .long 0x55 SDMR3_D1: .long 0x00 MCR_A: .long MCR /* MCR Address */ MCR_D1: .long 0x081901F4 /* MRSET:'0' */ MCR_D2: .long 0x481901F4 /* MRSET:'1' */ RFCR_A: .long RFCR /* RFCR Address */ RFCR_D: .long 0xA400 /* RFCR Write Code A4h Data 00h */ PCR_A: .long PCR /* PCR Address */ PCR_D: .long 0x0000 MMUCR_A: .long MMUCR /* MMUCCR Address */ MMUCR_D: .long 0x00000000 /* MMUCCR Data */ IRLMASK_A: .long 0xA4000000 /* IRLMASK Address */ IRLMASK_D: .long 0x00000000 /* IRLMASK Data */
4ms/stm32mp1-baremetal
4,022
third-party/u-boot/u-boot-stm32mp1-baremetal/board/renesas/MigoR/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2007-2008 * Nobuhiro Iwamatsu <iwamatsu@nigauri.org> * * Copyright (C) 2007 * Kenati Technologies, Inc. * * board/MigoR/lowlevel_init.S */ #include <config.h> #include <asm/processor.h> #include <asm/macro.h> /* * Board specific low level init code, called _very_ early in the * startup sequence. Relocation to SDRAM has not happened yet, no * stack is available, bss section has not been initialised, etc. * * (Note: As no stack is available, no subroutines can be called...). */ .global lowlevel_init .text .align 2 lowlevel_init: write32 CCR_A, CCR_D ! Address of Cache Control Register ! Instruction Cache Invalidate write32 MMUCR_A, MMUCR_D ! Address of MMU Control Register ! TI == TLB Invalidate bit write32 MSTPCR0_A, MSTPCR0_D ! Address of Power Control Register 0 write32 MSTPCR2_A, MSTPCR2_D ! Address of Power Control Register 2 write16 PFC_PULCR_A, PFC_PULCR_D write16 PFC_DRVCR_A, PFC_DRVCR_D write16 SBSCR_A, SBSCR_D write16 PSCR_A, PSCR_D write16 RWTCSR_A, RWTCSR_D_1 ! 0xA4520004 (Watchdog Control / Status Register) ! 0xA507 -> timer_STOP / WDT_CLK = max write16 RWTCNT_A, RWTCNT_D ! 0xA4520000 (Watchdog Count Register) ! 0x5A00 -> Clear write16 RWTCSR_A, RWTCSR_D_2 ! 0xA4520004 (Watchdog Control / Status Register) ! 0xA504 -> timer_STOP / CLK = 500ms write32 DLLFRQ_A, DLLFRQ_D ! 20080115 ! 20080115 write32 FRQCR_A, FRQCR_D ! 0xA4150000 Frequency control register ! 20080115 write32 CCR_A, CCR_D_2 ! Address of Cache Control Register ! ?? bsc_init: write32 CMNCR_A, CMNCR_D write32 CS0BCR_A, CS0BCR_D write32 CS4BCR_A, CS4BCR_D write32 CS5ABCR_A, CS5ABCR_D write32 CS5BBCR_A, CS5BBCR_D write32 CS6ABCR_A, CS6ABCR_D write32 CS0WCR_A, CS0WCR_D write32 CS4WCR_A, CS4WCR_D write32 CS5AWCR_A, CS5AWCR_D write32 CS5BWCR_A, CS5BWCR_D write32 CS6AWCR_A, CS6AWCR_D ! SDRAM initialization write32 SDCR_A, SDCR_D write32 SDWCR_A, SDWCR_D write32 SDPCR_A, SDPCR_D write32 RTCOR_A, RTCOR_D write32 RTCNT_A, RTCNT_D write32 RTCSR_A, RTCSR_D write32 RFCR_A, RFCR_D write8 SDMR3_A, SDMR3_D ! BL bit off (init = ON) (?!?) stc sr, r0 ! BL bit off(init=ON) mov.l SR_MASK_D, r1 and r1, r0 ldc r0, sr rts mov #0, r0 .align 4 CCR_A: .long CCR MMUCR_A: .long MMUCR MSTPCR0_A: .long MSTPCR0 MSTPCR2_A: .long MSTPCR2 PFC_PULCR_A: .long PULCR PFC_DRVCR_A: .long DRVCR SBSCR_A: .long SBSCR PSCR_A: .long PSCR RWTCSR_A: .long RWTCSR RWTCNT_A: .long RWTCNT FRQCR_A: .long FRQCR PLLCR_A: .long PLLCR DLLFRQ_A: .long DLLFRQ CCR_D: .long 0x00000800 CCR_D_2: .long 0x00000103 MMUCR_D: .long 0x00000004 MSTPCR0_D: .long 0x00001001 MSTPCR2_D: .long 0xffffffff PFC_PULCR_D: .long 0x6000 PFC_DRVCR_D: .long 0x0464 FRQCR_D: .long 0x07033639 PLLCR_D: .long 0x00005000 DLLFRQ_D: .long 0x000004F6 CMNCR_A: .long CMNCR CMNCR_D: .long 0x0000001B CS0BCR_A: .long CS0BCR CS0BCR_D: .long 0x24920400 CS4BCR_A: .long CS4BCR CS4BCR_D: .long 0x00003400 CS5ABCR_A: .long CS5ABCR CS5ABCR_D: .long 0x24920400 CS5BBCR_A: .long CS5BBCR CS5BBCR_D: .long 0x24920400 CS6ABCR_A: .long CS6ABCR CS6ABCR_D: .long 0x24920400 CS0WCR_A: .long CS0WCR CS0WCR_D: .long 0x00000380 CS4WCR_A: .long CS4WCR CS4WCR_D: .long 0x00110080 CS5AWCR_A: .long CS5AWCR CS5AWCR_D: .long 0x00000300 CS5BWCR_A: .long CS5BWCR CS5BWCR_D: .long 0x00000300 CS6AWCR_A: .long CS6AWCR CS6AWCR_D: .long 0x00000300 SDCR_A: .long SBSC_SDCR SDCR_D: .long 0x80160809 SDWCR_A: .long SBSC_SDWCR SDWCR_D: .long 0x0014450C SDPCR_A: .long SBSC_SDPCR SDPCR_D: .long 0x00000087 RTCOR_A: .long SBSC_RTCOR RTCNT_A: .long SBSC_RTCNT RTCNT_D: .long 0xA55A0012 RTCOR_D: .long 0xA55A001C RTCSR_A: .long SBSC_RTCSR RFCR_A: .long SBSC_RFCR RFCR_D: .long 0xA55A0221 RTCSR_D: .long 0xA55A009a SDMR3_A: .long 0xFE581180 SDMR3_D: .long 0x0 SR_MASK_D: .long 0xEFFFFF0F .align 2 SBSCR_D: .word 0x0044 PSCR_D: .word 0x0000 RWTCSR_D_1: .word 0xA507 RWTCSR_D_2: .word 0xA504 RWTCNT_D: .word 0x5A00
4ms/stm32mp1-baremetal
2,867
third-party/u-boot/u-boot-stm32mp1-baremetal/board/renesas/grpeach/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2017 Renesas Electronics * Copyright (C) 2017 Chris Brandt */ #include <config.h> #include <version.h> #include <asm/macro.h> /* Watchdog Registers */ #define RZA1_WDT_BASE 0xFCFE0000 #define WTCSR (RZA1_WDT_BASE + 0x00) /* Watchdog Timer Control Register */ #define WTCNT (RZA1_WDT_BASE + 0x02) /* Watchdog Timer Counter Register */ #define WRCSR (RZA1_WDT_BASE + 0x04) /* Watchdog Reset Control Register */ /* Standby controller registers (chapter 55) */ #define RZA1_STBCR_BASE 0xFCFE0020 #define STBCR1 (RZA1_STBCR_BASE + 0x00) #define STBCR2 (RZA1_STBCR_BASE + 0x04) #define STBCR3 (RZA1_STBCR_BASE + 0x400) #define STBCR4 (RZA1_STBCR_BASE + 0x404) #define STBCR5 (RZA1_STBCR_BASE + 0x408) #define STBCR6 (RZA1_STBCR_BASE + 0x40c) #define STBCR7 (RZA1_STBCR_BASE + 0x410) #define STBCR8 (RZA1_STBCR_BASE + 0x414) #define STBCR9 (RZA1_STBCR_BASE + 0x418) #define STBCR10 (RZA1_STBCR_BASE + 0x41c) #define STBCR11 (RZA1_STBCR_BASE + 0x420) #define STBCR12 (RZA1_STBCR_BASE + 0x424) #define STBCR13 (RZA1_STBCR_BASE + 0x450) /* Clock Registers */ #define RZA1_FRQCR_BASE 0xFCFE0010 #define FRQCR (RZA1_FRQCR_BASE + 0x00) #define FRQCR2 (RZA1_FRQCR_BASE + 0x04) #define SYSCR1 0xFCFE0400 /* System control register 1 */ #define SYSCR2 0xFCFE0404 /* System control register 2 */ #define SYSCR3 0xFCFE0408 /* System control register 3 */ /* Disable WDT */ #define WTCSR_D 0xA518 #define WTCNT_D 0x5A00 /* Enable all peripheral clocks */ #define STBCR3_D 0x00000000 #define STBCR4_D 0x00000000 #define STBCR5_D 0x00000000 #define STBCR6_D 0x00000000 #define STBCR7_D 0x00000024 #define STBCR8_D 0x00000005 #define STBCR9_D 0x00000000 #define STBCR10_D 0x00000000 #define STBCR11_D 0x000000c0 #define STBCR12_D 0x000000f0 /* * Set all system clocks to full speed. * On reset, the CPU will be running at 1/2 speed. * In the Hardware Manual, see Table 6.3 Settable Frequency Ranges */ #define FRQCR_D 0x0035 #define FRQCR2_D 0x0001 .global lowlevel_init .text .align 2 lowlevel_init: /* PL310 init */ write32 0x3fffff80, 0x00000001 /* Disable WDT */ write16 WTCSR, WTCSR_D write16 WTCNT, WTCNT_D /* Set clocks */ write16 FRQCR, FRQCR_D write16 FRQCR2, FRQCR2_D /* Enable all peripherals(Standby Control) */ write8 STBCR3, STBCR3_D write8 STBCR4, STBCR4_D write8 STBCR5, STBCR5_D write8 STBCR6, STBCR6_D write8 STBCR7, STBCR7_D write8 STBCR8, STBCR8_D write8 STBCR9, STBCR9_D write8 STBCR10, STBCR10_D write8 STBCR11, STBCR11_D write8 STBCR12, STBCR12_D /* For serial booting, enable read ahead caching to speed things up */ #define DRCR_0 0x3FEFA00C write32 DRCR_0, 0x00010100 /* Read Burst ON, Length=2 */ /* Enable all internal RAM */ write8 SYSCR1, 0xFF write8 SYSCR2, 0xFF write8 SYSCR3, 0xFF nop /* back to arch calling code */ mov pc, lr .align 4
4ms/stm32mp1-baremetal
9,529
third-party/u-boot/u-boot-stm32mp1-baremetal/board/renesas/sh7753evb/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2013 Renesas Solutions Corp. */ #include <config.h> #include <asm/processor.h> #include <asm/macro.h> .macro or32, addr, data mov.l \addr, r1 mov.l \data, r0 mov.l @r1, r2 or r2, r0 mov.l r0, @r1 .endm .macro wait_DBCMD mov.l DBWAIT_A, r0 mov.l @r0, r1 .endm .global lowlevel_init .section .spiboot1.text .align 2 lowlevel_init: mov #0, r14 mova 2f, r0 mov.l PC_MASK, r1 tst r0, r1 bf 2f bra exit_pmb nop .align 2 /* If CPU runs on SDRAM (PC=0x5???????) or not. */ PC_MASK: .long 0x20000000 2: mov #1, r14 mov.l EXPEVT_A, r0 mov.l @r0, r0 mov.l EXPEVT_POWER_ON_RESET, r1 cmp/eq r0, r1 bt 1f /* * If EXPEVT value is manual reset or tlb multipul-hit, * initialization of DBSC3 is not necessary. */ bra exit_ddr nop 1: /*------- Reset -------*/ write32 MRSTCR0_A, MRSTCR0_D write32 MRSTCR1_A, MRSTCR1_D /* For Core Reset */ mov.l DBACEN_A, r0 mov.l @r0, r0 cmp/eq #0, r0 bt 3f /* * If DBACEN == 1(DBSC was already enabled), we have to avoid the * initialization of DDR3-SDRAM. */ bra exit_ddr nop 3: /*------- DBSC3 -------*/ /* oscillation stabilization time */ wait_timer WAIT_OSC_TIME /* step 3 */ write32 DBKIND_A, DBKIND_D /* step 4 */ write32 DBCONF_A, DBCONF_D write32 DBTR0_A, DBTR0_D write32 DBTR1_A, DBTR1_D write32 DBTR2_A, DBTR2_D write32 DBTR3_A, DBTR3_D write32 DBTR4_A, DBTR4_D write32 DBTR5_A, DBTR5_D write32 DBTR6_A, DBTR6_D write32 DBTR7_A, DBTR7_D write32 DBTR8_A, DBTR8_D write32 DBTR9_A, DBTR9_D write32 DBTR10_A, DBTR10_D write32 DBTR11_A, DBTR11_D write32 DBTR12_A, DBTR12_D write32 DBTR13_A, DBTR13_D write32 DBTR14_A, DBTR14_D write32 DBTR15_A, DBTR15_D write32 DBTR16_A, DBTR16_D write32 DBTR17_A, DBTR17_D write32 DBTR18_A, DBTR18_D write32 DBTR19_A, DBTR19_D write32 DBRNK0_A, DBRNK0_D write32 DBADJ0_A, DBADJ0_D write32 DBADJ2_A, DBADJ2_D /* step 5 */ write32 DBCMD_A, DBCMD_RSTL_VAL wait_timer WAIT_30US /* step 6 */ write32 DBCMD_A, DBCMD_PDEN_VAL /* step 7 */ write32 DBPDCNT3_A, DBPDCNT3_D /* step 8 */ write32 DBPDCNT1_A, DBPDCNT1_D write32 DBPDCNT2_A, DBPDCNT2_D write32 DBPDLCK_A, DBPDLCK_D write32 DBPDRGA_A, DBPDRGA_D write32 DBPDRGD_A, DBPDRGD_D /* step 9 */ wait_timer WAIT_30US /* step 10 */ write32 DBPDCNT0_A, DBPDCNT0_D /* step 11 */ wait_timer WAIT_30US wait_timer WAIT_30US /* step 12 */ write32 DBCMD_A, DBCMD_WAIT_VAL wait_DBCMD /* step 13 */ write32 DBCMD_A, DBCMD_RSTH_VAL wait_DBCMD /* step 14 */ write32 DBCMD_A, DBCMD_WAIT_VAL write32 DBCMD_A, DBCMD_WAIT_VAL write32 DBCMD_A, DBCMD_WAIT_VAL write32 DBCMD_A, DBCMD_WAIT_VAL /* step 15 */ write32 DBCMD_A, DBCMD_PDXT_VAL /* step 16 */ write32 DBCMD_A, DBCMD_MRS2_VAL /* step 17 */ write32 DBCMD_A, DBCMD_MRS3_VAL /* step 18 */ write32 DBCMD_A, DBCMD_MRS1_VAL /* step 19 */ write32 DBCMD_A, DBCMD_MRS0_VAL write32 DBPDNCNF_A, DBPDNCNF_D /* step 20 */ write32 DBCMD_A, DBCMD_ZQCL_VAL write32 DBCMD_A, DBCMD_REF_VAL write32 DBCMD_A, DBCMD_REF_VAL wait_DBCMD /* step 21 */ write32 DBCALTR_A, DBCALTR_D /* step 22 */ write32 DBRFCNF0_A, DBRFCNF0_D write32 DBRFCNF1_A, DBRFCNF1_D write32 DBRFCNF2_A, DBRFCNF2_D /* step 23 */ write32 DBCALCNF_A, DBCALCNF_D /* step 24 */ write32 DBRFEN_A, DBRFEN_D write32 DBCMD_A, DBCMD_SRXT_VAL /* step 25 */ write32 DBACEN_A, DBACEN_D /* step 26 */ wait_DBCMD bra exit_ddr nop .align 2 EXPEVT_A: .long 0xff000024 EXPEVT_POWER_ON_RESET: .long 0x00000000 /*------- Reset -------*/ MRSTCR0_A: .long 0xffd50030 MRSTCR0_D: .long 0xfe1ffe7f MRSTCR1_A: .long 0xffd50034 MRSTCR1_D: .long 0xfff3ffff /*------- DBSC3 -------*/ DBCMD_A: .long 0xfe800018 DBKIND_A: .long 0xfe800020 DBCONF_A: .long 0xfe800024 DBTR0_A: .long 0xfe800040 DBTR1_A: .long 0xfe800044 DBTR2_A: .long 0xfe800048 DBTR3_A: .long 0xfe800050 DBTR4_A: .long 0xfe800054 DBTR5_A: .long 0xfe800058 DBTR6_A: .long 0xfe80005c DBTR7_A: .long 0xfe800060 DBTR8_A: .long 0xfe800064 DBTR9_A: .long 0xfe800068 DBTR10_A: .long 0xfe80006c DBTR11_A: .long 0xfe800070 DBTR12_A: .long 0xfe800074 DBTR13_A: .long 0xfe800078 DBTR14_A: .long 0xfe80007c DBTR15_A: .long 0xfe800080 DBTR16_A: .long 0xfe800084 DBTR17_A: .long 0xfe800088 DBTR18_A: .long 0xfe80008c DBTR19_A: .long 0xfe800090 DBRNK0_A: .long 0xfe800100 DBPDCNT0_A: .long 0xfe800200 DBPDCNT1_A: .long 0xfe800204 DBPDCNT2_A: .long 0xfe800208 DBPDCNT3_A: .long 0xfe80020c DBPDLCK_A: .long 0xfe800280 DBPDRGA_A: .long 0xfe800290 DBPDRGD_A: .long 0xfe8002a0 DBADJ0_A: .long 0xfe8000c0 DBADJ2_A: .long 0xfe8000c8 DBRFCNF0_A: .long 0xfe8000e0 DBRFCNF1_A: .long 0xfe8000e4 DBRFCNF2_A: .long 0xfe8000e8 DBCALCNF_A: .long 0xfe8000f4 DBRFEN_A: .long 0xfe800014 DBACEN_A: .long 0xfe800010 DBWAIT_A: .long 0xfe80001c DBCALTR_A: .long 0xfe8000f8 DBPDNCNF_A: .long 0xfe800180 WAIT_OSC_TIME: .long 6000 WAIT_30US: .long 13333 DBCMD_RSTL_VAL: .long 0x20000000 DBCMD_PDEN_VAL: .long 0x1000d73c DBCMD_WAIT_VAL: .long 0x0000d73c DBCMD_RSTH_VAL: .long 0x2100d73c DBCMD_PDXT_VAL: .long 0x110000c8 DBCMD_MRS0_VAL: .long 0x28000930 DBCMD_MRS1_VAL: .long 0x29000004 DBCMD_MRS2_VAL: .long 0x2a000008 DBCMD_MRS3_VAL: .long 0x2b000000 DBCMD_ZQCL_VAL: .long 0x03000200 DBCMD_REF_VAL: .long 0x0c000000 DBCMD_SRXT_VAL: .long 0x19000000 DBKIND_D: .long 0x00000007 DBCONF_D: .long 0x0f030a01 DBTR0_D: .long 0x00000007 DBTR1_D: .long 0x00000006 DBTR2_D: .long 0x00000000 DBTR3_D: .long 0x00000007 DBTR4_D: .long 0x00070007 DBTR5_D: .long 0x0000001b DBTR6_D: .long 0x00000014 DBTR7_D: .long 0x00000004 DBTR8_D: .long 0x00000014 DBTR9_D: .long 0x00000004 DBTR10_D: .long 0x00000008 DBTR11_D: .long 0x00000007 DBTR12_D: .long 0x0000000e DBTR13_D: .long 0x000000a0 DBTR14_D: .long 0x00060006 DBTR15_D: .long 0x00000003 DBTR16_D: .long 0x00160002 DBTR17_D: .long 0x000c0000 DBTR18_D: .long 0x00000200 DBTR19_D: .long 0x00000040 DBRNK0_D: .long 0x00000001 DBPDCNT0_D: .long 0x00000001 DBPDCNT1_D: .long 0x00000001 DBPDCNT2_D: .long 0x00000000 DBPDCNT3_D: .long 0x00004010 DBPDLCK_D: .long 0x0000a55a DBPDRGA_D: .long 0x00000028 DBPDRGD_D: .long 0x00017100 DBADJ0_D: .long 0x00010000 DBADJ2_D: .long 0x18061806 DBRFCNF0_D: .long 0x000001ff DBRFCNF1_D: .long 0x00081040 DBRFCNF2_D: .long 0x00000000 DBCALCNF_D: .long 0x0000ffff DBRFEN_D: .long 0x00000001 DBACEN_D: .long 0x00000001 DBCALTR_D: .long 0x08200820 DBPDNCNF_D: .long 0x00000001 .align 2 exit_ddr: #if defined(CONFIG_SH_32BIT) /*------- set PMB -------*/ write32 PASCR_A, PASCR_29BIT_D write32 MMUCR_A, MMUCR_D /***************************************************************** * ent virt phys v sz c wt * 0 0xa0000000 0x00000000 1 128M 0 1 * 1 0xa8000000 0x48000000 1 128M 0 1 * 5 0x88000000 0x48000000 1 128M 1 1 */ write32 PMB_ADDR_SPIBOOT_A, PMB_ADDR_SPIBOOT_D write32 PMB_DATA_SPIBOOT_A, PMB_DATA_SPIBOOT_D write32 PMB_ADDR_DDR_C1_A, PMB_ADDR_DDR_C1_D write32 PMB_DATA_DDR_C1_A, PMB_DATA_DDR_C1_D write32 PMB_ADDR_DDR_N1_A, PMB_ADDR_DDR_N1_D write32 PMB_DATA_DDR_N1_A, PMB_DATA_DDR_N1_D write32 PMB_ADDR_ENTRY2, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY3, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY4, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY6, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY7, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY8, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY9, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY10, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY11, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY12, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY13, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY14, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY15, PMB_ADDR_NOT_USE_D write32 PASCR_A, PASCR_INIT mov.l DUMMY_ADDR, r0 icbi @r0 #endif /* if defined(CONFIG_SH_32BIT) */ exit_pmb: /* CPU is running on ILRAM? */ mov r14, r0 tst #1, r0 bt 1f mov.l _stack_ilram, r15 mov.l _spiboot_main, r0 100: bsrf r0 nop .align 2 _spiboot_main: .long (spiboot_main - (100b + 4)) _stack_ilram: .long 0xe5204000 1: write32 CCR_A, CCR_D rts nop .align 2 #if defined(CONFIG_SH_32BIT) /*------- set PMB -------*/ PMB_ADDR_SPIBOOT_A: .long PMB_ADDR_BASE(0) PMB_ADDR_DDR_N1_A: .long PMB_ADDR_BASE(1) PMB_ADDR_DDR_C1_A: .long PMB_ADDR_BASE(5) PMB_ADDR_ENTRY2: .long PMB_ADDR_BASE(2) PMB_ADDR_ENTRY3: .long PMB_ADDR_BASE(3) PMB_ADDR_ENTRY4: .long PMB_ADDR_BASE(4) PMB_ADDR_ENTRY6: .long PMB_ADDR_BASE(6) PMB_ADDR_ENTRY7: .long PMB_ADDR_BASE(7) PMB_ADDR_ENTRY8: .long PMB_ADDR_BASE(8) PMB_ADDR_ENTRY9: .long PMB_ADDR_BASE(9) PMB_ADDR_ENTRY10: .long PMB_ADDR_BASE(10) PMB_ADDR_ENTRY11: .long PMB_ADDR_BASE(11) PMB_ADDR_ENTRY12: .long PMB_ADDR_BASE(12) PMB_ADDR_ENTRY13: .long PMB_ADDR_BASE(13) PMB_ADDR_ENTRY14: .long PMB_ADDR_BASE(14) PMB_ADDR_ENTRY15: .long PMB_ADDR_BASE(15) PMB_ADDR_SPIBOOT_D: .long mk_pmb_addr_val(0xa0) PMB_ADDR_DDR_C1_D: .long mk_pmb_addr_val(0x88) PMB_ADDR_DDR_N1_D: .long mk_pmb_addr_val(0xa8) PMB_ADDR_NOT_USE_D: .long 0x00000000 PMB_DATA_SPIBOOT_A: .long PMB_DATA_BASE(0) PMB_DATA_DDR_N1_A: .long PMB_DATA_BASE(1) PMB_DATA_DDR_C1_A: .long PMB_DATA_BASE(5) /* ppn ub v s1 s0 c wt */ PMB_DATA_SPIBOOT_D: .long mk_pmb_data_val(0x00, 0, 1, 1, 0, 0, 1) PMB_DATA_DDR_C1_D: .long mk_pmb_data_val(0x48, 0, 1, 1, 0, 1, 1) PMB_DATA_DDR_N1_D: .long mk_pmb_data_val(0x48, 1, 1, 1, 0, 0, 1) PASCR_A: .long 0xff000070 DUMMY_ADDR: .long 0xa0000000 PASCR_29BIT_D: .long 0x00000000 PASCR_INIT: .long 0x80000080 MMUCR_A: .long 0xff000010 MMUCR_D: .long 0x00000004 /* clear ITLB */ #endif /* CONFIG_SH_32BIT */ CCR_A: .long CCR CCR_D: .long CCR_CACHE_INIT
4ms/stm32mp1-baremetal
10,138
third-party/u-boot/u-boot-stm32mp1-baremetal/board/renesas/sh7752evb/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2012 Renesas Solutions Corp. */ #include <config.h> #include <asm/processor.h> #include <asm/macro.h> .macro or32, addr, data mov.l \addr, r1 mov.l \data, r0 mov.l @r1, r2 or r2, r0 mov.l r0, @r1 .endm .macro wait_DBCMD mov.l DBWAIT_A, r0 mov.l @r0, r1 .endm .global lowlevel_init .section .spiboot1.text .align 2 lowlevel_init: /*------- GPIO -------*/ write16 PDCR_A, PDCR_D ! SPI0 write16 PGCR_A, PGCR_D ! SPI0, GETHER MDIO gate(PTG1) write16 PJCR_A, PJCR_D ! SCIF4 write16 PTCR_A, PTCR_D ! STATUS write16 PSEL1_A, PSEL1_D ! SPI0 write16 PSEL2_A, PSEL2_D ! SPI0 write16 PSEL5_A, PSEL5_D ! STATUS bra exit_gpio nop .align 2 /*------- GPIO -------*/ PDCR_A: .long 0xffec0006 PGCR_A: .long 0xffec000c PJCR_A: .long 0xffec0012 PTCR_A: .long 0xffec0026 PSEL1_A: .long 0xffec0072 PSEL2_A: .long 0xffec0074 PSEL5_A: .long 0xffec007a PDCR_D: .long 0x0000 PGCR_D: .long 0x0004 PJCR_D: .long 0x0000 PTCR_D: .long 0x0000 PSEL1_D: .long 0x0000 PSEL2_D: .long 0x3000 PSEL5_D: .long 0x0ffc .align 2 exit_gpio: mov #0, r14 mova 2f, r0 mov.l PC_MASK, r1 tst r0, r1 bf 2f bra exit_pmb nop .align 2 /* If CPU runs on SDRAM (PC=0x5???????) or not. */ PC_MASK: .long 0x20000000 2: mov #1, r14 mov.l EXPEVT_A, r0 mov.l @r0, r0 mov.l EXPEVT_POWER_ON_RESET, r1 cmp/eq r0, r1 bt 1f /* * If EXPEVT value is manual reset or tlb multipul-hit, * initialization of DDR3IF is not necessary. */ bra exit_ddr nop 1: /*------- Reset -------*/ write32 MRSTCR0_A, MRSTCR0_D write32 MRSTCR1_A, MRSTCR1_D /* For Core Reset */ mov.l DBACEN_A, r0 mov.l @r0, r0 cmp/eq #0, r0 bt 3f /* * If DBACEN == 1(DBSC was already enabled), we have to avoid the * initialization of DDR3-SDRAM. */ bra exit_ddr nop 3: /*------- DDR3IF -------*/ /* oscillation stabilization time */ wait_timer WAIT_OSC_TIME /* step 3 */ write32 DBCMD_A, DBCMD_RSTL_VAL wait_timer WAIT_30US /* step 4 */ write32 DBCMD_A, DBCMD_PDEN_VAL /* step 5 */ write32 DBKIND_A, DBKIND_D /* step 6 */ write32 DBCONF_A, DBCONF_D write32 DBTR0_A, DBTR0_D write32 DBTR1_A, DBTR1_D write32 DBTR2_A, DBTR2_D write32 DBTR3_A, DBTR3_D write32 DBTR4_A, DBTR4_D write32 DBTR5_A, DBTR5_D write32 DBTR6_A, DBTR6_D write32 DBTR7_A, DBTR7_D write32 DBTR8_A, DBTR8_D write32 DBTR9_A, DBTR9_D write32 DBTR10_A, DBTR10_D write32 DBTR11_A, DBTR11_D write32 DBTR12_A, DBTR12_D write32 DBTR13_A, DBTR13_D write32 DBTR14_A, DBTR14_D write32 DBTR15_A, DBTR15_D write32 DBTR16_A, DBTR16_D write32 DBTR17_A, DBTR17_D write32 DBTR18_A, DBTR18_D write32 DBTR19_A, DBTR19_D write32 DBRNK0_A, DBRNK0_D /* step 7 */ write32 DBPDCNT3_A, DBPDCNT3_D /* step 8 */ write32 DBPDCNT1_A, DBPDCNT1_D write32 DBPDCNT2_A, DBPDCNT2_D write32 DBPDLCK_A, DBPDLCK_D write32 DBPDRGA_A, DBPDRGA_D write32 DBPDRGD_A, DBPDRGD_D /* step 9 */ wait_timer WAIT_30US /* step 10 */ write32 DBPDCNT0_A, DBPDCNT0_D /* step 11 */ wait_timer WAIT_30US wait_timer WAIT_30US /* step 12 */ write32 DBCMD_A, DBCMD_WAIT_VAL wait_DBCMD /* step 13 */ write32 DBCMD_A, DBCMD_RSTH_VAL wait_DBCMD /* step 14 */ write32 DBCMD_A, DBCMD_WAIT_VAL write32 DBCMD_A, DBCMD_WAIT_VAL write32 DBCMD_A, DBCMD_WAIT_VAL write32 DBCMD_A, DBCMD_WAIT_VAL /* step 15 */ write32 DBCMD_A, DBCMD_PDXT_VAL /* step 16 */ write32 DBCMD_A, DBCMD_MRS2_VAL /* step 17 */ write32 DBCMD_A, DBCMD_MRS3_VAL /* step 18 */ write32 DBCMD_A, DBCMD_MRS1_VAL /* step 19 */ write32 DBCMD_A, DBCMD_MRS0_VAL /* step 20 */ write32 DBCMD_A, DBCMD_ZQCL_VAL write32 DBCMD_A, DBCMD_REF_VAL write32 DBCMD_A, DBCMD_REF_VAL wait_DBCMD /* step 21 */ write32 DBADJ0_A, DBADJ0_D write32 DBADJ1_A, DBADJ1_D write32 DBADJ2_A, DBADJ2_D /* step 22 */ write32 DBRFCNF0_A, DBRFCNF0_D write32 DBRFCNF1_A, DBRFCNF1_D write32 DBRFCNF2_A, DBRFCNF2_D /* step 23 */ write32 DBCALCNF_A, DBCALCNF_D /* step 24 */ write32 DBRFEN_A, DBRFEN_D write32 DBCMD_A, DBCMD_SRXT_VAL /* step 25 */ write32 DBACEN_A, DBACEN_D /* step 26 */ wait_DBCMD bra exit_ddr nop .align 2 EXPEVT_A: .long 0xff000024 EXPEVT_POWER_ON_RESET: .long 0x00000000 /*------- Reset -------*/ MRSTCR0_A: .long 0xffd50030 MRSTCR0_D: .long 0xfe1ffe7f MRSTCR1_A: .long 0xffd50034 MRSTCR1_D: .long 0xfff3ffff /*------- DDR3IF -------*/ DBCMD_A: .long 0xfe800018 DBKIND_A: .long 0xfe800020 DBCONF_A: .long 0xfe800024 DBTR0_A: .long 0xfe800040 DBTR1_A: .long 0xfe800044 DBTR2_A: .long 0xfe800048 DBTR3_A: .long 0xfe800050 DBTR4_A: .long 0xfe800054 DBTR5_A: .long 0xfe800058 DBTR6_A: .long 0xfe80005c DBTR7_A: .long 0xfe800060 DBTR8_A: .long 0xfe800064 DBTR9_A: .long 0xfe800068 DBTR10_A: .long 0xfe80006c DBTR11_A: .long 0xfe800070 DBTR12_A: .long 0xfe800074 DBTR13_A: .long 0xfe800078 DBTR14_A: .long 0xfe80007c DBTR15_A: .long 0xfe800080 DBTR16_A: .long 0xfe800084 DBTR17_A: .long 0xfe800088 DBTR18_A: .long 0xfe80008c DBTR19_A: .long 0xfe800090 DBRNK0_A: .long 0xfe800100 DBPDCNT0_A: .long 0xfe800200 DBPDCNT1_A: .long 0xfe800204 DBPDCNT2_A: .long 0xfe800208 DBPDCNT3_A: .long 0xfe80020c DBPDLCK_A: .long 0xfe800280 DBPDRGA_A: .long 0xfe800290 DBPDRGD_A: .long 0xfe8002a0 DBADJ0_A: .long 0xfe8000c0 DBADJ1_A: .long 0xfe8000c4 DBADJ2_A: .long 0xfe8000c8 DBRFCNF0_A: .long 0xfe8000e0 DBRFCNF1_A: .long 0xfe8000e4 DBRFCNF2_A: .long 0xfe8000e8 DBCALCNF_A: .long 0xfe8000f4 DBRFEN_A: .long 0xfe800014 DBACEN_A: .long 0xfe800010 DBWAIT_A: .long 0xfe80001c WAIT_OSC_TIME: .long 6000 WAIT_30US: .long 13333 DBCMD_RSTL_VAL: .long 0x20000000 DBCMD_PDEN_VAL: .long 0x1000d73c DBCMD_WAIT_VAL: .long 0x0000d73c DBCMD_RSTH_VAL: .long 0x2100d73c DBCMD_PDXT_VAL: .long 0x110000c8 DBCMD_MRS0_VAL: .long 0x28000930 DBCMD_MRS1_VAL: .long 0x29000004 DBCMD_MRS2_VAL: .long 0x2a000008 DBCMD_MRS3_VAL: .long 0x2b000000 DBCMD_ZQCL_VAL: .long 0x03000200 DBCMD_REF_VAL: .long 0x0c000000 DBCMD_SRXT_VAL: .long 0x19000000 DBKIND_D: .long 0x00000007 DBCONF_D: .long 0x0f030a01 DBTR0_D: .long 0x00000007 DBTR1_D: .long 0x00000006 DBTR2_D: .long 0x00000000 DBTR3_D: .long 0x00000007 DBTR4_D: .long 0x00070007 DBTR5_D: .long 0x0000001b DBTR6_D: .long 0x00000014 DBTR7_D: .long 0x00000005 DBTR8_D: .long 0x00000015 DBTR9_D: .long 0x00000006 DBTR10_D: .long 0x00000008 DBTR11_D: .long 0x00000007 DBTR12_D: .long 0x0000000e DBTR13_D: .long 0x00000056 DBTR14_D: .long 0x00000006 DBTR15_D: .long 0x00000004 DBTR16_D: .long 0x00150002 DBTR17_D: .long 0x000c0017 DBTR18_D: .long 0x00000200 DBTR19_D: .long 0x00000040 DBRNK0_D: .long 0x00000001 DBPDCNT0_D: .long 0x00000001 DBPDCNT1_D: .long 0x00000001 DBPDCNT2_D: .long 0x00000000 DBPDCNT3_D: .long 0x00004010 DBPDLCK_D: .long 0x0000a55a DBPDRGA_D: .long 0x00000028 DBPDRGD_D: .long 0x00017100 DBADJ0_D: .long 0x00000000 DBADJ1_D: .long 0x00000000 DBADJ2_D: .long 0x18061806 DBRFCNF0_D: .long 0x000001ff DBRFCNF1_D: .long 0x08001000 DBRFCNF2_D: .long 0x00000000 DBCALCNF_D: .long 0x0000ffff DBRFEN_D: .long 0x00000001 DBACEN_D: .long 0x00000001 .align 2 exit_ddr: #if defined(CONFIG_SH_32BIT) /*------- set PMB -------*/ write32 PASCR_A, PASCR_29BIT_D write32 MMUCR_A, MMUCR_D /***************************************************************** * ent virt phys v sz c wt * 0 0xa0000000 0x00000000 1 128M 0 1 * 1 0xa8000000 0x48000000 1 128M 0 1 * 5 0x88000000 0x48000000 1 128M 1 1 */ write32 PMB_ADDR_SPIBOOT_A, PMB_ADDR_SPIBOOT_D write32 PMB_DATA_SPIBOOT_A, PMB_DATA_SPIBOOT_D write32 PMB_ADDR_DDR_C1_A, PMB_ADDR_DDR_C1_D write32 PMB_DATA_DDR_C1_A, PMB_DATA_DDR_C1_D write32 PMB_ADDR_DDR_N1_A, PMB_ADDR_DDR_N1_D write32 PMB_DATA_DDR_N1_A, PMB_DATA_DDR_N1_D write32 PMB_ADDR_ENTRY2, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY3, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY4, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY6, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY7, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY8, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY9, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY10, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY11, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY12, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY13, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY14, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY15, PMB_ADDR_NOT_USE_D write32 PASCR_A, PASCR_INIT mov.l DUMMY_ADDR, r0 icbi @r0 #endif /* if defined(CONFIG_SH_32BIT) */ exit_pmb: /* CPU is running on ILRAM? */ mov r14, r0 tst #1, r0 bt 1f mov.l _stack_ilram, r15 mov.l _spiboot_main, r0 100: bsrf r0 nop .align 2 _spiboot_main: .long (spiboot_main - (100b + 4)) _stack_ilram: .long 0xe5204000 1: write32 CCR_A, CCR_D rts nop .align 2 #if defined(CONFIG_SH_32BIT) /*------- set PMB -------*/ PMB_ADDR_SPIBOOT_A: .long PMB_ADDR_BASE(0) PMB_ADDR_DDR_N1_A: .long PMB_ADDR_BASE(1) PMB_ADDR_DDR_C1_A: .long PMB_ADDR_BASE(5) PMB_ADDR_ENTRY2: .long PMB_ADDR_BASE(2) PMB_ADDR_ENTRY3: .long PMB_ADDR_BASE(3) PMB_ADDR_ENTRY4: .long PMB_ADDR_BASE(4) PMB_ADDR_ENTRY6: .long PMB_ADDR_BASE(6) PMB_ADDR_ENTRY7: .long PMB_ADDR_BASE(7) PMB_ADDR_ENTRY8: .long PMB_ADDR_BASE(8) PMB_ADDR_ENTRY9: .long PMB_ADDR_BASE(9) PMB_ADDR_ENTRY10: .long PMB_ADDR_BASE(10) PMB_ADDR_ENTRY11: .long PMB_ADDR_BASE(11) PMB_ADDR_ENTRY12: .long PMB_ADDR_BASE(12) PMB_ADDR_ENTRY13: .long PMB_ADDR_BASE(13) PMB_ADDR_ENTRY14: .long PMB_ADDR_BASE(14) PMB_ADDR_ENTRY15: .long PMB_ADDR_BASE(15) PMB_ADDR_SPIBOOT_D: .long mk_pmb_addr_val(0xa0) PMB_ADDR_DDR_C1_D: .long mk_pmb_addr_val(0x88) PMB_ADDR_DDR_N1_D: .long mk_pmb_addr_val(0xa8) PMB_ADDR_NOT_USE_D: .long 0x00000000 PMB_DATA_SPIBOOT_A: .long PMB_DATA_BASE(0) PMB_DATA_DDR_N1_A: .long PMB_DATA_BASE(1) PMB_DATA_DDR_C1_A: .long PMB_DATA_BASE(5) /* ppn ub v s1 s0 c wt */ PMB_DATA_SPIBOOT_D: .long mk_pmb_data_val(0x00, 0, 1, 1, 0, 0, 1) PMB_DATA_DDR_C1_D: .long mk_pmb_data_val(0x48, 0, 1, 1, 0, 1, 1) PMB_DATA_DDR_N1_D: .long mk_pmb_data_val(0x48, 1, 1, 1, 0, 0, 1) PASCR_A: .long 0xff000070 DUMMY_ADDR: .long 0xa0000000 PASCR_29BIT_D: .long 0x00000000 PASCR_INIT: .long 0x80000080 MMUCR_A: .long 0xff000010 MMUCR_D: .long 0x00000004 /* clear ITLB */ #endif /* CONFIG_SH_32BIT */ CCR_A: .long CCR CCR_D: .long CCR_CACHE_INIT
4ms/stm32mp1-baremetal
4,839
third-party/u-boot/u-boot-stm32mp1-baremetal/board/renesas/sh7763rdp/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2008 Renesas Solutions Corp. * Copyright (C) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com> * Copyright (C) 2007 Kenati Technologies, Inc. * * board/sh7763rdp/lowlevel_init.S */ #include <config.h> #include <asm/processor.h> #include <asm/macro.h> .global lowlevel_init .text .align 2 lowlevel_init: write32 WDTCSR_A, WDTCSR_D /* Watchdog Control / Status Register */ write32 WDTST_A, WDTST_D /* Watchdog Stop Time Register */ write32 WDTBST_A, WDTBST_D /* * 0xFFCC0008 * Watchdog Base Stop Time Register */ write32 CCR_A, CCR_CACHE_ICI_D /* Address of Cache Control Register */ /* Instruction Cache Invalidate */ write32 MMUCR_A, MMU_CONTROL_TI_D /* MMU Control Register */ /* TI == TLB Invalidate bit */ write32 MSTPCR0_A, MSTPCR0_D /* Address of Power Control Register 0 */ write32 MSTPCR1_A, MSTPCR1_D /* Address of Power Control Register 1 */ write32 RAMCR_A, RAMCR_D mov.l MMSELR_A, r1 mov.l MMSELR_D, r0 synco mov.l r0, @r1 mov.l @r1, r2 /* execute two reads after setting MMSELR */ mov.l @r1, r2 synco /* issue memory read */ mov.l DDRSD_START_A, r1 /* memory address to read*/ mov.l @r1, r0 synco write32 MIM8_A, MIM8_D write32 MIMC_A, MIMC_D1 write32 STRC_A, STRC_D write32 SDR4_A, SDR4_D write32 MIMC_A, MIMC_D2 nop nop nop write32 SCR4_A, SCR4_D3 write32 SCR4_A, SCR4_D2 write32 SDMR02000_A, SDMR02000_D write32 SDMR00B08_A, SDMR00B08_D write32 SCR4_A, SCR4_D2 write32 SCR4_A, SCR4_D4 nop nop nop nop write32 SCR4_A, SCR4_D4 nop nop nop nop write32 SDMR00308_A, SDMR00308_D write32 MIMC_A, MIMC_D3 mov.l SCR4_A, r1 mov.l SCR4_D1, r0 mov.l DELAY60_D, r3 delay_loop_60: mov.l r0, @r1 dt r3 bf delay_loop_60 nop write32 CCR_A, CCR_CACHE_D_2 /* Address of Cache Control Register */ bsc_init: write32 BCR_A, BCR_D write32 CS0BCR_A, CS0BCR_D write32 CS1BCR_A, CS1BCR_D write32 CS2BCR_A, CS2BCR_D write32 CS4BCR_A, CS4BCR_D write32 CS5BCR_A, CS5BCR_D write32 CS6BCR_A, CS6BCR_D write32 CS0WCR_A, CS0WCR_D write32 CS1WCR_A, CS1WCR_D write32 CS2WCR_A, CS2WCR_D write32 CS4WCR_A, CS4WCR_D write32 CS5WCR_A, CS5WCR_D write32 CS6WCR_A, CS6WCR_D write32 CS5PCR_A, CS5PCR_D write32 CS6PCR_A, CS6PCR_D mov.l DELAY200_D, r3 delay_loop_200: dt r3 bf delay_loop_200 nop write16 PSEL0_A, PSEL0_D write16 PSEL1_A, PSEL1_D write32 ICR0_A, ICR0_D stc sr, r0 /* BL bit off(init=ON) */ mov.l SR_MASK_D, r1 and r1, r0 ldc r0, sr rts nop .align 2 DELAY60_D: .long 60 DELAY200_D: .long 17800 CCR_A: .long 0xFF00001C MMUCR_A: .long 0xFF000010 RAMCR_A: .long 0xFF000074 /* Low power mode control */ MSTPCR0_A: .long 0xFFC80030 MSTPCR1_A: .long 0xFFC80038 /* RWBT */ WDTST_A: .long 0xFFCC0000 WDTCSR_A: .long 0xFFCC0004 WDTBST_A: .long 0xFFCC0008 /* BSC */ MMSELR_A: .long 0xFE600020 BCR_A: .long 0xFF801000 CS0BCR_A: .long 0xFF802000 CS1BCR_A: .long 0xFF802010 CS2BCR_A: .long 0xFF802020 CS4BCR_A: .long 0xFF802040 CS5BCR_A: .long 0xFF802050 CS6BCR_A: .long 0xFF802060 CS0WCR_A: .long 0xFF802008 CS1WCR_A: .long 0xFF802018 CS2WCR_A: .long 0xFF802028 CS4WCR_A: .long 0xFF802048 CS5WCR_A: .long 0xFF802058 CS6WCR_A: .long 0xFF802068 CS5PCR_A: .long 0xFF802070 CS6PCR_A: .long 0xFF802080 DDRSD_START_A: .long 0xAC000000 /* INTC */ ICR0_A: .long 0xFFD00000 /* DDR I/F */ MIM8_A: .long 0xFE800008 MIMC_A: .long 0xFE80000C SCR4_A: .long 0xFE800014 STRC_A: .long 0xFE80001C SDR4_A: .long 0xFE800034 SDMR00308_A: .long 0xFE900308 SDMR00B08_A: .long 0xFE900B08 SDMR02000_A: .long 0xFE902000 /* GPIO */ PSEL0_A: .long 0xFFEF0070 PSEL1_A: .long 0xFFEF0072 CCR_CACHE_ICI_D:.long 0x00000800 CCR_CACHE_D_2: .long 0x00000103 MMU_CONTROL_TI_D:.long 0x00000004 RAMCR_D: .long 0x00000200 MSTPCR0_D: .long 0x00000000 MSTPCR1_D: .long 0x00000000 MMSELR_D: .long 0xa5a50000 BCR_D: .long 0x00000000 CS0BCR_D: .long 0x77777770 CS1BCR_D: .long 0x77777670 CS2BCR_D: .long 0x77777670 CS4BCR_D: .long 0x77777670 CS5BCR_D: .long 0x77777670 CS6BCR_D: .long 0x77777670 CS0WCR_D: .long 0x7777770F CS1WCR_D: .long 0x22000002 CS2WCR_D: .long 0x7777770F CS4WCR_D: .long 0x7777770F CS5WCR_D: .long 0x7777770F CS6WCR_D: .long 0x7777770F CS5PCR_D: .long 0x77000000 CS6PCR_D: .long 0x77000000 ICR0_D: .long 0x00E00000 MIM8_D: .long 0x00000000 MIMC_D1: .long 0x01d10008 MIMC_D2: .long 0x01d10009 MIMC_D3: .long 0x01d10209 SCR4_D1: .long 0x00000001 SCR4_D2: .long 0x00000002 SCR4_D3: .long 0x00000003 SCR4_D4: .long 0x00000004 STRC_D: .long 0x000f3980 SDR4_D: .long 0x00000300 SDMR00308_D: .long 0x00000000 SDMR00B08_D: .long 0x00000000 SDMR02000_D: .long 0x00000000 PSEL0_D: .word 0x00000001 PSEL1_D: .word 0x00000244 SR_MASK_D: .long 0xEFFFFF0F WDTST_D: .long 0x5A000FFF WDTCSR_D: .long 0xA5000000 WDTBST_D: .long 0x55000000
4ms/stm32mp1-baremetal
12,427
third-party/u-boot/u-boot-stm32mp1-baremetal/board/renesas/sh7757lcr/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2011 Renesas Solutions Corp. */ #include <config.h> #include <asm/processor.h> #include <asm/macro.h> .macro or32, addr, data mov.l \addr, r1 mov.l \data, r0 mov.l @r1, r2 or r2, r0 mov.l r0, @r1 .endm .macro wait_DBCMD mov.l DBWAIT_A, r0 mov.l @r0, r1 .endm .global lowlevel_init .section .spiboot1.text .align 2 lowlevel_init: /*------- GPIO -------*/ write8 PGDR_A, PGDR_D /* eMMC power off */ write16 PACR_A, PACR_D write16 PBCR_A, PBCR_D write16 PCCR_A, PCCR_D write16 PDCR_A, PDCR_D write16 PECR_A, PECR_D write16 PFCR_A, PFCR_D write16 PGCR_A, PGCR_D write16 PHCR_A, PHCR_D write16 PICR_A, PICR_D write16 PJCR_A, PJCR_D write16 PKCR_A, PKCR_D write16 PLCR_A, PLCR_D write16 PMCR_A, PMCR_D write16 PNCR_A, PNCR_D write16 POCR_A, POCR_D write16 PQCR_A, PQCR_D write16 PRCR_A, PRCR_D write16 PSCR_A, PSCR_D write16 PTCR_A, PTCR_D write16 PUCR_A, PUCR_D write16 PVCR_A, PVCR_D write16 PWCR_A, PWCR_D write16 PXCR_A, PXCR_D write16 PYCR_A, PYCR_D write16 PZCR_A, PZCR_D write16 PSEL0_A, PSEL0_D write16 PSEL1_A, PSEL1_D write16 PSEL2_A, PSEL2_D write16 PSEL3_A, PSEL3_D write16 PSEL4_A, PSEL4_D write16 PSEL5_A, PSEL5_D write16 PSEL6_A, PSEL6_D write16 PSEL7_A, PSEL7_D write16 PSEL8_A, PSEL8_D bra exit_gpio nop .align 4 /*------- GPIO -------*/ PGDR_A: .long 0xffec0040 PACR_A: .long 0xffec0000 PBCR_A: .long 0xffec0002 PCCR_A: .long 0xffec0004 PDCR_A: .long 0xffec0006 PECR_A: .long 0xffec0008 PFCR_A: .long 0xffec000a PGCR_A: .long 0xffec000c PHCR_A: .long 0xffec000e PICR_A: .long 0xffec0010 PJCR_A: .long 0xffec0012 PKCR_A: .long 0xffec0014 PLCR_A: .long 0xffec0016 PMCR_A: .long 0xffec0018 PNCR_A: .long 0xffec001a POCR_A: .long 0xffec001c PQCR_A: .long 0xffec0020 PRCR_A: .long 0xffec0022 PSCR_A: .long 0xffec0024 PTCR_A: .long 0xffec0026 PUCR_A: .long 0xffec0028 PVCR_A: .long 0xffec002a PWCR_A: .long 0xffec002c PXCR_A: .long 0xffec002e PYCR_A: .long 0xffec0030 PZCR_A: .long 0xffec0032 PSEL0_A: .long 0xffec0070 PSEL1_A: .long 0xffec0072 PSEL2_A: .long 0xffec0074 PSEL3_A: .long 0xffec0076 PSEL4_A: .long 0xffec0078 PSEL5_A: .long 0xffec007a PSEL6_A: .long 0xffec007c PSEL7_A: .long 0xffec0082 PSEL8_A: .long 0xffec0084 PGDR_D: .long 0x80 PACR_D: .long 0x0000 PBCR_D: .long 0x0001 PCCR_D: .long 0x0000 PDCR_D: .long 0x0000 PECR_D: .long 0x0000 PFCR_D: .long 0x0000 PGCR_D: .long 0x0000 PHCR_D: .long 0x0000 PICR_D: .long 0x0000 PJCR_D: .long 0x0000 PKCR_D: .long 0x0003 PLCR_D: .long 0x0000 PMCR_D: .long 0x0000 PNCR_D: .long 0x0000 POCR_D: .long 0x0000 PQCR_D: .long 0xc000 PRCR_D: .long 0x0000 PSCR_D: .long 0x0000 PTCR_D: .long 0x0000 #if defined(CONFIG_SH7757_OFFSET_SPI) PUCR_D: .long 0x0055 #else PUCR_D: .long 0x0000 #endif PVCR_D: .long 0x0000 PWCR_D: .long 0x0000 PXCR_D: .long 0x0000 PYCR_D: .long 0x0000 PZCR_D: .long 0x0000 PSEL0_D: .long 0xfe00 PSEL1_D: .long 0x0000 PSEL2_D: .long 0x3000 PSEL3_D: .long 0xff00 PSEL4_D: .long 0x771f PSEL5_D: .long 0x0ffc PSEL6_D: .long 0x00ff PSEL7_D: .long 0xfc00 PSEL8_D: .long 0x0000 .align 2 exit_gpio: mov #0, r14 mova 2f, r0 mov.l PC_MASK, r1 tst r0, r1 bf 2f bra exit_pmb nop .align 2 /* If CPU runs on SDRAM, PC is 0x8???????. */ PC_MASK: .long 0x20000000 2: mov #1, r14 mov.l EXPEVT_A, r0 mov.l @r0, r0 mov.l EXPEVT_POWER_ON_RESET, r1 cmp/eq r0, r1 bt 1f /* * If EXPEVT value is manual reset or tlb multipul-hit, * initialization of DDR3IF is not necessary. */ bra exit_ddr nop 1: /* For Core Reset */ mov.l DBACEN_A, r0 mov.l @r0, r0 cmp/eq #0, r0 bt 3f /* * If DBACEN == 1(DBSC was already enabled), we have to avoid the * initialization of DDR3-SDRAM. */ bra exit_ddr nop 3: /*------- DDR3IF -------*/ /* oscillation stabilization time */ wait_timer WAIT_OSC_TIME /* step 3 */ write32 DBCMD_A, DBCMD_RSTL_VAL wait_timer WAIT_30US /* step 4 */ write32 DBCMD_A, DBCMD_PDEN_VAL /* step 5 */ write32 DBKIND_A, DBKIND_D /* step 6 */ write32 DBCONF_A, DBCONF_D write32 DBTR0_A, DBTR0_D write32 DBTR1_A, DBTR1_D write32 DBTR2_A, DBTR2_D write32 DBTR3_A, DBTR3_D write32 DBTR4_A, DBTR4_D write32 DBTR5_A, DBTR5_D write32 DBTR6_A, DBTR6_D write32 DBTR7_A, DBTR7_D write32 DBTR8_A, DBTR8_D write32 DBTR9_A, DBTR9_D write32 DBTR10_A, DBTR10_D write32 DBTR11_A, DBTR11_D write32 DBTR12_A, DBTR12_D write32 DBTR13_A, DBTR13_D write32 DBTR14_A, DBTR14_D write32 DBTR15_A, DBTR15_D write32 DBTR16_A, DBTR16_D write32 DBTR17_A, DBTR17_D write32 DBTR18_A, DBTR18_D write32 DBTR19_A, DBTR19_D write32 DBRNK0_A, DBRNK0_D /* step 7 */ write32 DBPDCNT3_A, DBPDCNT3_D /* step 8 */ write32 DBPDCNT1_A, DBPDCNT1_D write32 DBPDCNT2_A, DBPDCNT2_D write32 DBPDLCK_A, DBPDLCK_D write32 DBPDRGA_A, DBPDRGA_D write32 DBPDRGD_A, DBPDRGD_D /* step 9 */ wait_timer WAIT_30US /* step 10 */ write32 DBPDCNT0_A, DBPDCNT0_D /* step 11 */ wait_timer WAIT_30US wait_timer WAIT_30US /* step 12 */ write32 DBCMD_A, DBCMD_WAIT_VAL wait_DBCMD /* step 13 */ write32 DBCMD_A, DBCMD_RSTH_VAL wait_DBCMD /* step 14 */ write32 DBCMD_A, DBCMD_WAIT_VAL write32 DBCMD_A, DBCMD_WAIT_VAL write32 DBCMD_A, DBCMD_WAIT_VAL write32 DBCMD_A, DBCMD_WAIT_VAL /* step 15 */ write32 DBCMD_A, DBCMD_PDXT_VAL /* step 16 */ write32 DBCMD_A, DBCMD_MRS2_VAL /* step 17 */ write32 DBCMD_A, DBCMD_MRS3_VAL /* step 18 */ write32 DBCMD_A, DBCMD_MRS1_VAL /* step 19 */ write32 DBCMD_A, DBCMD_MRS0_VAL /* step 20 */ write32 DBCMD_A, DBCMD_ZQCL_VAL write32 DBCMD_A, DBCMD_REF_VAL write32 DBCMD_A, DBCMD_REF_VAL wait_DBCMD /* step 21 */ write32 DBADJ0_A, DBADJ0_D write32 DBADJ1_A, DBADJ1_D write32 DBADJ2_A, DBADJ2_D /* step 22 */ write32 DBRFCNF0_A, DBRFCNF0_D write32 DBRFCNF1_A, DBRFCNF1_D write32 DBRFCNF2_A, DBRFCNF2_D /* step 23 */ write32 DBCALCNF_A, DBCALCNF_D /* step 24 */ write32 DBRFEN_A, DBRFEN_D write32 DBCMD_A, DBCMD_SRXT_VAL /* step 25 */ write32 DBACEN_A, DBACEN_D /* step 26 */ wait_DBCMD #if defined(CONFIG_SH7757LCR_DDR_ECC) /* enable DDR-ECC */ write32 ECD_ECDEN_A, ECD_ECDEN_D write32 ECD_INTSR_A, ECD_INTSR_D write32 ECD_SPACER_A, ECD_SPACER_D write32 ECD_MCR_A, ECD_MCR_D #endif bra exit_ddr nop .align 4 EXPEVT_A: .long 0xff000024 EXPEVT_POWER_ON_RESET: .long 0x00000000 /*------- DDR3IF -------*/ DBCMD_A: .long 0xfe800018 DBKIND_A: .long 0xfe800020 DBCONF_A: .long 0xfe800024 DBTR0_A: .long 0xfe800040 DBTR1_A: .long 0xfe800044 DBTR2_A: .long 0xfe800048 DBTR3_A: .long 0xfe800050 DBTR4_A: .long 0xfe800054 DBTR5_A: .long 0xfe800058 DBTR6_A: .long 0xfe80005c DBTR7_A: .long 0xfe800060 DBTR8_A: .long 0xfe800064 DBTR9_A: .long 0xfe800068 DBTR10_A: .long 0xfe80006c DBTR11_A: .long 0xfe800070 DBTR12_A: .long 0xfe800074 DBTR13_A: .long 0xfe800078 DBTR14_A: .long 0xfe80007c DBTR15_A: .long 0xfe800080 DBTR16_A: .long 0xfe800084 DBTR17_A: .long 0xfe800088 DBTR18_A: .long 0xfe80008c DBTR19_A: .long 0xfe800090 DBRNK0_A: .long 0xfe800100 DBPDCNT0_A: .long 0xfe800200 DBPDCNT1_A: .long 0xfe800204 DBPDCNT2_A: .long 0xfe800208 DBPDCNT3_A: .long 0xfe80020c DBPDLCK_A: .long 0xfe800280 DBPDRGA_A: .long 0xfe800290 DBPDRGD_A: .long 0xfe8002a0 DBADJ0_A: .long 0xfe8000c0 DBADJ1_A: .long 0xfe8000c4 DBADJ2_A: .long 0xfe8000c8 DBRFCNF0_A: .long 0xfe8000e0 DBRFCNF1_A: .long 0xfe8000e4 DBRFCNF2_A: .long 0xfe8000e8 DBCALCNF_A: .long 0xfe8000f4 DBRFEN_A: .long 0xfe800014 DBACEN_A: .long 0xfe800010 DBWAIT_A: .long 0xfe80001c WAIT_OSC_TIME: .long 6000 WAIT_30US: .long 13333 DBCMD_RSTL_VAL: .long 0x20000000 DBCMD_PDEN_VAL: .long 0x1000d73c DBCMD_WAIT_VAL: .long 0x0000d73c DBCMD_RSTH_VAL: .long 0x2100d73c DBCMD_PDXT_VAL: .long 0x110000c8 DBCMD_MRS0_VAL: .long 0x28000930 DBCMD_MRS1_VAL: .long 0x29000004 DBCMD_MRS2_VAL: .long 0x2a000008 DBCMD_MRS3_VAL: .long 0x2b000000 DBCMD_ZQCL_VAL: .long 0x03000200 DBCMD_REF_VAL: .long 0x0c000000 DBCMD_SRXT_VAL: .long 0x19000000 DBKIND_D: .long 0x00000007 DBCONF_D: .long 0x0f030a01 DBTR0_D: .long 0x00000007 DBTR1_D: .long 0x00000006 DBTR2_D: .long 0x00000000 DBTR3_D: .long 0x00000007 DBTR4_D: .long 0x00070007 DBTR5_D: .long 0x0000001b DBTR6_D: .long 0x00000014 DBTR7_D: .long 0x00000005 DBTR8_D: .long 0x00000015 DBTR9_D: .long 0x00000006 DBTR10_D: .long 0x00000008 DBTR11_D: .long 0x00000007 DBTR12_D: .long 0x0000000e DBTR13_D: .long 0x00000056 DBTR14_D: .long 0x00000006 DBTR15_D: .long 0x00000004 DBTR16_D: .long 0x00150002 DBTR17_D: .long 0x000c0017 DBTR18_D: .long 0x00000200 DBTR19_D: .long 0x00000040 DBRNK0_D: .long 0x00000001 DBPDCNT0_D: .long 0x00000001 DBPDCNT1_D: .long 0x00000001 DBPDCNT2_D: .long 0x00000000 DBPDCNT3_D: .long 0x00004010 DBPDLCK_D: .long 0x0000a55a DBPDRGA_D: .long 0x00000028 DBPDRGD_D: .long 0x00017100 DBADJ0_D: .long 0x00000000 DBADJ1_D: .long 0x00000000 DBADJ2_D: .long 0x18061806 DBRFCNF0_D: .long 0x000001ff DBRFCNF1_D: .long 0x08001000 DBRFCNF2_D: .long 0x00000000 DBCALCNF_D: .long 0x0000ffff DBRFEN_D: .long 0x00000001 DBACEN_D: .long 0x00000001 /*------- DDR-ECC -------*/ ECD_ECDEN_A: .long 0xffc1012c ECD_ECDEN_D: .long 0x00000001 ECD_INTSR_A: .long 0xfe900024 ECD_INTSR_D: .long 0xffffffff ECD_SPACER_A: .long 0xfe900018 ECD_SPACER_D: .long SH7757LCR_SDRAM_ECC_SETTING ECD_MCR_A: .long 0xfe900010 ECD_MCR_D: .long 0x00000001 .align 2 exit_ddr: #if defined(CONFIG_SH_32BIT) /*------- set PMB -------*/ write32 PASCR_A, PASCR_29BIT_D write32 MMUCR_A, MMUCR_D /***************************************************************** * ent virt phys v sz c wt * 0 0xa0000000 0x00000000 1 128M 0 1 * 1 0xa8000000 0x48000000 1 128M 0 1 * 5 0x88000000 0x48000000 1 128M 1 1 */ write32 PMB_ADDR_SPIBOOT_A, PMB_ADDR_SPIBOOT_D write32 PMB_DATA_SPIBOOT_A, PMB_DATA_SPIBOOT_D write32 PMB_ADDR_DDR_C1_A, PMB_ADDR_DDR_C1_D write32 PMB_DATA_DDR_C1_A, PMB_DATA_DDR_C1_D write32 PMB_ADDR_DDR_N1_A, PMB_ADDR_DDR_N1_D write32 PMB_DATA_DDR_N1_A, PMB_DATA_DDR_N1_D write32 PMB_ADDR_ENTRY2, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY3, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY4, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY6, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY7, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY8, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY9, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY10, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY11, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY12, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY13, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY14, PMB_ADDR_NOT_USE_D write32 PMB_ADDR_ENTRY15, PMB_ADDR_NOT_USE_D write32 PASCR_A, PASCR_INIT mov.l DUMMY_ADDR, r0 icbi @r0 #endif /* if defined(CONFIG_SH_32BIT) */ exit_pmb: /* CPU is running on ILRAM? */ mov r14, r0 tst #1, r0 bt 1f mov.l _bss_start, r15 mov.l _spiboot_main, r0 100: bsrf r0 nop .align 2 _spiboot_main: .long (spiboot_main - (100b + 4)) _bss_start: .long bss_start 1: write32 CCR_A, CCR_D rts nop .align 4 #if defined(CONFIG_SH_32BIT) /*------- set PMB -------*/ PMB_ADDR_SPIBOOT_A: .long PMB_ADDR_BASE(0) PMB_ADDR_DDR_N1_A: .long PMB_ADDR_BASE(1) PMB_ADDR_DDR_C1_A: .long PMB_ADDR_BASE(5) PMB_ADDR_ENTRY2: .long PMB_ADDR_BASE(2) PMB_ADDR_ENTRY3: .long PMB_ADDR_BASE(3) PMB_ADDR_ENTRY4: .long PMB_ADDR_BASE(4) PMB_ADDR_ENTRY6: .long PMB_ADDR_BASE(6) PMB_ADDR_ENTRY7: .long PMB_ADDR_BASE(7) PMB_ADDR_ENTRY8: .long PMB_ADDR_BASE(8) PMB_ADDR_ENTRY9: .long PMB_ADDR_BASE(9) PMB_ADDR_ENTRY10: .long PMB_ADDR_BASE(10) PMB_ADDR_ENTRY11: .long PMB_ADDR_BASE(11) PMB_ADDR_ENTRY12: .long PMB_ADDR_BASE(12) PMB_ADDR_ENTRY13: .long PMB_ADDR_BASE(13) PMB_ADDR_ENTRY14: .long PMB_ADDR_BASE(14) PMB_ADDR_ENTRY15: .long PMB_ADDR_BASE(15) PMB_ADDR_SPIBOOT_D: .long mk_pmb_addr_val(0xa0) PMB_ADDR_DDR_C1_D: .long mk_pmb_addr_val(0x88) PMB_ADDR_DDR_N1_D: .long mk_pmb_addr_val(0xa8) PMB_ADDR_NOT_USE_D: .long 0x00000000 PMB_DATA_SPIBOOT_A: .long PMB_DATA_BASE(0) PMB_DATA_DDR_N1_A: .long PMB_DATA_BASE(1) PMB_DATA_DDR_C1_A: .long PMB_DATA_BASE(5) /* ppn ub v s1 s0 c wt */ PMB_DATA_SPIBOOT_D: .long mk_pmb_data_val(0x00, 0, 1, 1, 0, 0, 1) PMB_DATA_DDR_C1_D: .long mk_pmb_data_val(0x48, 0, 1, 1, 0, 1, 1) PMB_DATA_DDR_N1_D: .long mk_pmb_data_val(0x48, 1, 1, 1, 0, 0, 1) PASCR_A: .long 0xff000070 DUMMY_ADDR: .long 0xa0000000 PASCR_29BIT_D: .long 0x00000000 PASCR_INIT: .long 0x80000080 MMUCR_A: .long 0xff000010 MMUCR_D: .long 0x00000004 /* clear ITLB */ #endif /* CONFIG_SH_32BIT */ CCR_A: .long CCR CCR_D: .long CCR_CACHE_INIT
4ms/stm32mp1-baremetal
5,613
third-party/u-boot/u-boot-stm32mp1-baremetal/board/renesas/r7780mp/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2007,2008 Nobuhiro Iwamatsu * * u-boot/board/r7780mp/lowlevel_init.S */ #include <config.h> #include <asm/processor.h> #include <asm/macro.h> /* * Board specific low level init code, called _very_ early in the * startup sequence. Relocation to SDRAM has not happened yet, no * stack is available, bss section has not been initialised, etc. * * (Note: As no stack is available, no subroutines can be called...). */ .global lowlevel_init .text .align 2 lowlevel_init: write32 CCR_A, CCR_D /* Address of Cache Control Register */ /* Instruction Cache Invalidate */ write32 FRQCR_A, FRQCR_D /* Frequency control register */ /* pin_multi_setting */ write32 BBG_PMMR_A, BBG_PMMR_D_PMSR1 write32 BBG_PMSR1_A, BBG_PMSR1_D write32 BBG_PMMR_A, BBG_PMMR_D_PMSR2 write32 BBG_PMSR2_A, BBG_PMSR2_D write32 BBG_PMMR_A, BBG_PMMR_D_PMSR3 write32 BBG_PMSR3_A, BBG_PMSR3_D write32 BBG_PMMR_A, BBG_PMMR_D_PMSR4 write32 BBG_PMSR4_A, BBG_PMSR4_D write32 BBG_PMMR_A, BBG_PMMR_D_PMSRG write32 BBG_PMSRG_A, BBG_PMSRG_D /* cpg_setting */ write32 FRQCR_A, FRQCR_D write32 DLLCSR_A, DLLCSR_D nop nop nop nop nop nop nop nop nop nop /* wait 200us */ mov.l REPEAT0_R3, r3 mov #0, r2 repeat0: add #1, r2 cmp/hs r3, r2 bf repeat0 nop /* bsc_setting */ write32 MMSELR_A, MMSELR_D write32 BCR_A, BCR_D write32 CS0BCR_A, CS0BCR_D write32 CS1BCR_A, CS1BCR_D write32 CS2BCR_A, CS2BCR_D write32 CS4BCR_A, CS4BCR_D write32 CS5BCR_A, CS5BCR_D write32 CS6BCR_A, CS6BCR_D write32 CS0WCR_A, CS0WCR_D write32 CS1WCR_A, CS1WCR_D write32 CS2WCR_A, CS2WCR_D write32 CS4WCR_A, CS4WCR_D write32 CS5WCR_A, CS5WCR_D write32 CS6WCR_A, CS6WCR_D write32 CS5PCR_A, CS5PCR_D write32 CS6PCR_A, CS6PCR_D /* ddr_setting */ /* wait 200us */ mov.l REPEAT0_R3, r3 mov #0, r2 repeat1: add #1, r2 cmp/hs r3, r2 bf repeat1 nop mov.l MIM_U_A, r0 mov.l MIM_U_D, r1 synco mov.l r1, @r0 synco mov.l MIM_L_A, r0 mov.l MIM_L_D0, r1 synco mov.l r1, @r0 synco mov.l STR_L_A, r0 mov.l STR_L_D, r1 synco mov.l r1, @r0 synco mov.l SDR_L_A, r0 mov.l SDR_L_D, r1 synco mov.l r1, @r0 synco nop nop nop nop mov.l SCR_L_A, r0 mov.l SCR_L_D0, r1 synco mov.l r1, @r0 synco mov.l SCR_L_A, r0 mov.l SCR_L_D1, r1 synco mov.l r1, @r0 synco nop nop nop mov.l EMRS_A, r0 mov.l EMRS_D, r1 synco mov.l r1, @r0 synco nop nop nop mov.l MRS1_A, r0 mov.l MRS1_D, r1 synco mov.l r1, @r0 synco nop nop nop mov.l SCR_L_A, r0 mov.l SCR_L_D2, r1 synco mov.l r1, @r0 synco nop nop nop mov.l SCR_L_A, r0 mov.l SCR_L_D3, r1 synco mov.l r1, @r0 synco nop nop nop mov.l SCR_L_A, r0 mov.l SCR_L_D4, r1 synco mov.l r1, @r0 synco nop nop nop mov.l MRS2_A, r0 mov.l MRS2_D, r1 synco mov.l r1, @r0 synco nop nop nop mov.l SCR_L_A, r0 mov.l SCR_L_D5, r1 synco mov.l r1, @r0 synco /* wait 200us */ mov.l REPEAT0_R1, r3 mov #0, r2 repeat2: add #1, r2 cmp/hs r3, r2 bf repeat2 synco mov.l MIM_L_A, r0 mov.l MIM_L_D1, r1 synco mov.l r1, @r0 synco rts nop .align 4 RWTCSR_D_1: .word 0xA507 RWTCSR_D_2: .word 0xA507 RWTCNT_D: .word 0x5A00 .align 2 BBG_PMMR_A: .long 0xFF800010 BBG_PMSR1_A: .long 0xFF800014 BBG_PMSR2_A: .long 0xFF800018 BBG_PMSR3_A: .long 0xFF80001C BBG_PMSR4_A: .long 0xFF800020 BBG_PMSRG_A: .long 0xFF800024 BBG_PMMR_D_PMSR1: .long 0xffffbffd BBG_PMSR1_D: .long 0x00004002 BBG_PMMR_D_PMSR2: .long 0xfc21a7ff BBG_PMSR2_D: .long 0x03de5800 BBG_PMMR_D_PMSR3: .long 0xfffffff8 BBG_PMSR3_D: .long 0x00000007 BBG_PMMR_D_PMSR4: .long 0xdffdfff9 BBG_PMSR4_D: .long 0x20020006 BBG_PMMR_D_PMSRG: .long 0xffffffff BBG_PMSRG_D: .long 0x00000000 FRQCR_A: .long FRQCR DLLCSR_A: .long 0xffc40010 FRQCR_D: .long 0x40233035 DLLCSR_D: .long 0x00000000 /* for DDR-SDRAM */ MIM_U_A: .long MIM_1 MIM_L_A: .long MIM_2 SCR_U_A: .long SCR_1 SCR_L_A: .long SCR_2 STR_U_A: .long STR_1 STR_L_A: .long STR_2 SDR_U_A: .long SDR_1 SDR_L_A: .long SDR_2 EMRS_A: .long 0xFEC02000 MRS1_A: .long 0xFEC00B08 MRS2_A: .long 0xFEC00308 MIM_U_D: .long 0x00004000 MIM_L_D0: .long 0x03e80009 MIM_L_D1: .long 0x03e80209 SCR_L_D0: .long 0x3 SCR_L_D1: .long 0x2 SCR_L_D2: .long 0x2 SCR_L_D3: .long 0x4 SCR_L_D4: .long 0x4 SCR_L_D5: .long 0x0 STR_L_D: .long 0x000f0000 SDR_L_D: .long 0x00000400 EMRS_D: .long 0x0 MRS1_D: .long 0x0 MRS2_D: .long 0x0 /* Cache Controller */ CCR_A: .long CCR MMUCR_A: .long MMUCR RWTCNT_A: .long WTCNT CCR_D: .long 0x0000090b CCR_D_2: .long 0x00000103 MMUCR_D: .long 0x00000004 MSTPCR0_D: .long 0x00001001 MSTPCR2_D: .long 0xffffffff /* local Bus State Controller */ MMSELR_A: .long MMSELR BCR_A: .long BCR CS0BCR_A: .long CS0BCR CS1BCR_A: .long CS1BCR CS2BCR_A: .long CS2BCR CS4BCR_A: .long CS4BCR CS5BCR_A: .long CS5BCR CS6BCR_A: .long CS6BCR CS0WCR_A: .long CS0WCR CS1WCR_A: .long CS1WCR CS2WCR_A: .long CS2WCR CS4WCR_A: .long CS4WCR CS5WCR_A: .long CS5WCR CS6WCR_A: .long CS6WCR CS5PCR_A: .long CS5PCR CS6PCR_A: .long CS6PCR MMSELR_D: .long 0xA5A50003 BCR_D: .long 0x00000000 CS0BCR_D: .long 0x77777770 CS1BCR_D: .long 0x77777670 CS2BCR_D: .long 0x77777770 CS4BCR_D: .long 0x77777770 CS5BCR_D: .long 0x77777670 CS6BCR_D: .long 0x77777770 CS0WCR_D: .long 0x00020006 CS1WCR_D: .long 0x00232304 CS2WCR_D: .long 0x7777770F CS4WCR_D: .long 0x7777770F CS5WCR_D: .long 0x00101006 CS6WCR_D: .long 0x77777703 CS5PCR_D: .long 0x77000000 CS6PCR_D: .long 0x77000000 REPEAT0_R3: .long 0x00002000 REPEAT0_R1: .long 0x0000200
4ms/stm32mp1-baremetal
3,296
third-party/u-boot/u-boot-stm32mp1-baremetal/board/sysam/stmark2/sbf_dram_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Board-specific early ddr/sdram init. * * (C) Copyright 2017 Angelo Dureghello <angelo@sysam.it> */ .equ PPMCR0, 0xfc04002d .equ MSCR_SDRAMC, 0xec094060 .equ MISCCR2, 0xec09001a .equ DDR_RCR, 0xfc0b8180 .equ DDR_PADCR, 0xfc0b81ac .equ DDR_CR00, 0xfc0b8000 .equ DDR_CR06, 0xfc0b8018 .equ DDR_CR09, 0xfc0b8024 .equ DDR_CR40, 0xfc0b80a0 .equ DDR_CR45, 0xfc0b80b4 .equ DDR_CR56, 0xfc0b80e0 .global sbf_dram_init .text sbf_dram_init: /* CD46 = DDR on */ move.l #PPMCR0, %a1 move.b #46, (%a1) /* stmark 2, max drive strength */ move.l #MSCR_SDRAMC, %a1 move.b #1, (%a1) /* * use cpu clock, seems more realiable * * DDR2 clock is serviced from DDR controller as input clock / 2 * so, if clock comes from * vco, i.e. 480(vco) / 2, so ddr clock is 240 Mhz (measured) * cpu, i.e. 250(cpu) / 2, so ddr clock is 125 Mhz (measured) * * . * / \ DDR2 can't be clocked lower than 125Mhz * / ! \ DDR2 init must pass further i/dcache enable test * /_____\ * WARNING */ /* cpu / 2 = 125 Mhz for 480 Mhz pll */ move.l #MISCCR2, %a1 move.w #0xa01d, (%a1) /* DDR force sw reset settings */ move.l #DDR_RCR, %a1 move.l #0x00000000, (%a1) move.l #0x40000000, (%a1) /* * PAD_ODT_CS: for us seems both 1(75 ohm) and 2(150ohm) are good, * 500/700 mV are ok */ move.l #DDR_PADCR, %a1 move.l #0x01030203, (%a1) /* as freescale tower */ move.l #DDR_CR00, %a1 move.l #0x01010101, (%a1)+ /* 0x00 */ move.l #0x00000101, (%a1)+ /* 0x04 */ move.l #0x01010100, (%a1)+ /* 0x08 */ move.l #0x01010000, (%a1)+ /* 0x0C */ move.l #0x00010101, (%a1)+ /* 0x10 */ move.l #DDR_CR06, %a1 move.l #0x00010100, (%a1)+ /* 0x18 */ move.l #0x00000001, (%a1)+ /* 0x1C */ move.l #0x01000001, (%a1)+ /* 0x20 */ move.l #0x00000100, (%a1)+ /* 0x24 */ move.l #0x00010001, (%a1)+ /* 0x28 */ move.l #0x00000200, (%a1)+ /* 0x2C */ move.l #0x01000002, (%a1)+ /* 0x30 */ move.l #0x00000000, (%a1)+ /* 0x34 */ move.l #0x00000100, (%a1)+ /* 0x38 */ move.l #0x02000100, (%a1)+ /* 0x3C */ move.l #0x02000407, (%a1)+ /* 0x40 */ move.l #0x02030007, (%a1)+ /* 0x44 */ move.l #0x02000100, (%a1)+ /* 0x48 */ move.l #0x0A030203, (%a1)+ /* 0x4C */ move.l #0x00020708, (%a1)+ /* 0x50 */ move.l #0x00050008, (%a1)+ /* 0x54 */ move.l #0x04030002, (%a1)+ /* 0x58 */ move.l #0x00000004, (%a1)+ /* 0x5C */ move.l #0x020A0000, (%a1)+ /* 0x60 */ move.l #0x0C00000E, (%a1)+ /* 0x64 */ move.l #0x00002004, (%a1)+ /* 0x68 */ move.l #0x00000000, (%a1)+ /* 0x6C */ move.l #0x00100010, (%a1)+ /* 0x70 */ move.l #0x00100010, (%a1)+ /* 0x74 */ move.l #0x00000000, (%a1)+ /* 0x78 */ move.l #0x07990000, (%a1)+ /* 0x7C */ move.l #DDR_CR40, %a1 move.l #0x00000000, (%a1)+ /* 0xA0 */ move.l #0x00C80064, (%a1)+ /* 0xA4 */ move.l #0x44520002, (%a1)+ /* 0xA8 */ move.l #0x00C80023, (%a1)+ /* 0xAC */ move.l #DDR_CR45, %a1 move.l #0x0000C350, (%a1) /* 0xB4 */ move.l #DDR_CR56, %a1 move.l #0x04000000, (%a1)+ /* 0xE0 */ move.l #0x03000304, (%a1)+ /* 0xE4 */ move.l #0x40040000, (%a1)+ /* 0xE8 */ move.l #0xC0004004, (%a1)+ /* 0xEC */ move.l #0x0642C000, (%a1)+ /* 0xF0 */ move.l #0x00000642, (%a1)+ /* 0xF4 */ move.l #DDR_CR09, %a1 tpf move.l #0x01000100, (%a1) /* 0x24 */ move.l #0x2000, %d1 bsr asm_delay rts
4ms/stm32mp1-baremetal
1,078
third-party/u-boot/u-boot-stm32mp1-baremetal/board/qualcomm/dragonboard410c/head.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * ARM64 header for proper chain-loading with Little Kernel. * * Little Kernel shipped with Dragonboard410C boots standard Linux images for * ARM64. This file adds header that is required to boot U-Boot properly. * * For details see: * https://www.kernel.org/doc/Documentation/arm64/booting.txt * * (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com> */ #include <config.h> .global _arm64_header _arm64_header: b _start .word 0 /* Image load offset from start of RAM, little-endian */ .quad CONFIG_SYS_TEXT_BASE-PHYS_SDRAM_1 /* Effective size of kernel image, little-endian */ .quad 0 /* 0x60000 - ignored */ /* Informative flags, little-endian */ .quad 0 .quad 0 /* reserved */ .quad 0 /* reserved */ .quad 0 /* reserved */ .byte 0x41 /* Magic number, "ARM\x64" */ .byte 0x52 .byte 0x4d .byte 0x64 .word 0 /* reserved */
4ms/stm32mp1-baremetal
1,967
third-party/u-boot/u-boot-stm32mp1-baremetal/board/syteco/zmx25/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2011 * Matthias Weisser <weisserm@arcor.de> * * (C) Copyright 2009 DENX Software Engineering * Author: John Rigby <jrigby@gmail.com> * * Based on U-Boot and RedBoot sources for several different i.mx * platforms. */ #include <asm/macro.h> #include <asm/arch/macro.h> #include <asm/arch/imx-regs.h> #include <generated/asm-offsets.h> /* * clocks */ .macro init_clocks /* disable clock output */ write32 IMX_CCM_BASE + CCM_MCR, 0x00000000 write32 IMX_CCM_BASE + CCM_CCTL, 0x50030000 /* * enable all implemented clocks in all three * clock control registers */ write32 IMX_CCM_BASE + CCM_CGCR0, 0x1fffffff write32 IMX_CCM_BASE + CCM_CGCR1, 0xffffffff write32 IMX_CCM_BASE + CCM_CGCR2, 0xfffff /* Devide NAND clock by 32 */ write32 IMX_CCM_BASE + CCM_PCDR2, 0x0101011F .endm /* * sdram controller init */ .macro init_lpddr ldr r0, =IMX_ESDRAMC_BASE ldr r2, =IMX_SDRAM_BANK0_BASE /* * reset SDRAM controller * then wait for initialization to complete */ ldr r1, =(1 << 1) | (1 << 2) str r1, [r0, #ESDRAMC_ESDMISC] 1: ldr r3, [r0, #ESDRAMC_ESDMISC] tst r3, #(1 << 31) beq 1b ldr r1, =(1 << 2) str r1, [r0, #ESDRAMC_ESDMISC] ldr r1, =0x002a7420 str r1, [r0, #ESDRAMC_ESDCFG0] /* control | precharge */ ldr r1, =0x92216008 str r1, [r0, #ESDRAMC_ESDCTL0] /* dram command encoded in address */ str r1, [r2, #0x400] /* auto refresh */ ldr r1, =0xa2216008 str r1, [r0, #ESDRAMC_ESDCTL0] /* read dram twice to auto refresh */ ldr r3, [r2] ldr r3, [r2] /* control | load mode */ ldr r1, =0xb2216008 str r1, [r0, #ESDRAMC_ESDCTL0] /* mode register of lpddram */ strb r1, [r2, #0x33] /* extended mode register of lpddrram */ ldr r2, =0x81000000 strb r1, [r2] /* control | normal */ ldr r1, =0x82216008 str r1, [r0, #ESDRAMC_ESDCTL0] .endm .globl lowlevel_init lowlevel_init: init_aips init_max init_clocks init_lpddr mov pc, lr
4ms/stm32mp1-baremetal
3,997
third-party/u-boot/u-boot-stm32mp1-baremetal/board/nokia/rx51/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2011-2012 * Pali Rohár <pali.rohar@gmail.com> */ #include <config.h> relocaddr: /* address of this relocaddr section after coping */ .word . /* address of section (calculated at compile time) */ startaddr: /* address of u-boot after copying */ .word CONFIG_SYS_TEXT_BASE kernaddr: /* address of kernel after copying */ .word KERNEL_ADDRESS kernsize: /* maximal size of kernel image */ .word KERNEL_MAXSIZE kernoffs: /* offset of kernel image in loaded u-boot */ .word KERNEL_OFFSET imagesize: /* maximal size of image */ .word IMAGE_MAXSIZE ih_magic: /* IH_MAGIC in big endian from include/image.h */ .word 0x56190527 /* * Routine: save_boot_params (called after reset from start.S) * Description: Copy attached kernel to address KERNEL_ADDRESS * Copy u-boot to address CONFIG_SYS_TEXT_BASE * Return to copied u-boot address */ .global save_boot_params save_boot_params: /* Get return address */ ldr lr, =save_boot_params_ret /* Copy valid attached kernel to address KERNEL_ADDRESS */ copy_kernel_start: adr r0, relocaddr /* r0 - address of section relocaddr */ ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ cmp r0, r1 /* r4 - calculated offset */ subhi r4, r0, r1 sublo r4, r1, r0 /* r0 - start of kernel before */ ldr r0, startaddr addhi r0, r0, r4 sublo r0, r0, r4 ldr r1, kernoffs add r0, r0, r1 /* r3 - start of kernel after */ ldr r3, kernaddr /* r2 - end of kernel after */ ldr r1, kernsize add r2, r3, r1 /* r1 - end of kernel before */ add r1, r0, r1 /* remove header in target kernel */ mov r5, #0 str r5, [r3] /* check for valid kernel uImage */ ldr r4, [r0] /* r4 - 4 bytes header of kernel */ ldr r5, ih_magic /* r5 - IH_MAGIC */ cmp r4, r5 bne copy_kernel_end /* skip if invalid image */ copy_kernel_loop: ldmdb r1!, {r3 - r10} stmdb r2!, {r3 - r10} cmp r1, r0 bhi copy_kernel_loop copy_kernel_end: mov r5, #0 str r5, [r0] /* remove 4 bytes header of kernel */ /* Fix u-boot code */ fix_start: adr r0, relocaddr /* r0 - address of section relocaddr */ ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ cmp r0, r1 beq copy_uboot_end /* skip if u-boot is on correct address */ /* r5 - calculated offset */ subhi r5, r0, r1 sublo r5, r1, r0 /* r6 - maximal u-boot size */ ldr r6, imagesize /* r1 - start of u-boot after */ ldr r1, startaddr /* r0 - start of u-boot before */ addhi r0, r1, r5 sublo r0, r1, r5 /* check if we need to move uboot copy code before calling it */ cmp r5, r6 bhi copy_uboot_start /* now coping u-boot code directly is safe */ copy_code_start: /* r0 - start of u-boot before */ /* r1 - start of u-boot after */ /* r6 - maximal u-boot size */ /* r7 - maximal kernel size */ ldr r7, kernsize /* r4 - end of kernel before */ add r4, r0, r6 add r4, r4, r7 /* r5 - end of u-boot after */ ldr r5, startaddr add r5, r5, r6 /* r2 - start of loop code after */ cmp r4, r5 /* higher address (r4 or r5) */ movhs r2, r4 movlo r2, r5 /* r3 - end of loop code before */ adr r3, end /* r4 - end of loop code after */ adr r4, copy_uboot_start sub r4, r3, r4 add r4, r2, r4 copy_code_loop: ldmdb r3!, {r7 - r10} stmdb r4!, {r7 - r10} cmp r4, r2 bhi copy_code_loop copy_code_end: mov pc, r2 /* Copy u-boot to address CONFIG_SYS_TEXT_BASE */ copy_uboot_start: /* r0 - start of u-boot before */ /* r1 - start of u-boot after */ /* r6 - maximal u-boot size */ /* r2 - end of u-boot after */ add r2, r1, r6 /* condition for copying from left to right */ cmp r0, r1 addlo r1, r0, r6 /* r1 - end of u-boot before */ blo copy_uboot_loop_right copy_uboot_loop_left: ldmia r0!, {r3 - r10} stmia r1!, {r3 - r10} cmp r1, r2 blo copy_uboot_loop_left b copy_uboot_end copy_uboot_loop_right: ldmdb r1!, {r3 - r10} stmdb r2!, {r3 - r10} cmp r1, r0 bhi copy_uboot_loop_right copy_uboot_end: bx lr end:
4ms/stm32mp1-baremetal
3,076
third-party/u-boot/u-boot-stm32mp1-baremetal/board/samsung/smdkc100/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2009 Samsung Electronics * Kyungmin Park <kyungmin.park@samsung.com> * Minkyu Kang <mk7.kang@samsung.com> */ #include <config.h> #include <asm/arch/cpu.h> #include <asm/arch/power.h> /* * Register usages: * * r5 has zero always */ .globl lowlevel_init lowlevel_init: mov r9, lr /* r5 has always zero */ mov r5, #0 ldr r8, =S5PC100_GPIO_BASE /* Disable Watchdog */ ldr r0, =S5PC100_WATCHDOG_BASE @0xEA200000 orr r0, r0, #0x0 str r5, [r0] /* setting SRAM */ ldr r0, =S5PC100_SROMC_BASE ldr r1, =0x9 str r1, [r0] /* S5PC100 has 3 groups of interrupt sources */ ldr r0, =S5PC100_VIC0_BASE @0xE4000000 ldr r1, =S5PC100_VIC1_BASE @0xE4000000 ldr r2, =S5PC100_VIC2_BASE @0xE4000000 /* Disable all interrupts (VIC0, VIC1 and VIC2) */ mvn r3, #0x0 str r3, [r0, #0x14] @INTENCLEAR str r3, [r1, #0x14] @INTENCLEAR str r3, [r2, #0x14] @INTENCLEAR /* Set all interrupts as IRQ */ str r5, [r0, #0xc] @INTSELECT str r5, [r1, #0xc] @INTSELECT str r5, [r2, #0xc] @INTSELECT /* Pending Interrupt Clear */ str r5, [r0, #0xf00] @INTADDRESS str r5, [r1, #0xf00] @INTADDRESS str r5, [r2, #0xf00] @INTADDRESS /* for UART */ bl uart_asm_init /* for TZPC */ bl tzpc_asm_init 1: mov lr, r9 mov pc, lr /* * system_clock_init: Initialize core clock and bus clock. * void system_clock_init(void) */ system_clock_init: ldr r8, =S5PC100_CLOCK_BASE @ 0xE0100000 /* Set Clock divider */ ldr r1, =0x00011110 str r1, [r8, #0x304] ldr r1, =0x1 str r1, [r8, #0x308] ldr r1, =0x00011301 str r1, [r8, #0x300] /* Set Lock Time */ ldr r1, =0xe10 @ Locktime : 0xe10 = 3600 str r1, [r8, #0x000] @ APLL_LOCK str r1, [r8, #0x004] @ MPLL_LOCK str r1, [r8, #0x008] @ EPLL_LOCK str r1, [r8, #0x00C] @ HPLL_LOCK /* APLL_CON */ ldr r1, =0x81bc0400 @ SDIV 0, PDIV 4, MDIV 444 (1332MHz) str r1, [r8, #0x100] /* MPLL_CON */ ldr r1, =0x80590201 @ SDIV 1, PDIV 2, MDIV 89 (267MHz) str r1, [r8, #0x104] /* EPLL_CON */ ldr r1, =0x80870303 @ SDIV 3, PDIV 3, MDIV 135 (67.5MHz) str r1, [r8, #0x108] /* HPLL_CON */ ldr r1, =0x80600603 str r1, [r8, #0x10C] /* Set Source Clock */ ldr r1, =0x1111 @ A, M, E, HPLL Muxing str r1, [r8, #0x200] @ CLK_SRC0 ldr r1, =0x1000001 @ Uart Clock & CLK48M Muxing str r1, [r8, #0x204] @ CLK_SRC1 ldr r1, =0x9000 @ ARMCLK/4 str r1, [r8, #0x400] @ CLK_OUT /* wait at least 200us to stablize all clock */ mov r2, #0x10000 1: subs r2, r2, #1 bne 1b mov pc, lr /* * uart_asm_init: Initialize UART's pins */ uart_asm_init: mov r0, r8 ldr r1, =0x22222222 str r1, [r0, #0x0] @ GPA0_CON ldr r1, =0x00022222 str r1, [r0, #0x20] @ GPA1_CON mov pc, lr /* * tzpc_asm_init: Initialize TZPC */ tzpc_asm_init: ldr r0, =0xE3800000 mov r1, #0x0 str r1, [r0] mov r1, #0xff str r1, [r0, #0x804] str r1, [r0, #0x810] ldr r0, =0xE2800000 str r1, [r0, #0x804] str r1, [r0, #0x810] str r1, [r0, #0x81C] ldr r0, =0xE2900000 str r1, [r0, #0x804] str r1, [r0, #0x810] mov pc, lr
4ms/stm32mp1-baremetal
10,334
third-party/u-boot/u-boot-stm32mp1-baremetal/board/samsung/goni/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Memory Setup stuff - taken from blob memsetup.S * * Copyright (C) 2009 Samsung Electronics * Kyungmin Park <kyungmin.park@samsung.com> */ #include <config.h> #include <asm/arch/cpu.h> #include <asm/arch/clock.h> #include <asm/arch/power.h> /* * Register usages: * * r5 has zero always * r7 has S5PC100 GPIO base, 0xE0300000 * r8 has real GPIO base, 0xE0300000, 0xE0200000 at S5PC100, S5PC110 repectively * r9 has Mobile DDR size, 1 means 1GiB, 2 means 2GiB and so on */ .globl lowlevel_init lowlevel_init: mov r11, lr /* r5 has always zero */ mov r5, #0 ldr r7, =S5PC100_GPIO_BASE ldr r8, =S5PC100_GPIO_BASE /* Read CPU ID */ ldr r2, =S5PC110_PRO_ID ldr r0, [r2] mov r1, #0x00010000 and r0, r0, r1 cmp r0, r5 beq 100f ldr r8, =S5PC110_GPIO_BASE 100: /* Turn on KEY_LED_ON [GPJ4(1)] XMSMWEN */ cmp r7, r8 beq skip_check_didle @ Support C110 only ldr r0, =S5PC110_RST_STAT ldr r1, [r0] and r1, r1, #0x000D0000 cmp r1, #(0x1 << 19) @ DEEPIDLE_WAKEUP beq didle_wakeup cmp r7, r8 skip_check_didle: addeq r0, r8, #0x280 @ S5PC100_GPIO_J4 addne r0, r8, #0x2C0 @ S5PC110_GPIO_J4 ldr r1, [r0, #0x0] @ GPIO_CON_OFFSET bic r1, r1, #(0xf << 4) @ 1 * 4-bit orr r1, r1, #(0x1 << 4) str r1, [r0, #0x0] @ GPIO_CON_OFFSET ldr r1, [r0, #0x4] @ GPIO_DAT_OFFSET bic r1, r1, #(1 << 1) str r1, [r0, #0x4] @ GPIO_DAT_OFFSET /* Don't setup at s5pc100 */ beq 100f /* * Initialize Async Register Setting for EVT1 * Because we are setting EVT1 as the default value of EVT0, * setting EVT0 as well does not make things worse. * Thus, for the simplicity, we set for EVT0, too * * The "Async Registers" are: * 0xE0F0_0000 * 0xE1F0_0000 * 0xF180_0000 * 0xF190_0000 * 0xF1A0_0000 * 0xF1B0_0000 * 0xF1C0_0000 * 0xF1D0_0000 * 0xF1E0_0000 * 0xF1F0_0000 * 0xFAF0_0000 */ ldr r0, =0xe0f00000 ldr r1, [r0] bic r1, r1, #0x1 str r1, [r0] ldr r0, =0xe1f00000 ldr r1, [r0] bic r1, r1, #0x1 str r1, [r0] ldr r0, =0xf1800000 ldr r1, [r0] bic r1, r1, #0x1 str r1, [r0] ldr r0, =0xf1900000 ldr r1, [r0] bic r1, r1, #0x1 str r1, [r0] ldr r0, =0xf1a00000 ldr r1, [r0] bic r1, r1, #0x1 str r1, [r0] ldr r0, =0xf1b00000 ldr r1, [r0] bic r1, r1, #0x1 str r1, [r0] ldr r0, =0xf1c00000 ldr r1, [r0] bic r1, r1, #0x1 str r1, [r0] ldr r0, =0xf1d00000 ldr r1, [r0] bic r1, r1, #0x1 str r1, [r0] ldr r0, =0xf1e00000 ldr r1, [r0] bic r1, r1, #0x1 str r1, [r0] ldr r0, =0xf1f00000 ldr r1, [r0] bic r1, r1, #0x1 str r1, [r0] ldr r0, =0xfaf00000 ldr r1, [r0] bic r1, r1, #0x1 str r1, [r0] /* * Diable ABB block to reduce sleep current at low temperature * Note that it's hidden register setup don't modify it */ ldr r0, =0xE010C300 ldr r1, =0x00800000 str r1, [r0] 100: /* IO retension release */ ldreq r0, =S5PC100_OTHERS @ 0xE0108200 ldrne r0, =S5PC110_OTHERS @ 0xE010E000 ldr r1, [r0] ldreq r2, =(1 << 31) @ IO_RET_REL ldrne r2, =((1 << 31) | (1 << 30) | (1 << 29) | (1 << 28)) orr r1, r1, r2 /* Do not release retention here for S5PC110 */ streq r1, [r0] /* Disable Watchdog */ ldreq r0, =S5PC100_WATCHDOG_BASE @ 0xEA200000 ldrne r0, =S5PC110_WATCHDOG_BASE @ 0xE2700000 str r5, [r0] /* setting SRAM */ ldreq r0, =S5PC100_SROMC_BASE ldrne r0, =S5PC110_SROMC_BASE ldr r1, =0x9 str r1, [r0] /* S5PC100 has 3 groups of interrupt sources */ ldreq r0, =S5PC100_VIC0_BASE @ 0xE4000000 ldrne r0, =S5PC110_VIC0_BASE @ 0xF2000000 add r1, r0, #0x00100000 add r2, r0, #0x00200000 /* Disable all interrupts (VIC0, VIC1 and VIC2) */ mvn r3, #0x0 str r3, [r0, #0x14] @ INTENCLEAR str r3, [r1, #0x14] @ INTENCLEAR str r3, [r2, #0x14] @ INTENCLEAR /* Set all interrupts as IRQ */ str r5, [r0, #0xc] @ INTSELECT str r5, [r1, #0xc] @ INTSELECT str r5, [r2, #0xc] @ INTSELECT /* Pending Interrupt Clear */ str r5, [r0, #0xf00] @ INTADDRESS str r5, [r1, #0xf00] @ INTADDRESS str r5, [r2, #0xf00] @ INTADDRESS /* for UART */ bl uart_asm_init bl internal_ram_init cmp r7, r8 /* Clear wakeup status register */ ldreq r0, =S5PC100_WAKEUP_STAT ldrne r0, =S5PC110_WAKEUP_STAT ldr r1, [r0] str r1, [r0] /* IO retension release */ ldreq r0, =S5PC100_OTHERS @ 0xE0108200 ldrne r0, =S5PC110_OTHERS @ 0xE010E000 ldr r1, [r0] ldreq r2, =(1 << 31) @ IO_RET_REL ldrne r2, =((1 << 31) | (1 << 30) | (1 << 29) | (1 << 28)) orr r1, r1, r2 str r1, [r0] b 1f didle_wakeup: /* Wait when APLL is locked */ ldr r0, =0xE0100100 @ S5PC110_APLL_CON lockloop: ldr r1, [r0] and r1, r1, #(1 << 29) cmp r1, #(1 << 29) bne lockloop ldr r0, =S5PC110_INFORM0 ldr r1, [r0] mov pc, r1 nop nop nop nop nop 1: mov lr, r11 mov pc, lr /* * system_clock_init: Initialize core clock and bus clock. * void system_clock_init(void) */ system_clock_init: ldr r0, =S5PC110_CLOCK_BASE @ 0xE0100000 /* Check S5PC100 */ cmp r7, r8 bne 110f 100: /* Set Lock Time */ ldr r1, =0xe10 @ Locktime : 0xe10 = 3600 str r1, [r0, #0x000] @ S5PC100_APLL_LOCK str r1, [r0, #0x004] @ S5PC100_MPLL_LOCK str r1, [r0, #0x008] @ S5PC100_EPLL_LOCK str r1, [r0, #0x00C] @ S5PC100_HPLL_LOCK /* S5P_APLL_CON */ ldr r1, =0x81bc0400 @ SDIV 0, PDIV 4, MDIV 444 (1333MHz) str r1, [r0, #0x100] /* S5P_MPLL_CON */ ldr r1, =0x80590201 @ SDIV 1, PDIV 2, MDIV 89 (267MHz) str r1, [r0, #0x104] /* S5P_EPLL_CON */ ldr r1, =0x80870303 @ SDIV 3, PDIV 3, MDIV 135 (67.5MHz) str r1, [r0, #0x108] /* S5P_HPLL_CON */ ldr r1, =0x80600603 @ SDIV 3, PDIV 6, MDIV 96 str r1, [r0, #0x10C] ldr r1, [r0, #0x300] ldr r2, =0x00003fff bic r1, r1, r2 ldr r2, =0x00011301 orr r1, r1, r2 str r1, [r0, #0x300] ldr r1, [r0, #0x304] ldr r2, =0x00011110 orr r1, r1, r2 str r1, [r0, #0x304] ldr r1, =0x00000001 str r1, [r0, #0x308] /* Set Source Clock */ ldr r1, =0x00001111 @ A, M, E, HPLL Muxing str r1, [r0, #0x200] @ S5PC1XX_CLK_SRC0 b 200f 110: ldr r0, =0xE010C000 @ S5PC110_PWR_CFG /* Set OSC_FREQ value */ ldr r1, =0xf str r1, [r0, #0x100] @ S5PC110_OSC_FREQ /* Set MTC_STABLE value */ ldr r1, =0xffffffff str r1, [r0, #0x110] @ S5PC110_MTC_STABLE /* Set CLAMP_STABLE value */ ldr r1, =0x3ff03ff str r1, [r0, #0x114] @ S5PC110_CLAMP_STABLE ldr r0, =S5PC110_CLOCK_BASE @ 0xE0100000 /* Set Clock divider */ ldr r1, =0x14131330 @ 1:1:4:4, 1:4:5 str r1, [r0, #0x300] ldr r1, =0x11110111 @ UART[3210]: MMC[3210] str r1, [r0, #0x310] /* Set Lock Time */ ldr r1, =0x2cf @ Locktime : 30us str r1, [r0, #0x000] @ S5PC110_APLL_LOCK ldr r1, =0xe10 @ Locktime : 0xe10 = 3600 str r1, [r0, #0x008] @ S5PC110_MPLL_LOCK str r1, [r0, #0x010] @ S5PC110_EPLL_LOCK str r1, [r0, #0x020] @ S5PC110_VPLL_LOCK /* S5PC110_APLL_CON */ ldr r1, =0x80C80601 @ 800MHz str r1, [r0, #0x100] /* S5PC110_MPLL_CON */ ldr r1, =0x829B0C01 @ 667MHz str r1, [r0, #0x108] /* S5PC110_EPLL_CON */ ldr r1, =0x80600602 @ 96MHz VSEL 0 P 6 M 96 S 2 str r1, [r0, #0x110] /* S5PC110_VPLL_CON */ ldr r1, =0x806C0603 @ 54MHz str r1, [r0, #0x120] /* Set Source Clock */ ldr r1, =0x10001111 @ A, M, E, VPLL Muxing str r1, [r0, #0x200] @ S5PC1XX_CLK_SRC0 /* OneDRAM(DMC0) clock setting */ ldr r1, =0x01000000 @ ONEDRAM_SEL[25:24] 1 SCLKMPLL str r1, [r0, #0x218] @ S5PC110_CLK_SRC6 ldr r1, =0x30000000 @ ONEDRAM_RATIO[31:28] 3 + 1 str r1, [r0, #0x318] @ S5PC110_CLK_DIV6 /* XCLKOUT = XUSBXTI 24MHz */ add r2, r0, #0xE000 @ S5PC110_OTHERS ldr r1, [r2] orr r1, r1, #(0x3 << 8) @ CLKOUT[9:8] 3 XUSBXTI str r1, [r2] /* CLK_IP0 */ ldr r1, =0x8fefeeb @ DMC[1:0] PDMA0[3] IMEM[5] str r1, [r0, #0x460] @ S5PC110_CLK_IP0 /* CLK_IP1 */ ldr r1, =0xe9fdf0f9 @ FIMD[0] USBOTG[16] @ NANDXL[24] str r1, [r0, #0x464] @ S5PC110_CLK_IP1 /* CLK_IP2 */ ldr r1, =0xf75f7fc @ CORESIGHT[8] MODEM[9] @ HOSTIF[10] HSMMC0[16] @ HSMMC2[18] VIC[27:24] str r1, [r0, #0x468] @ S5PC110_CLK_IP2 /* CLK_IP3 */ ldr r1, =0x8eff038c @ I2C[8:6] @ SYSTIMER[16] UART0[17] @ UART1[18] UART2[19] @ UART3[20] WDT[22] @ PWM[23] GPIO[26] SYSCON[27] str r1, [r0, #0x46c] @ S5PC110_CLK_IP3 /* CLK_IP4 */ ldr r1, =0xfffffff1 @ CHIP_ID[0] TZPC[8:5] str r1, [r0, #0x470] @ S5PC110_CLK_IP3 200: /* wait at least 200us to stablize all clock */ mov r2, #0x10000 1: subs r2, r2, #1 bne 1b mov pc, lr internal_ram_init: ldreq r0, =0xE3800000 ldrne r0, =0xF1500000 ldr r1, =0x0 str r1, [r0] mov pc, lr /* * uart_asm_init: Initialize UART's pins */ uart_asm_init: /* set GPIO to enable UART0-UART4 */ mov r0, r8 ldr r1, =0x22222222 str r1, [r0, #0x0] @ S5PC100_GPIO_A0_OFFSET ldr r1, =0x00002222 str r1, [r0, #0x20] @ S5PC100_GPIO_A1_OFFSET /* Check S5PC100 */ cmp r7, r8 bne 110f /* UART_SEL GPK0[5] at S5PC100 */ add r0, r8, #0x2A0 @ S5PC100_GPIO_K0_OFFSET ldr r1, [r0, #0x0] @ S5PC1XX_GPIO_CON_OFFSET bic r1, r1, #(0xf << 20) @ 20 = 5 * 4-bit orr r1, r1, #(0x1 << 20) @ Output str r1, [r0, #0x0] @ S5PC1XX_GPIO_CON_OFFSET ldr r1, [r0, #0x8] @ S5PC1XX_GPIO_PULL_OFFSET bic r1, r1, #(0x3 << 10) @ 10 = 5 * 2-bit orr r1, r1, #(0x2 << 10) @ Pull-up enabled str r1, [r0, #0x8] @ S5PC1XX_GPIO_PULL_OFFSET ldr r1, [r0, #0x4] @ S5PC1XX_GPIO_DAT_OFFSET orr r1, r1, #(1 << 5) @ 5 = 5 * 1-bit str r1, [r0, #0x4] @ S5PC1XX_GPIO_DAT_OFFSET b 200f 110: /* * Note that the following address * 0xE020'0360 is reserved address at S5PC100 */ /* UART_SEL MP0_5[7] at S5PC110 */ add r0, r8, #0x360 @ S5PC110_GPIO_MP0_5_OFFSET ldr r1, [r0, #0x0] @ S5PC1XX_GPIO_CON_OFFSET bic r1, r1, #(0xf << 28) @ 28 = 7 * 4-bit orr r1, r1, #(0x1 << 28) @ Output str r1, [r0, #0x0] @ S5PC1XX_GPIO_CON_OFFSET ldr r1, [r0, #0x8] @ S5PC1XX_GPIO_PULL_OFFSET bic r1, r1, #(0x3 << 14) @ 14 = 7 * 2-bit orr r1, r1, #(0x2 << 14) @ Pull-up enabled str r1, [r0, #0x8] @ S5PC1XX_GPIO_PULL_OFFSET ldr r1, [r0, #0x4] @ S5PC1XX_GPIO_DAT_OFFSET orr r1, r1, #(1 << 7) @ 7 = 7 * 1-bit str r1, [r0, #0x4] @ S5PC1XX_GPIO_DAT_OFFSET 200: mov pc, lr
4ms/stm32mp1-baremetal
3,529
third-party/u-boot/u-boot-stm32mp1-baremetal/board/armadeus/apf27/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2013 Philippe Reynes <tremyfr@yahoo.fr> */ #include <config.h> #include <generated/asm-offsets.h> #include <asm/macro.h> #include <asm/arch/imx-regs.h> #include "apf27.h" .macro init_aipi /* * setup AIPI1 and AIPI2 */ write32 AIPI1_PSR0, ACFG_AIPI1_PSR0_VAL write32 AIPI1_PSR1, ACFG_AIPI1_PSR1_VAL write32 AIPI2_PSR0, ACFG_AIPI2_PSR0_VAL write32 AIPI2_PSR1, ACFG_AIPI2_PSR1_VAL /* Change SDRAM signal strengh */ ldr r0, =GPCR ldr r1, =ACFG_GPCR_VAL ldr r5, [r0] orr r5, r5, r1 str r5, [r0] .endm /* init_aipi */ .macro init_clock ldr r0, =CSCR /* disable MPLL/SPLL first */ ldr r1, [r0] bic r1, r1, #(CSCR_MPEN|CSCR_SPEN) str r1, [r0] /* * pll clock initialization predefined in apf27.h */ write32 MPCTL0, ACFG_MPCTL0_VAL write32 SPCTL0, ACFG_SPCTL0_VAL write32 CSCR, ACFG_CSCR_VAL|CSCR_MPLL_RESTART|CSCR_SPLL_RESTART /* * add some delay here */ mov r1, #0x1000 1: subs r1, r1, #0x1 bne 1b /* peripheral clock divider */ write32 PCDR0, ACFG_PCDR0_VAL write32 PCDR1, ACFG_PCDR1_VAL /* Configure PCCR0 and PCCR1 */ write32 PCCR0, ACFG_PCCR0_VAL write32 PCCR1, ACFG_PCCR1_VAL .endm /* init_clock */ .macro init_ddr /* wait for SDRAM/LPDDR ready (SDRAMRDY) */ ldr r0, =IMX_ESD_BASE ldr r4, =ESDMISC_SDRAM_RDY 2: ldr r1, [r0, #ESDMISC_ROF] ands r1, r1, r4 bpl 2b /* LPDDR Soft Reset Mobile/Low Power DDR SDRAM. */ ldr r0, =IMX_ESD_BASE ldr r4, =ACFG_ESDMISC_VAL orr r1, r4, #ESDMISC_MDDR_DL_RST str r1, [r0, #ESDMISC_ROF] /* Hold for more than 200ns */ ldr r1, =0x10000 1: subs r1, r1, #0x1 bne 1b str r4, [r0] ldr r0, =IMX_ESD_BASE ldr r1, =ACFG_SDRAM_ESDCFG_REGISTER_VAL str r1, [r0, #ESDCFG0_ROF] ldr r0, =IMX_ESD_BASE ldr r1, =ACFG_PRECHARGE_CMD str r1, [r0, #ESDCTL0_ROF] /* write8(0xA0001000, any value) */ ldr r1, =PHYS_SDRAM_1+ACFG_SDRAM_PRECHARGE_ALL_VAL strb r2, [r1] ldr r1, =ACFG_AUTOREFRESH_CMD str r1, [r0, #ESDCTL0_ROF] ldr r4, =PHYS_SDRAM_1 /* CSD0 base address */ ldr r6,=0x7 /* load loop counter */ 1: str r5,[r4] /* run auto-refresh cycle to array 0 */ subs r6,r6,#1 bne 1b ldr r1, =ACFG_SET_MODE_REG_CMD str r1, [r0, #ESDCTL0_ROF] /* set standard mode register */ ldr r4, = PHYS_SDRAM_1+ACFG_SDRAM_MODE_REGISTER_VAL strb r2, [r4] /* set extended mode register */ ldr r4, =PHYS_SDRAM_1+ACFG_SDRAM_EXT_MODE_REGISTER_VAL strb r5, [r4] ldr r1, =ACFG_NORMAL_RW_CMD str r1, [r0, #ESDCTL0_ROF] /* 2nd sdram */ ldr r0, =IMX_ESD_BASE ldr r1, =ACFG_SDRAM_ESDCFG_REGISTER_VAL str r1, [r0, #ESDCFG1_ROF] ldr r0, =IMX_ESD_BASE ldr r1, =ACFG_PRECHARGE_CMD str r1, [r0, #ESDCTL1_ROF] /* write8(0xB0001000, any value) */ ldr r1, =PHYS_SDRAM_2+ACFG_SDRAM_PRECHARGE_ALL_VAL strb r2, [r1] ldr r1, =ACFG_AUTOREFRESH_CMD str r1, [r0, #ESDCTL1_ROF] ldr r4, =PHYS_SDRAM_2 /* CSD1 base address */ ldr r6,=0x7 /* load loop counter */ 1: str r5,[r4] /* run auto-refresh cycle to array 0 */ subs r6,r6,#1 bne 1b ldr r1, =ACFG_SET_MODE_REG_CMD str r1, [r0, #ESDCTL1_ROF] /* set standard mode register */ ldr r4, =PHYS_SDRAM_2+ACFG_SDRAM_MODE_REGISTER_VAL strb r2, [r4] /* set extended mode register */ ldr r4, =PHYS_SDRAM_2+ACFG_SDRAM_EXT_MODE_REGISTER_VAL strb r2, [r4] ldr r1, =ACFG_NORMAL_RW_CMD str r1, [r0, #ESDCTL1_ROF] .endm /* init_ddr */ .globl lowlevel_init lowlevel_init: init_aipi init_clock #ifdef CONFIG_SPL_BUILD init_ddr #endif mov pc, lr
4ms/stm32mp1-baremetal
4,834
third-party/u-boot/u-boot-stm32mp1-baremetal/post/lib_powerpc/asm.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2002 Wolfgang Denk <wd@denx.de> */ #include <config.h> #include <post.h> #include <ppc_asm.tmpl> #include <ppc_defs.h> #include <asm/cache.h> #if CONFIG_POST & CONFIG_SYS_POST_CPU /* void cpu_post_exec_02 (ulong *code, ulong op1, ulong op2); */ .global cpu_post_exec_02 cpu_post_exec_02: isync mflr r0 stwu r0, -4(r1) subi r1, r1, 104 stmw r6, 0(r1) mtlr r3 mr r3, r4 mr r4, r5 blrl lmw r6, 0(r1) addi r1, r1, 104 lwz r0, 0(r1) addi r1, r1, 4 mtlr r0 blr /* void cpu_post_exec_04 (ulong *code, ulong op1, ulong op2, ulong op3, ulong op4); */ .global cpu_post_exec_04 cpu_post_exec_04: isync mflr r0 stwu r0, -4(r1) subi r1, r1, 96 stmw r8, 0(r1) mtlr r3 mr r3, r4 mr r4, r5 mr r5, r6 mtxer r7 blrl lmw r8, 0(r1) addi r1, r1, 96 lwz r0, 0(r1) addi r1, r1, 4 mtlr r0 blr /* void cpu_post_exec_12 (ulong *code, ulong *res, ulong op1, ulong op2); */ .global cpu_post_exec_12 cpu_post_exec_12: isync mflr r0 stwu r0, -4(r1) stwu r4, -4(r1) mtlr r3 mr r3, r5 mr r4, r6 blrl lwz r4, 0(r1) stw r3, 0(r4) lwz r0, 4(r1) addi r1, r1, 8 mtlr r0 blr /* void cpu_post_exec_11 (ulong *code, ulong *res, ulong op1); */ .global cpu_post_exec_11 cpu_post_exec_11: isync mflr r0 stwu r0, -4(r1) stwu r4, -4(r1) mtlr r3 mr r3, r5 blrl lwz r4, 0(r1) stw r3, 0(r4) lwz r0, 4(r1) addi r1, r1, 8 mtlr r0 blr /* void cpu_post_exec_21 (ulong *code, ulong *cr, ulong *res, ulong op1); */ .global cpu_post_exec_21 cpu_post_exec_21: isync mflr r0 stwu r0, -4(r1) stwu r4, -4(r1) stwu r5, -4(r1) li r0, 0 mtxer r0 lwz r0, 0(r4) mtcr r0 mtlr r3 mr r3, r6 blrl mfcr r0 lwz r4, 4(r1) stw r0, 0(r4) lwz r4, 0(r1) stw r3, 0(r4) lwz r0, 8(r1) addi r1, r1, 12 mtlr r0 blr /* void cpu_post_exec_22 (ulong *code, ulong *cr, ulong *res, ulong op1, ulong op2); */ .global cpu_post_exec_22 cpu_post_exec_22: isync mflr r0 stwu r0, -4(r1) stwu r4, -4(r1) stwu r5, -4(r1) li r0, 0 mtxer r0 lwz r0, 0(r4) mtcr r0 mtlr r3 mr r3, r6 mr r4, r7 blrl mfcr r0 lwz r4, 4(r1) stw r0, 0(r4) lwz r4, 0(r1) stw r3, 0(r4) lwz r0, 8(r1) addi r1, r1, 12 mtlr r0 blr /* void cpu_post_exec_12w (ulong *code, ulong *op1, ulong op2, ulong op3); */ .global cpu_post_exec_12w cpu_post_exec_12w: isync mflr r0 stwu r0, -4(r1) stwu r4, -4(r1) mtlr r3 lwz r3, 0(r4) mr r4, r5 mr r5, r6 blrl lwz r4, 0(r1) stw r3, 0(r4) lwz r0, 4(r1) addi r1, r1, 8 mtlr r0 blr /* void cpu_post_exec_11w (ulong *code, ulong *op1, ulong op2); */ .global cpu_post_exec_11w cpu_post_exec_11w: isync mflr r0 stwu r0, -4(r1) stwu r4, -4(r1) mtlr r3 lwz r3, 0(r4) mr r4, r5 blrl lwz r4, 0(r1) stw r3, 0(r4) lwz r0, 4(r1) addi r1, r1, 8 mtlr r0 blr /* void cpu_post_exec_22w (ulong *code, ulong *op1, ulong op2, ulong *op3); */ .global cpu_post_exec_22w cpu_post_exec_22w: isync mflr r0 stwu r0, -4(r1) stwu r4, -4(r1) stwu r6, -4(r1) mtlr r3 lwz r3, 0(r4) mr r4, r5 blrl lwz r4, 4(r1) stw r3, 0(r4) lwz r4, 0(r1) stw r5, 0(r4) lwz r0, 8(r1) addi r1, r1, 12 mtlr r0 blr /* void cpu_post_exec_21w (ulong *code, ulong *op1, ulong *op2); */ .global cpu_post_exec_21w cpu_post_exec_21w: isync mflr r0 stwu r0, -4(r1) stwu r4, -4(r1) stwu r5, -4(r1) mtlr r3 lwz r3, 0(r4) blrl lwz r5, 4(r1) stw r3, 0(r5) lwz r5, 0(r1) stw r4, 0(r5) lwz r0, 8(r1) addi r1, r1, 12 mtlr r0 blr /* void cpu_post_exec_21x (ulong *code, ulong *op1, ulong *op2, ulong op3); */ .global cpu_post_exec_21x cpu_post_exec_21x: isync mflr r0 stwu r0, -4(r1) stwu r4, -4(r1) stwu r5, -4(r1) mtlr r3 mr r3, r6 blrl lwz r5, 4(r1) stw r3, 0(r5) lwz r5, 0(r1) stw r4, 0(r5) lwz r0, 8(r1) addi r1, r1, 12 mtlr r0 blr /* void cpu_post_exec_31 (ulong *code, ulong *ctr, ulong *lr, ulong *jump, ulong cr); */ .global cpu_post_exec_31 cpu_post_exec_31: isync mflr r0 stwu r0, -4(r1) stwu r4, -4(r1) stwu r5, -4(r1) stwu r6, -4(r1) mtlr r3 lwz r3, 0(r4) lwz r4, 0(r5) mr r6, r7 mfcr r7 blrl mtcr r7 lwz r7, 8(r1) stw r3, 0(r7) lwz r7, 4(r1) stw r4, 0(r7) lwz r7, 0(r1) stw r5, 0(r7) lwz r0, 12(r1) addi r1, r1, 16 mtlr r0 blr /* int cpu_post_complex_1_asm (int a1, int a2, int a3, int a4, int n); */ .global cpu_post_complex_1_asm cpu_post_complex_1_asm: li r9,0 cmpw r9,r7 bge cpu_post_complex_1_done mtctr r7 cpu_post_complex_1_loop: mullw r0,r3,r4 subf r0,r5,r0 divw r0,r0,r6 add r9,r9,r0 bdnz cpu_post_complex_1_loop cpu_post_complex_1_done: mr r3,r9 blr /* int cpu_post_complex_2_asm (int x, int n); */ .global cpu_post_complex_2_asm cpu_post_complex_2_asm: mr. r0,r4 mtctr r0 mr r0,r3 li r3,1 li r4,1 blelr cpu_post_complex_2_loop: mullw r3,r3,r0 add r3,r3,r4 bdnz cpu_post_complex_2_loop blr #endif
4ms/stm32mp1-baremetal
1,031
third-party/u-boot/u-boot-stm32mp1-baremetal/examples/api/crt0.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2007 Semihalf * * Written by: Rafal Jaworowski <raj@semihalf.com> */ #if defined(CONFIG_PPC) .text .globl _start _start: lis %r11, search_hint@ha addi %r11, %r11, search_hint@l stw %r1, 0(%r11) b main .globl syscall syscall: lis %r11, syscall_ptr@ha addi %r11, %r11, syscall_ptr@l lwz %r11, 0(%r11) mtctr %r11 bctr #elif defined(CONFIG_ARM) .text .globl _start _start: ldr ip, =search_hint str sp, [ip] b main .globl syscall syscall: ldr ip, =syscall_ptr ldr pc, [ip] #elif defined(CONFIG_MIPS) #include <asm/asm.h> .text .globl __start .ent __start __start: PTR_S $sp, search_hint b main .end __start .globl syscall .ent syscall syscall: PTR_S $ra, return_addr PTR_L $t9, syscall_ptr jalr $t9 nop PTR_L $ra, return_addr jr $ra nop .end syscall return_addr: .align 8 .long 0 #else #error No support for this arch! #endif .globl syscall_ptr syscall_ptr: .align 8 .long 0 .globl search_hint search_hint: .long 0
4ms/stm32mp1-baremetal
1,939
third-party/u-boot/u-boot-stm32mp1-baremetal/examples/standalone/ppc_longjmp.S
/* SPDX-License-Identifier: LGPL-2.1+ */ /* longjmp for PowerPC. Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. */ #include <ppc_asm.tmpl> # define JB_GPR1 0 /* Also known as the stack pointer */ # define JB_GPR2 1 # define JB_LR 2 /* The address we will return to */ # define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total */ # define JB_CR 21 /* Condition code registers. */ # define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total */ # define JB_SIZE (58*4) #define FP(x...) x #define FP(x...) x .globl ppc_longjmp; ppc_longjmp: lwz r1,(JB_GPR1*4)(r3) lwz r2,(JB_GPR2*4)(r3) lwz r0,(JB_LR*4)(r3) lwz r14,((JB_GPRS+0)*4)(r3) FP( lfd 14,((JB_FPRS+0*2)*4)(r3)) lwz r15,((JB_GPRS+1)*4)(r3) FP( lfd 15,((JB_FPRS+1*2)*4)(r3)) lwz r16,((JB_GPRS+2)*4)(r3) FP( lfd 16,((JB_FPRS+2*2)*4)(r3)) lwz r17,((JB_GPRS+3)*4)(r3) FP( lfd 17,((JB_FPRS+3*2)*4)(r3)) lwz r18,((JB_GPRS+4)*4)(r3) FP( lfd 18,((JB_FPRS+4*2)*4)(r3)) lwz r19,((JB_GPRS+5)*4)(r3) FP( lfd 19,((JB_FPRS+5*2)*4)(r3)) lwz r20,((JB_GPRS+6)*4)(r3) FP( lfd 20,((JB_FPRS+6*2)*4)(r3)) mtlr r0 lwz r21,((JB_GPRS+7)*4)(r3) FP( lfd 21,((JB_FPRS+7*2)*4)(r3)) lwz r22,((JB_GPRS+8)*4)(r3) FP( lfd 22,((JB_FPRS+8*2)*4)(r3)) lwz r0,(JB_CR*4)(r3) lwz r23,((JB_GPRS+9)*4)(r3) FP( lfd 23,((JB_FPRS+9*2)*4)(r3)) lwz r24,((JB_GPRS+10)*4)(r3) FP( lfd 24,((JB_FPRS+10*2)*4)(r3)) lwz r25,((JB_GPRS+11)*4)(r3) FP( lfd 25,((JB_FPRS+11*2)*4)(r3)) mtcrf 0xFF,r0 lwz r26,((JB_GPRS+12)*4)(r3) FP( lfd 26,((JB_FPRS+12*2)*4)(r3)) lwz r27,((JB_GPRS+13)*4)(r3) FP( lfd 27,((JB_FPRS+13*2)*4)(r3)) lwz r28,((JB_GPRS+14)*4)(r3) FP( lfd 28,((JB_FPRS+14*2)*4)(r3)) lwz r29,((JB_GPRS+15)*4)(r3) FP( lfd 29,((JB_FPRS+15*2)*4)(r3)) lwz r30,((JB_GPRS+16)*4)(r3) FP( lfd 30,((JB_FPRS+16*2)*4)(r3)) lwz r31,((JB_GPRS+17)*4)(r3) FP( lfd 31,((JB_FPRS+17*2)*4)(r3)) mr r3,r4 blr
4ms/stm32mp1-baremetal
1,960
third-party/u-boot/u-boot-stm32mp1-baremetal/examples/standalone/ppc_setjmp.S
/* SPDX-License-Identifier: LGPL-2.1+ */ /* setjmp for PowerPC. Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. */ #include <ppc_asm.tmpl> # define JB_GPR1 0 /* Also known as the stack pointer */ # define JB_GPR2 1 # define JB_LR 2 /* The address we will return to */ # define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total */ # define JB_CR 21 /* Condition code registers. */ # define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total */ # define JB_SIZE (58*4) #define FP(x...) x .globl setctxsp; setctxsp: mr r1, r3 blr .globl ppc_setjmp; ppc_setjmp: stw r1,(JB_GPR1*4)(3) mflr r0 stw r2,(JB_GPR2*4)(3) stw r14,((JB_GPRS+0)*4)(3) FP( stfd 14,((JB_FPRS+0*2)*4)(3)) stw r0,(JB_LR*4)(3) stw r15,((JB_GPRS+1)*4)(3) FP( stfd 15,((JB_FPRS+1*2)*4)(3)) mfcr r0 stw r16,((JB_GPRS+2)*4)(3) FP( stfd 16,((JB_FPRS+2*2)*4)(3)) stw r0,(JB_CR*4)(3) stw r17,((JB_GPRS+3)*4)(3) FP( stfd 17,((JB_FPRS+3*2)*4)(3)) stw r18,((JB_GPRS+4)*4)(3) FP( stfd 18,((JB_FPRS+4*2)*4)(3)) stw r19,((JB_GPRS+5)*4)(3) FP( stfd 19,((JB_FPRS+5*2)*4)(3)) stw r20,((JB_GPRS+6)*4)(3) FP( stfd 20,((JB_FPRS+6*2)*4)(3)) stw r21,((JB_GPRS+7)*4)(3) FP( stfd 21,((JB_FPRS+7*2)*4)(3)) stw r22,((JB_GPRS+8)*4)(3) FP( stfd 22,((JB_FPRS+8*2)*4)(3)) stw r23,((JB_GPRS+9)*4)(3) FP( stfd 23,((JB_FPRS+9*2)*4)(3)) stw r24,((JB_GPRS+10)*4)(3) FP( stfd 24,((JB_FPRS+10*2)*4)(3)) stw r25,((JB_GPRS+11)*4)(3) FP( stfd 25,((JB_FPRS+11*2)*4)(3)) stw r26,((JB_GPRS+12)*4)(3) FP( stfd 26,((JB_FPRS+12*2)*4)(3)) stw r27,((JB_GPRS+13)*4)(3) FP( stfd 27,((JB_FPRS+13*2)*4)(3)) stw r28,((JB_GPRS+14)*4)(3) FP( stfd 28,((JB_FPRS+14*2)*4)(3)) stw r29,((JB_GPRS+15)*4)(3) FP( stfd 29,((JB_FPRS+15*2)*4)(3)) stw r30,((JB_GPRS+16)*4)(3) FP( stfd 30,((JB_FPRS+16*2)*4)(3)) stw r31,((JB_GPRS+17)*4)(3) FP( stfd 31,((JB_FPRS+17*2)*4)(3)) li 3, 0 blr
4ms/stm32mp1-baremetal
2,684
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/nios2/cpu/exceptions.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2004, Psyent Corporation <www.psyent.com> * Scott McNutt <smcnutt@psyent.com> */ #include <config.h> #include <asm/opcodes.h> .text .align 4 .global _exception .set noat .set nobreak _exception: /* SAVE ALL REGS -- this allows trap and unimplemented * instruction handlers to be coded conveniently in C */ addi sp, sp, -(33*4) stw r0, 0(sp) stw r1, 4(sp) stw r2, 8(sp) stw r3, 12(sp) stw r4, 16(sp) stw r5, 20(sp) stw r6, 24(sp) stw r7, 28(sp) stw r8, 32(sp) stw r9, 36(sp) stw r10, 40(sp) stw r11, 44(sp) stw r12, 48(sp) stw r13, 52(sp) stw r14, 56(sp) stw r15, 60(sp) stw r16, 64(sp) stw r17, 68(sp) stw r19, 72(sp) stw r19, 76(sp) stw r20, 80(sp) stw r21, 84(sp) stw r22, 88(sp) stw r23, 92(sp) stw r24, 96(sp) stw r25, 100(sp) stw r26, 104(sp) stw r27, 108(sp) stw r28, 112(sp) stw r29, 116(sp) stw r30, 120(sp) stw r31, 124(sp) rdctl et, estatus stw et, 128(sp) /* If interrupts are disabled -- software interrupt */ rdctl et, estatus andi et, et, 1 beq et, r0, 0f /* If no interrupts are pending -- software interrupt */ rdctl et, ipending beq et, r0, 0f /* HARDWARE INTERRUPT: Call interrupt handler */ movhi r3, %hi(external_interrupt) ori r3, r3, %lo(external_interrupt) mov r4, sp /* ptr to regs */ callr r3 /* Return address fixup: execution resumes by re-issue of * interrupted instruction at ea-4 (ea == r29). Here we do * simple fixup to allow common exception return. */ ldw r3, 116(sp) addi r3, r3, -4 stw r3, 116(sp) br _exception_return 0: /* TRAP EXCEPTION */ movhi r3, %hi(OPC_TRAP) ori r3, r3, %lo(OPC_TRAP) addi r1, ea, -4 ldw r1, 0(r1) bne r1, r3, 1f movhi r3, %hi(trap_handler) ori r3, r3, %lo(trap_handler) mov r4, sp /* ptr to regs */ callr r3 br _exception_return 1: /* UNIMPLEMENTED INSTRUCTION EXCEPTION */ movhi r3, %hi(soft_emulation) ori r3, r3, %lo(soft_emulation) mov r4, sp /* ptr to regs */ callr r3 /* Restore regsisters and return from exception*/ _exception_return: ldw r1, 4(sp) ldw r2, 8(sp) ldw r3, 12(sp) ldw r4, 16(sp) ldw r5, 20(sp) ldw r6, 24(sp) ldw r7, 28(sp) ldw r8, 32(sp) ldw r9, 36(sp) ldw r10, 40(sp) ldw r11, 44(sp) ldw r12, 48(sp) ldw r13, 52(sp) ldw r14, 56(sp) ldw r15, 60(sp) ldw r16, 64(sp) ldw r17, 68(sp) ldw r19, 72(sp) ldw r19, 76(sp) ldw r20, 80(sp) ldw r21, 84(sp) ldw r22, 88(sp) ldw r23, 92(sp) ldw r24, 96(sp) ldw r25, 100(sp) ldw r26, 104(sp) ldw r27, 108(sp) ldw r28, 112(sp) ldw r29, 116(sp) ldw r30, 120(sp) ldw r31, 124(sp) addi sp, sp, (33*4) eret /*-------------------------------------------------------------*/
4ms/stm32mp1-baremetal
4,272
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/nios2/cpu/start.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2004, Psyent Corporation <www.psyent.com> * Scott McNutt <smcnutt@psyent.com> */ #include <asm-offsets.h> #include <config.h> #include <version.h> /* * icache and dcache configuration used only for start.S. * the values are chosen so that it will work for all configuration. */ #define ICACHE_LINE_SIZE 32 /* fixed 32 */ #define ICACHE_SIZE_MAX 0x10000 /* 64k max */ #define DCACHE_LINE_SIZE_MIN 4 /* 4, 16, 32 */ #define DCACHE_SIZE_MAX 0x10000 /* 64k max */ /* RESTART */ .text .global _start, _except_start, _except_end _start: wrctl status, r0 /* Disable interrupts */ /* * ICACHE INIT -- only the icache line at the reset address * is invalidated at reset. So the init must stay within * the cache line size (8 words). If GERMS is used, we'll * just be invalidating the cache a second time. If cache * is not implemented initi behaves as nop. */ ori r4, r0, %lo(ICACHE_LINE_SIZE) movhi r5, %hi(ICACHE_SIZE_MAX) ori r5, r5, %lo(ICACHE_SIZE_MAX) 0: initi r5 sub r5, r5, r4 bgt r5, r0, 0b br _except_end /* Skip the tramp */ /* * EXCEPTION TRAMPOLINE -- the following gets copied * to the exception address (below), but is otherwise at the * default exception vector offset (0x0020). */ _except_start: movhi et, %hi(_exception) ori et, et, %lo(_exception) jmp et _except_end: /* * INTERRUPTS -- for now, all interrupts masked and globally * disabled. */ wrctl ienable, r0 /* All disabled */ /* * DCACHE INIT -- if dcache not implemented, initd behaves as * nop. */ ori r4, r0, %lo(DCACHE_LINE_SIZE_MIN) movhi r5, %hi(DCACHE_SIZE_MAX) ori r5, r5, %lo(DCACHE_SIZE_MAX) mov r6, r0 1: initd 0(r6) add r6, r6, r4 bltu r6, r5, 1b /* * RELOCATE CODE, DATA & COMMAND TABLE -- the following code * assumes code, data and the command table are all * contiguous. This lets us relocate everything as a single * block. Make sure the linker script matches this ;-) */ nextpc r4 _cur: movhi r5, %hi(_cur - _start) ori r5, r5, %lo(_cur - _start) sub r4, r4, r5 /* r4 <- cur _start */ mov r8, r4 movhi r5, %hi(_start) ori r5, r5, %lo(_start) /* r5 <- linked _start */ mov sp, r5 /* initial stack below u-boot code */ beq r4, r5, 3f movhi r6, %hi(CONFIG_SYS_MONITOR_LEN) ori r6, r6, %lo(CONFIG_SYS_MONITOR_LEN) add r6, r6, r5 2: ldwio r7, 0(r4) addi r4, r4, 4 stwio r7, 0(r5) addi r5, r5, 4 bne r5, r6, 2b 3: /* JUMP TO RELOC ADDR */ movhi r4, %hi(_reloc) ori r4, r4, %lo(_reloc) jmp r4 _reloc: /* STACK INIT -- zero top two words for call back chain. */ addi sp, sp, -8 stw r0, 0(sp) stw r0, 4(sp) mov fp, sp #ifdef CONFIG_DEBUG_UART /* Set up the debug UART */ movhi r2, %hi(debug_uart_init@h) ori r2, r2, %lo(debug_uart_init@h) callr r2 #endif /* Allocate and initialize reserved area, update SP */ mov r4, sp movhi r2, %hi(board_init_f_alloc_reserve@h) ori r2, r2, %lo(board_init_f_alloc_reserve@h) callr r2 mov sp, r2 mov r4, sp movhi r2, %hi(board_init_f_init_reserve@h) ori r2, r2, %lo(board_init_f_init_reserve@h) callr r2 /* Update frame-pointer */ mov fp, sp /* Call board_init_f -- never returns */ mov r4, r0 movhi r2, %hi(board_init_f@h) ori r2, r2, %lo(board_init_f@h) callr r2 /* * NEVER RETURNS -- but branch to the _start just * in case ;-) */ br _start /* * relocate_code -- Nios2 handles the relocation above. But * the generic board code monkeys with the heap, stack, etc. * (it makes some assumptions that may not be appropriate * for Nios). Nevertheless, we capitulate here. * * We'll call the board_init_r from here since this isn't * supposed to return. * * void relocate_code (ulong sp, gd_t *global_data, * ulong reloc_addr) * __attribute__ ((noreturn)); */ .text .global relocate_code relocate_code: mov sp, r4 /* Set the new sp */ mov r4, r5 /* * ZERO BSS/SBSS -- bss and sbss are assumed to be adjacent * and between __bss_start and __bss_end. */ movhi r5, %hi(__bss_start) ori r5, r5, %lo(__bss_start) movhi r6, %hi(__bss_end) ori r6, r6, %lo(__bss_end) beq r5, r6, 5f 4: stw r0, 0(r5) addi r5, r5, 4 bne r5, r6, 4b 5: movhi r8, %hi(board_init_r@h) ori r8, r8, %lo(board_init_r@h) callr r8 ret
4ms/stm32mp1-baremetal
7,062
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/m68k/cpu/mcf530x/start.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2015 Angelo Dureghello <angelo@sysam.it> * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com> */ #include <asm-offsets.h> #include <config.h> #include "version.h" #include <asm/cache.h> #define _START _start #define _FAULT _fault .macro SAVE_ALL move.w #0x2700,%sr; /* disable intrs */ subl #60,%sp; /* space for 15 regs */ moveml %d0-%d7/%a0-%a6,%sp@ .endm .macro RESTORE_ALL moveml %sp@,%d0-%d7/%a0-%a6; addl #60,%sp; /* space for 15 regs */ rte .endm /* If we come from a pre-loader we don't need an initial exception * table. */ #if !defined(CONFIG_MONITOR_IS_IN_RAM) .text /* * Vector table. This is used for initial platform startup. * These vectors are to catch any un-intended traps. */ _vectors: /* Flash offset is 0 until we setup CS0 */ .long 0x00000000 #if defined(CONFIG_M5307) && \ (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE) .long _start - CONFIG_SYS_TEXT_BASE #else .long _START #endif .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT #endif .text .globl _start _start: nop nop move.w #0x2700,%sr /* set MBAR address + valid flag */ move.l #(CONFIG_SYS_MBAR + 1), %d0 move.c %d0, %MBAR move.l #(CONFIG_SYS_INIT_RAM_ADDR + 1), %d0 move.c %d0, %RAMBAR /* DS 4.8.2 (Cache Organization) invalidate and disable cache */ move.l #CF_CACR_CINVA, %d0 movec %d0, %CACR move.l #0, %d0 movec %d0, %ACR0 movec %d0, %ACR1 /* * if we come from a pre-loader we have no exception table and * therefore no VBR to set */ #if !defined(CONFIG_MONITOR_IS_IN_RAM) move.l #CONFIG_SYS_FLASH_BASE, %d0 movec %d0, %VBR #endif /* initialize general use internal ram */ move.l #0, %d0 move.l #(ICACHE_STATUS), %a1 /* icache */ move.l #(DCACHE_STATUS), %a2 /* dcache */ move.l %d0, (%a1) move.l %d0, (%a2) /* put relocation table address to a5 */ move.l #__got_start, %a5 /* setup stack initially on top of internal static ram */ move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp /* * if configured, malloc_f arena will be reserved first, * then (and always) gd struct space will be reserved */ move.l %sp, -(%sp) bsr board_init_f_alloc_reserve /* update stack and frame-pointers */ move.l %d0, %sp move.l %sp, %fp /* initialize reserved area */ move.l %d0, -(%sp) bsr board_init_f_init_reserve /* run low-level CPU init code (from flash) */ bsr cpu_init_f /* run low-level board init code (from flash) */ clr.l %sp@- bsr board_init_f /* board_init_f() does not return */ /******************************************************************************/ /* * void relocate_code (addr_sp, gd, addr_moni) * * This "function" does not return, instead it continues in RAM * after relocating the monitor code. * */ .globl relocate_code relocate_code: link.w %a6,#0 move.l 8(%a6), %sp /* set new stack pointer */ move.l 12(%a6), %d0 /* Save copy of Global Data pointer */ move.l 16(%a6), %a0 /* Save copy of Destination Address */ move.l #CONFIG_SYS_MONITOR_BASE, %a1 move.l #__init_end, %a2 move.l %a0, %a3 /* copy the code to RAM */ 1: move.l (%a1)+, (%a3)+ cmp.l %a1,%a2 bgt.s 1b /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. */ move.l %a0, %a1 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1 jmp (%a1) in_ram: clear_bss: /* * Now clear BSS segment */ move.l %a0, %a1 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE), %a1 move.l %a0, %d1 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE), %d1 6: clr.l (%a1)+ cmp.l %a1,%d1 bgt.s 6b /* * fix got table in RAM */ move.l %a0, %a1 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE), %a1 /* fix got pointer register a5 */ move.l %a1,%a5 move.l %a0, %a2 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE), %a2 7: move.l (%a1),%d1 sub.l #_start, %d1 add.l %a0,%d1 move.l %d1,(%a1)+ cmp.l %a2, %a1 bne 7b /* calculate relative jump to board_init_r in ram */ move.l %a0, %a1 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1 /* set parameters for board_init_r */ move.l %a0,-(%sp) /* dest_addr */ move.l %d0,-(%sp) /* gd */ #if defined(DEBUG) && (CONFIG_SYS_TEXT_BASE!=CONFIG_SYS_INT_FLASH_BASE) && \ defined(CONFIG_SYS_HALT_BEFOR_RAM_JUMP) halt #endif jsr (%a1) /******************************************************************************/ /* exception code */ .globl _fault _fault: bra _fault .globl _exc_handler _exc_handler: SAVE_ALL movel %sp,%sp@- bsr exc_handler addql #4,%sp RESTORE_ALL .globl _int_handler _int_handler: SAVE_ALL movel %sp,%sp@- bsr int_handler addql #4,%sp RESTORE_ALL /******************************************************************************/ .globl version_string version_string: .ascii U_BOOT_VERSION .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")" .ascii CONFIG_IDENT_STRING, "\0" .align 4
4ms/stm32mp1-baremetal
6,806
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/m68k/cpu/mcf523x/start.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2003 Josef Baumgartner <josef.baumgartner@telex.de> * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com> */ #include <asm-offsets.h> #include <config.h> #include "version.h" #include <asm/cache.h> #define _START _start #define _FAULT _fault #define SAVE_ALL \ move.w #0x2700,%sr; /* disable intrs */ \ subl #60,%sp; /* space for 15 regs */ \ moveml %d0-%d7/%a0-%a6,%sp@; #define RESTORE_ALL \ moveml %sp@,%d0-%d7/%a0-%a6; \ addl #60,%sp; /* space for 15 regs */ \ rte; .text /* * Vector table. This is used for initial platform startup. * These vectors are to catch any un-intended traps. */ _vectors: INITSP: .long 0x00000000 /* Initial SP */ INITPC: .long _START /* Initial PC */ vector02_0F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT /* Reserved */ vector10_17: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector18_1F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT /* TRAP #0 - #15 */ vector20_2F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT /* Reserved */ vector30_3F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector64_127: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector128_191: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector192_255: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .text .globl _start _start: nop nop move.w #0x2700,%sr /* Mask off Interrupt */ /* Set vector base register at the beginning of the Flash */ move.l #CONFIG_SYS_FLASH_BASE, %d0 movec %d0, %VBR move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0 movec %d0, %RAMBAR1 /* invalidate and disable cache */ move.l #CF_CACR_CINV, %d0 /* Invalidate cache cmd */ movec %d0, %CACR /* Invalidate cache */ nop move.l #0, %d0 movec %d0, %ACR0 movec %d0, %ACR1 /* initialize general use internal ram */ move.l #0, %d0 move.l #(ICACHE_STATUS), %a1 /* icache */ move.l #(DCACHE_STATUS), %a2 /* icache */ move.l %d0, (%a1) move.l %d0, (%a2) /* put relocation table address to a5 */ move.l #__got_start, %a5 /* setup stack initially on top of internal static ram */ move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp /* * if configured, malloc_f arena will be reserved first, * then (and always) gd struct space will be reserved */ move.l %sp, -(%sp) move.l #board_init_f_alloc_reserve, %a1 jsr (%a1) /* update stack and frame-pointers */ move.l %d0, %sp move.l %sp, %fp /* initialize reserved area */ move.l %d0, -(%sp) move.l #board_init_f_init_reserve, %a1 jsr (%a1) /* run low-level CPU init code (from flash) */ move.l #cpu_init_f, %a1 jsr (%a1) /* run low-level board init code (from flash) */ clr.l %sp@- move.l #board_init_f, %a1 jsr (%a1) /* board_init_f() does not return */ /******************************************************************************/ /* * void relocate_code (addr_sp, gd, addr_moni) * * This "function" does not return, instead it continues in RAM * after relocating the monitor code. * * r3 = dest * r4 = src * r5 = length in bytes * r6 = cachelinesize */ .globl relocate_code relocate_code: link.w %a6,#0 move.l 8(%a6), %sp /* set new stack pointer */ move.l 12(%a6), %d0 /* Save copy of Global Data pointer */ move.l 16(%a6), %a0 /* Save copy of Destination Address */ move.l #CONFIG_SYS_MONITOR_BASE, %a1 move.l #__init_end, %a2 move.l %a0, %a3 /* copy the code to RAM */ 1: move.l (%a1)+, (%a3)+ cmp.l %a1,%a2 bgt.s 1b /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. */ move.l %a0, %a1 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1 jmp (%a1) in_ram: clear_bss: /* * Now clear BSS segment */ move.l %a0, %a1 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1 move.l %a0, %d1 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1 6: clr.l (%a1)+ cmp.l %a1,%d1 bgt.s 6b /* * fix got table in RAM */ move.l %a0, %a1 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1 move.l %a1,%a5 /* * fix got pointer register a5 */ move.l %a0, %a2 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2 7: move.l (%a1),%d1 sub.l #_start,%d1 add.l %a0,%d1 move.l %d1,(%a1)+ cmp.l %a2, %a1 bne 7b /* calculate relative jump to board_init_r in ram */ move.l %a0, %a1 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1 /* set parameters for board_init_r */ move.l %a0,-(%sp) /* dest_addr */ move.l %d0,-(%sp) /* gd */ jsr (%a1) /******************************************************************************/ /* exception code */ .globl _fault _fault: bra _fault .globl _exc_handler _exc_handler: SAVE_ALL movel %sp,%sp@- bsr exc_handler addql #4,%sp RESTORE_ALL .globl _int_handler _int_handler: SAVE_ALL movel %sp,%sp@- bsr int_handler addql #4,%sp RESTORE_ALL /******************************************************************************/ .globl version_string version_string: .ascii U_BOOT_VERSION_STRING, "\0" .align 4
4ms/stm32mp1-baremetal
7,165
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/m68k/cpu/mcf532x/start.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2003 Josef Baumgartner <josef.baumgartner@telex.de> * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com> * * (C) Copyright 2004-2008 Freescale Semiconductor, Inc. * TsiChung Liew (Tsi-Chung.Liew@freescale.com) */ #include <asm-offsets.h> #include <config.h> #include "version.h" #include <asm/cache.h> #define _START _start #define _FAULT _fault #define SAVE_ALL \ move.w #0x2700,%sr; /* disable intrs */ \ subl #60,%sp; /* space for 15 regs */ \ moveml %d0-%d7/%a0-%a6,%sp@; #define RESTORE_ALL \ moveml %sp@,%d0-%d7/%a0-%a6; \ addl #60,%sp; /* space for 15 regs */ \ rte; #if !defined(CONFIG_MONITOR_IS_IN_RAM) .text /* * Vector table. This is used for initial platform startup. * These vectors are to catch any un-intended traps. */ _vectors: INITSP: .long 0x00000000 /* Initial SP */ INITPC: .long _START /* Initial PC */ vector02_0F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT /* Reserved */ vector10_17: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector18_1F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT /* TRAP #0 - #15 */ vector20_2F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT /* Reserved */ vector30_3F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector64_127: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector128_191: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector192_255: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT #endif /* !defined(CONFIG_MONITOR_IS_IN_RAM) */ .text .globl _start _start: nop nop move.w #0x2700,%sr /* Mask off Interrupt */ #if !defined(CONFIG_MONITOR_IS_IN_RAM) /* Set vector base register at the beginning of the Flash */ move.l #CONFIG_SYS_FLASH_BASE, %d0 movec %d0, %VBR #endif move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0 movec %d0, %RAMBAR1 /* invalidate and disable cache */ move.l #CF_CACR_CINVA, %d0 /* Invalidate cache cmd */ movec %d0, %CACR /* Invalidate cache */ move.l #0, %d0 movec %d0, %ACR0 movec %d0, %ACR1 #ifdef CONFIG_MCF5301x move.l #(0xFC0a0010), %a0 move.w (%a0), %d0 and.l %d0, 0xEFFF move.w %d0, (%a0) #endif /* initialize general use internal ram */ move.l #0, %d0 move.l #(ICACHE_STATUS), %a1 /* icache */ move.l #(DCACHE_STATUS), %a2 /* icache */ move.l %d0, (%a1) move.l %d0, (%a2) /* put relocation table address to a5 */ move.l #__got_start, %a5 /* setup stack initially on top of internal static ram */ move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp /* * if configured, malloc_f arena will be reserved first, * then (and always) gd struct space will be reserved */ move.l %sp, -(%sp) move.l #board_init_f_alloc_reserve, %a1 jsr (%a1) /* update stack and frame-pointers */ move.l %d0, %sp move.l %sp, %fp /* initialize reserved area */ move.l %d0, -(%sp) move.l #board_init_f_init_reserve, %a1 jsr (%a1) /* run low-level CPU init code (from flash) */ move.l #cpu_init_f, %a1 jsr (%a1) /* run low-level board init code (from flash) */ clr.l %sp@- move.l #board_init_f, %a1 jsr (%a1) /* board_init_f() does not return */ /******************************************************************************/ /* * void relocate_code (addr_sp, gd, addr_moni) * * This "function" does not return, instead it continues in RAM * after relocating the monitor code. * * r3 = dest * r4 = src * r5 = length in bytes * r6 = cachelinesize */ .globl relocate_code relocate_code: link.w %a6,#0 move.l 8(%a6), %sp /* set new stack pointer */ move.l 12(%a6), %d0 /* Save copy of Global Data pointer */ move.l 16(%a6), %a0 /* Save copy of Destination Address */ move.l #CONFIG_SYS_MONITOR_BASE, %a1 move.l #__init_end, %a2 move.l %a0, %a3 /* copy the code to RAM */ 1: move.l (%a1)+, (%a3)+ cmp.l %a1,%a2 bgt.s 1b /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. */ move.l %a0, %a1 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1 jmp (%a1) in_ram: clear_bss: /* * Now clear BSS segment */ move.l %a0, %a1 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1 move.l %a0, %d1 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1 6: clr.l (%a1)+ cmp.l %a1,%d1 bgt.s 6b /* * fix got table in RAM */ move.l %a0, %a1 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1 move.l %a1,%a5 /* fix got pointer register a5 */ move.l %a0, %a2 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2 7: move.l (%a1),%d1 sub.l #_start,%d1 add.l %a0,%d1 move.l %d1,(%a1)+ cmp.l %a2, %a1 bne 7b /* calculate relative jump to board_init_r in ram */ move.l %a0, %a1 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1 /* set parameters for board_init_r */ move.l %a0,-(%sp) /* dest_addr */ move.l %d0,-(%sp) /* gd */ jsr (%a1) /******************************************************************************/ /* exception code */ .globl _fault _fault: bra _fault .globl _exc_handler _exc_handler: SAVE_ALL movel %sp,%sp@- bsr exc_handler addql #4,%sp RESTORE_ALL .globl _int_handler _int_handler: SAVE_ALL movel %sp,%sp@- bsr int_handler addql #4,%sp RESTORE_ALL /******************************************************************************/ .globl version_string version_string: .ascii U_BOOT_VERSION_STRING, "\0" .align 4
4ms/stm32mp1-baremetal
9,521
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/m68k/cpu/mcf52x2/start.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2003 Josef Baumgartner <josef.baumgartner@telex.de> * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com> */ #include <asm-offsets.h> #include <config.h> #include "version.h" #include <asm/cache.h> #define _START _start #define _FAULT _fault #define SAVE_ALL \ move.w #0x2700,%sr; /* disable intrs */ \ subl #60,%sp; /* space for 15 regs */ \ moveml %d0-%d7/%a0-%a6,%sp@; \ #define RESTORE_ALL \ moveml %sp@,%d0-%d7/%a0-%a6; \ addl #60,%sp; /* space for 15 regs */ \ rte /* If we come from a pre-loader we don't need an initial exception * table. */ #if !defined(CONFIG_MONITOR_IS_IN_RAM) .text /* * Vector table. This is used for initial platform startup. * These vectors are to catch any un-intended traps. */ _vectors: .long 0x00000000 /* Flash offset is 0 until we setup CS0 */ #if defined(CONFIG_M5282) && (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE) .long _start - CONFIG_SYS_TEXT_BASE #else .long _START #endif .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT #endif .text #if defined(CONFIG_SYS_INT_FLASH_BASE) && \ (defined(CONFIG_M5282) || defined(CONFIG_M5281)) #if (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE) .long 0x55AA55AA,0xAA55AA55 /* CFM Backdoorkey */ .long 0xFFFFFFFF /* all sectors protected */ .long 0x00000000 /* supervisor/User restriction */ .long 0x00000000 /* programm/data space restriction */ .long 0x00000000 /* Flash security */ #endif #endif .globl _start _start: nop nop move.w #0x2700,%sr #if defined(CONFIG_M5208) /* Initialize RAMBAR: locate SRAM and validate it */ move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0 movec %d0, %RAMBAR1 #endif #if defined(CONFIG_M5272) || defined(CONFIG_M5249) || defined(CONFIG_M5253) /* set MBAR address + valid flag */ move.l #(CONFIG_SYS_MBAR + 1), %d0 move.c %d0, %MBAR /*** The 5249 has MBAR2 as well ***/ #ifdef CONFIG_SYS_MBAR2 /* Get MBAR2 address */ move.l #(CONFIG_SYS_MBAR2 + 1), %d0 /* Set MBAR2 */ movec %d0, #0xc0e #endif move.l #(CONFIG_SYS_INIT_RAM_ADDR + 1), %d0 movec %d0, %RAMBAR0 #endif /* CONFIG_M5272 || CONFIG_M5249 || CONFIG_M5253 */ #if defined(CONFIG_M5282) || defined(CONFIG_M5271) /* set MBAR address + valid flag */ move.l #(CONFIG_SYS_MBAR + 1), %d0 move.l %d0, 0x40000000 /* Initialize RAMBAR1: locate SRAM and validate it */ move.l #(CONFIG_SYS_INIT_RAM_ADDR + 0x21), %d0 movec %d0, %RAMBAR1 #if defined(CONFIG_M5282) #if (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE) /* * Setup code in SRAM to initialize FLASHBAR, * if start from internal Flash */ move.l #(_flashbar_setup-CONFIG_SYS_INT_FLASH_BASE), %a0 move.l #(_flashbar_setup_end-CONFIG_SYS_INT_FLASH_BASE), %a1 move.l #(CONFIG_SYS_INIT_RAM_ADDR), %a2 _copy_flash: move.l (%a0)+, (%a2)+ cmp.l %a0, %a1 bgt.s _copy_flash jmp CONFIG_SYS_INIT_RAM_ADDR _flashbar_setup: /* Initialize FLASHBAR: locate internal Flash and validate it */ move.l #(CONFIG_SYS_INT_FLASH_BASE + CONFIG_SYS_INT_FLASH_ENABLE), %d0 movec %d0, %FLASHBAR jmp _after_flashbar_copy.L /* Force jump to absolute address */ _flashbar_setup_end: nop _after_flashbar_copy: #else /* Setup code to initialize FLASHBAR, if start from external Memory */ move.l #(CONFIG_SYS_INT_FLASH_BASE + CONFIG_SYS_INT_FLASH_ENABLE), %d0 movec %d0, %FLASHBAR #endif /* (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE) */ #endif #endif /* * if we come from a pre-loader we have no exception table and * therefore no VBR to set */ #if !defined(CONFIG_MONITOR_IS_IN_RAM) #if defined(CONFIG_M5282) && (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE) move.l #CONFIG_SYS_INT_FLASH_BASE, %d0 #else move.l #CONFIG_SYS_FLASH_BASE, %d0 #endif movec %d0, %VBR #endif #ifdef CONFIG_M5275 /* set MBAR address + valid flag */ move.l #(CONFIG_SYS_MBAR + 1), %d0 move.l %d0, 0x40000000 /* movec %d0, %MBAR */ /* Initialize RAMBAR: locate SRAM and validate it */ move.l #(CONFIG_SYS_INIT_RAM_ADDR + 0x21), %d0 movec %d0, %RAMBAR1 #endif /* initialize general use internal ram */ move.l #0, %d0 move.l #(ICACHE_STATUS), %a1 /* icache */ move.l #(DCACHE_STATUS), %a2 /* icache */ move.l %d0, (%a1) move.l %d0, (%a2) /* put relocation table address to a5 */ move.l #__got_start, %a5 /* setup stack initially on top of internal static ram */ move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp /* * if configured, malloc_f arena will be reserved first, * then (and always) gd struct space will be reserved */ move.l %sp, -(%sp) move.l #board_init_f_alloc_reserve, %a1 jsr (%a1) /* update stack and frame-pointers */ move.l %d0, %sp move.l %sp, %fp /* initialize reserved area */ move.l %d0, -(%sp) move.l #board_init_f_init_reserve, %a1 jsr (%a1) /* run low-level CPU init code (from flash) */ move.l #cpu_init_f, %a1 jsr (%a1) /* run low-level board init code (from flash) */ clr.l %sp@- move.l #board_init_f, %a1 jsr (%a1) /* board_init_f() does not return */ /******************************************************************************/ /* * void relocate_code (addr_sp, gd, addr_moni) * * This "function" does not return, instead it continues in RAM * after relocating the monitor code. * * r3 = dest * r4 = src * r5 = length in bytes * r6 = cachelinesize */ .globl relocate_code relocate_code: link.w %a6,#0 move.l 8(%a6), %sp /* set new stack pointer */ move.l 12(%a6), %d0 /* Save copy of Global Data pointer */ move.l 16(%a6), %a0 /* Save copy of Destination Address */ move.l #CONFIG_SYS_MONITOR_BASE, %a1 move.l #__init_end, %a2 move.l %a0, %a3 /* copy the code to RAM */ 1: move.l (%a1)+, (%a3)+ cmp.l %a1,%a2 bgt.s 1b /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. */ move.l %a0, %a1 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1 jmp (%a1) in_ram: clear_bss: /* * Now clear BSS segment */ move.l %a0, %a1 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1 move.l %a0, %d1 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1 6: clr.l (%a1)+ cmp.l %a1,%d1 bgt.s 6b /* * fix got table in RAM */ move.l %a0, %a1 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1 move.l %a1,%a5 /* fix got pointer register a5 */ move.l %a0, %a2 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2 7: move.l (%a1),%d1 sub.l #_start,%d1 add.l %a0,%d1 move.l %d1,(%a1)+ cmp.l %a2, %a1 bne 7b /* calculate relative jump to board_init_r in ram */ move.l %a0, %a1 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1 /* set parameters for board_init_r */ move.l %a0,-(%sp) /* dest_addr */ move.l %d0,-(%sp) /* gd */ #if defined(DEBUG) && (CONFIG_SYS_TEXT_BASE != CONFIG_SYS_INT_FLASH_BASE) && \ defined(CONFIG_SYS_HALT_BEFOR_RAM_JUMP) halt #endif jsr (%a1) /******************************************************************************/ /* exception code */ .globl _fault _fault: bra _fault .globl _exc_handler _exc_handler: SAVE_ALL movel %sp,%sp@- bsr exc_handler addql #4,%sp RESTORE_ALL .globl _int_handler _int_handler: SAVE_ALL movel %sp,%sp@- bsr int_handler addql #4,%sp RESTORE_ALL /******************************************************************************/ .globl version_string version_string: .ascii U_BOOT_VERSION_STRING, "\0" .align 4
4ms/stm32mp1-baremetal
6,962
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/m68k/cpu/mcf547x_8x/start.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2003 Josef Baumgartner <josef.baumgartner@telex.de> * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com> */ #include <asm-offsets.h> #include <config.h> #include "version.h" #include <asm/cache.h> #define _START _start #define _FAULT _fault #define SAVE_ALL \ move.w #0x2700,%sr; /* disable intrs */ \ subl #60,%sp; /* space for 15 regs */ \ moveml %d0-%d7/%a0-%a6,%sp@; #define RESTORE_ALL \ moveml %sp@,%d0-%d7/%a0-%a6; \ addl #60,%sp; /* space for 15 regs */ \ rte; .text /* * Vector table. This is used for initial platform startup. * These vectors are to catch any un-intended traps. */ _vectors: INITSP: .long 0x00000000 /* Initial SP */ INITPC: .long _START /* Initial PC */ vector02_0F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT /* Reserved */ vector10_17: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector18_1F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT /* TRAP #0 - #15 */ vector20_2F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT /* Reserved */ vector30_3F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector64_127: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector128_191: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector192_255: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .text .globl _start _start: nop nop move.w #0x2700,%sr /* Mask off Interrupt */ /* Set vector base register at the beginning of the Flash */ move.l #CONFIG_SYS_FLASH_BASE, %d0 movec %d0, %VBR move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0 movec %d0, %RAMBAR0 move.l #(CONFIG_SYS_INIT_RAM1_ADDR + CONFIG_SYS_INIT_RAM1_CTRL), %d0 movec %d0, %RAMBAR1 move.l #CONFIG_SYS_MBAR, %d0 /* set MBAR address */ move.c %d0, %MBAR /* invalidate and disable cache */ move.l #0x01040100, %d0 /* Invalidate cache cmd */ movec %d0, %CACR /* Invalidate cache */ move.l #0, %d0 movec %d0, %ACR0 movec %d0, %ACR1 movec %d0, %ACR2 movec %d0, %ACR3 /* initialize general use internal ram */ move.l #0, %d0 move.l #(ICACHE_STATUS), %a1 /* icache */ move.l #(DCACHE_STATUS), %a2 /* icache */ move.l %d0, (%a1) move.l %d0, (%a2) /* put relocation table address to a5 */ move.l #__got_start, %a5 /* setup stack initially on top of internal static ram */ move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp /* * if configured, malloc_f arena will be reserved first, * then (and always) gd struct space will be reserved */ move.l %sp, -(%sp) move.l #board_init_f_alloc_reserve, %a1 jsr (%a1) /* update stack and frame-pointers */ move.l %d0, %sp move.l %sp, %fp /* initialize reserved area */ move.l %d0, -(%sp) move.l #board_init_f_init_reserve, %a1 jsr (%a1) /* run low-level CPU init code (from flash) */ jbsr cpu_init_f /* run low-level board init code (from flash) */ clr.l %sp@- jbsr board_init_f /* board_init_f() does not return */ /******************************************************************************/ /* * void relocate_code (addr_sp, gd, addr_moni) * * This "function" does not return, instead it continues in RAM * after relocating the monitor code. * * r3 = dest * r4 = src * r5 = length in bytes * r6 = cachelinesize */ .globl relocate_code relocate_code: link.w %a6,#0 move.l 8(%a6), %sp /* set new stack pointer */ move.l 12(%a6), %d0 /* Save copy of Global Data pointer */ move.l 16(%a6), %a0 /* Save copy of Destination Address */ move.l #CONFIG_SYS_MONITOR_BASE, %a1 move.l #__init_end, %a2 move.l %a0, %a3 /* copy the code to RAM */ 1: move.l (%a1)+, (%a3)+ cmp.l %a1,%a2 bgt.s 1b /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. */ move.l %a0, %a1 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1 jmp (%a1) in_ram: clear_bss: /* * Now clear BSS segment */ move.l %a0, %a1 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1 move.l %a0, %d1 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1 6: clr.l (%a1)+ cmp.l %a1,%d1 bgt.s 6b /* * fix got table in RAM */ move.l %a0, %a1 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1 move.l %a1,%a5 /* fix got pointer register a5 */ move.l %a0, %a2 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2 7: move.l (%a1),%d1 sub.l #_start,%d1 add.l %a0,%d1 move.l %d1,(%a1)+ cmp.l %a2, %a1 bne 7b /* calculate relative jump to board_init_r in ram */ move.l %a0, %a1 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1 /* set parameters for board_init_r */ move.l %a0,-(%sp) /* dest_addr */ move.l %d0,-(%sp) /* gd */ jsr (%a1) /******************************************************************************/ /* exception code */ .globl _fault _fault: bra _fault .globl _exc_handler _exc_handler: SAVE_ALL movel %sp,%sp@- bsr exc_handler addql #4,%sp RESTORE_ALL .globl _int_handler _int_handler: SAVE_ALL movel %sp,%sp@- bsr int_handler addql #4,%sp RESTORE_ALL /******************************************************************************/ .globl version_string version_string: .ascii U_BOOT_VERSION_STRING, "\0" .align 4
4ms/stm32mp1-baremetal
11,886
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/m68k/cpu/mcf5227x/start.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2003 Josef Baumgartner <josef.baumgartner@telex.de> * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com> */ #include <asm-offsets.h> #include <config.h> #include "version.h" #include <asm/cache.h> #define _START _start #define _FAULT _fault #define SAVE_ALL \ move.w #0x2700,%sr; /* disable intrs */ \ subl #60,%sp; /* space for 15 regs */ \ moveml %d0-%d7/%a0-%a6,%sp@; #define RESTORE_ALL \ moveml %sp@,%d0-%d7/%a0-%a6; \ addl #60,%sp; /* space for 15 regs */ \ rte; #if defined(CONFIG_CF_SBF) #define ASM_DRAMINIT (asm_dram_init - CONFIG_SYS_TEXT_BASE + \ CONFIG_SYS_INIT_RAM_ADDR) #define ASM_SBF_IMG_HDR (asm_sbf_img_hdr - CONFIG_SYS_TEXT_BASE + \ CONFIG_SYS_INIT_RAM_ADDR) #endif .text /* * Vector table. This is used for initial platform startup. * These vectors are to catch any un-intended traps. */ _vectors: #if defined(CONFIG_CF_SBF) INITSP: .long 0 /* Initial SP */ INITPC: .long ASM_DRAMINIT /* Initial PC */ #else INITSP: .long 0 /* Initial SP */ INITPC: .long _START /* Initial PC */ #endif vector02_0F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT /* Reserved */ vector10_17: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector18_1F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT #if !defined(CONFIG_CF_SBF) /* TRAP #0 - #15 */ vector20_2F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT /* Reserved */ vector30_3F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector64_127: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector128_191: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector192_255: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT #endif #if defined(CONFIG_CF_SBF) /* Image header: chksum 4 bytes, len 4 bytes, img dest 4 bytes */ asm_sbf_img_hdr: .long 0x00000000 /* checksum, not yet implemented */ .long 0x00020000 /* image length */ .long CONFIG_SYS_TEXT_BASE /* image to be relocated at */ asm_dram_init: move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0 movec %d0, %RAMBAR1 /* init Rambar */ move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp clr.l %sp@- /* Must disable global address */ move.l #0xFC008000, %a1 move.l #(CONFIG_SYS_CS0_BASE), (%a1) move.l #0xFC008008, %a1 move.l #(CONFIG_SYS_CS0_CTRL), (%a1) move.l #0xFC008004, %a1 move.l #(CONFIG_SYS_CS0_MASK), (%a1) /* * Dram Initialization * a1, a2, and d0 */ move.l #0xFC0A4074, %a1 move.b #(CONFIG_SYS_SDRAM_DRV_STRENGTH), (%a1) nop /* SDRAM Chip 0 and 1 */ move.l #0xFC0B8110, %a1 move.l #0xFC0B8114, %a2 /* calculate the size */ move.l #0x13, %d1 move.l #(CONFIG_SYS_SDRAM_SIZE), %d2 #ifdef CONFIG_SYS_SDRAM_BASE1 lsr.l #1, %d2 #endif dramsz_loop: lsr.l #1, %d2 add.l #1, %d1 cmp.l #1, %d2 bne dramsz_loop /* SDRAM Chip 0 and 1 */ move.l #(CONFIG_SYS_SDRAM_BASE), (%a1) or.l %d1, (%a1) #ifdef CONFIG_SYS_SDRAM_BASE1 move.l #(CONFIG_SYS_SDRAM_BASE1), (%a2) or.l %d1, (%a2) #endif nop /* dram cfg1 and cfg2 */ move.l #0xFC0B8008, %a1 move.l #(CONFIG_SYS_SDRAM_CFG1), (%a1) nop move.l #0xFC0B800C, %a2 move.l #(CONFIG_SYS_SDRAM_CFG2), (%a2) nop move.l #0xFC0B8000, %a1 /* Mode */ move.l #0xFC0B8004, %a2 /* Ctrl */ /* Issue PALL */ move.l #(CONFIG_SYS_SDRAM_CTRL + 2), (%a2) nop /* Issue LEMR */ move.l #(CONFIG_SYS_SDRAM_MODE), (%a1) nop move.l #(CONFIG_SYS_SDRAM_EMOD), (%a1) nop move.l #1000, %d0 wait1000: nop subq.l #1, %d0 bne wait1000 /* Issue PALL */ move.l #(CONFIG_SYS_SDRAM_CTRL + 2), (%a2) nop /* Perform two refresh cycles */ move.l #(CONFIG_SYS_SDRAM_CTRL + 4), %d0 nop move.l %d0, (%a2) move.l %d0, (%a2) nop move.l #(CONFIG_SYS_SDRAM_CTRL), %d0 and.l #0x7FFFFFFF, %d0 or.l #0x10000c00, %d0 move.l %d0, (%a2) nop /* * DSPI Initialization * a0 - general, sram - 0x80008000 - 32, see M52277EVB.h * a1 - dspi status * a2 - dtfr * a3 - drfr * a4 - Dst addr */ /* Enable pins for DSPI mode - chip-selects are enabled later */ move.l #0xFC0A4036, %a0 move.b #0x3F, %d0 move.b %d0, (%a0) /* DSPI CS */ #ifdef CONFIG_SYS_DSPI_CS0 move.b (%a0), %d0 or.l #0xC0, %d0 move.b %d0, (%a0) #endif #ifdef CONFIG_SYS_DSPI_CS2 move.l #0xFC0A4037, %a0 move.b (%a0), %d0 or.l #0x10, %d0 move.b %d0, (%a0) #endif nop /* Configure DSPI module */ move.l #0xFC05C000, %a0 move.l #0x80FF0C00, (%a0) /* Master, clear TX/RX FIFO */ move.l #0xFC05C00C, %a0 move.l #0x3E000011, (%a0) move.l #0xFC05C034, %a2 /* dtfr */ move.l #0xFC05C03B, %a3 /* drfr */ move.l #(ASM_SBF_IMG_HDR + 4), %a1 move.l (%a1)+, %d5 move.l (%a1), %a4 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_SBFHDR_DATA_OFFSET), %a0 move.l #(CONFIG_SYS_SBFHDR_SIZE), %d4 move.l #0xFC05C02C, %a1 /* dspi status */ /* Issue commands and address */ move.l #0x8004000B, %d2 /* Fast Read Cmd */ jsr asm_dspi_wr_status jsr asm_dspi_rd_status move.l #0x80040000, %d2 /* Address byte 2 */ jsr asm_dspi_wr_status jsr asm_dspi_rd_status move.l #0x80040000, %d2 /* Address byte 1 */ jsr asm_dspi_wr_status jsr asm_dspi_rd_status move.l #0x80040000, %d2 /* Address byte 0 */ jsr asm_dspi_wr_status jsr asm_dspi_rd_status move.l #0x80040000, %d2 /* Dummy Wr and Rd */ jsr asm_dspi_wr_status jsr asm_dspi_rd_status /* Transfer serial boot header to sram */ asm_dspi_rd_loop1: move.l #0x80040000, %d2 jsr asm_dspi_wr_status jsr asm_dspi_rd_status move.b %d1, (%a0) /* read, copy to dst */ add.l #1, %a0 /* inc dst by 1 */ sub.l #1, %d4 /* dec cnt by 1 */ bne asm_dspi_rd_loop1 /* Transfer u-boot from serial flash to memory */ asm_dspi_rd_loop2: move.l #0x80040000, %d2 jsr asm_dspi_wr_status jsr asm_dspi_rd_status move.b %d1, (%a4) /* read, copy to dst */ add.l #1, %a4 /* inc dst by 1 */ sub.l #1, %d5 /* dec cnt by 1 */ bne asm_dspi_rd_loop2 move.l #0x00040000, %d2 /* Terminate */ jsr asm_dspi_wr_status jsr asm_dspi_rd_status /* jump to memory and execute */ move.l #(CONFIG_SYS_TEXT_BASE + 0x400), %a0 move.l %a0, (%a1) jmp (%a0) asm_dspi_wr_status: move.l (%a1), %d0 /* status */ and.l #0x0000F000, %d0 cmp.l #0x00003000, %d0 bgt asm_dspi_wr_status move.l %d2, (%a2) rts asm_dspi_rd_status: move.l (%a1), %d0 /* status */ and.l #0x000000F0, %d0 lsr.l #4, %d0 cmp.l #0, %d0 beq asm_dspi_rd_status move.b (%a3), %d1 rts #endif /* CONFIG_CF_SBF */ .text . = 0x400 .globl _start _start: nop nop move.w #0x2700,%sr /* Mask off Interrupt */ /* Set vector base register at the beginning of the Flash */ #if defined(CONFIG_CF_SBF) move.l #CONFIG_SYS_TEXT_BASE, %d0 movec %d0, %VBR #else move.l #CONFIG_SYS_FLASH_BASE, %d0 movec %d0, %VBR move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0 movec %d0, %RAMBAR1 #endif /* invalidate and disable cache */ move.l #CF_CACR_CINV, %d0 /* Invalidate cache cmd */ movec %d0, %CACR /* Invalidate cache */ move.l #0, %d0 movec %d0, %ACR0 movec %d0, %ACR1 /* initialize general use internal ram */ move.l #0, %d0 move.l #(ICACHE_STATUS), %a1 /* icache */ move.l #(DCACHE_STATUS), %a2 /* icache */ move.l %d0, (%a1) move.l %d0, (%a2) /* put relocation table address to a5 */ move.l #__got_start, %a5 /* setup stack initially on top of internal static ram */ move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp /* * if configured, malloc_f arena will be reserved first, * then (and always) gd struct space will be reserved */ move.l %sp, -(%sp) bsr board_init_f_alloc_reserve /* update stack and frame-pointers */ move.l %d0, %sp move.l %sp, %fp /* initialize reserved area */ move.l %d0, -(%sp) bsr board_init_f_init_reserve /* run low-level CPU init code (from flash) */ bsr cpu_init_f clr.l %sp@- /* run low-level board init code (from flash) */ move.l #board_init_f, %a1 jsr (%a1) /* board_init_f() does not return */ /******************************************************************************/ /* * void relocate_code (addr_sp, gd, addr_moni) * * This "function" does not return, instead it continues in RAM * after relocating the monitor code. * * r3 = dest * r4 = src * r5 = length in bytes * r6 = cachelinesize */ .globl relocate_code relocate_code: link.w %a6,#0 move.l 8(%a6), %sp /* set new stack pointer */ move.l 12(%a6), %d0 /* Save copy of Global Data pointer */ move.l 16(%a6), %a0 /* Save copy of Destination Address */ move.l #CONFIG_SYS_MONITOR_BASE, %a1 move.l #__init_end, %a2 move.l %a0, %a3 /* copy the code to RAM */ 1: move.l (%a1)+, (%a3)+ cmp.l %a1,%a2 bgt.s 1b /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. */ move.l %a0, %a1 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1 jmp (%a1) in_ram: clear_bss: /* * Now clear BSS segment */ move.l %a0, %a1 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1 move.l %a0, %d1 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1 6: clr.l (%a1)+ cmp.l %a1,%d1 bgt.s 6b /* * fix got table in RAM */ move.l %a0, %a1 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1 move.l %a1,%a5 /* fix got pointer register a5 */ move.l %a0, %a2 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2 7: move.l (%a1),%d1 sub.l #_start,%d1 add.l %a0,%d1 move.l %d1,(%a1)+ cmp.l %a2, %a1 bne 7b /* calculate relative jump to board_init_r in ram */ move.l %a0, %a1 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1 /* set parameters for board_init_r */ move.l %a0,-(%sp) /* dest_addr */ move.l %d0,-(%sp) /* gd */ jsr (%a1) /******************************************************************************/ /* exception code */ .globl _fault _fault: bra _fault .globl _exc_handler _exc_handler: SAVE_ALL movel %sp,%sp@- bsr exc_handler addql #4,%sp RESTORE_ALL .globl _int_handler _int_handler: SAVE_ALL movel %sp,%sp@- bsr int_handler addql #4,%sp RESTORE_ALL /******************************************************************************/ .globl version_string version_string: .ascii U_BOOT_VERSION_STRING, "\0" .align 4
4ms/stm32mp1-baremetal
15,292
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/m68k/cpu/mcf5445x/start.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2003 Josef Baumgartner <josef.baumgartner@telex.de> * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com> * * Copyright 2010-2012 Freescale Semiconductor, Inc. * TsiChung Liew (Tsi-Chung.Liew@freescale.com) */ #include <common.h> #include <asm-offsets.h> #include <config.h> #include <timestamp.h> #include "version.h" #include <asm/cache.h> #define _START _start #define _FAULT _fault #define SAVE_ALL \ move.w #0x2700,%sr; /* disable intrs */ \ subl #60,%sp; /* space for 15 regs */ \ moveml %d0-%d7/%a0-%a6,%sp@; #define RESTORE_ALL \ moveml %sp@,%d0-%d7/%a0-%a6; \ addl #60,%sp; /* space for 15 regs */ \ rte; #if defined(CONFIG_SERIAL_BOOT) #define ASM_DRAMINIT (asm_dram_init - CONFIG_SYS_TEXT_BASE + \ CONFIG_SYS_INIT_RAM_ADDR) #define ASM_DRAMINIT_N (asm_dram_init - CONFIG_SYS_TEXT_BASE) #define ASM_SBF_IMG_HDR (asm_sbf_img_hdr - CONFIG_SYS_TEXT_BASE + \ CONFIG_SYS_INIT_RAM_ADDR) #endif .text /* * Vector table. This is used for initial platform startup. * These vectors are to catch any un-intended traps. */ _vectors: #if defined(CONFIG_SERIAL_BOOT) INITSP: .long 0 /* Initial SP */ #ifdef CONFIG_CF_SBF INITPC: .long ASM_DRAMINIT /* Initial PC */ #endif #ifdef CONFIG_SYS_NAND_BOOT INITPC: .long ASM_DRAMINIT_N /* Initial PC */ #endif #else INITSP: .long 0 /* Initial SP */ INITPC: .long _START /* Initial PC */ #endif vector02_0F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT /* Reserved */ vector10_17: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector18_1F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT #if !defined(CONFIG_SERIAL_BOOT) /* TRAP #0 - #15 */ vector20_2F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT /* Reserved */ vector30_3F: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector64_127: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector128_191: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT vector192_255: .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT #endif #if defined(CONFIG_SERIAL_BOOT) /* Image header: chksum 4 bytes, len 4 bytes, img dest 4 bytes */ asm_sbf_img_hdr: .long 0x00000000 /* checksum, not yet implemented */ .long 0x00040000 /* image length */ .long CONFIG_SYS_TEXT_BASE /* image to be relocated at */ asm_dram_init: move.w #0x2700,%sr /* Mask off Interrupt */ #ifdef CONFIG_SYS_NAND_BOOT /* for assembly stack */ move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0 movec %d0, %RAMBAR1 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp clr.l %sp@- #endif #ifdef CONFIG_CF_SBF move.l #CONFIG_SYS_INIT_RAM_ADDR, %d0 movec %d0, %VBR move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0 movec %d0, %RAMBAR1 /* initialize general use internal ram */ move.l #0, %d0 move.l #(ICACHE_STATUS), %a1 /* icache */ move.l #(DCACHE_STATUS), %a2 /* dcache */ move.l %d0, (%a1) move.l %d0, (%a2) /* invalidate and disable cache */ move.l #(CONFIG_SYS_ICACHE_INV + CONFIG_SYS_DCACHE_INV), %d0 movec %d0, %CACR /* Invalidate cache */ move.l #0, %d0 movec %d0, %ACR0 movec %d0, %ACR1 movec %d0, %ACR2 movec %d0, %ACR3 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp clr.l %sp@- #ifdef CONFIG_SYS_CS0_BASE /* Must disable global address */ move.l #0xFC008000, %a1 move.l #(CONFIG_SYS_CS0_BASE), (%a1) move.l #0xFC008008, %a1 move.l #(CONFIG_SYS_CS0_CTRL), (%a1) move.l #0xFC008004, %a1 move.l #(CONFIG_SYS_CS0_MASK), (%a1) #endif #endif /* CONFIG_CF_SBF */ #ifdef CONFIG_MCF5441x /* TC: enable all peripherals, in the future only enable certain peripherals */ move.l #0xFC04002D, %a1 #if defined(CONFIG_CF_SBF) move.b #23, (%a1) /* dspi */ #endif #endif /* CONFIG_MCF5441x */ /* mandatory board level ddr-sdram init, * for both 5441x and 5445x */ bsr sbf_dram_init #ifdef CONFIG_CF_SBF /* * DSPI Initialization * a0 - general, sram - 0x80008000 - 32, see M54455EVB.h * a1 - dspi status * a2 - dtfr * a3 - drfr * a4 - Dst addr */ /* Enable pins for DSPI mode - chip-selects are enabled later */ asm_dspi_init: #ifdef CONFIG_MCF5441x move.l #0xEC09404E, %a1 move.l #0xEC09404F, %a2 move.b #0xFF, (%a1) move.b #0x80, (%a2) #endif #ifdef CONFIG_MCF5445x move.l #0xFC0A4063, %a0 move.b #0x7F, (%a0) #endif /* Configure DSPI module */ move.l #0xFC05C000, %a0 move.l #0x80FF0C00, (%a0) /* Master, clear TX/RX FIFO */ move.l #0xFC05C00C, %a0 #ifdef CONFIG_MCF5441x move.l #0x3E000016, (%a0) #endif #ifdef CONFIG_MCF5445x move.l #0x3E000011, (%a0) #endif move.l #0xFC05C034, %a2 /* dtfr */ move.l #0xFC05C03B, %a3 /* drfr */ move.l #(ASM_SBF_IMG_HDR + 4), %a1 move.l (%a1)+, %d5 move.l (%a1), %a4 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_SBFHDR_DATA_OFFSET), %a0 move.l #(CONFIG_SYS_SBFHDR_SIZE), %d4 move.l #0xFC05C02C, %a1 /* dspi status */ /* Issue commands and address */ move.l #0x8002000B, %d2 /* Fast Read Cmd */ jsr asm_dspi_wr_status jsr asm_dspi_rd_status move.l #0x80020000, %d2 /* Address byte 2 */ jsr asm_dspi_wr_status jsr asm_dspi_rd_status move.l #0x80020000, %d2 /* Address byte 1 */ jsr asm_dspi_wr_status jsr asm_dspi_rd_status move.l #0x80020000, %d2 /* Address byte 0 */ jsr asm_dspi_wr_status jsr asm_dspi_rd_status move.l #0x80020000, %d2 /* Dummy Wr and Rd */ jsr asm_dspi_wr_status jsr asm_dspi_rd_status /* Transfer serial boot header to sram */ asm_dspi_rd_loop1: move.l #0x80020000, %d2 jsr asm_dspi_wr_status jsr asm_dspi_rd_status move.b %d1, (%a0) /* read, copy to dst */ add.l #1, %a0 /* inc dst by 1 */ sub.l #1, %d4 /* dec cnt by 1 */ bne asm_dspi_rd_loop1 /* Transfer u-boot from serial flash to memory */ asm_dspi_rd_loop2: move.l #0x80020000, %d2 jsr asm_dspi_wr_status jsr asm_dspi_rd_status move.b %d1, (%a4) /* read, copy to dst */ add.l #1, %a4 /* inc dst by 1 */ sub.l #1, %d5 /* dec cnt by 1 */ bne asm_dspi_rd_loop2 move.l #0x00020000, %d2 /* Terminate */ jsr asm_dspi_wr_status jsr asm_dspi_rd_status /* jump to memory and execute */ move.l #(CONFIG_SYS_TEXT_BASE + 0x400), %a0 jmp (%a0) asm_dspi_wr_status: move.l (%a1), %d0 /* status */ and.l #0x0000F000, %d0 cmp.l #0x00003000, %d0 bgt asm_dspi_wr_status move.l %d2, (%a2) rts asm_dspi_rd_status: move.l (%a1), %d0 /* status */ and.l #0x000000F0, %d0 lsr.l #4, %d0 cmp.l #0, %d0 beq asm_dspi_rd_status move.b (%a3), %d1 rts #endif /* CONFIG_CF_SBF */ #ifdef CONFIG_SYS_NAND_BOOT /* copy 4 boot pages to dram as soon as possible */ /* each page is 996 bytes (1056 total with 60 ECC bytes */ move.l #0x00000000, %a1 /* src */ move.l #CONFIG_SYS_TEXT_BASE, %a2 /* dst */ move.l #0x3E0, %d0 /* sz in long */ asm_boot_nand_copy: move.l (%a1)+, (%a2)+ subq.l #1, %d0 bne asm_boot_nand_copy /* jump to memory and execute */ move.l #(asm_nand_init), %a0 jmp (%a0) asm_nand_init: /* exit nand boot-mode */ move.l #0xFC0FFF30, %a1 or.l #0x00000040, %d1 move.l %d1, (%a1) /* initialize general use internal ram */ move.l #0, %d0 move.l #(CACR_STATUS), %a1 /* CACR */ move.l #(ICACHE_STATUS), %a2 /* icache */ move.l #(DCACHE_STATUS), %a3 /* dcache */ move.l %d0, (%a1) move.l %d0, (%a2) move.l %d0, (%a3) /* invalidate and disable cache */ move.l #0x01004100, %d0 /* Invalidate cache cmd */ movec %d0, %CACR /* Invalidate cache */ move.l #0, %d0 movec %d0, %ACR0 movec %d0, %ACR1 movec %d0, %ACR2 movec %d0, %ACR3 #ifdef CONFIG_SYS_CS0_BASE /* Must disable global address */ move.l #0xFC008000, %a1 move.l #(CONFIG_SYS_CS0_BASE), (%a1) move.l #0xFC008008, %a1 move.l #(CONFIG_SYS_CS0_CTRL), (%a1) move.l #0xFC008004, %a1 move.l #(CONFIG_SYS_CS0_MASK), (%a1) #endif /* NAND port configuration */ move.l #0xEC094048, %a1 move.b #0xFD, (%a1)+ move.b #0x5F, (%a1)+ move.b #0x04, (%a1)+ /* reset nand */ move.l #0xFC0FFF38, %a1 /* isr */ move.l #0x000e0000, (%a1) move.l #0xFC0FFF08, %a2 move.l #0x00000000, (%a2)+ /* car */ move.l #0x11000000, (%a2)+ /* rar */ move.l #0x00000000, (%a2)+ /* rpt */ move.l #0x00000000, (%a2)+ /* rai */ move.l #0xFC0FFF2c, %a2 /* cfg */ move.l #0x00000000, (%a2)+ /* secsz */ move.l #0x000e0681, (%a2)+ move.l #0xFC0FFF04, %a2 /* cmd2 */ move.l #0xFF404001, (%a2) move.l #0x000e0000, (%a1) move.l #0x2000, %d1 bsr asm_delay /* setup nand */ move.l #0xFC0FFF00, %a1 move.l #0x30700000, (%a1)+ /* cmd1 */ move.l #0x007EF000, (%a1)+ /* cmd2 */ move.l #0xFC0FFF2C, %a1 move.l #0x00000841, (%a1)+ /* secsz */ move.l #0x000e0681, (%a1)+ /* cfg */ move.l #100, %d4 /* 100 pages ~200KB */ move.l #4, %d2 /* start at 4 */ move.l #0xFC0FFF04, %a0 /* cmd2 */ move.l #0xFC0FFF0C, %a1 /* rar */ move.l #(CONFIG_SYS_TEXT_BASE + 0xF80), %a2 asm_nand_read: move.l #0x11000000, %d0 /* rar */ or.l %d2, %d0 move.l %d0, (%a1) add.l #1, %d2 move.l (%a0), %d0 /* cmd2 */ or.l #1, %d0 move.l %d0, (%a0) move.l #0x200, %d1 bsr asm_delay asm_nand_chk_status: move.l #0xFC0FFF38, %a4 /* isr */ move.l (%a4), %d0 and.l #0x40000000, %d0 tst.l %d0 beq asm_nand_chk_status move.l #0xFC0FFF38, %a4 /* isr */ move.l (%a4), %d0 or.l #0x000E0000, %d0 move.l %d0, (%a4) move.l #0x200, %d3 move.l #0xFC0FC000, %a3 /* buf 1 */ asm_nand_copy: move.l (%a3)+, (%a2)+ subq.l #1, %d3 bgt asm_nand_copy subq.l #1, %d4 bgt asm_nand_read /* jump to memory and execute */ move.l #(CONFIG_SYS_TEXT_BASE + 0x400), %a0 jmp (%a0) #endif /* CONFIG_SYS_NAND_BOOT */ .globl asm_delay asm_delay: nop subq.l #1, %d1 bne asm_delay rts #endif /* CONFIG_CF_SBF || CONFIG_NAND_U_BOOT */ .text . = 0x400 .globl _start _start: #if !defined(CONFIG_SERIAL_BOOT) nop nop move.w #0x2700,%sr /* Mask off Interrupt */ /* Set vector base register at the beginning of the Flash */ move.l #CONFIG_SYS_FLASH_BASE, %d0 movec %d0, %VBR move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0 movec %d0, %RAMBAR1 /* initialize general use internal ram */ move.l #0, %d0 move.l #(ICACHE_STATUS), %a1 /* icache */ move.l #(DCACHE_STATUS), %a2 /* dcache */ move.l %d0, (%a1) move.l %d0, (%a2) /* invalidate and disable cache */ move.l #(CONFIG_SYS_ICACHE_INV + CONFIG_SYS_DCACHE_INV), %d0 movec %d0, %CACR /* Invalidate cache */ move.l #0, %d0 movec %d0, %ACR0 movec %d0, %ACR1 movec %d0, %ACR2 movec %d0, %ACR3 #else move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0 movec %d0, %RAMBAR1 #endif /* put relocation table address to a5 */ move.l #__got_start, %a5 /* setup stack initially on top of internal static ram */ move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp /* * if configured, malloc_f arena will be reserved first, * then (and always) gd struct space will be reserved */ move.l %sp, -(%sp) move.l #board_init_f_alloc_reserve, %a1 jsr (%a1) /* update stack and frame-pointers */ move.l %d0, %sp move.l %sp, %fp /* initialize reserved area */ move.l %d0, -(%sp) move.l #board_init_f_init_reserve, %a1 jsr (%a1) /* run low-level CPU init code (from flash) */ move.l #cpu_init_f, %a1 jsr (%a1) /* run low-level board init code (from flash) */ clr.l %sp@- move.l #board_init_f, %a1 jsr (%a1) /* board_init_f() does not return */ /******************************************************************************/ /* * void relocate_code (addr_sp, gd, addr_moni) * * This "function" does not return, instead it continues in RAM * after relocating the monitor code. * * r3 = dest * r4 = src * r5 = length in bytes * r6 = cachelinesize */ .globl relocate_code relocate_code: link.w %a6,#0 move.l 8(%a6), %sp /* set new stack pointer */ move.l 12(%a6), %d0 /* Save copy of Global Data pointer */ move.l 16(%a6), %a0 /* Save copy of Destination Address */ move.l #CONFIG_SYS_MONITOR_BASE, %a1 move.l #__init_end, %a2 move.l %a0, %a3 /* copy the code to RAM */ 1: move.l (%a1)+, (%a3)+ cmp.l %a1,%a2 bgt.s 1b /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. */ move.l %a0, %a1 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1 jmp (%a1) in_ram: clear_bss: /* * Now clear BSS segment */ move.l %a0, %a1 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1 move.l %a0, %d1 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1 6: clr.l (%a1)+ cmp.l %a1,%d1 bgt.s 6b /* * fix got table in RAM */ move.l %a0, %a1 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1 move.l %a1,%a5 /* fix got pointer register a5 */ move.l %a0, %a2 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2 7: move.l (%a1),%d1 sub.l #_start,%d1 add.l %a0,%d1 move.l %d1,(%a1)+ cmp.l %a2, %a1 bne 7b /* calculate relative jump to board_init_r in ram */ move.l %a0, %a1 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1 /* set parameters for board_init_r */ move.l %a0,-(%sp) /* dest_addr */ move.l %d0,-(%sp) /* gd */ jsr (%a1) /******************************************************************************/ /* exception code */ .globl _fault _fault: bra _fault .globl _exc_handler _exc_handler: SAVE_ALL movel %sp,%sp@- bsr exc_handler addql #4,%sp RESTORE_ALL .globl _int_handler _int_handler: SAVE_ALL movel %sp,%sp@- bsr int_handler addql #4,%sp RESTORE_ALL /******************************************************************************/ .globl version_string version_string: .ascii U_BOOT_VERSION_STRING, "\0" .align 4
4ms/stm32mp1-baremetal
1,369
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/microblaze/cpu/irq.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2007 Michal Simek * * Michal SIMEK <monstr@monstr.eu> */ #include <config.h> #include <asm/asm.h> .text .global _interrupt_handler _interrupt_handler: addik r1, r1, -124 swi r2, r1, 4 swi r3, r1, 8 swi r4, r1, 12 swi r5, r1, 16 swi r6, r1, 20 swi r7, r1, 24 swi r8, r1, 28 swi r9, r1, 32 swi r10, r1, 36 swi r11, r1, 40 swi r12, r1, 44 swi r13, r1, 48 swi r14, r1, 52 swi r15, r1, 56 swi r16, r1, 60 swi r17, r1, 64 swi r18, r1, 68 swi r19, r1, 72 swi r20, r1, 76 swi r21, r1, 80 swi r22, r1, 84 swi r23, r1, 88 swi r24, r1, 92 swi r25, r1, 96 swi r26, r1, 100 swi r27, r1, 104 swi r28, r1, 108 swi r29, r1, 112 swi r30, r1, 116 swi r31, r1, 120 brlid r15, interrupt_handler nop lwi r31, r1, 120 lwi r30, r1, 116 lwi r29, r1, 112 lwi r28, r1, 108 lwi r27, r1, 104 lwi r26, r1, 100 lwi r25, r1, 96 lwi r24, r1, 92 lwi r23, r1, 88 lwi r22, r1, 84 lwi r21, r1, 80 lwi r20, r1, 76 lwi r19, r1, 72 lwi r18, r1, 68 lwi r17, r1, 64 lwi r16, r1, 60 lwi r15, r1, 56 lwi r14, r1, 52 lwi r13, r1, 48 lwi r12, r1, 44 lwi r11, r1, 40 lwi r10, r1, 36 lwi r9, r1, 32 lwi r8, r1, 28 lwi r7, r1, 24 lwi r6, r1, 20 lwi r5, r1, 16 lwi r4, r1, 12 lwi r3, r1, 8 lwi r2, r1, 4 addik r1, r1, 124 rtid r14, 0 nop .size _interrupt_handler,.-_interrupt_handler
4ms/stm32mp1-baremetal
7,744
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/microblaze/cpu/start.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2007 Michal Simek * (C) Copyright 2004 Atmark Techno, Inc. * * Michal SIMEK <monstr@monstr.eu> * Yasushi SHOJI <yashi@atmark-techno.com> */ #include <asm-offsets.h> #include <config.h> .text .global _start _start: /* * reserve registers: * r10: Stores little/big endian offset for vectors * r2: Stores imm opcode * r3: Stores brai opcode */ mts rmsr, r0 /* disable cache */ addi r8, r0, __end mts rslr, r8 /* TODO: Redo this code to call board_init_f_*() */ #if defined(CONFIG_SPL_BUILD) addi r1, r0, CONFIG_SPL_STACK_ADDR mts rshr, r1 addi r1, r1, -4 /* Decrement SP to top of memory */ #else #if CONFIG_VAL(SYS_MALLOC_F_LEN) addi r1, r0, CONFIG_SYS_INIT_SP_OFFSET - CONFIG_VAL(SYS_MALLOC_F_LEN) #else addi r1, r0, CONFIG_SYS_INIT_SP_OFFSET #endif mts rshr, r1 addi r1, r1, -4 /* Decrement SP to top of memory */ /* Find-out if u-boot is running on BIG/LITTLE endian platform * There are some steps which is necessary to keep in mind: * 1. Setup offset value to r6 * 2. Store word offset value to address 0x0 * 3. Load just byte from address 0x0 * 4a) LITTLE endian - r10 contains 0x2 because it is the smallest * value that's why is on address 0x0 * 4b) BIG endian - r10 contains 0x0 because 0x2 offset is on addr 0x3 */ addik r6, r0, 0x2 /* BIG/LITTLE endian offset */ lwi r7, r0, 0x28 swi r6, r0, 0x28 /* used first unused MB vector */ lbui r10, r0, 0x28 /* used first unused MB vector */ swi r7, r0, 0x28 /* add opcode instruction for 32bit jump - 2 instruction imm & brai */ addi r2, r0, 0xb0000000 /* hex b000 opcode imm */ addi r3, r0, 0xb8080000 /* hew b808 opcode brai */ #ifdef CONFIG_SYS_RESET_ADDRESS /* reset address */ swi r2, r0, 0x0 /* reset address - imm opcode */ swi r3, r0, 0x4 /* reset address - brai opcode */ addik r6, r0, CONFIG_SYS_RESET_ADDRESS sw r6, r1, r0 lhu r7, r1, r10 rsubi r8, r10, 0x2 sh r7, r0, r8 rsubi r8, r10, 0x6 sh r6, r0, r8 #endif #ifdef CONFIG_SYS_USR_EXCEP /* user_vector_exception */ swi r2, r0, 0x8 /* user vector exception - imm opcode */ swi r3, r0, 0xC /* user vector exception - brai opcode */ addik r6, r0, _exception_handler sw r6, r1, r0 /* * BIG ENDIAN memory map for user exception * 0x8: 0xB000XXXX * 0xC: 0xB808XXXX * * then it is necessary to count address for storing the most significant * 16bits from _exception_handler address and copy it to * 0xa address. Big endian use offset in r10=0 that's why is it just * 0xa address. The same is done for the least significant 16 bits * for 0xe address. * * LITTLE ENDIAN memory map for user exception * 0x8: 0xXXXX00B0 * 0xC: 0xXXXX08B8 * * Offset is for little endian setup to 0x2. rsubi instruction decrease * address value to ensure that points to proper place which is * 0x8 for the most significant 16 bits and * 0xC for the least significant 16 bits */ lhu r7, r1, r10 rsubi r8, r10, 0xa sh r7, r0, r8 rsubi r8, r10, 0xe sh r6, r0, r8 #endif /* interrupt_handler */ swi r2, r0, 0x10 /* interrupt - imm opcode */ swi r3, r0, 0x14 /* interrupt - brai opcode */ addik r6, r0, _interrupt_handler sw r6, r1, r0 lhu r7, r1, r10 rsubi r8, r10, 0x12 sh r7, r0, r8 rsubi r8, r10, 0x16 sh r6, r0, r8 /* hardware exception */ swi r2, r0, 0x20 /* hardware exception - imm opcode */ swi r3, r0, 0x24 /* hardware exception - brai opcode */ addik r6, r0, _hw_exception_handler sw r6, r1, r0 lhu r7, r1, r10 rsubi r8, r10, 0x22 sh r7, r0, r8 rsubi r8, r10, 0x26 sh r6, r0, r8 #endif /* CONFIG_SPL_BUILD */ /* Flush cache before enable cache */ addik r5, r0, 0 addik r6, r0, XILINX_DCACHE_BYTE_SIZE bralid r15, flush_cache nop /* enable instruction and data cache */ mfs r12, rmsr ori r12, r12, 0x1a0 mts rmsr, r12 /* TODO: Redo this code to call board_init_f_*() */ clear_bss: /* clear BSS segments */ addi r5, r0, __bss_start addi r4, r0, __bss_end cmp r6, r5, r4 beqi r6, 3f 2: swi r0, r5, 0 /* write zero to loc */ addi r5, r5, 4 /* increment to next loc */ cmp r6, r5, r4 /* check if we have reach the end */ bnei r6, 2b 3: /* jumping to board_init */ #ifdef CONFIG_DEBUG_UART bralid r15, debug_uart_init nop #endif #ifndef CONFIG_SPL_BUILD or r5, r0, r0 /* flags - empty */ addi r31, r0, _gd #if CONFIG_VAL(SYS_MALLOC_F_LEN) addi r6, r0, CONFIG_SYS_INIT_SP_OFFSET swi r6, r31, GD_MALLOC_BASE #endif brai board_init_f #else addi r31, r0, _gd #if CONFIG_VAL(SYS_MALLOC_F_LEN) addi r6, r0, CONFIG_SPL_STACK_ADDR swi r6, r31, GD_MALLOC_BASE #endif brai board_init_r #endif 1: bri 1b .section .bss .align 4 _gd: .space GENERATED_GBL_DATA_SIZE #ifndef CONFIG_SPL_BUILD /* * Read 16bit little endian */ .text .global in16 .ent in16 .align 2 in16: lhu r3, r0, r5 bslli r4, r3, 8 bsrli r3, r3, 8 andi r4, r4, 0xffff or r3, r3, r4 rtsd r15, 8 sext16 r3, r3 .end in16 /* * Write 16bit little endian * first parameter(r5) - address, second(r6) - short value */ .text .global out16 .ent out16 .align 2 out16: bslli r3, r6, 8 bsrli r6, r6, 8 andi r3, r3, 0xffff or r3, r3, r6 sh r3, r0, r5 rtsd r15, 8 or r0, r0, r0 .end out16 /* * Relocate u-boot */ .text .global relocate_code .ent relocate_code .align 2 relocate_code: /* * r5 - start_addr_sp * r6 - new_gd * r7 - reloc_addr */ addi r1, r5, 0 /* Start to use new SP */ addi r31, r6, 0 /* Start to use new GD */ add r23, r0, r7 /* Move reloc addr to r23 */ /* Relocate text and data - r12 temp value */ addi r21, r0, _start addi r22, r0, __end - 4 /* Include BSS too */ rsub r6, r21, r22 or r5, r0, r0 1: lw r12, r21, r5 /* Load u-boot data */ sw r12, r23, r5 /* Write zero to loc */ cmp r12, r5, r6 /* Check if we have reach the end */ bneid r12, 1b addi r5, r5, 4 /* Increment to next loc - relocate code */ /* R23 points to the base address. */ add r23, r0, r7 /* Move reloc addr to r23 */ addi r24, r0, CONFIG_SYS_TEXT_BASE /* Get reloc offset */ rsub r23, r24, r23 /* keep - this is already here gd->reloc_off */ addik r6, r0, 0x2 /* BIG/LITTLE endian offset */ lwi r7, r0, 0x28 swi r6, r0, 0x28 /* used first unused MB vector */ lbui r10, r0, 0x28 /* used first unused MB vector */ swi r7, r0, 0x28 #ifdef CONFIG_SYS_USR_EXCEP addik r6, r0, _exception_handler addk r6, r6, r23 /* add offset */ sw r6, r1, r0 lhu r7, r1, r10 rsubi r8, r10, 0xa sh r7, r0, r8 rsubi r8, r10, 0xe sh r6, r0, r8 #endif addik r6, r0, _hw_exception_handler addk r6, r6, r23 /* add offset */ sw r6, r1, r0 lhu r7, r1, r10 rsubi r8, r10, 0x22 sh r7, r0, r8 rsubi r8, r10, 0x26 sh r6, r0, r8 addik r6, r0, _interrupt_handler addk r6, r6, r23 /* add offset */ sw r6, r1, r0 lhu r7, r1, r10 rsubi r8, r10, 0x12 sh r7, r0, r8 rsubi r8, r10, 0x16 sh r6, r0, r8 /* Check if GOT exist */ addik r21, r23, _got_start addik r22, r23, _got_end cmpu r12, r21, r22 beqi r12, 2f /* No GOT table - jump over */ /* Skip last 3 entries plus 1 because of loop boundary below */ addik r22, r22, -0x10 /* Relocate the GOT. */ 3: lw r12, r21, r0 /* Load entry */ addk r12, r12, r23 /* Add reloc offset */ sw r12, r21, r0 /* Save entry back */ cmpu r12, r21, r22 /* Check if this cross boundary */ bneid r12, 3b addik r21. r21, 4 /* Update pointer to GOT */ mfs r20, rpc addik r20, r20, _GLOBAL_OFFSET_TABLE_ + 8 addk r20, r20, r23 /* Flush caches to ensure consistency */ addik r5, r0, 0 addik r6, r0, XILINX_DCACHE_BYTE_SIZE bralid r15, flush_cache nop 2: addi r5, r31, 0 /* gd is initialized in board_r.c */ addi r6, r0, CONFIG_SYS_TEXT_BASE addi r12, r23, board_init_r bra r12 /* Jump to relocated code */ .end relocate_code #endif
4ms/stm32mp1-baremetal
11,922
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/nds32/cpu/n1213/start.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Andesboot - Startup Code for Whitiger core * * Copyright (C) 2006 Andes Technology Corporation * Copyright (C) 2006 Shawn Lin <nobuhiro@andestech.com> * Copyright (C) 2011 Macpaul Lin <macpaul@andestech.com> * Greentime Hu <greentime@andestech.com> */ .pic #include <asm-offsets.h> #include <config.h> #include <common.h> #include <asm/macro.h> /* * Jump vector table for EVIC mode */ #define ENA_DCAC 2UL #define DIS_DCAC ~ENA_DCAC #define ICAC_MEM_KBF_ISET (0x07) ! I Cache sets per way #define ICAC_MEM_KBF_IWAY (0x07<<3) ! I cache ways #define ICAC_MEM_KBF_ISZ (0x07<<6) ! I cache line size #define DCAC_MEM_KBF_DSET (0x07) ! D Cache sets per way #define DCAC_MEM_KBF_DWAY (0x07<<3) ! D cache ways #define DCAC_MEM_KBF_DSZ (0x07<<6) ! D cache line size #define PSW $ir0 #define EIT_INTR_PSW $ir1 ! interruption $PSW #define EIT_PREV_IPSW $ir2 ! previous $IPSW #define EIT_IVB $ir3 ! intr vector base address #define EIT_EVA $ir4 ! MMU related Exception VA reg #define EIT_PREV_EVA $ir5 ! previous $eva #define EIT_ITYPE $ir6 ! interruption type #define EIT_PREV_ITYPE $ir7 ! prev intr type #define EIT_MACH_ERR $ir8 ! machine error log #define EIT_INTR_PC $ir9 ! Interruption PC #define EIT_PREV_IPC $ir10 ! previous $IPC #define EIT_OVL_INTR_PC $ir11 ! overflow interruption PC #define EIT_PREV_P0 $ir12 ! prev $P0 #define EIT_PREV_P1 $ir13 ! prev $p1 #define CR_ICAC_MEM $cr1 ! I-cache/memory config reg #define CR_DCAC_MEM $cr2 ! D-cache/memory config reg #define MR_CAC_CTL $mr8 .globl _start _start: j reset j tlb_fill j tlb_not_present j tlb_misc j tlb_vlpt_miss j machine_error j debug j general_exception j syscall j internal_interrupt ! H0I j internal_interrupt ! H1I j internal_interrupt ! H2I j internal_interrupt ! H3I j internal_interrupt ! H4I j internal_interrupt ! H5I j software_interrupt ! S0I .balign 16 /* * Andesboot Startup Code (reset vector) * * 1. bootstrap * 1.1 reset - start of u-boot * 1.2 to superuser mode - as is when reset * 1.4 Do lowlevel_init * - (this will jump out to lowlevel_init.S in SoC) * - (lowlevel_init) * 1.3 Turn off watchdog timer * - (this will jump out to watchdog.S in SoC) * - (turnoff_watchdog) * 2. Do critical init when reboot (not from mem) * 3. Relocate andesboot to ram * 4. Setup stack * 5. Jump to second stage (board_init_r) */ /* Note: TEXT_BASE is defined by the (board-dependent) linker script */ .globl _TEXT_BASE _TEXT_BASE: .word CONFIG_SYS_TEXT_BASE /* IRQ stack memory (calculated at run-time) + 8 bytes */ .globl IRQ_STACK_START_IN IRQ_STACK_START_IN: .word 0x0badc0de /* * The bootstrap code of nds32 core */ reset: /* * gp = ~0 for burn mode * = ~load_address for load mode */ reset_gp: .relax_hint 0 sethi $gp, hi20(_GLOBAL_OFFSET_TABLE_-8) .relax_hint 0 ori $gp, $gp, lo12(_GLOBAL_OFFSET_TABLE_-4) add5.pc $gp set_ivb: li $r0, 0x0 /* turn on BTB */ mtsr $r0, $misc_ctl /* set IVIC, vector size: 4 bytes, base: 0x0 */ mtsr $r0, $ivb /* * MMU_CTL NTC0 Non-cacheable */ li $r0, ~0x6 mfsr $r1, $mr0 and $r1, $r1, $r0 mtsr $r1, $mr0 li $r0, ~0x3 mfsr $r1, $mr8 and $r1, $r1, $r0 mtsr $r1, $mr8 #if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) /* * MMU_CTL NTC0 Cacheable/Write-Back */ li $r0, 0x4 mfsr $r1, $mr0 or $r1, $r1, $r0 mtsr $r1, $mr0 #endif #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) #ifdef CONFIG_ARCH_MAP_SYSMEM /* * MMU_CTL NTC1 Non-cacheable */ li $r0, ~0x18 mfsr $r1, $mr0 and $r1, $r1, $r0 mtsr $r1, $mr0 /* * MMU_CTL NTM1 mapping for partition 0 */ li $r0, ~0x6000 mfsr $r1, $mr0 and $r1, $r1, $r0 mtsr $r1, $mr0 #endif #endif #if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF) li $r0, 0x1 mfsr $r1, $mr8 or $r1, $r1, $r0 mtsr $r1, $mr8 #endif #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) li $r0, 0x2 mfsr $r1, $mr8 or $r1, $r1, $r0 mtsr $r1, $mr8 #endif jal mem_init #ifndef CONFIG_SKIP_LOWLEVEL_INIT jal lowlevel_init /* * gp = ~VMA for burn mode * = ~load_address for load mode */ update_gp: .relax_hint 0 sethi $gp, hi20(_GLOBAL_OFFSET_TABLE_-8) .relax_hint 0 ori $gp, $gp, lo12(_GLOBAL_OFFSET_TABLE_-4) add5.pc $gp #endif /* * do critical initializations first (shall be in short time) * do self_relocation ASAP. */ /* * Set the N1213 (Whitiger) core to superuser mode * According to spec, it is already when reset */ #ifndef CONFIG_SKIP_TRUNOFF_WATCHDOG jal turnoff_watchdog #endif /* * Set stackpointer in internal RAM to call board_init_f * $sp must be 8-byte alignment for ABI compliance. */ call_board_init_f: li $sp, CONFIG_SYS_INIT_SP_ADDR move $r0, $sp bal board_init_f_alloc_reserve move $sp, $r0 bal board_init_f_init_reserve #ifdef CONFIG_DEBUG_UART bal debug_uart_init #endif li $r0, 0x00000000 #ifdef __PIC__ #ifdef __NDS32_N1213_43U1H__ /* __NDS32_N1213_43U1H__ implies NDS32 V0 ISA */ la $r15, board_init_f ! store function address into $r15 #endif #endif j board_init_f ! jump to board_init_f() in lib/board.c /* * void relocate_code (addr_sp, gd, addr_moni) * * This "function" does not return, instead it continues in RAM * after relocating the monitor code. * */ /* * gp = ~RAM_SIZE - TEXT_SIZE for burn/load mode */ .globl relocate_code relocate_code: move $r4, $r0 /* save addr_sp */ move $r5, $r1 /* save addr of gd */ move $r6, $r2 /* save addr of destination */ /* Set up the stack */ stack_setup: move $sp, $r4 la $r0, _start@GOTOFF beq $r0, $r6, clear_bss /* skip relocation */ la $r1, _end@GOTOFF move $r2, $r6 /* r2 <- scratch for copy_loop */ copy_loop: lmw.bim $r11, [$r0], $r18 smw.bim $r11, [$r2], $r18 blt $r0, $r1, copy_loop /* * fix relocations related issues */ fix_relocations: l.w $r0, _TEXT_BASE@GOTOFF /* r0 <- Text base */ sub $r9, $r6, $r0 /* r9 <- relocation offset */ la $r7, __rel_dyn_start@GOTOFF add $r7, $r7, $r9 /* r2 <- rel __got_start in RAM */ la $r8, __rel_dyn_end@GOTOFF add $r8, $r8, $r9 /* r2 <- rel __got_start in RAM */ li $r3, #0x2a /* R_NDS32_RELATIVE */ 1: lmw.bim $r0, [$r7], $r2 /* r0,r1,r2 <- adr,type,addend */ bne $r1, $r3, 2f add $r0, $r0, $r9 add $r2, $r2, $r9 sw $r2, [$r0] 2: blt $r7, $r8, 1b clear_bss: la $r0, __bss_start@GOTOFF /* r0 <- rel __bss_start in FLASH */ add $r0, $r0, $r9 /* r0 <- rel __bss_start in FLASH */ la $r1, __bss_end@GOTOFF /* r1 <- rel __bss_end in RAM */ add $r1, $r1, $r9 /* r0 <- rel __bss_end in RAM */ li $r2, 0x00000000 /* clear */ clbss_l: sw $r2, [$r0] /* clear loop... */ addi $r0, $r0, #4 bne $r0, $r1, clbss_l /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. */ call_board_init_r: bal invalidate_icache_all bal flush_dcache_all la $r0, board_init_r@GOTOFF move $lp, $r0 /* offset of board_init_r() */ add $lp, $lp, $r9 /* real address of board_init_r() */ /* setup parameters for board_init_r */ move $r0, $r5 /* gd_t */ move $r1, $r6 /* dest_addr */ #ifdef __PIC__ #ifdef __NDS32_N1213_43U1H__ /* NDS32 V0 ISA */ move $r15, $lp /* store function address into $r15 */ #endif #endif /* jump to it ... */ jr $lp /* jump to board_init_r() */ /* * Invalidate I$ */ invalidate_icac: ! read $cr1(I CAC/MEM cfg. reg.) configuration mfsr $t0, CR_ICAC_MEM ! Get the ISZ field andi $p0, $t0, ICAC_MEM_KBF_ISZ ! if $p0=0, then no I CAC existed beqz $p0, end_flush_icache ! get $p0 the index of I$ block srli $p0, $p0, 6 ! $t1= bit width of I cache line size(ISZ) addi $t1, $p0, 2 li $t4, 1 sll $t5, $t4, $t1 ! get $t5 cache line size andi $p1, $t0, ICAC_MEM_KBF_ISET ! get the ISET field addi $t2, $p1, 6 ! $t2= bit width of ISET andi $p1, $t0, ICAC_MEM_KBF_IWAY ! get bitfield of Iway srli $p1, $p1, 3 addi $p1, $p1, 1 ! then $p1 is I way number add $t3, $t2, $t1 ! SHIFT sll $p1, $p1, $t3 ! GET the total cache size ICAC_LOOP: sub $p1, $p1, $t5 cctl $p1, L1I_IX_INVAL bnez $p1, ICAC_LOOP end_flush_icache: ret /* * Invalidate D$ */ invalidate_dcac: ! read $cr2(D CAC/MEM cfg. reg.) configuration mfsr $t0, CR_DCAC_MEM ! Get the DSZ field andi $p0, $t0, DCAC_MEM_KBF_DSZ ! if $p0=0, then no D CAC existed beqz $p0, end_flush_dcache ! get $p0 the index of D$ block srli $p0, $p0, 6 ! $t1= bit width of D cache line size(DSZ) addi $t1, $p0, 2 li $t4, 1 sll $t5, $t4, $t1 ! get $t5 cache line size andi $p1, $t0, DCAC_MEM_KBF_DSET ! get the DSET field addi $t2, $p1, 6 ! $t2= bit width of DSET andi $p1, $t0, DCAC_MEM_KBF_DWAY ! get bitfield of D way srli $p1, $p1, 3 addi $p1, $p1, 1 ! then $p1 is D way number add $t3, $t2, $t1 ! SHIFT sll $p1, $p1, $t3 ! GET the total cache size DCAC_LOOP: sub $p1, $p1, $t5 cctl $p1, L1D_IX_INVAL bnez $p1, DCAC_LOOP end_flush_dcache: ret /* * Interrupt handling */ /* * exception handlers */ .align 5 .macro SAVE_ALL ! FIXME: Other way to get PC? ! FIXME: Update according to the newest spec!! 1: li $r28, 1 push $r28 mfsr $r28, PSW ! $PSW push $r28 mfsr $r28, EIT_EVA ! $ir1 $EVA push $r28 mfsr $r28, EIT_ITYPE ! $ir2 $ITYPE push $r28 mfsr $r28, EIT_MACH_ERR ! $ir3 Mach Error push $r28 mfsr $r28, EIT_INTR_PSW ! $ir5 $IPSW push $r28 mfsr $r28, EIT_PREV_IPSW ! $ir6 prev $IPSW push $r28 mfsr $r28, EIT_PREV_EVA ! $ir7 prev $EVA push $r28 mfsr $r28, EIT_PREV_ITYPE ! $ir8 prev $ITYPE push $r28 mfsr $r28, EIT_INTR_PC ! $ir9 Interruption PC push $r28 mfsr $r28, EIT_PREV_IPC ! $ir10 prev INTR_PC push $r28 mfsr $r28, EIT_OVL_INTR_PC ! $ir11 Overflowed INTR_PC push $r28 mfusr $r28, $d1.lo push $r28 mfusr $r28, $d1.hi push $r28 mfusr $r28, $d0.lo push $r28 mfusr $r28, $d0.hi push $r28 pushm $r0, $r30 ! store $sp-$r31, ra-$r30, $gp-$r29, $r28-$fp addi $sp, $sp, -4 ! make room for implicit pt_regs parameters .endm .align 5 tlb_fill: SAVE_ALL move $r0, $sp ! To get the kernel stack li $r1, 1 ! Determine interruption type bal do_interruption .align 5 tlb_not_present: SAVE_ALL move $r0, $sp ! To get the kernel stack li $r1, 2 ! Determine interruption type bal do_interruption .align 5 tlb_misc: SAVE_ALL move $r0, $sp ! To get the kernel stack li $r1, 3 ! Determine interruption type bal do_interruption .align 5 tlb_vlpt_miss: SAVE_ALL move $r0, $sp ! To get the kernel stack li $r1, 4 ! Determine interruption type bal do_interruption .align 5 machine_error: SAVE_ALL move $r0, $sp ! To get the kernel stack li $r1, 5 ! Determine interruption type bal do_interruption .align 5 debug: SAVE_ALL move $r0, $sp ! To get the kernel stack li $r1, 6 ! Determine interruption type bal do_interruption .align 5 general_exception: SAVE_ALL move $r0, $sp ! To get the kernel stack li $r1, 7 ! Determine interruption type bal do_interruption .align 5 syscall: SAVE_ALL move $r0, $sp ! To get the kernel stack li $r1, 8 ! Determine interruption type bal do_interruption .align 5 internal_interrupt: SAVE_ALL move $r0, $sp ! To get the kernel stack li $r1, 9 ! Determine interruption type bal do_interruption .align 5 software_interrupt: SAVE_ALL move $r0, $sp ! To get the kernel stack li $r1, 10 ! Determine interruption type bal do_interruption .align 5 /* * void reset_cpu(ulong addr); * $r0: input address to jump to */ .globl reset_cpu reset_cpu: /* No need to disable MMU because we never enable it */ bal invalidate_icac bal invalidate_dcac mfsr $p0, $MMU_CFG andi $p0, $p0, 0x3 ! MMPS li $p1, 0x2 ! TLB MMU bne $p0, $p1, 1f tlbop flushall ! Flush TLB 1: mfsr $p0, MR_CAC_CTL ! Get the $CACHE_CTL reg li $p1, DIS_DCAC and $p0, $p0, $p1 ! Clear the DC_EN bit mtsr $p0, MR_CAC_CTL ! Write back the $CACHE_CTL reg br $r0 ! Jump to the input address
4ms/stm32mp1-baremetal
7,616
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/nds32/cpu/n1213/ag101/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2011 Andes Technology Corporation * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com> * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com> */ .pic .text #include <common.h> #include <config.h> #include <asm/macro.h> #include <generated/asm-offsets.h> /* * parameters for the SDRAM controller */ #define SDMC_TP1_A (CONFIG_FTSDMC021_BASE + FTSDMC021_TP1) #define SDMC_TP2_A (CONFIG_FTSDMC021_BASE + FTSDMC021_TP2) #define SDMC_CR1_A (CONFIG_FTSDMC021_BASE + FTSDMC021_CR1) #define SDMC_CR2_A (CONFIG_FTSDMC021_BASE + FTSDMC021_CR2) #define SDMC_B0_BSR_A (CONFIG_FTSDMC021_BASE + FTSDMC021_BANK0_BSR) #define SDMC_B1_BSR_A (CONFIG_FTSDMC021_BASE + FTSDMC021_BANK1_BSR) #define SDMC_TP1_D CONFIG_SYS_FTSDMC021_TP1 #define SDMC_TP2_D CONFIG_SYS_FTSDMC021_TP2 #define SDMC_CR1_D CONFIG_SYS_FTSDMC021_CR1 #define SDMC_CR2_D CONFIG_SYS_FTSDMC021_CR2 #define SDMC_B0_BSR_D CONFIG_SYS_FTSDMC021_BANK0_BSR #define SDMC_B1_BSR_D CONFIG_SYS_FTSDMC021_BANK1_BSR /* * for Orca and Emerald */ #define BOARD_ID_REG 0x104 #define BOARD_ID_FAMILY_MASK 0xfff000 #define BOARD_ID_FAMILY_V5 0x556000 #define BOARD_ID_FAMILY_K7 0x74b000 /* * parameters for the static memory controller */ #define SMC_BANK0_CR_A (CONFIG_FTSMC020_BASE + FTSMC020_BANK0_CR) #define SMC_BANK0_TPR_A (CONFIG_FTSMC020_BASE + FTSMC020_BANK0_TPR) #define SMC_BANK0_CR_D FTSMC020_BANK0_LOWLV_CONFIG #define SMC_BANK0_TPR_D FTSMC020_BANK0_LOWLV_TIMING /* * parameters for the ahbc controller */ #define AHBC_CR_A (CONFIG_FTAHBC020S_BASE + FTAHBC020S_CR) #define AHBC_BSR6_A (CONFIG_FTAHBC020S_BASE + FTAHBC020S_SLAVE_BSR_6) /* * for Orca and Emerald */ #define AHBC_BSR4_A (CONFIG_FTAHBC020S_BASE + FTAHBC020S_SLAVE_BSR_4) #define AHBC_BSR6_D CONFIG_SYS_FTAHBC020S_SLAVE_BSR_6 /* * parameters for the pmu controoler */ #define PMU_PDLLCR0_A (CONFIG_FTPMU010_BASE + FTPMU010_PDLLCR0) /* * numeric 7 segment display */ .macro led, num write32 CONFIG_DEBUG_LED, \num .endm /* * Waiting for SDRAM to set up */ .macro wait_sdram li $r0, CONFIG_FTSDMC021_BASE 1: lwi $r1, [$r0+FTSDMC021_CR2] bnez $r1, 1b .endm .globl mem_init mem_init: move $r11, $lp /* * mem_init: * There are 2 bank connected to FTSMC020 on AG101 * BANK0: FLASH/ROM (SW5, J16), BANK1: OnBoard SDRAM. * we need to set onboard SDRAM before remap and relocation. */ led 0x01 /* * for Orca and Emerald * disable write protection and reset bank size */ li $r0, SMC_BANK0_CR_A lwi $r1, [$r0+#0x00] ori $r1, $r1, 0x8f0 xori $r1, $r1, 0x8f0 /* check board */ li $r3, CONFIG_FTPMU010_BASE + BOARD_ID_REG lwi $r3, [$r3] li $r4, BOARD_ID_FAMILY_MASK and $r3, $r3, $r4 li $r4, BOARD_ID_FAMILY_K7 xor $r4, $r3, $r4 beqz $r4, use_flash_16bit_boot /* 32-bit mode */ use_flash_32bit_boot: ori $r1, $r1, 0x50 li $r2, 0x00151151 j sdram_b0_cr /* 16-bit mode */ use_flash_16bit_boot: ori $r1, $r1, 0x60 li $r2, 0x00153153 /* SRAM bank0 config */ sdram_b0_cr: swi $r1, [$r0+#0x00] swi $r2, [$r0+#0x04] /* config AHB Controller */ led 0x02 /* * config PMU controller */ /* ftpmu010_dlldis_disable, must do it in lowleve_init */ led 0x03 setbf32 PMU_PDLLCR0_A, FTPMU010_PDLLCR0_DLLDIS ! 0x00010000 /* * config SDRAM controller */ led 0x04 write32 SDMC_TP1_A, SDMC_TP1_D ! 0x00011312 led 0x05 write32 SDMC_TP2_A, SDMC_TP2_D ! 0x00480180 led 0x06 write32 SDMC_CR1_A, SDMC_CR1_D ! 0x00002326 led 0x07 write32 SDMC_CR2_A, FTSDMC021_CR2_IPREC ! 0x00000010 wait_sdram led 0x08 write32 SDMC_CR2_A, FTSDMC021_CR2_ISMR ! 0x00000004 wait_sdram led 0x09 write32 SDMC_CR2_A, FTSDMC021_CR2_IREF ! 0x00000008 wait_sdram led 0x0a move $lp, $r11 ret #ifndef CONFIG_SKIP_LOWLEVEL_INIT .globl lowlevel_init lowlevel_init: move $r10, $lp led 0x10 jal remap #if (defined(NDS32_EXT_FPU_DP) || defined(NDS32_EXT_FPU_SP)) led 0x1f jal enable_fpu #endif led 0x20 ret $r10 remap: move $r11, $lp #ifdef __NDS32_N1213_43U1H__ /* NDS32 V0 ISA - AG101 Only */ bal 2f relo_base: move $r0, $lp #else relo_base: mfusr $r0, $pc #endif /* __NDS32_N1213_43U1H__ */ /* Remapping */ led 0x1a write32 SDMC_B0_BSR_A, SDMC_B0_BSR_D ! 0x00001800 write32 SDMC_B1_BSR_A, SDMC_B1_BSR_D ! 0x00001880 /* clear empty BSR registers */ led 0x1b li $r4, CONFIG_FTSDMC021_BASE li $r5, 0x0 swi $r5, [$r4 + FTSDMC021_BANK2_BSR] swi $r5, [$r4 + FTSDMC021_BANK3_BSR] #ifdef CONFIG_MEM_REMAP /* * Copy ROM code to SDRAM base for memory remap layout. * This is not the real relocation, the real relocation is the function * relocate_code() is start.S which supports the systems is memory * remapped or not. */ /* * Doing memory remap is essential for preparing some non-OS or RTOS * applications. * * This is also a must on ADP-AG101 board. * The reason is because the ROM/FLASH circuit on PCB board. * AG101-A0 board has 2 jumpers MA17 and SW5 to configure which * ROM/FLASH is used to boot. * * When SW5 = "0101", MA17 = LO, the ROM is connected to BANK0, * and the FLASH is connected to BANK1. * When SW5 = "1010", MA17 = HI, the ROM is disabled (still at BANK0), * and the FLASH is connected to BANK0. * It will occur problem when doing flash probing if the flash is at * BANK0 (0x00000000) while memory remapping was skipped. * * Other board like ADP-AG101P may not enable this since there is only * a FLASH connected to bank0. */ led 0x11 /* * for Orca and Emerald * read sdram base address automatically */ li $r5, AHBC_BSR6_A lwi $r8, [$r5] li $r4, 0xfff00000 /* r4 = bank6 base */ and $r4, $r4, $r8 la $r5, _start@GOTOFF la $r6, _end@GOTOFF 1: lwi.p $r7, [$r5], #4 swi.p $r7, [$r4], #4 blt $r5, $r6, 1b /* set remap bit */ /* * MEM remap bit is operational * - use it to map writeable memory at 0x00000000, in place of flash * - before remap: flash/rom 0x00000000, sdram: 0x10000000-0x4fffffff * - after remap: flash/rom 0x80000000, sdram: 0x00000000 */ led 0x1c write32 SDMC_B0_BSR_A, 0x00001000 write32 SDMC_B1_BSR_A, 0x00001200 li $r5, CONFIG_SYS_TEXT_BASE /* flash base address */ add $r11, $r11, $r5 /* add flash address offset for ret */ add $r10, $r10, $r5 move $lp, $r11 setbf15 AHBC_CR_A, FTAHBC020S_CR_REMAP ! 0x1 /* * for Orca and Emerald * extend sdram size from 256MB to 2GB */ li $r5, AHBC_BSR6_A lwi $r6, [$r5] li $r4, 0xfff0ffff and $r6 ,$r4, $r6 li $r4, 0x000b0000 or $r6, $r4, $r6 swi $r6, [$r5] /* * for Orca and Emerald * extend rom base from 256MB to 2GB */ li $r4, AHBC_BSR4_A lwi $r5, [$r4] li $r6, 0xffffff and $r5, $r5, $r6 li $r6, 0x80000000 or $r5, $r5, $r6 swi $r5, [$r4] #endif /* #ifdef CONFIG_MEM_REMAP */ move $lp, $r11 2: ret /* * enable_fpu: * Some of Andes CPU version support FPU coprocessor, if so, * and toolchain support FPU instruction set, we should enable it. */ #if (defined(NDS32_EXT_FPU_DP) || defined(NDS32_EXT_FPU_SP)) enable_fpu: mfsr $r0, $CPU_VER /* enable FPU if it exists */ srli $r0, $r0, 3 andi $r0, $r0, 1 beqz $r0, 1f /* skip if no COP */ mfsr $r0, $FUCOP_EXIST srli $r0, $r0, 31 beqz $r0, 1f /* skip if no FPU */ mfsr $r0, $FUCOP_CTL ori $r0, $r0, 1 mtsr $r0, $FUCOP_CTL 1: ret #endif .globl show_led show_led: li $r8, (CONFIG_DEBUG_LED) swi $r7, [$r8] ret #endif /* #ifndef CONFIG_SKIP_LOWLEVEL_INIT */
4ms/stm32mp1-baremetal
3,377
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/nds32/cpu/n1213/ae3xx/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2011 Andes Technology Corporation * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com> * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com> */ .pic .text #include <common.h> #include <config.h> #include <asm/macro.h> #include <generated/asm-offsets.h> /* * parameters for the SDRAM controller */ #define SDMC_TP1_A (CONFIG_FTSDMC021_BASE + FTSDMC021_TP1) #define SDMC_TP2_A (CONFIG_FTSDMC021_BASE + FTSDMC021_TP2) #define SDMC_CR1_A (CONFIG_FTSDMC021_BASE + FTSDMC021_CR1) #define SDMC_CR2_A (CONFIG_FTSDMC021_BASE + FTSDMC021_CR2) #define SDMC_B0_BSR_A (CONFIG_FTSDMC021_BASE + FTSDMC021_BANK0_BSR) #define SDMC_B1_BSR_A (CONFIG_FTSDMC021_BASE + FTSDMC021_BANK1_BSR) #define SDMC_TP1_D CONFIG_SYS_FTSDMC021_TP1 #define SDMC_TP2_D CONFIG_SYS_FTSDMC021_TP2 #define SDMC_CR1_D CONFIG_SYS_FTSDMC021_CR1 #define SDMC_CR2_D CONFIG_SYS_FTSDMC021_CR2 #define SDMC_B0_BSR_D CONFIG_SYS_FTSDMC021_BANK0_BSR #define SDMC_B1_BSR_D CONFIG_SYS_FTSDMC021_BANK1_BSR /* * for Orca and Emerald */ #define BOARD_ID_REG 0x104 #define BOARD_ID_FAMILY_MASK 0xfff000 #define BOARD_ID_FAMILY_V5 0x556000 #define BOARD_ID_FAMILY_K7 0x74b000 /* * parameters for the static memory controller */ #define SMC_BANK0_CR_A (CONFIG_FTSMC020_BASE + FTSMC020_BANK0_CR) #define SMC_BANK0_TPR_A (CONFIG_FTSMC020_BASE + FTSMC020_BANK0_TPR) #define SMC_BANK0_CR_D FTSMC020_BANK0_LOWLV_CONFIG #define SMC_BANK0_TPR_D FTSMC020_BANK0_LOWLV_TIMING /* * for Orca and Emerald */ #define AHBC_BSR4_A (CONFIG_FTAHBC020S_BASE + FTAHBC020S_SLAVE_BSR_4) #define AHBC_BSR6_D CONFIG_SYS_FTAHBC020S_SLAVE_BSR_6 /* * parameters for the pmu controoler */ #define PMU_PDLLCR0_A (CONFIG_FTPMU010_BASE + FTPMU010_PDLLCR0) /* * numeric 7 segment display */ .macro led, num write32 CONFIG_DEBUG_LED, \num .endm /* * Waiting for SDRAM to set up */ .macro wait_sdram li $r0, CONFIG_FTSDMC021_BASE 1: lwi $r1, [$r0+FTSDMC021_CR2] bnez $r1, 1b .endm .globl mem_init mem_init: move $r11, $lp li $r0, SMC_BANK0_CR_A lwi $r1, [$r0+#0x00] ori $r1, $r1, 0x8f0 xori $r1, $r1, 0x8f0 /* 16-bit mode */ ori $r1, $r1, 0x60 li $r2, 0x00153153 swi $r1, [$r0+#0x00] swi $r2, [$r0+#0x04] move $lp, $r11 ret #ifndef CONFIG_SKIP_LOWLEVEL_INIT .globl lowlevel_init lowlevel_init: move $r10, $lp jal remap #if (defined(NDS32_EXT_FPU_DP) || defined(NDS32_EXT_FPU_SP)) jal enable_fpu #endif ret $r10 remap: move $r11, $lp relo_base: mfusr $r0, $pc #ifdef CONFIG_MEM_REMAP li $r4, 0x00000000 li $r5, 0x80000000 la $r6, _end@GOTOFF 1: lmw.bim $r12, [$r5], $r19 smw.bim $r12, [$r4], $r19 blt $r5, $r6, 1b #endif /* #ifdef CONFIG_MEM_REMAP */ move $lp, $r11 2: ret /* * enable_fpu: * Some of Andes CPU version support FPU coprocessor, if so, * and toolchain support FPU instruction set, we should enable it. */ #if (defined(NDS32_EXT_FPU_DP) || defined(NDS32_EXT_FPU_SP)) enable_fpu: mfsr $r0, $CPU_VER /* enable FPU if it exists */ srli $r0, $r0, 3 andi $r0, $r0, 1 beqz $r0, 1f /* skip if no COP */ mfsr $r0, $FUCOP_EXIST srli $r0, $r0, 31 beqz $r0, 1f /* skip if no FPU */ mfsr $r0, $FUCOP_CTL ori $r0, $r0, 1 mtsr $r0, $FUCOP_CTL 1: ret #endif #endif /* #ifndef CONFIG_SKIP_LOWLEVEL_INIT */
4ms/stm32mp1-baremetal
2,919
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/arc/lib/ints_low.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2013-2015 Synopsys, Inc. All rights reserved. */ #include <linux/linkage.h> /* * Note on the LD/ST addressing modes with address register write-back * * LD.a same as LD.aw * * LD.a reg1, [reg2, x] => Pre Incr * Eff Addr for load = [reg2 + x] * * LD.ab reg1, [reg2, x] => Post Incr * Eff Addr for load = [reg2] */ .macro PUSH reg st.a \reg, [%sp, -4] .endm .macro PUSHAX aux lr %r9, [\aux] PUSH %r9 .endm .macro SAVE_R1_TO_R24 PUSH %r1 PUSH %r2 PUSH %r3 PUSH %r4 PUSH %r5 PUSH %r6 PUSH %r7 PUSH %r8 PUSH %r9 PUSH %r10 PUSH %r11 PUSH %r12 PUSH %r13 PUSH %r14 PUSH %r15 PUSH %r16 PUSH %r17 PUSH %r18 PUSH %r19 PUSH %r20 PUSH %r21 PUSH %r22 PUSH %r23 PUSH %r24 .endm .macro SAVE_ALL_SYS /* saving %r0 to reg->r0 in advance since we read %ecr into it */ st %r0, [%sp, -8] lr %r0, [%ecr] /* all stack addressing is manual so far */ st %r0, [%sp] st %sp, [%sp, -4] /* now move %sp to reg->r0 position so we can do "push" automatically */ sub %sp, %sp, 8 SAVE_R1_TO_R24 PUSH %r25 PUSH %gp PUSH %fp PUSH %blink PUSHAX %eret PUSHAX %erstatus PUSH %lp_count PUSHAX %lp_end PUSHAX %lp_start PUSHAX %erbta .endm .macro SAVE_EXCEPTION_SOURCE #ifdef CONFIG_MMU /* If MMU exists exception faulting address is loaded in EFA reg */ lr %r0, [%efa] #else /* Otherwise in ERET (exception return) reg */ lr %r0, [%eret] #endif .endm ENTRY(memory_error) SAVE_ALL_SYS SAVE_EXCEPTION_SOURCE mov %r1, %sp j do_memory_error ENDPROC(memory_error) ENTRY(instruction_error) SAVE_ALL_SYS SAVE_EXCEPTION_SOURCE mov %r1, %sp j do_instruction_error ENDPROC(instruction_error) ENTRY(interrupt_handler) /* Todo - save and restore CPU context when interrupts will be in use */ bl do_interrupt_handler rtie ENDPROC(interrupt_handler) ENTRY(EV_MachineCheck) SAVE_ALL_SYS SAVE_EXCEPTION_SOURCE mov %r1, %sp j do_machine_check_fault ENDPROC(EV_MachineCheck) ENTRY(EV_TLBMissI) SAVE_ALL_SYS mov %r0, %sp j do_itlb_miss ENDPROC(EV_TLBMissI) ENTRY(EV_TLBMissD) SAVE_ALL_SYS mov %r0, %sp j do_dtlb_miss ENDPROC(EV_TLBMissD) ENTRY(EV_TLBProtV) SAVE_ALL_SYS SAVE_EXCEPTION_SOURCE mov %r1, %sp j do_tlb_prot_violation ENDPROC(EV_TLBProtV) ENTRY(EV_PrivilegeV) SAVE_ALL_SYS mov %r0, %sp j do_privilege_violation ENDPROC(EV_PrivilegeV) ENTRY(EV_Trap) SAVE_ALL_SYS mov %r0, %sp j do_trap ENDPROC(EV_Trap) ENTRY(EV_Extension) SAVE_ALL_SYS mov %r0, %sp j do_extension ENDPROC(EV_Extension) #ifdef CONFIG_ISA_ARCV2 ENTRY(EV_SWI) SAVE_ALL_SYS mov %r0, %sp j do_swi ENDPROC(EV_SWI) ENTRY(EV_DivZero) SAVE_ALL_SYS SAVE_EXCEPTION_SOURCE mov %r1, %sp j do_divzero ENDPROC(EV_DivZero) ENTRY(EV_DCError) SAVE_ALL_SYS mov %r0, %sp j do_dcerror ENDPROC(EV_DCError) ENTRY(EV_Maligned) SAVE_ALL_SYS SAVE_EXCEPTION_SOURCE mov %r1, %sp j do_maligned ENDPROC(EV_Maligned) #endif
4ms/stm32mp1-baremetal
3,038
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/arc/lib/start.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved. */ #include <asm-offsets.h> #include <config.h> #include <linux/linkage.h> #include <asm/arcregs.h> ENTRY(_start) /* Setup interrupt vector base that matches "__text_start" */ sr __ivt_start, [ARC_AUX_INTR_VEC_BASE] ; Disable/enable I-cache according to configuration lr r5, [ARC_BCR_IC_BUILD] breq r5, 0, 1f ; I$ doesn't exist lr r5, [ARC_AUX_IC_CTRL] #if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF) bclr r5, r5, 0 ; 0 - Enable, 1 is Disable #else bset r5, r5, 0 ; I$ exists, but is not used #endif sr r5, [ARC_AUX_IC_CTRL] mov r5, 1 sr r5, [ARC_AUX_IC_IVIC] ; As per ARC HS databook (see chapter 5.3.3.2) ; it is required to add 3 NOPs after each write to IC_IVIC. nop nop nop 1: ; Disable/enable D-cache according to configuration lr r5, [ARC_BCR_DC_BUILD] breq r5, 0, 1f ; D$ doesn't exist lr r5, [ARC_AUX_DC_CTRL] bclr r5, r5, 6 ; Invalidate (discard w/o wback) #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) bclr r5, r5, 0 ; Enable (+Inv) #else bset r5, r5, 0 ; Disable (+Inv) #endif sr r5, [ARC_AUX_DC_CTRL] mov r5, 1 sr r5, [ARC_AUX_DC_IVDC] 1: #ifdef CONFIG_ISA_ARCV2 ; Disable System-Level Cache (SLC) lr r5, [ARC_BCR_SLC] breq r5, 0, 1f ; SLC doesn't exist lr r5, [ARC_AUX_SLC_CTRL] bclr r5, r5, 6 ; Invalidate (discard w/o wback) bclr r5, r5, 0 ; Enable (+Inv) sr r5, [ARC_AUX_SLC_CTRL] 1: #endif #ifdef __ARC_UNALIGNED__ /* * Enable handling of unaligned access in the CPU as by default * this HW feature is disabled while GCC starting from 8.1.0 * unconditionally uses it for ARC HS cores. */ flag 1 << STATUS_AD_BIT #endif /* Establish C runtime stack and frame */ mov %sp, CONFIG_SYS_INIT_SP_ADDR mov %fp, %sp /* Allocate reserved area from current top of stack */ mov %r0, %sp bl board_init_f_alloc_reserve /* Set stack below reserved area, adjust frame pointer accordingly */ mov %sp, %r0 mov %fp, %sp /* Initialize reserved area - note: r0 already contains address */ bl board_init_f_init_reserve #ifdef CONFIG_DEBUG_UART /* Earliest point to set up early debug uart */ bl debug_uart_init #endif /* Zero the one and only argument of "board_init_f" */ mov_s %r0, 0 bl board_init_f /* We only get here if relocation is disabled by GD_FLG_SKIP_RELOC */ /* Make sure we don't lose GD overwritten by zero new GD */ mov %r0, %r25 mov %r1, 0 bl board_init_r ENDPROC(_start) /* * void board_init_f_r_trampoline(stack-pointer address) * * This "function" does not return, instead it continues in RAM * after relocating the monitor code. * * r0 = new stack-pointer */ ENTRY(board_init_f_r_trampoline) /* Set up the stack- and frame-pointers */ mov %sp, %r0 mov %fp, %sp /* Update position of intterupt vector table */ lr %r0, [ARC_AUX_INTR_VEC_BASE] ld %r1, [%r25, GD_RELOC_OFF] add %r0, %r0, %r1 sr %r0, [ARC_AUX_INTR_VEC_BASE] /* Re-enter U-Boot by calling board_init_f_r */ j board_init_f_r ENDPROC(board_init_f_r_trampoline)
4ms/stm32mp1-baremetal
5,541
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/arc/lib/_millicodethunk.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 1995, 1997, 2007-2013 Free Software Foundation, Inc. */ /* ANSI concatenation macros. */ #define CONCAT1(a, b) CONCAT2(a, b) #define CONCAT2(a, b) a ## b /* Use the right prefix for global labels. */ #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) #ifndef WORKING_ASSEMBLER #define abs_l abs #define asl_l asl #define mov_l mov #endif #define FUNC(X) .type SYM(X),@function #define HIDDEN_FUNC(X) FUNC(X)` .hidden X #define ENDFUNC0(X) .Lfe_##X: .size X,.Lfe_##X-X #define ENDFUNC(X) ENDFUNC0(X) .section .text .align 4 .global SYM(__st_r13_to_r15) .global SYM(__st_r13_to_r16) .global SYM(__st_r13_to_r17) .global SYM(__st_r13_to_r18) .global SYM(__st_r13_to_r19) .global SYM(__st_r13_to_r20) .global SYM(__st_r13_to_r21) .global SYM(__st_r13_to_r22) .global SYM(__st_r13_to_r23) .global SYM(__st_r13_to_r24) .global SYM(__st_r13_to_r25) HIDDEN_FUNC(__st_r13_to_r15) HIDDEN_FUNC(__st_r13_to_r16) HIDDEN_FUNC(__st_r13_to_r17) HIDDEN_FUNC(__st_r13_to_r18) HIDDEN_FUNC(__st_r13_to_r19) HIDDEN_FUNC(__st_r13_to_r20) HIDDEN_FUNC(__st_r13_to_r21) HIDDEN_FUNC(__st_r13_to_r22) HIDDEN_FUNC(__st_r13_to_r23) HIDDEN_FUNC(__st_r13_to_r24) HIDDEN_FUNC(__st_r13_to_r25) .align 4 SYM(__st_r13_to_r25): st r25, [sp,48] SYM(__st_r13_to_r24): st r24, [sp,44] SYM(__st_r13_to_r23): st r23, [sp,40] SYM(__st_r13_to_r22): st r22, [sp,36] SYM(__st_r13_to_r21): st r21, [sp,32] SYM(__st_r13_to_r20): st r20, [sp,28] SYM(__st_r13_to_r19): st r19, [sp,24] SYM(__st_r13_to_r18): st r18, [sp,20] SYM(__st_r13_to_r17): st r17, [sp,16] SYM(__st_r13_to_r16): st r16, [sp,12] SYM(__st_r13_to_r15): #ifdef __ARC700__ st r15, [sp,8] ; minimum function size to avoid stall: 6 bytes. #else st_s r15, [sp,8] #endif st_s r14, [sp,4] j_s.d [%blink] st_s r13, [sp,0] ENDFUNC(__st_r13_to_r15) ENDFUNC(__st_r13_to_r16) ENDFUNC(__st_r13_to_r17) ENDFUNC(__st_r13_to_r18) ENDFUNC(__st_r13_to_r19) ENDFUNC(__st_r13_to_r20) ENDFUNC(__st_r13_to_r21) ENDFUNC(__st_r13_to_r22) ENDFUNC(__st_r13_to_r23) ENDFUNC(__st_r13_to_r24) ENDFUNC(__st_r13_to_r25) .section .text .align 4 ; ================================== ; the loads .global SYM(__ld_r13_to_r15) .global SYM(__ld_r13_to_r16) .global SYM(__ld_r13_to_r17) .global SYM(__ld_r13_to_r18) .global SYM(__ld_r13_to_r19) .global SYM(__ld_r13_to_r20) .global SYM(__ld_r13_to_r21) .global SYM(__ld_r13_to_r22) .global SYM(__ld_r13_to_r23) .global SYM(__ld_r13_to_r24) .global SYM(__ld_r13_to_r25) HIDDEN_FUNC(__ld_r13_to_r15) HIDDEN_FUNC(__ld_r13_to_r16) HIDDEN_FUNC(__ld_r13_to_r17) HIDDEN_FUNC(__ld_r13_to_r18) HIDDEN_FUNC(__ld_r13_to_r19) HIDDEN_FUNC(__ld_r13_to_r20) HIDDEN_FUNC(__ld_r13_to_r21) HIDDEN_FUNC(__ld_r13_to_r22) HIDDEN_FUNC(__ld_r13_to_r23) HIDDEN_FUNC(__ld_r13_to_r24) HIDDEN_FUNC(__ld_r13_to_r25) SYM(__ld_r13_to_r25): ld r25, [sp,48] SYM(__ld_r13_to_r24): ld r24, [sp,44] SYM(__ld_r13_to_r23): ld r23, [sp,40] SYM(__ld_r13_to_r22): ld r22, [sp,36] SYM(__ld_r13_to_r21): ld r21, [sp,32] SYM(__ld_r13_to_r20): ld r20, [sp,28] SYM(__ld_r13_to_r19): ld r19, [sp,24] SYM(__ld_r13_to_r18): ld r18, [sp,20] SYM(__ld_r13_to_r17): ld r17, [sp,16] SYM(__ld_r13_to_r16): ld r16, [sp,12] SYM(__ld_r13_to_r15): #ifdef __ARC700__ ld r15, [sp,8] ; minimum function size to avoid stall: 6 bytes. #else ld_s r15, [sp,8] #endif ld_s r14, [sp,4] j_s.d [%blink] ld_s r13, [sp,0] ENDFUNC(__ld_r13_to_r15) ENDFUNC(__ld_r13_to_r16) ENDFUNC(__ld_r13_to_r17) ENDFUNC(__ld_r13_to_r18) ENDFUNC(__ld_r13_to_r19) ENDFUNC(__ld_r13_to_r20) ENDFUNC(__ld_r13_to_r21) ENDFUNC(__ld_r13_to_r22) ENDFUNC(__ld_r13_to_r23) ENDFUNC(__ld_r13_to_r24) ENDFUNC(__ld_r13_to_r25) .global SYM(__ld_r13_to_r14_ret) .global SYM(__ld_r13_to_r15_ret) .global SYM(__ld_r13_to_r16_ret) .global SYM(__ld_r13_to_r17_ret) .global SYM(__ld_r13_to_r18_ret) .global SYM(__ld_r13_to_r19_ret) .global SYM(__ld_r13_to_r20_ret) .global SYM(__ld_r13_to_r21_ret) .global SYM(__ld_r13_to_r22_ret) .global SYM(__ld_r13_to_r23_ret) .global SYM(__ld_r13_to_r24_ret) .global SYM(__ld_r13_to_r25_ret) HIDDEN_FUNC(__ld_r13_to_r14_ret) HIDDEN_FUNC(__ld_r13_to_r15_ret) HIDDEN_FUNC(__ld_r13_to_r16_ret) HIDDEN_FUNC(__ld_r13_to_r17_ret) HIDDEN_FUNC(__ld_r13_to_r18_ret) HIDDEN_FUNC(__ld_r13_to_r19_ret) HIDDEN_FUNC(__ld_r13_to_r20_ret) HIDDEN_FUNC(__ld_r13_to_r21_ret) HIDDEN_FUNC(__ld_r13_to_r22_ret) HIDDEN_FUNC(__ld_r13_to_r23_ret) HIDDEN_FUNC(__ld_r13_to_r24_ret) HIDDEN_FUNC(__ld_r13_to_r25_ret) .section .text .align 4 SYM(__ld_r13_to_r25_ret): ld r25, [sp,48] SYM(__ld_r13_to_r24_ret): ld r24, [sp,44] SYM(__ld_r13_to_r23_ret): ld r23, [sp,40] SYM(__ld_r13_to_r22_ret): ld r22, [sp,36] SYM(__ld_r13_to_r21_ret): ld r21, [sp,32] SYM(__ld_r13_to_r20_ret): ld r20, [sp,28] SYM(__ld_r13_to_r19_ret): ld r19, [sp,24] SYM(__ld_r13_to_r18_ret): ld r18, [sp,20] SYM(__ld_r13_to_r17_ret): ld r17, [sp,16] SYM(__ld_r13_to_r16_ret): ld r16, [sp,12] SYM(__ld_r13_to_r15_ret): ld r15, [sp,8] SYM(__ld_r13_to_r14_ret): ld blink,[sp,r12] ld_s r14, [sp,4] ld.ab r13, [sp,r12] j_s.d [%blink] add_s sp,sp,4 ENDFUNC(__ld_r13_to_r14_ret) ENDFUNC(__ld_r13_to_r15_ret) ENDFUNC(__ld_r13_to_r16_ret) ENDFUNC(__ld_r13_to_r17_ret) ENDFUNC(__ld_r13_to_r18_ret) ENDFUNC(__ld_r13_to_r19_ret) ENDFUNC(__ld_r13_to_r20_ret) ENDFUNC(__ld_r13_to_r21_ret) ENDFUNC(__ld_r13_to_r22_ret) ENDFUNC(__ld_r13_to_r23_ret) ENDFUNC(__ld_r13_to_r24_ret) ENDFUNC(__ld_r13_to_r25_ret)
4ms/stm32mp1-baremetal
1,067
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/arc/cpu/arcv2/ivt.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2013-2015 Synopsys, Inc. All rights reserved. */ .section .ivt, "a",@progbits .align 4 /* Critical system events */ .word _start /* 0x00 - Reset */ .word memory_error /* 0x01 - Memory Error */ .word instruction_error /* 0x02 - Instruction Error */ /* Exceptions */ .word EV_MachineCheck /* 0x03 - Fatal Machine check */ .word EV_TLBMissI /* 0x04 - Intruction TLB miss */ .word EV_TLBMissD /* 0x05 - Data TLB miss */ .word EV_TLBProtV /* 0x06 - Protection Violation or Misaligned Access */ .word EV_PrivilegeV /* 0x07 - Privilege Violation */ .word EV_SWI /* 0x08 - Software Interrupt */ .word EV_Trap /* 0x09 - Trap */ .word EV_Extension /* 0x0A - Extension Intruction Exception */ .word EV_DivZero /* 0x0B - Division by Zero */ .word EV_DCError /* 0x0C - Data cache consistency error */ .word EV_Maligned /* 0x0D - Misaligned data access */ .word 0 /* 0x0E - Unused */ .word 0 /* 0x0F - Unused */ /* Device interrupts */ .rept 240 .word interrupt_handler /* 0x10 - 0xFF */ .endr
4ms/stm32mp1-baremetal
1,227
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/riscv/lib/setjmp.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) 2018 Alexander Graf <agraf@suse.de> */ #include <config.h> #include <linux/linkage.h> #ifdef CONFIG_ARCH_RV64I #define STORE_IDX(reg, idx) sd reg, (idx*8)(a0) #define LOAD_IDX(reg, idx) ld reg, (idx*8)(a0) #else #define STORE_IDX(reg, idx) sw reg, (idx*4)(a0) #define LOAD_IDX(reg, idx) lw reg, (idx*4)(a0) #endif .pushsection .text.setjmp, "ax" ENTRY(setjmp) /* Preserve all callee-saved registers and the SP */ STORE_IDX(s0, 0) STORE_IDX(s1, 1) STORE_IDX(s2, 2) STORE_IDX(s3, 3) STORE_IDX(s4, 4) STORE_IDX(s5, 5) STORE_IDX(s6, 6) STORE_IDX(s7, 7) STORE_IDX(s8, 8) STORE_IDX(s9, 9) STORE_IDX(s10, 10) STORE_IDX(s11, 11) STORE_IDX(ra, 12) STORE_IDX(sp, 13) li a0, 0 ret ENDPROC(setjmp) .popsection .pushsection .text.longjmp, "ax" ENTRY(longjmp) LOAD_IDX(s0, 0) LOAD_IDX(s1, 1) LOAD_IDX(s2, 2) LOAD_IDX(s3, 3) LOAD_IDX(s4, 4) LOAD_IDX(s5, 5) LOAD_IDX(s6, 6) LOAD_IDX(s7, 7) LOAD_IDX(s8, 8) LOAD_IDX(s9, 9) LOAD_IDX(s10, 10) LOAD_IDX(s11, 11) LOAD_IDX(ra, 12) LOAD_IDX(sp, 13) /* Move the return value in place, but return 1 if passed 0. */ beq a1, zero, longjmp_1 mv a0, a1 ret longjmp_1: li a0, 1 ret ENDPROC(longjmp) .popsection
4ms/stm32mp1-baremetal
4,349
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/riscv/lib/crt0_riscv_efi.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * crt0-efi-riscv.S - PE/COFF header for RISC-V EFI applications * * Copright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org> * Copright (C) 2018 Alexander Graf <agraf@suse.de> * * This file is inspired by arch/arm/lib/crt0_aarch64_efi.S */ #include <asm-generic/pe.h> #if __riscv_xlen == 64 #define SIZE_LONG 8 #define SAVE_LONG(reg, idx) sd reg, (idx*SIZE_LONG)(sp) #define LOAD_LONG(reg, idx) ld reg, (idx*SIZE_LONG)(sp) #define PE_MACHINE IMAGE_FILE_MACHINE_RISCV64 #else #define SIZE_LONG 4 #define SAVE_LONG(reg, idx) sw reg, (idx*SIZE_LONG)(sp) #define LOAD_LONG(reg, idx) lw reg, (idx*SIZE_LONG)(sp) #define PE_MACHINE IMAGE_FILE_MACHINE_RISCV32 #endif .section .text.head /* * Magic "MZ" signature for PE/COFF */ .globl ImageBase ImageBase: .short IMAGE_DOS_SIGNATURE /* 'MZ' */ .skip 58 /* 'MZ' + pad + offset == 64 */ .long pe_header - ImageBase /* Offset to the PE header */ pe_header: .long IMAGE_NT_SIGNATURE /* 'PE' */ coff_header: .short PE_MACHINE /* RISC-V 64/32-bit */ .short 2 /* nr_sections */ .long 0 /* TimeDateStamp */ .long 0 /* PointerToSymbolTable */ .long 0 /* NumberOfSymbols */ .short section_table - optional_header /* SizeOfOptionalHeader */ /* Characteristics */ .short (IMAGE_FILE_EXECUTABLE_IMAGE | \ IMAGE_FILE_LINE_NUMS_STRIPPED | \ IMAGE_FILE_LOCAL_SYMS_STRIPPED | \ IMAGE_FILE_DEBUG_STRIPPED) optional_header: .short IMAGE_NT_OPTIONAL_HDR64_MAGIC /* PE32+ format */ .byte 0x02 /* MajorLinkerVersion */ .byte 0x14 /* MinorLinkerVersion */ .long _edata - _start /* SizeOfCode */ .long 0 /* SizeOfInitializedData */ .long 0 /* SizeOfUninitializedData */ .long _start - ImageBase /* AddressOfEntryPoint */ .long _start - ImageBase /* BaseOfCode */ extra_header_fields: .quad 0 /* ImageBase */ .long 0x20 /* SectionAlignment */ .long 0x8 /* FileAlignment */ .short 0 /* MajorOperatingSystemVersion */ .short 0 /* MinorOperatingSystemVersion */ .short 0 /* MajorImageVersion */ .short 0 /* MinorImageVersion */ .short 0 /* MajorSubsystemVersion */ .short 0 /* MinorSubsystemVersion */ .long 0 /* Win32VersionValue */ .long _edata - ImageBase /* SizeOfImage */ /* * Everything before the kernel image is considered part of the header */ .long _start - ImageBase /* SizeOfHeaders */ .long 0 /* CheckSum */ .short IMAGE_SUBSYSTEM_EFI_APPLICATION /* Subsystem */ .short 0 /* DllCharacteristics */ .quad 0 /* SizeOfStackReserve */ .quad 0 /* SizeOfStackCommit */ .quad 0 /* SizeOfHeapReserve */ .quad 0 /* SizeOfHeapCommit */ .long 0 /* LoaderFlags */ .long 0x6 /* NumberOfRvaAndSizes */ .quad 0 /* ExportTable */ .quad 0 /* ImportTable */ .quad 0 /* ResourceTable */ .quad 0 /* ExceptionTable */ .quad 0 /* CertificationTable */ .quad 0 /* BaseRelocationTable */ /* Section table */ section_table: /* * The EFI application loader requires a relocation section * because EFI applications must be relocatable. This is a * dummy section as far as we are concerned. */ .ascii ".reloc" .byte 0 .byte 0 /* end of 0 padding of section name */ .long 0 .long 0 .long 0 /* SizeOfRawData */ .long 0 /* PointerToRawData */ .long 0 /* PointerToRelocations */ .long 0 /* PointerToLineNumbers */ .short 0 /* NumberOfRelocations */ .short 0 /* NumberOfLineNumbers */ .long 0x42100040 /* Characteristics (section flags) */ .ascii ".text" .byte 0 .byte 0 .byte 0 /* end of 0 padding of section name */ .long _edata - _start /* VirtualSize */ .long _start - ImageBase /* VirtualAddress */ .long _edata - _start /* SizeOfRawData */ .long _start - ImageBase /* PointerToRawData */ .long 0 /* PointerToRelocations (0 for executables) */ .long 0 /* PointerToLineNumbers (0 for executables) */ .short 0 /* NumberOfRelocations (0 for executables) */ .short 0 /* NumberOfLineNumbers (0 for executables) */ .long 0xe0500020 /* Characteristics (section flags) */ _start: addi sp, sp, -(SIZE_LONG * 3) SAVE_LONG(a0, 0) SAVE_LONG(a1, 1) SAVE_LONG(ra, 2) lla a0, ImageBase lla a1, _DYNAMIC call _relocate bne a0, zero, 0f LOAD_LONG(a1, 1) LOAD_LONG(a0, 0) call efi_main LOAD_LONG(ra, 2) 0: addi sp, sp, (SIZE_LONG * 3) ret
4ms/stm32mp1-baremetal
2,624
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/riscv/cpu/mtrap.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * M-mode Trap Handler Code for RISC-V Core * * Copyright (c) 2017 Microsemi Corporation. * Copyright (c) 2017 Padmarao Begari <Padmarao.Begari@microsemi.com> * * Copyright (C) 2017 Andes Technology Corporation * Rick Chen, Andes Technology Corporation <rick@andestech.com> * * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com> */ #include <common.h> #include <asm/encoding.h> #ifdef CONFIG_32BIT #define LREG lw #define SREG sw #define REGBYTES 4 #else #define LREG ld #define SREG sd #define REGBYTES 8 #endif .text /* trap entry */ .align 2 .global trap_entry trap_entry: addi sp, sp, -32 * REGBYTES SREG x1, 1 * REGBYTES(sp) SREG x2, 2 * REGBYTES(sp) SREG x3, 3 * REGBYTES(sp) SREG x4, 4 * REGBYTES(sp) SREG x5, 5 * REGBYTES(sp) SREG x6, 6 * REGBYTES(sp) SREG x7, 7 * REGBYTES(sp) SREG x8, 8 * REGBYTES(sp) SREG x9, 9 * REGBYTES(sp) SREG x10, 10 * REGBYTES(sp) SREG x11, 11 * REGBYTES(sp) SREG x12, 12 * REGBYTES(sp) SREG x13, 13 * REGBYTES(sp) SREG x14, 14 * REGBYTES(sp) SREG x15, 15 * REGBYTES(sp) SREG x16, 16 * REGBYTES(sp) SREG x17, 17 * REGBYTES(sp) SREG x18, 18 * REGBYTES(sp) SREG x19, 19 * REGBYTES(sp) SREG x20, 20 * REGBYTES(sp) SREG x21, 21 * REGBYTES(sp) SREG x22, 22 * REGBYTES(sp) SREG x23, 23 * REGBYTES(sp) SREG x24, 24 * REGBYTES(sp) SREG x25, 25 * REGBYTES(sp) SREG x26, 26 * REGBYTES(sp) SREG x27, 27 * REGBYTES(sp) SREG x28, 28 * REGBYTES(sp) SREG x29, 29 * REGBYTES(sp) SREG x30, 30 * REGBYTES(sp) SREG x31, 31 * REGBYTES(sp) csrr a0, MODE_PREFIX(cause) csrr a1, MODE_PREFIX(epc) mv a2, sp jal handle_trap csrw MODE_PREFIX(epc), a0 LREG x1, 1 * REGBYTES(sp) LREG x3, 3 * REGBYTES(sp) LREG x4, 4 * REGBYTES(sp) LREG x5, 5 * REGBYTES(sp) LREG x6, 6 * REGBYTES(sp) LREG x7, 7 * REGBYTES(sp) LREG x8, 8 * REGBYTES(sp) LREG x9, 9 * REGBYTES(sp) LREG x10, 10 * REGBYTES(sp) LREG x11, 11 * REGBYTES(sp) LREG x12, 12 * REGBYTES(sp) LREG x13, 13 * REGBYTES(sp) LREG x14, 14 * REGBYTES(sp) LREG x15, 15 * REGBYTES(sp) LREG x16, 16 * REGBYTES(sp) LREG x17, 17 * REGBYTES(sp) LREG x18, 18 * REGBYTES(sp) LREG x19, 19 * REGBYTES(sp) LREG x20, 20 * REGBYTES(sp) LREG x21, 21 * REGBYTES(sp) LREG x22, 22 * REGBYTES(sp) LREG x23, 23 * REGBYTES(sp) LREG x24, 24 * REGBYTES(sp) LREG x25, 25 * REGBYTES(sp) LREG x26, 26 * REGBYTES(sp) LREG x27, 27 * REGBYTES(sp) LREG x28, 28 * REGBYTES(sp) LREG x29, 29 * REGBYTES(sp) LREG x30, 30 * REGBYTES(sp) LREG x31, 31 * REGBYTES(sp) LREG x2, 2 * REGBYTES(sp) addi sp, sp, 32 * REGBYTES MODE_PREFIX(ret)
4ms/stm32mp1-baremetal
8,345
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/riscv/cpu/start.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Startup Code for RISC-V Core * * Copyright (c) 2017 Microsemi Corporation. * Copyright (c) 2017 Padmarao Begari <Padmarao.Begari@microsemi.com> * * Copyright (C) 2017 Andes Technology Corporation * Rick Chen, Andes Technology Corporation <rick@andestech.com> */ #include <asm-offsets.h> #include <config.h> #include <common.h> #include <elf.h> #include <asm/encoding.h> #include <generated/asm-offsets.h> #ifdef CONFIG_32BIT #define LREG lw #define SREG sw #define REGBYTES 4 #define RELOC_TYPE R_RISCV_32 #define SYM_INDEX 0x8 #define SYM_SIZE 0x10 #else #define LREG ld #define SREG sd #define REGBYTES 8 #define RELOC_TYPE R_RISCV_64 #define SYM_INDEX 0x20 #define SYM_SIZE 0x18 #endif .section .data secondary_harts_relocation_error: .ascii "Relocation of secondary harts has failed, error %d\n" .section .text .globl _start _start: #if CONFIG_IS_ENABLED(RISCV_MMODE) csrr a0, CSR_MHARTID #endif /* save hart id and dtb pointer */ mv tp, a0 mv s1, a1 la t0, trap_entry csrw MODE_PREFIX(tvec), t0 /* mask all interrupts */ csrw MODE_PREFIX(ie), zero #ifdef CONFIG_SMP /* check if hart is within range */ /* tp: hart id */ li t0, CONFIG_NR_CPUS bge tp, t0, hart_out_of_bounds_loop #endif #ifdef CONFIG_SMP /* set xSIE bit to receive IPIs */ #if CONFIG_IS_ENABLED(RISCV_MMODE) li t0, MIE_MSIE #else li t0, SIE_SSIE #endif csrs MODE_PREFIX(ie), t0 #endif /* * Set stackpointer in internal/ex RAM to call board_init_f */ call_board_init_f: li t0, -16 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK) li t1, CONFIG_SPL_STACK #else li t1, CONFIG_SYS_INIT_SP_ADDR #endif and sp, t1, t0 /* force 16 byte alignment */ call_board_init_f_0: mv a0, sp jal board_init_f_alloc_reserve /* * Set global data pointer here for all harts, uninitialized at this * point. */ mv gp, a0 /* setup stack */ #ifdef CONFIG_SMP /* tp: hart id */ slli t0, tp, CONFIG_STACK_SIZE_SHIFT sub sp, a0, t0 #else mv sp, a0 #endif #ifndef CONFIG_XIP /* * Pick hart to initialize global data and run U-Boot. The other harts * wait for initialization to complete. */ la t0, hart_lottery li s2, 1 amoswap.w s2, t1, 0(t0) bnez s2, wait_for_gd_init #else bnez tp, secondary_hart_loop #endif #ifdef CONFIG_OF_PRIOR_STAGE la t0, prior_stage_fdt_address SREG s1, 0(t0) #endif jal board_init_f_init_reserve /* save the boot hart id to global_data */ SREG tp, GD_BOOT_HART(gp) #ifndef CONFIG_XIP la t0, available_harts_lock fence rw, w amoswap.w zero, zero, 0(t0) wait_for_gd_init: la t0, available_harts_lock li t1, 1 1: amoswap.w t1, t1, 0(t0) fence r, rw bnez t1, 1b /* register available harts in the available_harts mask */ li t1, 1 sll t1, t1, tp LREG t2, GD_AVAILABLE_HARTS(gp) or t2, t2, t1 SREG t2, GD_AVAILABLE_HARTS(gp) fence rw, w amoswap.w zero, zero, 0(t0) /* * Continue on hart lottery winner, others branch to * secondary_hart_loop. */ bnez s2, secondary_hart_loop #endif /* Enable cache */ jal icache_enable jal dcache_enable #ifdef CONFIG_DEBUG_UART jal debug_uart_init #endif mv a0, zero /* a0 <-- boot_flags = 0 */ la t5, board_init_f jalr t5 /* jump to board_init_f() */ #ifdef CONFIG_SPL_BUILD spl_clear_bss: la t0, __bss_start la t1, __bss_end beq t0, t1, spl_stack_gd_setup spl_clear_bss_loop: SREG zero, 0(t0) addi t0, t0, REGBYTES blt t0, t1, spl_clear_bss_loop spl_stack_gd_setup: jal spl_relocate_stack_gd /* skip setup if we did not relocate */ beqz a0, spl_call_board_init_r mv s0, a0 /* setup stack on main hart */ #ifdef CONFIG_SMP /* tp: hart id */ slli t0, tp, CONFIG_STACK_SIZE_SHIFT sub sp, s0, t0 #else mv sp, s0 #endif /* set new stack and global data pointer on secondary harts */ spl_secondary_hart_stack_gd_setup: la a0, secondary_hart_relocate mv a1, s0 mv a2, s0 mv a3, zero jal smp_call_function /* hang if relocation of secondary harts has failed */ beqz a0, 1f mv a1, a0 la a0, secondary_harts_relocation_error jal printf jal hang /* set new global data pointer on main hart */ 1: mv gp, s0 spl_call_board_init_r: mv a0, zero mv a1, zero jal board_init_r #endif /* * void relocate_code (addr_sp, gd, addr_moni) * * This "function" does not return, instead it continues in RAM * after relocating the monitor code. * */ .globl relocate_code relocate_code: mv s2, a0 /* save addr_sp */ mv s3, a1 /* save addr of gd */ mv s4, a2 /* save addr of destination */ /* *Set up the stack */ stack_setup: #ifdef CONFIG_SMP /* tp: hart id */ slli t0, tp, CONFIG_STACK_SIZE_SHIFT sub sp, s2, t0 #else mv sp, s2 #endif la t0, _start sub t6, s4, t0 /* t6 <- relocation offset */ beq t0, s4, clear_bss /* skip relocation */ mv t1, s4 /* t1 <- scratch for copy_loop */ la t3, __bss_start sub t3, t3, t0 /* t3 <- __bss_start_ofs */ add t2, t0, t3 /* t2 <- source end address */ copy_loop: LREG t5, 0(t0) addi t0, t0, REGBYTES SREG t5, 0(t1) addi t1, t1, REGBYTES blt t0, t2, copy_loop /* * Update dynamic relocations after board_init_f */ fix_rela_dyn: la t1, __rel_dyn_start la t2, __rel_dyn_end beq t1, t2, clear_bss add t1, t1, t6 /* t1 <- rela_dyn_start in RAM */ add t2, t2, t6 /* t2 <- rela_dyn_end in RAM */ /* * skip first reserved entry: address, type, addend */ j 10f 6: LREG t5, -(REGBYTES*2)(t1) /* t5 <-- relocation info:type */ li t3, R_RISCV_RELATIVE /* reloc type R_RISCV_RELATIVE */ bne t5, t3, 8f /* skip non-RISCV_RELOC entries */ LREG t3, -(REGBYTES*3)(t1) LREG t5, -(REGBYTES)(t1) /* t5 <-- addend */ add t5, t5, t6 /* t5 <-- location to fix up in RAM */ add t3, t3, t6 /* t3 <-- location to fix up in RAM */ SREG t5, 0(t3) j 10f 8: la t4, __dyn_sym_start add t4, t4, t6 9: LREG t5, -(REGBYTES*2)(t1) /* t5 <-- relocation info:type */ srli t0, t5, SYM_INDEX /* t0 <--- sym table index */ andi t5, t5, 0xFF /* t5 <--- relocation type */ li t3, RELOC_TYPE bne t5, t3, 10f /* skip non-addned entries */ LREG t3, -(REGBYTES*3)(t1) li t5, SYM_SIZE mul t0, t0, t5 add s5, t4, t0 LREG t0, -(REGBYTES)(t1) /* t0 <-- addend */ LREG t5, REGBYTES(s5) add t5, t5, t0 add t5, t5, t6 /* t5 <-- location to fix up in RAM */ add t3, t3, t6 /* t3 <-- location to fix up in RAM */ SREG t5, 0(t3) 10: addi t1, t1, (REGBYTES*3) ble t1, t2, 6b /* * trap update */ la t0, trap_entry add t0, t0, t6 csrw MODE_PREFIX(tvec), t0 clear_bss: la t0, __bss_start /* t0 <- rel __bss_start in FLASH */ add t0, t0, t6 /* t0 <- rel __bss_start in RAM */ la t1, __bss_end /* t1 <- rel __bss_end in FLASH */ add t1, t1, t6 /* t1 <- rel __bss_end in RAM */ beq t0, t1, relocate_secondary_harts clbss_l: SREG zero, 0(t0) /* clear loop... */ addi t0, t0, REGBYTES blt t0, t1, clbss_l relocate_secondary_harts: #ifdef CONFIG_SMP /* send relocation IPI */ la t0, secondary_hart_relocate add a0, t0, t6 /* store relocation offset */ mv s5, t6 mv a1, s2 mv a2, s3 mv a3, zero jal smp_call_function /* hang if relocation of secondary harts has failed */ beqz a0, 1f mv a1, a0 la a0, secondary_harts_relocation_error jal printf jal hang /* restore relocation offset */ 1: mv t6, s5 #endif /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. */ call_board_init_r: jal invalidate_icache_all jal flush_dcache_all la t0, board_init_r mv t4, t0 /* offset of board_init_r() */ add t4, t4, t6 /* real address of board_init_r() */ /* * setup parameters for board_init_r */ mv a0, s3 /* gd_t */ mv a1, s4 /* dest_addr */ /* * jump to it ... */ jr t4 /* jump to board_init_r() */ #ifdef CONFIG_SMP hart_out_of_bounds_loop: /* Harts in this loop are out of bounds, increase CONFIG_NR_CPUS. */ wfi j hart_out_of_bounds_loop #endif #ifdef CONFIG_SMP /* SMP relocation entry */ secondary_hart_relocate: /* a1: new sp */ /* a2: new gd */ /* tp: hart id */ /* setup stack */ slli t0, tp, CONFIG_STACK_SIZE_SHIFT sub sp, a1, t0 /* update global data pointer */ mv gp, a2 #endif secondary_hart_loop: wfi #ifdef CONFIG_SMP csrr t0, MODE_PREFIX(ip) #if CONFIG_IS_ENABLED(RISCV_MMODE) andi t0, t0, MIE_MSIE #else andi t0, t0, SIE_SSIE #endif beqz t0, secondary_hart_loop mv a0, tp jal handle_ipi #endif j secondary_hart_loop
4ms/stm32mp1-baremetal
9,109
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/sh/lib/udivsi3_i4i.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. */ !! libgcc routines for the Renesas / SuperH SH CPUs. !! Contributed by Steve Chamberlain. !! sac@cygnus.com !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines !! recoded in assembly by Toshiyasu Morita !! tm@netcom.com /* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and ELF local label prefixes by J"orn Rennecke amylaar@cygnus.com */ /* This code used shld, thus is not suitable for SH1 / SH2. */ /* Signed / unsigned division without use of FPU, optimized for SH4. Uses a lookup table for divisors in the range -128 .. +128, and div1 with case distinction for larger divisors in three more ranges. The code is lumped together with the table to allow the use of mova. */ #ifdef CONFIG_CPU_LITTLE_ENDIAN #define L_LSB 0 #define L_LSWMSB 1 #define L_MSWLSB 2 #else #define L_LSB 3 #define L_LSWMSB 2 #define L_MSWLSB 1 #endif .balign 4 .global __udivsi3_i4i .global __udivsi3_i4 .set __udivsi3_i4, __udivsi3_i4i .type __udivsi3_i4i, @function __udivsi3_i4i: mov.w c128_w, r1 div0u mov r4,r0 shlr8 r0 cmp/hi r1,r5 extu.w r5,r1 bf udiv_le128 cmp/eq r5,r1 bf udiv_ge64k shlr r0 mov r5,r1 shll16 r5 mov.l r4,@-r15 div1 r5,r0 mov.l r1,@-r15 div1 r5,r0 div1 r5,r0 bra udiv_25 div1 r5,r0 div_le128: mova div_table_ix,r0 bra div_le128_2 mov.b @(r0,r5),r1 udiv_le128: mov.l r4,@-r15 mova div_table_ix,r0 mov.b @(r0,r5),r1 mov.l r5,@-r15 div_le128_2: mova div_table_inv,r0 mov.l @(r0,r1),r1 mov r5,r0 tst #0xfe,r0 mova div_table_clz,r0 dmulu.l r1,r4 mov.b @(r0,r5),r1 bt/s div_by_1 mov r4,r0 mov.l @r15+,r5 sts mach,r0 /* clrt */ addc r4,r0 mov.l @r15+,r4 rotcr r0 rts shld r1,r0 div_by_1_neg: neg r4,r0 div_by_1: mov.l @r15+,r5 rts mov.l @r15+,r4 div_ge64k: bt/s div_r8 div0u shll8 r5 bra div_ge64k_2 div1 r5,r0 udiv_ge64k: cmp/hi r0,r5 mov r5,r1 bt udiv_r8 shll8 r5 mov.l r4,@-r15 div1 r5,r0 mov.l r1,@-r15 div_ge64k_2: div1 r5,r0 mov.l zero_l,r1 .rept 4 div1 r5,r0 .endr mov.l r1,@-r15 div1 r5,r0 mov.w m256_w,r1 div1 r5,r0 mov.b r0,@(L_LSWMSB,r15) xor r4,r0 and r1,r0 bra div_ge64k_end xor r4,r0 div_r8: shll16 r4 bra div_r8_2 shll8 r4 udiv_r8: mov.l r4,@-r15 shll16 r4 clrt shll8 r4 mov.l r5,@-r15 div_r8_2: rotcl r4 mov r0,r1 div1 r5,r1 mov r4,r0 rotcl r0 mov r5,r4 div1 r5,r1 .rept 5 rotcl r0; div1 r5,r1 .endr rotcl r0 mov.l @r15+,r5 div1 r4,r1 mov.l @r15+,r4 rts rotcl r0 .global __sdivsi3_i4i .global __sdivsi3_i4 .global __sdivsi3 .set __sdivsi3_i4, __sdivsi3_i4i .set __sdivsi3, __sdivsi3_i4i .type __sdivsi3_i4i, @function /* This is link-compatible with a __sdivsi3 call, but we effectively clobber only r1. */ __sdivsi3_i4i: mov.l r4,@-r15 cmp/pz r5 mov.w c128_w, r1 bt/s pos_divisor cmp/pz r4 mov.l r5,@-r15 neg r5,r5 bt/s neg_result cmp/hi r1,r5 neg r4,r4 pos_result: extu.w r5,r0 bf div_le128 cmp/eq r5,r0 mov r4,r0 shlr8 r0 bf/s div_ge64k cmp/hi r0,r5 div0u shll16 r5 div1 r5,r0 div1 r5,r0 div1 r5,r0 udiv_25: mov.l zero_l,r1 div1 r5,r0 div1 r5,r0 mov.l r1,@-r15 .rept 3 div1 r5,r0 .endr mov.b r0,@(L_MSWLSB,r15) xtrct r4,r0 swap.w r0,r0 .rept 8 div1 r5,r0 .endr mov.b r0,@(L_LSWMSB,r15) div_ge64k_end: .rept 8 div1 r5,r0 .endr mov.l @r15+,r4 ! zero-extension and swap using LS unit. extu.b r0,r0 mov.l @r15+,r5 or r4,r0 mov.l @r15+,r4 rts rotcl r0 div_le128_neg: tst #0xfe,r0 mova div_table_ix,r0 mov.b @(r0,r5),r1 mova div_table_inv,r0 bt/s div_by_1_neg mov.l @(r0,r1),r1 mova div_table_clz,r0 dmulu.l r1,r4 mov.b @(r0,r5),r1 mov.l @r15+,r5 sts mach,r0 /* clrt */ addc r4,r0 mov.l @r15+,r4 rotcr r0 shld r1,r0 rts neg r0,r0 pos_divisor: mov.l r5,@-r15 bt/s pos_result cmp/hi r1,r5 neg r4,r4 neg_result: extu.w r5,r0 bf div_le128_neg cmp/eq r5,r0 mov r4,r0 shlr8 r0 bf/s div_ge64k_neg cmp/hi r0,r5 div0u mov.l zero_l,r1 shll16 r5 div1 r5,r0 mov.l r1,@-r15 .rept 7 div1 r5,r0 .endr mov.b r0,@(L_MSWLSB,r15) xtrct r4,r0 swap.w r0,r0 .rept 8 div1 r5,r0 .endr mov.b r0,@(L_LSWMSB,r15) div_ge64k_neg_end: .rept 8 div1 r5,r0 .endr mov.l @r15+,r4 ! zero-extension and swap using LS unit. extu.b r0,r1 mov.l @r15+,r5 or r4,r1 div_r8_neg_end: mov.l @r15+,r4 rotcl r1 rts neg r1,r0 div_ge64k_neg: bt/s div_r8_neg div0u shll8 r5 mov.l zero_l,r1 .rept 6 div1 r5,r0 .endr mov.l r1,@-r15 div1 r5,r0 mov.w m256_w,r1 div1 r5,r0 mov.b r0,@(L_LSWMSB,r15) xor r4,r0 and r1,r0 bra div_ge64k_neg_end xor r4,r0 c128_w: .word 128 div_r8_neg: clrt shll16 r4 mov r4,r1 shll8 r1 mov r5,r4 .rept 7 rotcl r1; div1 r5,r0 .endr mov.l @r15+,r5 rotcl r1 bra div_r8_neg_end div1 r4,r0 m256_w: .word 0xff00 /* This table has been generated by divtab-sh4.c. */ .balign 4 div_table_clz: .byte 0 .byte 1 .byte 0 .byte -1 .byte -1 .byte -2 .byte -2 .byte -2 .byte -2 .byte -3 .byte -3 .byte -3 .byte -3 .byte -3 .byte -3 .byte -3 .byte -3 .byte -4 .byte -4 .byte -4 .byte -4 .byte -4 .byte -4 .byte -4 .byte -4 .byte -4 .byte -4 .byte -4 .byte -4 .byte -4 .byte -4 .byte -4 .byte -4 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -5 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 .byte -6 /* Lookup table translating positive divisor to index into table of normalized inverse. N.B. the '0' entry is also the last entry of the previous table, and causes an unaligned access for division by zero. */ div_table_ix: .byte -6 .byte -128 .byte -128 .byte 0 .byte -128 .byte -64 .byte 0 .byte 64 .byte -128 .byte -96 .byte -64 .byte -32 .byte 0 .byte 32 .byte 64 .byte 96 .byte -128 .byte -112 .byte -96 .byte -80 .byte -64 .byte -48 .byte -32 .byte -16 .byte 0 .byte 16 .byte 32 .byte 48 .byte 64 .byte 80 .byte 96 .byte 112 .byte -128 .byte -120 .byte -112 .byte -104 .byte -96 .byte -88 .byte -80 .byte -72 .byte -64 .byte -56 .byte -48 .byte -40 .byte -32 .byte -24 .byte -16 .byte -8 .byte 0 .byte 8 .byte 16 .byte 24 .byte 32 .byte 40 .byte 48 .byte 56 .byte 64 .byte 72 .byte 80 .byte 88 .byte 96 .byte 104 .byte 112 .byte 120 .byte -128 .byte -124 .byte -120 .byte -116 .byte -112 .byte -108 .byte -104 .byte -100 .byte -96 .byte -92 .byte -88 .byte -84 .byte -80 .byte -76 .byte -72 .byte -68 .byte -64 .byte -60 .byte -56 .byte -52 .byte -48 .byte -44 .byte -40 .byte -36 .byte -32 .byte -28 .byte -24 .byte -20 .byte -16 .byte -12 .byte -8 .byte -4 .byte 0 .byte 4 .byte 8 .byte 12 .byte 16 .byte 20 .byte 24 .byte 28 .byte 32 .byte 36 .byte 40 .byte 44 .byte 48 .byte 52 .byte 56 .byte 60 .byte 64 .byte 68 .byte 72 .byte 76 .byte 80 .byte 84 .byte 88 .byte 92 .byte 96 .byte 100 .byte 104 .byte 108 .byte 112 .byte 116 .byte 120 .byte 124 .byte -128 /* 1/64 .. 1/127, normalized. There is an implicit leading 1 in bit 32. */ .balign 4 zero_l: .long 0x0 .long 0xF81F81F9 .long 0xF07C1F08 .long 0xE9131AC0 .long 0xE1E1E1E2 .long 0xDAE6076C .long 0xD41D41D5 .long 0xCD856891 .long 0xC71C71C8 .long 0xC0E07039 .long 0xBACF914D .long 0xB4E81B4F .long 0xAF286BCB .long 0xA98EF607 .long 0xA41A41A5 .long 0x9EC8E952 .long 0x9999999A .long 0x948B0FCE .long 0x8F9C18FA .long 0x8ACB90F7 .long 0x86186187 .long 0x81818182 .long 0x7D05F418 .long 0x78A4C818 .long 0x745D1746 .long 0x702E05C1 .long 0x6C16C16D .long 0x68168169 .long 0x642C8591 .long 0x60581606 .long 0x5C9882BA .long 0x58ED2309 div_table_inv: .long 0x55555556 .long 0x51D07EAF .long 0x4E5E0A73 .long 0x4AFD6A06 .long 0x47AE147B .long 0x446F8657 .long 0x41414142 .long 0x3E22CBCF .long 0x3B13B13C .long 0x38138139 .long 0x3521CFB3 .long 0x323E34A3 .long 0x2F684BDB .long 0x2C9FB4D9 .long 0x29E4129F .long 0x27350B89 .long 0x24924925 .long 0x21FB7813 .long 0x1F7047DD .long 0x1CF06ADB .long 0x1A7B9612 .long 0x18118119 .long 0x15B1E5F8 .long 0x135C8114 .long 0x11111112 .long 0xECF56BF .long 0xC9714FC .long 0xA6810A7 .long 0x8421085 .long 0x624DD30 .long 0x4104105 .long 0x2040811 /* maximum error: 0.987342 scaled: 0.921875*/
4ms/stm32mp1-baremetal
2,642
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/sh/lib/ashrsi3.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. */ !! libgcc routines for the Renesas / SuperH SH CPUs. !! Contributed by Steve Chamberlain. !! sac@cygnus.com !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines !! recoded in assembly by Toshiyasu Morita !! tm@netcom.com /* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and ELF local label prefixes by J"orn Rennecke amylaar@cygnus.com */ ! ! __ashrsi3 ! ! Entry: ! ! r4: Value to shift ! r5: Shifts ! ! Exit: ! ! r0: Result ! ! Destroys: ! ! (none) ! .global __ashrsi3 .align 2 __ashrsi3: mov #31,r0 and r0,r5 mova ashrsi3_table,r0 mov.b @(r0,r5),r5 #ifdef __sh1__ add r5,r0 jmp @r0 #else braf r5 #endif mov r4,r0 .align 2 ashrsi3_table: .byte ashrsi3_0-ashrsi3_table .byte ashrsi3_1-ashrsi3_table .byte ashrsi3_2-ashrsi3_table .byte ashrsi3_3-ashrsi3_table .byte ashrsi3_4-ashrsi3_table .byte ashrsi3_5-ashrsi3_table .byte ashrsi3_6-ashrsi3_table .byte ashrsi3_7-ashrsi3_table .byte ashrsi3_8-ashrsi3_table .byte ashrsi3_9-ashrsi3_table .byte ashrsi3_10-ashrsi3_table .byte ashrsi3_11-ashrsi3_table .byte ashrsi3_12-ashrsi3_table .byte ashrsi3_13-ashrsi3_table .byte ashrsi3_14-ashrsi3_table .byte ashrsi3_15-ashrsi3_table .byte ashrsi3_16-ashrsi3_table .byte ashrsi3_17-ashrsi3_table .byte ashrsi3_18-ashrsi3_table .byte ashrsi3_19-ashrsi3_table .byte ashrsi3_20-ashrsi3_table .byte ashrsi3_21-ashrsi3_table .byte ashrsi3_22-ashrsi3_table .byte ashrsi3_23-ashrsi3_table .byte ashrsi3_24-ashrsi3_table .byte ashrsi3_25-ashrsi3_table .byte ashrsi3_26-ashrsi3_table .byte ashrsi3_27-ashrsi3_table .byte ashrsi3_28-ashrsi3_table .byte ashrsi3_29-ashrsi3_table .byte ashrsi3_30-ashrsi3_table .byte ashrsi3_31-ashrsi3_table ashrsi3_31: rotcl r0 rts subc r0,r0 ashrsi3_30: shar r0 ashrsi3_29: shar r0 ashrsi3_28: shar r0 ashrsi3_27: shar r0 ashrsi3_26: shar r0 ashrsi3_25: shar r0 ashrsi3_24: shlr16 r0 shlr8 r0 rts exts.b r0,r0 ashrsi3_23: shar r0 ashrsi3_22: shar r0 ashrsi3_21: shar r0 ashrsi3_20: shar r0 ashrsi3_19: shar r0 ashrsi3_18: shar r0 ashrsi3_17: shar r0 ashrsi3_16: shlr16 r0 rts exts.w r0,r0 ashrsi3_15: shar r0 ashrsi3_14: shar r0 ashrsi3_13: shar r0 ashrsi3_12: shar r0 ashrsi3_11: shar r0 ashrsi3_10: shar r0 ashrsi3_9: shar r0 ashrsi3_8: shar r0 ashrsi3_7: shar r0 ashrsi3_6: shar r0 ashrsi3_5: shar r0 ashrsi3_4: shar r0 ashrsi3_3: shar r0 ashrsi3_2: shar r0 ashrsi3_1: rts shar r0 ashrsi3_0: rts nop
4ms/stm32mp1-baremetal
2,892
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/sh/lib/ashlsi3.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. */ !! libgcc routines for the Renesas / SuperH SH CPUs. !! Contributed by Steve Chamberlain. !! sac@cygnus.com !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines !! recoded in assembly by Toshiyasu Morita !! tm@netcom.com /* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and ELF local label prefixes by J"orn Rennecke amylaar@cygnus.com */ ! ! GLOBAL(ashlsi3) ! ! Entry: ! ! r4: Value to shift ! r5: Shifts ! ! Exit: ! ! r0: Result ! ! Destroys: ! ! (none) ! .global __ashlsi3 .align 2 __ashlsi3: mov #31,r0 and r0,r5 mova __ashlsi3_table,r0 mov.b @(r0,r5),r5 #ifdef __sh1__ add r5,r0 jmp @r0 #else braf r5 #endif mov r4,r0 .align 2 __ashlsi3_table: .byte __ashlsi3_0-__ashlsi3_table .byte __ashlsi3_1-__ashlsi3_table .byte __ashlsi3_2-__ashlsi3_table .byte __ashlsi3_3-__ashlsi3_table .byte __ashlsi3_4-__ashlsi3_table .byte __ashlsi3_5-__ashlsi3_table .byte __ashlsi3_6-__ashlsi3_table .byte __ashlsi3_7-__ashlsi3_table .byte __ashlsi3_8-__ashlsi3_table .byte __ashlsi3_9-__ashlsi3_table .byte __ashlsi3_10-__ashlsi3_table .byte __ashlsi3_11-__ashlsi3_table .byte __ashlsi3_12-__ashlsi3_table .byte __ashlsi3_13-__ashlsi3_table .byte __ashlsi3_14-__ashlsi3_table .byte __ashlsi3_15-__ashlsi3_table .byte __ashlsi3_16-__ashlsi3_table .byte __ashlsi3_17-__ashlsi3_table .byte __ashlsi3_18-__ashlsi3_table .byte __ashlsi3_19-__ashlsi3_table .byte __ashlsi3_20-__ashlsi3_table .byte __ashlsi3_21-__ashlsi3_table .byte __ashlsi3_22-__ashlsi3_table .byte __ashlsi3_23-__ashlsi3_table .byte __ashlsi3_24-__ashlsi3_table .byte __ashlsi3_25-__ashlsi3_table .byte __ashlsi3_26-__ashlsi3_table .byte __ashlsi3_27-__ashlsi3_table .byte __ashlsi3_28-__ashlsi3_table .byte __ashlsi3_29-__ashlsi3_table .byte __ashlsi3_30-__ashlsi3_table .byte __ashlsi3_31-__ashlsi3_table __ashlsi3_6: shll2 r0 __ashlsi3_4: shll2 r0 __ashlsi3_2: rts shll2 r0 __ashlsi3_7: shll2 r0 __ashlsi3_5: shll2 r0 __ashlsi3_3: shll2 r0 __ashlsi3_1: rts shll r0 __ashlsi3_14: shll2 r0 __ashlsi3_12: shll2 r0 __ashlsi3_10: shll2 r0 __ashlsi3_8: rts shll8 r0 __ashlsi3_15: shll2 r0 __ashlsi3_13: shll2 r0 __ashlsi3_11: shll2 r0 __ashlsi3_9: shll8 r0 rts shll r0 __ashlsi3_22: shll2 r0 __ashlsi3_20: shll2 r0 __ashlsi3_18: shll2 r0 __ashlsi3_16: rts shll16 r0 __ashlsi3_23: shll2 r0 __ashlsi3_21: shll2 r0 __ashlsi3_19: shll2 r0 __ashlsi3_17: shll16 r0 rts shll r0 __ashlsi3_30: shll2 r0 __ashlsi3_28: shll2 r0 __ashlsi3_26: shll2 r0 __ashlsi3_24: shll16 r0 rts shll8 r0 __ashlsi3_31: shll2 r0 __ashlsi3_29: shll2 r0 __ashlsi3_27: shll2 r0 __ashlsi3_25: shll16 r0 shll8 r0 rts shll r0 __ashlsi3_0: rts nop
4ms/stm32mp1-baremetal
2,887
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/sh/lib/lshrsi3.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. */ !! libgcc routines for the Renesas / SuperH SH CPUs. !! Contributed by Steve Chamberlain. !! sac@cygnus.com !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines !! recoded in assembly by Toshiyasu Morita !! tm@netcom.com /* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and ELF local label prefixes by J"orn Rennecke amylaar@cygnus.com */ ! ! __lshrsi3) ! ! Entry: ! ! r4: Value to shift ! r5: Shifts ! ! Exit: ! ! r0: Result ! ! Destroys: ! ! (none) ! .global __lshrsi3 .align 2 __lshrsi3: mov #31,r0 and r0,r5 mova __lshrsi3_table,r0 mov.b @(r0,r5),r5 #ifdef __sh1__ add r5,r0 jmp @r0 #else braf r5 #endif mov r4,r0 .align 2 __lshrsi3_table: .byte __lshrsi3_0-__lshrsi3_table .byte __lshrsi3_1-__lshrsi3_table .byte __lshrsi3_2-__lshrsi3_table .byte __lshrsi3_3-__lshrsi3_table .byte __lshrsi3_4-__lshrsi3_table .byte __lshrsi3_5-__lshrsi3_table .byte __lshrsi3_6-__lshrsi3_table .byte __lshrsi3_7-__lshrsi3_table .byte __lshrsi3_8-__lshrsi3_table .byte __lshrsi3_9-__lshrsi3_table .byte __lshrsi3_10-__lshrsi3_table .byte __lshrsi3_11-__lshrsi3_table .byte __lshrsi3_12-__lshrsi3_table .byte __lshrsi3_13-__lshrsi3_table .byte __lshrsi3_14-__lshrsi3_table .byte __lshrsi3_15-__lshrsi3_table .byte __lshrsi3_16-__lshrsi3_table .byte __lshrsi3_17-__lshrsi3_table .byte __lshrsi3_18-__lshrsi3_table .byte __lshrsi3_19-__lshrsi3_table .byte __lshrsi3_20-__lshrsi3_table .byte __lshrsi3_21-__lshrsi3_table .byte __lshrsi3_22-__lshrsi3_table .byte __lshrsi3_23-__lshrsi3_table .byte __lshrsi3_24-__lshrsi3_table .byte __lshrsi3_25-__lshrsi3_table .byte __lshrsi3_26-__lshrsi3_table .byte __lshrsi3_27-__lshrsi3_table .byte __lshrsi3_28-__lshrsi3_table .byte __lshrsi3_29-__lshrsi3_table .byte __lshrsi3_30-__lshrsi3_table .byte __lshrsi3_31-__lshrsi3_table __lshrsi3_6: shlr2 r0 __lshrsi3_4: shlr2 r0 __lshrsi3_2: rts shlr2 r0 __lshrsi3_7: shlr2 r0 __lshrsi3_5: shlr2 r0 __lshrsi3_3: shlr2 r0 __lshrsi3_1: rts shlr r0 __lshrsi3_14: shlr2 r0 __lshrsi3_12: shlr2 r0 __lshrsi3_10: shlr2 r0 __lshrsi3_8: rts shlr8 r0 __lshrsi3_15: shlr2 r0 __lshrsi3_13: shlr2 r0 __lshrsi3_11: shlr2 r0 __lshrsi3_9: shlr8 r0 rts shlr r0 __lshrsi3_22: shlr2 r0 __lshrsi3_20: shlr2 r0 __lshrsi3_18: shlr2 r0 __lshrsi3_16: rts shlr16 r0 __lshrsi3_23: shlr2 r0 __lshrsi3_21: shlr2 r0 __lshrsi3_19: shlr2 r0 __lshrsi3_17: shlr16 r0 rts shlr r0 __lshrsi3_30: shlr2 r0 __lshrsi3_28: shlr2 r0 __lshrsi3_26: shlr2 r0 __lshrsi3_24: shlr16 r0 rts shlr8 r0 __lshrsi3_31: shlr2 r0 __lshrsi3_29: shlr2 r0 __lshrsi3_27: shlr2 r0 __lshrsi3_25: shlr16 r0 shlr8 r0 rts shlr r0 __lshrsi3_0: rts nop
4ms/stm32mp1-baremetal
1,348
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/sh/lib/start.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2016 Vladimir Zapolskiy <vz@mleia.com> * Copyright (C) 2007, 2010 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> */ #include <asm-offsets.h> #include <config.h> .text .align 2 .global _start _start: mov.l ._lowlevel_init, r0 100: bsrf r0 nop bsr 1f nop 1: sts pr, r5 mov.l ._reloc_dst, r4 add #(_start-1b), r5 mov.l ._reloc_dst_end, r6 #ifdef CONFIG_OF_SEPARATE mov.l ._reloc_size, r0 add r5, r0 add #4, r0 mov.l @r0, r0 swap.b r0, r0 swap.w r0, r0 swap.b r0, r0 add #4, r0 add r0, r6 #endif 2: mov.l @r5+, r1 mov.l r1, @r4 add #4, r4 cmp/hs r6, r4 bf 2b #ifndef CONFIG_OF_SEPARATE mov.l ._bss_start, r4 mov.l ._bss_end, r5 mov #0, r1 3: mov.l r1, @r4 /* bss clear */ add #4, r4 cmp/hs r5, r4 bf 3b #endif mov.l ._gd_init, r13 /* global data */ mov.l ._stack_init, r15 /* stack */ mov.l ._sh_generic_init, r0 jsr @r0 mov #0, r4 loop: bra loop .align 2 ._lowlevel_init: .long (lowlevel_init - (100b + 4)) ._reloc_dst: .long _start ._reloc_dst_end: .long reloc_dst_end ._reloc_size: .long (_end - _start) ._bss_start: .long bss_start ._bss_end: .long bss_end ._gd_init: .long (_start - GENERATED_GBL_DATA_SIZE) ._stack_init: .long (_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16) ._sh_generic_init: .long board_init_f
4ms/stm32mp1-baremetal
1,089
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/sh/lib/udiv_qrnnd.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. */ !! libgcc routines for the Renesas / SuperH SH CPUs. !! Contributed by Steve Chamberlain. !! sac@cygnus.com !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines !! recoded in assembly by Toshiyasu Morita !! tm@netcom.com /* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and ELF local label prefixes by J"orn Rennecke amylaar@cygnus.com */ /* r0: rn r1: qn */ /* r0: n1 r4: n0 r5: d r6: d1 */ /* r2: __m */ /* n1 < d, but n1 might be larger than d1. */ .global __udiv_qrnnd_16 .balign 8 __udiv_qrnnd_16: div0u cmp/hi r6,r0 bt .Lots .rept 16 div1 r6,r0 .endr extu.w r0,r1 bt 0f add r6,r0 0: rotcl r1 mulu.w r1,r5 xtrct r4,r0 swap.w r0,r0 sts macl,r2 cmp/hs r2,r0 sub r2,r0 bt 0f addc r5,r0 add #-1,r1 bt 0f 1: add #-1,r1 rts add r5,r0 .balign 8 .Lots: sub r5,r0 swap.w r4,r1 xtrct r0,r1 clrt mov r1,r0 addc r5,r0 mov #-1,r1 bf/s 1b shlr16 r1 0: rts nop
4ms/stm32mp1-baremetal
2,295
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/sh/lib/udivsi3_i4i-Os.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2006 Free Software Foundation, Inc. */ /* Moderately Space-optimized libgcc routines for the Renesas SH / STMicroelectronics ST40 CPUs. Contributed by J"orn Rennecke joern.rennecke@st.com. */ /* Size: 186 bytes jointly for udivsi3_i4i and sdivsi3_i4i sh4-200 run times: udiv small divisor: 55 cycles udiv large divisor: 52 cycles sdiv small divisor, positive result: 59 cycles sdiv large divisor, positive result: 56 cycles sdiv small divisor, negative result: 65 cycles (*) sdiv large divisor, negative result: 62 cycles (*) (*): r2 is restored in the rts delay slot and has a lingering latency of two more cycles. */ .balign 4 .global __udivsi3_i4i .global __udivsi3_i4 .set __udivsi3_i4, __udivsi3_i4i .type __udivsi3_i4i, @function .type __sdivsi3_i4i, @function __udivsi3_i4i: sts pr,r1 mov.l r4,@-r15 extu.w r5,r0 cmp/eq r5,r0 swap.w r4,r0 shlr16 r4 bf/s large_divisor div0u mov.l r5,@-r15 shll16 r5 sdiv_small_divisor: div1 r5,r4 bsr div6 div1 r5,r4 div1 r5,r4 bsr div6 div1 r5,r4 xtrct r4,r0 xtrct r0,r4 bsr div7 swap.w r4,r4 div1 r5,r4 bsr div7 div1 r5,r4 xtrct r4,r0 mov.l @r15+,r5 swap.w r0,r0 mov.l @r15+,r4 jmp @r1 rotcl r0 div7: div1 r5,r4 div6: div1 r5,r4; div1 r5,r4; div1 r5,r4 div1 r5,r4; div1 r5,r4; rts; div1 r5,r4 divx3: rotcl r0 div1 r5,r4 rotcl r0 div1 r5,r4 rotcl r0 rts div1 r5,r4 large_divisor: mov.l r5,@-r15 sdiv_large_divisor: xor r4,r0 .rept 4 rotcl r0 bsr divx3 div1 r5,r4 .endr mov.l @r15+,r5 mov.l @r15+,r4 jmp @r1 rotcl r0 .global __sdivsi3_i4i .global __sdivsi3_i4 .global __sdivsi3 .set __sdivsi3_i4, __sdivsi3_i4i .set __sdivsi3, __sdivsi3_i4i __sdivsi3_i4i: mov.l r4,@-r15 cmp/pz r5 mov.l r5,@-r15 bt/s pos_divisor cmp/pz r4 neg r5,r5 extu.w r5,r0 bt/s neg_result cmp/eq r5,r0 neg r4,r4 pos_result: swap.w r4,r0 bra sdiv_check_divisor sts pr,r1 pos_divisor: extu.w r5,r0 bt/s pos_result cmp/eq r5,r0 neg r4,r4 neg_result: mova negate_result,r0 ; mov r0,r1 swap.w r4,r0 lds r2,macl sts pr,r2 sdiv_check_divisor: shlr16 r4 bf/s sdiv_large_divisor div0u bra sdiv_small_divisor shll16 r5 .balign 4 negate_result: neg r0,r0 jmp @r2 sts macl,r2
4ms/stm32mp1-baremetal
2,346
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/sh/lib/ashiftrt.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. */ !! libgcc routines for the Renesas / SuperH SH CPUs. !! Contributed by Steve Chamberlain. !! sac@cygnus.com !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines !! recoded in assembly by Toshiyasu Morita !! tm@netcom.com /* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and ELF local label prefixes by J"orn Rennecke amylaar@cygnus.com */ .global __ashiftrt_r4_0 .global __ashiftrt_r4_1 .global __ashiftrt_r4_2 .global __ashiftrt_r4_3 .global __ashiftrt_r4_4 .global __ashiftrt_r4_5 .global __ashiftrt_r4_6 .global __ashiftrt_r4_7 .global __ashiftrt_r4_8 .global __ashiftrt_r4_9 .global __ashiftrt_r4_10 .global __ashiftrt_r4_11 .global __ashiftrt_r4_12 .global __ashiftrt_r4_13 .global __ashiftrt_r4_14 .global __ashiftrt_r4_15 .global __ashiftrt_r4_16 .global __ashiftrt_r4_17 .global __ashiftrt_r4_18 .global __ashiftrt_r4_19 .global __ashiftrt_r4_20 .global __ashiftrt_r4_21 .global __ashiftrt_r4_22 .global __ashiftrt_r4_23 .global __ashiftrt_r4_24 .global __ashiftrt_r4_25 .global __ashiftrt_r4_26 .global __ashiftrt_r4_27 .global __ashiftrt_r4_28 .global __ashiftrt_r4_29 .global __ashiftrt_r4_30 .global __ashiftrt_r4_31 .global __ashiftrt_r4_32 .align 1 __ashiftrt_r4_32: __ashiftrt_r4_31: rotcl r4 rts subc r4,r4 __ashiftrt_r4_30: shar r4 __ashiftrt_r4_29: shar r4 __ashiftrt_r4_28: shar r4 __ashiftrt_r4_27: shar r4 __ashiftrt_r4_26: shar r4 __ashiftrt_r4_25: shar r4 __ashiftrt_r4_24: shlr16 r4 shlr8 r4 rts exts.b r4,r4 __ashiftrt_r4_23: shar r4 __ashiftrt_r4_22: shar r4 __ashiftrt_r4_21: shar r4 __ashiftrt_r4_20: shar r4 __ashiftrt_r4_19: shar r4 __ashiftrt_r4_18: shar r4 __ashiftrt_r4_17: shar r4 __ashiftrt_r4_16: shlr16 r4 rts exts.w r4,r4 __ashiftrt_r4_15: shar r4 __ashiftrt_r4_14: shar r4 __ashiftrt_r4_13: shar r4 __ashiftrt_r4_12: shar r4 __ashiftrt_r4_11: shar r4 __ashiftrt_r4_10: shar r4 __ashiftrt_r4_9: shar r4 __ashiftrt_r4_8: shar r4 __ashiftrt_r4_7: shar r4 __ashiftrt_r4_6: shar r4 __ashiftrt_r4_5: shar r4 __ashiftrt_r4_4: shar r4 __ashiftrt_r4_3: shar r4 __ashiftrt_r4_2: shar r4 __ashiftrt_r4_1: rts shar r4 __ashiftrt_r4_0: rts nop
4ms/stm32mp1-baremetal
4,327
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/sh/lib/movmem.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. */ !! libgcc routines for the Renesas / SuperH SH CPUs. !! Contributed by Steve Chamberlain. !! sac@cygnus.com !! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines !! recoded in assembly by Toshiyasu Morita !! tm@netcom.com /* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and ELF local label prefixes by J"orn Rennecke amylaar@cygnus.com */ .text .balign 4 .global __movmem .global __movstr .set __movstr, __movmem /* This would be a lot simpler if r6 contained the byte count minus 64, and we wouldn't be called here for a byte count of 64. */ __movmem: sts.l pr,@-r15 shll2 r6 bsr __movmemSI52+2 mov.l @(48,r5),r0 .balign 4 movmem_loop: /* Reached with rts */ mov.l @(60,r5),r0 add #-64,r6 mov.l r0,@(60,r4) tst r6,r6 mov.l @(56,r5),r0 bt movmem_done mov.l r0,@(56,r4) cmp/pl r6 mov.l @(52,r5),r0 add #64,r5 mov.l r0,@(52,r4) add #64,r4 bt __movmemSI52 ! done all the large groups, do the remainder ! jump to movmem+ mova __movmemSI4+4,r0 add r6,r0 jmp @r0 movmem_done: ! share slot insn, works out aligned. lds.l @r15+,pr mov.l r0,@(56,r4) mov.l @(52,r5),r0 rts mov.l r0,@(52,r4) .balign 4 .global __movmemSI64 .global __movstrSI64 .set __movstrSI64, __movmemSI64 __movmemSI64: mov.l @(60,r5),r0 mov.l r0,@(60,r4) .global __movmemSI60 .global __movstrSI60 .set __movstrSI60, __movmemSI60 __movmemSI60: mov.l @(56,r5),r0 mov.l r0,@(56,r4) .global __movmemSI56 .global __movstrSI56 .set __movstrSI56, __movmemSI56 __movmemSI56: mov.l @(52,r5),r0 mov.l r0,@(52,r4) .global __movmemSI52 .global __movstrSI52 .set __movstrSI52, __movmemSI52 __movmemSI52: mov.l @(48,r5),r0 mov.l r0,@(48,r4) .global __movmemSI48 .global __movstrSI48 .set __movstrSI48, __movmemSI48 __movmemSI48: mov.l @(44,r5),r0 mov.l r0,@(44,r4) .global __movmemSI44 .global __movstrSI44 .set __movstrSI44, __movmemSI44 __movmemSI44: mov.l @(40,r5),r0 mov.l r0,@(40,r4) .global __movmemSI40 .global __movstrSI40 .set __movstrSI40, __movmemSI40 __movmemSI40: mov.l @(36,r5),r0 mov.l r0,@(36,r4) .global __movmemSI36 .global __movstrSI36 .set __movstrSI36, __movmemSI36 __movmemSI36: mov.l @(32,r5),r0 mov.l r0,@(32,r4) .global __movmemSI32 .global __movstrSI32 .set __movstrSI32, __movmemSI32 __movmemSI32: mov.l @(28,r5),r0 mov.l r0,@(28,r4) .global __movmemSI28 .global __movstrSI28 .set __movstrSI28, __movmemSI28 __movmemSI28: mov.l @(24,r5),r0 mov.l r0,@(24,r4) .global __movmemSI24 .global __movstrSI24 .set __movstrSI24, __movmemSI24 __movmemSI24: mov.l @(20,r5),r0 mov.l r0,@(20,r4) .global __movmemSI20 .global __movstrSI20 .set __movstrSI20, __movmemSI20 __movmemSI20: mov.l @(16,r5),r0 mov.l r0,@(16,r4) .global __movmemSI16 .global __movstrSI16 .set __movstrSI16, __movmemSI16 __movmemSI16: mov.l @(12,r5),r0 mov.l r0,@(12,r4) .global __movmemSI12 .global __movstrSI12 .set __movstrSI12, __movmemSI12 __movmemSI12: mov.l @(8,r5),r0 mov.l r0,@(8,r4) .global __movmemSI8 .global __movstrSI8 .set __movstrSI8, __movmemSI8 __movmemSI8: mov.l @(4,r5),r0 mov.l r0,@(4,r4) .global __movmemSI4 .global __movstrSI4 .set __movstrSI4, __movmemSI4 __movmemSI4: mov.l @(0,r5),r0 rts mov.l r0,@(0,r4) .global __movmem_i4_even .global __movstr_i4_even .set __movstr_i4_even, __movmem_i4_even .global __movmem_i4_odd .global __movstr_i4_odd .set __movstr_i4_odd, __movmem_i4_odd .global __movmemSI12_i4 .global __movstrSI12_i4 .set __movstrSI12_i4, __movmemSI12_i4 .p2align 5 L_movmem_2mod4_end: mov.l r0,@(16,r4) rts mov.l r1,@(20,r4) .p2align 2 __movmem_i4_even: mov.l @r5+,r0 bra L_movmem_start_even mov.l @r5+,r1 __movmem_i4_odd: mov.l @r5+,r1 add #-4,r4 mov.l @r5+,r2 mov.l @r5+,r3 mov.l r1,@(4,r4) mov.l r2,@(8,r4) L_movmem_loop: mov.l r3,@(12,r4) dt r6 mov.l @r5+,r0 bt/s L_movmem_2mod4_end mov.l @r5+,r1 add #16,r4 L_movmem_start_even: mov.l @r5+,r2 mov.l @r5+,r3 mov.l r0,@r4 dt r6 mov.l r1,@(4,r4) bf/s L_movmem_loop mov.l r2,@(8,r4) rts mov.l r3,@(12,r4) .p2align 4 __movmemSI12_i4: mov.l @r5,r0 mov.l @(4,r5),r1 mov.l @(8,r5),r2 mov.l r0,@r4 mov.l r1,@(4,r4) rts mov.l r2,@(8,r4)
4ms/stm32mp1-baremetal
1,797
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/arm/mach-sunxi/rmr_switch.S
@ @ ARMv8 RMR reset sequence on Allwinner SoCs. @ @ All 64-bit capable Allwinner SoCs reset in AArch32 (and continue to @ exectute the Boot ROM in this state), so we need to switch to AArch64 @ at some point. @ Section G6.2.133 of the ARMv8 ARM describes the Reset Management Register @ (RMR), which triggers a warm-reset of a core and can request to switch @ into a different execution state (AArch32 or AArch64). @ The address at which execution starts after the reset is held in the @ RVBAR system register, which is architecturally read-only. @ Allwinner provides a writable alias of this register in MMIO space, so @ we can easily set the start address of AArch64 code. @ This code below switches to AArch64 and starts execution at the specified @ start address. It needs to be assembled by an ARM(32) assembler and @ the machine code must be inserted as verbatim .word statements into the @ beginning of the AArch64 U-Boot code. @ To get the encoded bytes, use: @ ${CROSS_COMPILE}gcc -c -o rmr_switch.o rmr_switch.S @ ${CROSS_COMPILE}objdump -d rmr_switch.o @ @ The resulting words should be inserted into the U-Boot file at @ arch/arm/include/asm/arch-sunxi/boot0.h. @ @ This file is not build by the U-Boot build system, but provided only as a @ reference and to be able to regenerate a (probably fixed) version of this @ code found in encoded form in boot0.h. #include <config.h> .text #ifndef CONFIG_MACH_SUN50I_H6 ldr r1, =0x017000a0 @ MMIO mapped RVBAR[0] register #else ldr r1, =0x09010040 @ MMIO mapped RVBAR[0] register #endif ldr r0, =0x57aA7add @ start address, to be replaced str r0, [r1] dsb sy isb sy mrc 15, 0, r0, cr12, cr0, 2 @ read RMR register orr r0, r0, #3 @ request reset in AArch64 mcr 15, 0, r0, cr12, cr0, 2 @ write RMR register isb sy 1: wfi b 1b
4ms/stm32mp1-baremetal
1,930
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/arm/mach-rmobile/lowlevel_init_gen3.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * arch/arm/cpu/armv8/rcar_gen3/lowlevel_init.S * This file is lowlevel initialize routine. * * (C) Copyright 2015 Renesas Electronics Corporation * * This file is based on the arch/arm/cpu/armv8/start.S * * (C) Copyright 2013 * David Feng <fenghua@phytium.com.cn> */ #include <asm-offsets.h> #include <config.h> #include <linux/linkage.h> #include <asm/macro.h> .align 8 .globl rcar_atf_boot_args rcar_atf_boot_args: .dword 0 .dword 0 .dword 0 .dword 0 ENTRY(save_boot_params) adr x8, rcar_atf_boot_args stp x0, x1, [x8], #16 stp x2, x3, [x8], #16 b save_boot_params_ret ENDPROC(save_boot_params) ENTRY(lowlevel_init) mov x29, lr /* Save LR */ #ifndef CONFIG_ARMV8_MULTIENTRY /* * For single-entry systems the lowlevel init is very simple. */ ldr x0, =GICD_BASE bl gic_init_secure #else /* CONFIG_ARMV8_MULTIENTRY is set */ #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3) branch_if_slave x0, 1f ldr x0, =GICD_BASE bl gic_init_secure 1: #if defined(CONFIG_GICV3) ldr x0, =GICR_BASE bl gic_init_secure_percpu #elif defined(CONFIG_GICV2) ldr x0, =GICD_BASE ldr x1, =GICC_BASE bl gic_init_secure_percpu #endif #endif branch_if_master x0, x1, 2f /* * Slave should wait for master clearing spin table. * This sync prevent salves observing incorrect * value of spin table and jumping to wrong place. */ #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3) #ifdef CONFIG_GICV2 ldr x0, =GICC_BASE #endif bl gic_wait_for_interrupt #endif /* * All slaves will enter EL2 and optionally EL1. */ adr x4, lowlevel_in_el2 ldr x5, =ES_TO_AARCH64 bl armv8_switch_to_el2 lowlevel_in_el2: #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 adr x4, lowlevel_in_el1 ldr x5, =ES_TO_AARCH64 bl armv8_switch_to_el1 lowlevel_in_el1: #endif #endif /* CONFIG_ARMV8_MULTIENTRY */ bl s_init 2: mov lr, x29 /* Restore LR */ ret ENDPROC(lowlevel_init)
4ms/stm32mp1-baremetal
1,776
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/arm/mach-rmobile/lowlevel_init_ca15.S
/* SPDX-License-Identifier: GPL-2.0 */ /* * arch/arm/cpu/armv7/rmobile/lowlevel_init_ca15.S * This file is lager low level initialize. * * Copyright (C) 2013, 2014 Renesas Electronics Corporation */ #include <config.h> #include <linux/linkage.h> ENTRY(lowlevel_init) #ifndef CONFIG_SPL_BUILD mrc p15, 0, r4, c0, c0, 5 /* mpidr */ orr r4, r4, r4, lsr #6 and r4, r4, #7 /* id 0-3 = ca15.0,1,2,3 */ b do_lowlevel_init .pool /* * CPU ID #1-#3 come here */ .align 4 do_cpu_waiting: ldr r1, =0xe6180000 /* sysc */ 1: ldr r0, [r1, #0x20] /* sbar */ tst r0, r0 beq 1b bx r0 /* * Only CPU ID #0 comes here */ .align 4 do_lowlevel_init: ldr r2, =0xFF000044 /* PRR */ ldr r1, [r2] and r1, r1, #0x7F00 lsrs r1, r1, #8 cmp r1, #0x4C /* 0x4C is ID of r8a7794 */ beq _enable_actlr_smp /* surpress wfe if ca15 */ tst r4, #4 mrceq p15, 0, r0, c1, c0, 1 /* actlr */ orreq r0, r0, #(1<<7) mcreq p15, 0, r0, c1, c0, 1 /* and set l2 latency */ mrc p15, 0, r0, c0, c0, 5 /* r0 = MPIDR */ and r0, r0, #0xf00 lsr r0, r0, #8 tst r0, #1 /* only need for cluster 0 */ bne _exit_init_l2_a15 mrc p15, 1, r0, c9, c0, 2 /* r0 = L2CTLR */ and r1, r0, #7 cmp r1, #3 /* has already been set up */ bicne r0, r0, #0xe7 orrne r0, r0, #0x83 /* L2CTLR[7:6] + L2CTLR[2:0] */ #if defined(CONFIG_R8A7790) orrne r0, r0, #0x20 /* L2CTLR[5] */ #endif mcrne p15, 1, r0, c9, c0, 2 b _exit_init_l2_a15 _enable_actlr_smp: /* R8A7794 only (CA7) */ #ifndef CONFIG_DCACHE_OFF mrc p15, 0, r0, c1, c0, 1 orr r0, r0, #0x40 mcr p15, 0, r0, c1, c0, 1 #endif _exit_init_l2_a15: ldr r3, =(CONFIG_SYS_INIT_SP_ADDR) sub sp, r3, #4 str lr, [sp] /* initialize system */ bl s_init ldr lr, [sp] #endif mov pc, lr nop ENDPROC(lowlevel_init) .ltorg
4ms/stm32mp1-baremetal
1,834
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/arm/mach-omap2/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Board specific setup info * * (C) Copyright 2010 * Texas Instruments, <www.ti.com> * * Author : * Aneesh V <aneesh@ti.com> */ #include <config.h> #include <asm/arch/omap.h> #include <asm/omap_common.h> #include <asm/arch/spl.h> #include <linux/linkage.h> .arch_extension sec #ifdef CONFIG_SPL ENTRY(save_boot_params) ldr r1, =OMAP_SRAM_SCRATCH_BOOT_PARAMS str r0, [r1] b save_boot_params_ret ENDPROC(save_boot_params) #if !defined(CONFIG_TI_SECURE_DEVICE) && defined(CONFIG_ARMV7_LPAE) ENTRY(switch_to_hypervisor) /* * Switch to hypervisor mode */ adr r0, save_sp str sp, [r0] adr r1, restore_from_hyp ldr r0, =0x102 b omap_smc1 restore_from_hyp: adr r0, save_sp ldr sp, [r0] MRC p15, 4, R0, c1, c0, 0 ldr r1, =0X1004 @Set cache enable bits for hypervisor mode orr r0, r0, r1 MCR p15, 4, R0, c1, c0, 0 b switch_to_hypervisor_ret save_sp: .word 0x0 ENDPROC(switch_to_hypervisor) #endif #endif ENTRY(omap_smc1) push {r4-r12, lr} @ save registers - ROM code may pollute @ our registers mov r12, r0 @ Service mov r0, r1 @ Argument dsb dmb smc 0 @ SMC #0 to enter monitor mode @ call ROM Code API for the service requested pop {r4-r12, pc} ENDPROC(omap_smc1) ENTRY(omap_smc_sec) push {r4-r12, lr} @ save registers - ROM code may pollute @ our registers mov r6, #0xFF @ Indicate new Task call mov r12, #0x00 @ Secure Service ID in R12 dsb dmb smc 0 @ SMC #0 to enter monitor mode b omap_smc_sec_end @ exit at end of the service execution nop @ In case of IRQ happening in Secure, then ARM will branch here. @ At that moment, IRQ will be pending and ARM will jump to Non Secure @ IRQ handler mov r12, #0xFE dsb dmb smc 0 @ SMC #0 to enter monitor mode omap_smc_sec_end: pop {r4-r12, pc} ENDPROC(omap_smc_sec)
4ms/stm32mp1-baremetal
7,325
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/arm/mach-orion5x/lowlevel_init.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2010 Albert ARIBAUD <albert.u.boot@aribaud.net> * * (C) Copyright 2009 * Marvell Semiconductor <www.marvell.com> * Written-by: Prafulla Wadaskar <prafulla@marvell.com> */ #include <config.h> #include "asm/arch/orion5x.h" /* * Configuration values for SDRAM access setup */ #define SDRAM_CONFIG 0x3148400 #define SDRAM_MODE 0x62 #define SDRAM_CONTROL 0x4041000 #define SDRAM_TIME_CTRL_LOW 0x11602220 #define SDRAM_TIME_CTRL_HI 0x40c #define SDRAM_OPEN_PAGE_EN 0x0 /* DDR 1 2x 32M NANYA NT5DS16M16CS-6K ==> 64MB */ #define SDRAM_BANK0_SIZE 0x3ff0001 #define SDRAM_ADDR_CTRL 0x10 #define SDRAM_OP_NOP 0x05 #define SDRAM_OP_SETMODE 0x03 #define SDRAM_PAD_CTRL_WR_EN 0x80000000 #define SDRAM_PAD_CTRL_TUNE_EN 0x00010000 #define SDRAM_PAD_CTRL_DRVN_MASK 0x0000003f #define SDRAM_PAD_CTRL_DRVP_MASK 0x00000fc0 /* * For Guideline MEM-3 - Drive Strength value */ #define DDR1_PAD_STRENGTH_DEFAULT 0x00001000 #define SDRAM_PAD_CTRL_DRV_STR_MASK 0x00003000 /* * For Guideline MEM-4 - DQS Reference Delay Tuning */ #define MSAR_ARMDDRCLCK_MASK 0x000000f0 #define MSAR_ARMDDRCLCK_H_MASK 0x00000100 #define MSAR_ARMDDRCLCK_333_167 0x00000000 #define MSAR_ARMDDRCLCK_500_167 0x00000030 #define MSAR_ARMDDRCLCK_667_167 0x00000060 #define MSAR_ARMDDRCLCK_400_200_1 0x000001E0 #define MSAR_ARMDDRCLCK_400_200 0x00000010 #define MSAR_ARMDDRCLCK_600_200 0x00000050 #define MSAR_ARMDDRCLCK_800_200 0x00000070 #define FTDLL_DDR1_166MHZ 0x0047F001 #define FTDLL_DDR1_200MHZ 0x0044D001 /* * Low-level init happens right after start.S has switched to SVC32, * flushed and disabled caches and disabled MMU. We're still running * from the boot chip select, so the first thing SPL should do is to * set up the RAM to copy U-Boot into. */ .globl lowlevel_init lowlevel_init: #ifdef CONFIG_SPL_BUILD /* Use 'r2 as the base for internal register accesses */ ldr r2, =ORION5X_REGS_PHY_BASE /* move internal registers from the default 0xD0000000 * to their intended location, defined by SoC */ ldr r3, =0xD0000000 add r3, r3, #0x20000 str r2, [r3, #0x80] /* Use R3 as the base for DRAM registers */ add r3, r2, #0x01000 /*DDR SDRAM Initialization Control */ ldr r0, =0x00000001 str r0, [r3, #0x480] /* Use R3 as the base for PCI registers */ add r3, r2, #0x31000 /* Disable arbiter */ ldr r0, =0x00000030 str r0, [r3, #0xd00] /* Use R3 as the base for DRAM registers */ add r3, r2, #0x01000 /* set all dram windows to 0 */ mov r0, #0 str r0, [r3, #0x504] str r0, [r3, #0x50C] str r0, [r3, #0x514] str r0, [r3, #0x51C] /* 1) Configure SDRAM */ ldr r0, =SDRAM_CONFIG str r0, [r3, #0x400] /* 2) Set SDRAM Control reg */ ldr r0, =SDRAM_CONTROL str r0, [r3, #0x404] /* 3) Write SDRAM address control register */ ldr r0, =SDRAM_ADDR_CTRL str r0, [r3, #0x410] /* 4) Write SDRAM bank 0 size register */ ldr r0, =SDRAM_BANK0_SIZE str r0, [r3, #0x504] /* keep other banks disabled */ /* 5) Write SDRAM open pages control register */ ldr r0, =SDRAM_OPEN_PAGE_EN str r0, [r3, #0x414] /* 6) Write SDRAM timing Low register */ ldr r0, =SDRAM_TIME_CTRL_LOW str r0, [r3, #0x408] /* 7) Write SDRAM timing High register */ ldr r0, =SDRAM_TIME_CTRL_HI str r0, [r3, #0x40C] /* 8) Write SDRAM mode register */ /* The CPU must not attempt to change the SDRAM Mode register setting */ /* prior to DRAM controller completion of the DRAM initialization */ /* sequence. To guarantee this restriction, it is recommended that */ /* the CPU sets the SDRAM Operation register to NOP command, performs */ /* read polling until the register is back in Normal operation value, */ /* and then sets SDRAM Mode register to its new value. */ /* 8.1 write 'nop' to SDRAM operation */ ldr r0, =SDRAM_OP_NOP str r0, [r3, #0x418] /* 8.2 poll SDRAM operation until back in 'normal' mode. */ 1: ldr r0, [r3, #0x418] cmp r0, #0 bne 1b /* 8.3 Now its safe to write new value to SDRAM Mode register */ ldr r0, =SDRAM_MODE str r0, [r3, #0x41C] /* 8.4 Set new mode */ ldr r0, =SDRAM_OP_SETMODE str r0, [r3, #0x418] /* 8.5 poll SDRAM operation until back in 'normal' mode. */ 2: ldr r0, [r3, #0x418] cmp r0, #0 bne 2b /* DDR SDRAM Address/Control Pads Calibration */ ldr r0, [r3, #0x4C0] /* Set Bit [31] to make the register writable */ orr r0, r0, #SDRAM_PAD_CTRL_WR_EN str r0, [r3, #0x4C0] bic r0, r0, #SDRAM_PAD_CTRL_WR_EN bic r0, r0, #SDRAM_PAD_CTRL_TUNE_EN bic r0, r0, #SDRAM_PAD_CTRL_DRVN_MASK bic r0, r0, #SDRAM_PAD_CTRL_DRVP_MASK /* Get the final N locked value of driving strength [22:17] */ mov r1, r0 mov r1, r1, LSL #9 mov r1, r1, LSR #26 /* r1[5:0]<DrvN> = r3[22:17]<LockN> */ orr r1, r1, r1, LSL #6 /* r1[11:6]<DrvP> = r1[5:0]<DrvN> */ /* Write to both <DrvN> bits [5:0] and <DrvP> bits [11:6] */ orr r0, r0, r1 str r0, [r3, #0x4C0] /* DDR SDRAM Data Pads Calibration */ ldr r0, [r3, #0x4C4] /* Set Bit [31] to make the register writable */ orr r0, r0, #SDRAM_PAD_CTRL_WR_EN str r0, [r3, #0x4C4] bic r0, r0, #SDRAM_PAD_CTRL_WR_EN bic r0, r0, #SDRAM_PAD_CTRL_TUNE_EN bic r0, r0, #SDRAM_PAD_CTRL_DRVN_MASK bic r0, r0, #SDRAM_PAD_CTRL_DRVP_MASK /* Get the final N locked value of driving strength [22:17] */ mov r1, r0 mov r1, r1, LSL #9 mov r1, r1, LSR #26 orr r1, r1, r1, LSL #6 /* r1[5:0] = r3[22:17]<LockN> */ /* Write to both <DrvN> bits [5:0] and <DrvP> bits [11:6] */ orr r0, r0, r1 str r0, [r3, #0x4C4] /* Implement Guideline (GL# MEM-3) Drive Strength Value */ /* Relevant for: 88F5181-A1/B0/B1 and 88F5281-A0/B0 */ ldr r1, =DDR1_PAD_STRENGTH_DEFAULT /* Enable writes to DDR SDRAM Addr/Ctrl Pads Calibration register */ ldr r0, [r3, #0x4C0] orr r0, r0, #SDRAM_PAD_CTRL_WR_EN str r0, [r3, #0x4C0] /* Correct strength and disable writes again */ bic r0, r0, #SDRAM_PAD_CTRL_WR_EN bic r0, r0, #SDRAM_PAD_CTRL_DRV_STR_MASK orr r0, r0, r1 str r0, [r3, #0x4C0] /* Enable writes to DDR SDRAM Data Pads Calibration register */ ldr r0, [r3, #0x4C4] orr r0, r0, #SDRAM_PAD_CTRL_WR_EN str r0, [r3, #0x4C4] /* Correct strength and disable writes again */ bic r0, r0, #SDRAM_PAD_CTRL_DRV_STR_MASK bic r0, r0, #SDRAM_PAD_CTRL_WR_EN orr r0, r0, r1 str r0, [r3, #0x4C4] /* Implement Guideline (GL# MEM-4) DQS Reference Delay Tuning */ /* Relevant for: 88F5181-A1/B0/B1 and 88F5281-A0/B0 */ /* Get the "sample on reset" register for the DDR frequancy */ ldr r3, =0x10000 ldr r0, [r3, #0x010] ldr r1, =MSAR_ARMDDRCLCK_MASK and r1, r0, r1 ldr r0, =FTDLL_DDR1_166MHZ cmp r1, #MSAR_ARMDDRCLCK_333_167 beq 3f cmp r1, #MSAR_ARMDDRCLCK_500_167 beq 3f cmp r1, #MSAR_ARMDDRCLCK_667_167 beq 3f ldr r0, =FTDLL_DDR1_200MHZ cmp r1, #MSAR_ARMDDRCLCK_400_200_1 beq 3f cmp r1, #MSAR_ARMDDRCLCK_400_200 beq 3f cmp r1, #MSAR_ARMDDRCLCK_600_200 beq 3f cmp r1, #MSAR_ARMDDRCLCK_800_200 beq 3f ldr r0, =0 3: /* Use R3 as the base for DRAM registers */ add r3, r2, #0x01000 ldr r2, [r3, #0x484] orr r2, r2, r0 str r2, [r3, #0x484] /* enable for 2 GB DDR; detection should find out real amount */ sub r0, r0, r0 str r0, [r3, #0x500] ldr r0, =0x7fff0001 str r0, [r3, #0x504] #endif /* CONFIG_SPL_BUILD */ /* Return to U-Boot via saved link register */ mov pc, lr
4ms/stm32mp1-baremetal
3,407
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/arm/lib/relocate.S
/* SPDX-License-Identifier: GPL-2.0+ */ /* * relocate - common relocation function for ARM U-Boot * * Copyright (c) 2013 Albert ARIBAUD <albert.u.boot@aribaud.net> */ #include <asm-offsets.h> #include <asm/assembler.h> #include <config.h> #include <elf.h> #include <linux/linkage.h> #ifdef CONFIG_CPU_V7M #include <asm/armv7m.h> #endif /* * Default/weak exception vectors relocation routine * * This routine covers the standard ARM cases: normal (0x00000000), * high (0xffff0000) and VBAR. SoCs which do not comply with any of * the standard cases must provide their own, strong, version. */ .section .text.relocate_vectors,"ax",%progbits .weak relocate_vectors ENTRY(relocate_vectors) #ifdef CONFIG_CPU_V7M /* * On ARMv7-M we only have to write the new vector address * to VTOR register. */ ldr r0, [r9, #GD_RELOCADDR] /* r0 = gd->relocaddr */ ldr r1, =V7M_SCB_BASE str r0, [r1, V7M_SCB_VTOR] #else #ifdef CONFIG_HAS_VBAR /* * If the ARM processor has the security extensions, * use VBAR to relocate the exception vectors. */ ldr r0, [r9, #GD_RELOCADDR] /* r0 = gd->relocaddr */ mcr p15, 0, r0, c12, c0, 0 /* Set VBAR */ #else /* * Copy the relocated exception vectors to the * correct address * CP15 c1 V bit gives us the location of the vectors: * 0x00000000 or 0xFFFF0000. */ ldr r0, [r9, #GD_RELOCADDR] /* r0 = gd->relocaddr */ mrc p15, 0, r2, c1, c0, 0 /* V bit (bit[13]) in CP15 c1 */ ands r2, r2, #(1 << 13) ldreq r1, =0x00000000 /* If V=0 */ ldrne r1, =0xFFFF0000 /* If V=1 */ ldmia r0!, {r2-r8,r10} stmia r1!, {r2-r8,r10} ldmia r0!, {r2-r8,r10} stmia r1!, {r2-r8,r10} #endif #endif bx lr ENDPROC(relocate_vectors) /* * void relocate_code(addr_moni) * * This function relocates the monitor code. * * NOTE: * To prevent the code below from containing references with an R_ARM_ABS32 * relocation record type, we never refer to linker-defined symbols directly. * Instead, we declare literals which contain their relative location with * respect to relocate_code, and at run time, add relocate_code back to them. */ ENTRY(relocate_code) ldr r1, =__image_copy_start /* r1 <- SRC &__image_copy_start */ subs r4, r0, r1 /* r4 <- relocation offset */ beq relocate_done /* skip relocation */ ldr r2, =__image_copy_end /* r2 <- SRC &__image_copy_end */ copy_loop: ldmia r1!, {r10-r11} /* copy from source address [r1] */ stmia r0!, {r10-r11} /* copy to target address [r0] */ cmp r1, r2 /* until source end address [r2] */ blo copy_loop /* * fix .rel.dyn relocations */ ldr r2, =__rel_dyn_start /* r2 <- SRC &__rel_dyn_start */ ldr r3, =__rel_dyn_end /* r3 <- SRC &__rel_dyn_end */ fixloop: ldmia r2!, {r0-r1} /* (r0,r1) <- (SRC location,fixup) */ and r1, r1, #0xff cmp r1, #R_ARM_RELATIVE bne fixnext /* relative fix: increase location by offset */ add r0, r0, r4 ldr r1, [r0] add r1, r1, r4 str r1, [r0] fixnext: cmp r2, r3 blo fixloop relocate_done: #ifdef __XSCALE__ /* * On xscale, icache must be invalidated and write buffers drained, * even with cache disabled - 4.2.7 of xscale core developer's manual */ mcr p15, 0, r0, c7, c7, 0 /* invalidate icache */ mcr p15, 0, r0, c7, c10, 4 /* drain write buffer */ #endif /* ARMv4- don't know bx lr but the assembler fails to see that */ #ifdef __ARM_ARCH_4__ mov pc, lr #else bx lr #endif ENDPROC(relocate_code)
4ms/stm32mp1-baremetal
3,976
third-party/u-boot/u-boot-stm32mp1-baremetal/arch/arm/lib/div64.S
/* SPDX-License-Identifier: GPL-2.0 */ /* * linux/arch/arm/lib/div64.S * * Optimized computation of 64-bit dividend / 32-bit divisor * * Author: Nicolas Pitre * Created: Oct 5, 2003 * Copyright: Monta Vista Software, Inc. */ #include <linux/linkage.h> #include <asm/assembler.h> #ifdef __UBOOT__ #define UNWIND(x...) #endif #ifdef __ARMEB__ #define xh r0 #define xl r1 #define yh r2 #define yl r3 #else #define xl r0 #define xh r1 #define yl r2 #define yh r3 #endif /* * __do_div64: perform a division with 64-bit dividend and 32-bit divisor. * * Note: Calling convention is totally non standard for optimal code. * This is meant to be used by do_div() from include/asm/div64.h only. * * Input parameters: * xh-xl = dividend (clobbered) * r4 = divisor (preserved) * * Output values: * yh-yl = result * xh = remainder * * Clobbered regs: xl, ip */ .pushsection .text.__do_div64, "ax" ENTRY(__do_div64) UNWIND(.fnstart) @ Test for easy paths first. subs ip, r4, #1 bls 9f @ divisor is 0 or 1 tst ip, r4 beq 8f @ divisor is power of 2 @ See if we need to handle upper 32-bit result. cmp xh, r4 mov yh, #0 blo 3f @ Align divisor with upper part of dividend. @ The aligned divisor is stored in yl preserving the original. @ The bit position is stored in ip. #if __LINUX_ARM_ARCH__ >= 5 clz yl, r4 clz ip, xh sub yl, yl, ip mov ip, #1 mov ip, ip, lsl yl mov yl, r4, lsl yl #else mov yl, r4 mov ip, #1 1: cmp yl, #0x80000000 cmpcc yl, xh movcc yl, yl, lsl #1 movcc ip, ip, lsl #1 bcc 1b #endif @ The division loop for needed upper bit positions. @ Break out early if dividend reaches 0. 2: cmp xh, yl orrcs yh, yh, ip subscs xh, xh, yl movsne ip, ip, lsr #1 mov yl, yl, lsr #1 bne 2b @ See if we need to handle lower 32-bit result. 3: cmp xh, #0 mov yl, #0 cmpeq xl, r4 movlo xh, xl retlo lr @ The division loop for lower bit positions. @ Here we shift remainer bits leftwards rather than moving the @ divisor for comparisons, considering the carry-out bit as well. mov ip, #0x80000000 4: movs xl, xl, lsl #1 adcs xh, xh, xh beq 6f cmpcc xh, r4 5: orrcs yl, yl, ip subcs xh, xh, r4 movs ip, ip, lsr #1 bne 4b ret lr @ The top part of remainder became zero. If carry is set @ (the 33th bit) this is a false positive so resume the loop. @ Otherwise, if lower part is also null then we are done. 6: bcs 5b cmp xl, #0 reteq lr @ We still have remainer bits in the low part. Bring them up. #if __LINUX_ARM_ARCH__ >= 5 clz xh, xl @ we know xh is zero here so... add xh, xh, #1 mov xl, xl, lsl xh mov ip, ip, lsr xh #else 7: movs xl, xl, lsl #1 mov ip, ip, lsr #1 bcc 7b #endif @ Current remainder is now 1. It is worthless to compare with @ divisor at this point since divisor can not be smaller than 3 here. @ If possible, branch for another shift in the division loop. @ If no bit position left then we are done. movs ip, ip, lsr #1 mov xh, #1 bne 4b ret lr 8: @ Division by a power of 2: determine what that divisor order is @ then simply shift values around #if __LINUX_ARM_ARCH__ >= 5 clz ip, r4 rsb ip, ip, #31 #else mov yl, r4 cmp r4, #(1 << 16) mov ip, #0 movhs yl, yl, lsr #16 movhs ip, #16 cmp yl, #(1 << 8) movhs yl, yl, lsr #8 addhs ip, ip, #8 cmp yl, #(1 << 4) movhs yl, yl, lsr #4 addhs ip, ip, #4 cmp yl, #(1 << 2) addhi ip, ip, #3 addls ip, ip, yl, lsr #1 #endif mov yh, xh, lsr ip mov yl, xl, lsr ip rsb ip, ip, #32 ARM( orr yl, yl, xh, lsl ip ) THUMB( lsl xh, xh, ip ) THUMB( orr yl, yl, xh ) mov xh, xl, lsl ip mov xh, xh, lsr ip ret lr @ eq -> division by 1: obvious enough... 9: moveq yl, xl moveq yh, xh moveq xh, #0 reteq lr UNWIND(.fnend) UNWIND(.fnstart) UNWIND(.pad #4) UNWIND(.save {lr}) Ldiv0_64: @ Division by 0: str lr, [sp, #-8]! bl __div0 @ as wrong as it could be... mov yl, #0 mov yh, #0 mov xh, #0 ldr pc, [sp], #8 UNWIND(.fnend) ENDPROC(__do_div64) .popsection