xref: /netbsd-src/sys/arch/sparc/include/z8530var.h (revision 9aff02ebc19c4d76f46e13ff321fe3746fbed2ca)
1*9aff02ebSdyoung /*	$NetBSD: z8530var.h,v 1.11 2011/07/01 21:00:57 dyoung Exp $	*/
20308bf1aSgwr 
30308bf1aSgwr /*
40308bf1aSgwr  * Copyright (c) 1992, 1993
50308bf1aSgwr  *	The Regents of the University of California.  All rights reserved.
60308bf1aSgwr  *
70308bf1aSgwr  * This software was developed by the Computer Systems Engineering group
80308bf1aSgwr  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
90308bf1aSgwr  * contributed to Berkeley.
100308bf1aSgwr  *
110308bf1aSgwr  * All advertising materials mentioning features or use of this software
120308bf1aSgwr  * must display the following acknowledgement:
130308bf1aSgwr  *	This product includes software developed by the University of
140308bf1aSgwr  *	California, Lawrence Berkeley Laboratory.
150308bf1aSgwr  *
160308bf1aSgwr  * Redistribution and use in source and binary forms, with or without
170308bf1aSgwr  * modification, are permitted provided that the following conditions
180308bf1aSgwr  * are met:
190308bf1aSgwr  * 1. Redistributions of source code must retain the above copyright
200308bf1aSgwr  *    notice, this list of conditions and the following disclaimer.
210308bf1aSgwr  * 2. Redistributions in binary form must reproduce the above copyright
220308bf1aSgwr  *    notice, this list of conditions and the following disclaimer in the
230308bf1aSgwr  *    documentation and/or other materials provided with the distribution.
24aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
250308bf1aSgwr  *    may be used to endorse or promote products derived from this software
260308bf1aSgwr  *    without specific prior written permission.
270308bf1aSgwr  *
280308bf1aSgwr  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
290308bf1aSgwr  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
300308bf1aSgwr  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
310308bf1aSgwr  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
320308bf1aSgwr  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
330308bf1aSgwr  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
340308bf1aSgwr  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
350308bf1aSgwr  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
360308bf1aSgwr  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
370308bf1aSgwr  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
380308bf1aSgwr  * SUCH DAMAGE.
390308bf1aSgwr  *
400308bf1aSgwr  *	@(#)zsvar.h	8.1 (Berkeley) 6/11/93
410308bf1aSgwr  */
420308bf1aSgwr 
43*9aff02ebSdyoung #include <sys/bus.h>
440308bf1aSgwr #include <dev/ic/z8530sc.h>
450308bf1aSgwr 
460308bf1aSgwr struct zsc_softc {
4702cb47caStsutsui 	device_t		zsc_dev;	/* base device */
481ffa7b76Swiz 	bus_space_tag_t		zsc_bustag;	/* bus space/DMA tags */
4961365a8bSpk 	bus_dma_tag_t		zsc_dmatag;
500308bf1aSgwr 	struct zs_chanstate	*zsc_cs[2];	/* channel A and B soft state */
5161365a8bSpk 
520308bf1aSgwr 	/* Machine-dependent part follows... */
53b0eba375Spk 	int			zsc_promunit;	/* PROM's view of zs devices */
54b0eba375Spk 	int			zsc_node;	/* PROM node, if any */
550308bf1aSgwr 	struct evcnt		zsc_intrcnt;	/* count interrupts */
560308bf1aSgwr 	struct zs_chanstate	zsc_cs_store[2];
57e193fab2Stsutsui 	void			*zsc_sicookie;	/* softint(9) cookie */
580308bf1aSgwr };
590308bf1aSgwr 
600308bf1aSgwr /*
610308bf1aSgwr  * Functions to read and write individual registers in a channel.
620308bf1aSgwr  * The ZS chip requires a 1.6 uSec. recovery time between accesses.
630308bf1aSgwr  * On the SparcStation the recovery time is handled in hardware.
640308bf1aSgwr  * On the older Sun4 machine it isn't, and software must do it.
650308bf1aSgwr  *
660308bf1aSgwr  * However, it *is* a problem on some Sun4m's (i.e. the SS20) (XXX: why?).
670308bf1aSgwr  * Thus we leave in the delay (done in the functions below).
680308bf1aSgwr  * XXX: (ABB) Think about this more.
690308bf1aSgwr  *
700308bf1aSgwr  * The functions below could be macros instead if we are concerned
710308bf1aSgwr  * about the function call overhead where ZS_DELAY does nothing.
720308bf1aSgwr  */
730308bf1aSgwr 
7402cb47caStsutsui uint8_t zs_read_reg(struct zs_chanstate *cs, uint8_t reg);
7502cb47caStsutsui uint8_t zs_read_csr(struct zs_chanstate *cs);
7602cb47caStsutsui uint8_t zs_read_data(struct zs_chanstate *cs);
770308bf1aSgwr 
7802cb47caStsutsui void  zs_write_reg(struct zs_chanstate *cs, uint8_t reg, uint8_t val);
7902cb47caStsutsui void  zs_write_csr(struct zs_chanstate *cs, uint8_t val);
8002cb47caStsutsui void  zs_write_data(struct zs_chanstate *cs, uint8_t val);
810308bf1aSgwr 
820308bf1aSgwr /* The sparc has splzs() in psl.h */
830308bf1aSgwr 
840308bf1aSgwr /* We want to call it "zs" instead of "zsc" (sigh). */
850308bf1aSgwr #ifndef ZSCCF_CHANNEL
860308bf1aSgwr #define ZSCCF_CHANNEL 0
870308bf1aSgwr #define ZSCCF_CHANNEL_DEFAULT -1
880308bf1aSgwr #endif
89b0263218Schs 
90b0263218Schs #undef cn_trap
91b0263218Schs #define cn_trap() zs_abort(NULL)
92