[b599faa] | 1 | /* |
---|
| 2 | * start.S : RTEMS entry point |
---|
| 3 | * |
---|
| 4 | * Copyright (C) 1999 Eric Valette. valette@crf.canon.fr |
---|
| 5 | * |
---|
| 6 | * The license and distribution terms for this file may be |
---|
[0c875c6a] | 7 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 8 | * http://www.rtems.org/license/LICENSE. |
---|
[ac7af4a] | 9 | * |
---|
[b599faa] | 10 | * Modified for mvme3100 by T. Straumann, 2007. |
---|
| 11 | * |
---|
| 12 | */ |
---|
| 13 | |
---|
| 14 | #include <rtems/asm.h> |
---|
[84e59b7c] | 15 | #include <libcpu/powerpc-utility.h> |
---|
[b599faa] | 16 | |
---|
| 17 | #include <bspopts.h> |
---|
| 18 | |
---|
| 19 | #define SYNC \ |
---|
| 20 | sync; \ |
---|
| 21 | isync |
---|
| 22 | |
---|
| 23 | #define KERNELBASE 0x0 |
---|
| 24 | |
---|
[02d2330] | 25 | /* cannot include <bsp.h> from assembly :-( */ |
---|
| 26 | #ifndef BSP_8540_CCSR_BASE |
---|
| 27 | #define BSP_8540_CCSR_BASE 0xe1000000 |
---|
| 28 | #endif |
---|
| 29 | |
---|
| 30 | #define ERR_DISABLE_REG (BSP_8540_CCSR_BASE + 0x2e44) |
---|
| 31 | |
---|
[b599faa] | 32 | .text |
---|
| 33 | .globl __rtems_entry_point |
---|
| 34 | .type __rtems_entry_point,@function |
---|
| 35 | __rtems_entry_point: |
---|
| 36 | mr r31,r3 |
---|
| 37 | mr r30,r4 |
---|
| 38 | mr r29,r5 |
---|
| 39 | mr r28,r6 |
---|
| 40 | mr r27,r7 |
---|
[02d2330] | 41 | /* disable checking for memory-select errors; motload has all TLBs |
---|
| 42 | * mapping a possible larger area as memory (not-guarded, caching-enabled) |
---|
| 43 | * than actual physical memory is available. |
---|
| 44 | * In case of speculative loads this may cause 'memory-select' errors |
---|
[ac7af4a] | 45 | * which seem to raise 'core_fault_in' (found no description in |
---|
[02d2330] | 46 | * the manual but I experienced this problem). |
---|
| 47 | * Such errors (if HID1[RFXE] is clear) may *stall* execution |
---|
| 48 | * leading to mysterious 'hangs'. |
---|
| 49 | * Note: enabling HID1[RFXE] at this point makes no sense since |
---|
| 50 | * exceptions are not configured yet. Therefore we disable |
---|
| 51 | * memory-select errors. |
---|
| 52 | * Eventually (bspstart.c) we want to delete TLB entries for |
---|
| 53 | * which no physical memory is present. |
---|
| 54 | */ |
---|
| 55 | lis r3, ERR_DISABLE_REG@ha |
---|
| 56 | lwz r4, ERR_DISABLE_REG@l(r3) |
---|
| 57 | /* disable memory-select errors */ |
---|
| 58 | ori r4, r4, 1 |
---|
| 59 | stw r4, ERR_DISABLE_REG@l(r3) |
---|
[b599faa] | 60 | |
---|
| 61 | /* Use MotLoad's TLB setup for now; caches are on already */ |
---|
| 62 | bl __eabi /* setup EABI and SYSV environment */ |
---|
| 63 | bl zero_bss |
---|
| 64 | /* |
---|
| 65 | * restore original args |
---|
| 66 | */ |
---|
| 67 | mr r3,r31 |
---|
| 68 | mr r4,r30 |
---|
| 69 | mr r5,r29 |
---|
| 70 | mr r6,r28 |
---|
| 71 | mr r7,r27 |
---|
| 72 | bl save_boot_params |
---|
[6963b2e7] | 73 | |
---|
[84e59b7c] | 74 | /* |
---|
| 75 | * Initialize start stack. The stacks are statically allocated and |
---|
| 76 | * properly aligned. |
---|
| 77 | */ |
---|
| 78 | LA r1, _ISR_Stack_area_end |
---|
| 79 | subi r1, r1, PPC_DEFAULT_CACHE_LINE_SIZE |
---|
| 80 | li r0, 0 |
---|
| 81 | stw r0, 0(r1) |
---|
[6963b2e7] | 82 | |
---|
[b599faa] | 83 | /* |
---|
[ac7af4a] | 84 | * We are now in a environment that is totally independent from |
---|
[b599faa] | 85 | * bootloader setup. |
---|
| 86 | */ |
---|
[5eccbac] | 87 | /* pass result of 'save_boot_params' to 'boot_card' in R3 */ |
---|
[b599faa] | 88 | bl boot_card |
---|
| 89 | /* point of no return: reset board here ? */ |
---|