Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

backup for sync w/ 3.6

- dccp/sctp do not compile
- carp does not compile
- "encif" symbol undefined (= GENERIC does not compile)
  • Loading branch information...
commit 398ea3fbb8413c069fd0f3deff4918e32cb654d1 1 parent 2dad750
itojun authored
Showing with 443 additions and 43,152 deletions.
  1. +10 −1 kame/sys/net/radix_mpath.c
  2. +6 −1 kame/sys/net/radix_mpath.h
  3. +3 −3 kame/sys/netinet6/in6_ifattach.c
  4. +6 −1 openbsd/sys/arch/alpha/alpha/conf.c
  5. +4 −8 openbsd/sys/arch/alpha/alpha/machdep.c
  6. +0 −152 openbsd/sys/arch/alpha/include/intrcnt.h
  7. +0 −398 openbsd/sys/arch/arm/arm/fusu.S
  8. +0 −508 openbsd/sys/arch/hp300/dev/ac.c
  9. +0 −89 openbsd/sys/arch/hp300/dev/acioctl.h
  10. +0 −100 openbsd/sys/arch/hp300/dev/acvar.h
  11. +0 −1,548 openbsd/sys/arch/hp300/dev/scsi.c
  12. +0 −481 openbsd/sys/arch/hp300/dev/scsireg.h
  13. +0 −95 openbsd/sys/arch/hp300/dev/scsivar.h
  14. +0 −1,287 openbsd/sys/arch/hp300/dev/sd.c
  15. +0 −98 openbsd/sys/arch/hp300/dev/sdvar.h
  16. +0 −1,426 openbsd/sys/arch/hp300/dev/st.c
  17. +0 −224 openbsd/sys/arch/hp300/dev/stvar.h
  18. +44 −19 openbsd/sys/arch/i386/conf/GENERIC
  19. +1 −1  openbsd/sys/arch/i386/conf/GENERIC.KAME
  20. +5 −1 openbsd/sys/arch/i386/i386/conf.c
  21. +0 −41 openbsd/sys/arch/i386/include/longrun.h
  22. +0 −72 openbsd/sys/arch/i386/isa/icu.h
  23. +42 −18 openbsd/sys/arch/i386/isa/icu.s
  24. +0 −344 openbsd/sys/arch/i386/isa/vector.s
  25. +0 −151 openbsd/sys/arch/i386/stand/README
  26. +0 −47 openbsd/sys/arch/i386/stand/libsa/ps2probe.h
  27. +0 −3  openbsd/sys/arch/macppc/include/dlfcn.h
  28. +101 −126 openbsd/sys/arch/mvme68k/mvme68k/machdep.c
  29. +0 −609 openbsd/sys/arch/mvme88k/ddb/db_disasm.c
  30. +0 −269 openbsd/sys/arch/mvme88k/ddb/db_sstep.c
  31. +0 −1,146 openbsd/sys/arch/mvme88k/ddb/db_trace.c
  32. +0 −9 openbsd/sys/arch/mvme88k/dev/busswfunc.h
  33. +0 −290 openbsd/sys/arch/mvme88k/dev/i82586.h
  34. +0 −1,345 openbsd/sys/arch/mvme88k/dev/if_ve.c
  35. +0 −218 openbsd/sys/arch/mvme88k/dev/if_vereg.h
  36. +0 −146 openbsd/sys/arch/mvme88k/dev/if_vevar.h
  37. +0 −9 openbsd/sys/arch/mvme88k/dev/pcctwofunc.h
  38. +0 −412 openbsd/sys/arch/mvme88k/dev/sclock.c
  39. +0 −1,941 openbsd/sys/arch/mvme88k/dev/ssh.c
  40. +0 −175 openbsd/sys/arch/mvme88k/dev/ssh_script.out
  41. +0 −205 openbsd/sys/arch/mvme88k/dev/ssh_script.ss
  42. +0 −263 openbsd/sys/arch/mvme88k/dev/sshdma.c
  43. +0 −336 openbsd/sys/arch/mvme88k/dev/sshreg.h
  44. +0 −204 openbsd/sys/arch/mvme88k/dev/sshvar.h
  45. +0 −8 openbsd/sys/arch/mvme88k/dev/sysconfunc.h
  46. +0 −199 openbsd/sys/arch/mvme88k/dev/vsdma.c
  47. +0 −127 openbsd/sys/arch/mvme88k/include/board.h
  48. +0 −65 openbsd/sys/arch/mvme88k/include/cpus.h
  49. +0 −4 openbsd/sys/arch/mvme88k/mvme88k/TODO
  50. +0 −1,357 openbsd/sys/arch/mvme88k/mvme88k/cmmu.c
  51. +0 −141 openbsd/sys/arch/mvme88k/mvme88k/genassym.cf
  52. +0 −1,740 openbsd/sys/arch/mvme88k/mvme88k/locore_asm_routines.S
  53. +0 −2,305 openbsd/sys/arch/mvme88k/mvme88k/m88100_fp.S
  54. +0 −266 openbsd/sys/arch/mvme88k/mvme88k/m88110_fp.S
  55. +0 −159 openbsd/sys/arch/mvme88k/mvme88k/m88110_mmu.S
  56. +221 −176 openbsd/sys/arch/mvme88k/mvme88k/machdep.c
  57. +0 −5,347 openbsd/sys/arch/mvme88k/mvme88k/pmap.c
  58. +0 −340 openbsd/sys/arch/mvme88k/mvme88k/process.S
  59. +0 −155 openbsd/sys/arch/mvme88k/mvme88k/process_machdep.c
  60. +0 −29 openbsd/sys/arch/mvme88k/mvme88k/syscall.stub
  61. +0 −788 openbsd/sys/arch/mvme88k/mvme88k/trap.c
  62. +0 −89 openbsd/sys/arch/mvme88k/mvme88k/vectors_88100.S
  63. +0 −88 openbsd/sys/arch/mvme88k/mvme88k/vectors_88110.S
  64. +0 −537 openbsd/sys/arch/mvme88k/mvme88k/vm_machdep.c
  65. +0 −7 openbsd/sys/arch/mvme88k/stand/bootsd/README
  66. +0 −88 openbsd/sys/arch/mvme88k/stand/bugcrt/bugcrt.c
  67. +0 −81 openbsd/sys/arch/mvme88k/stand/bugcrt/sdcrt.c
  68. +0 −15 openbsd/sys/arch/mvme88k/stand/libbug/outch.c
  69. +0 −3  openbsd/sys/arch/mvmeppc/include/dlfcn.h
  70. +0 −608 openbsd/sys/arch/mvmeppc/pci/raven.c
  71. +0 −126 openbsd/sys/arch/mvmeppc/stand/bugcrt/bugcrt.c
  72. +0 −87 openbsd/sys/arch/mvmeppc/stand/bugcrt/sdcrt.c
  73. +0 −90 openbsd/sys/arch/mvmeppc/stand/libsa/SRT0.S
  74. +0 −124 openbsd/sys/arch/mvmeppc/stand/libsa/SRT1.c
  75. +0 −23 openbsd/sys/arch/mvmeppc/stand/libsa/cache.c
  76. +0 −12 openbsd/sys/arch/pegasos/Makefile
  77. +0 −2  openbsd/sys/arch/pegasos/compile/.cvsignore
  78. +0 −213 openbsd/sys/arch/pegasos/conf/GENERIC
  79. +0 −198 openbsd/sys/arch/pegasos/conf/Makefile.pegasos
  80. +0 −194 openbsd/sys/arch/pegasos/conf/RAMDISK
  81. +0 −165 openbsd/sys/arch/pegasos/conf/files.pegasos
  82. +0 −3  openbsd/sys/arch/pegasos/include/ansi.h
  83. +0 −3  openbsd/sys/arch/pegasos/include/asm.h
  84. +0 −106 openbsd/sys/arch/pegasos/include/autoconf.h
  85. +0 −3  openbsd/sys/arch/pegasos/include/bat.h
  86. +0 −653 openbsd/sys/arch/pegasos/include/bus.h
  87. +0 −3  openbsd/sys/arch/pegasos/include/cdefs.h
  88. +0 −37 openbsd/sys/arch/pegasos/include/conf.h
  89. +0 −50 openbsd/sys/arch/pegasos/include/cpu.h
  90. +0 −3  openbsd/sys/arch/pegasos/include/db_machdep.h
  91. +0 −172 openbsd/sys/arch/pegasos/include/disklabel.h
  92. +0 −3  openbsd/sys/arch/pegasos/include/elf_abi.h
  93. +0 −3  openbsd/sys/arch/pegasos/include/endian.h
  94. +0 −3  openbsd/sys/arch/pegasos/include/exec.h
  95. +0 −3  openbsd/sys/arch/pegasos/include/float.h
  96. +0 −3  openbsd/sys/arch/pegasos/include/fpu.h
  97. +0 −3  openbsd/sys/arch/pegasos/include/frame.h
  98. +0 −3  openbsd/sys/arch/pegasos/include/ieee.h
  99. +0 −3  openbsd/sys/arch/pegasos/include/ieeefp.h
  100. +0 −3  openbsd/sys/arch/pegasos/include/internal_types.h
  101. +0 −6 openbsd/sys/arch/pegasos/include/intr.h
  102. +0 −3  openbsd/sys/arch/pegasos/include/kcore.h
  103. +0 −3  openbsd/sys/arch/pegasos/include/limits.h
  104. +0 −57 openbsd/sys/arch/pegasos/include/loadfile_machdep.h
  105. +0 −70 openbsd/sys/arch/pegasos/include/param.h
  106. +0 −3  openbsd/sys/arch/pegasos/include/pcb.h
  107. +0 −3  openbsd/sys/arch/pegasos/include/pio.h
  108. +0 −7 openbsd/sys/arch/pegasos/include/pmap.h
  109. +0 −85 openbsd/sys/arch/pegasos/include/powerpc.h
  110. +0 −3  openbsd/sys/arch/pegasos/include/proc.h
  111. +0 −3  openbsd/sys/arch/pegasos/include/profile.h
  112. +0 −3  openbsd/sys/arch/pegasos/include/psl.h
  113. +0 −3  openbsd/sys/arch/pegasos/include/pte.h
  114. +0 −3  openbsd/sys/arch/pegasos/include/ptrace.h
  115. +0 −64 openbsd/sys/arch/pegasos/include/rbus_machdep.h
  116. +0 −229 openbsd/sys/arch/pegasos/include/rdb.h
  117. +0 −3  openbsd/sys/arch/pegasos/include/reg.h
  118. +0 −3  openbsd/sys/arch/pegasos/include/reloc.h
  119. +0 −3  openbsd/sys/arch/pegasos/include/setjmp.h
  120. +0 −3  openbsd/sys/arch/pegasos/include/signal.h
  121. +0 −3  openbsd/sys/arch/pegasos/include/spinlock.h
  122. +0 −3  openbsd/sys/arch/pegasos/include/stdarg.h
  123. +0 −3  openbsd/sys/arch/pegasos/include/trap.h
  124. +0 −3  openbsd/sys/arch/pegasos/include/types.h
  125. +0 −3  openbsd/sys/arch/pegasos/include/va-ppc.h
  126. +0 −3  openbsd/sys/arch/pegasos/include/varargs.h
  127. +0 −115 openbsd/sys/arch/pegasos/include/vmparam.h
  128. +0 −3  openbsd/sys/arch/pegasos/include/wsconsio.h
  129. +0 −390 openbsd/sys/arch/pegasos/isa/isa_clock.c
  130. +0 −93 openbsd/sys/arch/pegasos/isa/nvram.h
  131. +0 −97 openbsd/sys/arch/pegasos/isa/timerreg.h
  132. +0 −63 openbsd/sys/arch/pegasos/pci/agp_machdep.c
  133. +0 −572 openbsd/sys/arch/pegasos/pci/isabr.c
  134. +0 −84 openbsd/sys/arch/pegasos/pci/mpc106reg.h
  135. +0 −1,018 openbsd/sys/arch/pegasos/pci/mpcpcibus.c
  136. +0 −101 openbsd/sys/arch/pegasos/pci/pchb.c
  137. +0 −466 openbsd/sys/arch/pegasos/pci/pci_addr_fixup.c
  138. +0 −75 openbsd/sys/arch/pegasos/pci/pcibrvar.h
  139. +0 −78 openbsd/sys/arch/pegasos/pci/pciide_machdep.c
  140. +0 −634 openbsd/sys/arch/pegasos/pegasos/autoconf.c
  141. +0 −459 openbsd/sys/arch/pegasos/pegasos/clock.c
  142. +0 −352 openbsd/sys/arch/pegasos/pegasos/conf.c
  143. +0 −383 openbsd/sys/arch/pegasos/pegasos/cpu.c
  144. +0 −44 openbsd/sys/arch/pegasos/pegasos/db_interface.c
  145. +0 −450 openbsd/sys/arch/pegasos/pegasos/disksubr.c
  146. +0 −601 openbsd/sys/arch/pegasos/pegasos/dma.c
  147. +0 −73 openbsd/sys/arch/pegasos/pegasos/genassym.cf
  148. +0 −121 openbsd/sys/arch/pegasos/pegasos/hfsdisksubr.c
  149. +0 −1,246 openbsd/sys/arch/pegasos/pegasos/locore.S
  150. +0 −1,440 openbsd/sys/arch/pegasos/pegasos/machdep.c
  151. +0 −161 openbsd/sys/arch/pegasos/pegasos/mainbus.c
  152. +0 −208 openbsd/sys/arch/pegasos/pegasos/mbrdisksubr.c
  153. +0 −187 openbsd/sys/arch/pegasos/pegasos/mem.c
  154. +0 −723 openbsd/sys/arch/pegasos/pegasos/ofw_machdep.c
  155. +0 −55 openbsd/sys/arch/pegasos/pegasos/ofw_machdep.h
  156. +0 −449 openbsd/sys/arch/pegasos/pegasos/ofwreal.S
