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