1 /* $Id$ 2 * 3 * This file is subject to the terms and conditions of the GNU General Public 4 * License. See the file "COPYING" in the main directory of this archive 5 * for more details. 6 * 7 * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved. 8 */ 9 10 #ifndef __SYS_SN_SN2_GEO_H__ 11 #define __SYS_SN_SN2_GEO_H__ 12 13 /* Headers required by declarations in this file */ 14 15 #include <asm/sn/slotnum.h> 16 17 18 /* The geoid_t implementation below is based loosely on the pcfg_t 19 implementation in sys/SN/promcfg.h. */ 20 21 /* Type declaractions */ 22 23 /* Size of a geoid_t structure (must be before decl. of geoid_u) */ 24 #define GEOID_SIZE 8 /* Would 16 be better? The size can 25 be different on different platforms. */ 26 27 #define MAX_SLABS 0xe /* slabs per module */ 28 29 typedef unsigned char geo_type_t; 30 31 /* Fields common to all substructures */ 32 typedef struct geo_any_s { 33 moduleid_t module; /* The module (box) this h/w lives in */ 34 geo_type_t type; /* What type of h/w is named by this geoid_t */ 35 slabid_t slab; /* The logical assembly within the module */ 36 } geo_any_t; 37 38 /* Additional fields for particular types of hardware */ 39 typedef struct geo_node_s { 40 geo_any_t any; /* No additional fields needed */ 41 } geo_node_t; 42 43 typedef struct geo_rtr_s { 44 geo_any_t any; /* No additional fields needed */ 45 } geo_rtr_t; 46 47 typedef struct geo_iocntl_s { 48 geo_any_t any; /* No additional fields needed */ 49 } geo_iocntl_t; 50 51 typedef struct geo_pcicard_s { 52 geo_iocntl_t any; 53 char bus; /* Bus/widget number */ 54 slotid_t slot; /* PCI slot number */ 55 } geo_pcicard_t; 56 57 /* Subcomponents of a node */ 58 typedef struct geo_cpu_s { 59 geo_node_t node; 60 char slice; /* Which CPU on the node */ 61 } geo_cpu_t; 62 63 typedef struct geo_mem_s { 64 geo_node_t node; 65 char membus; /* The memory bus on the node */ 66 char memslot; /* The memory slot on the bus */ 67 } geo_mem_t; 68 69 70 typedef union geoid_u { 71 geo_any_t any; 72 geo_node_t node; 73 geo_iocntl_t iocntl; 74 geo_pcicard_t pcicard; 75 geo_rtr_t rtr; 76 geo_cpu_t cpu; 77 geo_mem_t mem; 78 char padsize[GEOID_SIZE]; 79 } geoid_t; 80 81 82 /* Preprocessor macros */ 83 84 #define GEO_MAX_LEN 48 /* max. formatted length, plus some pad: 85 module/001c07/slab/5/node/memory/2/slot/4 */ 86 87 /* Values for geo_type_t */ 88 #define GEO_TYPE_INVALID 0 89 #define GEO_TYPE_MODULE 1 90 #define GEO_TYPE_NODE 2 91 #define GEO_TYPE_RTR 3 92 #define GEO_TYPE_IOCNTL 4 93 #define GEO_TYPE_IOCARD 5 94 #define GEO_TYPE_CPU 6 95 #define GEO_TYPE_MEM 7 96 #define GEO_TYPE_MAX (GEO_TYPE_MEM+1) 97 98 /* Parameter for hwcfg_format_geoid_compt() */ 99 #define GEO_COMPT_MODULE 1 100 #define GEO_COMPT_SLAB 2 101 #define GEO_COMPT_IOBUS 3 102 #define GEO_COMPT_IOSLOT 4 103 #define GEO_COMPT_CPU 5 104 #define GEO_COMPT_MEMBUS 6 105 #define GEO_COMPT_MEMSLOT 7 106 107 #define GEO_INVALID_STR "<invalid>" 108 109 #endif /* __SYS_SN_SN2_GEO_H__ */ 110