xref: /netbsd-src/sys/arch/pmax/include/tc_machdep.h (revision 290a34a0654c1fa44ee7c555fca756322438c03e)
1*290a34a0Smatt /*	$NetBSD: tc_machdep.h,v 1.18 2009/12/14 00:46:10 matt Exp $	*/
2a47c251dSjonathan 
3a47c251dSjonathan /*
4a47c251dSjonathan  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
5a47c251dSjonathan  * All rights reserved.
6a47c251dSjonathan  *
7a47c251dSjonathan  * Author: Jonathan Stone, Chris G. Demetriou
8a47c251dSjonathan  *
9a47c251dSjonathan  * Permission to use, copy, modify and distribute this software and
10a47c251dSjonathan  * its documentation is hereby granted, provided that both the copyright
11a47c251dSjonathan  * notice and this permission notice appear in all copies of the
12a47c251dSjonathan  * software, derivative works or modified versions, and any portions
13a47c251dSjonathan  * thereof, and that both notices appear in supporting documentation.
14a47c251dSjonathan  *
15a47c251dSjonathan  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16a47c251dSjonathan  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17a47c251dSjonathan  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18a47c251dSjonathan  *
19a47c251dSjonathan  * Carnegie Mellon requests users of this software to return to
20a47c251dSjonathan  *
21a47c251dSjonathan  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
22a47c251dSjonathan  *  School of Computer Science
23a47c251dSjonathan  *  Carnegie Mellon University
24a47c251dSjonathan  *  Pittsburgh PA 15213-3890
25a47c251dSjonathan  *
26a47c251dSjonathan  * any improvements or extensions that they make and grant Carnegie the
27a47c251dSjonathan  * rights to redistribute these changes.
28a47c251dSjonathan  */
29a47c251dSjonathan 
30a47c251dSjonathan /*
31ed098090Snisimura  * Machine-specific definitions for TURBOchannel support.
32a47c251dSjonathan  *
33a47c251dSjonathan  * This file must typedef the following types:
34a47c251dSjonathan  *
35ed098090Snisimura  *	tc_addr_t	TURBOchannel bus address
36ed098090Snisimura  *	tc_offset_t	TURBOchannel bus address difference (offset)
37a47c251dSjonathan  *
38a47c251dSjonathan  * This file must prototype or define the following functions
39a47c251dSjonathan  * or macros (one or more of which may be no-ops):
40a47c251dSjonathan  *
41a47c251dSjonathan  *	tc_mb()		read/write memory barrier (any CPU<->memory
42a47c251dSjonathan  *			reads/writes before must complete before any
43a47c251dSjonathan  *			CPU<->memory reads/writes after).
44a47c251dSjonathan  *	tc_wmb()	write memory barrier (any CPU<->memory writes
45a47c251dSjonathan  *			before must complete before any CPU<->memory
46a47c251dSjonathan  *			writes after).
47a47c251dSjonathan  *	tc_syncbus()	sync TC bus; make sure CPU writes are
48ed098090Snisimura  *			propagated across the TURBOchannel bus.
49a47c251dSjonathan  *	tc_badaddr()	return non-zero if the given address is invalid.
50a47c251dSjonathan  *	TC_DENSE_TO_SPARSE()
51a47c251dSjonathan  *			convert the given physical address in
52ed098090Snisimura  *			TURBOchannel dense space to the corresponding
53ed098090Snisimura  *			address in TURBOchannel sparse space.
54a47c251dSjonathan  *	TC_PHYS_TO_UNCACHED()
55a47c251dSjonathan  *			convert the given system memory physical address
56a47c251dSjonathan  *			to the physical address of the corresponding
57a47c251dSjonathan  *			region that is not cached.
58a47c251dSjonathan  */
59a47c251dSjonathan 
60838b5e08Sad #ifndef _PMAX_TC_MACHDEP_H_
61838b5e08Sad #define _PMAX_TC_MACHDEP_H_
62a47c251dSjonathan 
631f449344Sjonathan #include <mips/cpuregs.h>		/* defines MIPS_PHYS_TO_KSEG1 */
644a04d76cSjonathan 
65*290a34a0Smatt typedef paddr_t		tc_addr_t;
66a47c251dSjonathan typedef int32_t		tc_offset_t;
67a47c251dSjonathan 
68a47c251dSjonathan #define	tc_mb()		wbflush()
69a47c251dSjonathan #define	tc_wmb()	wbflush()
70ed098090Snisimura #define	tc_syncbus()	wbflush() /* XXX how to do this on a DECstation ? */
71a47c251dSjonathan 
72*290a34a0Smatt #define	tc_badaddr(tcaddr) badaddr((void *)(tcaddr), sizeof (uint32_t))
73a47c251dSjonathan 
744a04d76cSjonathan #define	TC_DENSE_TO_SPARSE(addr)  (addr)
75a47c251dSjonathan 
761f449344Sjonathan #define	TC_PHYS_TO_UNCACHED(addr) MIPS_PHYS_TO_KSEG1(addr)
77a47c251dSjonathan 
787917bfc6Snisimura /*
797917bfc6Snisimura  * Use the following macros to compare device names on a pmax, as
807917bfc6Snisimura  * the autoconfig structs are in a state of flux.
817917bfc6Snisimura  */
827917bfc6Snisimura #define TC_BUS_MATCHNAME(ta, name) \
837917bfc6Snisimura 		(strncmp( (ta)->ta_modname, (name), TC_ROM_LLEN+1) == 0)
847917bfc6Snisimura 
85582e9de2Snisimura #define KV(x)	((tc_addr_t)MIPS_PHYS_TO_KSEG1(x))
86582e9de2Snisimura #define C(x)	((void *)(u_long)(x))
87fb43e6e1Snisimura 
88838b5e08Sad #endif	/* !_PMAX_TC_MACHDEP_H_ */
89