Home | History | Annotate | Line # | Download | only in include
tc_machdep.h revision 1.10.4.1
      1  1.10.4.1   thorpej /*	$NetBSD: tc_machdep.h,v 1.10.4.1 1999/06/21 00:58:58 thorpej 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.10  nisimura  * 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.10  nisimura  *	tc_addr_t	TURBOchannel bus address
     36      1.10  nisimura  *	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.10  nisimura  *			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.10  nisimura  *			TURBOchannel dense space to the corresponding
     53      1.10  nisimura  *			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.7  jonathan #include <mips/cpuregs.h>		/* defines MIPS_PHYS_TO_KSEG1 */
     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.10  nisimura #define	tc_syncbus()	wbflush() /* XXX how to do this on a DECstation ? */
     71       1.1  jonathan 
     72       1.1  jonathan #define	tc_badaddr(tcaddr)						\
     73       1.1  jonathan     badaddr((void *)(tcaddr), sizeof (u_int32_t))
     74       1.1  jonathan 
     75       1.3  jonathan #define	TC_DENSE_TO_SPARSE(addr)  (addr)
     76  1.10.4.1   thorpej 
     77       1.7  jonathan #define	TC_PHYS_TO_UNCACHED(addr) MIPS_PHYS_TO_KSEG1(addr)
     78       1.2  jonathan 
     79       1.2  jonathan 
     80       1.2  jonathan /*
     81       1.2  jonathan  * Use the following macros to compare device names on a pmax, as
     82       1.2  jonathan  * the autoconfig structs are in a state of flux.
     83       1.2  jonathan  */
     84       1.4    mhitch #define TC_BUS_MATCHNAME(ta, name) \
     85       1.4    mhitch      (strncmp( (ta)->ta_modname, (name), TC_ROM_LLEN+1) == 0)
     86       1.3  jonathan 
     87       1.3  jonathan /*
     88       1.3  jonathan  * Port-specific declarations:
     89       1.3  jonathan  * Declarations "private" sys/dev/tc/tc.c MI functions used to search
     90       1.3  jonathan  * for potential TC-option console devices (framebuffers),
     91       1.3  jonathan  */
     92       1.3  jonathan int tc_checkslot __P((tc_addr_t slotbase, char *namep));
     93       1.3  jonathan 
     94       1.3  jonathan /*
     95       1.3  jonathan  * And declarations for the MD function used to search for and configure
     96      1.10  nisimura  * a TC framebuffer as system console, and to configure the TC bus
     97       1.3  jonathan  * (the last is a hack).
     98       1.3  jonathan  */
     99       1.3  jonathan 
    100      1.10  nisimura extern int badaddr	 __P((void *, u_int));
    101       1.3  jonathan extern void config_tcbus __P((struct device *parent, int cputype,
    102       1.5  jonathan 			      int printfn __P((void*, const char*)) ));
    103      1.10  nisimura extern int tc_findconsole __P((int preferred_slot));
    104       1.1  jonathan 
    105       1.8  jonathan #define TC_KV(x)  ((tc_addr_t)MIPS_PHYS_TO_KSEG1(x))
    106       1.8  jonathan #define TC_C(x)	((void *)(u_long)x)
    107       1.1  jonathan #endif /* __MACHINE_TC_MACHDEP_H__*/
    108