nodepda.h 3.68 KB
Newer Older
David Mosberger's avatar
David Mosberger committed
1
/*
Linus Torvalds's avatar
Linus Torvalds committed
2 3 4 5
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
Jesse Barnes's avatar
Jesse Barnes committed
6
 * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
Linus Torvalds's avatar
Linus Torvalds committed
7
 */
David Mosberger's avatar
David Mosberger committed
8 9
#ifndef _ASM_IA64_SN_NODEPDA_H
#define _ASM_IA64_SN_NODEPDA_H
Linus Torvalds's avatar
Linus Torvalds committed
10 11 12


#include <linux/config.h>
Jesse Barnes's avatar
Jesse Barnes committed
13
#include <asm/sn/sgi.h>
David Mosberger's avatar
David Mosberger committed
14
#include <asm/irq.h>
Linus Torvalds's avatar
Linus Torvalds committed
15 16
#include <asm/sn/intr.h>
#include <asm/sn/router.h>
David Mosberger's avatar
David Mosberger committed
17
#include <asm/sn/pda.h>
Linus Torvalds's avatar
Linus Torvalds committed
18
#include <asm/sn/module.h>
David Mosberger's avatar
David Mosberger committed
19 20
#include <asm/sn/bte.h>

Linus Torvalds's avatar
Linus Torvalds committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
/*
 * NUMA Node-Specific Data structures are defined in this file.
 * In particular, this is the location of the node PDA.
 * A pointer to the right node PDA is saved in each CPU PDA.
 */

/*
 * Node-specific data structure.
 *
 * One of these structures is allocated on each node of a NUMA system.
 *
 * This structure provides a convenient way of keeping together 
 * all per-node data structures. 
 */


Linus Torvalds's avatar
Linus Torvalds committed
37

Linus Torvalds's avatar
Linus Torvalds committed
38 39 40 41
struct nodepda_s {


	cpuid_t         node_first_cpu; /* Starting cpu number for node */
David Mosberger's avatar
David Mosberger committed
42 43 44
					/* WARNING: no guarantee that   */
					/*  the second cpu on a node is */
					/*  node_first_cpu+1.           */
Linus Torvalds's avatar
Linus Torvalds committed
45

Jesse Barnes's avatar
Jesse Barnes committed
46
	vertex_hdl_t 	xbow_vhdl;
Linus Torvalds's avatar
Linus Torvalds committed
47 48 49
	nasid_t		xbow_peer;	/* NASID of our peer hub on xbow */
	struct semaphore xbow_sema;	/* Sema for xbow synchronization */
	slotid_t	slotdesc;
Jesse Barnes's avatar
Jesse Barnes committed
50
	geoid_t		geoid;
Linus Torvalds's avatar
Linus Torvalds committed
51 52
	module_t	*module;	/* Pointer to containing module */
	xwidgetnum_t 	basew_id;
Jesse Barnes's avatar
Jesse Barnes committed
53
	vertex_hdl_t 	basew_xc;
Linus Torvalds's avatar
Linus Torvalds committed
54
	int		hubticks;
David Mosberger's avatar
David Mosberger committed
55
	int		num_routers;	/* XXX not setup! Total routers in the system */
Linus Torvalds's avatar
Linus Torvalds committed
56 57 58

	
	char		*hwg_node_name;	/* hwgraph node name */
Jesse Barnes's avatar
Jesse Barnes committed
59
	vertex_hdl_t	node_vertex;	/* Hwgraph vertex for this node */
Linus Torvalds's avatar
Linus Torvalds committed
60 61 62 63

	void 		*pdinfo;	/* Platform-dependent per-node info */


David Mosberger's avatar
David Mosberger committed
64 65
	nodepda_router_info_t	*npda_rip_first;
	nodepda_router_info_t	**npda_rip_last;
Linus Torvalds's avatar
Linus Torvalds committed
66 67 68 69 70


	/*
	 * The BTEs on this node are shared by the local cpus
	 */
Jesse Barnes's avatar
Jesse Barnes committed
71 72 73
	struct bteinfo_s	bte_if[BTES_PER_NODE];	/* Virtual Interface */
	struct timer_list	bte_recovery_timer;
	spinlock_t		bte_recovery_lock;
David Mosberger's avatar
David Mosberger committed
74 75 76 77 78 79

