date and time created 86/11/29 12:09:54 by sam
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Sun, 30 Nov 1986 04:09:54 +0000 (20:09 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Sun, 30 Nov 1986 04:09:54 +0000 (20:09 -0800)
SCCS-vsn: sys/tahoe/vba/psproto.h 1.1
SCCS-vsn: sys/tahoe/vba/psreg.h 1.1

usr/src/sys/tahoe/vba/psproto.h [new file with mode: 0644]
usr/src/sys/tahoe/vba/psreg.h [new file with mode: 0644]

diff --git a/usr/src/sys/tahoe/vba/psproto.h b/usr/src/sys/tahoe/vba/psproto.h
new file mode 100644 (file)
index 0000000..2e182b7
--- /dev/null
@@ -0,0 +1,65 @@
+/*     psproto.h       1.1     86/11/29        */
+
+/*
+ * PS300-Host Handshake Protocol Definitions.
+ */
+
+/*
+ * Commands sent from host->PS300.
+ *
+ * In the initial handshake carried out when requesting
+ * one of these commands be performed, the PS300 always
+ * returns the identical code to indicate success.
+ */
+#define PS_ABORT        0x1000  /* abort current command */
+#define PS_RESET        0x3000  /* reset device */
+#define PS_RDNET        0x5000  /* logical read */
+#define PS_LOOKUP       0x8000  /* name lookup */
+#define PS_RDPHY        0x9000  /* physical read */
+#define PS_WRPHY_SYNC   0xa000  /* physical write w/ sync */
+#define PS_WRPHY        0xb000  /* physical write */
+#define PS_WRNET        0xc000  /* logical write */
+#define PS_DETACH       0xd000  /* normal/diagnostic detach */
+#define PS_ATTACH       0xe000  /* normal attach */
+#define PS_DATTACH      0xf000  /* diagnostic attach */
+
+#define PS_DIOREAD      0x4000  /* internal, wait for dioread attention */
+
+/*
+ * Command responses from PS300->host.
+ */
+#define PS_DMAOK(code)  ((code)|0x0a00) /* successful dma transfer */ 
+#define PS_ADROK(code)  ((code)|0x0100) /* successful address tranfer */
+
+#define PS_CODE(v)      ((v)&0xf000)    /* extract code from PS300 msg */
+#define PS_LUNIT(v)     ((v)&0x000f)    /* extract PS300 unit from msg */
+
+/*
+ * Single unit PS300 address list.
+ */
+struct  psalist {
+        u_short nblocks;                /* # of i/o vectors (we always use 1) */
+        u_short addr[2];                /* PS300 address */
+        u_short wc;                     /* transfer size */
+};
+
+/*
+ * The max dma size is actually 64KB, but
+ * we limit it to be just large enough for
+ * the maximum vector list as this is sufficient
+ * for our needs and we must allocate real
+ * memory to the intermediate buffer.
+ */
+#define PS_MAXDMA       (1024+2048*12)
+
+/*
+ * Pseudo commands used internally by the driver.
+ */
+#define PS_DMAOUT       0x0100          /* dma buffer host->PS300 */
+#define PS_DMAIN        0x0200          /* dma buffer PS300->host */
+
+/*
+ * Default timeouts.
+ */
+#define PS_TIMEOUT      30              /* dma/attention timeout (in hz) */
+#define PS_DIOTIMO      1000            /* dio polling timeout */
diff --git a/usr/src/sys/tahoe/vba/psreg.h b/usr/src/sys/tahoe/vba/psreg.h
new file mode 100644 (file)
index 0000000..71890f3
--- /dev/null
@@ -0,0 +1,50 @@
+/*     psreg.h 1.1     86/11/29        */
+
+#ifndef _PSREG_
+#define _PSREG_
+/*
+ * PS300 definitions.
+ */
+#ifndef KERNEL
+#include <sys/ioctl.h>
+#else
+#include "../h/ioctl.h"
+#endif
+
+struct  pslookup {
+        int     pl_len;                 /* length of name string */
+        char    *pl_name;               /* address of name string */
+        u_long  pl_addr;                /* symbol's address */
+};
+
+/*
+ * Maximum string which may be supplied for lookup.
+ */
+#define PS_MAXNAMELEN   256             /* must be <= PSMAXDMA */
+
+/*
+ * When doing physical i/o, one may specify the address
+ * and whether or not refresh sync should is required with
+ * a null iovec descriptor (iov_len = 0).
+ */
+#define PSIO_SYNC       1               /* do physical write w/ refresh sync */
+
+/*
+ * Ioctl requests.
+ */
+#define PSIOGETERROR    _IOR(p, 0, int)                 /* get last error */
+#define PSIOLOOKUP      _IOWR(p, 1, struct pslookup)    /* do name lookup */
+#define PSIORWLOGICAL   _IOWR(p, 2, int)                /* set i/o mode */
+
+/*
+ * Error codes returned by PSIOGETERROR are either
+ * returned by the PS300 or, from the list below,
+ * generated by the device driver.
+ */
+#define PSERROR_DIOTIMO         1       /* timeout during dioread/diowrite */
+#define PSERROR_INVALBC         2       /* invalid byte count for read/write */
+#define PSERROR_BADADDR         3       /* invalid address for read/write */
+#define PSERROR_BADCMD          4       /* invalid command in ikstart */
+#define PSERROR_NAMETIMO        5       /* timeout during nameaddr dioread */
+#define PSERROR_CMDTIMO         6       /* operation timed out */
+#endif