Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later
0002  *
0003  * This file is subject to the terms and conditions of the GNU General Public
0004  * License.  See the file "COPYING" in the main directory of this archive
0005  * for more details.
0006  *
0007  * Copyright (C) 2020 Hewlett Packard Enterprise Development LP. All rights reserved.
0008  */
0009 
0010 #ifndef _ASM_UV_GEO_H
0011 #define _ASM_UV_GEO_H
0012 
0013 /* Type declarations */
0014 
0015 /* Size of a geoid_s structure (must be before decl. of geoid_u) */
0016 #define GEOID_SIZE  8
0017 
0018 /* Fields common to all substructures */
0019 struct geo_common_s {
0020     unsigned char type;     /* What type of h/w is named by this geoid_s */
0021     unsigned char blade;
0022     unsigned char slot;     /* slot is IRU */
0023     unsigned char upos;
0024     unsigned char rack;
0025 };
0026 
0027 /* Additional fields for particular types of hardware */
0028 struct geo_node_s {
0029     struct geo_common_s common;     /* No additional fields needed */
0030 };
0031 
0032 struct geo_rtr_s {
0033     struct geo_common_s common;     /* No additional fields needed */
0034 };
0035 
0036 struct geo_iocntl_s {
0037     struct geo_common_s common;     /* No additional fields needed */
0038 };
0039 
0040 struct geo_pcicard_s {
0041     struct geo_iocntl_s common;
0042     char bus;               /* Bus/widget number */
0043     char slot;              /* PCI slot number */
0044 };
0045 
0046 /* Subcomponents of a node */
0047 struct geo_cpu_s {
0048     struct geo_node_s node;
0049     unsigned char   socket:4,   /* Which CPU on the node */
0050             thread:4;
0051     unsigned char   core;
0052 };
0053 
0054 struct geo_mem_s {
0055     struct geo_node_s node;
0056     char membus;            /* The memory bus on the node */
0057     char memslot;           /* The memory slot on the bus */
0058 };
0059 
0060 union geoid_u {
0061     struct geo_common_s common;
0062     struct geo_node_s node;
0063     struct geo_iocntl_s iocntl;
0064     struct geo_pcicard_s pcicard;
0065     struct geo_rtr_s rtr;
0066     struct geo_cpu_s cpu;
0067     struct geo_mem_s mem;
0068     char padsize[GEOID_SIZE];
0069 };
0070 
0071 /* Defined constants */
0072 
0073 #define GEO_MAX_LEN 48
0074 
0075 #define GEO_TYPE_INVALID    0
0076 #define GEO_TYPE_MODULE     1
0077 #define GEO_TYPE_NODE       2
0078 #define GEO_TYPE_RTR        3
0079 #define GEO_TYPE_IOCNTL     4
0080 #define GEO_TYPE_IOCARD     5
0081 #define GEO_TYPE_CPU        6
0082 #define GEO_TYPE_MEM        7
0083 #define GEO_TYPE_MAX        (GEO_TYPE_MEM+1)
0084 
0085 static inline int geo_rack(union geoid_u g)
0086 {
0087     return (g.common.type == GEO_TYPE_INVALID) ?
0088         -1 : g.common.rack;
0089 }
0090 
0091 static inline int geo_slot(union geoid_u g)
0092 {
0093     return (g.common.type == GEO_TYPE_INVALID) ?
0094         -1 : g.common.upos;
0095 }
0096 
0097 static inline int geo_blade(union geoid_u g)
0098 {
0099     return (g.common.type == GEO_TYPE_INVALID) ?
0100         -1 : g.common.blade * 2 + g.common.slot;
0101 }
0102 
0103 #endif /* _ASM_UV_GEO_H */