create netif directory
[unix-history] / usr / src / sys / vax / mba / mbavar.h
index 30e8ef5..62fbb8b 100644 (file)
-/*     mbavar.h        4.3     %G%     */
+/*     mbavar.h        4.15    81/04/08        */
 
 
-#if VAX==780
 /*
 /*
- * VAX Massbus adapter registers
+ * 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.
  */
 
  */
 
-struct mba_drv
-{
-       int     mbd_cs1;
-       int     mbd_ds;
-       int     mbd_er1;
-       int     mbd_mr1;
-       int     mbd_as;
-       int     mbd_da;
-#define        mbd_fc  mbd_da
-       int     mbd_dt;
-       int     mbd_la;
-#define        mbd_ck  mbd_la
-       int     mbd_sn;
-       int     mbd_of;
-#define        mbd_tc  mbd_of
-       int     mbd_fill[22];
-};
 /*
 /*
- * Bits in mbd_dt.
+ * 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.
  */
  */
-#define        MBDT_NSA        0x8000          /* not sector addressible */
-#define        MBDT_TAP        0x4000          /* is a tape */
-#define        MBDT_MOH        0x2000          /* moving head */
-#define        MBDT_7CH        0x1000          /* 7 channel */
-#define        MBDT_DRQ        0x800           /* drive request required */
-#define        MBDT_SPR        0x400           /* slave present */
-
-#define        MBDT_TYPE       0x1ff
-#define        MBDT_MASK       (MBDT_NSA|MBDT_TAP|MBDT_TYPE)
-
-#define        MBDT_RP04       020
-#define        MBDT_RP05       021
-#define        MBDT_RP06       022
-#define        MBDT_RP07       042
-#define        MBDT_RM03       024
-#define        MBDT_RM05       027
-#define        MBDT_RM80       026
-
-#define        MBDT_TM03       050
-#define        MBDT_TE16       051
-#define        MBDT_TU45       052
-#define        MBDT_TU77       054
-#define        MBDT_TU78       0140
+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 */
+};
 
 /*
 
 /*
- * Bits in mbd_ds.
+ * 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.
  */
  */
-#define        MBD_DRY         0x80
-#define        MBD_MOL         0x1000
-#define        MBD_DPR         0x100
-#define        MBD_ERR         0x4000
+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;
+};
 
 
-#define        MBD_WCOM        0x30
-#define        MBD_RCOM        0x38
-#define        MBD_GO          0x1
+/*
+ * 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;
+};
 
 
-struct mba_regs
-{
-       int     mba_csr;
-       int     mba_cr;
-       int     mba_sr;
-       int     mba_var;
-       int     mba_bcr;
-       int     mba_dr;
-       int     mba_pad1[250];
-       struct  mba_drv mba_drv[8];
-       struct  pte mba_map[256];
-       int     mba_pad2[256*5];
+/*
+ * 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 */
 };
 
 };
 
-#define        MBAINIT         0x1
-#define        MBAIE           0x4
+/*
+ * 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 */
 
 
-#define        MBAEBITS        0xe0770
+/*
+ * 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 */
 
 
-#define        PHYSMBA0        ((struct mba_regs *)0x20010000)
-#define        PHYSMBA1        ((struct mba_regs *)0x20012000)
+/*
+ * 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 */
 
 
-#define        mbadev(mba,unit)        ((struct device *)&mba->mba_drv[unit])
+/*
+ * 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
 #ifdef KERNEL
-struct mba_info
-{
-       struct  mba_regs *mi_loc;       /* virtual mba */
-       struct  mba_regs *mi_phys;      /* physical mba */
-       struct  pte *mi_map;            /* page table base for nexus */
-};
-
-#define        MBA0            ((struct mba_regs *)0x80064000)
-#define        MBA1            ((struct mba_regs *)0x80066000)
+int    nummba;
+#if NMBA > 0
+struct mba_hd mba_hd[NMBA];
+extern Xmba0int(), Xmba1int(), Xmba2int(), Xmba3int();
 
 
-int    mbanum[];
-struct mba_info mbainfo[];
-int    mbaact;
+extern struct  mba_device mbdinit[];
+extern struct  mba_slave mbsinit[];
 #endif
 #endif
 #endif
 #endif