0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _ASM_UV_GEO_H
0011 #define _ASM_UV_GEO_H
0012
0013
0014
0015
0016 #define GEOID_SIZE 8
0017
0018
0019 struct geo_common_s {
0020 unsigned char type;
0021 unsigned char blade;
0022 unsigned char slot;
0023 unsigned char upos;
0024 unsigned char rack;
0025 };
0026
0027
0028 struct geo_node_s {
0029 struct geo_common_s common;
0030 };
0031
0032 struct geo_rtr_s {
0033 struct geo_common_s common;
0034 };
0035
0036 struct geo_iocntl_s {
0037 struct geo_common_s common;
0038 };
0039
0040 struct geo_pcicard_s {
0041 struct geo_iocntl_s common;
0042 char bus;
0043 char slot;
0044 };
0045
0046
0047 struct geo_cpu_s {
0048 struct geo_node_s node;
0049 unsigned char socket:4,
0050 thread:4;
0051 unsigned char core;
0052 };
0053
0054 struct geo_mem_s {
0055 struct geo_node_s node;
0056 char membus;
0057 char memslot;
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
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