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

📄 tc.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 2 页
字号:
/* *	tc_disable_option() *	 *	Takes a pointer to a uba_device struct or a uba_controller struct, *  	since the beginning of these structs are identical it will take *	a pointer to either one. * *	This function disables an option's interrupt on the TURBOchannel from *	interrupting the system at the I/O interrupt level.   *	This is done by calling the system specific routine to reset the  *	option's slot from interrupting the system. */	tc_disable_option(ui)    struct uba_device *ui;{    register int index = ui->ui_nexus;    (*tc_sw.disable_option)(index);}/* *	tc_module_name(ui, cp) *		struct uba_device *ui; *		char cp[TC_ROMNAMLEN]; * *	Takes a pointer to a uba_device struct or a uba_controller struct, *  	since the beginning of these structs are identical it will take *	a pointer to either one. * *	This function will fill in the character array 'cp' with the ascii *	string of the TURBOchannel option's module name refered to by the *	 'ui' pointer. * *	The function will return a (-1) if it was unable to use the 'cp' *	pointer that it was given. */tc_module_name(ui, cp)	struct uba_device *ui;	char *cp;{    register int index = ui->ui_nexus;    register int i;    register char *tcp;    /* sanity check the buffer cp[] to verify that it 	*/    /* can be written into.				*/    for (i = 0, tcp = cp; i < TC_ROMNAMLEN + 1; i++, tcp++) 	if (BADADDR(tcp, 1))	    return (-1);    bcopy(tc_slot[index].modulename, cp, TC_ROMNAMLEN + 1);    return (0);}tc_addr_to_name(addr, cp)	u_int addr;	char *cp;{    register int i;    register char *tcp;    /* sanity check the buffer cp[] to verify that it 	*/    /* can be written into.				*/    for (i = 0, tcp = cp; i < TC_ROMNAMLEN + 1; i++, tcp++) 	if (BADADDR(tcp, 1))	    return (-1);    for (i = 0; i < TC_IOSLOTS; i++) {	if (svtophy(addr) == tc_slotaddr[i]) {	    bcopy(tc_slot[i].modulename, cp, TC_ROMNAMLEN + 1);	    return (0);	}    }    return (-1);}/* * Look for a specific option on the system, if its found return its *     physical address, else return 0. * In particular, this routine is used at "consinit" time, to determine *     if there is a graphics module in the system and if so, where it is. */tc_where_option(str)	char *str;			/* the device name to look for */{	register int i;	register int index;	extern int cold;	cold = 1;	tc_probe(0);	cold = 0;	/*	 * Go thru the tc_slot table and look for device in "str".	 * If found, return its address, else return 0.	 */	for (i = 0; tc_sw.config_order[i] != -1; i++) {	    index = tc_sw.config_order[i];	    if (!(strcmp (str, tc_slot[index].devname)))			return (tc_slot[index].physaddr);	}	return(0);}/*	tc_find() * *	This routine probes the option slots and fills in the tc_slot *	table with the devices that are found on the system.  It then *	turns on interrupts and calls the probe routine for each device. * *	NOTE: 	Interrupts are enabled after return from this routine. */tc_find(){    int found;    register int i, j;    register int index;		/* current index into tc_slot to config */    /* Probe the option slots with printing turned on. */    tc_probe(1);    /*     * For each device/controller found on the system, look for it in     * the ubminit or ubdinit data structs (built from the config file).     * If it is found, then fill in the tc_slot table.     *     * If in the config file a dev or ctlr was assigned to a specific     * ibus (slot #), then we will only match if we find that piece     * of hardware in the corresponding slot on the system.     *     * The default case is that we will assign unit numbers to like devices     * starting with unit 0 and going thru the devices according to the     * "config_order" list.     */    for (i = 0; tc_sw.config_order[i] != -1; i++) {	index = tc_sw.config_order[i];	found = 0;	for (j = 0; ubminit[j].um_driver != 0; j++) 	    if ((!(strcmp (tc_slot[index].devname, ubminit[j].um_ctlrname))) &&		((ubminit[j].um_adpt == tc_slot[index].slot) ||		 ((ubminit[j].um_adpt == '?') && (!(tc_func_used(*ubminit[j].um_intr)))))){		tc_slot[index].intr = *ubminit[j].um_intr;		tc_slot[index].unit = ubminit[j].um_ctlr;		ubminit[j].um_nexus = index;		tc_slot[index].class = TC_CTLR;		if (tc_slot[index].intr_b4_probe)		    (*tc_sw.enable_option)(index);		found = 1;		break;	    }	if (!found)	    for (j = 0; ubdinit[j].ui_driver != 0; j++) {		if ((!(strcmp (tc_slot[index].devname, ubdinit[j].ui_devname))) && 		    ((ubdinit[j].ui_adpt == tc_slot[index].slot) ||		     ((ubdinit[j].ui_adpt == '?') && (!(tc_func_used(*ubdinit[j].ui_intr)))))){		    tc_slot[index].intr = *ubdinit[j].ui_intr;		    tc_slot[index].unit = ubdinit[j].ui_unit;		    ubdinit[j].ui_nexus = index;		    tc_slot[index].class = TC_DEV;		    if (tc_slot[index].intr_b4_probe)			(*tc_sw.enable_option)(index);		    found = 1;		    break;		}	    }	if (!found)	    for (j = 0; config_adpt[j].p_name != NULL; j++) {		if ((!(strcmp (tc_slot[index].devname, config_adpt[j].c_name))) &&		    (config_adpt[j].c_type == 'A')) {		    /* 		     * Note: probe routine fills in the		     * 	interrupt routine		     */		    tc_slot[index].unit = config_adpt[j].c_num;		    tc_slot[index].class = TC_ADPT;		    if (tc_slot[index].intr_b4_probe)			(*tc_sw.enable_option)(index);		    found = 1;		    break;		}	    }    }        /*     * Safe to take interrupts now (first clear any old bits in ERR reg).     */    (*tc_sw.clear_errors)();    splnone();    config_delay();        /*     * Mark each "ibus" alive so installation sizer will see it.     */    for (i = 0; tc_sw.config_order[i] != -1; i++) {	index = tc_sw.config_order[i];	config_set_alive("ibus", tc_slot[index].slot, 0, 0);    }        /*     * Go thru the tc_slot table and call ib_config_dev for each     *   device and ib_config_cont for each controller.     * The ib_config_* routines will in turn call the probe and attach     *   routines for each device/controller.     * If its an adapter, we get the name of the config routine from     *   the maxoption data table.     */    for (i = 0; tc_sw.config_order[i] != -1; i++) {	index = tc_sw.config_order[i];	if (tc_slot[index].unit >= 0) {	/* have a valid table entry */	    if (tc_slot[index].class == TC_CTLR) {		if (!(ib_config_cont(PHYS_TO_K1(tc_slot[index].physaddr),				     tc_slot[index].physaddr, tc_slot[index].slot, 				     tc_slot[index].devname, 0))) {		    printf("%s%d not probed\n",			   tc_slot[index].devname, tc_slot[index].unit);		    (*tc_sw.disable_option)(index);		} else {		    if (tc_slot[index].intr_aft_attach) {			(*tc_sw.enable_option)(index);		    } else {			(*tc_sw.disable_option)(index);		    }		}	    } else if (tc_slot[index].class == TC_DEV) {		if (!(ib_config_dev(PHYS_TO_K1(tc_slot[index].physaddr),				    tc_slot[index].physaddr, tc_slot[index].slot,				    tc_slot[index].devname, 0))) {		    printf("%s%d not probed\n",			   tc_slot[index].devname, tc_slot[index].unit);		    (*tc_sw.disable_option)(index);		} else {		    if (tc_slot[index].intr_aft_attach) {			(*tc_sw.enable_option)(index);		    } else {			(*tc_sw.disable_option)(index);		    }		}	    } else if (tc_slot[index].class == TC_ADPT) {		if (!(*(tc_slot[index].adpt_config))(PHYS_TO_K1(tc_slot[index].physaddr),						    tc_slot[index].physaddr,						    tc_slot[index].slot,						    tc_slot[index].unit,						    &tc_slot[index].intr)) {		    printf("%s%d not probed\n",			   tc_slot[index].devname, tc_slot[index].unit);		    (*tc_sw.disable_option)(index);		} else {		    if (tc_slot[index].intr_aft_attach) {			(*tc_sw.enable_option)(index);		    } else {			(*tc_sw.disable_option)(index);		    }		}	    }	}    }}/* * Search thru the tc_slot table to see if the given func address has *   already been used (already in the table).  Return 1 if used, 0 if not. * This is for devices & controllers that have the ibus number wildcarded. */tc_func_used(intr)	int (*intr)();		/* the interrupt routine for this device */{	register int i;	for (i = 0; i < TC_IOSLOTS; i++) {		if (tc_slot[i].intr == intr)			return(1);	}	return (0);}tc_isolate_memerr(memerr_status)	struct tc_memerr_status *memerr_status;{    if (memerr_status->va == 0) 	memerr_status->va = (caddr_t)PHYS_TO_K1(memerr_status->pa);    if (tc_sw.isolate_memerr)	return ((*tc_sw.isolate_memerr)(memerr_status));    else	return (-1);}

⌨️ 快捷键说明

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