| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | * | 
| Russ Anderson | 5b9021b | 2005-08-17 10:00:00 -0700 | [diff] [blame] | 6 | * Copyright (C) 1992 - 1997, 2000-2005 Silicon Graphics, Inc. All rights reserved. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  | 
| Mark Goodwin | 0985ea8 | 2005-04-25 13:21:54 -0700 | [diff] [blame] | 21 | #define MAX_SLOTS	0xf	/* slots per module */ | 
|  | 22 | #define MAX_SLABS	0xf	/* slabs per slot */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 |  | 
|  | 24 | typedef unsigned char	geo_type_t; | 
|  | 25 |  | 
|  | 26 | /* Fields common to all substructures */ | 
| Mark Goodwin | 0985ea8 | 2005-04-25 13:21:54 -0700 | [diff] [blame] | 27 | typedef struct geo_common_s { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | moduleid_t	module;		/* The module (box) this h/w lives in */ | 
|  | 29 | geo_type_t	type;		/* What type of h/w is named by this geoid_t */ | 
| Mark Goodwin | 0985ea8 | 2005-04-25 13:21:54 -0700 | [diff] [blame] | 30 | slabid_t	slab:4;		/* slab (ASIC), 0 .. 15 within slot */ | 
|  | 31 | slotid_t	slot:4;		/* slot (Blade), 0 .. 15 within module */ | 
|  | 32 | } geo_common_t; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 |  | 
|  | 34 | /* Additional fields for particular types of hardware */ | 
|  | 35 | typedef struct geo_node_s { | 
| Mark Goodwin | 0985ea8 | 2005-04-25 13:21:54 -0700 | [diff] [blame] | 36 | geo_common_t	common;		/* No additional fields needed */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | } geo_node_t; | 
|  | 38 |  | 
|  | 39 | typedef struct geo_rtr_s { | 
| Mark Goodwin | 0985ea8 | 2005-04-25 13:21:54 -0700 | [diff] [blame] | 40 | geo_common_t	common;		/* No additional fields needed */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | } geo_rtr_t; | 
|  | 42 |  | 
|  | 43 | typedef struct geo_iocntl_s { | 
| Mark Goodwin | 0985ea8 | 2005-04-25 13:21:54 -0700 | [diff] [blame] | 44 | geo_common_t	common;		/* No additional fields needed */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | } geo_iocntl_t; | 
|  | 46 |  | 
|  | 47 | typedef struct geo_pcicard_s { | 
| Mark Goodwin | 0985ea8 | 2005-04-25 13:21:54 -0700 | [diff] [blame] | 48 | geo_iocntl_t	common; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | char		bus;	/* Bus/widget number */ | 
|  | 50 | char		slot;	/* PCI slot number */ | 
|  | 51 | } geo_pcicard_t; | 
|  | 52 |  | 
|  | 53 | /* Subcomponents of a node */ | 
|  | 54 | typedef struct geo_cpu_s { | 
|  | 55 | geo_node_t	node; | 
|  | 56 | char	slice;		/* Which CPU on the node */ | 
|  | 57 | } geo_cpu_t; | 
|  | 58 |  | 
|  | 59 | typedef struct geo_mem_s { | 
|  | 60 | geo_node_t	node; | 
|  | 61 | char	membus;		/* The memory bus on the node */ | 
|  | 62 | char	memslot;	/* The memory slot on the bus */ | 
|  | 63 | } geo_mem_t; | 
|  | 64 |  | 
|  | 65 |  | 
|  | 66 | typedef union geoid_u { | 
| Mark Goodwin | 0985ea8 | 2005-04-25 13:21:54 -0700 | [diff] [blame] | 67 | geo_common_t	common; | 
|  | 68 | geo_node_t		node; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | geo_iocntl_t	iocntl; | 
|  | 70 | geo_pcicard_t	pcicard; | 
| Mark Goodwin | 0985ea8 | 2005-04-25 13:21:54 -0700 | [diff] [blame] | 71 | geo_rtr_t		rtr; | 
|  | 72 | geo_cpu_t		cpu; | 
|  | 73 | geo_mem_t		mem; | 
|  | 74 | char		padsize[GEOID_SIZE]; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | } geoid_t; | 
|  | 76 |  | 
|  | 77 |  | 
|  | 78 | /* Preprocessor macros */ | 
|  | 79 |  | 
|  | 80 | #define GEO_MAX_LEN	48	/* max. formatted length, plus some pad: | 
|  | 81 | module/001c07/slab/5/node/memory/2/slot/4 */ | 
|  | 82 |  | 
|  | 83 | /* Values for geo_type_t */ | 
|  | 84 | #define GEO_TYPE_INVALID	0 | 
|  | 85 | #define GEO_TYPE_MODULE		1 | 
|  | 86 | #define GEO_TYPE_NODE		2 | 
|  | 87 | #define GEO_TYPE_RTR		3 | 
|  | 88 | #define GEO_TYPE_IOCNTL		4 | 
|  | 89 | #define GEO_TYPE_IOCARD		5 | 
|  | 90 | #define GEO_TYPE_CPU		6 | 
|  | 91 | #define GEO_TYPE_MEM		7 | 
|  | 92 | #define GEO_TYPE_MAX		(GEO_TYPE_MEM+1) | 
|  | 93 |  | 
|  | 94 | /* Parameter for hwcfg_format_geoid_compt() */ | 
|  | 95 | #define GEO_COMPT_MODULE	1 | 
|  | 96 | #define GEO_COMPT_SLAB		2 | 
|  | 97 | #define GEO_COMPT_IOBUS		3 | 
|  | 98 | #define GEO_COMPT_IOSLOT	4 | 
|  | 99 | #define GEO_COMPT_CPU		5 | 
|  | 100 | #define GEO_COMPT_MEMBUS	6 | 
|  | 101 | #define GEO_COMPT_MEMSLOT	7 | 
|  | 102 |  | 
|  | 103 | #define GEO_INVALID_STR		"<invalid>" | 
|  | 104 |  | 
|  | 105 | #define INVALID_NASID           ((nasid_t)-1) | 
|  | 106 | #define INVALID_CNODEID         ((cnodeid_t)-1) | 
|  | 107 | #define INVALID_PNODEID         ((pnodeid_t)-1) | 
|  | 108 | #define INVALID_SLAB            (slabid_t)-1 | 
| Mark Goodwin | 0985ea8 | 2005-04-25 13:21:54 -0700 | [diff] [blame] | 109 | #define INVALID_SLOT            (slotid_t)-1 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | #define INVALID_MODULE          ((moduleid_t)-1) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 |  | 
|  | 112 | static inline slabid_t geo_slab(geoid_t g) | 
|  | 113 | { | 
| Mark Goodwin | 0985ea8 | 2005-04-25 13:21:54 -0700 | [diff] [blame] | 114 | return (g.common.type == GEO_TYPE_INVALID) ? | 
|  | 115 | INVALID_SLAB : g.common.slab; | 
|  | 116 | } | 
|  | 117 |  | 
|  | 118 | static inline slotid_t geo_slot(geoid_t g) | 
|  | 119 | { | 
|  | 120 | return (g.common.type == GEO_TYPE_INVALID) ? | 
|  | 121 | INVALID_SLOT : g.common.slot; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | } | 
|  | 123 |  | 
|  | 124 | static inline moduleid_t geo_module(geoid_t g) | 
|  | 125 | { | 
| Mark Goodwin | 0985ea8 | 2005-04-25 13:21:54 -0700 | [diff] [blame] | 126 | return (g.common.type == GEO_TYPE_INVALID) ? | 
|  | 127 | INVALID_MODULE : g.common.module; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | } | 
|  | 129 |  | 
|  | 130 | extern geoid_t cnodeid_get_geoid(cnodeid_t cnode); | 
|  | 131 |  | 
|  | 132 | #endif /* _ASM_IA64_SN_GEO_H */ |