Annotation of sys/arch/luna88k/dev/spc.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: spc.c,v 1.4 2005/04/04 13:09:51 aoyama Exp $ */
2: /* $NetBSD: spc.c,v 1.4 2003/07/05 19:00:17 tsutsui Exp $ */
3:
4: /*-
5: * Copyright (c) 2000 The NetBSD Foundation, Inc.
6: * All rights reserved.
7: *
8: * This code is derived from software contributed to The NetBSD Foundation
9: * by Tohru Nishimura.
10: *
11: * Redistribution and use in source and binary forms, with or without
12: * modification, are permitted provided that the following conditions
13: * are met:
14: * 1. Redistributions of source code must retain the above copyright
15: * notice, this list of conditions and the following disclaimer.
16: * 2. Redistributions in binary form must reproduce the above copyright
17: * notice, this list of conditions and the following disclaimer in the
18: * documentation and/or other materials provided with the distribution.
19: * 3. All advertising materials mentioning features or use of this software
20: * must display the following acknowledgement:
21: * This product includes software developed by the NetBSD
22: * Foundation, Inc. and its contributors.
23: * 4. Neither the name of The NetBSD Foundation nor the names of its
24: * contributors may be used to endorse or promote products derived
25: * from this software without specific prior written permission.
26: *
27: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37: * POSSIBILITY OF SUCH DAMAGE.
38: */
39:
40: #include <sys/param.h>
41: #include <sys/systm.h>
42: #include <sys/device.h>
43: #include <sys/buf.h>
44:
45: #include <machine/bus.h>
46: #include <machine/cpu.h>
47: #include <machine/autoconf.h>
48:
49: #include <scsi/scsi_all.h>
50: #include <scsi/scsi_message.h>
51: #include <scsi/scsiconf.h>
52:
53: #include <luna88k/dev/mb89352reg.h>
54: #include <luna88k/dev/mb89352var.h>
55:
56: #include <luna88k/luna88k/isr.h>
57:
58: int spc_mainbus_match(struct device *, void *, void *);
59: void spc_mainbus_attach(struct device *, struct device *, void *);
60:
61: struct cfattach spc_ca = {
62: sizeof(struct spc_softc), spc_mainbus_match, spc_mainbus_attach
63: };
64:
65: struct cfdriver spc_cd = {
66: NULL, "spc", DV_DULL
67: };
68:
69: struct scsi_adapter spc_switch = {
70: spc_scsi_cmd,
71: minphys, /* no max at this level; handled by DMA code */
72: NULL,
73: NULL,
74: };
75:
76: /* bus space tag for spc */
77: struct luna88k_bus_space_tag spc_bst = {
78: 4, /* when reading/writing 1 byte, the stride is 4. */
79: 0, /* not used */
80: 0, /* not used */
81: 0, /* not used */
82: };
83:
84: int
85: spc_mainbus_match(parent, cf, aux)
86: struct device *parent;
87: void *cf, *aux;
88: {
89: struct mainbus_attach_args *ma = aux;
90:
91: if (strcmp(ma->ma_name, spc_cd.cd_name))
92: return 0;
93: #if 0
94: if (badaddr((caddr_t)ma->ma_addr, 4))
95: return 0;
96: /* Experiments proved 2nd SPC address does NOT make a buserror. */
97: #endif
98: return 1;
99: }
100:
101: void
102: spc_mainbus_attach(parent, self, aux)
103: struct device *parent, *self;
104: void *aux;
105: {
106: struct spc_softc *sc = (void *)self;
107: struct mainbus_attach_args *ma = aux;
108:
109: printf ("\n");
110:
111: sc->sc_iot = &spc_bst;
112: sc->sc_ioh = ma->ma_addr;
113: sc->sc_initiator = 7;
114: sc->sc_dma_start = NULL;
115: sc->sc_dma_done = NULL;
116:
117: isrlink_autovec(spc_intr, (void *)sc, ma->ma_ilvl, ISRPRI_BIO,
118: self->dv_xname);
119:
120: spc_attach(sc, &spc_switch);
121: }
CVSweb