Blame view
arch/powerpc/boot/ps3.c
3.95 KB
bafdb6457 [POWERPC] PS3: Bo... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
/* * PS3 bootwrapper support. * * Copyright (C) 2007 Sony Computer Entertainment Inc. * Copyright 2007 Sony Corp. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <stdarg.h> #include <stddef.h> #include "types.h" #include "elf.h" #include "string.h" #include "stdio.h" #include "page.h" #include "ops.h" |
5761eaa3a [POWERPC] PS3: Bo... |
29 30 31 32 |
extern int lv1_panic(u64 in_1); extern int lv1_get_logical_partition_id(u64 *out_1); extern int lv1_get_logical_ppe_id(u64 *out_1); extern int lv1_get_repository_node_value(u64 in_1, u64 in_2, u64 in_3, |
bafdb6457 [POWERPC] PS3: Bo... |
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
u64 in_4, u64 in_5, u64 *out_1, u64 *out_2); #ifdef DEBUG #define DBG(fmt...) printf(fmt) #else static inline int __attribute__ ((format (printf, 1, 2))) DBG( const char *fmt, ...) {return 0;} #endif BSS_STACK(4096); /* A buffer that may be edited by tools operating on a zImage binary so as to * edit the command line passed to vmlinux (by setting /chosen/bootargs). * The buffer is put in it's own section so that tools may locate it easier. */ |
5761eaa3a [POWERPC] PS3: Bo... |
48 |
|
a2dd5da77 powerpc: Rename d... |
49 |
static char cmdline[BOOT_COMMAND_LINE_SIZE] |
bafdb6457 [POWERPC] PS3: Bo... |
50 51 52 53 54 |
__attribute__((__section__("__builtin_cmdline"))); static void prep_cmdline(void *chosen) { if (cmdline[0] == '\0') |
a2dd5da77 powerpc: Rename d... |
55 |
getprop(chosen, "bootargs", cmdline, BOOT_COMMAND_LINE_SIZE-1); |
bafdb6457 [POWERPC] PS3: Bo... |
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
else setprop_str(chosen, "bootargs", cmdline); printf("cmdline: '%s' ", cmdline); } static void ps3_console_write(const char *buf, int len) { } static void ps3_exit(void) { printf("ps3_exit "); /* lv1_panic will shutdown the lpar. */ lv1_panic(0); /* zero = do not reboot */ while (1); } static int ps3_repository_read_rm_size(u64 *rm_size) { |
5761eaa3a [POWERPC] PS3: Bo... |
80 |
int result; |
bafdb6457 [POWERPC] PS3: Bo... |
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
u64 lpar_id; u64 ppe_id; u64 v2; result = lv1_get_logical_partition_id(&lpar_id); if (result) return -1; result = lv1_get_logical_ppe_id(&ppe_id); if (result) return -1; /* * n1: 0000000062690000 : ....bi.. * n2: 7075000000000000 : pu...... * n3: 0000000000000001 : ........ * n4: 726d5f73697a6500 : rm_size. */ result = lv1_get_repository_node_value(lpar_id, 0x0000000062690000ULL, 0x7075000000000000ULL, ppe_id, 0x726d5f73697a6500ULL, rm_size, &v2); printf("%s:%d: ppe_id %lu ", __func__, __LINE__, (unsigned long)ppe_id); printf("%s:%d: lpar_id %lu ", __func__, __LINE__, (unsigned long)lpar_id); printf("%s:%d: rm_size %llxh ", __func__, __LINE__, *rm_size); return result ? -1 : 0; } void ps3_copy_vectors(void) { extern char __system_reset_kernel[]; |
5761eaa3a [POWERPC] PS3: Bo... |
121 122 |
memcpy((void *)0x100, __system_reset_kernel, 512); flush_cache((void *)0x100, 512); |
bafdb6457 [POWERPC] PS3: Bo... |
123 |
} |
5761eaa3a [POWERPC] PS3: Bo... |
124 |
void platform_init(unsigned long null_check) |
bafdb6457 [POWERPC] PS3: Bo... |
125 |
{ |
bafdb6457 [POWERPC] PS3: Bo... |
126 127 128 129 |
const u32 heapsize = 0x1000000 - (u32)_end; /* 16MiB */ void *chosen; unsigned long ft_addr; u64 rm_size; |
5761eaa3a [POWERPC] PS3: Bo... |
130 |
unsigned long val; |
bafdb6457 [POWERPC] PS3: Bo... |
131 132 133 134 135 136 137 138 139 |
console_ops.write = ps3_console_write; platform_ops.exit = ps3_exit; printf(" -- PS3 bootwrapper -- "); simple_alloc_init(_end, heapsize, 32, 64); |
2f0dfeaa8 [POWERPC] Use emb... |
140 |
fdt_init(_dtb_start); |
bafdb6457 [POWERPC] PS3: Bo... |
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
chosen = finddevice("/chosen"); ps3_repository_read_rm_size(&rm_size); dt_fixup_memory(0, rm_size); if (_initrd_end > _initrd_start) { setprop_val(chosen, "linux,initrd-start", (u32)(_initrd_start)); setprop_val(chosen, "linux,initrd-end", (u32)(_initrd_end)); } prep_cmdline(chosen); ft_addr = dt_ops.finalize(); ps3_copy_vectors(); printf(" flat tree at 0x%lx \r", ft_addr); |
5761eaa3a [POWERPC] PS3: Bo... |
160 161 162 163 164 |
val = *(unsigned long *)0; if (val != null_check) printf("null check failed: %lx != %lx \r", val, null_check); |
bafdb6457 [POWERPC] PS3: Bo... |
165 166 167 168 |
((kernel_entry_t)0)(ft_addr, 0, NULL); ps3_exit(); } |