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

📄 xtalk.c

📁 linux-2.4.29操作系统的源码
💻 C
📖 第 1 页 / 共 2 页
字号:
 */vertex_hdl_txtalk_intr_cpu_get(xtalk_intr_t intr_hdl){      return (vertex_hdl_t)0;}/* * ===================================================================== *                      ERROR MANAGEMENT *//* * xtalk_error_handler: * pass this error on to the handler registered * at the specified xtalk connecdtion point, * or complain about it here if there is no handler. * * This routine plays two roles during error delivery * to most widgets: first, the external agent (heart, * hub, or whatever) calls in with the error and the * connect point representing the crosstalk switch, * or whatever crosstalk device is directly connected * to the agent. * * If there is a switch, it will generally look at the * widget number stashed in the ioerror structure; and, * if the error came from some widget other than the * switch, it will call back into xtalk_error_handler * with the connection point of the offending port. */intxtalk_error_handler(		       vertex_hdl_t xconn,		       int error_code,		       ioerror_mode_t mode,		       ioerror_t *ioerror){    xwidget_info_t          xwidget_info;    xwidget_info = xwidget_info_get(xconn);    /* Make sure that xwidget_info is a valid pointer before derefencing it.     * We could come in here during very early initialization.      */    if (xwidget_info && xwidget_info->w_efunc)	return xwidget_info->w_efunc	    (xwidget_info->w_einfo,	     error_code, mode, ioerror);    /*     * no error handler registered for     * the offending port. it's not clear     * what needs to be done, but reporting     * it would be a good thing, unless it     * is a mode that requires nothing.     */    if ((mode == MODE_DEVPROBE) || (mode == MODE_DEVUSERERROR) ||	(mode == MODE_DEVREENABLE))	return IOERROR_HANDLED;#if defined(SUPPORT_PRINTING_V_FORMAT)    printk(KERN_WARNING "Xbow at %v encountered Fatal error", xconn);#else    printk(KERN_WARNING "Xbow at 0x%p encountered Fatal error", (void *)xconn);#endif    snia_ioerror_dump("xtalk", error_code, mode, ioerror);    return IOERROR_UNHANDLED;}intxtalk_error_devenable(vertex_hdl_t xconn_vhdl, int devnum, int error_code){    return DEV_FUNC(xconn_vhdl, error_devenable) (xconn_vhdl, devnum, error_code);}/* ===================================================================== *                    CONFIGURATION MANAGEMENT *//* * Startup a crosstalk provider */voidxtalk_provider_startup(vertex_hdl_t xtalk_provider){    DEV_FUNC(xtalk_provider, provider_startup)	(xtalk_provider);}/* * Shutdown a crosstalk provider */voidxtalk_provider_shutdown(vertex_hdl_t xtalk_provider){    DEV_FUNC(xtalk_provider, provider_shutdown)	(xtalk_provider);}/*  * Enable a device on a xtalk widget  */voidxtalk_widgetdev_enable(vertex_hdl_t xconn_vhdl, int devnum){	return;}/*  * Shutdown a device on a xtalk widget  */voidxtalk_widgetdev_shutdown(vertex_hdl_t xconn_vhdl, int devnum){	return;}intxtalk_dma_enabled(vertex_hdl_t xconn_vhdl){    return DEV_FUNC(xconn_vhdl, dma_enabled) (xconn_vhdl);}/* * Generic crosstalk functions, for use with all crosstalk providers * and all crosstalk devices. *//****** Generic crosstalk interrupt interfaces ******/vertex_hdl_txtalk_intr_dev_get(xtalk_intr_t xtalk_intr){    return (xtalk_intr->xi_dev);}xwidgetnum_txtalk_intr_target_get(xtalk_intr_t xtalk_intr){    return (xtalk_intr->xi_target);}xtalk_intr_vector_txtalk_intr_vector_get(xtalk_intr_t xtalk_intr){    return (xtalk_intr->xi_vector);}iopaddr_txtalk_intr_addr_get(struct xtalk_intr_s *xtalk_intr){    return (xtalk_intr->xi_addr);}void                   *xtalk_intr_sfarg_get(xtalk_intr_t xtalk_intr){    return (xtalk_intr->xi_sfarg);}/****** Generic crosstalk pio interfaces ******/vertex_hdl_txtalk_pio_dev_get(xtalk_piomap_t xtalk_piomap){    return (xtalk_piomap->xp_dev);}xwidgetnum_txtalk_pio_target_get(xtalk_piomap_t xtalk_piomap){    return (xtalk_piomap->xp_target);}iopaddr_txtalk_pio_xtalk_addr_get(xtalk_piomap_t xtalk_piomap){    return (xtalk_piomap->xp_xtalk_addr);}ulongxtalk_pio_mapsz_get(xtalk_piomap_t xtalk_piomap){    return (xtalk_piomap->xp_mapsz);}caddr_txtalk_pio_kvaddr_get(xtalk_piomap_t xtalk_piomap){    return (xtalk_piomap->xp_kvaddr);}/****** Generic crosstalk dma interfaces ******/vertex_hdl_txtalk_dma_dev_get(xtalk_dmamap_t xtalk_dmamap){    return (xtalk_dmamap->xd_dev);}xwidgetnum_txtalk_dma_target_get(xtalk_dmamap_t xtalk_dmamap){    return (xtalk_dmamap->xd_target);}/****** Generic crosstalk widget information interfaces ******//* xwidget_info_chk: * check to see if this vertex is a widget; * if so, return its widget_info (if any). * if not, return NULL. */xwidget_info_txwidget_info_chk(vertex_hdl_t xwidget){    arbitrary_info_t        ainfo = 0;    hwgraph_info_get_LBL(xwidget, INFO_LBL_XWIDGET, &ainfo);    return (xwidget_info_t) ainfo;}xwidget_info_txwidget_info_get(vertex_hdl_t xwidget){    xwidget_info_t          widget_info;    widget_info = (xwidget_info_t)	hwgraph_fastinfo_get(xwidget);    return (widget_info);}voidxwidget_info_set(vertex_hdl_t xwidget, xwidget_info_t widget_info){    if (widget_info != NULL)	widget_info->w_fingerprint = widget_info_fingerprint;    hwgraph_fastinfo_set(xwidget, (arbitrary_info_t) widget_info);    /* Also, mark this vertex as an xwidget,     * and use the widget_info, so xwidget_info_chk     * can work (and be fairly efficient).     */    hwgraph_info_add_LBL(xwidget, INFO_LBL_XWIDGET,			 (arbitrary_info_t) widget_info);}vertex_hdl_txwidget_info_dev_get(xwidget_info_t xwidget_info){    if (xwidget_info == NULL)	panic("xwidget_info_dev_get: null xwidget_info");    return (xwidget_info->w_vertex);}xwidgetnum_txwidget_info_id_get(xwidget_info_t xwidget_info){    if (xwidget_info == NULL)	panic("xwidget_info_id_get: null xwidget_info");    return (xwidget_info->w_id);}vertex_hdl_txwidget_info_master_get(xwidget_info_t xwidget_info){    if (xwidget_info == NULL)	panic("xwidget_info_master_get: null xwidget_info");    return (xwidget_info->w_master);}xwidgetnum_txwidget_info_masterid_get(xwidget_info_t xwidget_info){    if (xwidget_info == NULL)	panic("xwidget_info_masterid_get: null xwidget_info");    return (xwidget_info->w_masterid);}xwidget_part_num_txwidget_info_part_num_get(xwidget_info_t xwidget_info){    if (xwidget_info == NULL)	panic("xwidget_info_part_num_get: null xwidget_info");    return (xwidget_info->w_hwid.part_num);}xwidget_mfg_num_txwidget_info_mfg_num_get(xwidget_info_t xwidget_info){    if (xwidget_info == NULL)	panic("xwidget_info_mfg_num_get: null xwidget_info");    return (xwidget_info->w_hwid.mfg_num);}/* Extract the widget name from the widget information * for the xtalk widget. */char *xwidget_info_name_get(xwidget_info_t xwidget_info){    if (xwidget_info == NULL)	panic("xwidget_info_name_get: null xwidget_info");    return(xwidget_info->w_name);}/****** Generic crosstalk initialization interfaces ******//* * Associate a set of xtalk_provider functions with a vertex. */voidxtalk_provider_register(vertex_hdl_t provider, xtalk_provider_t *xtalk_fns){    hwgraph_fastinfo_set(provider, (arbitrary_info_t) xtalk_fns);}/* * Disassociate a set of xtalk_provider functions with a vertex. */voidxtalk_provider_unregister(vertex_hdl_t provider){    hwgraph_fastinfo_set(provider, (arbitrary_info_t)NULL);}/* * Obtain a pointer to the xtalk_provider functions for a specified Crosstalk * provider. */xtalk_provider_t       *xtalk_provider_fns_get(vertex_hdl_t provider){    return ((xtalk_provider_t *) hwgraph_fastinfo_get(provider));}/* * Inform xtalk infrastructure that a driver is no longer available for * handling any widgets. */voidxwidget_driver_unregister(char *driver_prefix){	return;}/* * Call some function with each vertex that * might be one of this driver's attach points. */voidxtalk_iterate(char *driver_prefix,	      xtalk_iter_f *func){}/* * xwidget_register: *	Register a xtalk device (xwidget) by doing the following. *      -allocate and initialize xwidget_info data *      -allocate a hwgraph vertex with name based on widget number (id) *      -look up the widget's initialization function and call it, *      or remember the vertex for later initialization. * */intxwidget_register(xwidget_hwid_t hwid,		/* widget's hardware ID */		 vertex_hdl_t 	widget,		/* widget to initialize */		 xwidgetnum_t 	id,		/* widget's target id (0..f) */		 vertex_hdl_t 	master,		/* widget's master vertex */		 xwidgetnum_t 	targetid)	/* master's target id (9/a) */{			    xwidget_info_t          widget_info;    char		    *s,devnm[MAXDEVNAME];    /* Allocate widget_info and associate it with widget vertex */    NEW(widget_info);    /* Initialize widget_info */    widget_info->w_vertex = widget;    widget_info->w_id = id;    widget_info->w_master = master;    widget_info->w_masterid = targetid;    widget_info->w_hwid = *hwid;	/* structure copy */    widget_info->w_efunc = 0;    widget_info->w_einfo = 0;    /*     * get the name of this xwidget vertex and keep the info.     * This is needed during errors and interupts, but as     * long as we have it, we can use it elsewhere.     */    s = dev_to_name(widget,devnm,MAXDEVNAME);    widget_info->w_name = kmalloc(strlen(s) + 1, GFP_KERNEL);    strcpy(widget_info->w_name,s);        xwidget_info_set(widget, widget_info);    device_master_set(widget, master);    /*      * Add pointer to async attach info -- tear down will be done when     * the particular descendant is done with the info.     */    return cdl_add_connpt(hwid->part_num, hwid->mfg_num,                          widget, 0);}/* * xwidget_unregister : *	Unregister the xtalk device and detach all its hwgraph namespace. */intxwidget_unregister(vertex_hdl_t widget){    xwidget_info_t	widget_info;    xwidget_hwid_t	hwid;    /* Make sure that we have valid widget information initialized */    if (!(widget_info = xwidget_info_get(widget)))	return(1);    /* Remove the inventory information associated     * with the widget.     */    hwgraph_inventory_remove(widget, -1, -1, -1, -1, -1);        hwid = &(widget_info->w_hwid);    /* Clean out the xwidget information */    (void)kfree(widget_info->w_name);    memset((void *)widget_info, 0, sizeof(widget_info));    DEL(widget_info);        return(0);}voidxwidget_error_register(vertex_hdl_t xwidget,		       error_handler_f *efunc,		       error_handler_arg_t einfo){    xwidget_info_t          xwidget_info;    xwidget_info = xwidget_info_get(xwidget);    ASSERT(xwidget_info != NULL);    xwidget_info->w_efunc = efunc;    xwidget_info->w_einfo = einfo;}/* * Issue a link reset to a widget. */voidxwidget_reset(vertex_hdl_t xwidget){    xswitch_reset_link(xwidget);}voidxwidget_gfx_reset(vertex_hdl_t xwidget){	return;}#define ANON_XWIDGET_NAME	"No Name"	/* Default Widget Name *//* Get the canonical hwgraph  name of xtalk widget */char *xwidget_name_get(vertex_hdl_t xwidget_vhdl){	xwidget_info_t  info;	/* If we have a bogus widget handle then return	 * a default anonymous widget name.	 */	if (xwidget_vhdl == GRAPH_VERTEX_NONE)	    return(ANON_XWIDGET_NAME);	/* Read the widget name stored in the widget info	 * for the widget setup during widget initialization.	 */	info = xwidget_info_get(xwidget_vhdl);	ASSERT(info != NULL);	return(xwidget_info_name_get(info));}

⌨️ 快捷键说明

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