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