	/* 
	 * Array of pointers to the nodepdas for each node.
	 */
	struct nodepda_s	*pernode_pdaindr[MAX_COMPACT_NODES]; 

Linus Torvalds's avatar
Linus Torvalds committed
80 81 82 83
};

typedef struct nodepda_s nodepda_t;

David Mosberger's avatar
David Mosberger committed
84 85
struct irqpda_s {
	int num_irq_used;
Jesse Barnes's avatar
Jesse Barnes committed
86 87 88 89
	char irq_flags[NR_IRQS];
	struct pci_dev *device_dev[NR_IRQS];
	char share_count[NR_IRQS];
	struct pci_dev *current;
David Mosberger's avatar
David Mosberger committed
90 91 92 93
};

typedef struct irqpda_s irqpda_t;

Linus Torvalds's avatar
Linus Torvalds committed
94 95 96 97 98 99 100 101

/*
 * Access Functions for node PDA.
 * Since there is one nodepda for each node, we need a convenient mechanism
 * to access these nodepdas without cluttering code with #ifdefs.
 * The next set of definitions provides this.
 * Routines are expected to use 
 *
David Mosberger's avatar
David Mosberger committed
102 103
 *	nodepda			-> to access node PDA for the node on which code is running
 *	subnodepda		-> to access subnode PDA for the subnode on which code is running
Linus Torvalds's avatar
Linus Torvalds committed
104
 *
David Mosberger's avatar
David Mosberger committed
105 106
 *	NODEPDA(cnode)		-> to access node PDA for cnodeid 
 *	SUBNODEPDA(cnode,sn)	-> to access subnode PDA for cnodeid/subnode
Linus Torvalds's avatar
Linus Torvalds committed
107 108
 */

Jesse Barnes's avatar
Jesse Barnes committed
109
#define	nodepda		pda->p_nodepda		/* Ptr to this node's PDA */
David Mosberger's avatar
David Mosberger committed
110
#define	NODEPDA(cnode)		(nodepda->pernode_pdaindr[cnode])
Linus Torvalds's avatar
Linus Torvalds committed
111 112 113 114 115


/*
 * Macros to access data structures inside nodepda 
 */
Jesse Barnes's avatar
Jesse Barnes committed
116
#define NODE_MODULEID(cnode)    geo_module((NODEPDA(cnode)->geoid))
David Mosberger's avatar
David Mosberger committed
117
#define NODE_SLOTID(cnode)	(NODEPDA(cnode)->slotdesc)
Linus Torvalds's avatar
Linus Torvalds committed
118 119 120


/*
David Mosberger's avatar
David Mosberger committed
121
 * Quickly convert a compact node ID into a hwgraph vertex
Linus Torvalds's avatar
Linus Torvalds committed
122
 */
David Mosberger's avatar
David Mosberger committed
123
#define cnodeid_to_vertex(cnodeid) (NODEPDA(cnodeid)->node_vertex)
Linus Torvalds's avatar
Linus Torvalds committed
124 125 126


/*
David Mosberger's avatar
David Mosberger committed
127 128
 * Check if given a compact node id the corresponding node has all the
 * cpus disabled. 
Linus Torvalds's avatar
Linus Torvalds committed
129
 */
Jesse Barnes's avatar
Jesse Barnes committed
130 131
#define is_headless_node(cnode)		((cnode == CNODEID_NONE) ||			\
					 (node_data(cnode)->active_cpu_count == 0))
Linus Torvalds's avatar
Linus Torvalds committed
132 133

/*
David Mosberger's avatar
David Mosberger committed
134
 * Check if given a node vertex handle the corresponding node has all the
Linus Torvalds's avatar
Linus Torvalds committed
135 136 137 138 139 140
 * cpus disabled. 
 */
#define is_headless_node_vertex(_nodevhdl) \
			is_headless_node(nodevertex_to_cnodeid(_nodevhdl))


David Mosberger's avatar
David Mosberger committed
141
#endif /* _ASM_IA64_SN_NODEPDA_H */