00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <linux/kernel.h>
00012 #include <asmlink.h>
00013 #include <linux/smp.h>
00014 #include <linux/sched.h>
00015 #include <asm/hw_irq.h>
00016 #include <asm/current.h>
00017 #include <system_data_cells.h>
00018 #include <ipl.h>
00019 #include <internals.h>
00020 #include<queue.h>
00021 #include<ddtdef.h>
00022 #include<ucbdef.h>
00023 #include<irpdef.h>
00024 #include<ipldef.h>
00025 #include<ddbdef.h>
00026 #include <ioc_routines.h>
00027 #include <smp_routines.h>
00028
00029 #include <linux/sched.h>
00030
00031 #undef MYDEB_REQCOM
00032 #define MYDEB_REQCOM
00033
00034
00035
00036
00037
00038
00039
00040 void ioc_initiate(struct _irp * i, struct _ucb * u) {
00041 struct _ddt *d;
00042 void (*f)(void *,void *);
00043
00044
00045 u->ucb_l_irp=i;
00046
00047
00048 u->ucb_l_svapte=i->irp$l_svapte;
00049 u->ucb_l_boff=i->irp$l_boff;
00050 u->ucb_l_bcnt=i->irp$l_bcnt;
00051
00052
00053 u->ucb_l_sts&=~(UCB$M_TIMOUT|UCB$M_CANCEL);
00054
00055
00056
00057
00058 d=u->ucb_l_ddt;
00059 f=d->ddt_l_start;
00060
00061 f(i,u);
00062
00063 }
00064
00065 void ioc_std_initiate(struct _irp * i, struct _ucb * u) {
00066 ioc_initiate(i,u);
00067 }
00068
00069 extern int exetimeout;
00070
00071 #ifdef MYDEB_REQCOM
00072 long reqcom[32*1024];
00073 long reqcomc[32]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
00074 #endif
00075
00076
00077
00078
00079
00080
00081
00082
00083 void ioc_reqcom(int iosb1, int iosb2, struct _ucb * u) {
00084 int qemp;
00085 int savipl;
00086 struct _irp * i=u->ucb_l_irp;
00087 #ifdef MYDEB_REQCOM
00088 {
00089 long addr = &iosb1;
00090 addr -= 0x4;
00091 int pid=i->irp_l_pid&31;
00092 reqcom[1024*pid+reqcomc[pid]]=i;
00093 reqcomc[pid]++;
00094 reqcom[1024*pid+reqcomc[pid]]=i->irp_w_empty;
00095 reqcomc[pid]++;
00096 reqcom[1024*pid+reqcomc[pid]]=((long*)addr)[0];
00097 reqcomc[pid]++;
00098 reqcom[1024*pid+reqcomc[pid]]=exe_gl_abstim_tics;
00099 reqcomc[pid]++;
00100 if (reqcomc[pid]>1000)
00101 reqcomc[pid]=0;
00102 }
00103 #endif
00104
00105
00106
00107
00108
00109 i->irp_l_iost1=iosb1;
00110 i->irp_l_iost2=iosb2;
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122 if (i==0) {
00123 printk("i should not be 0\n");
00124 goto end;
00125 }
00126
00127
00128
00129 savipl=getipl();
00130 if (savipl<IPL__IOPOST)
00131 setipl(IPL__IOPOST);
00132
00133
00134
00135 vmslock(&SPIN_IOPOST, -1);
00136
00137
00138 qemp=rqempty(&ioc_gq_postiq);
00139 insqti(i,&ioc_gq_postiq);
00140
00141
00142
00143 vmsunlock(&SPIN_IOPOST, -1);
00144 #if 0
00145 long * l2=&ioc_gq_postiq;
00146 long l=((long)l2)+(*l2);
00147 if (i==l)
00148 goto skip_it;
00149 insqti(i,&ioc_gq_postiq);
00150 skip_it:
00151 #endif
00152 if (!qemp) goto notempty;
00153
00154
00155
00156
00157 if (smp_processor_id() == smp_gl_primid) {
00158 SOFTINT_IOPOST_VECTOR;
00159 } else {
00160
00161 smp_send_work(CPU_M_IOPOST, 0);
00162
00163 }
00164 notempty:
00165 {
00166 }
00167
00168
00169 setipl(savipl);
00170
00171
00172
00173
00174 qemp=aqempty(u->ucb_l_ioqfl);
00175 if (qemp) goto end;
00176
00177
00178 i=remque(u->ucb_l_ioqfl,i);
00179
00180
00181 return ioc_initiate(i,u);
00182 end:
00183
00184 if (aqempty(u->ucb_l_ioqfl))
00185 u->ucb_l_sts&=~UCB$M_BSY;
00186
00187
00188 }
00189
00190 void ioc_std_reqcom(int iosb1, int iosb2, struct _ucb * u) {
00191 return(ioc_reqcom(iosb1,iosb2,u));
00192 }
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205 void ioc_wfikpch(void * nextfunc, void * timeoutfunc, struct _irp * i, unsigned long fr4, struct _ucb * u, int timeout, int oldipl) {
00206
00207
00208 u->ucb_l_sts|=UCB$M_INT|UCB$M_TIM;
00209
00210 u->ucb_l_duetim=exe$gl_abstim+timeout;
00211
00212 u->ucb_l_fr3=i;
00213 u->ucb_l_fr4=fr4;
00214
00215 u->ucb_l_fpc=nextfunc;
00216
00217 u->ucb_l_sts&=~UCB$M_TIMOUT;
00218
00219 }
00220
00221 int ioc_scan_iodb_usrctx(struct _ddb **d) {
00222 if ((*d)->ddb_ps_link)
00223 (*d)=(*d)->ddb_ps_link;
00224 else
00225 *d=0;
00226 }
00227
00228 int ioc_cvt_devnam() {
00229
00230 }
00231
00232 int exe_match_name(struct _ddb * d, char * s) {
00233
00234 }
00235
00236 void ioc_std_cancelio (signed int chan, struct _irp *irp, struct _pcb *pcb, struct _ucb *ucb) {
00237 if (ucb->ucb_l_sts&UCB$M_BSY && irp->irp$l_pid==pcb->pcb$l_pid && (-chan)==irp->irp$w_chan) {
00238 ucb->ucb_l_sts|=UCB$M_CANCEL;
00239 }
00240 }
00241
00242 int ioc_ctrl_init (struct _crb *crb, struct _ddb *ddb) {
00243 struct _ddt * ddt = ddb->ddb_l_ddt;
00244 int (*ctrlinit_2)() = ddt->ddt_ps_ctrlinit_2;
00245 if (ctrlinit_2)
00246 ctrlinit_2(0 , ddb, crb);
00247 }
00248
00249 int ioc_unit_init (struct _ucb *ucb) {
00250 struct _ddt * ddt = ucb->ucb_l_ddt;
00251 int (*unitinit)() = ddt->ddt_l_unitinit;
00252 if (unitinit)
00253 unitinit(0, ucb);
00254 struct _ddb * ddb = ucb->ucb_l_ddb;
00255 struct _dpt * dpt = ddb->ddb_ps_dpt;
00256 void (*init)() = dpt->dpt_ps_init_pd;
00257 void (*reinit)() = dpt->dpt_ps_reinit_pd;
00258 long orb = 0;
00259 long idb = 0;
00260 long crb = 0;
00261 struct _ddb * dbb = ucb->ucb_l_ddb;
00262 if (init)
00263 init(crb, ddb, idb, orb, ucb);
00264 if (reinit)
00265 reinit(crb, ddb, idb, orb, ucb);
00266 }
00267