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
6 * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
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>
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)
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));
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;
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
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? */
68 init_platform_hubinfo(nodepda_t **nodepdaindr)
73 extern int numionodes;
75 if (IS_RUNNING_ON_SIMULATOR())
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);
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;
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;
104 /* No router, no ports. */
105 npda_rip->router_portmask = 0;
107 npda_rip = npda_rip->router_next;