3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
7 * Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved.
12 #include <linux/config.h>
13 #include <linux/types.h>
14 #include <asm/bitops.h>
16 extern void klgraph_init(void);
17 void bedrock_init(int);
18 void synergy_init(int, int);
19 void sys_fw_init (const char *args, int arglen, int bsp);
21 volatile int bootmaster=0; /* Used to pick bootmaster */
22 volatile int nasidmaster[128]={0}; /* Used to pick node/synergy masters */
26 #define get_bit(b,p) (((*p)>>(b))&1)
29 fmain(int lid, int bsp) {
33 * First lets figure out who we are. This is done from the
36 nasid = (lid>>16)&0xfff;
41 * Now pick a nasid master to initialize Bedrock registers.
43 if (test_and_set_bit(8, &nasidmaster[nasid]) == 0) {
45 test_and_set_bit(9, &nasidmaster[nasid]);
47 while (get_bit(9, &nasidmaster[nasid]) == 0);
51 * Now pick a BSP & finish init.
53 if (test_and_set_bit(0, &bootmaster) == 0) {
54 sys_fw_init(0, 0, bsp);
55 test_and_set_bit(1, &bootmaster);
57 while (get_bit(1, &bootmaster) == 0);
59 return (lid == bsp_lid);
64 bedrock_init(int nasid)
66 nasid = nasid; /* to quiet gcc */
69 * Undef if you need fprom to generate a 1 node klgraph
70 * information .. only works for 1 node for nasid 0.
78 synergy_init(int nasid, int syn)
84 * Enable all FSB flashed interrupts.
85 * I'd really like defines for this......
87 base = (long*)0x80000e0000000000LL; /* base of synergy regs */
88 for (off = 0x2a0; off < 0x2e0; off+=8) /* offset for VEC_MASK_{0-3}_A/B */
92 * Set the NASID in the FSB_CONFIG register.
94 base = (long*)0x80000e0000000450LL;
95 *base = (long)((nasid<<16)|(syn<<9));
99 /* Why isnt there a bcopy/memcpy in lib64.a */
102 memcpy(void * dest, const void *src, size_t count)
106 for(d=dest, s=(char*)src, se=s+count; s<se; s++, d++)