|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1982, 1986, 1988 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: * ! 6: * @(#)mba.c 7.6 (Berkeley) 7/9/88 ! 7: */ ! 8: ! 9: #include "../machine/pte.h" ! 10: ! 11: #include "param.h" ! 12: #include "inode.h" ! 13: #include "fs.h" ! 14: #include "vm.h" ! 15: ! 16: #include "../vax/mtpr.h" ! 17: #include "../vaxmba/mbareg.h" ! 18: #include "../vaxmba/hpreg.h" ! 19: ! 20: #include "saio.h" ! 21: #include "savax.h" ! 22: ! 23: mbastart(io, unit, func) ! 24: register struct iob *io; ! 25: int unit, func; ! 26: { ! 27: struct mba_regs *mba = mbamba(io->i_adapt); ! 28: struct mba_drv *drv = mbadrv(io->i_adapt, unit); ! 29: register struct pte *pte = mba->mba_map; ! 30: unsigned int v; ! 31: int npf, o, vaddr; ! 32: ! 33: v = btop(io->i_ma); ! 34: o = (int)io->i_ma & PGOFSET; ! 35: npf = btoc(io->i_cc + o); ! 36: vaddr = o; ! 37: while (--npf >= 0) ! 38: *(int *)pte++ = v++ | PG_V; ! 39: mba->mba_sr = -1; ! 40: mba->mba_bcr = -io->i_cc; ! 41: mba->mba_var = vaddr; ! 42: if (io->i_flgs&F_SSI) ! 43: drv->mbd_of |= HPOF_SSEI; ! 44: switch (io->i_flgs & F_TYPEMASK) { ! 45: ! 46: case F_RDDATA: /* standard read */ ! 47: drv->mbd_cs1 = MB_RCOM|MB_GO; ! 48: mbawait(io, unit); ! 49: return(0); ! 50: ! 51: case F_WRDATA: /* standard write */ ! 52: drv->mbd_cs1 = MB_WCOM|MB_GO; ! 53: mbawait(io, unit); ! 54: return(0); ! 55: ! 56: /* the following commands apply to disks only */ ! 57: ! 58: case F_HDR|F_RDDATA: ! 59: drv->mbd_cs1 = HP_RHDR|HP_GO; ! 60: break; ! 61: ! 62: case F_HDR|F_WRDATA: ! 63: drv->mbd_cs1 = HP_WHDR|HP_GO; ! 64: break; ! 65: ! 66: case F_CHECK|F_WRDATA: ! 67: case F_CHECK|F_RDDATA: ! 68: drv->mbd_cs1 = HP_WCDATA|HP_GO; ! 69: break; ! 70: ! 71: case F_HCHECK|F_WRDATA: ! 72: case F_HCHECK|F_RDDATA: ! 73: drv->mbd_cs1 = HP_WCHDR|HP_GO; ! 74: break; ! 75: ! 76: default: ! 77: goto error; ! 78: } ! 79: mbawait(io, unit); ! 80: if ((drv->mbd_dt & MBDT_TAP) == 0) ! 81: return (0); ! 82: error: ! 83: io->i_error = ECMD; ! 84: io->i_flgs &= ~F_TYPEMASK; ! 85: return (1); ! 86: } ! 87: ! 88: mbawait(io, unit) ! 89: register struct iob *io; ! 90: int unit; ! 91: { ! 92: struct mba_regs *mba = mbamba(io->i_adapt); ! 93: struct mba_drv *drv = mbadrv(io->i_adapt, unit); ! 94: ! 95: while (mba->mba_sr & MBSR_DTBUSY) ! 96: DELAY(100); ! 97: } ! 98: ! 99: mbainit(mbanum) ! 100: int mbanum; ! 101: { ! 102: register struct mba_regs *mba; ! 103: ! 104: if (mbanum >= nmba) ! 105: return (0); ! 106: mba = mbaddr[mbanum]; ! 107: if (badaddr((char *)mba, sizeof(long))) ! 108: return (0); ! 109: if ((mbaact & (1<<mbanum)) == 0) { ! 110: mba->mba_cr = MBCR_INIT; ! 111: mbaact |= 1<<mbanum; ! 112: } ! 113: return (1); ! 114: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.