Changeset 3debedec in mainline
- Timestamp:
- 2006-02-16T20:26:14Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ba52899
- Parents:
- 2a46e10
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ppc32/_link.ld.in
r2a46e10 r3debedec 12 12 13 13 SECTIONS { 14 .image 0x800000 00: AT (0x80000000) {14 .image 0x800000: AT (0x800000) { 15 15 ktext_start = .; 16 16 *(K_TEXT_START) … … 31 31 LONG(kdata_end - kdata_start); 32 32 hardcoded_load_address = .; 33 LONG(0x800000 00);33 LONG(0x800000); 34 34 *(.bss); /* uninitialized static variables */ 35 35 *(COMMON); /* global variables */ -
arch/ppc32/include/console.h
r2a46e10 r3debedec 30 30 #define __ppc32_CONSOLE_H__ 31 31 32 extern void ofw_ppc32_console_init(void);32 extern void ppc32_console_init(void); 33 33 34 34 #endif -
arch/ppc32/include/mm/memory_init.h
r2a46e10 r3debedec 33 33 34 34 size_t get_memory_size(void); 35 void preboot_read_config(void); 36 void ppc_init_zones(void); 35 37 36 38 #endif -
arch/ppc32/include/mm/page.h
r2a46e10 r3debedec 37 37 #define PAGE_SIZE FRAME_SIZE 38 38 39 #define KA2PA(x) (( (__address) (x)) - 0x80000000)40 #define PA2KA(x) (( (__address) (x)) + 0x80000000)39 #define KA2PA(x) ((__address)(x)) 40 #define PA2KA(x) ((__address)(x)) 41 41 42 42 #define PTL0_ENTRIES_ARCH 0 -
arch/ppc32/src/console.c
r2a46e10 r3debedec 31 31 #include <console/chardev.h> 32 32 #include <console/console.h> 33 #include <genarch/fb/fb.h> 33 34 34 /** Print one character.35 *36 * @param ch Character to be printed.37 */38 static void ofw_ppc32_putchar(chardev_t *d, const char ch)39 {40 ofw_putchar(ch);41 }42 43 static chardev_t ofw_ppc32_console;44 static chardev_operations_t ofw_ppc32_console_ops = {45 .write = ofw_ppc32_putchar46 };47 35 48 36 /** Initialize console to use ofw output */ 49 void ofw_ppc32_console_init(void)37 void ppc32_console_init(void) 50 38 { 51 chardev_initialize("ofw_out", &ofw_ppc32_console, &ofw_ppc32_console_ops);52 stdout = &ofw_ppc32_console;39 /* TODO: PCI detection etc. etc. - this is fine in PearPC for now */ 40 fb_init(0x84000000,800,600,4); 53 41 } -
arch/ppc32/src/mm/frame.c
r2a46e10 r3debedec 28 28 29 29 #include <arch/mm/frame.h> 30 #include <arch/mm/memory_init.h> 30 31 #include <mm/frame.h> 31 32 #include <config.h> … … 34 35 void frame_arch_init(void) 35 36 { 36 /* First page is exception vector, 37 * second is 'implementation specific', evade it too 38 */ 39 zone_create(0, SIZE2FRAMES(config.memory_size), 2, 0); 37 ppc_init_zones(); 38 /* First is exception vector, second is 'implementation specific' */ 40 39 frame_mark_unavailable(0, 2); 41 40 } -
arch/ppc32/src/mm/memory_init.c
r2a46e10 r3debedec 30 30 #include <genarch/ofw/ofw.h> 31 31 #include <panic.h> 32 #include <mm/frame.h> 33 #include <align.h> 32 34 33 35 #define MEMMAP_MAX_RECORDS 32 … … 38 40 } memmap_t; 39 41 40 size_t get_memory_size(void) 42 static memmap_t memmap[MEMMAP_MAX_RECORDS]; 43 size_t total_mem = 0; 44 45 static void init_memmap(void) 41 46 { 47 int i; 48 42 49 phandle handle = ofw_find_device("/memory"); 43 50 if (handle == -1) 44 51 panic("No RAM\n"); 45 52 46 memmap_t memmap[MEMMAP_MAX_RECORDS];47 53 size_t ret = ofw_get_property(handle, "reg", &memmap, sizeof(memmap)); 48 54 if (ret == -1) 49 55 panic("Device /memory has no reg property\n"); 50 56 51 size_t total = 0;52 int i;53 57 54 58 for (i = 0; i < MEMMAP_MAX_RECORDS; i++) { 55 59 if (memmap[i].size == 0) 56 60 break; 57 total += memmap[i].size;61 total_mem += memmap[i].size; 58 62 } 63 } 59 64 60 return total; 65 void preboot_read_config(void) 66 { 67 init_memmap(); 61 68 } 69 70 size_t get_memory_size(void) 71 { 72 return total_mem; 73 } 74 75 void ppc_init_zones(void) 76 { 77 int i; 78 pfn_t confdata; 79 80 for (i = 0; i < MEMMAP_MAX_RECORDS; i++) { 81 if (memmap[i].size == 0) 82 break; 83 confdata = ADDR2PFN(memmap[i].start); 84 if (confdata == 0) 85 confdata = 2; 86 zone_create(ADDR2PFN(memmap[i].start), 87 SIZE2FRAMES(ALIGN_DOWN(memmap[i].size,PAGE_SIZE)), 88 confdata, 0); 89 } 90 } -
arch/ppc32/src/ppc32.c
r2a46e10 r3debedec 32 32 void arch_pre_mm_init(void) 33 33 { 34 ofw_ppc32_console_init();34 ppc32_console_init(); 35 35 } 36 36 -
arch/ppc32/src/start.S
r2a46e10 r3debedec 28 28 29 29 #include <arch/asm/macro.h> 30 #include <arch/asm/spr.h> 30 31 31 32 .section K_TEXT_START … … 33 34 .global kernel_image_start 34 35 36 .org 0x0 37 /* 256 bytes of some data */ 38 /* exception table - must use 'ba' instructions for branches, 39 * because it is elsewhere than the linker thinks 40 */ 41 .space 4096 42 35 43 kernel_image_start: 44 /* Initialize OFW, might be needed before relocate_kernel? */ 36 45 lis r4, ofw@ha 37 46 addi r4, r4, ofw@l … … 39 48 40 49 bl ofw_init 50 bl preboot_read_config 51 52 bl relocate_kernel 53 __after_reloc: 54 /* Set stack to some more meaningful value */ 55 /* TODO: This is hardcoded for PearPC, must be changed later */ 56 lis r1, 0x70 57 b main_bsp 41 58 42 b main_bsp 59 relocate_kernel: 60 /* TODO: We _know_ that pearpc loads it to 8MB, and 61 * but it should be really generic 62 */ 63 lis r4, 0x80 /* r4 is where data was loaded - 8MB */ 64 65 bl to_real_mode 66 /* Now we are in real mode, copy first block and jump to it, 67 * we are running in the loaded kernel now 68 * We still have in r3 physical load kernel address 69 */ 70 71 b __after_reloc /* We know in pearpc we are ok, so return, 72 * otherwise we should relocate kernel 73 * here 74 */ 75 76 77 78 79 /* Turn off page translation 80 * - assume that physical-loaded address is in r4 81 */ 82 to_real_mode: 83 mflr r0 84 85 lis r5, ktext_start@ha // Expected start of kernel 86 addi r5, r5, ktext_start@l 87 88 add r0, r4, r0 89 sub r0, r0, r5 // r0 now contains physical return address 90 91 mfmsr r3 92 andis. r3, r3, (~MSR_DR | MSR_IR) >> 16 93 mtspr SPRN_SRR0, r0 94 mtspr SPRN_SRR1, r3 95 sync // Really needed? RFI should do it as well? 96 RFI 97 -
kernel.config
r2a46e10 r3debedec 46 46 47 47 # Framebuffer support 48 ! [ ARCH=mips32&MIPS_MACHINE=lgxemul] CONFIG_FB (y/n)48 ! [(ARCH=mips32&MIPS_MACHINE=lgxemul)|(ARCH=mips32&MIPS_MACHINE=bgxemul)] CONFIG_FB (y/n) 49 49 50 50 # Support for SMP
Note:
See TracChangeset
for help on using the changeset viewer.