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 extern void router_map_init(nodepda_t *);
35 extern void router_queue_init(nodepda_t *,cnodeid_t);
36 extern void intr_init_vecblk(nodepda_t *, cnodeid_t, int);
38 /* Allocate per-node platform-dependent data */
40 nasid = COMPACT_TO_NASID_NODEID(node);
41 if (node >= numnodes) /* Headless/memless IO nodes */
42 hubinfo = (hubinfo_t)alloc_bootmem_node(NODE_DATA(0), sizeof(struct hubinfo_s));
44 hubinfo = (hubinfo_t)alloc_bootmem_node(NODE_DATA(node), sizeof(struct hubinfo_s));
46 npda->pdinfo = (void *)hubinfo;
47 hubinfo->h_nodepda = npda;
48 hubinfo->h_cnodeid = node;
50 spin_lock_init(&hubinfo->h_crblock);
52 npda->xbow_peer = INVALID_NASID;
55 * Initialize the linked list of
56 * router info pointers to the dependent routers
58 npda->npda_rip_first = NULL;
61 * npda_rip_last always points to the place
62 * where the next element is to be inserted
65 npda->npda_rip_last = &npda->npda_rip_first;
66 npda->geoid.any.type = GEO_TYPE_INVALID;
68 init_MUTEX_LOCKED(&npda->xbow_sema); /* init it locked? */
72 init_platform_hubinfo(nodepda_t **nodepdaindr)
77 extern int numionodes;
79 if (IS_RUNNING_ON_SIMULATOR())
81 for (cnode = 0; cnode < numionodes; cnode++) {
82 npda = nodepdaindr[cnode];
83 hubinfo = (hubinfo_t)npda->pdinfo;
84 hubinfo->h_nasid = COMPACT_TO_NASID_NODEID(cnode);
85 hubinfo->h_widgetid = hub_widget_id(hubinfo->h_nasid);
90 update_node_information(cnodeid_t cnodeid)
92 nodepda_t *npda = NODEPDA(cnodeid);
93 nodepda_router_info_t *npda_rip;
95 /* Go through the list of router info
96 * structures and copy some frequently
97 * accessed info from the info hanging
98 * off the corresponding router vertices
100 npda_rip = npda->npda_rip_first;
102 if (npda_rip->router_infop) {
103 npda_rip->router_portmask =
104 npda_rip->router_infop->ri_portmask;
105 npda_rip->router_slot =
106 npda_rip->router_infop->ri_slotnum;
108 /* No router, no ports. */
109 npda_rip->router_portmask = 0;
111 npda_rip = npda_rip->router_next;