/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 2006 Michael Lorenz4* Copyright (c) 2008 Nathan Whitehorn5* All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15* 3. Neither the name of The NetBSD Foundation nor the names of its16* contributors may be used to endorse or promote products derived17* from this software without specific prior written permission.18*19* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS20* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED21* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR22* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS23* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR24* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF25* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS26* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN27* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)28* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE29* POSSIBILITY OF SUCH DAMAGE.30*31*/3233#ifndef _POWERPC_CUDAVAR_H_34#define _POWERPC_CUDAVAR_H_3536#define CUDA_DEVSTR "Apple CUDA I/O Controller"37#define CUDA_MAXPACKETS 103839/* Cuda addresses */40#define CUDA_ADB 041#define CUDA_PSEUDO 142#define CUDA_ERROR 2 /* error codes? */43#define CUDA_TIMER 344#define CUDA_POWER 445#define CUDA_IIC 5 /* XXX ??? */46#define CUDA_PMU 647#define CUDA_ADB_QUERY 74849/* Cuda commands */50#define CMD_AUTOPOLL 151#define CMD_READ_RTC 352#define CMD_WRITE_RTC 953#define CMD_POWEROFF 1054#define CMD_RESET 1755#define CMD_IIC 345657/* Cuda state codes */58#define CUDA_NOTREADY 0x1 /* has not been initialized yet */59#define CUDA_IDLE 0x2 /* the bus is currently idle */60#define CUDA_OUT 0x3 /* sending out a command */61#define CUDA_IN 0x4 /* receiving data */62#define CUDA_POLLING 0x5 /* polling - II only */6364struct cuda_packet {65uint8_t len;66uint8_t type;6768uint8_t data[253];69STAILQ_ENTRY(cuda_packet) pkt_q;70};7172STAILQ_HEAD(cuda_pktq, cuda_packet);7374struct cuda_softc {75device_t sc_dev;76int sc_memrid;77struct resource *sc_memr;78int sc_irqrid;79struct resource *sc_irq;80void *sc_ih;8182struct mtx sc_mutex;8384device_t adb_bus;8586int sc_node;87volatile int sc_state;88int sc_waiting;89int sc_polling;90int sc_iic_done;91volatile int sc_autopoll;92uint32_t sc_rtc;9394int sc_i2c_read_len;9596/* internal buffers */97uint8_t sc_in[256];98uint8_t sc_out[256];99int sc_sent;100int sc_out_length;101int sc_received;102103struct cuda_packet sc_pkts[CUDA_MAXPACKETS];104struct cuda_pktq sc_inq;105struct cuda_pktq sc_outq;106struct cuda_pktq sc_freeq;107};108109#endif /* _POWERPC_CUDAVAR_H_ */110111112