2 * Copyright (c) 2006 Michael Lorenz
3 * Copyright (c) 2008 Nathan Whitehorn
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of The NetBSD Foundation nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
34 #ifndef _POWERPC_CUDAVAR_H_
35 #define _POWERPC_CUDAVAR_H_
37 #define CUDA_DEVSTR "Apple CUDA I/O Controller"
38 #define CUDA_MAXPACKETS 10
43 #define CUDA_ERROR 2 /* error codes? */
46 #define CUDA_IIC 5 /* XXX ??? */
48 #define CUDA_ADB_QUERY 7
51 #define CMD_AUTOPOLL 1
52 #define CMD_READ_RTC 3
53 #define CMD_WRITE_RTC 9
54 #define CMD_POWEROFF 10
58 /* Cuda state codes */
59 #define CUDA_NOTREADY 0x1 /* has not been initialized yet */
60 #define CUDA_IDLE 0x2 /* the bus is currently idle */
61 #define CUDA_OUT 0x3 /* sending out a command */
62 #define CUDA_IN 0x4 /* receiving data */
63 #define CUDA_POLLING 0x5 /* polling - II only */
70 STAILQ_ENTRY(cuda_packet) pkt_q;
73 STAILQ_HEAD(cuda_pktq, cuda_packet);
78 struct resource *sc_memr;
80 struct resource *sc_irq;
88 volatile int sc_state;
92 volatile int sc_autopoll;
97 /* internal buffers */
104 struct cuda_packet sc_pkts[CUDA_MAXPACKETS];
105 struct cuda_pktq sc_inq;
106 struct cuda_pktq sc_outq;
107 struct cuda_pktq sc_freeq;
110 #endif /* _POWERPC_CUDAVAR_H_ */