initial commit with v2.6.9
[linux-2.6.9-moxart.git] / arch / ia64 / sn / io / sn2 / ml_SN_init.c
blob6de1ba85c473824e9f3ac50306150437e816dc1a
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
6 * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
7 */
9 #include <linux/types.h>
10 #include <linux/slab.h>
11 #include <linux/bootmem.h>
12 #include <asm/sn/sgi.h>
13 #include <asm/sn/io.h>
14 #include <asm/sn/hcl.h>
15 #include <asm/sn/labelcl.h>
16 #include <asm/sn/sn_private.h>
17 #include <asm/sn/klconfig.h>
18 #include <asm/sn/sn_cpuid.h>
19 #include <asm/sn/simulator.h>
21 int maxcpus;
23 extern xwidgetnum_t hub_widget_id(nasid_t);
25 /* XXX - Move the meat of this to intr.c ? */
27 * Set up the platform-dependent fields in the nodepda.
29 void init_platform_nodepda(nodepda_t *npda, cnodeid_t node)
31 hubinfo_t hubinfo;
32 nasid_t nasid;
34 /* Allocate per-node platform-dependent data */
36 nasid = cnodeid_to_nasid(node);
37 if (node >= numnodes) /* Headless/memless IO nodes */
38 hubinfo = (hubinfo_t)alloc_bootmem_node(NODE_DATA(0), sizeof(struct hubinfo_s));
39 else
40 hubinfo = (hubinfo_t)alloc_bootmem_node(NODE_DATA(node), sizeof(struct hubinfo_s));
42 npda->pdinfo = (void *)hubinfo;
43 hubinfo->h_nodepda = npda;
44 hubinfo->h_cnodeid = node;
46 spin_lock_init(&hubinfo->h_crblock);
48 npda->xbow_peer = INVALID_NASID;
50 /*
51 * Initialize the linked list of
52 * router info pointers to the dependent routers
54 npda->npda_rip_first = NULL;
57 * npda_rip_last always points to the place
58 * where the next element is to be inserted
59 * into the list
61 npda->npda_rip_last = &npda->npda_rip_first;
62 npda->geoid.any.type = GEO_TYPE_INVALID;
64 init_MUTEX_LOCKED(&npda->xbow_sema); /* init it locked? */
67 void
68 init_platform_hubinfo(nodepda_t **nodepdaindr)
70 cnodeid_t cnode;
71 hubinfo_t hubinfo;
72 nodepda_t *npda;
73 extern int numionodes;
75 if (IS_RUNNING_ON_SIMULATOR())
76 return;
77 for (cnode = 0; cnode < numionodes; cnode++) {
78 npda = nodepdaindr[cnode];
79 hubinfo = (hubinfo_t)npda->pdinfo;
80 hubinfo->h_nasid = cnodeid_to_nasid(cnode);
81 hubinfo->h_widgetid = hub_widget_id(hubinfo->h_nasid);
85 void
86 update_node_information(cnodeid_t cnodeid)
88 nodepda_t *npda = NODEPDA(cnodeid);
89 nodepda_router_info_t *npda_rip;
91 /* Go through the list of router info
92 * structures and copy some frequently
93 * accessed info from the info hanging
94 * off the corresponding router vertices
96 npda_rip = npda->npda_rip_first;
97 while(npda_rip) {
98 if (npda_rip->router_infop) {
99 npda_rip->router_portmask =
100 npda_rip->router_infop->ri_portmask;
101 npda_rip->router_slot =
102 npda_rip->router_infop->ri_slotnum;
103 } else {
104 /* No router, no ports. */
105 npda_rip->router_portmask = 0;
107 npda_rip = npda_rip->router_next;