8 #include <linux/errno.h>
9 #include <linux/sched.h>
10 #include <linux/kernel.h>
12 #include <linux/stddef.h>
14 #include <linux/ptrace.h>
17 #include <linux/screen_info.h>
22 #include <linux/kdev_t.h>
24 #include <linux/string.h>
32 #include <linux/module.h>
35 #include <asm/processor.h>
36 #include <asm/oplib.h>
38 #include <asm/pgtable.h>
39 #include <asm/idprom.h>
42 #include <asm/mmu_context.h>
43 #include <asm/timer.h>
44 #include <asm/sections.h>
45 #include <asm/setup.h>
48 #include <asm/btext.h>
51 #include <asm/cacheflush.h>
79 prom_console_write(
struct console *
con,
const char *
s,
unsigned n)
87 static struct console prom_early_console = {
89 .write = prom_console_write,
98 static void __init process_switch(
char c)
114 printk(
"BOOT: Ignoring P-Cache force option.\n");
123 printk(
"Unknown boot switch (-%c)\n", c);
132 while (*commands && *commands ==
' ')
136 if (*commands ==
'\0')
138 if (*commands ==
'-') {
140 while (*commands && *commands !=
' ')
141 process_switch(*commands++);
144 if (!
strncmp(commands,
"mem=", 4)) {
151 if (*commands ==
'K' || *commands ==
'k') {
154 }
else if (*commands==
'M' || *commands==
'm') {
159 while (*commands && *commands !=
' ')
167 #define RAMDISK_IMAGE_START_MASK 0x07FF
168 #define RAMDISK_PROMPT_FLAG 0x8000
169 #define RAMDISK_LOAD_FLAG 0x4000
188 __asm__ (
"rdpr %%ver, %0" :
"=r" (ver));
210 insns = &p->
sun4v[0];
217 *(
unsigned int *) (addr + 0) = insns[0];
219 __asm__ __volatile__(
"flush %0" : :
"r" (addr + 0));
221 *(
unsigned int *) (addr + 4) = insns[1];
223 __asm__ __volatile__(
"flush %0" : :
"r" (addr + 4));
225 *(
unsigned int *) (addr + 8) = insns[2];
227 __asm__ __volatile__(
"flush %0" : :
"r" (addr + 8));
229 *(
unsigned int *) (addr + 12) = insns[3];
231 __asm__ __volatile__(
"flush %0" : :
"r" (addr + 12));
240 while (start < end) {
243 *(
unsigned int *) (addr + 0) = start->
insn;
245 __asm__ __volatile__(
"flush %0" : :
"r" (addr + 0));
254 while (start < end) {
257 *(
unsigned int *) (addr + 0) = start->
insns[0];
259 __asm__ __volatile__(
"flush %0" : :
"r" (addr + 0));
261 *(
unsigned int *) (addr + 4) = start->
insns[1];
263 __asm__ __volatile__(
"flush %0" : :
"r" (addr + 4));
285 static void __init popc_patch(
void)
290 p3 = &__popc_3insn_patch;
291 while (p3 < &__popc_3insn_patch_end) {
294 for (i = 0; i < 3; i++) {
295 *(
unsigned int *) (addr + (i * 4)) = p3->
insns[i];
297 __asm__ __volatile__(
"flush %0"
298 : :
"r" (addr + (i * 4)));
304 p6 = &__popc_6insn_patch;
305 while (p6 < &__popc_6insn_patch_end) {
306 unsigned long i, addr = p6->
addr;
308 for (i = 0; i < 6; i++) {
309 *(
unsigned int *) (addr + (i * 4)) = p6->
insns[i];
311 __asm__ __volatile__(
"flush %0"
312 : :
"r" (addr + (i * 4)));
319 static void __init pause_patch(
void)
323 p = &__pause_3insn_patch;
324 while (p < &__pause_3insn_patch_end) {
325 unsigned long i, addr = p->
addr;
327 for (i = 0; i < 3; i++) {
328 *(
unsigned int *) (addr + (i * 4)) = p->
insns[i];
330 __asm__ __volatile__(
"flush %0"
331 : :
"r" (addr + (i * 4)));
341 prom_printf(
"Serious problem, boot cpu id (%d) >= NR_CPUS (%d)\n",
353 static const char *hwcaps[] = {
354 "flush",
"stbar",
"swap",
"muldiv",
"v9",
355 "ultra3",
"blkinit",
"n2",
360 "mul32",
"div32",
"fsmuld",
"v8plus",
"popc",
"vis",
"vis2",
361 "ASIBlkInit",
"fmaf",
"vis3",
"hpc",
"random",
"trans",
"fjfmau",
362 "ima",
"cspare",
"pause",
"cbcond",
365 static const char *crypto_hwcaps[] = {
366 "aes",
"des",
"kasumi",
"camellia",
"md5",
"sha1",
"sha256",
367 "sha512",
"mpmul",
"montmul",
"montsqr",
"crc32c",
377 unsigned long bit = 1
UL <<
i;
380 printed ?
"," :
"", hwcaps[i]);
387 __asm__ __volatile__(
"rd %%asr26, %0" :
"=r" (cfr));
388 for (i = 0; i <
ARRAY_SIZE(crypto_hwcaps); i++) {
389 unsigned long bit = 1
UL <<
i;
392 printed ?
"," :
"", crypto_hwcaps[i]);
400 static void __init report_one_hwcap(
int *printed,
const char *
name)
405 (*printed) ?
"," :
"", name);
406 if (++(*printed) == 8) {
412 static void __init report_crypto_hwcaps(
int *printed)
417 __asm__ __volatile__(
"rd %%asr26, %0" :
"=r" (cfr));
419 for (i = 0; i <
ARRAY_SIZE(crypto_hwcaps); i++) {
420 unsigned long bit = 1
UL <<
i;
422 report_one_hwcap(printed, crypto_hwcaps[i]);
426 static void __init report_hwcaps(
unsigned long caps)
431 unsigned long bit = 1
UL <<
i;
433 report_one_hwcap(&printed, hwcaps[i]);
436 report_crypto_hwcaps(&printed);
441 static unsigned long __init mdesc_cpu_hwcap_list(
void)
444 unsigned long caps = 0;
465 unsigned long bit = 1
UL <<
i;
467 if (!
strcmp(prop, hwcaps[i])) {
472 for (i = 0; i <
ARRAY_SIZE(crypto_hwcaps); i++) {
473 if (!
strcmp(prop, crypto_hwcaps[i]))
474 caps |= HWCAP_SPARC_CRYPTO;
490 static void __init init_sparc64_elf_hwcap(
void)
493 unsigned long mdesc_caps;
498 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 ||
499 sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
500 sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
501 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
502 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
504 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
505 sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
506 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
507 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
513 mdesc_caps = mdesc_cpu_hwcap_list();
520 unsigned long impl,
ver;
522 __asm__ __volatile__(
"rdpr %%ver, %0" :
"=r" (ver));
523 impl = ((ver >> 32) & 0xffff);
528 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1)
530 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
531 sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
532 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
533 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
537 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
538 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
539 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
544 sparc64_elf_hwcap = cap | mdesc_caps;
546 report_hwcaps(sparc64_elf_hwcap);
561 boot_flags_init(*cmdline_p);
562 #ifdef CONFIG_EARLYFB
572 #ifdef CONFIG_DUMMY_CONSOLE
580 ROOT_DEV = old_decode_dev(root_dev);
581 #ifdef CONFIG_BLK_DEV_RAM
602 #if defined(CONFIG_IP_PNP_BOOTP) || defined(CONFIG_IP_PNP_RARP)
613 init_sparc64_elf_hwcap();
630 int stop_a_enabled = 1;