xref: /netbsd-src/sys/dev/sbus/qecvar.h (revision 6d160c79192c0b7e3f2faba2c055e25bfd3027db)
1*6d160c79Stsutsui /*	$NetBSD: qecvar.h,v 1.14 2009/09/19 04:48:18 tsutsui Exp $	*/
23252d462Spk 
33252d462Spk /*-
43252d462Spk  * Copyright (c) 1998 The NetBSD Foundation, Inc.
53252d462Spk  * All rights reserved.
63252d462Spk  *
73252d462Spk  * This code is derived from software contributed to The NetBSD Foundation
83252d462Spk  * by Paul Kranenburg.
93252d462Spk  *
103252d462Spk  * Redistribution and use in source and binary forms, with or without
113252d462Spk  * modification, are permitted provided that the following conditions
123252d462Spk  * are met:
133252d462Spk  * 1. Redistributions of source code must retain the above copyright
143252d462Spk  *    notice, this list of conditions and the following disclaimer.
153252d462Spk  * 2. Redistributions in binary form must reproduce the above copyright
163252d462Spk  *    notice, this list of conditions and the following disclaimer in the
173252d462Spk  *    documentation and/or other materials provided with the distribution.
183252d462Spk  *
193252d462Spk  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
203252d462Spk  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
213252d462Spk  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
223252d462Spk  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
233252d462Spk  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
243252d462Spk  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
253252d462Spk  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
263252d462Spk  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
273252d462Spk  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
283252d462Spk  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
293252d462Spk  * POSSIBILITY OF SUCH DAMAGE.
303252d462Spk  */
313252d462Spk 
323252d462Spk struct qec_softc {
33*6d160c79Stsutsui 	device_t sc_dev;		/* us as a device */
341ffa7b76Swiz 	bus_space_tag_t	sc_bustag;	/* bus & DMA tags */
353252d462Spk 	bus_dma_tag_t	sc_dmatag;
3690817e31Sthorpej 	struct	openprom_intr *sc_intr;	/* interrupt info */
373252d462Spk 
38c830c88dSpk 	bus_space_handle_t sc_regs;	/* QEC registers */
39c830c88dSpk 	int	sc_nchannels;		/* # of channels on board */
403252d462Spk 	int	sc_burst;		/* DVMA burst size in effect */
4153524e44Schristos 	void *	sc_buffer;		/* VA of the buffer we provide */
423252d462Spk 	int	sc_bufsiz;		/* Size of buffer */
43c830c88dSpk 
44c830c88dSpk 	u_int	sc_msize;		/* QEC buffer offset per channel */
45c830c88dSpk 	u_int	sc_rsize;		/* QEC buffer size for receive */
463252d462Spk };
47fb846bdeSpk 
48fb846bdeSpk struct qec_ring {
49fb846bdeSpk 	/* Ring Descriptors */
5053524e44Schristos 	void *		rb_membase;	/* Packet buffer: CPU address */
51fb846bdeSpk 	bus_addr_t	rb_dmabase;	/* Packet buffer: DMA address */
52fb846bdeSpk 	struct	qec_xd	*rb_txd;	/* Transmit descriptors */
53fb846bdeSpk 	bus_addr_t	rb_txddma;	/* DMA address of same */
54fb846bdeSpk 	struct	qec_xd	*rb_rxd;	/* Receive descriptors */
55fb846bdeSpk 	bus_addr_t	rb_rxddma;	/* DMA address of same */
5601a44458Stsutsui 	uint8_t		*rb_txbuf;	/* Transmit buffers */
5701a44458Stsutsui 	uint8_t		*rb_rxbuf;	/* Receive buffers */
58fb846bdeSpk 	int		rb_ntbuf;	/* # of transmit buffers */
59fb846bdeSpk 	int		rb_nrbuf;	/* # of receive buffers */
60fb846bdeSpk 
61fb846bdeSpk 	/* Ring Descriptor state */
62fb846bdeSpk 	int	rb_tdhead, rb_tdtail;
63fb846bdeSpk 	int	rb_rdtail;
64fb846bdeSpk 	int	rb_td_nbusy;
65fb846bdeSpk };
66fb846bdeSpk 
6718db93c7Sperry void	qec_meminit(struct qec_ring *, unsigned int);
68