%TITLE 'Flamingo Autoconfiguration Routines' MODULE FOOB$ICBM (IDENT = 'X-7', LANGUAGE(BLISS64E), ENVIRONMENT(NOFP), ADDRESSING_MODE(EXTERNAL=GENERAL)) = BEGIN ! Hacked up ICBM called FOOB$ so we can debug iogen mods... ! !**************************************************************************** !* * !* COPYRIGHT (c) 1991, 1992 BY * !* DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS. * !* 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: ! ! IOGEN ! ! ABSTRACT: ! ! This module provides autoconfiguration functions for the Flamingo system. ! ! ENVIRONMENT: ! ! Called in exec mode, IPL 0 ! ! AUTHOR: ! ! Jim Janetos CREATION DATE: 03-Dec-1991 ! ! REVISION HISTORY: ! ! X-7 JPJ James P. Janetos 11-Dec-1992 ! Call iogen$ac_select to determine if OP ports should ! be configured. ! ! X-6 RWC101 Richard W. Critz, Jr. 22-Oct-1992 ! Don't call the SET_TERM_INTR console callback without holding ! the device lock. ! ! X-5 JPJ Jim Janetos 09-Jul-1992 ! Add iogen$_node item list code to load_driver calls so that ! the Turbo slot number is copied to the CRB. ! ! Remove Core I/O configuration from this module. Core I/O ! configuration is now accomplished by iogen$coreio_config. ! ! X-4 JPJ Jim Janetos 19-Jun-1992 ! Get the interrupt vector directly from the bus array entry. ! ! X-3 JPJ Jim Janetos 16-Jun-1992 ! Fix bug in configuring Core I/O devices. We were ignoring the ! ISDN chip. ! ! Change version number due to master pack cleanup (reserved as ! generation 2). ! ! X-4 JPJ Jim Janetos 12-Mar-1992 ! Add opdriver autoconfigure. ! ! X-3 RWC075 Richard W. Critz, Jr. 3-Mar-1992 ! Integrate autoconfigure logging. ! ! X-2 JPJ Jim Janetos 05-Feb-1992 ! Fix bug in call to iogen$assign_controller. Should pass address ! of string instead of address of descriptor. ! ! X-1 JPJ Jim Janetos 28-Jan-1992 ! Initial version. !-- ! Libraries and macros ! REQUIRE 'sys$library:arch_defs.req'; LIBRARY 'sys$library:lib.l64'; ! ! Table of Contents: ! FORWARD ROUTINE iogen$icbm_init, iogen$ka0402_op_config, deliver_opa2_ucb, ena_opa1_interrupt : NOVALUE, ena_opa2_interrupt : NOVALUE; ! External routines EXTERNAL ROUTINE iogen$turbo_config, ! BSR iogen$coreio_config, ! BSR iogen$ac_select, iogen$log, sys$load_driver; ! External global variables and literals ! EXTERNAL LITERAL iogen$_icbm_ok; EXTERNAL opa$ar_ddb : LONG SIGNED, opa$ar_crb : LONG SIGNED, exe$gpq_hwrpb : REF BLOCK [,BYTE]; %SBTTL 'ABM - Autoconfigure Bus Mapping Table for Flamingo' ! ! The Autoconfigure Bus Mapping Table contains longword pairs. Each longword ! pair associates an adapter type code and an autoconfiguration routine for ! that adapter. The autoconfigure master scans the ADP list, and for each ! ADP, invokes an adapter specific autoconfiguration routine if the ADP ! adapter type matches an adapter type from the Autoconfigure Bus Mapping ! Table. ! iogen$build_abm (abm_0402, ! ! Adapter Type Configuration Routine ! ------------ --------------------- at$_ka0402, iogen$ka0402_op_config, at$_tc, iogen$turbo_config, at$_coreio, iogen$coreio_config ); %SBTTL 'iogen$icbm_init -- Flamingo autoconfiguration init routine' GLOBAL ROUTINE iogen$icbm_init (abm_ref : SIGNED LONG) = !+ ! FUNCTION ! ! This is the initialization routine for Flamingo autoconfiguration. It ! is called by the autoconfig master routine and returns the address of the ! Flamingo Autoconfigure Bus Mapping Table (ABM). ! ! INPUT ! ! abm_ref (output) -- address of a longword cell to receive the address ! of the Flamingo Autoconfigure Bus Mapping Table. ! ! IMPLICIT INPUT ! ! none ! ! EXPLICIT OUTPUT ! ! IOGEN$_ICBM_OK Successful completion. ! !- BEGIN ! of routine iogen$icbm_init BIND abm = .abm_ref : SIGNED LONG; abm = abm_0402; ! Write address of ABM table to caller's address RETURN iogen$_icbm_ok; END; ! End of routine iogen$icbm_init %SBTTL 'iogen$ka0402_op_config - Configure opdriver driver devices on flamingo' ROUTINE iogen$ka0402_op_config (handle : SIGNED LONG) = !+ ! FUNCTION ! ! This routine configures OPA1 and OPA2 on the flamingo ! ! INPUT ! ! handle : Magic number passed in by iogen$autoconfigure ! ! IMPLICIT INPUT ! ! Called in exec mode at IPL 0. ! ! EXPLICIT OUTPUT ! ! ss$_normal OPA1 and OPA2 configured !- BEGIN ! of iogen$ka0402_op_config LOCAL status : INITIAL (ss$_normal), devname1 : VECTOR [4, BYTE] VOLATILE INITIAL(BYTE(%ASCII'OPA1')), devname1_desc : VECTOR [2, LONG] INITIAL ( LONG (4), ! String length LONG (devname1)), ! Address of string devname2 : VECTOR [4, BYTE] VOLATILE INITIAL(BYTE(%ASCII'OPA2')), devname2_desc : VECTOR [2, LONG] INITIAL ( LONG (4), ! String length LONG (devname2)), ! Address of string driver_name : VECTOR [8, BYTE] VOLATILE INITIAL (BYTE(%ASCII'OPERATOR')), drivername_desc : VECTOR [2, LONG] INITIAL ( LONG (8), LONG (driver_name)), op_itemlist : $ITMLST_DECL (items=4) VOLATILE, op_iosb : VECTOR [4, WORD], op_unit : VOLATILE UNSIGNED LONG , opa1_ucb : VOLATILE SIGNED LONG , opa2_ucb : VOLATILE SIGNED LONG , op_crb : LONG SIGNED, sysg_ptr : REF BLOCK [,BYTE]; MAP opa$ar_crb : REF BLOCK [,BYTE]; sysg_ptr = .opa$ar_crb [crb$ps_sysg_dblk]; op_crb = .opa$ar_crb; IF (.sysg_ptr [sysg$v_ucb_config_pport] AND iogen$ac_select (.handle, devname1_desc)) THEN BEGIN op_unit = 1; opa1_ucb = 0; ! make compiler happy $ITMLST_INIT (ITMLST=op_itemlist, (ITMCOD = iogen$_noadapter, BUFSIZ = 0, BUFADR = 0), (ITMCOD = iogen$_ucb, BUFSIZ = 4, BUFADR = opa1_ucb), (ITMCOD = iogen$_sysloa_crb, BUFSIZ = 4, BUFADR = .op_crb), (ITMCOD = iogen$_unit, BUFSIZ = 4, BUFADR = op_unit) ); ! Call load_driver to connect the port. status = sys$load_driver (iogen$_connect, ! function code devname1_desc, drivername_desc, op_itemlist, op_iosb); IF .status THEN status = .op_iosb [0]; iogen$log (.handle, .status, devname1_desc, drivername_desc); ! If the device already exists, sys$load_driver returns an error ! status of ss$_devexists. Since this isn't really an error, change ! this status to ss$_normal. Return other errors to the caller. IF .status EQL ss$_devexists THEN status = ss$_normal; IF NOT .status THEN RETURN .status; ! Call kernel routine to enable opa1 interrupts iogen$call_kernel_routine (ena_opa1_interrupt, .opa1_ucb); END; IF (.sysg_ptr [sysg$v_ucb_config_kbio] AND iogen$ac_select (.handle, devname2_desc)) THEN BEGIN ! Now configure unit 2 opa2_ucb = 0; ! make compiler happy op_unit = 2; $ITMLST_INIT (ITMLST = op_itemlist, (ITMCOD=iogen$_noadapter, BUFSIZ = 0, BUFADR = 0), (ITMCOD=iogen$_ucb, BUFSIZ = 4, BUFADR = opa2_ucb), (ITMCOD=iogen$_sysloa_crb, BUFSIZ = 4, BUFADR = .op_crb), (ITMCOD=iogen$_unit, BUFSIZ = 4, BUFADR = op_unit) ); ! Call load_driver to connect the port. status = sys$load_driver (iogen$_connect, devname2_desc, drivername_desc, op_itemlist, op_iosb); IF .status THEN status = .op_iosb [0]; iogen$log (.handle, .status, devname2_desc, drivername_desc); ! If the device already exists, sys$load_driver returns an error ! status of ss$_devexists. Since this isn't really an error, change ! this status to ss$_normal. Return other errors to the caller. IF .status EQL ss$_devexists THEN status = ss$_normal; IF NOT .status THEN RETURN .status; ! Call kernel routine to enable opa2 interrupts and to deliver the ! opa2 ucb. iogen$call_kernel_routine (ena_opa2_interrupt, .opa2_ucb); iogen$call_kernel_routine (deliver_opa2_ucb, .opa2_ucb); END; RETURN .status; END; ! of config_op %SBTTL 'Deliver KB UCB to sysg data block' ROUTINE deliver_opa2_ucb (opa2_ucb: SIGNED LONG) = !++ ! ! Functional Description: ! ! This routine places the KB UCB in the sysg structure for DECW. ! ! Inputs: ! UCB address ! ! Outputs: ! None ! ! Return Status: ! Success !-- BEGIN LOCAL sysg_ptr : REF BLOCK [,BYTE]; MAP opa$ar_crb : REF BLOCK [,BYTE]; sysg_ptr = .opa$ar_crb [crb$ps_sysg_dblk]; sysg_ptr [sysg$iq_kb_ucb] = .opa2_ucb; RETURN ss$_normal; END; %SBTTL 'Enable Printer port interrupts' ROUTINE ena_opa1_interrupt (opa1_ucb : SIGNED LONG) : NOVALUE = !++ ! ! Functional Description: ! This routine enables HW interrupts on OPA1 (Printer port), when ! it is not being used as the console. (Note: OPA2 is a logical ! device and does need this done) ! ! Inputs: ! UCB address ! ! Outputs: ! None ! ! Return Status: ! Success !-- BEGIN MAP opa1_ucb : REF BLOCK[,BYTE]; LITERAL mask = %X'202'; LOCAL status, ipl, unit : INITIAL (1), crb_ptr : REF BLOCK [, BYTE] INITIAL (.exe$gpq_hwrpb + .exe$gpq_hwrpb [hwrpb$iq_crb_offset]); BIND ROUTINE disp = .crb_ptr [hwrpb_crb$iq_va_dispatch_pd]; ! The SRM requires that the SET_TERM_INTR console callback routine be ! called at or above console DIPL. Acquire the device lock before ! making the call. $devicelock(lockaddr = .opa1_ucb[ucb$l_dlck], savipl = ipl); status = disp (hwrpb_crb$k_set_term_intr, .unit, mask); $deviceunlock(lockaddr = .opa1_ucb[ucb$l_dlck], newipl = .ipl); END; %SBTTL 'Enable KB port interrupts' ROUTINE ena_opa2_interrupt (opa2_ucb: SIGNED LONG) : NOVALUE = !++ ! ! Functional Description: ! This routine enables HW interrupts on OPA2 (KB port). ! ! Inputs: ! UCB address ! ! Outputs: ! None ! ! Return Status: ! Success !-- BEGIN MAP opa2_ucb : REF BLOCK[,BYTE]; LITERAL mask = %X'202'; LOCAL status, ipl, unit : INITIAL (2), crb_ptr : REF BLOCK [,BYTE] INITIAL (.exe$gpq_hwrpb + .exe$gpq_hwrpb [hwrpb$iq_crb_offset]); BIND ROUTINE disp = .crb_ptr [hwrpb_crb$iq_va_dispatch_pd]; ! The SRM requires that the SET_TERM_INTR console callback routine be ! called at or above console DIPL. Acquire the device lock before ! making the call. $devicelock(lockaddr = .opa2_ucb[ucb$l_dlck], savipl = ipl); status = disp (hwrpb_crb$k_set_term_intr, .unit, mask); $deviceunlock(lockaddr = .opa2_ucb[ucb$l_dlck], newipl = .ipl); END; END ! End of module icbm_0402 ELUDOM