Sorry, we could not display the entire diff because too many files (384) changed.
11 kame/sys/net/radix_mpath.c
View
@@ -1,4 +1,4 @@
-/* $KAME: radix_mpath.c,v 1.15 2004/04/25 02:21:39 itojun Exp $ */
+/* $KAME: radix_mpath.c,v 1.16 2004/11/06 15:44:28 itojun Exp $ */
/*
* Copyright (C) 2001 WIDE Project.
@@ -120,10 +120,17 @@ rt_mpath_matchgate(rt, gate)
* check if we have the same key/mask/gateway on the table already.
*/
int
+#ifdef __OpenBSD__
+rt_mpath_conflict(rnh, rt, netmask, mpathok)
+#else
rt_mpath_conflict(rnh, rt, netmask)
+#endif
struct radix_node_head *rnh;
struct rtentry *rt;
struct sockaddr *netmask;
+#ifdef __OpenBSD__
+ int mpathok;
+#endif
{
struct radix_node *rn, *rn1;
struct rtentry *rt1;
@@ -199,6 +206,8 @@ rt_mpath_conflict(rnh, rt, netmask)
}
maskmatched:;
+ if (!mpathok)
+ return EEXIST;
/* key/mask were the same. compare gateway for all multipaths */
do {
7 kame/sys/net/radix_mpath.h
View
@@ -1,4 +1,4 @@
-/* $KAME: radix_mpath.h,v 1.9 2004/03/30 11:21:49 keiichi Exp $ */
+/* $KAME: radix_mpath.h,v 1.10 2004/11/06 15:44:28 itojun Exp $ */
/*
* Copyright (C) 2001 WIDE Project.
@@ -47,8 +47,13 @@ int rn_mpath_capable __P((struct radix_node_head *));
struct radix_node *rn_mpath_next __P((struct radix_node *));
int rn_mpath_count __P((struct radix_node *));
struct rtentry *rt_mpath_matchgate __P((struct rtentry *, struct sockaddr *));
+#ifdef __OpenBSD__
+int rt_mpath_conflict __P((struct radix_node_head *, struct rtentry *,
+ struct sockaddr *, int));
+#else
int rt_mpath_conflict __P((struct radix_node_head *, struct rtentry *,
struct sockaddr *));
+#endif
void rtalloc_mpath __P((struct route *, int));
struct radix_node *rn_mpath_lookup __P((void *, void *,
struct radix_node_head *));
6 kame/sys/netinet6/in6_ifattach.c
View
@@ -1,4 +1,4 @@
-/* $KAME: in6_ifattach.c,v 1.201 2004/08/17 10:18:58 jinmei Exp $ */
+/* $KAME: in6_ifattach.c,v 1.202 2004/11/06 15:44:28 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -41,8 +41,8 @@
#include <sys/sockio.h>
#include <sys/kernel.h>
#include <sys/syslog.h>
-#if defined(__OpenBSD__)
-#include <sys/md5k.h>
+#ifdef __OpenBSD__
+#include <crypto/md5.h>
#else
#include <sys/md5.h>
#endif
7 openbsd/sys/arch/alpha/alpha/conf.c
View
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.48 2004/02/10 01:31:20 millert Exp $ */
+/* $OpenBSD: conf.c,v 1.50 2004/06/18 20:35:50 miod Exp $ */
/* $NetBSD: conf.c,v 1.16 1996/10/18 21:26:57 cgd Exp $ */
/*-
@@ -40,6 +40,8 @@
#include <sys/conf.h>
#include <sys/vnode.h>
+#include "inet.h"
+
#include "wd.h"
bdev_decl(wd);
#include "fd.h"
@@ -126,6 +128,7 @@ cdev_decl(pci);
#endif
#include "systrace.h"
+#include "hotplug.h"
struct cdevsw cdevsw[] =
{
@@ -193,6 +196,8 @@ struct cdevsw cdevsw[] =
cdev_notdef(), /* 53: ALTQ (deprecated) */
cdev_iop_init(NIOP, iop), /* 54: I2O IOP control interface */
cdev_ptm_init(NPTY,ptm), /* 55: pseudo-tty ptm device */
+ cdev_hotplug_init(NHOTPLUG,hotplug), /* 56: devices hot plugging */
+ cdev_crypto_init(NCRYPTO,crypto), /* 57: /dev/crypto */
};
int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
12 openbsd/sys/arch/alpha/alpha/machdep.c
View
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.86 2004/03/10 23:02:53 tom Exp $ */
+/* $OpenBSD: machdep.c,v 1.89 2004/07/06 21:53:59 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */
/*-
@@ -191,9 +191,6 @@ struct user *proc0paddr;
/* Number of machine cycles per microsecond */
u_int64_t cycles_per_usec;
-/* number of cpus in the box. really! */
-int ncpus;
-
struct bootinfo_kernel bootinfo;
/* For built-in TCDS */
@@ -393,10 +390,9 @@ alpha_init(pfn, ptb, bim, bip, biv)
*/
(*platform.cons_init)();
-#ifdef DIAGNOSTIC
+#if 0
/* Paranoid sanity checking */
- /* We should always be running on the primary. */
assert(hwrpb->rpb_primary_cpu_id == alpha_pal_whami());
/*
@@ -760,7 +756,7 @@ alpha_init(pfn, ptb, bim, bip, biv)
* Figure out the number of cpus in the box, from RPB fields.
* Really. We mean it.
*/
- for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) {
+ for (ncpus = 0, i = 0; i < hwrpb->rpb_pcs_cnt; i++) {
struct pcs *pcsp;
pcsp = LOCATE_PCS(hwrpb, i);
@@ -2046,7 +2042,7 @@ delay(n)
: "i" (2), "0" (N));
}
-#if defined(COMPAT_OSF1) || 1 /* XXX */
+#if defined(COMPAT_OSF1)
void cpu_exec_ecoff_setregs(struct proc *, struct exec_package *,
u_long, register_t *);
152 openbsd/sys/arch/alpha/include/intrcnt.h
View
@@ -1,152 +0,0 @@
-/* $OpenBSD: intrcnt.h,v 1.5 1997/01/24 19:57:13 niklas Exp $ */
-/* $NetBSD: intrcnt.h,v 1.7 1996/11/16 23:11:57 cgd Exp $ */
-
-/*
- * Copyright (c) 1995, 1996 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#define INTRNAMES_DEFINITION \
-/* 0x00 */ ASCIZ "clock"; \
- ASCIZ "isa irq 0"; \
- ASCIZ "isa irq 1"; \
- ASCIZ "isa irq 2"; \
- ASCIZ "isa irq 3"; \
- ASCIZ "isa irq 4"; \
- ASCIZ "isa irq 5"; \
- ASCIZ "isa irq 6"; \
- ASCIZ "isa irq 7"; \
- ASCIZ "isa irq 8"; \
- ASCIZ "isa irq 9"; \
- ASCIZ "isa irq 10"; \
- ASCIZ "isa irq 11"; \
- ASCIZ "isa irq 12"; \
- ASCIZ "isa irq 13"; \
- ASCIZ "isa irq 14"; \
-/* 0x10 */ ASCIZ "isa irq 15"; \
- ASCIZ "kn20aa irq 0"; \
- ASCIZ "kn20aa irq 1"; \
- ASCIZ "kn20aa irq 2"; \
- ASCIZ "kn20aa irq 3"; \
- ASCIZ "kn20aa irq 4"; \
- ASCIZ "kn20aa irq 5"; \
- ASCIZ "kn20aa irq 6"; \
- ASCIZ "kn20aa irq 7"; \
- ASCIZ "kn20aa irq 8"; \
- ASCIZ "kn20aa irq 9"; \
- ASCIZ "kn20aa irq 10"; \
- ASCIZ "kn20aa irq 11"; \
- ASCIZ "kn20aa irq 12"; \
- ASCIZ "kn20aa irq 13"; \
- ASCIZ "kn20aa irq 14"; \
-/* 0x20 */ ASCIZ "kn20aa irq 15"; \
- ASCIZ "kn20aa irq 16"; \
- ASCIZ "kn20aa irq 17"; \
- ASCIZ "kn20aa irq 18"; \
- ASCIZ "kn20aa irq 19"; \
- ASCIZ "kn20aa irq 20"; \
- ASCIZ "kn20aa irq 21"; \
- ASCIZ "kn20aa irq 22"; \
- ASCIZ "kn20aa irq 23"; \
- ASCIZ "kn20aa irq 24"; \
- ASCIZ "kn20aa irq 25"; \
- ASCIZ "kn20aa irq 26"; \
- ASCIZ "kn20aa irq 27"; \
- ASCIZ "kn20aa irq 28"; \
- ASCIZ "kn20aa irq 29"; \
- ASCIZ "kn20aa irq 30"; \
-/* 0x30 */ ASCIZ "kn20aa irq 31"; \
- ASCIZ "kn15 tc slot 0"; \
- ASCIZ "kn15 tc slot 1"; \
- ASCIZ "kn15 tc slot 2"; \
- ASCIZ "kn15 tc slot 3"; \
- ASCIZ "kn15 tc slot 4"; \
- ASCIZ "kn15 tc slot 5"; \
- ASCIZ "kn15 tcds"; \
- ASCIZ "kn15 ioasic"; \
- ASCIZ "kn15 sfb"; \
- ASCIZ "kn16 tc slot 0"; \
- ASCIZ "kn16 tc slot 1"; \
- ASCIZ "kn16 tcds"; \
- ASCIZ "kn16 ioasic"; \
- ASCIZ "kn16 sfb"; \
- ASCIZ "tcds esp 0"; \
-/* 0x40 */ ASCIZ "tcds esp 1"; \
- ASCIZ "ioasic le"; \
- ASCIZ "ioasic scc 0"; \
- ASCIZ "ioasic scc 1"; \
- ASCIZ "ioasic am79c30"; \
- ASCIZ "eb164 irq 0"; \
- ASCIZ "eb164 irq 1"; \
- ASCIZ "eb164 irq 2"; \
- ASCIZ "eb164 irq 3"; \
- ASCIZ "eb164 irq 4"; \
- ASCIZ "eb164 irq 5"; \
- ASCIZ "eb164 irq 6"; \
- ASCIZ "eb164 irq 7"; \
- ASCIZ "eb164 irq 8"; \
- ASCIZ "eb164 irq 9"; \
- ASCIZ "eb164 irq 10"; \
-/* 0x50 */ ASCIZ "eb164 irq 11"; \
- ASCIZ "eb164 irq 12"; \
- ASCIZ "eb164 irq 13"; \
- ASCIZ "eb164 irq 14"; \
- ASCIZ "eb164 irq 15"; \
- ASCIZ "eb164 irq 16"; \
- ASCIZ "eb164 irq 17"; \
- ASCIZ "eb164 irq 18"; \
- ASCIZ "eb164 irq 19"; \
- ASCIZ "eb164 irq 20"; \
- ASCIZ "eb164 irq 21"; \
- ASCIZ "eb164 irq 22"; \
- ASCIZ "eb164 irq 23";
-
-#define INTRCNT_DEFINITION \
-/* 0x00 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
-/* 0x10 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
-/* 0x20 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
-/* 0x30 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
-/* 0x40 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
-/* 0x50 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
-
-#define INTRCNT_CLOCK 0
-#define INTRCNT_ISA_IRQ (INTRCNT_CLOCK + 1)
-#define INTRCNT_ISA_IRQ_LEN 16
-#define INTRCNT_KN20AA_IRQ (INTRCNT_ISA_IRQ + INTRCNT_ISA_IRQ_LEN)
-#define INTRCNT_KN20AA_IRQ_LEN 32
-#define INTRCNT_KN15 (INTRCNT_KN20AA_IRQ + INTRCNT_KN20AA_IRQ_LEN)
-#define INTRCNT_KN15_LEN 9
-#define INTRCNT_KN16 (INTRCNT_KN15 + INTRCNT_KN15_LEN)
-#define INTRCNT_KN16_LEN 5
-#define INTRCNT_TCDS (INTRCNT_KN16 + INTRCNT_KN16_LEN)
-#define INTRCNT_TCDS_LEN 2
-#define INTRCNT_IOASIC (INTRCNT_TCDS + INTRCNT_TCDS_LEN)
-#define INTRCNT_IOASIC_LEN 4
-#define INTRCNT_EB164_IRQ (INTRCNT_IOASIC + INTRCNT_IOASIC_LEN)
-#define INTRCNT_EB164_IRQ_LEN 24
-
-#ifndef _LOCORE
-extern volatile long intrcnt[];
-#endif
398 openbsd/sys/arch/arm/arm/fusu.S
View
@@ -1,398 +0,0 @@
-/* $OpenBSD: fusu.S,v 1.2 2004/02/01 06:10:33 drahn Exp $ */
-/* $NetBSD: exception.S,v 1.13 2003/10/31 16:30:15 scw Exp $ */
-
-
-/*
- * Copyright (c) 1996-1998 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "assym.h"
-#include <machine/asm.h>
-
-#ifdef MULTIPROCESSOR
-.Lcpu_info:
- .word _C_LABEL(cpu_info)
-#else
-.Lcurpcb:
- .word _C_LABEL(curpcb)
-#endif
-
-/*
- * fuword(caddr_t uaddr);
- * Fetch an int from the user's address space.
- */
-
-ENTRY(fuword)
-#ifdef MULTIPROCESSOR
- /* XXX Probably not appropriate for non-Hydra SMPs */
- stmfd sp!, {r0, r14}
- bl _C_LABEL(cpu_number)
- ldr r2, .Lcpu_info
- ldr r2, [r2, r0, lsl #2]
- ldr r2, [r2, #CI_CURPCB]
- ldmfd sp!, {r0, r14}
-#else
- ldr r2, .Lcurpcb
- ldr r2, [r2]
-#endif
-
-#ifdef DIAGNOSTIC
- teq r2, #0x00000000
- beq .Lfusupcbfault
-#endif
-
- adr r1, .Lfusufault
- str r1, [r2, #PCB_ONFAULT]
-
- ldrt r3, [r0]
-
- mov r1, #0x00000000
- str r1, [r2, #PCB_ONFAULT]
- mov r0, r3
- mov pc, lr
-
-/*
- * fusword(caddr_t uaddr);
- * Fetch a short from the user's address space.
- */
-
-ENTRY(fusword)
-#ifdef MULTIPROCESSOR
- /* XXX Probably not appropriate for non-Hydra SMPs */
- stmfd sp!, {r0, r14}
- bl _C_LABEL(cpu_number)
- ldr r2, .Lcpu_info
- ldr r2, [r2, r0, lsl #2]
- ldr r2, [r2, #CI_CURPCB]
- ldmfd sp!, {r0, r14}
-#else
- ldr r2, .Lcurpcb
- ldr r2, [r2]
-#endif
-
-#ifdef DIAGNOSTIC
- teq r2, #0x00000000
- beq .Lfusupcbfault
-#endif
-
- adr r1, .Lfusufault
- str r1, [r2, #PCB_ONFAULT]
-
- ldrbt r3, [r0], #1
- ldrbt ip, [r0]
-#ifdef __ARMEB__
- orr r0, ip, r3, asl #8
-#else
- orr r0, r3, ip, asl #8
-#endif
- mov r1, #0x00000000
- str r1, [r2, #PCB_ONFAULT]
- mov pc, lr
-
-/*
- * fuswintr(caddr_t uaddr);
- * Fetch a short from the user's address space. Can be called during an
- * interrupt.
- */
-
-ENTRY(fuswintr)
- ldr r2, Lblock_userspace_access
- ldr r2, [r2]
- teq r2, #0
- mvnne r0, #0x00000000
- movne pc, lr
-
-#ifdef MULTIPROCESSOR
- /* XXX Probably not appropriate for non-Hydra SMPs */
- stmfd sp!, {r0, r14}
- bl _C_LABEL(cpu_number)
- ldr r2, .Lcpu_info
- ldr r2, [r2, r0, lsl #2]
- ldr r2, [r2, #CI_CURPCB]
- ldmfd sp!, {r0, r14}
-#else
- ldr r2, .Lcurpcb
- ldr r2, [r2]
-#endif
-
-#ifdef DIAGNOSTIC
- teq r2, #0x00000000
- beq .Lfusupcbfault
-#endif
-
- adr r1, _C_LABEL(fusubailout)
- str r1, [r2, #PCB_ONFAULT]
-
- ldrbt r3, [r0], #1
- ldrbt ip, [r0]
-#ifdef __ARMEB__
- orr r0, ip, r3, asl #8
-#else
- orr r0, r3, ip, asl #8
-#endif
-
- mov r1, #0x00000000
- str r1, [r2, #PCB_ONFAULT]
- mov pc, lr
-
-Lblock_userspace_access:
- .word _C_LABEL(block_userspace_access)
-
- .data
- .align 0
- .global _C_LABEL(block_userspace_access)
-_C_LABEL(block_userspace_access):
- .word 0
- .text
-
-/*
- * fubyte(caddr_t uaddr);
- * Fetch a byte from the user's address space.
- */
-
-ENTRY(fubyte)
-#ifdef MULTIPROCESSOR
- /* XXX Probably not appropriate for non-Hydra SMPs */
- stmfd sp!, {r0, r14}
- bl _C_LABEL(cpu_number)
- ldr r2, .Lcpu_info
- ldr r2, [r2, r0, lsl #2]
- ldr r2, [r2, #CI_CURPCB]
- ldmfd sp!, {r0, r14}
-#else
- ldr r2, .Lcurpcb
- ldr r2, [r2]
-#endif
-
-#ifdef DIAGNOSTIC
- teq r2, #0x00000000
- beq .Lfusupcbfault
-#endif
-
- adr r1, .Lfusufault
- str r1, [r2, #PCB_ONFAULT]
-
- ldrbt r3, [r0]
-
- mov r1, #0x00000000
- str r1, [r2, #PCB_ONFAULT]
- mov r0, r3
- mov pc, lr
-
-/*
- * Handle faults from [fs]u*(). Clean up and return -1.
- */
-
-.Lfusufault:
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mvn r0, #0x00000000
- mov pc, lr
-
-/*
- * Handle faults from [fs]u*(). Clean up and return -1. This differs from
- * fusufault() in that trap() will recognise it and return immediately rather
- * than trying to page fault.
- */
-
-/* label must be global as fault.c references it */
- .global _C_LABEL(fusubailout)
-_C_LABEL(fusubailout):
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mvn r0, #0x00000000
- mov pc, lr
-
-#ifdef DIAGNOSTIC
-/*
- * Handle earlier faults from [fs]u*(), due to no pcb
- */
-
-.Lfusupcbfault:
- mov r1, r0
- adr r0, fusupcbfaulttext
- b _C_LABEL(panic)
-
-fusupcbfaulttext:
- .asciz "Yikes - no valid PCB during fusuxxx() addr=%08x\n"
- .align 0
-#endif
-
-/*
- * suword(caddr_t uaddr, int x);
- * Store an int in the user's address space.
- */
-
-ENTRY(suword)
-#ifdef MULTIPROCESSOR
- /* XXX Probably not appropriate for non-Hydra SMPs */
- stmfd sp!, {r0, r1, r14}
- bl _C_LABEL(cpu_number)
- ldr r2, .Lcpu_info
- ldr r2, [r2, r0, lsl #2]
- ldr r2, [r2, #CI_CURPCB]
- ldmfd sp!, {r0, r1, r14}
-#else
- ldr r2, .Lcurpcb
- ldr r2, [r2]
-#endif
-
-#ifdef DIAGNOSTIC
- teq r2, #0x00000000
- beq .Lfusupcbfault
-#endif
-
- adr r3, .Lfusufault
- str r3, [r2, #PCB_ONFAULT]
-
- strt r1, [r0]
-
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mov pc, lr
-
-/*
- * suswintr(caddr_t uaddr, short x);
- * Store a short in the user's address space. Can be called during an
- * interrupt.
- */
-
-ENTRY(suswintr)
- ldr r2, Lblock_userspace_access
- ldr r2, [r2]
- teq r2, #0
- mvnne r0, #0x00000000
- movne pc, lr
-
-#ifdef MULTIPROCESSOR
- stmfd sp!, {r0, r1, r14}
- bl _C_LABEL(cpu_number)
- ldr r2, .Lcpu_info
- ldr r2, [r2, r0, lsl #2]
- ldr r2, [r2, #CI_CURPCB]
- ldmfd sp!, {r0, r1, r14}
-#else
- ldr r2, .Lcurpcb
- ldr r2, [r2]
-#endif
-
-#ifdef DIAGNOSTIC
- teq r2, #0x00000000
- beq .Lfusupcbfault
-#endif
-
- adr r3, _C_LABEL(fusubailout)
- str r3, [r2, #PCB_ONFAULT]
-
-#ifdef __ARMEB__
- mov ip, r1, lsr #8
- strbt ip, [r0], #1
-#else
- strbt r1, [r0], #1
- mov r1, r1, lsr #8
-#endif
- strbt r1, [r0]
-
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mov pc, lr
-
-/*
- * susword(caddr_t uaddr, short x);
- * Store a short in the user's address space.
- */
-
-ENTRY(susword)
-#ifdef MULTIPROCESSOR
- stmfd sp!, {r0, r1, r14}
- bl _C_LABEL(cpu_number)
- ldr r2, .Lcpu_info
- ldr r2, [r2, r0, lsl #2]
- ldr r2, [r2, #CI_CURPCB]
- ldmfd sp!, {r0, r1, r14}
-#else
- ldr r2, .Lcurpcb
- ldr r2, [r2]
-#endif
-
-#ifdef DIAGNOSTIC
- teq r2, #0x00000000
- beq .Lfusupcbfault
-#endif
-
- adr r3, .Lfusufault
- str r3, [r2, #PCB_ONFAULT]
-
-#ifdef __ARMEB__
- mov ip, r1, lsr #8
- strbt ip, [r0], #1
-#else
- strbt r1, [r0], #1
- mov r1, r1, lsr #8
-#endif
- strbt r1, [r0]
-
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mov pc, lr
-
-/*
- * subyte(caddr_t uaddr, char x);
- * Store a byte in the user's address space.
- */
-
-ENTRY(subyte)
-#ifdef MULTIPROCESSOR
- stmfd sp!, {r0, r1, r14}
- bl _C_LABEL(cpu_number)
- ldr r2, .Lcpu_info
- ldr r2, [r2, r0, lsl #2]
- ldr r2, [r2, #CI_CURPCB]
- ldmfd sp!, {r0, r1, r14}
-#else
- ldr r2, .Lcurpcb
- ldr r2, [r2]
-#endif
-
-
-#ifdef DIAGNOSTIC
- teq r2, #0x00000000
- beq .Lfusupcbfault
-#endif
-
- adr r3, .Lfusufault
- str r3, [r2, #PCB_ONFAULT]
-
- strbt r1, [r0]
-
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mov pc, lr
508 openbsd/sys/arch/hp300/dev/ac.c
View
@@ -1,508 +0,0 @@
-/* $OpenBSD: ac.c,v 1.7 1997/04/20 07:01:11 downsj Exp $ */
-/* $NetBSD: ac.c,v 1.9 1997/04/02 22:37:21 scottr Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ac.c 1.5 92/01/21$
- *
- * @(#)ac.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * SCSI driver for MO autochanger.
- *
- * Very crude. Because of the lack of connect/disconnect support in the
- * scsi driver, this driver can tie up the SCSI bus for a long time. It
- * also grabs a DMA channel and holds it for the duration even though it
- * never uses it.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-
-#include <hp300/dev/scsireg.h>
-#include <hp300/dev/scsivar.h>
-#include <hp300/dev/acioctl.h>
-#include <hp300/dev/acvar.h>
-
-/* cdev_decl(ac); */
-/* XXX we should use macros to do these... */
-int acopen __P((dev_t, int, int, struct proc *));
-int acclose __P((dev_t, int, int, struct proc *));
-int acioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
-
-static int acmatch __P((struct device *, void *, void *));
-static void acattach __P((struct device *, struct device *, void *));
-
-struct cfattach ac_ca = {
- sizeof(struct ac_softc), acmatch, acattach
-};
-
-struct cfdriver ac_cd = {
- NULL, "ac", DV_DULL
-};
-
-void acstart __P((void *));
-void acgo __P((void *));
-void acintr __P((void *, int));
-
-#ifdef DEBUG
-int ac_debug = 0x0000;
-#define ACD_FOLLOW 0x0001
-#define ACD_OPEN 0x0002
-#endif
-
-static int
-acmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct oscsi_attach_args *osa = aux;
-
- if (osa->osa_inqbuf->type != 8 || osa->osa_inqbuf->qual != 0x80 ||
- osa->osa_inqbuf->version != 2)
- return (0);
-
- return (1);
-}
-
-static void
-acattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct ac_softc *sc = (struct ac_softc *)self;
- struct oscsi_attach_args *osa = aux;
-
- printf("\n");
-
- sc->sc_target = osa->osa_target;
- sc->sc_lun = osa->osa_lun;
-
- /* Initialize SCSI queue entry. */
- sc->sc_sq.sq_softc = sc;
- sc->sc_sq.sq_target = sc->sc_target;
- sc->sc_sq.sq_lun = sc->sc_lun;
- sc->sc_sq.sq_start = acstart;
- sc->sc_sq.sq_go = acgo;
- sc->sc_sq.sq_intr = acintr;
-
- sc->sc_bp = (struct buf *)malloc(sizeof(struct buf),
- M_DEVBUF, M_NOWAIT);
- sc->sc_cmd = (struct scsi_fmt_cdb *)malloc(sizeof(struct scsi_fmt_cdb),
- M_DEVBUF, M_NOWAIT);
-
- if (sc->sc_bp == NULL || sc->sc_cmd == NULL) {
- printf("%s: memory allocation failed\n", sc->sc_dev.dv_xname);
- return;
- }
-
- sc->sc_flags = ACF_ALIVE;
-}
-
-/*ARGSUSED*/
-int
-acopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit = minor(dev);
- struct ac_softc *sc;
-
- if (unit >= ac_cd.cd_ndevs ||
- (sc = ac_cd.cd_devs[unit]) == NULL ||
- (sc->sc_flags & ACF_ALIVE) == 0)
- return (ENXIO);
-
- if (sc->sc_flags & ACF_OPEN)
- return (EBUSY);
-
- /*
- * Since acgeteinfo can block we mark the changer open now.
- */
- sc->sc_flags |= ACF_OPEN;
- if (acgeteinfo(dev)) {
- sc->sc_flags &= ~ACF_OPEN;
- return(EIO);
- }
- return (0);
-}
-
-/*ARGSUSED*/
-int
-acclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct ac_softc *sc = ac_cd.cd_devs[minor(dev)];
-
- sc->sc_flags &= ~ACF_OPEN;
- return (0);
-}
-
-#define ACRESLEN(ep) \
- (8 + (ep)->nmte*12 + (ep)->nse*12 + (ep)->niee*12 + (ep)->ndte*20)
-
-/*ARGSUSED*/
-int
-acioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct ac_softc *sc = ac_cd.cd_devs[minor(dev)];
- char *dp;
- int dlen, error = 0;
-
- switch (cmd) {
-
- default:
- return (EINVAL);
-
- /* perform an init element status and mode sense to reset state */
- case ACIOCINIT:
- error = accommand(dev, ACCMD_INITES, (caddr_t)0, 0);
- if (!error)
- error = acgeteinfo(dev);
- break;
-
- /* copy internal element information */
- case ACIOCGINFO:
- *(struct acinfo *)data = sc->sc_einfo;
- break;
-
- case ACIOCRAWES:
- {
- struct acbuffer *acbp = (struct acbuffer *)data;
-
- dlen = ACRESLEN(&sc->sc_einfo);
- dp = (char *) malloc(dlen, M_DEVBUF, M_WAITOK);
- error = accommand(dev, ACCMD_READES, dp, dlen);
- if (!error) {
- dlen = *(int *)&dp[4] + 8;
- if (dlen > acbp->buflen)
- dlen = acbp->buflen;
- error = copyout(dp, acbp->bufptr, dlen);
- }
- break;
- }
-
- case ACIOCGSTAT:
- {
- struct acbuffer *acbp = (struct acbuffer *)data;
-
- dlen = ACRESLEN(&sc->sc_einfo);
- dp = (char *) malloc(dlen, M_DEVBUF, M_WAITOK);
- error = accommand(dev, ACCMD_READES, dp, dlen);
- if (!error) {
- int ne;
- char *tbuf;
-
- ne = sc->sc_einfo.nmte + sc->sc_einfo.nse +
- sc->sc_einfo.niee + sc->sc_einfo.ndte;
- dlen = ne * sizeof(struct aceltstat);
- tbuf = (char *) malloc(dlen, M_DEVBUF, M_WAITOK);
- acconvert(dp, tbuf, ne);
- if (dlen > acbp->buflen)
- dlen = acbp->buflen;
- error = copyout(tbuf, acbp->bufptr, dlen);
- free(tbuf, M_DEVBUF);
- }
- free(dp, M_DEVBUF);
- break;
- }
-
- case ACIOCMOVE:
- error = accommand(dev, ACCMD_MOVEM, data,
- sizeof(struct acmove));
- break;
- }
- return(error);
-}
-
-int
-accommand(dev, command, bufp, buflen)
- dev_t dev;
- int command;
- char *bufp;
- int buflen;
-{
- int unit = minor(dev);
- struct ac_softc *sc = ac_cd.cd_devs[unit];
- struct buf *bp = sc->sc_bp;
- struct scsi_fmt_cdb *cmd = sc->sc_cmd;
- int error;
-
-#ifdef DEBUG
- if (ac_debug & ACD_FOLLOW)
- printf("accommand(dev=%x, cmd=%x, buf=%p, buflen=%x)\n",
- dev, command, bufp, buflen);
-#endif
- if (sc->sc_flags & ACF_ACTIVE)
- panic("accommand: active!");
-
- sc->sc_flags |= ACF_ACTIVE;
- bzero((caddr_t)cmd->cdb, sizeof(cmd->cdb));
- cmd->cdb[0] = command;
-
- switch (command) {
- case ACCMD_INITES:
- cmd->len = 6;
- break;
- case ACCMD_READES:
- cmd->len = 12;
- *(short *)&cmd->cdb[2] = 0;
- *(short *)&cmd->cdb[4] =
- sc->sc_einfo.nmte + sc->sc_einfo.nse +
- sc->sc_einfo.niee + sc->sc_einfo.ndte;
- cmd->cdb[7] = buflen >> 16;
- cmd->cdb[8] = buflen >> 8;
- cmd->cdb[9] = buflen;
- break;
- case ACCMD_MODESENSE:
- cmd->len = 6;
- cmd->cdb[2] = 0x3F; /* all pages */
- cmd->cdb[4] = buflen;
- break;
- case ACCMD_MOVEM:
- cmd->len = 12;
- *(short *)&cmd->cdb[2] = sc->sc_picker;
- *(short *)&cmd->cdb[4] = *(short *)&bufp[0];
- *(short *)&cmd->cdb[6] = *(short *)&bufp[2];
- if (*(short *)&bufp[4] & AC_INVERT)
- cmd->cdb[10] = 1;
- bufp = 0;
- buflen = 0;
- break;
- default:
- panic("accommand: bad command");
- }
- bp->b_flags = B_BUSY|B_READ;
- bp->b_dev = dev;
- bp->b_un.b_addr = bufp;
- bp->b_bcount = buflen;
- bp->b_resid = 0;
- bp->b_blkno = 0;
- bp->b_error = 0;
- if (scsireq(sc->sc_dev.dv_parent, &sc->sc_sq))
- acstart(sc);
- error = biowait(bp);
- sc->sc_flags &= ~ACF_ACTIVE;
- return (error);
-}
-
-void
-acstart(arg)
- void *arg;
-{
- struct ac_softc *sc = arg;
-
-#ifdef DEBUG
- if (ac_debug & ACD_FOLLOW)
- printf("acstart(unit=%x)\n", sc->sc_dev.dv_unit);
-#endif
- if (scsiustart(sc->sc_dev.dv_parent->dv_unit))
- acgo(arg);
-}
-
-void
-acgo(arg)
- void *arg;
-{
- struct ac_softc *sc = arg;
- struct buf *bp = sc->sc_bp;
- int stat;
-
-#ifdef DEBUG
- if (ac_debug & ACD_FOLLOW)
- printf("acgo(unit=%x): ", sc->sc_dev.dv_unit);
-#endif
- stat = scsigo(sc->sc_dev.dv_parent->dv_unit, sc->sc_target,
- sc->sc_lun, bp, sc->sc_cmd, 0);
-#ifdef DEBUG
- if (ac_debug & ACD_FOLLOW)
- printf("scsigo returns %x\n", stat);
-#endif
- if (stat) {
- bp->b_error = EIO;
- bp->b_flags |= B_ERROR;
- (void) biodone(bp);
- scsifree(sc->sc_dev.dv_parent, &sc->sc_sq);
- }
-}
-
-void
-acintr(arg, stat)
- void *arg;
- int stat;
-{
- struct ac_softc *sc = arg;
- struct buf *bp = sc->sc_bp;
- u_char sensebuf[78];
- struct scsi_xsense *sp;
-
-#ifdef DEBUG
- if (ac_debug & ACD_FOLLOW)
- printf("acintr(unit=%x, stat=%x)\n", sc->sc_dev.dv_unit, stat);
-#endif
- switch (stat) {
- case 0:
- bp->b_resid = 0;
- break;
- case STS_CHECKCOND:
- scsi_request_sense(sc->sc_dev.dv_parent->dv_unit,
- sc->sc_target, sc->sc_lun, sensebuf, sizeof sensebuf);
- sp = (struct scsi_xsense *)sensebuf;
- printf("%s: acintr sense key=%x, ac=%x, acq=%x\n",
- sc->sc_dev.dv_xname, sp->key, sp->info4, sp->len);
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
- break;
- default:
- printf("%s: acintr unknown status 0x%x\n", sc->sc_dev.dv_xname,
- stat);
- break;
- }
- (void) biodone(sc->sc_bp);
- scsifree(sc->sc_dev.dv_parent, &sc->sc_sq);
-}
-
-int
-acgeteinfo(dev)
- dev_t dev;
-{
- struct ac_softc *sc = ac_cd.cd_devs[minor(dev)];
- char *bp;
- char msbuf[48];
- int error;
-
- bzero(msbuf, sizeof msbuf);
- error = accommand(dev, ACCMD_MODESENSE, msbuf, sizeof msbuf);
- if (error)
- return(error);
- bp = &msbuf[4];
- while (bp < &msbuf[48]) {
- switch (bp[0] & 0x3F) {
- case 0x1D:
- sc->sc_einfo = *(struct acinfo *)&bp[2];
- sc->sc_picker = sc->sc_einfo.fmte; /* XXX */
- return(0);
- case 0x1E:
- bp += 4;
- break;
- case 0x1F:
- bp += 20;
- break;
- default:
- printf("acgeteinfo: bad page type %x\n", bp[0]);
- return(EIO);
- }
- }
- return(EIO);
-}
-
-void
-acconvert(sbuf, dbuf, ne)
- char *sbuf, *dbuf;
- int ne;
-{
- struct aceltstat *ep = (struct aceltstat *)dbuf;
- struct ac_restatphdr *phdr;
- struct ac_restatdb *dbp;
- struct ac_restathdr *hdr;
-#ifdef DEBUG
- int bcount;
-#endif
-
- hdr = (struct ac_restathdr *)&sbuf[0];
- sbuf += sizeof *hdr;
-#ifdef DEBUG
- if (ac_debug & ACD_FOLLOW)
- printf("element status: first=%d, num=%d, len=%ld\n",
- hdr->ac_felt, hdr->ac_nelt, hdr->ac_bcount);
- if (hdr->ac_nelt != ne) {
- printf("acconvert: # of elements, %d != %d\n",
- hdr->ac_nelt, ne);
- if (hdr->ac_nelt < ne)
- ne = hdr->ac_nelt;
- }
- bcount = hdr->ac_bcount;
-#endif
- while (ne) {
- phdr = (struct ac_restatphdr *)sbuf;
- sbuf += sizeof *phdr;
-#ifdef DEBUG
- bcount -= sizeof *phdr;
-#endif
- dbp = (struct ac_restatdb *)sbuf;
- sbuf += phdr->ac_bcount;
-#ifdef DEBUG
- bcount -= phdr->ac_bcount;
-#endif
- while (dbp < (struct ac_restatdb *)sbuf) {
- ep->type = phdr->ac_type;
- ep->eaddr = dbp->ac_eaddr;
- ep->flags = 0;
- if (dbp->ac_full)
- ep->flags |= AC_FULL;
- if (dbp->ac_exc)
- ep->flags |= AC_ERROR;
- if (dbp->ac_acc)
- ep->flags |= AC_ACCESS;
- dbp = (struct ac_restatdb *)
- ((char *)dbp + phdr->ac_dlen);
- ep++;
- ne--;
- }
-#ifdef DEBUG
- if (ne < 0 || bcount < 0)
- panic("acconvert: inconsistant");
-#endif
- }
-}
89 openbsd/sys/arch/hp300/dev/acioctl.h
View
@@ -1,89 +0,0 @@
-/* $OpenBSD: acioctl.h,v 1.2 1997/01/12 15:12:18 downsj Exp $ */
-/* $NetBSD: acioctl.h,v 1.2 1994/10/26 07:23:25 cgd Exp $ */
-
-/*
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: acioctl.h 1.1 91/06/19$
- *
- * @(#)acioctl.h 8.1 (Berkeley) 6/10/93
- */
-
-struct acinfo {
- short fmte; /* 1st medium transport elt (picker) */
- short nmte; /* # medium transport elts */
- short fse; /* 1st storage elt (slot) */
- short nse; /* # storage elts */
- short fiee; /* 1st import/export elt (mailslot) */
- short niee; /* # import/export elts */
- short fdte; /* 1st data transport elt (drive) */
- short ndte; /* # data transport elts */
-};
-
-struct aceltstat {
- short eaddr; /* element adress */
- char type; /* type of element */
- char flags; /* flags */
-};
-
-/* types */
-#define AC_MTE 0x01 /* picker */
-#define AC_SE 0x02 /* slot */
-#define AC_IEE 0x03 /* mailslot */
-#define AC_DTE 0x04 /* drive */
-/* flags */
-#define AC_FULL 0x01 /* media present */
-#define AC_ERROR 0x04 /* error accessing element */
-#define AC_ACCESS 0x08 /* element accessible */
-#define AC_INVERT 0x80 /* media inverted prior to insertion */
-
-struct acmove {
- short srcelem;
- short dstelem;
- short flags;
-};
-
-struct acbuffer {
- char *bufptr;
- int buflen;
-};
-
-#define ACIOCINIT _IO('A', 0x1) /* init elt status */
-#define ACIOCGINFO _IOR('A', 0x2, struct acinfo) /* mode sense */
-#define ACIOCGSTAT _IOW('A', 0x3, struct acbuffer) /* read elem status */
-#define ACIOCMOVE _IOW('A', 0x4, struct acmove) /* move elem */
-#define ACIOCRAWES _IOW('A', 0x5, struct acbuffer) /* raw element stat */
100 openbsd/sys/arch/hp300/dev/acvar.h
View
@@ -1,100 +0,0 @@
-/* $OpenBSD: acvar.h,v 1.4 1997/04/16 11:55:56 downsj Exp $ */
-/* $NetBSD: acvar.h,v 1.4 1997/03/31 07:32:15 scottr Exp $ */
-
-/*
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: acvar.h 1.1 91/06/19$
- *
- * @(#)acvar.h 8.1 (Berkeley) 6/10/93
- */
-
-struct ac_softc {
- struct device sc_dev;
- int sc_target;
- int sc_lun;
- int sc_flags;
- struct buf *sc_bp;
- struct scsi_fmt_cdb *sc_cmd;
- struct acinfo sc_einfo;
- short sc_picker;
- struct scsiqueue sc_sq;
-};
-
-#define ACF_ALIVE 0x01
-#define ACF_OPEN 0x02
-#define ACF_ACTIVE 0x04
-
-#define ACCMD_INITES 0x07
-#define ACCMD_MODESENSE 0x1A
-#define ACCMD_READES 0xB8
-#define ACCMD_MOVEM 0xA5
-
-struct ac_restathdr {
- short ac_felt; /* first element reported */
- short ac_nelt; /* number of elements reported */
- long ac_bcount; /* length of report (really only 24 bits) */
-};
-
-struct ac_restatphdr {
- char ac_type; /* type code */
- char ac_res;
- short ac_dlen; /* element descriptor length */
- long ac_bcount; /* byte count (really only 24 bits) */
-};
-
-struct ac_restatdb {
- short ac_eaddr; /* element address */
- u_int ac_res1:2,
- ac_ie:1, /* import enabled (IEE only) */
- ac_ee:1, /* export enabled (IEE only) */
- ac_acc:1, /* accessible from MTE */
- ac_exc:1, /* element in abnormal state */
- ac_imp:1, /* 1 == user inserted medium (IEE only) */
- ac_full:1; /* element contains media */
-};
-
-#ifdef _KERNEL
-int accommand __P((dev_t, int, char *, int));
-
-void acstart __P((void *));
-void acgo __P((void *));
-void acintr __P((void *, int));
-
-int acgeteinfo __P((dev_t));
-void acconvert __P((char *, char *, int));
-#endif /* _KERNEL */
1,548 openbsd/sys/arch/hp300/dev/scsi.c
View
@@ -1,1548 +0,0 @@
-/* $OpenBSD: scsi.c,v 1.10 1997/07/06 08:01:55 downsj Exp $ */
-/* $NetBSD: scsi.c,v 1.21 1997/05/05 21:08:26 thorpej Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsi.c 8.2 (Berkeley) 1/12/94
- */
-
-#ifndef DEBUG
-#define DEBUG
-#endif
-/*
- * HP9000/3xx 98658 SCSI host adaptor driver.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-#include <machine/hp300spu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <hp300/dev/dmavar.h>
-
-#include <hp300/dev/scsireg.h>
-#include <hp300/dev/scsivar.h>
-
-struct scsi_softc {
- struct device sc_dev; /* generic device glue */
- volatile struct scsidevice *sc_regs; /* card registers */
- struct dmaqueue sc_dq; /* our entry in DMA job queue */
- TAILQ_HEAD(, scsiqueue) sc_queue; /* job queue */
- u_char sc_flags;
- u_char sc_sync;
- u_char sc_scsi_addr;
- u_char sc_scsiid; /* XXX unencoded copy of sc_scsi_addr */
- u_char sc_stat[2];
- u_char sc_msg[7];
-};
-
-/* sc_flags */
-#define SCSI_IO 0x80 /* DMA I/O in progress */
-#define SCSI_DMA32 0x40 /* 32-bit DMA should be used */
-#define SCSI_HAVEDMA 0x04 /* controller has DMA channel */
-#ifdef DEBUG
-#define SCSI_PAD 0x02 /* 'padded' transfer in progress */
-#endif
-#define SCSI_ALIVE 0x01 /* controller initialized */
-
-/*
- * SCSI delays
- * In u-seconds, primarily for state changes on the SPC.
- */
-#define SCSI_CMD_WAIT 10000 /* wait per step of 'immediate' cmds */
-#define SCSI_DATA_WAIT 10000 /* wait per data in/out step */
-#define SCSI_INIT_WAIT 50000 /* wait per step (both) during init */
-
-static void scsiabort __P((int, struct scsi_softc *,
- volatile struct scsidevice *, char *));
-static void scsierror __P((struct scsi_softc *,
- volatile struct scsidevice *, u_char));
-static int issue_select __P((volatile struct scsidevice *,
- u_char, u_char));
-static int wait_for_select __P((volatile struct scsidevice *));
-static int ixfer_start __P((volatile struct scsidevice *,
- int, u_char, int));
-static int ixfer_out __P((volatile struct scsidevice *, int, u_char *));
-static void ixfer_in __P((volatile struct scsidevice *, int, u_char *));
-static int mxfer_in __P((volatile struct scsidevice *,
- int, u_char *, u_char));
-static int scsiicmd __P((struct scsi_softc *, int, u_char *, int,
- u_char *, int, u_char));
-static void finishxfer __P((struct scsi_softc *,
- volatile struct scsidevice *, int));
-
-int scsimatch __P((struct device *, void *, void *));
-void scsiattach __P((struct device *, struct device *, void *));
-void scsi_attach_children __P((struct scsi_softc *));
-int scsisubmatch __P((struct device *, void *, void *));
-
-struct cfattach oscsi_ca = {
- sizeof(struct scsi_softc), scsimatch, scsiattach
-};
-
-struct cfdriver oscsi_cd = {
- NULL, "oscsi", DV_DULL
-};
-
-int scsi_cmd_wait = SCSI_CMD_WAIT;
-int scsi_data_wait = SCSI_DATA_WAIT;
-int scsi_init_wait = SCSI_INIT_WAIT;
-
-int scsi_nosync = 1; /* inhibit sync xfers if 1 */
-int scsi_pridma = 0; /* use "priority" dma */
-
-#ifdef DEBUG
-int scsi_debug = 0;
-#define WAITHIST
-#endif
-
-#ifdef WAITHIST
-#define MAXWAIT 1022
-u_int ixstart_wait[MAXWAIT+2];
-u_int ixin_wait[MAXWAIT+2];
-u_int ixout_wait[MAXWAIT+2];
-u_int mxin_wait[MAXWAIT+2];
-u_int mxin2_wait[MAXWAIT+2];
-u_int cxin_wait[MAXWAIT+2];
-u_int fxfr_wait[MAXWAIT+2];
-u_int sgo_wait[MAXWAIT+2];
-#define HIST(h,w) (++h[((w)>MAXWAIT? MAXWAIT : ((w) < 0 ? -1 : (w))) + 1]);
-#else
-#define HIST(h,w)
-#endif
-
-#define b_cylin b_resid
-
-static void
-scsiabort(target, hs, hd, where)
- int target;
- struct scsi_softc *hs;
- volatile struct scsidevice *hd;
- char *where;
-{
- int len;
- int maxtries; /* XXX - kludge till I understand whats *supposed* to happen */
- int startlen; /* XXX - kludge till I understand whats *supposed* to happen */
- u_char junk;
-
- printf("%s: ", hs->sc_dev.dv_xname);
- if (target != -1)
- printf("targ %d ", target);
- printf("abort from %s: phase=0x%x, ssts=0x%x, ints=0x%x\n",
- where, hd->scsi_psns, hd->scsi_ssts, hd->scsi_ints);
-
- hd->scsi_ints = hd->scsi_ints;
- hd->scsi_csr = 0;
- if (hd->scsi_psns == 0 || (hd->scsi_ssts & SSTS_INITIATOR) == 0)
- /* no longer connected to scsi target */
- return;
-
- /* get the number of bytes remaining in current xfer + fudge */
- len = (hd->scsi_tch << 16) | (hd->scsi_tcm << 8) | hd->scsi_tcl;
-
- /* for that many bus cycles, try to send an abort msg */
- for (startlen = (len += 1024); (hd->scsi_ssts & SSTS_INITIATOR) && --len >= 0; ) {
- hd->scsi_scmd = SCMD_SET_ATN;
- maxtries = 1000;
- while ((hd->scsi_psns & PSNS_REQ) == 0) {
- if (! (hd->scsi_ssts & SSTS_INITIATOR))
- goto out;
- DELAY(1);
- if (--maxtries == 0) {
- printf("-- scsiabort gave up after 1000 tries (startlen = %d len = %d)\n",
- startlen, len);
- goto out2;
- }
-
- }
-out2:
- if ((hd->scsi_psns & PHASE) == MESG_OUT_PHASE)
- hd->scsi_scmd = SCMD_RST_ATN;
- hd->scsi_pctl = hd->scsi_psns & PHASE;
- if (hd->scsi_psns & PHASE_IO) {
- /* one of the input phases - read & discard a byte */
- hd->scsi_scmd = SCMD_SET_ACK;
- if (hd->scsi_tmod == 0)
- while (hd->scsi_psns & PSNS_REQ)
- DELAY(1);
- junk = hd->scsi_temp;
- } else {
- /* one of the output phases - send an abort msg */
- hd->scsi_temp = MSG_ABORT;
- hd->scsi_scmd = SCMD_SET_ACK;
- if (hd->scsi_tmod == 0)
- while (hd->scsi_psns & PSNS_REQ)
- DELAY(1);
- }
- hd->scsi_scmd = SCMD_RST_ACK;
- }
-out:
- /*
- * Either the abort was successful & the bus is disconnected or
- * the device didn't listen. If the latter, announce the problem.
- * Either way, reset the card & the SPC.
- */
- if (len < 0 && hs)
- printf("%s: abort failed. phase=0x%x, ssts=0x%x\n",
- hs->sc_dev.dv_xname, hd->scsi_psns, hd->scsi_ssts);
-
- if (! ((junk = hd->scsi_ints) & INTS_RESEL)) {
- hd->scsi_sctl |= SCTL_CTRLRST;
- DELAY(2);
- hd->scsi_sctl &=~ SCTL_CTRLRST;
- hd->scsi_hconf = 0;
- hd->scsi_ints = hd->scsi_ints;
- }
-}
-
-/*
- * XXX Set/reset long delays.
- *
- * if delay == 0, reset default delays
- * if delay < 0, set both delays to default long initialization values
- * if delay > 0, set both delays to this value
- *
- * Used when a devices is expected to respond slowly (e.g. during
- * initialization).
- */
-void
-scsi_delay(delay)
- int delay;
-{
- static int saved_cmd_wait, saved_data_wait;
-
- if (delay) {
- saved_cmd_wait = scsi_cmd_wait;
- saved_data_wait = scsi_data_wait;
- if (delay > 0)
- scsi_cmd_wait = scsi_data_wait = delay;
- else
- scsi_cmd_wait = scsi_data_wait = scsi_init_wait;
- } else {
- scsi_cmd_wait = saved_cmd_wait;
- scsi_data_wait = saved_data_wait;
- }
-}
-
-int
-scsimatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- switch (da->da_id) {
- case DIO_DEVICE_ID_SCSI0:
- case DIO_DEVICE_ID_SCSI1:
- case DIO_DEVICE_ID_SCSI2:
- case DIO_DEVICE_ID_SCSI3:
- return (1);
- }
-
- return (0);
-}
-
-void
-scsiattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct scsi_softc *hs = (struct scsi_softc *)self;
- struct dio_attach_args *da = aux;
- struct scsidevice *hd;
- int ipl, unit = self->dv_unit;
-
- /*
- * Set up DMA job queue entry.
- */
- hs->sc_dq.dq_softc = hs;
- hs->sc_dq.dq_start = scsistart;
- hs->sc_dq.dq_done = scsidone;
-
- /* Initialize request queue. */
- TAILQ_INIT(&hs->sc_queue);
-
- /* Map the device. */
- hd = (struct scsidevice *)iomap(dio_scodetopa(da->da_scode),
- da->da_size);
- if (hd == NULL) {
- printf("\n%s: can't map registers\n", self->dv_xname);
- return;
- }
- ipl = DIO_IPL(hd);
-
- printf(" ipl %d", ipl);
-
- hs->sc_regs = hd;
-
- /* Establish the interrupt handler. */
- (void) dio_intr_establish(scsiintr, hs, ipl, IPL_BIO);
-
- /* Reset the controller. */
- scsireset(unit);
-
- /*
- * Print information about what we've found.
- */
- printf(":");
- if (hs->sc_flags & SCSI_DMA32)
- printf(" 32 bit dma, ");
-
- switch (hs->sc_sync) {
- case 0:
- printf("async");
- break;
-
- case (TMOD_SYNC | 0x3e):
- printf("250ns sync");
- break;
-
- case (TMOD_SYNC | 0x5e):
- printf("375ns sync");
- break;
-
- case (TMOD_SYNC | 0x7d):
- printf("500ns sync");
- break;
-
- default:
- panic("scsiattach: unknown sync param 0x%x", hs->sc_sync);
- }
-
- if ((hd->scsi_hconf & HCONF_PARITY) == 0)
- printf(", no parity");
-
- printf(", scsi id %d\n", hs->sc_scsiid);
-
- /*
- * XXX scale initialization wait according to CPU speed.
- * Should we do this for all wait? Should we do this at all?
- */
- scsi_init_wait *= (cpuspeed / 8);
-
- /*
- * Find and attach devices on the SCSI bus.
- */
- scsi_attach_children(hs);
-}
-
-void
-scsi_attach_children(sc)
- struct scsi_softc *sc;
-{
- struct oscsi_attach_args osa;
- struct scsi_inquiry inqbuf;
- int target, lun;
-
- /*
- * Look for devices on the SCSI bus.
- */
-
- for (target = 0; target < 8; target++) {
- /* Skip target used by controller. */
- if (target == sc->sc_scsiid)
- continue;
-
- for (lun = 0; lun < 1 /* XXX */; lun++) {
- bzero(&inqbuf, sizeof(inqbuf));
- if (scsi_probe_device(sc->sc_dev.dv_unit,
- target, lun, &inqbuf, sizeof(inqbuf))) {
- /*
- * XXX First command on some tapes
- * XXX always fails. (Or, at least,
- * XXX that's what the old Utah "st"
- * XXX driver claimed.)
- */
- bzero(&inqbuf, sizeof(inqbuf));
- if (scsi_probe_device(sc->sc_dev.dv_unit,
- target, lun, &inqbuf, sizeof(inqbuf)))
- continue;
- }
-
- /*
- * There is a device here; find a driver
- * to match it.
- */
- osa.osa_target = target;
- osa.osa_lun = lun;
- osa.osa_inqbuf = &inqbuf;
- (void)config_found_sm(&sc->sc_dev, &osa,
- scsi_print, scsisubmatch);
- }
- }
-}
-
-int
-scsisubmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
- struct oscsi_attach_args *osa = aux;
-
- if (cf->cf_loc[0] != -1 &&
- cf->cf_loc[0] != osa->osa_target)
- return (0);
-
- if (cf->cf_loc[1] != -1 &&
- cf->cf_loc[1] != osa->osa_lun)
- return (0);
-
- return ((*cf->cf_attach->ca_match)(parent, match, aux));
-}
-
-int
-scsi_print(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct oscsi_attach_args *osa = aux;
- struct scsi_inquiry *inqbuf = osa->osa_inqbuf;
- char vendor[9], product[17], revision[5];
-
- if (pnp == NULL)
- printf(" targ %d lun %d: ", osa->osa_target, osa->osa_lun);
-
- bzero(vendor, sizeof(vendor));
- bzero(product, sizeof(product));
- bzero(revision, sizeof(revision));
- switch (inqbuf->version) {
- case 1:
- case 2:
- scsi_str(inqbuf->vendor_id, vendor, sizeof(inqbuf->vendor_id));
- scsi_str(inqbuf->product_id, product,
- sizeof(inqbuf->product_id));
- scsi_str(inqbuf->rev, revision, sizeof(inqbuf->rev));
- printf("<%s, %s, %s>", vendor, product, revision);
- if (inqbuf->version == 2)
- printf(" (SCSI-2)");
- break;
- default:
- printf("type 0x%x, qual 0x%x, ver %d",
- inqbuf->type, inqbuf->qual, inqbuf->version);
- }
- if (pnp != NULL)
- printf(" at %s targ %d lun %d",
- pnp, osa->osa_target, osa->osa_lun);
-
- return (UNCONF);
-}
-
-void
-scsireset(unit)
- int unit;
-{
- struct scsi_softc *hs = oscsi_cd.cd_devs[unit];
- volatile struct scsidevice *hd = hs->sc_regs;
- u_int i;
-
- if (hs->sc_flags & SCSI_ALIVE)
- scsiabort(-1, hs, hd, "reset");
-
- hd->scsi_id = 0xFF;
- DELAY(100);
- /*
- * Disable interrupts then reset the FUJI chip.
- */
- hd->scsi_csr = 0;
- hd->scsi_sctl = SCTL_DISABLE | SCTL_CTRLRST;
- hd->scsi_scmd = 0;
- hd->scsi_tmod = 0;
- hd->scsi_pctl = 0;
- hd->scsi_temp = 0;
- hd->scsi_tch = 0;
- hd->scsi_tcm = 0;
- hd->scsi_tcl = 0;
- hd->scsi_ints = 0;
-
- if ((hd->scsi_id & ID_WORD_DMA) == 0)
- hs->sc_flags |= SCSI_DMA32;
-
- /* Determine Max Synchronous Transfer Rate */
- if (scsi_nosync)
- i = 3;
- else
- i = SCSI_SYNC_XFER(hd->scsi_hconf);
- switch (i) {
- case 0:
- hs->sc_sync = TMOD_SYNC | 0x3e; /* 250 nsecs */
- break;
- case 1:
- hs->sc_sync = TMOD_SYNC | 0x5e; /* 375 nsecs */
- break;
- case 2:
- hs->sc_sync = TMOD_SYNC | 0x7d; /* 500 nsecs */
- break;
- case 3:
- hs->sc_sync = 0;
- break;
- }
-
- /*
- * Configure the FUJI chip with its SCSI address, all
- * interrupts enabled & appropriate parity.
- */
- i = (~hd->scsi_hconf) & 0x7;
- hs->sc_scsi_addr = 1 << i;
- hd->scsi_bdid = i;
- hs->sc_scsiid = i;
- if (hd->scsi_hconf & HCONF_PARITY)
- hd->scsi_sctl = SCTL_DISABLE | SCTL_ABRT_ENAB |
- SCTL_SEL_ENAB | SCTL_RESEL_ENAB |
- SCTL_INTR_ENAB | SCTL_PARITY_ENAB;
- else
- hd->scsi_sctl = SCTL_DISABLE | SCTL_ABRT_ENAB |
- SCTL_SEL_ENAB | SCTL_RESEL_ENAB |
- SCTL_INTR_ENAB;
-
- hd->scsi_sctl &=~ SCTL_DISABLE;
- hs->sc_flags |= SCSI_ALIVE;
-}
-
-static void
-scsierror(hs, hd, ints)
- struct scsi_softc *hs;
- volatile struct scsidevice *hd;
- u_char ints;
-{
- char *sep = "";
-
- printf("%s: ", hs->sc_dev.dv_xname);
- if (ints & INTS_RST) {
- DELAY(100);
- if (hd->scsi_hconf & HCONF_SD)
- printf("spurious RST interrupt");
- else
- printf("hardware error - check fuse");
- sep = ", ";
- }
- if ((ints & INTS_HARD_ERR) || hd->scsi_serr) {
- if (hd->scsi_serr & SERR_SCSI_PAR) {
- printf("%sparity err", sep);
- sep = ", ";
- }
- if (hd->scsi_serr & SERR_SPC_PAR) {
- printf("%sSPC parity err", sep);
- sep = ", ";
- }
- if (hd->scsi_serr & SERR_TC_PAR) {
- printf("%sTC parity err", sep);
- sep = ", ";
- }
- if (hd->scsi_serr & SERR_PHASE_ERR) {
- printf("%sphase err", sep);
- sep = ", ";
- }
- if (hd->scsi_serr & SERR_SHORT_XFR) {
- printf("%ssync short transfer err", sep);
- sep = ", ";
- }
- if (hd->scsi_serr & SERR_OFFSET) {
- printf("%ssync offset error", sep);
- sep = ", ";
- }
- }
- if (ints & INTS_TIMEOUT)
- printf("%sSPC select timeout error", sep);
- if (ints & INTS_SRV_REQ)
- printf("%sspurious SRV_REQ interrupt", sep);
- if (ints & INTS_CMD_DONE)
- printf("%sspurious CMD_DONE interrupt", sep);
- if (ints & INTS_DISCON)
- printf("%sspurious disconnect interrupt", sep);
- if (ints & INTS_RESEL)
- printf("%sspurious reselect interrupt", sep);
- if (ints & INTS_SEL)
- printf("%sspurious select interrupt", sep);
- printf("\n");
-}
-
-static int
-issue_select(hd, target, our_addr)
- volatile struct scsidevice *hd;
- u_char target, our_addr;
-{
- if (hd->scsi_ssts & (SSTS_INITIATOR|SSTS_TARGET|SSTS_BUSY))
- return (1);
-
- if (hd->scsi_ints & INTS_DISCON)
- hd->scsi_ints = INTS_DISCON;
-
- hd->scsi_pctl = 0;
- hd->scsi_temp = (1 << target) | our_addr;
- /* select timeout is hardcoded to 2ms */
- hd->scsi_tch = 15;
- hd->scsi_tcm = 32;
- hd->scsi_tcl = 4;
-
- hd->scsi_scmd = SCMD_SELECT;
- return (0);
-}
-
-static int
-wait_for_select(hd)
- volatile struct scsidevice *hd;
-{
- u_char ints;
-
- while ((ints = hd->scsi_ints) == 0)
- DELAY(1);
- hd->scsi_ints = ints;
- return (!(hd->scsi_ssts & SSTS_INITIATOR));
-}
-
-static int
-ixfer_start(hd, len, phase, wait)
- volatile struct scsidevice *hd;
- int len;
- u_char phase;
- int wait;
-{
-
- hd->scsi_tch = len >> 16;
- hd->scsi_tcm = len >> 8;
- hd->scsi_tcl = len;
- hd->scsi_pctl = phase;
- hd->scsi_tmod = 0; /*XXX*/
- hd->scsi_scmd = SCMD_XFR | SCMD_PROG_XFR;
-
- /* wait for xfer to start or svc_req interrupt */
- while ((hd->scsi_ssts & SSTS_BUSY) == 0) {
- if (hd->scsi_ints || --wait < 0) {
-#ifdef DEBUG
- if (scsi_debug)
- printf("ixfer_start fail: i%x, w%d\n",
- hd->scsi_ints, wait);
-#endif
- HIST(ixstart_wait, wait)
- return (0);
- }
- DELAY(1);
- }
- HIST(ixstart_wait, wait)
- return (1);
-}
-
-static int
-ixfer_out(hd, len, buf)
- volatile struct scsidevice *hd;
- int len;
- u_char *buf;
-{
- int wait = scsi_data_wait;
-
- for (; len > 0; --len) {
- while (hd->scsi_ssts & SSTS_DREG_FULL) {
- if (hd->scsi_ints || --wait < 0) {
-#ifdef DEBUG
- if (scsi_debug)
- printf("ixfer_out fail: l%d i%x w%d\n",
- len, hd->scsi_ints, wait);
-#endif
- HIST(ixout_wait, wait)
- return (len);
- }
- DELAY(1);
- }
- hd->scsi_dreg = *buf++;
- }
- HIST(ixout_wait, wait)
- return (0);
-}
-
-static void
-ixfer_in(hd, len, buf)
- volatile struct scsidevice *hd;
- int len;
- u_char *buf;
-{
- int wait = scsi_data_wait;
-
- for (; len > 0; --len) {
- while (hd->scsi_ssts & SSTS_DREG_EMPTY) {
- if (hd->scsi_ints || --wait < 0) {
- while (! (hd->scsi_ssts & SSTS_DREG_EMPTY)) {
- *buf++ = hd->scsi_dreg;
- --len;
- }
-#ifdef DEBUG
- if (scsi_debug)
- printf("ixfer_in fail: l%d i%x w%d\n",
- len, hd->scsi_ints, wait);
-#endif
- HIST(ixin_wait, wait)
- return;
- }
- DELAY(1);
- }
- *buf++ = hd->scsi_dreg;
- }
- HIST(ixin_wait, wait)
-}
-
-static int
-mxfer_in(hd, len, buf, phase)
- volatile struct scsidevice *hd;
- int len;
- u_char *buf;
- u_char phase;
-{
- int wait = scsi_cmd_wait;
- int i;
-
- hd->scsi_tmod = 0;
- for (i = 0; i < len; ++i) {
- /*
- * manual sez: reset ATN before ACK is sent.
- */
- if (hd->scsi_psns & PSNS_ATN)
- hd->scsi_scmd = SCMD_RST_ATN;
- /*
- * wait for the request line (which says the target
- * wants to give us data). If the phase changes while
- * we're waiting, we're done.
- */
- while ((hd->scsi_psns & PSNS_REQ) == 0) {
- if (--wait < 0) {
- HIST(mxin_wait, wait)
- return (-1);
- }
- if ((hd->scsi_psns & PHASE) != phase ||
- (hd->scsi_ssts & SSTS_INITIATOR) == 0)
- goto out;
-
- DELAY(1);
- }
- /*
- * set ack (which says we're ready for the data, wait for
- * req to go away (target says data is available), grab the
- * data, then reset ack (say we've got the data).
- */
- hd->scsi_pctl = phase;
- hd->scsi_scmd = SCMD_SET_ACK;
- while (hd->scsi_psns & PSNS_REQ) {
- if (--wait < 0) {
- HIST(mxin_wait, wait)
- return (-2);
- }
- DELAY(1);
- }
- *buf++ = hd->scsi_temp;
- hd->scsi_scmd = SCMD_RST_ACK;
- }
-out:
- HIST(mxin_wait, wait)
- /*
- * Wait for manual transfer to finish.
- * Avoids occasional "unexpected phase" errors in finishxfer
- * formerly addressed by per-slave delays.
- */
- wait = scsi_cmd_wait;
- while ((hd->scsi_ssts & SSTS_ACTIVE) == SSTS_INITIATOR) {
- if (--wait < 0)
- break;
- DELAY(1);
- }
- HIST(mxin2_wait, wait)
- return (i);
-}
-
-/*
- * SCSI 'immediate' command: issue a command to some SCSI device
- * and get back an 'immediate' response (i.e., do programmed xfer
- * to get the response data). 'cbuf' is a buffer containing a scsi
- * command of length clen bytes. 'buf' is a buffer of length 'len'
- * bytes for data. The transfer direction is determined by the device
- * (i.e., by the scsi bus data xfer phase). If 'len' is zero, the
- * command must supply no data. 'xferphase' is the bus phase the
- * caller expects to happen after the command is issued. It should
- * be one of DATA_IN_PHASE, DATA_OUT_PHASE or STATUS_PHASE.
- */
-static int
-scsiicmd(hs, target, cbuf, clen, buf, len, xferphase)
- struct scsi_softc *hs;
- int target;
- u_char *cbuf;
- int clen;
- u_char *buf;
- int len;
- u_char xferphase;
-{
- volatile struct scsidevice *hd = hs->sc_regs;
- u_char phase, ints;
- int wait;
-
- /* select the SCSI bus (it's an error if bus isn't free) */
- if (issue_select(hd, target, hs->sc_scsi_addr))
- return (-1);
- if (wait_for_select(hd))
- return (-1);
- /*
- * Wait for a phase change (or error) then let the device
- * sequence us through the various SCSI phases.
- */
- hs->sc_stat[0] = 0xff;
- hs->sc_msg[0] = 0xff;
- phase = CMD_PHASE;
- while (1) {
- wait = scsi_cmd_wait;
- switch (phase) {
-
- case CMD_PHASE:
- if (ixfer_start(hd, clen, phase, wait))
- if (ixfer_out(hd, clen, cbuf))
- goto abort;
- phase = xferphase;
- break;
-
- case DATA_IN_PHASE:
- if (len <= 0)
- goto abort;
- wait = scsi_data_wait;
- if (ixfer_start(hd, len, phase, wait) ||
- !(hd->scsi_ssts & SSTS_DREG_EMPTY))
- ixfer_in(hd, len, buf);
- phase = STATUS_PHASE;
- break;
-
- case DATA_OUT_PHASE:
- if (len <= 0)
- goto abort;
- wait = scsi_data_wait;
- if (ixfer_start(hd, len, phase, wait)) {
- if (ixfer_out(hd, len, buf))
- goto abort;
- }
- phase = STATUS_PHASE;
- break;
-
- case STATUS_PHASE:
- wait = scsi_data_wait;
- if (ixfer_start(hd, sizeof(hs->sc_stat), phase, wait) ||
- !(hd->scsi_ssts & SSTS_DREG_EMPTY))
- ixfer_in(hd, sizeof(hs->sc_stat), hs->sc_stat);
- phase = MESG_IN_PHASE;
- break;
-
- case MESG_IN_PHASE:
- if (ixfer_start(hd, sizeof(hs->sc_msg), phase, wait) ||
- !(hd->scsi_ssts & SSTS_DREG_EMPTY)) {
- ixfer_in(hd, sizeof(hs->sc_msg), hs->sc_msg);
- hd->scsi_scmd = SCMD_RST_ACK;
- }
- phase = BUS_FREE_PHASE;
- break;
-
- case BUS_FREE_PHASE:
- goto out;
-
- default:
- printf("%s: unexpected phase %d in icmd from %d\n",
- hs->sc_dev.dv_xname, phase, target);
- goto abort;
- }
- /* wait for last command to complete */
- while ((ints = hd->scsi_ints) == 0) {
- if (--wait < 0) {
- HIST(cxin_wait, wait)
- goto abort;
- }
- DELAY(1);
- }
- HIST(cxin_wait, wait)
- hd->scsi_ints = ints;
- if (ints & INTS_SRV_REQ)
- phase = hd->scsi_psns & PHASE;
- else if (ints & INTS_DISCON)
- goto out;
- else if ((ints & INTS_CMD_DONE) == 0) {
- scsierror(hs, hd, ints);
- goto abort;
- }
- }
-abort:
- scsiabort(target, hs, hd, "icmd");
-out:
- return (hs->sc_stat[0]);
-}
-
-/*
- * Finish SCSI xfer command: After the completion interrupt from
- * a read/write operation, sequence through the final phases in
- * programmed i/o. This routine is a lot like scsiicmd except we
- * skip (and don't allow) the select, cmd out and data in/out phases.
- */
-static void
-finishxfer(hs, hd, target)
- struct scsi_softc *hs;
- volatile struct scsidevice *hd;
- int target;
-{
- u_char phase, ints;
-
- /*
- * We specified padding xfer so we ended with either a phase
- * change interrupt (normal case) or an error interrupt (handled
- * elsewhere). Reset the board dma logic then try to get the
- * completion status & command done msg. The reset confuses
- * the SPC REQ/ACK logic so we have to do any status/msg input
- * operations via 'manual xfer'.
- */
- if (hd->scsi_ssts & SSTS_BUSY) {
- int wait = scsi_cmd_wait;
-
- /* wait for dma operation to finish */
- while (hd->scsi_ssts & SSTS_BUSY) {
- if (--wait < 0) {
-#ifdef DEBUG
- if (scsi_debug)
- printf("finishxfer fail: ssts %x\n",
- hd->scsi_ssts);
-#endif
- HIST(fxfr_wait, wait)
- goto abort;
- }
- }
- HIST(fxfr_wait, wait)
- }
- hd->scsi_scmd |= SCMD_PROG_XFR;
- hd->scsi_sctl |= SCTL_CTRLRST;
- DELAY(2);
- hd->scsi_sctl &=~ SCTL_CTRLRST;
- hd->scsi_hconf = 0;
- /*
- * The following delay is definitely needed when trying to
- * write on a write protected disk (in the optical jukebox anyways),
- * but we shall see if other unexplained machine freezeups
- * also stop occuring... A value of 5 seems to work but
- * 10 seems safer considering the potential consequences.
- */
- DELAY(10);
- hs->sc_stat[0] = 0xff;
- hs->sc_msg[0] = 0xff;
- hd->scsi_csr = 0;
- hd->scsi_ints = ints = hd->scsi_ints;
- while (1) {
- phase = hd->scsi_psns & PHASE;
- switch (phase) {
-
- case STATUS_PHASE:
- if (mxfer_in(hd, sizeof(hs->sc_stat),
- (u_char *)hs->sc_stat, phase) <= 0)
- goto abort;
- break;
-
- case MESG_IN_PHASE:
- if (mxfer_in(hd, sizeof(hs->sc_msg),
- (u_char *)hs->sc_msg, phase) < 0)
- goto abort;
- break;
-
- case BUS_FREE_PHASE:
- return;
-
- default:
- printf("%s: unexpected phase %d in finishxfer from %d\n",
- hs->sc_dev.dv_xname, phase, target);
- goto abort;
- }
- if ((ints = hd->scsi_ints)) {
- hd->scsi_ints = ints;
- if (ints & INTS_DISCON)
- return;
- else if (ints & ~(INTS_SRV_REQ|INTS_CMD_DONE)) {
- scsierror(hs, hd, ints);
- break;
- }
- }
- if ((hd->scsi_ssts & SSTS_INITIATOR) == 0)
- return;
- }
-abort:
- scsiabort(target, hs, hd, "finishxfer");
- hs->sc_stat[0] = 0xfe;
-}
-