⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 klconfig.h

📁 linux-2.4.29操作系统的源码
💻 H
📖 第 1 页 / 共 3 页
字号:
/* * 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, 2000 Silicon Graphics, Inc. * Copyright (C) 1999, 2000 by Ralf Baechle */#ifndef	_ASM_SN_KLCONFIG_H#define	_ASM_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/config.h>#include <linux/types.h>#include <asm/sn/types.h>#if defined(CONFIG_SGI_IP27)#include <asm/sn/sn0/addrs.h>//#include <sys/SN/router.h>// XXX Stolen from <sys/SN/router.h>:#define MAX_ROUTER_PORTS (6)    /* Max. number of ports on a router */#include <asm/sn/sn0/sn0_fru.h>//#include <sys/graph.h>//#include <sys/xtalk/xbow.h>#elif defined(CONFIG_SGI_IP35)#include <asm/sn/sn1/addrs.h>#include <sys/sn/router.h>#include <sys/graph.h>#include <asm/xtalk/xbow.h>#endif /* !CONFIG_SGI_IP27 && !CONFIG_SGI_IP35 */#if defined(CONFIG_SGI_IP27) || defined(CONFIG_SGI_IP35)#include <asm/sn/agent.h>#include <asm/arc/types.h>#include <asm/arc/hinv.h>#if defined(CONFIG_SGI_IO) || defined(CONFIG_SGI_IP35)// The hack file has to be before vector and after sn0_fru....#include <asm/hack.h>#include <asm/sn/vector.h>#include <asm/xtalk/xtalk.h>#endif /* CONFIG_SGI_IO || CONFIG_SGI_IP35 */#endif /* CONFIG_SGI_IP27 || CONFIG_SGI_IP35 */#define KLCFGINFO_MAGIC	0xbeedbabe#ifdef FRUTESTtypedef u64 klconf_off_t;#elsetypedef s32 klconf_off_t;#endif/* * Some IMPORTANT OFFSETS. These are the offsets on all NODES. */#if 0#define RAMBASE                 0#define ARCSSPB_OFF             0x1000 /* shift it to sys/arcs/spb.h */#define OFF_HWGRAPH 		0#endif#define	MAX_MODULE_ID		255#define SIZE_PAD		4096 /* 4k padding for structures *//* * 1 NODE brd, 2 Router brd (1 8p, 1 meta), 6 Widgets, * 2 Midplanes assuming no pci card cages */#define MAX_SLOTS_PER_NODE	(1 + 2 + 6 + 2)/* 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 GLOBAL_MASTER_IO6	0x20#define THIRD_NIC_PRESENT 	0x40  	/* for future use */#define SECOND_NIC_PRESENT 	0x80 	/* addons like MIO are present *//* 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 */#define IS_CONSOLE_IOC3(i)	((((klinfo_t *)i)->flags) & KLINFO_INSTALL)#define GB2		0x80000000#define MAX_RSV_PTRS	32/* 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 {#if defined(CONFIG_SGI_IO)	/* FIXME */	__psunsigned_t 	uart_base;	__psunsigned_t 	config_base;	__psunsigned_t 	memory_base;#else	unsigned long 	uart_base;	unsigned long 	config_base;	unsigned long 	memory_base;#endif	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)))#if 0#define KL_CONFIG_MALLOC_HDR(_nasid) \                                (KL_CONFIG_HDR(_nasid)->ch_malloc_hdr)#endif#define KL_CONFIG_INFO_OFFSET(_nasid)					\        (KL_CONFIG_HDR(_nasid)->ch_board_info)#define KL_CONFIG_INFO_SET_OFFSET(_nasid, _off)				\        (KL_CONFIG_HDR(_nasid)->ch_board_info = (_off))#define KL_CONFIG_INFO(_nasid) 						\        (lboard_t *)((KL_CONFIG_HDR(_nasid)->ch_board_info) ?		\	 NODE_OFFSET_TO_K1((_nasid), KL_CONFIG_HDR(_nasid)->ch_board_info) : \	 0)#define KL_CONFIG_MAGIC(_nasid)		(KL_CONFIG_HDR(_nasid)->ch_magic)#define KL_CONFIG_CHECK_MAGIC(_nasid)					\        (KL_CONFIG_HDR(_nasid)->ch_magic == KLCFGINFO_MAGIC)#define KL_CONFIG_HDR_INIT_MAGIC(_nasid)	\                  (KL_CONFIG_HDR(_nasid)->ch_magic = KLCFGINFO_MAGIC)/* --- New Macros for the changed kl_config_hdr_t structure --- */#if defined(CONFIG_SGI_IO)#define PTR_CH_MALLOC_HDR(_k)   ((klc_malloc_hdr_t *)\			((__psunsigned_t)_k + (_k->ch_malloc_hdr_off)))#else#define PTR_CH_MALLOC_HDR(_k)   ((klc_malloc_hdr_t *)\			(unsigned long)_k + (_k->ch_malloc_hdr_off)))#endif#define KL_CONFIG_CH_MALLOC_HDR(_n)   PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n))#if defined(CONFIG_SGI_IO)#define PTR_CH_CONS_INFO(_k)	((console_t *)\			((__psunsigned_t)_k + (_k->ch_cons_off)))#else#define PTR_CH_CONS_INFO(_k)	((console_t *)\			((unsigned long)_k + (_k->ch_cons_off)))#endif#define KL_CONFIG_CH_CONS_INFO(_n)   PTR_CH_CONS_INFO(KL_CONFIG_HDR(_n))/* ------------------------------------------------------------- */#define KL_CONFIG_INFO_START(_nasid)	\        (klconf_off_t)(KLCONFIG_OFFSET(_nasid) + sizeof(kl_config_hdr_t))#define KL_CONFIG_BOARD_NASID(_brd)	((_brd)->brd_nasid)#define KL_CONFIG_BOARD_SET_NEXT(_brd, _off)	((_brd)->brd_next = (_off))#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#define	SN0_PORT_FENCE_SHFT	0#define	SN0_PORT_FENCE_MASK	(1 << SN0_PORT_FENCE_SHFT)/* * 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 accomodate 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.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -