+#if NTMSCP > 0
+
+#include "../vax/pte.h"
+
+#include "param.h"
+#include "systm.h"
+#include "buf.h"
+#include "conf.h"
+#include "dir.h"
+#include "user.h"
+#include "file.h"
+#include "map.h"
+#include "vm.h"
+#include "ioctl.h"
+#include "syslog.h"
+#include "mtio.h"
+#include "cmap.h"
+#include "uio.h"
+
+#include "../vax/cpu.h"
+#include "../vax/mtpr.h"
+#include "ubareg.h"
+#include "ubavar.h"
+
+#define TENSEC (1000)
+#define TMS_PRI LOG_INFO
+
+#define NRSPL2 3 /* log2 number of response packets */
+#define NCMDL2 3 /* log2 number of command packets */
+#define NRSP (1<<NRSPL2)
+#define NCMD (1<<NCMDL2)
+
+#include "tmscpreg.h"
+#include "../vax/tmscp.h"
+
+/* Software state per controller */
+
+struct tmscp_softc {
+ short sc_state; /* state of controller */
+ short sc_mapped; /* Unibus map allocated for tmscp struct? */
+ int sc_ubainfo; /* Unibus mapping info */
+ struct tmscp *sc_tmscp; /* Unibus address of tmscp struct */
+ int sc_ivec; /* interrupt vector address */
+ short sc_credits; /* transfer credits */
+ short sc_lastcmd; /* pointer into command ring */
+ short sc_lastrsp; /* pointer into response ring */
+} tmscp_softc[NTMSCP];
+
+struct tmscp {
+ struct tmscpca tmscp_ca; /* communications area */
+ struct mscp tmscp_rsp[NRSP]; /* response packets */
+ struct mscp tmscp_cmd[NCMD]; /* command packets */
+} tmscp[NTMSCP];
+
+/*
+ * Per drive-unit info
+ */
+struct tms_info {
+ daddr_t tms_dsize; /* Max user size from online pkt */
+ unsigned tms_type; /* Drive type int field */
+ int tms_resid; /* residual from last xfer */
+ u_char tms_endcode; /* last command endcode */
+ u_char tms_flags; /* last command end flags */
+ unsigned tms_status; /* Command status from last command */
+ char tms_openf; /* lock against multiple opens */
+ char tms_lastiow; /* last op was a write */
+ char tms_serex; /* set when serious exception occurs */
+ char tms_clserex; /* set when serex being cleared by no-op */
+ short tms_fmtmenu; /* the unit's format (density) menu */
+ short tms_unitflgs; /* unit flag parameters */
+ short tms_format; /* the unit's current format (density) */
+ struct tty *tms_ttyp; /* record user's tty for errors */
+} tms_info[NTMS];
+struct uba_ctlr *tmscpminfo[NTMSCP];
+struct uba_device *tmsdinfo[NTMS];
+/*
+ * ifdef other tmscp devices here if they allow more than 1 unit/controller
+ */
+struct uba_device *tmscpip[NTMSCP][1];
+struct buf rtmsbuf[NTMS]; /* raw i/o buffer */
+struct buf ctmscpbuf[NTMSCP]; /* internal cmd buffer (for ioctls) */
+struct buf tmsutab[NTMS]; /* Drive queue */
+struct buf tmscpwtab[NTMSCP]; /* I/O wait queue, per controller */
+int tmscpmicro[NTMSCP]; /* to store microcode level */
+short utoctlr[NTMS]; /* Slave unit to controller mapping */
+ /* filled in by the slave routine */
+