Home | History | Annotate | Line # | Download | only in include
tc_machdep.h revision 1.14
      1  1.14    simonb /* $NetBSD: tc_machdep.h,v 1.14 2000/01/08 01:02:38 simonb 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.12  nisimura #define	tc_badaddr(tcaddr) badaddr((void *)(tcaddr), sizeof (u_int32_t))
     73   1.1  jonathan 
     74   1.3  jonathan #define	TC_DENSE_TO_SPARSE(addr)  (addr)
     75  1.11    simonb 
     76   1.7  jonathan #define	TC_PHYS_TO_UNCACHED(addr) MIPS_PHYS_TO_KSEG1(addr)
     77  1.13  nisimura 
     78  1.13  nisimura /*
     79  1.13  nisimura  * Use the following macros to compare device names on a pmax, as
     80  1.13  nisimura  * the autoconfig structs are in a state of flux.
     81  1.13  nisimura  */
     82  1.13  nisimura #define TC_BUS_MATCHNAME(ta, name) \
     83  1.13  nisimura 		(strncmp( (ta)->ta_modname, (name), TC_ROM_LLEN+1) == 0)
     84   1.2  jonathan 
     85  1.14    simonb int	badaddr __P((void *, u_int));
     86   1.2  jonathan 
     87  1.12  nisimura #define TC_KV(x) ((tc_addr_t)MIPS_PHYS_TO_KSEG1(x))
     88  1.12  nisimura #define TC_C(x)	 ((void *)(u_long)(x))
     89   1.1  jonathan 
     90   1.1  jonathan #endif /* __MACHINE_TC_MACHDEP_H__*/
     91