From: CSRG Date: Mon, 13 Apr 1981 14:20:15 +0000 (-0800) Subject: BSD 4_1_snap development X-Git-Tag: BSD-4_1_snap~370 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/ba9bfaab0c182ab210ee61032bcc151a85e350c6 BSD 4_1_snap development Work on file sys/dev/vaxcpu.c Work on file sys/h/mbavar.h Synthesized-from: CSRG/cd1/4.1.snap --- diff --git a/sys/dev/vaxcpu.c b/sys/dev/vaxcpu.c new file mode 100644 index 0000000000..d7b1daa9e2 --- /dev/null +++ b/sys/dev/vaxcpu.c @@ -0,0 +1,65 @@ +/* vaxcpu.c 4.5 81/04/13 */ + +#include "../h/param.h" +#include "../h/pte.h" +#include "../h/ubareg.h" +#include "../h/nexus.h" +#include "../h/cpu.h" + +/* + * Initialization of per-cpu data structures. + */ + +/* + * These are the (fixed) addresses of the (last 8k bytes of) + * unibus memory for each of the possible unibus adapters. Note that the + * unibus memory addresses are actually indexed by the unibus adapter type code. + */ +#if VAX780 +caddr_t umaddr780[4] = { + (caddr_t) UMEM780(0), (caddr_t) UMEM780(1), + (caddr_t) UMEM780(2), (caddr_t) UMEM780(3) +}; +#endif +#if VAX750 +caddr_t umaddr750[2] = { + (caddr_t) UMEM750(0), (caddr_t) UMEM750(1), +}; +#endif +#if VAX7ZZ +caddr_t umaddr7ZZ[1] = { + (caddr_t) UMEM7ZZ +}; +#endif + +/* + * Information to patch around the stupidity of configuration + * registers not returning types on some of the processors. + */ +#if VAX750 +short nexty750[NNEX750] = { + NEX_MEM16, NEX_MEM16, NEX_MEM16, NEX_MEM16, + NEX_MBA, NEX_MBA, NEX_MBA, NEX_MBA, + NEX_UBA0, NEX_UBA1, NEX_ANY, NEX_ANY, + NEX_ANY, NEX_ANY, NEX_ANY, NEX_ANY +}; +#endif +#if VAX7ZZ +short nexty7ZZ[NNEX7ZZ] = { + NEX_MEM16, NEX_ANY, NEX_ANY, NEX_ANY, + NEX_ANY, NEX_ANY, NEX_ANY, NEX_ANY, +}; +#endif + +struct percpu percpu[] = { +#if VAX780 + VAX_780, NNEX780, NEX780, umaddr780, NBDP780, 1, 0, +#endif +#if VAX750 + VAX_750, NNEX750, NEX750, umaddr750, NBDP750, 0, nexty750, +#endif +#if VAX7ZZ + VAX_7ZZ, NNEX7ZZ, NEX7ZZ, umaddr7ZZ, NBDP7ZZ, 0, nexty7ZZ, +#endif + 0, +}; diff --git a/sys/h/mbavar.h b/sys/h/mbavar.h new file mode 100644 index 0000000000..62fbb8b8a2 --- /dev/null +++ b/sys/h/mbavar.h @@ -0,0 +1,136 @@ +/* mbavar.h 4.15 81/04/08 */ + +/* + * This file contains definitions related to the kernel structures + * for dealing with the massbus adapters. + * + * Each mba has a mba_hd structure. + * Each massbus device has a mba_device structure. + * Each massbus slave has a mba_slave structure. + * + * At boot time we prowl the structures and fill in the pointers + * for devices which we find. + */ + +/* + * Per-mba structure. + * + * The initialization routine uses the information in the mbdinit table + * to initialize the what is attached to each massbus slot information. + * It counts the number of devices on each mba (to see if bothering to + * search/seek is appropriate). + * + * During normal operation, the devices attached to the mba which wish + * to transfer are queued on the mh_act? links. + */ +struct mba_hd { + short mh_active; /* set if mba is active */ + short mh_ndrive; /* number of devices, to avoid seeks */ + struct mba_regs *mh_mba; /* virt addr of mba */ + struct mba_regs *mh_physmba; /* phys addr of mba */ + struct mba_device *mh_mbip[8]; /* what is attached to each dev */ + struct mba_device *mh_actf; /* head of queue to transfer */ + struct mba_device *mh_actl; /* tail of queue to transfer */ +}; + +/* + * Per-device structure + * (one for each RM/RP disk, and one for each tape formatter). + * + * This structure is used by the device driver as its argument + * to the massbus driver, and by the massbus driver to locate + * the device driver for a particular massbus slot. + * + * The device drivers hang ready buffers on this structure, + * and the massbus driver will start i/o on the first such buffer + * when appropriate. + */ +struct mba_device { + struct mba_driver *mi_driver; + short mi_unit; /* unit number to the system */ + short mi_mbanum; /* the mba it is on */ + short mi_drive; /* controller on mba */ + short mi_dk; /* driver number for iostat */ + short mi_alive; /* device exists */ + short mi_type; /* driver specific unit type */ + struct buf mi_tab; /* head of queue for this device */ + struct mba_device *mi_forw; +/* we could compute these every time, but hereby save time */ + struct mba_regs *mi_mba; + struct mba_drv *mi_drv; + struct mba_hd *mi_hd; +}; + +/* + * Tape formatter slaves are specified by + * the following information which is used + * at boot time to initialize the tape driver + * internal tables. + */ +struct mba_slave { + struct mba_driver *ms_driver; + short ms_ctlr; /* which of several formatters */ + short ms_unit; /* which unit to system */ + short ms_slave; /* which slave to formatter */ + short ms_alive; +}; + +/* + * Per device-type structure. + * + * Each massbus driver defines entries for a set of routines used + * by the massbus driver, as well as an array of types which are + * acceptable to it. + */ +struct mba_driver { + int (*md_attach)(); /* attach a device */ + int (*md_slave)(); /* attach a slave */ + int (*md_ustart)(); /* unit start routine */ + int (*md_start)(); /* setup a data transfer */ + int (*md_dtint)(); /* data transfer complete */ + int (*md_ndint)(); /* non-data transfer interrupt */ + short *md_type; /* array of drive type codes */ + char *md_dname, *md_sname; /* device, slave names */ + struct mba_device **md_info; /* backpointers to mbinit structs */ +}; + +/* + * Possible return values from unit start routines. + */ +#define MBU_NEXT 0 /* skip to next operation */ +#define MBU_BUSY 1 /* dual port busy; wait for intr */ +#define MBU_STARTED 2 /* non-data transfer started */ +#define MBU_DODATA 3 /* data transfer ready; start mba */ + +/* + * Possible return values from data transfer interrupt handling routines + */ +#define MBD_DONE 0 /* data transfer complete */ +#define MBD_RETRY 1 /* error occurred, please retry */ +#define MBD_RESTARTED 2 /* driver restarted i/o itself */ + +/* + * Possible return values from non-data-transfer interrupt handling routines + */ +#define MBN_DONE 0 /* non-data transfer complete */ +#define MBN_RETRY 1 /* failed; retry the operation */ +#define MBN_SKIP 2 /* don't do anything */ + +/* + * Clear attention status for specified device. + */ +#define mbclrattn(mi) ((mi)->mi_mba->mba_drv[0].mbd_as = 1 << (mi)->mi_drive) + +/* + * Kernel definitions related to mba. + */ +#ifdef KERNEL +int nummba; +#if NMBA > 0 +struct mba_hd mba_hd[NMBA]; +extern Xmba0int(), Xmba1int(), Xmba2int(), Xmba3int(); + +extern struct mba_device mbdinit[]; +extern struct mba_slave mbsinit[]; +#endif +#endif