|
|
1.1 root 1: /******************************************************************************
2: * Copyright (c) 2004, 2008 IBM Corporation
3: * All rights reserved.
4: * This program and the accompanying materials
5: * are made available under the terms of the BSD License
6: * which accompanies this distribution, and is available at
7: * http://www.opensource.org/licenses/bsd-license.php
8: *
9: * Contributors:
10: * IBM Corporation - initial implementation
11: *****************************************************************************/
12:
13: #include <macros.h>
14: #include <cpu.h>
15:
16: .text
17:
18: C_ENTRY(copy_from_flash)
19: # size in GPR3 (multiple of 64), from GPR4, to GPR5
20: mflr 24 ; mtctr 3 ; addi 4,4,-64 ; addi 5,5,-64
21: 0: SETCI(r0)
22: ldu 16,64(4) ; ld 17,8(4) ; ld 18,16(4) ; ld 19,24(4)
23: ld 20,32(4) ; ld 21,40(4) ; ld 22,48(4) ; ld 23,56(4)
24: CLRCI(r0)
25: stdu 16,64(5) ; std 17,8(5) ; std 18,16(5) ; std 19,24(5)
26: std 20,32(5) ; std 21,40(5) ; std 22,48(5) ; std 23,56(5)
27: sync ; icbi 0,2 ; bdnz 0b ; sync ; isync ; mtlr 24 ; blr
28:
29: /****************************************************************************
30: * prints one character to serial console
31: *
32: * Input:
33: * R3 - character
34: *
35: * Returns: -
36: *
37: * Modifies Registers:
38: * R3, R4, R5, R6, R7
39: ****************************************************************************/
40: ENTRY(io_putchar)
41: mflr r7
42:
43: SETCI(r0)
44:
45: # always use serial1
46: li 4,0x3f8 ; oris 4,4,0xf400
47:
48: # print one char
49: 0: lbz 0,5(4) ; andi. 0,0,0x20 ; beq 0b ; stb 3,0(4) ; eieio
50:
51: # also print char to serial2 if on a JS21
52: # read ID register: only if it is a PC87427 (JS21) also use serial2
53: addi 4,4,-0x3f8
54: li 5,0x20 ; stb 5,0x2e(4) ; lbz 5,0x2f(4) ; cmpdi 5,0xf2 ; bne 1f
55:
56: addi 4,4,0x2f8
57: 0: lbz 0,5(4) ; andi. 0,0,0x20 ; beq 0b ; stb 3,0(4) ; eieio
58:
59: 1: CLRCI(r0)
60:
61: mtlr r7
62: blr
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.