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) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
10 #include <linux/types.h>
11 #include <linux/slab.h>
12 #include <linux/bootmem.h>
13 #include <asm/sn/sgi.h>
14 #include <asm/sn/io.h>
15 #include <asm/sn/iograph.h>
16 #include <asm/sn/invent.h>
17 #include <asm/sn/hcl.h>
18 #include <asm/sn/labelcl.h>
19 #include <asm/sn/sn_private.h>
20 #include <asm/sn/klconfig.h>
21 #include <asm/sn/sn_cpuid.h>
23 extern cpuid_t master_procid;
26 extern xwidgetnum_t hub_widget_id(nasid_t);
28 /* XXX - Move the meat of this to intr.c ? */
30 * Set up the platform-dependent fields in the nodepda.
32 void init_platform_nodepda(nodepda_t *npda, cnodeid_t node)
36 extern void router_map_init(nodepda_t *);
37 extern void router_queue_init(nodepda_t *,cnodeid_t);
38 extern void intr_init_vecblk(nodepda_t *, cnodeid_t, int);
40 /* Allocate per-node platform-dependent data */
41 hubinfo = (hubinfo_t)alloc_bootmem_node(NODE_DATA(node), sizeof(struct hubinfo_s));
43 npda->pdinfo = (void *)hubinfo;
44 hubinfo->h_nodepda = npda;
45 hubinfo->h_cnodeid = node;
47 spin_lock_init(&hubinfo->h_crblock);
49 npda->xbow_peer = INVALID_NASID;
52 * Initialize the linked list of
53 * router info pointers to the dependent routers
55 npda->npda_rip_first = NULL;
58 * npda_rip_last always points to the place
59 * where the next element is to be inserted
62 npda->npda_rip_last = &npda->npda_rip_first;
63 npda->geoid.any.type = GEO_TYPE_INVALID;
65 init_MUTEX_LOCKED(&npda->xbow_sema); /* init it locked? */
69 init_platform_hubinfo(nodepda_t **nodepdaindr) {
74 for (cnode = 0; cnode < numionodes; cnode++) {
75 npda = nodepdaindr[cnode];
76 hubinfo = (hubinfo_t)npda->pdinfo;
77 hubinfo->h_nasid = COMPACT_TO_NASID_NODEID(cnode);
78 /* For TIO the following returns -1 */
79 hubinfo->h_widgetid = hub_widget_id(hubinfo->h_nasid);
84 update_node_information(cnodeid_t cnodeid)
86 nodepda_t *npda = NODEPDA(cnodeid);
87 nodepda_router_info_t *npda_rip;
89 /* Go through the list of router info
90 * structures and copy some frequently
91 * accessed info from the info hanging
92 * off the corresponding router vertices
94 npda_rip = npda->npda_rip_first;
96 if (npda_rip->router_infop) {
97 npda_rip->router_portmask =
98 npda_rip->router_infop->ri_portmask;
99 npda_rip->router_slot =
100 npda_rip->router_infop->ri_slotnum;
102 /* No router, no ports. */
103 npda_rip->router_portmask = 0;
105 npda_rip = npda_rip->router_next;