1*10623Shelge /* mba.c 4.8 83/01/27 */ 2323Sbill 39806Ssam #include "../machine/pte.h" 49806Ssam 5323Sbill #include "../h/param.h" 6323Sbill #include "../h/inode.h" 77446Sroot #include "../h/fs.h" 8323Sbill #include "../h/vm.h" 99186Ssam 109186Ssam #include "../vax/mtpr.h" 119186Ssam #include "../vaxmba/mbareg.h" 1210332Shelge #include "../vaxmba/hpreg.h" 139186Ssam 14323Sbill #include "saio.h" 153262Swnj #include "savax.h" 16323Sbill 173262Swnj mbastart(io, func) 183262Swnj register struct iob *io; 193262Swnj int func; 20323Sbill { 213262Swnj struct mba_regs *mba = mbamba(io->i_unit); 223262Swnj struct mba_drv *drv = mbadrv(io->i_unit); 233262Swnj register struct pte *pte = mba->mba_map; 24323Sbill int npf; 25323Sbill unsigned v; 26323Sbill int o; 27323Sbill int vaddr; 28323Sbill 29323Sbill v = btop(io->i_ma); 30323Sbill o = (int)io->i_ma & PGOFSET; 31323Sbill npf = btoc(io->i_cc + o); 323262Swnj vaddr = o; 33323Sbill while (--npf >= 0) 34323Sbill *(int *)pte++ = v++ | PG_V; 353262Swnj mba->mba_sr = -1; 363262Swnj mba->mba_bcr = -io->i_cc; 373262Swnj mba->mba_var = vaddr; 38*10623Shelge if (io->i_flgs&F_SSI) { 39*10623Shelge drv->mbd_of |= HPOF_SSEI; 40*10623Shelge } 4110332Shelge switch (io->i_flgs & F_TYPEMASK) { 4210332Shelge 4310332Shelge case F_RDDATA: /* standard read */ 4410332Shelge drv->mbd_cs1 = MB_RCOM|MB_GO; 4510332Shelge return(0); 4610332Shelge 4710332Shelge case F_WRDATA: /* standard write */ 4810332Shelge drv->mbd_cs1 = MB_WCOM|MB_GO; 4910332Shelge return(0); 5010332Shelge 5110332Shelge /* the following commands apply to disks only */ 5210332Shelge 5310332Shelge case F_HDR|F_RDDATA: 5410332Shelge drv->mbd_cs1 = HP_RHDR|HP_GO; 5510332Shelge break; 5610332Shelge 5710332Shelge case F_HDR|F_WRDATA: 5810332Shelge drv->mbd_cs1 = HP_WHDR|HP_GO; 5910332Shelge break; 6010332Shelge 6110332Shelge case F_CHECK|F_WRDATA: 6210332Shelge case F_CHECK|F_RDDATA: 6310332Shelge drv->mbd_cs1 = HP_WCDATA|HP_GO; 6410332Shelge break; 6510332Shelge 6610332Shelge case F_HCHECK|F_WRDATA: 6710332Shelge case F_HCHECK|F_RDDATA: 6810332Shelge drv->mbd_cs1 = HP_WCHDR|HP_GO; 6910332Shelge break; 7010332Shelge 7110332Shelge default: 7210332Shelge error: 7310332Shelge io->i_error = ECMD; 7410332Shelge io->i_flgs &= ~F_TYPEMASK; 7510332Shelge return (1); 7610332Shelge } 7710332Shelge 7810332Shelge if ((drv->mbd_dt & MBDT_TAP) == 0) 7910332Shelge return (0); 803262Swnj else 8110332Shelge goto error; /* if not a disk : error */ 82323Sbill } 83415Sbill 84415Sbill mbainit(mbanum) 85415Sbill int mbanum; 86415Sbill { 873262Swnj register struct mba_regs *mba = mbaddr[mbanum]; 88415Sbill 893262Swnj /* SHOULD BADADDR IT */ 903262Swnj if (mbaact & (1<<mbanum)) 913262Swnj return; 923262Swnj mba->mba_cr = MBCR_INIT; 93415Sbill mbaact |= 1<<mbanum; 94415Sbill } 95