Home | History | Annotate | Line # | Download | only in tx
tx39var.h revision 1.8.4.1
      1  1.8.4.1  nathanw /*	$NetBSD: tx39var.h,v 1.8.4.1 2001/06/21 19:24:36 nathanw Exp $ */
      2      1.1      uch 
      3      1.6      uch /*-
      4      1.7      uch  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
      5      1.7      uch  * All rights reserved.
      6      1.7      uch  *
      7      1.7      uch  * This code is derived from software contributed to The NetBSD Foundation
      8      1.7      uch  * by UCHIYAMA Yasushi.
      9      1.1      uch  *
     10      1.1      uch  * Redistribution and use in source and binary forms, with or without
     11      1.1      uch  * modification, are permitted provided that the following conditions
     12      1.1      uch  * are met:
     13      1.1      uch  * 1. Redistributions of source code must retain the above copyright
     14      1.1      uch  *    notice, this list of conditions and the following disclaimer.
     15      1.6      uch  * 2. Redistributions in binary form must reproduce the above copyright
     16      1.6      uch  *    notice, this list of conditions and the following disclaimer in the
     17      1.6      uch  *    documentation and/or other materials provided with the distribution.
     18      1.7      uch  * 3. All advertising materials mentioning features or use of this software
     19      1.7      uch  *    must display the following acknowledgement:
     20      1.7      uch  *        This product includes software developed by the NetBSD
     21      1.7      uch  *        Foundation, Inc. and its contributors.
     22      1.7      uch  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23      1.7      uch  *    contributors may be used to endorse or promote products derived
     24      1.7      uch  *    from this software without specific prior written permission.
     25      1.1      uch  *
     26      1.7      uch  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27      1.7      uch  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28      1.7      uch  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29      1.7      uch  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30      1.7      uch  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31      1.7      uch  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32      1.7      uch  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33      1.7      uch  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34      1.7      uch  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35      1.7      uch  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36      1.7      uch  * POSSIBILITY OF SUCH DAMAGE.
     37      1.1      uch  */
     38      1.2      uch 
     39      1.8      uch enum tx_chipset {
     40      1.8      uch 	__TX391X,
     41      1.8      uch 	__TX392X,
     42      1.8      uch };
     43      1.8      uch 
     44      1.8      uch /* attach priority of TX-internal modules. */
     45      1.8      uch enum tx_attach_order {
     46      1.8      uch 	ATTACH_FIRST	= 3,
     47      1.8      uch 	ATTACH_NORMAL	= 2,
     48      1.8      uch 	ATTACH_LAST	= 1,
     49      1.8      uch };
     50      1.8      uch 
     51      1.8      uch /* unified I/O manager */
     52      1.8      uch enum txio_group {
     53      1.8      uch 	MFIO = 0,
     54      1.8      uch 	IO,
     55      1.8      uch 	BETTY,
     56      1.8      uch 	SNOWBALL,
     57      1.8      uch 	PLUM,
     58      1.8      uch 	NTXIO_GROUP
     59      1.8      uch };
     60      1.8      uch 
     61  1.8.4.1  nathanw struct hpcio_chip;
     62      1.8      uch 
     63      1.1      uch struct tx_chipset_tag {
     64      1.8      uch 	enum tx_chipset tc_chipset;
     65      1.1      uch 	void *tc_intrt;  /* interrupt tag */
     66      1.3      uch 	void *tc_powert; /* power tag */
     67      1.3      uch 	void *tc_clockt; /* clock/timer tag */
     68      1.4      uch 	void *tc_soundt; /* sound tag */
     69  1.8.4.1  nathanw 	struct hpcio_chip *tc_iochip[NTXIO_GROUP];
     70      1.6      uch 	void *tc_videot; /* video chip tag */
     71      1.1      uch };
     72      1.1      uch 
     73      1.8      uch typedef struct tx_chipset_tag* tx_chipset_tag_t __attribute__((__unused__));
     74      1.1      uch typedef u_int32_t txreg_t;
     75      1.8      uch extern struct tx_chipset_tag tx_chipset;
     76      1.8      uch #define tx_conf_get_tag() (&tx_chipset)
     77      1.8      uch 
     78      1.8      uch #if defined TX391X && defined TX392X
     79      1.8      uch #define IS_TX391X(t)	((t)->tc_chipset == __TX391X)
     80      1.8      uch #define IS_TX392X(t)	((t)->tc_chipset == __TX392X)
     81      1.8      uch #elif defined TX391X
     82      1.8      uch #define IS_TX391X(t)	(1)
     83      1.8      uch #define IS_TX392X(t)	(0)
     84      1.8      uch #elif defined TX392X
     85      1.8      uch #define IS_TX391X(t)	(0)
     86      1.8      uch #define IS_TX392X(t)	(1)
     87      1.8      uch #endif
     88      1.1      uch 
     89      1.7      uch void	tx_conf_register_intr(tx_chipset_tag_t, void *);
     90      1.7      uch void	tx_conf_register_power(tx_chipset_tag_t, void *);
     91      1.7      uch void	tx_conf_register_clock(tx_chipset_tag_t, void *);
     92      1.7      uch void	tx_conf_register_sound(tx_chipset_tag_t, void *);
     93  1.8.4.1  nathanw void	tx_conf_register_ioman(tx_chipset_tag_t, struct hpcio_chip *);
     94      1.7      uch void	tx_conf_register_video(tx_chipset_tag_t, void *);
     95      1.8      uch 
     96      1.1      uch /*
     97      1.1      uch  *	TX39 Internal Function Register access
     98      1.1      uch  */
     99      1.1      uch #define TX39_SYSADDR_CONFIG_REG_KSEG1	0xb0c00000
    100      1.8      uch #define tx_conf_read(t, reg) (						\
    101      1.7      uch 	(*((volatile txreg_t *)(TX39_SYSADDR_CONFIG_REG_KSEG1 + (reg)))))
    102      1.8      uch #define tx_conf_write(t, reg, val) (					\
    103      1.7      uch 	(*((volatile txreg_t *)(TX39_SYSADDR_CONFIG_REG_KSEG1 + (reg))) \
    104      1.2      uch 	= (val)))
    105      1.1      uch 
    106      1.1      uch /*
    107      1.1      uch  *	txsim attach arguments. (txsim ... TX System Internal Module)
    108      1.1      uch  */
    109      1.1      uch struct txsimbus_attach_args {
    110      1.1      uch 	char *tba_busname;
    111      1.1      uch };
    112      1.1      uch 
    113      1.1      uch /*
    114      1.1      uch  *	txsim module attach arguments.
    115      1.1      uch  */
    116      1.1      uch struct txsim_attach_args {
    117      1.1      uch 	tx_chipset_tag_t ta_tc; /* Chipset tag */
    118      1.1      uch };
    119      1.1      uch 
    120      1.1      uch /*
    121      1.1      uch  *	Interrupt staff
    122      1.1      uch  */
    123      1.7      uch #define MAKEINTR(s, b)	((s) * 32 + (ffs(b) - 1))
    124      1.7      uch void*	tx_intr_establish(tx_chipset_tag_t, int, int, int, int (*)(void *),
    125      1.7      uch 			  void *);
    126      1.7      uch void	tx_intr_disestablish(tx_chipset_tag_t, void *);
    127      1.3      uch 
    128      1.1      uch #ifdef USE_POLL
    129      1.7      uch void*	tx39_poll_establish(tx_chipset_tag_t, int, int, int (*)(void *),
    130      1.7      uch 			    void *);
    131      1.7      uch void	tx39_poll_disestablish(tx_chipset_tag_t, void *);
    132      1.3      uch #define POLL_CONT	0
    133      1.3      uch #define POLL_END	1
    134      1.1      uch #endif /* USE_POLL */
    135      1.1      uch 
    136      1.7      uch u_int32_t tx_intr_status(tx_chipset_tag_t, int);
    137      1.5      uch extern u_int32_t tx39intrvec;
    138      1.5      uch 
    139      1.7      uch /*
    140      1.7      uch  *	Power management staff
    141      1.7      uch  */
    142      1.7      uch void tx39power_suspend_cpu(void);
    143      1.7      uch 
    144      1.1      uch #ifdef TX39_DEBUG
    145      1.5      uch extern u_int32_t tx39debugflag;
    146      1.1      uch /*
    147      1.1      uch  *	Debugging use.
    148      1.1      uch  */
    149      1.1      uch #define __bitdisp(a, s, e, m, c)					\
    150      1.1      uch ({									\
    151      1.1      uch 	u_int32_t __j, __j1;						\
    152      1.1      uch 	int __i, __s, __e, __n;						\
    153      1.1      uch 	__n = sizeof(typeof(a)) * NBBY - 1;				\
    154      1.1      uch 	__j1 = 1 << __n;						\
    155      1.1      uch 	__e = e ? e : __n;						\
    156      1.1      uch 	__s = s;							\
    157      1.1      uch 	for (__j = __j1, __i = __n; __j > 0; __j >>=1, __i--) {		\
    158      1.1      uch 		if (__i > __e || __i < __s) {				\
    159      1.1      uch 			printf("%c", a & __j ? '+' : '-');		\
    160      1.1      uch 		} else {						\
    161      1.1      uch 			printf("%c", a & __j ? '|' : '.');		\
    162      1.1      uch 		}							\
    163      1.1      uch 	}								\
    164      1.1      uch 	if (m) {							\
    165      1.1      uch 		printf("[%s]", (char*)m);				\
    166      1.1      uch 	}								\
    167      1.1      uch 	if (c) {							\
    168      1.1      uch 		for (__j = __j1, __i = __n; __j > 0; __j >>=1, __i--) {	\
    169      1.1      uch 			if (!(__i > __e || __i < __s) && (a & __j)) {	\
    170      1.1      uch 				printf(" %d", __i);			\
    171      1.1      uch 			}						\
    172      1.1      uch 		}							\
    173      1.1      uch 	}								\
    174      1.1      uch 	printf("\n");							\
    175      1.1      uch })
    176      1.8      uch #define bitdisp(a) __bitdisp((a), 0, 0, 0, 1)
    177      1.1      uch #else /* TX39_DEBUG */
    178      1.1      uch #define __bitdisp(a, s, e, m, c)
    179      1.1      uch #define bitdisp(a)
    180      1.1      uch #endif /* TX39_DEBUG */
    181      1.1      uch 
    182      1.7      uch int	__is_set_print(u_int32_t, int, char *);
    183