00001
00002
00003
00004
00005
00006 #include<linux/linkage.h>
00007
00008 #include<starlet.h>
00009 #include<ssdef.h>
00010 #include<dvidef.h>
00011 #include<system_data_cells.h>
00012 #include<misc.h>
00013 #include<ddbdef.h>
00014 #include<pridef.h>
00015 #include<ucbdef.h>
00016 #include <exe_routines.h>
00017 #include <ioc_routines.h>
00018 #include <sch_routines.h>
00019
00020 #include<linux/sched.h>
00021
00022 struct _generic_64 {
00023 long long l;
00024 };
00025
00026 asmlinkage int exe_getdvi(unsigned int efn, unsigned short int chan, void *devnam, void *itmlst, struct _iosb *iosb, void (*astadr)(), int astprm, struct _generic_64 *nullarg);
00027
00028 asmlinkage int exe_getdvi_wrap(struct struct_getdvi *s) {
00029 return exe_getdvi(s->efn,s->chan,s->devnam,s->itmlst,s->iosb,s->astadr,s->astprm,s->nullarg);
00030 }
00031
00032 struct _ddb * contxt=0;
00033
00034 asmlinkage int exe_getdvi(unsigned int efn, unsigned short int chan, void *devnam, void *itmlst, struct _iosb *iosb, void (*astadr)(), int astprm, struct _generic_64 *nullarg) {
00035
00036 struct _ddb * d;
00037 struct item_list_3 * it=itmlst;
00038 struct _ucb * u = 0;
00039
00040 exe_clref(efn);
00041
00042
00043
00044
00045
00046 if (chan==0 && devnam!=0) {
00047 struct return_values r,r2;
00048 int status=ioc_search(&r,devnam);
00049 if (status==SS__NORMAL)
00050 u=r.val1;
00051 else
00052 return status;
00053 }
00054 if (chan!=0) {
00055 struct _ccb * c = &ctl_gl_ccbbase[chan];
00056 u = c->ccb_l_ucb;
00057 }
00058
00059
00060 if (contxt)
00061 d=contxt;
00062 else
00063 d=ioc_gl_devlist;
00064
00065 while (it->item_code) {
00066 int * bufaddr_int = it->bufaddr;
00067 switch (it->item_code) {
00068 case DVI__FULLDEVNAM:
00069 case DVI__DEVNAM:
00070 if (chan!=0 || u!=0 ) {
00071 struct _ddb * d = u->ucb_l_ddb;
00072 memcpy(it->bufaddr, &d->ddb_t_name[1], 3);
00073 if (d->ddb_t_name[1] != 'd')
00074 snprintf(&it->bufaddr[3],3,"%d",u->ucb_w_unit);
00075 else
00076 snprintf(&it->bufaddr[3],3,"%03d",u->ucb_w_unit);
00077 } else {
00078 memcpy(it->bufaddr,&d->ddb_t_name[1],15);
00079 }
00080 if (it->retlenaddr) {
00081 short int * len = it->retlenaddr;
00082 *len = strlen(it->bufaddr);
00083 }
00084 break;
00085 case DVI__UNIT:
00086 *bufaddr_int=u->ucb_w_unit;
00087 break;
00088 case DVI__PID:
00089 *bufaddr_int=1;
00090
00091 break;
00092 case DVI__OWNUIC:
00093 {
00094 int i=0;
00095 memcpy(it->bufaddr, &i, 4);
00096 }
00097 break;
00098 case DVI__NEXTDEVNAM:
00099 case DVI__ROOTDEVNAM:
00100 case DVI__VOLCOUNT:
00101 case DVI__VOLNUMBER:
00102 {
00103 int i=0;
00104 memcpy(it->bufaddr, &i, 4);
00105 }
00106 break;
00107 case DVI__DEVCLASS:
00108 {
00109 int * i = it->bufaddr;
00110 *i=u->ucb_b_devclass;
00111 }
00112 break;
00113 case DVI__DEVCHAR:
00114 {
00115 int * i = it->bufaddr;
00116 *i=u->ucb_l_devchar;
00117 }
00118 break;
00119 case DVI__MAXBLOCK:
00120 {
00121 int * i = it->bufaddr;
00122 *i=((struct _dt_ucb *)u)->ucb_l_maxblock;
00123 }
00124 break;
00125 case DVI__DEVTYPE:
00126 {
00127 int * i = it->bufaddr;
00128 *i=u->ucb_b_devtype;
00129 }
00130 break;
00131 default:
00132 printk("getdvi item_code %x not implemented\n",it->item_code);
00133 break;
00134 }
00135 it++;
00136 }
00137
00138 struct _pcb * pcb = ctl_gl_pcb;
00139 sch_postef(pcb->pcb$l_pid, PRI$_NULL, efn);
00140
00141 if (iosb)
00142 iosb->iosb_w_status=SS$_NORMAL;
00143
00144 contxt=d->ddb_ps_link;
00145 if (contxt==0)
00146 return SS__NOMOREDEV;
00147
00148 return SS__NORMAL;
00149
00150 }
00151
00152 asmlinkage int exe_getdviw(unsigned int efn, unsigned short int chan, void *devnam, void *itmlst, struct _iosb *iosb, void (*astadr)(), int astprm, struct _generic_64 *nullarg) {
00153
00154
00155
00156 int status=exe_getdvi(efn,chan,devnam,itmlst,iosb,astadr,astprm,nullarg);
00157 if ((status&1)==0) return status;
00158 return exe_synch(efn,iosb);
00159
00160 }
00161
00162 asmlinkage int exe_getdviw_wrap(struct struct_getdvi *s) {
00163 return exe_getdviw(s->efn,s->chan,s->devnam,s->itmlst,s->iosb,s->astadr,s->astprm,s->nullarg);
00164 }
00165
00166 asmlinkage int exe_device_scan(void *return_devnam, unsigned short int *retlen, void *search_devnam, void *itmlst, unsigned long long *contxt) {
00167 struct _ddb * d;
00168 struct item_list_3 * it=itmlst;
00169
00170 if (*contxt)
00171 d=*contxt;
00172 else
00173 d=ioc_gl_devlist;
00174
00175 again:
00176 ioc_scan_iodb_usrctx(&d);
00177 if (d==0)
00178 return SS__NOMOREDEV;
00179
00180 while (it->item_code) {
00181 switch (it->item_code) {
00182 case DVI__DEVNAM:
00183 memcpy(it->bufaddr,&d->ddb_t_name[1],15);
00184 break;
00185
00186 }
00187 it++;
00188 }
00189 return SS__NORMAL;
00190
00191 }
00192
00193