klconfig.h
来自「优龙2410linux2.6.8内核源代码」· C头文件 代码 · 共 703 行 · 第 1/2 页
H
703 行
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Derived from IRIX <sys/SN/klconfig.h>. * * Copyright (C) 1992-1997,1999,2001-2003 Silicon Graphics, Inc. All Rights Reserved. * Copyright (C) 1999 by Ralf Baechle */#ifndef _ASM_IA64_SN_KLCONFIG_H#define _ASM_IA64_SN_KLCONFIG_H/* * The KLCONFIG structures store info about the various BOARDs found * during Hardware Discovery. In addition, it stores info about the * components found on the BOARDs. *//* * WARNING: * Certain assembly language routines (notably xxxxx.s) in the IP27PROM * will depend on the format of the data structures in this file. In * most cases, rearranging the fields can seriously break things. * Adding fields in the beginning or middle can also break things. * Add fields if necessary, to the end of a struct in such a way * that offsets of existing fields do not change. */#include <linux/types.h>#include <asm/sn/types.h>#include <asm/sn/slotnum.h>#include <asm/sn/router.h>#include <asm/sn/sgi.h>#include <asm/sn/addrs.h>#include <asm/sn/vector.h>#include <asm/sn/xtalk/xbow.h>#include <asm/sn/xtalk/xtalk.h>#include <asm/sn/kldir.h>#include <asm/sn/sn_fru.h>#include <asm/sn/sn2/shub_md.h>#include <asm/sn/geo.h>#define KLCFGINFO_MAGIC 0xbeedbabetypedef s32 klconf_off_t;#define MAX_MODULE_ID 255#define SIZE_PAD 4096 /* 4k padding for structures *//* * 1 NODE brick, 3 Router bricks (1 local, 1 meta, 1 repeater), * 6 XIO Widgets, 1 Xbow, 1 gfx */#define MAX_SLOTS_PER_NODE (1 + 3 + 6 + 1 + 1) /* XXX if each node is guranteed to have some memory */#define MAX_PCI_DEVS 8/* lboard_t->brd_flags fields *//* All bits in this field are currently used. Try the pad fields if you need more flag bits */#define ENABLE_BOARD 0x01#define FAILED_BOARD 0x02#define DUPLICATE_BOARD 0x04 /* Boards like midplanes/routers which are discovered twice. Use one of them */#define VISITED_BOARD 0x08 /* Used for compact hub numbering. */#define LOCAL_MASTER_IO6 0x10 /* master io6 for that node */#define KLTYPE_IOBRICK_XBOW (KLCLASS_MIDPLANE | 0x2)/* klinfo->flags fields */#define KLINFO_ENABLE 0x01 /* This component is enabled */#define KLINFO_FAILED 0x02 /* This component failed */#define KLINFO_DEVICE 0x04 /* This component is a device */#define KLINFO_VISITED 0x08 /* This component has been visited */#define KLINFO_CONTROLLER 0x10 /* This component is a device controller */#define KLINFO_INSTALL 0x20 /* Install a driver */#define KLINFO_HEADLESS 0x40 /* Headless (or hubless) component *//* Structures to manage various data storage areas *//* The numbers must be contiguous since the array index i is used in the code to allocate various areas. */#define BOARD_STRUCT 0#define COMPONENT_STRUCT 1#define ERRINFO_STRUCT 2#define KLMALLOC_TYPE_MAX (ERRINFO_STRUCT + 1)#define DEVICE_STRUCT 3typedef struct console_s { unsigned long uart_base; unsigned long config_base; unsigned long memory_base; short baud; short flag; int type; nasid_t nasid; char wid; char npci; nic_t baseio_nic;} console_t;typedef struct klc_malloc_hdr { klconf_off_t km_base; klconf_off_t km_limit; klconf_off_t km_current;} klc_malloc_hdr_t;/* Functions/macros needed to use this structure */typedef struct kl_config_hdr { u64 ch_magic; /* set this to KLCFGINFO_MAGIC */ u32 ch_version; /* structure version number */ klconf_off_t ch_malloc_hdr_off; /* offset of ch_malloc_hdr */ klconf_off_t ch_cons_off; /* offset of ch_cons */ klconf_off_t ch_board_info; /* the link list of boards */ console_t ch_cons_info; /* address info of the console */ klc_malloc_hdr_t ch_malloc_hdr[KLMALLOC_TYPE_MAX]; confidence_t ch_sw_belief; /* confidence that software is bad*/ confidence_t ch_sn0net_belief; /* confidence that sn0net is bad */} kl_config_hdr_t;#define KL_CONFIG_HDR(_nasid) ((kl_config_hdr_t *)(KLCONFIG_ADDR(_nasid)))#define NODE_OFFSET_TO_LBOARD(nasid,off) (lboard_t*)(NODE_CAC_BASE(nasid) + (off))#define KL_CONFIG_INFO(_nasid) root_lboard[nasid_to_cnodeid(_nasid)]/* --- New Macros for the changed kl_config_hdr_t structure --- */#define PTR_CH_CONS_INFO(_k) ((console_t *)\ ((unsigned long)_k + (_k->ch_cons_off)))#define KL_CONFIG_CH_CONS_INFO(_n) PTR_CH_CONS_INFO(KL_CONFIG_HDR(_n))/* ------------------------------------------------------------- */#define KL_CONFIG_DUPLICATE_BOARD(_brd) ((_brd)->brd_flags & DUPLICATE_BOARD)#define XBOW_PORT_TYPE_HUB(_xbowp, _link) \ ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_HUB)#define XBOW_PORT_TYPE_IO(_xbowp, _link) \ ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_IO)#define XBOW_PORT_IS_ENABLED(_xbowp, _link) \ ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_ENABLE)#define XBOW_PORT_NASID(_xbowp, _link) \ ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_nasid)#define XBOW_PORT_IO 0x1#define XBOW_PORT_HUB 0x2#define XBOW_PORT_ENABLE 0x4/* * The KLCONFIG area is organized as a LINKED LIST of BOARDs. A BOARD * can be either 'LOCAL' or 'REMOTE'. LOCAL means it is attached to * the LOCAL/current NODE. REMOTE means it is attached to a different * node.(TBD - Need a way to treat ROUTER boards.) * * There are 2 different structures to represent these boards - * lboard - Local board, rboard - remote board. These 2 structures * can be arbitrarily mixed in the LINKED LIST of BOARDs. (Refer * Figure below). The first byte of the rboard or lboard structure * is used to find out its type - no unions are used. * If it is a lboard, then the config info of this board will be found * on the local node. (LOCAL NODE BASE + offset value gives pointer to * the structure. * If it is a rboard, the local structure contains the node number * and the offset of the beginning of the LINKED LIST on the remote node. * The details of the hardware on a remote node can be built locally, * if required, by reading the LINKED LIST on the remote node and * ignoring all the rboards on that node. * * The local node uses the REMOTE NODE NUMBER + OFFSET to point to the * First board info on the remote node. The remote node list is * traversed as the local list, using the REMOTE BASE ADDRESS and not * the local base address and ignoring all rboard values. * * KLCONFIG +------------+ +------------+ +------------+ +------------+ | lboard | +-->| lboard | +-->| rboard | +-->| lboard | +------------+ | +------------+ | +------------+ | +------------+ | board info | | | board info | | |errinfo,bptr| | | board info | +------------+ | +------------+ | +------------+ | +------------+ | offset |--+ | offset |--+ | offset |--+ |offset=NULL | +------------+ +------------+ +------------+ +------------+ +------------+ | board info | +------------+ +--------------------------------+ | compt 1 |------>| type, rev, diaginfo, size ... | (CPU) +------------+ +--------------------------------+ | compt 2 |--+ +------------+ | +--------------------------------+ | ... | +--->| type, rev, diaginfo, size ... | (MEM_BANK) +------------+ +--------------------------------+ | errinfo |--+ +------------+ | +--------------------------------+ +--->|r/l brd errinfo,compt err flags | +--------------------------------+ * * Each BOARD consists of COMPONENTs and the BOARD structure has * pointers (offsets) to its COMPONENT structure. * The COMPONENT structure has version info, size and speed info, revision, * error info and the NIC info. This structure can accommodate any * BOARD with arbitrary COMPONENT composition. * * The ERRORINFO part of each BOARD has error information * that describes errors about the BOARD itself. It also has flags to * indicate the COMPONENT(s) on the board that have errors. The error * information specific to the COMPONENT is present in the respective * COMPONENT structure. * * The ERRORINFO structure is also treated like a COMPONENT, ie. the * BOARD has pointers(offset) to the ERRORINFO structure. The rboard * structure also has a pointer to the ERRORINFO structure. This is * the place to store ERRORINFO about a REMOTE NODE, if the HUB on * that NODE is not working or if the REMOTE MEMORY is BAD. In cases where * only the CPU of the REMOTE NODE is disabled, the ERRORINFO pointer can * be a NODE NUMBER, REMOTE OFFSET combination, pointing to error info * which is present on the REMOTE NODE.(TBD) * REMOTE ERRINFO can be stored on any of the nearest nodes * or on all the nearest nodes.(TBD) * Like BOARD structures, REMOTE ERRINFO structures can be built locally * using the rboard errinfo pointer. * * In order to get useful information from this Data organization, a set of * interface routines are provided (TBD). The important thing to remember while * manipulating the structures, is that, the NODE number information should * be used. If the NODE is non-zero (remote) then each offset should * be added to the REMOTE BASE ADDR else it should be added to the LOCAL BASE ADDR. * This includes offsets for BOARDS, COMPONENTS and ERRORINFO. * * Note that these structures do not provide much info about connectivity. * That info will be part of HWGRAPH, which is an extension of the cfg_t * data structure. (ref IP27prom/cfg.h) It has to be extended to include * the IO part of the Network(TBD). * * The data structures below define the above concepts. *//* * BOARD classes */#define KLCLASS_MASK 0xf0 #define KLCLASS_NONE 0x00#define KLCLASS_NODE 0x10 /* CPU, Memory and HUB board */#define KLCLASS_CPU KLCLASS_NODE #define KLCLASS_IO 0x20 /* BaseIO, 4 ch SCSI, ethernet, FDDI and the non-graphics widget boards */#define KLCLASS_ROUTER 0x30 /* Router board */#define KLCLASS_MIDPLANE 0x40 /* We need to treat this as a board so that we can record error info */#define KLCLASS_GFX 0x50 /* graphics boards */#define KLCLASS_PSEUDO_GFX 0x60 /* HDTV type cards that use a gfx * hw ifc to xtalk and are not gfx * class for sw purposes */#define KLCLASS_IOBRICK 0x70 /* IP35 iobrick */#define KLCLASS_MAX 8 /* Bump this if a new CLASS is added */#define KLTYPE_MAX 11 /* Bump this if a new CLASS is added */#define KLCLASS_UNKNOWN 0xf0#define KLCLASS(_x) ((_x) & KLCLASS_MASK)/* * board types */#define KLTYPE_MASK 0x0f#define KLTYPE_NONE 0x00#define KLTYPE_EMPTY 0x00#define KLTYPE_WEIRDCPU (KLCLASS_CPU | 0x0)#define KLTYPE_SNIA (KLCLASS_CPU | 0x1)#define KLTYPE_ROUTER (KLCLASS_ROUTER | 0x1)#define KLTYPE_META_ROUTER (KLCLASS_ROUTER | 0x3)#define KLTYPE_REPEATER_ROUTER (KLCLASS_ROUTER | 0x4)#define KLTYPE_IOBRICK (KLCLASS_IOBRICK | 0x0)#define KLTYPE_NBRICK (KLCLASS_IOBRICK | 0x4)#define KLTYPE_PXBRICK (KLCLASS_IOBRICK | 0x6)#define KLTYPE_IXBRICK (KLCLASS_IOBRICK | 0x7)#define KLTYPE_CGBRICK (KLCLASS_IOBRICK | 0x8)#define KLTYPE_OPUSBRICK (KLCLASS_IOBRICK | 0x9)/* The value of type should be more than 8 so that hinv prints * out the board name from the NIC string. For values less than * 8 the name of the board needs to be hard coded in a few places. * When bringup started nic names had not standardized and so we * had to hard code. (For people interested in history.) */#define KLTYPE_UNKNOWN (KLCLASS_UNKNOWN | 0xf)#define KLTYPE(_x) ((_x) & KLTYPE_MASK)/* * board structures */#define MAX_COMPTS_PER_BRD 24typedef struct lboard_s { klconf_off_t brd_next_any; /* Next BOARD */ unsigned char struct_type; /* type of structure, local or remote */ unsigned char brd_type; /* type+class */ unsigned char brd_sversion; /* version of this structure */ unsigned char brd_brevision; /* board revision */ unsigned char brd_promver; /* board prom version, if any */ unsigned char brd_flags; /* Enabled, Disabled etc */ unsigned char brd_slot; /* slot number */ unsigned short brd_debugsw; /* Debug switches */ geoid_t brd_geoid; /* geo id */ partid_t brd_partition; /* Partition number */ unsigned short brd_diagval; /* diagnostic value */ unsigned short brd_diagparm; /* diagnostic parameter */ unsigned char brd_inventory; /* inventory history */ unsigned char brd_numcompts; /* Number of components */ nic_t brd_nic; /* Number in CAN */ nasid_t brd_nasid; /* passed parameter */ klconf_off_t brd_compts[MAX_COMPTS_PER_BRD]; /* pointers to COMPONENTS */ klconf_off_t brd_errinfo; /* Board's error information */ struct lboard_s *brd_parent; /* Logical parent for this brd */ char pad0[4]; confidence_t brd_confidence; /* confidence that the board is bad */ nasid_t brd_owner; /* who owns this board */ unsigned char brd_nic_flags; /* To handle 8 more NICs */ char pad1[24]; /* future expansion */ char brd_name[32]; nasid_t brd_next_same_host; /* host of next brd w/same nasid */ klconf_off_t brd_next_same; /* Next BOARD with same nasid */} lboard_t;/* * Make sure we pass back the calias space address for local boards. * klconfig board traversal and error structure extraction defines. */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?