xref: /netbsd-src/sys/arch/vax/include/tc_machdep.h (revision dfba816635b288ffc525cb86146857ef1a9333c3)
1*dfba8166Smatt /*	$NetBSD: tc_machdep.h,v 1.3 2008/03/11 05:34:02 matt Exp $	*/
2f6c632dbSmatt 
3f6c632dbSmatt /*
4f6c632dbSmatt  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
5f6c632dbSmatt  * All rights reserved.
6f6c632dbSmatt  *
7f6c632dbSmatt  * Author: Jonathan Stone, Chris G. Demetriou
8f6c632dbSmatt  *
9f6c632dbSmatt  * Permission to use, copy, modify and distribute this software and
10f6c632dbSmatt  * its documentation is hereby granted, provided that both the copyright
11f6c632dbSmatt  * notice and this permission notice appear in all copies of the
12f6c632dbSmatt  * software, derivative works or modified versions, and any portions
13f6c632dbSmatt  * thereof, and that both notices appear in supporting documentation.
14f6c632dbSmatt  *
15f6c632dbSmatt  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16f6c632dbSmatt  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17f6c632dbSmatt  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18f6c632dbSmatt  *
19f6c632dbSmatt  * Carnegie Mellon requests users of this software to return to
20f6c632dbSmatt  *
21f6c632dbSmatt  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
22f6c632dbSmatt  *  School of Computer Science
23f6c632dbSmatt  *  Carnegie Mellon University
24f6c632dbSmatt  *  Pittsburgh PA 15213-3890
25f6c632dbSmatt  *
26f6c632dbSmatt  * any improvements or extensions that they make and grant Carnegie the
27f6c632dbSmatt  * rights to redistribute these changes.
28f6c632dbSmatt  */
29f6c632dbSmatt 
30f6c632dbSmatt /*
31f6c632dbSmatt  * Machine-specific definitions for TURBOchannel support.
32f6c632dbSmatt  *
33f6c632dbSmatt  * This file must typedef the following types:
34f6c632dbSmatt  *
35f6c632dbSmatt  *	tc_addr_t	TURBOchannel bus address
36f6c632dbSmatt  *	tc_offset_t	TURBOchannel bus address difference (offset)
37f6c632dbSmatt  *
38f6c632dbSmatt  * This file must prototype or define the following functions
39f6c632dbSmatt  * or macros (one or more of which may be no-ops):
40f6c632dbSmatt  *
41f6c632dbSmatt  *	tc_mb()		read/write memory barrier (any CPU<->memory
42f6c632dbSmatt  *			reads/writes before must complete before any
43f6c632dbSmatt  *			CPU<->memory reads/writes after).
44f6c632dbSmatt  *	tc_wmb()	write memory barrier (any CPU<->memory writes
45f6c632dbSmatt  *			before must complete before any CPU<->memory
46f6c632dbSmatt  *			writes after).
47f6c632dbSmatt  *	tc_syncbus()	sync TC bus; make sure CPU writes are
48f6c632dbSmatt  *			propagated across the TURBOchannel bus.
49f6c632dbSmatt  *	tc_badaddr()	return non-zero if the given address is invalid.
50f6c632dbSmatt  *	TC_DENSE_TO_SPARSE()
51f6c632dbSmatt  *			convert the given physical address in
52f6c632dbSmatt  *			TURBOchannel dense space to the corresponding
53f6c632dbSmatt  *			address in TURBOchannel sparse space.
54f6c632dbSmatt  *	TC_PHYS_TO_UNCACHED()
55f6c632dbSmatt  *			convert the given system memory physical address
56f6c632dbSmatt  *			to the physical address of the corresponding
57f6c632dbSmatt  *			region that is not cached.
58f6c632dbSmatt  */
59f6c632dbSmatt 
60f6c632dbSmatt #ifndef _VAX_TC_MACHDEP_H_
61f6c632dbSmatt #define _VAX_TC_MACHDEP_H_
62f6c632dbSmatt 
63c905608aSmatt #include <machine/cpu.h>		/* for badaddr */
64c905608aSmatt 
65f6c632dbSmatt typedef uint32_t	tc_addr_t;
66f6c632dbSmatt typedef uint32_t	tc_offset_t;
67f6c632dbSmatt 
68f6c632dbSmatt #define	tc_mb()		do { } while (/*CONSTCOND*/ 0)
69f6c632dbSmatt #define	tc_wmb()	do { } while (/*CONSTCOND*/ 0)
70f6c632dbSmatt #define	tc_syncbus()	do { } while (/*CONSTCOND*/ 0)
71f6c632dbSmatt 
72f6c632dbSmatt #define	tc_badaddr(tcaddr) badaddr((void *)(tcaddr), sizeof (uint32_t))
73f6c632dbSmatt 
74f6c632dbSmatt #define	TC_DENSE_TO_SPARSE(addr)  (addr)
75f6c632dbSmatt #define	TC_PHYS_TO_UNCACHED(addr) (addr)
76*dfba8166Smatt #define	VAX_PHYS_TO_S0(addr)	  ((addr) | KERNBASE)
77f6c632dbSmatt 
78f6c632dbSmatt /*
79f6c632dbSmatt  * Use the following macros to compare device names on a vax, as
80f6c632dbSmatt  * the autoconfig structs are in a state of flux.
81f6c632dbSmatt  */
82f6c632dbSmatt #define TC_BUS_MATCHNAME(ta, name) \
83f6c632dbSmatt 	(strncmp( (ta)->ta_modname, (name), TC_ROM_LLEN+1) == 0)
84f6c632dbSmatt 
85f6c632dbSmatt #endif /* _VAX_TC_MACHDEP_H_ */
86