📄 mscp_config.c
字号:
#ifndef lintstatic char *sccsid = "@(#)mscp_config.c 4.3 (ULTRIX) 12/6/90";#endif lint/************************************************************************ * * * Copyright (c) 1985 - 1989 by * * Digital Equipment Corporation, Maynard, MA * * All rights reserved. * * * * This software is furnished under a license and may be used and * * copied only in accordance with the terms of such license and * * with the inclusion of the above copyright notice. This * * software or any other copies thereof may not be provided or * * otherwise made available to any other person. No title to and * * ownership of the software is hereby transferred. * * * * The information in this software is subject to change without * * notice and should not be construed as a commitment by Digital * * Equipment Corporation. * * * * Digital assumes no responsibility for the use or reliability * * of its software on equipment which is not supplied by Digital. * * * ************************************************************************ * * * Facility: Systems Communication Architecture * Disk and Tape Class Driver common code. * * Abstract: This module contains functions which locate and fill in * various static ULTRIX data structures with information * obtained dynamically from the class drivers and underlying * SCA layers. * * mscp_find_controller Find controller structure for connection * mscp_find_device Find device structure for unit * mscp_find_model Get controller model information * mscp_strcmp Utility string compare function * mscp_adapt_check Check whether this controller attaches to this * adapter as specified by the configuration. * * Author: David E. Eiche Creation Date: September 30, 1985 * * History: * * 04-Dec-1990 Pete Keilty * Added new routine mscp_adapt_check() for static load balancing. * Checks whether this controller attaches to this adapter as * specified by the configuration. * * 05-Jul-1990 Pete Keilty * Changed mscp_find_controller bus_type for CI is now DEV_BICI, * DEV_XMICI and DEV_CI depending on interconnect. * * 06-Jun-1990 Pete Keilty * Changed mscp_find_controller to find wildcarded at ci? for HSC's. * * 27-Dec-1989 David E. Eiche DEE0081 * Change mscp_find_model() to eliminate the setting of host * timeout. * * 09-Nov-1989 David E. Eiche DEE0080 * Change mscp_find_model() to use the new software port and * interconnect type fields in the local port information block * to fill in the controller name and bus type fields of the * connection block. * * 26-Sep-1989 Tim Burke * Test to make sure that dkn < DK_NDRIVE before assigning the dk slot for * disk statistics. * * 18-May-1989 Tim Burke * Changed mscp_find_device to wildcard slave numbers with a -1 instead of * using '?'. This is necessary because the '?' character conflicts with * unit number 63. * * 17-Jan-1989 Todd M. Katz TMK0002 * 1. The macro Scaaddr_lol() has been renamed to Scaaddr_low(). It now * accesses only the low order word( instead of low order longword ) of * a SCA system address. * 2. Include header file ../vaxmsi/msisysap.h. * 3. Use the ../machine link to refer to machine specific header files. * * 05-Aug-1988 David E. Eiche DEE0049 * Rearrange the code added in DEE0048 to provide defaults for * bus type and controller name, improve code style, and add a * case for the BVPSSP hardware port type. * * 27-Jul-1988 David E. Eiche DEE0048 * Change mscp_find_model to use information acquired from the * port driver to determine the bus type and config name of the * controller when that information cannot be derived directly * from the model code. * * 17-Jul-1988 David E. Eiche DEE0047 * Change mscp_find_controller to store the ubminit structure * pointer in the connection block, rather than return it as * the function value. * * 17-Jul-1988 David E. Eiche DEE0046 * Move mscp_find_model routine to this module and change it * to correspond to the new model table format and to store * various fields in the connection block. * * 02-Jun-1988 Ricky S. Palmer * Removed inclusion of header file ../vaxmsi/msisysap.h * Added new code to correctly configure "dssc". * * 29-Apr-1988 David E. Eiche DEE0033 * Add code to fill hardcoded "ra" and "hsc" strings into the * hscdriver driver table entry. Also correct header comment * for 25-Apr-1988. * * 25-Apr-1988 Robin * Added code to enable disk I/O statistics gathering for MSCP * disks. * * 07-Feb-1988 David E. Eiche DEE0026 * Change mscp_find_controller to print the controller name and number * from the ubminit entry, add the remote controller number to the * printout, and provide an additional message to clarify status when a * HSC controller cannot be found in the configuration file. * * 07-Feb-1988 David E. Eiche DEE0025 * Change mscp_find_controller to propogate adaptor number and * nexus number from the adaptor entry to the controller entry * in the config_adpt table. This allows the change made in * DEE0012 to work. Also change mscp_find_device to propogate * the remote controller number from ubminit to ubdinit entries. * * 02-Feb-1988 David E. Eiche DEE0012 * Change mscp_find_controller to get adaptor number and nexus * out of new fields in the adaptor configuration table rather * than the CI adaptor table. * * 15-Jan-1988 Todd M. Katz TMK0001 * Include new header file ../io/msi/msisysap.h. *//**//* Libraries and Include Files. */#include "../h/types.h"#include "../h/time.h"#include "../h/param.h"#include "../h/kmalloc.h"#include "../h/buf.h"#include "../h/errno.h"#include "../h/ioctl.h"#include "../h/devio.h"#include "../h/dk.h"#include "../h/file.h"#include "../fs/ufs/fs.h"#include "../h/errlog.h"#include "../machine/pte.h"#include "../h/vmmac.h"#include "../h/config.h"#include "../io/scs/sca.h"#include "../io/ci/cippdsysap.h"#include "../io/ci/cisysap.h"#include "../io/ci/ciadapter.h"#include "../io/bi/bvpsysap.h"#include "../io/gvp/gvpsysap.h"#include "../io/msi/msisysap.h"#include "../io/uba/uqsysap.h"#include "../io/sysap/sysap.h"#include "../io/uba/ubavar.h"#include "../io/sysap/mscp_msg.h"#include "../io/sysap/mscp_defs.h"/**//* External Variables and Routines. */extern struct uba_ctlr ubminit[];extern struct uba_device ubdinit[];extern struct uba_driver mscpdriver;extern struct config_adpt config_adpt[];extern MODEL model_tbl[];extern int model_ct;extern int dkn;void mscp_find_controller();void mscp_find_device();void mscp_find_model();/**//* * * Name: mscp_find_controller - Find controller in Unibus database. * * Abstract: This function attempts to find a "Unibus" controller table * entry corresponding to the supplied connection. No wildcard * card matching is provided for any field. * * Inputs: IPL_SCS * cp Connection block pointer * cnt_name config name for controller * cnt_number remote controller number if HSC; * otherwise logical controller index. * Implicit * Inputs: ubminit Unibus controller table * config_adpt config'ed adapter table * * Outputs: * * * Return * Values: NONE */voidmscp_find_controller( cp ) register CONNB *cp;{ register struct uba_ctlr *um; register struct config_adpt *ap, *ap1; register u_long found = 0; register u_long adapt_num = Ctrl_from_name( cp->lport_name ); /* If the connection is to an HSC, search for a ubminit entry that * matches on controller name and remote controller number. If * a match is found: * * 1. Find the corresponding controller entry in the config_adpt table. * 2. Find the parent adaptor entry in the config_adpt table. * 3. Propogate the bus number and nexus number from the adaptor entry * to the controller entry in the config_adpt table, and then into * the ubminit entry. * 4. Link the config_adpt entry to the ubminit entry. * 5. Hard wire "ra" and "hsc" into the corresponding driver * table entry. * 6. If the unit had not been previously marked alive, mark it so * and print a message identifying the controller. * 7. Return a pointer to the ubminit entry to the caller. * */ if( mscp_strcmp( "hsc", cp->cnt_name ) == 0 || mscp_strcmp( "dssc", cp->cnt_name ) == 0) { for( um = ubminit; um->um_driver; um++ ) if(( mscp_strcmp( um->um_ctlrname, cp->cnt_name ) == 0 ) && um->um_rctlr == cp->cnt_number ) break; if( um->um_driver ) { for( ap = config_adpt; ap->p_name; ap++ ) if(( ap->c_name == ( char * )um->um_driver ) && ( ap->c_num == um->um_ctlr ) && ( ap->c_type == 'C' )) break; if( ap->p_name ) { for( ap1 = config_adpt; ap1->p_name; ap1++ ) if(( mscp_strcmp( ap1->c_name, ap->p_name ) == 0 ) && ( ap1->c_num == adapt_num ) && ( ap1->c_type == 'A' ) && ( ap1->c_ptr )) break; if( ap1->p_name ) { found++; ap->c_bus_num = ap1->c_bus_num; ap->c_nexus_num = ap1->c_nexus_num; um->um_adpt = ap1->c_bus_num; um->um_nexus = ap1->c_nexus_num; um->um_ubanum = 0; ap->c_ptr = ( caddr_t )um; ap->p_num = adapt_num; um->um_driver->ud_dname = "ra"; if( mscp_strcmp( "dssc", cp->cnt_name ) == 0) { um->um_driver->ud_mname = "dssc"; } else { um->um_driver->ud_mname = "hsc"; } if( um->um_alive == 0 ) { um->um_alive = 1; printf("%s%d at %s%d node %d\n", um->um_ctlrname, um->um_ctlr, ap->p_name, ap->p_num, um->um_rctlr ); } } } } /* If the connection is to another controller type, search for a ubminit * entry that matches on controller name and controller number. If a * match is found, return a pointer to the ubminit entry to the caller. */ } else { for( um = ubminit; um->um_driver; um++ ) if(( mscp_strcmp( um->um_ctlrname, cp->cnt_name ) == 0 ) && um->um_ctlr == cp->cnt_number ) break; if( um->um_driver ) found++; } /* If the controller cannot be found in the ubminit table, print * a diagnostic and set the um pointer to NULL. */ if( found == 0 ) { if( mscp_strcmp( "hsc", cp->cnt_name ) == 0 || mscp_strcmp( "dssc", cp->cnt_name ) == 0 ) printf( "mscp_find_controller: %s at node %d not config'ed\n",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -