tc_machdep.h revision 1.5 1 1.5 jonathan /* $NetBSD: tc_machdep.h,v 1.5 1996/10/06 06:29:51 jonathan Exp $ */
2 1.1 jonathan
3 1.1 jonathan /*
4 1.1 jonathan * Copyright (c) 1994, 1995 Carnegie-Mellon University.
5 1.1 jonathan * All rights reserved.
6 1.1 jonathan *
7 1.1 jonathan * Author: Jonathan Stone, Chris G. Demetriou
8 1.1 jonathan *
9 1.1 jonathan * Permission to use, copy, modify and distribute this software and
10 1.1 jonathan * its documentation is hereby granted, provided that both the copyright
11 1.1 jonathan * notice and this permission notice appear in all copies of the
12 1.1 jonathan * software, derivative works or modified versions, and any portions
13 1.1 jonathan * thereof, and that both notices appear in supporting documentation.
14 1.1 jonathan *
15 1.1 jonathan * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 1.1 jonathan * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 1.1 jonathan * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 1.1 jonathan *
19 1.1 jonathan * Carnegie Mellon requests users of this software to return to
20 1.1 jonathan *
21 1.1 jonathan * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
22 1.1 jonathan * School of Computer Science
23 1.1 jonathan * Carnegie Mellon University
24 1.1 jonathan * Pittsburgh PA 15213-3890
25 1.1 jonathan *
26 1.1 jonathan * any improvements or extensions that they make and grant Carnegie the
27 1.1 jonathan * rights to redistribute these changes.
28 1.1 jonathan */
29 1.1 jonathan
30 1.1 jonathan /*
31 1.1 jonathan * Machine-specific definitions for TurboChannel support.
32 1.1 jonathan *
33 1.1 jonathan * This file must typedef the following types:
34 1.1 jonathan *
35 1.1 jonathan * tc_addr_t TurboChannel bus address
36 1.1 jonathan * tc_offset_t TurboChannel bus address difference (offset)
37 1.1 jonathan *
38 1.1 jonathan * This file must prototype or define the following functions
39 1.1 jonathan * or macros (one or more of which may be no-ops):
40 1.1 jonathan *
41 1.1 jonathan * tc_mb() read/write memory barrier (any CPU<->memory
42 1.1 jonathan * reads/writes before must complete before any
43 1.1 jonathan * CPU<->memory reads/writes after).
44 1.1 jonathan * tc_wmb() write memory barrier (any CPU<->memory writes
45 1.1 jonathan * before must complete before any CPU<->memory
46 1.1 jonathan * writes after).
47 1.1 jonathan * tc_syncbus() sync TC bus; make sure CPU writes are
48 1.1 jonathan * propagated across the TurboChannel bus.
49 1.1 jonathan * tc_badaddr() return non-zero if the given address is invalid.
50 1.1 jonathan * TC_DENSE_TO_SPARSE()
51 1.1 jonathan * convert the given physical address in
52 1.1 jonathan * TurboChannel dense space to the corresponding
53 1.1 jonathan * address in TurboChannel sparse space.
54 1.1 jonathan * TC_PHYS_TO_UNCACHED()
55 1.1 jonathan * convert the given system memory physical address
56 1.1 jonathan * to the physical address of the corresponding
57 1.1 jonathan * region that is not cached.
58 1.1 jonathan */
59 1.1 jonathan
60 1.1 jonathan #ifndef __MACHINE_TC_MACHDEP_H__
61 1.1 jonathan #define __MACHINE_TC_MACHDEP_H__
62 1.1 jonathan
63 1.3 jonathan #include <mips/cpuregs.h> /* defines MACH_PHYS_TO_UNCACHED */
64 1.3 jonathan
65 1.1 jonathan typedef int32_t tc_addr_t;
66 1.1 jonathan typedef int32_t tc_offset_t;
67 1.1 jonathan
68 1.1 jonathan #define tc_mb() wbflush()
69 1.1 jonathan #define tc_wmb() wbflush()
70 1.1 jonathan
71 1.1 jonathan /*
72 1.1 jonathan * XXX how to do this on a DECstation ?
73 1.1 jonathan */
74 1.1 jonathan #define tc_syncbus() wbflush();
75 1.1 jonathan
76 1.1 jonathan #define tc_badaddr(tcaddr) \
77 1.1 jonathan badaddr((void *)(tcaddr), sizeof (u_int32_t))
78 1.1 jonathan
79 1.3 jonathan #define TC_DENSE_TO_SPARSE(addr) (addr)
80 1.1 jonathan
81 1.3 jonathan #define TC_PHYS_TO_UNCACHED(addr) MACH_PHYS_TO_UNCACHED(addr)
82 1.2 jonathan
83 1.2 jonathan
84 1.2 jonathan /*
85 1.2 jonathan * Use the following macros to compare device names on a pmax, as
86 1.2 jonathan * the autoconfig structs are in a state of flux.
87 1.2 jonathan */
88 1.2 jonathan struct confargs;
89 1.2 jonathan
90 1.4 mhitch #define TC_BUS_MATCHNAME(ta, name) \
91 1.4 mhitch (strncmp( (ta)->ta_modname, (name), TC_ROM_LLEN+1) == 0)
92 1.3 jonathan
93 1.3 jonathan /*
94 1.3 jonathan * Port-specific declarations:
95 1.3 jonathan * Declarations "private" sys/dev/tc/tc.c MI functions used to search
96 1.3 jonathan * for potential TC-option console devices (framebuffers),
97 1.3 jonathan */
98 1.3 jonathan int tc_checkslot __P((tc_addr_t slotbase, char *namep));
99 1.3 jonathan
100 1.3 jonathan /*
101 1.3 jonathan * And declarations for the MD function used to search for and configure
102 1.3 jonathan * a TC framebuffer as system console, and to configure the TC bus
103 1.3 jonathan * (the last is a hack).
104 1.3 jonathan */
105 1.3 jonathan
106 1.3 jonathan extern int tc_findconsole __P((int preferred_slot));
107 1.3 jonathan extern void config_tcbus __P((struct device *parent, int cputype,
108 1.5 jonathan int printfn __P((void*, const char*)) ));
109 1.3 jonathan
110 1.1 jonathan
111 1.1 jonathan #endif /* __MACHINE_TC_MACHDEP_H__*/
112