channels.h

Go to the documentation of this file.
00001 /*
00002 **++
00003 **  IDENT X-5
00004 **
00005 **  FACILITY:  DRIVER
00006 **
00007 **  Copyright (C) 1998 by
00008 **  Digital Equipment Corporation, Maynard, Massachusetts.
00009 **  All rights reserved.
00010 **
00011 **  This software is furnished under a license and may be used and copied
00012 **  only  in  accordance  of  the  terms  of  such  license  and with the
00013 **  inclusion of the above copyright notice. This software or  any  other
00014 **  copies thereof may not be provided or otherwise made available to any
00015 **  other person.  No title to and  ownership of the  software is  hereby
00016 **  transferred.
00017 **
00018 **  The information in this software is  subject to change without notice
00019 **  and  should  not  be  construed  as a commitment by Digital Equipment
00020 **  Corporation.
00021 **
00022 **  Digital assumes no responsibility for the use  or  reliability of its
00023 **  software on equipment which is not supplied by Digital.
00024 **
00025 **  MODULE DESCRIPTION:
00026 **
00027 **      This module contains definitions and macros used by pbdriver.c
00028 **      and channels.c, the shared memory interconnect driver.
00029 **      {@tbs@}
00030 **
00031 **  AUTHORS:
00032 **
00033 **              Phil Norwich
00034 **              Juan F. Astorga
00035 **              Gregory H. Jordan
00036 **
00037 **  CREATION DATE:  March 5, 1998
00038 **
00039 **  DESIGN ISSUES:
00040 **
00041 **      None
00042 **
00043 **  SUBSYSTEM:
00044 **   
00045 **      SMCI - Shared Memory Cluster Interconnect driver
00046 **   
00047 **  MODIFICATION HISTORY:
00048 **
00049 **      X-5     JFA         Juan F. Astorga             24-Jul-1998
00050 **              Change macro REMQTI to use pal remque non-resident 
00051 **              version. This simplifies a lot the problem of
00052 **              mapping added channel section pages.
00053 **
00054 **      X-4     JFA         Juan F. Astorga             4-May-1998
00055 **              Delete head argument from channel allocation routines.
00056 **              Not needed since a head pointer is in the handle.
00057 **
00058 **      X-3     JFA         Juan F. Astorga             5-Mar-1998
00059 **              Change argument of pb$send_channel_buffer to reflect
00060 **              change in channel module.
00061 **
00062 **      X-2     GHJ         Gregory H. Jordan           12-Mar-1998
00063 **              Add updates to support shutdown.
00064 **
00065 **      X-1     JFA         Juan F. Astorga             5-Mar-1998
00066 **              Initial entry.
00067 **      
00068 **--
00069 */
00070 
00071 /*        
00072 **  prototypes
00073 **  {@tbs@}
00074 */        
00075 
00076 int pb$return_to_free(SMWE *e, SMH *smh);
00077 int pb$get_from_free (SMWE **e, SMH *smh);
00078 int pb$allocate_channel_buffer (SMH *smh, void **buffer);
00079 int pb$deallocate_channel_buffer (SMH *smh, void *buffer);
00080 int pb$send_channel_buffer (SMH *smh, void *buff,int len,int prio);
00081 int pb$create_channel_block (SMH *smh, PB_UCB *ucb);
00082 int pb$start_shutdown( UCB *ucb );
00083 void pb$validate_harter_list(SMH *smh);
00084 
00085 #define RPAGE mmg$gl_bwp_mask
00086 #define R64BT 63
00087 #define RQUAD 7
00088 #define ROUND(s,R) ((s + R) & ~R)
00089 
00090 #define BYTE2PAGE(s) (s >> mmg$gl_bwp_width)
00091 
00092 #define min(x,y) (x<y?x:y)
00093 #define max(x,y) (x>y?x:y)
00094 
00095 /*        
00096 **  INSQUE MACRO
00097 **  This macro attempts to insqueti an entry by calling PAL INSQUETILR
00098 **  routine. On failure, it re-try until the giveup counter expires.
00099 **  We use the resident versions as the entries are already mapped and
00100 **  carved.
00101 */        
00102 #define NQUE    32000                           // giveup counter for queues
00103 #define INSQTI(s,head,ent)                                      \
00104         {                                                       \
00105         register int loop=NQUE;                                 \
00106                                                                 \
00107         while (loop--)                                          \
00108             {                                                   \
00109             s = __PAL_INSQTILR((void *)head,ent);               \
00110             if (s != -1)                                        \
00111                 break;                                          \
00112             }                                                   \
00113          }                                                      \
00114 
00115 /*        
00116 **  REMQUE MACRO
00117 **  This macro attempts to remqueti an entry by calling PAL REMQUETIL
00118 **  routine. On failure, it re-try until the giveup counter expires.
00119 **  We use here the non-resident version as the entries may not be
00120 **  mapped in the local instance.
00121 */        
00122 #define REMQHI(s,head,ent)                                      \
00123         {                                                       \
00124         register int loop=NQUE;                                 \
00125                                                                 \
00126         while (loop--)                                          \
00127             {                                                   \
00128             s = __PAL_REMQHIL((void *)head,(void **)ent);       \
00129             if (s != -1)                                        \
00130                 break;                                          \
00131             }                                                   \
00132          }                                                      \
00133 
00134 
00135 #define WQ_q(i)         smnd$r_wq_cls[i].smnd$q_work_queue
00136 #define WQ_l(i)         smnd$r_wq_cls[i].smnd$l_work_queue
00137 
00138 #define BASE    smh->smh$pl_channel                     // channel base
00139 // channel offset to VA 
00140 #define CHO2VA(offset) (void *) ((uint32)offset + (uint32)BASE)
00141 
00142 // Virtual address to channel offset
00143 #define VA2CHO(va)     (uint32) ((uint32)va     - (uint32)BASE)
00144 
00145 int bug_check_pb();

SourceForge.net Logo
Project space on SourceForge.net