2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
5 * Louis Hamilton, Red Hat, Inc.
6 * hamilton@redhat.com [MIPS64 modifications]
8 * Based on Ocelot Linux port, which is
9 * Copyright 2001 MontaVista Software Inc.
10 * Author: jsun@mvista.com or jsun@junsun.net
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
17 * Added changes for SMP - Manish Lachwani (lachwani@pmc-sierra.com)
19 #include <linux/init.h>
21 #include <linux/sched.h>
22 #include <linux/bootmem.h>
23 #include <linux/mv643xx.h>
25 #include <asm/addrspace.h>
26 #include <asm/bootinfo.h>
29 #include "jaguar_atx_fpga.h"
31 extern void ja_setup_console(void);
33 struct callvectors *debug_vectors;
35 extern unsigned long cpu_clock;
37 const char *get_system_type(void)
39 return "Momentum Jaguar-ATX";
44 unsigned long signext(unsigned long addr)
47 return (unsigned long)((int)addr);
50 void *get_arg(unsigned long args, int arc)
53 unsigned char *puc, uc;
56 ul = (unsigned long)signext(args);
57 puc = (unsigned char *)ul;
61 #ifdef CONFIG_CPU_LITTLE_ENDIAN
63 l = (unsigned long)uc;
65 ul |= (((unsigned long)uc) << 8);
67 ul |= (((unsigned long)uc) << 16);
69 ul |= (((unsigned long)uc) << 24);
72 ul = ((unsigned long)uc) << 24;
74 ul |= (((unsigned long)uc) << 16);
76 ul |= (((unsigned long)uc) << 8);
78 ul |= ((unsigned long)uc);
85 char *arg64(unsigned long addrin, int arg_index)
90 args = signext(addrin);
91 p = (char *)get_arg(args, arg_index);
95 #endif /* CONFIG_64BIT */
97 /* PMON passes arguments in C main() style */
98 void __init prom_init(void)
101 char **arg = (char **) fw_arg1;
102 char **env = (char **) fw_arg2;
103 struct callvectors *cv = (struct callvectors *) fw_arg3;
106 #ifdef CONFIG_SERIAL_8250_CONSOLE
107 // ja_setup_console(); /* The very first thing. */
113 printk("Mips64 Jaguar-ATX\n");
114 /* save the PROM vectors for debugging use */
115 debug_vectors = (struct callvectors *)signext((unsigned long)cv);
117 /* arg[0] is "g", the rest is boot parameters */
118 arcs_cmdline[0] = '\0';
120 for (i = 1; i < argc; i++) {
121 ptr = (char *)arg64((unsigned long)arg, i);
122 if ((strlen(arcs_cmdline) + strlen(ptr) + 1) >=
123 sizeof(arcs_cmdline))
125 strcat(arcs_cmdline, ptr);
126 strcat(arcs_cmdline, " ");
131 ptr = (char *)arg64((unsigned long)env, i);
135 if (strncmp("gtbase", ptr, strlen("gtbase")) == 0) {
136 marvell_base = simple_strtol(ptr + strlen("gtbase="),
139 if ((marvell_base & 0xffffffff00000000) == 0)
140 marvell_base |= 0xffffffff00000000;
142 printk("marvell_base set to 0x%016lx\n", marvell_base);
144 if (strncmp("cpuclock", ptr, strlen("cpuclock")) == 0) {
145 cpu_clock = simple_strtol(ptr + strlen("cpuclock="),
147 printk("cpu_clock set to %d\n", cpu_clock);
151 printk("arcs_cmdline: %s\n", arcs_cmdline);
153 #else /* CONFIG_64BIT */
154 /* save the PROM vectors for debugging use */
157 /* arg[0] is "g", the rest is boot parameters */
158 arcs_cmdline[0] = '\0';
159 for (i = 1; i < argc; i++) {
160 if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
161 >= sizeof(arcs_cmdline))
163 strcat(arcs_cmdline, arg[i]);
164 strcat(arcs_cmdline, " ");
168 if (strncmp("gtbase", *env, strlen("gtbase")) == 0) {
169 marvell_base = simple_strtol(*env + strlen("gtbase="),
172 if (strncmp("cpuclock", *env, strlen("cpuclock")) == 0) {
173 cpu_clock = simple_strtol(*env + strlen("cpuclock="),
178 #endif /* CONFIG_64BIT */
179 mips_machgroup = MACH_GROUP_MOMENCO;
180 mips_machtype = MACH_MOMENCO_JAGUAR_ATX;
183 void __init prom_free_prom_memory(void)
187 void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
191 int prom_boot_secondary(int cpu, unsigned long sp, unsigned long gp)
193 /* Clear the semaphore */
194 *(volatile uint32_t *)(0xbb000a68) = 0x80000000;
199 void prom_init_secondary(void)
201 clear_c0_config(CONF_CM_CMASK);
204 clear_c0_status(ST0_IM);
205 set_c0_status(0x1ffff);
208 void prom_smp_finish(void)