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