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

📄 ml_iograph.c

📁 linux-2.4.29操作系统的源码
💻 C
📖 第 1 页 / 共 3 页
字号:
	/*	 * Check that the widget is an io widget and is enabled	 * on this nasid or the `peer' nasid.  The peer nasid	 * is the other hub/bedrock connected to the xbow.	 */	peer_nasid = NODEPDA(cnode)->xbow_peer;	if (peer_nasid == INVALID_NASID)		/* If I don't have a peer, use myself. */		peer_nasid = nasid;	if (!xbow_port_io_enabled(nasid, widgetnum) &&	    !xbow_port_io_enabled(peer_nasid, widgetnum)) {		return;	}	if (xswitch_info_link_ok(xswitch_info, widgetnum)) {		char			name[4];		lboard_t dummy;		/*		 * If the current hub is not supposed to be the master 		 * for this widgetnum, then skip this widget.		 */		if (xswitch_info_master_assignment_get(xswitch_info, widgetnum) != hubv) {			return;		}		board = find_lboard_class(				(lboard_t *)KL_CONFIG_INFO(nasid),				KLCLASS_IOBRICK);		if (!board && NODEPDA(cnode)->xbow_peer != INVALID_NASID) {		    	board = find_lboard_class(					(lboard_t *)KL_CONFIG_INFO( NODEPDA(cnode)->xbow_peer),						KLCLASS_IOBRICK);		}		if (board) {			DBG("io_xswitch_widget_init: Found KLTYPE_IOBRICK Board 0x%p brd_type 0x%x\n", board, board->brd_type);		} else {			DBG("io_xswitch_widget_init: FIXME did not find IOBOARD\n");			board = &dummy;		}		/* Copy over the nodes' geoid info */		{			lboard_t *brd;			brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_SNIA);			if ( brd != (lboard_t *)0 ) {				board->brd_geoid = brd->brd_geoid;			}		}		/* 		 * Make sure we really want to say xbrick, pbrick,		 * etc. rather than XIO, graphics, etc. 		 */		memset(buffer, 0, 16);		format_module_id(buffer, geo_module(board->brd_geoid), MODULE_FORMAT_BRIEF);		sprintf(pathname, EDGE_LBL_MODULE "/%s/" EDGE_LBL_SLAB "/%d" "/%s" "/%s/%d",			buffer,			geo_slab(board->brd_geoid),			(board->brd_type == KLTYPE_IBRICK) ? EDGE_LBL_IBRICK :			(board->brd_type == KLTYPE_PBRICK) ? EDGE_LBL_PBRICK :			(board->brd_type == KLTYPE_PXBRICK) ? EDGE_LBL_PXBRICK :			(board->brd_type == KLTYPE_IXBRICK) ? EDGE_LBL_IXBRICK :			(board->brd_type == KLTYPE_CGBRICK) ? EDGE_LBL_CGBRICK :			(board->brd_type == KLTYPE_OPUSBRICK) ? EDGE_LBL_OPUSBRICK :			(board->brd_type == KLTYPE_XBRICK) ? EDGE_LBL_XBRICK : "?brick",			EDGE_LBL_XTALK, widgetnum);				DBG("io_xswitch_widget_init: path= %s\n", pathname);		rc = hwgraph_path_add(hwgraph_root, pathname, &widgetv);				ASSERT(rc == GRAPH_SUCCESS);		/* This is needed to let the user programs to map the		 * module,slot numbers to the corresponding widget numbers		 * on the crossbow.		 */		device_master_set(hwgraph_connectpt_get(widgetv), hubv);		sprintf(name, "%d", widgetnum);		DBG("io_xswitch_widget_init: FIXME hwgraph_edge_add %s xswitchv 0x%p, widgetv 0x%p\n", name, xswitchv, widgetv);		rc = hwgraph_edge_add(xswitchv, widgetv, name);				/*		 * crosstalk switch code tracks which		 * widget is attached to each link.		 */		xswitch_info_vhdl_set(xswitch_info, widgetnum, widgetv);				/*		 * Peek at the widget to get its crosstalk part and		 * mfgr numbers, then present it to the generic xtalk		 * bus provider to have its driver attach routine		 * called (or not).		 */		widget_id = XWIDGET_ID_READ(nasid, widgetnum);		hwid.part_num = XWIDGET_PART_NUM(widget_id);		hwid.rev_num = XWIDGET_REV_NUM(widget_id);		hwid.mfg_num = XWIDGET_MFG_NUM(widget_id);		/* Store some inventory information about		 * the xwidget in the hardware graph.		 */		xwidget_inventory_add(widgetv,board,hwid);		(void)xwidget_register(&hwid, widgetv, widgetnum,				       hubv, hub_widgetid);		ia64_sn_sysctl_iobrick_module_get(nasid, &io_module);		if (io_module >= 0) {			char			buffer[16];			vertex_hdl_t		to, from;			char           		*brick_name;			extern char *iobrick_L1bricktype_to_name(int type);			memset(buffer, 0, 16);			format_module_id(buffer, geo_module(board->brd_geoid), MODULE_FORMAT_BRIEF);			if ( isupper(MODULE_GET_BTCHAR(io_module)) ) {				bt = tolower(MODULE_GET_BTCHAR(io_module));			}			else {				bt = MODULE_GET_BTCHAR(io_module);			}			brick_name = iobrick_L1bricktype_to_name(bt);			/* Add a helper vertex so xbow monitoring			* can identify the brick type. It's simply			* an edge from the widget 0 vertex to the			*  brick vertex.			*/			sprintf(pathname, EDGE_LBL_HW "/" EDGE_LBL_MODULE "/%s/"				EDGE_LBL_SLAB "/%d/"				EDGE_LBL_NODE "/" EDGE_LBL_XTALK "/"				"0",				buffer, geo_slab(board->brd_geoid));			DBG("io_xswitch_widget_init: FROM path '%s'\n", pathname);			from = hwgraph_path_to_vertex(pathname);			ASSERT_ALWAYS(from);			sprintf(pathname, EDGE_LBL_HW "/" EDGE_LBL_MODULE "/%s/"				EDGE_LBL_SLAB "/%d/"				"%s",				buffer, geo_slab(board->brd_geoid), brick_name);			DBG("io_xswitch_widget_init: TO path '%s'\n", pathname);			to = hwgraph_path_to_vertex(pathname);			ASSERT_ALWAYS(to);			rc = hwgraph_edge_add(from, to,				EDGE_LBL_INTERCONNECT);			if (rc == -EEXIST)				goto link_done;			if (rc != GRAPH_SUCCESS) {				printk("%s: Unable to establish link"					" for xbmon.", pathname);			}link_done:		}#ifdef	SN0_USE_BTE		bte_bpush_war(cnode, (void *)board);#endif	}}static voidio_init_xswitch_widgets(vertex_hdl_t xswitchv, cnodeid_t cnode){	xwidgetnum_t		widgetnum;		DBG("io_init_xswitch_widgets: xswitchv 0x%p for cnode %d\n", xswitchv, cnode);	for (widgetnum = HUB_WIDGET_ID_MIN; widgetnum <= HUB_WIDGET_ID_MAX; widgetnum++) {		io_xswitch_widget_init(xswitchv, cnodeid_to_vertex(cnode), widgetnum);	}}/* * For each PCI bridge connected to the xswitch, add a link from the * board's klconfig info to the bridge's hwgraph vertex.  This lets * the FRU analyzer find the bridge without traversing the hardware * graph and risking hangs. */static voidio_link_xswitch_widgets(vertex_hdl_t xswitchv, cnodeid_t cnodeid){	xwidgetnum_t		widgetnum;	char 			pathname[128];	vertex_hdl_t		vhdl;	nasid_t			nasid, peer_nasid;	lboard_t		*board;	/* And its connected hub's nasids */	nasid = COMPACT_TO_NASID_NODEID(cnodeid);	peer_nasid = NODEPDA(cnodeid)->xbow_peer;	/* 	 * Look for paths matching "<widgetnum>/pci" under xswitchv.	 * For every widget, init. its lboard's hwgraph link.  If the	 * board has a PCI bridge, point the link to it.	 */	for (widgetnum = HUB_WIDGET_ID_MIN; widgetnum <= HUB_WIDGET_ID_MAX;		 widgetnum++) {		sprintf(pathname, "%d", widgetnum);		if (hwgraph_traverse(xswitchv, pathname, &vhdl) !=		    GRAPH_SUCCESS)			continue;		board = find_lboard_module((lboard_t *)KL_CONFIG_INFO(nasid),				NODEPDA(cnodeid)->geoid);		if (board == NULL && peer_nasid != INVALID_NASID) {			/*			 * Try to find the board on our peer			 */			board = find_lboard_module(				(lboard_t *)KL_CONFIG_INFO(peer_nasid),				NODEPDA(cnodeid)->geoid);		}		if (board == NULL) {			printk(KERN_WARNING  "Could not find PROM info for vertex 0x%p, "				"FRU analyzer may fail",				(void *)vhdl);			return;		}		/* Check both buses */		sprintf(pathname, "%d/"EDGE_LBL_PCIX_0, widgetnum);		if (hwgraph_traverse(xswitchv, pathname, &vhdl) == GRAPH_SUCCESS)			board->brd_graph_link = vhdl;		else {			sprintf(pathname, "%d/"EDGE_LBL_PCIX_1, widgetnum);			if (hwgraph_traverse(xswitchv, pathname, &vhdl) == GRAPH_SUCCESS)				board->brd_graph_link = vhdl;			else				board->brd_graph_link = GRAPH_VERTEX_NONE;		}	}}/* * Initialize all I/O on the specified node. */static voidio_init_node(cnodeid_t cnodeid){	/*REFERENCED*/	vertex_hdl_t hubv, switchv, widgetv;	struct xwidget_hwid_s hwid;	hubinfo_t hubinfo;	int is_xswitch;	nodepda_t	*npdap;	struct semaphore *peer_sema = 0;	uint32_t	widget_partnum;	cpuid_t	c = 0;	npdap = NODEPDA(cnodeid);	/*	 * Get the "top" vertex for this node's hardware	 * graph; it will carry the per-hub hub-specific	 * data, and act as the crosstalk provider master.	 * It's canonical path is probably something of the	 * form /hw/module/%M/slot/%d/node	 */	hubv = cnodeid_to_vertex(cnodeid);	DBG("io_init_node: Initialize IO for cnode %d hubv(node) 0x%p npdap 0x%p\n", cnodeid, hubv, npdap);	ASSERT(hubv != GRAPH_VERTEX_NONE);	/*	 * Read mfg info on this hub	 */	/* 	 * If nothing connected to this hub's xtalk port, we're done.	 */	early_probe_for_widget(hubv, &hwid);	if (hwid.part_num == XWIDGET_PART_NUM_NONE) {#ifdef PROBE_TEST		if ((cnodeid == 1) || (cnodeid == 2)) {			int index;			for (index = 0; index < 600; index++)				DBG("Interfering with device probing!!!\n");		}#endif		/* io_init_done takes cpu cookie as 2nd argument 		 * to do a restorenoderun for the setnoderun done 		 * at the start of this thread 		 */				DBG("**** io_init_node: Node's 0x%p hub widget has XWIDGET_PART_NUM_NONE ****\n", hubv);		return;		/* NOTREACHED */	}	/* 	 * attach our hub_provider information to hubv,	 * so we can use it as a crosstalk provider "master"	 * vertex.	 */	xtalk_provider_register(hubv, &hub_provider);	xtalk_provider_startup(hubv);	/*	 * Create a vertex to represent the crosstalk bus	 * attached to this hub, and a vertex to be used	 * as the connect point for whatever is out there	 * on the other side of our crosstalk connection.	 *	 * Crosstalk Switch drivers "climb up" from their	 * connection point to try and take over the switch	 * point.	 *	 * Of course, the edges and verticies may already	 * exist, in which case our net effect is just to	 * associate the "xtalk_" driver with the connection	 * point for the device.	 */	(void)hwgraph_path_add(hubv, EDGE_LBL_XTALK, &switchv);	DBG("io_init_node: Created 'xtalk' entry to '../node/' xtalk vertex 0x%p\n", switchv);	ASSERT(switchv != GRAPH_VERTEX_NONE);	(void)hwgraph_edge_add(hubv, switchv, EDGE_LBL_IO);	DBG("io_init_node: Created symlink 'io' from ../node/io to ../node/xtalk \n");	/*	 * We need to find the widget id and update the basew_id field	 * accordingly. In particular, SN00 has direct connected bridge,	 * and hence widget id is Not 0.	 */	widget_partnum = (((*(volatile int32_t *)(NODE_SWIN_BASE(COMPACT_TO_NASID_NODEID(cnodeid), 0) + WIDGET_ID))) & WIDGET_PART_NUM) >> WIDGET_PART_NUM_SHFT;	if (widget_partnum == BRIDGE_WIDGET_PART_NUM ||				widget_partnum == XBRIDGE_WIDGET_PART_NUM){		npdap->basew_id = (((*(volatile int32_t *)(NODE_SWIN_BASE(COMPACT_TO_NASID_NODEID(cnodeid), 0) + BRIDGE_WID_CONTROL))) & WIDGET_WIDGET_ID);		DBG("io_init_node: Found XBRIDGE widget_partnum= 0x%x\n", widget_partnum);	} else if ((widget_partnum == XBOW_WIDGET_PART_NUM) ||			(widget_partnum == XXBOW_WIDGET_PART_NUM) ||			(widget_partnum == PXBOW_WIDGET_PART_NUM) ) {		/* 		 * Xbow control register does not have the widget ID field.		 * So, hard code the widget ID to be zero.

⌨️ 快捷键说明

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