aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ia64/sn/geo.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-ia64/sn/geo.h')
-rw-r--r--include/asm-ia64/sn/geo.h124
1 files changed, 124 insertions, 0 deletions
diff --git a/include/asm-ia64/sn/geo.h b/include/asm-ia64/sn/geo.h
new file mode 100644
index 000000000000..f566343d25f8
--- /dev/null
+++ b/include/asm-ia64/sn/geo.h
@@ -0,0 +1,124 @@
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.
5 *
6 * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8
9#ifndef _ASM_IA64_SN_GEO_H
10#define _ASM_IA64_SN_GEO_H
11
12/* The geoid_t implementation below is based loosely on the pcfg_t
13 implementation in sys/SN/promcfg.h. */
14
15/* Type declaractions */
16
17/* Size of a geoid_t structure (must be before decl. of geoid_u) */
18#define GEOID_SIZE 8 /* Would 16 be better? The size can
19 be different on different platforms. */
20
21#define MAX_SLABS 0xe /* slabs per module */
22
23typedef unsigned char geo_type_t;
24
25/* Fields common to all substructures */
26typedef struct geo_any_s {
27 moduleid_t module; /* The module (box) this h/w lives in */
28 geo_type_t type; /* What type of h/w is named by this geoid_t */
29 slabid_t slab; /* The logical assembly within the module */
30} geo_any_t;
31
32/* Additional fields for particular types of hardware */
33typedef struct geo_node_s {
34 geo_any_t any; /* No additional fields needed */
35} geo_node_t;
36
37typedef struct geo_rtr_s {
38 geo_any_t any; /* No additional fields needed */
39} geo_rtr_t;
40
41typedef struct geo_iocntl_s {
42 geo_any_t any; /* No additional fields needed */
43} geo_iocntl_t;
44
45typedef struct geo_pcicard_s {
46 geo_iocntl_t any;
47 char bus; /* Bus/widget number */
48 char slot; /* PCI slot number */
49} geo_pcicard_t;
50
51/* Subcomponents of a node */
52typedef struct geo_cpu_s {
53 geo_node_t node;
54 char slice; /* Which CPU on the node */
55} geo_cpu_t;
56
57typedef struct geo_mem_s {
58 geo_node_t node;
59 char membus; /* The memory bus on the node */
60 char memslot; /* The memory slot on the bus */
61} geo_mem_t;
62
63
64typedef union geoid_u {
65 geo_any_t any;
66 geo_node_t node;
67 geo_iocntl_t iocntl;
68 geo_pcicard_t pcicard;
69 geo_rtr_t rtr;
70 geo_cpu_t cpu;
71 geo_mem_t mem;
72 char padsize[GEOID_SIZE];
73} geoid_t;
74
75
76/* Preprocessor macros */
77
78#define GEO_MAX_LEN 48 /* max. formatted length, plus some pad:
79 module/001c07/slab/5/node/memory/2/slot/4 */
80
81/* Values for geo_type_t */
82#define GEO_TYPE_INVALID 0
83#define GEO_TYPE_MODULE 1
84#define GEO_TYPE_NODE 2
85#define GEO_TYPE_RTR 3
86#define GEO_TYPE_IOCNTL 4
87#define GEO_TYPE_IOCARD 5
88#define GEO_TYPE_CPU 6
89#define GEO_TYPE_MEM 7
90#define GEO_TYPE_MAX (GEO_TYPE_MEM+1)
91
92/* Parameter for hwcfg_format_geoid_compt() */
93#define GEO_COMPT_MODULE 1
94#define GEO_COMPT_SLAB 2
95#define GEO_COMPT_IOBUS 3
96#define GEO_COMPT_IOSLOT 4
97#define GEO_COMPT_CPU 5
98#define GEO_COMPT_MEMBUS 6
99#define GEO_COMPT_MEMSLOT 7
100
101#define GEO_INVALID_STR "<invalid>"
102
103#define INVALID_NASID ((nasid_t)-1)
104#define INVALID_CNODEID ((cnodeid_t)-1)
105#define INVALID_PNODEID ((pnodeid_t)-1)
106#define INVALID_SLAB (slabid_t)-1
107#define INVALID_MODULE ((moduleid_t)-1)
108#define INVALID_PARTID ((partid_t)-1)
109
110static inline slabid_t geo_slab(geoid_t g)
111{
112 return (g.any.type == GEO_TYPE_INVALID) ?
113 INVALID_SLAB : g.any.slab;
114}
115
116static inline moduleid_t geo_module(geoid_t g)
117{
118 return (g.any.type == GEO_TYPE_INVALID) ?
119 INVALID_MODULE : g.any.module;
120}
121
122extern geoid_t cnodeid_get_geoid(cnodeid_t cnode);
123
124#endif /* _ASM_IA64_SN_GEO_H */