1/*
2 * Copyright (c) 2004-2007 Voltaire Inc.  All rights reserved.
3 * Copyright (c) 2007 Xsigo Systems Inc.  All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses.  You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 *     Redistribution and use in source and binary forms, with or
12 *     without modification, are permitted provided that the following
13 *     conditions are met:
14 *
15 *      - Redistributions of source code must retain the above
16 *        copyright notice, this list of conditions and the following
17 *        disclaimer.
18 *
19 *      - Redistributions in binary form must reproduce the above
20 *        copyright notice, this list of conditions and the following
21 *        disclaimer in the documentation and/or other materials
22 *        provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 *
33 */
34
35#ifndef _GROUPING_H_
36#define _GROUPING_H_
37
38/*========================================================*/
39/*               FABRIC SCANNER SPECIFIC DATA             */
40/*========================================================*/
41
42#define SPINES_MAX_NUM 12
43#define LINES_MAX_NUM 36
44
45typedef struct ChassisList ChassisList;
46typedef struct AllChassisList AllChassisList;
47
48struct ChassisList {
49	ChassisList *next;
50	uint64_t chassisguid;
51	int chassisnum;
52	int chassistype;
53	int nodecount;		/* used for grouping by SystemImageGUID */
54	Node *spinenode[SPINES_MAX_NUM + 1];
55	Node *linenode[LINES_MAX_NUM + 1];
56};
57
58struct AllChassisList {
59	ChassisList *first;
60	ChassisList *current;
61	ChassisList *last;
62};
63
64/*========================================================*/
65/*                CHASSIS RECOGNITION SPECIFIC DATA       */
66/*========================================================*/
67
68/* Device IDs */
69#define VTR_DEVID_IB_FC_ROUTER		0x5a00
70#define VTR_DEVID_IB_IP_ROUTER		0x5a01
71#define VTR_DEVID_ISR9600_SPINE		0x5a02
72#define VTR_DEVID_ISR9600_LEAF		0x5a03
73#define VTR_DEVID_HCA1			0x5a04
74#define VTR_DEVID_HCA2			0x5a44
75#define VTR_DEVID_HCA3			0x6278
76#define VTR_DEVID_SW_6IB4		0x5a05
77#define VTR_DEVID_ISR9024		0x5a06
78#define VTR_DEVID_ISR9288		0x5a07
79#define VTR_DEVID_SLB24			0x5a09
80#define VTR_DEVID_SFB12			0x5a08
81#define VTR_DEVID_SFB4			0x5a0b
82#define VTR_DEVID_ISR9024_12		0x5a0c
83#define VTR_DEVID_SLB8			0x5a0d
84#define VTR_DEVID_RLX_SWITCH_BLADE	0x5a20
85#define VTR_DEVID_ISR9024_DDR		0x5a31
86#define VTR_DEVID_SFB12_DDR		0x5a32
87#define VTR_DEVID_SFB4_DDR		0x5a33
88#define VTR_DEVID_SLB24_DDR		0x5a34
89#define VTR_DEVID_SFB2012		0x5a37
90#define VTR_DEVID_SLB2024		0x5a38
91#define VTR_DEVID_ISR2012		0x5a39
92#define VTR_DEVID_SFB2004		0x5a40
93#define VTR_DEVID_ISR2004		0x5a41
94#define VTR_DEVID_SRB2004		0x5a42
95
96enum ChassisType { UNRESOLVED_CT, ISR9288_CT, ISR9096_CT, ISR2012_CT, ISR2004_CT };
97enum ChassisSlot { UNRESOLVED_CS, LINE_CS, SPINE_CS, SRBD_CS };
98
99/*========================================================*/
100/*                External interface                      */
101/*========================================================*/
102
103ChassisList *group_nodes();
104char *portmapstring(Port *port);
105char *get_chassis_type(unsigned char chassistype);
106char *get_chassis_slot(unsigned char chassisslot);
107uint64_t get_chassis_guid(unsigned char chassisnum);
108
109int is_xsigo_guid(uint64_t guid);
110int is_xsigo_tca(uint64_t guid);
111int is_xsigo_hca(uint64_t guid);
112
113#endif	/* _GROUPING_H_ */
114