Home | History | Annotate | Line # | Download | only in tx
tx39var.h revision 1.14
      1  1.14  martin /*	$NetBSD: tx39var.h,v 1.14 2008/04/28 20:23:22 martin Exp $ */
      2   1.1     uch 
      3   1.6     uch /*-
      4  1.10     uch  * Copyright (c) 1999-2002 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.1     uch  *
     19   1.7     uch  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20   1.7     uch  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21   1.7     uch  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22   1.7     uch  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23   1.7     uch  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24   1.7     uch  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25   1.7     uch  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26   1.7     uch  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27   1.7     uch  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28   1.7     uch  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29   1.7     uch  * POSSIBILITY OF SUCH DAMAGE.
     30   1.1     uch  */
     31  1.11  martin 
     32  1.11  martin #include "opt_use_poll.h"
     33   1.2     uch 
     34   1.8     uch enum tx_chipset {
     35   1.8     uch 	__TX391X,
     36   1.8     uch 	__TX392X,
     37   1.8     uch };
     38   1.8     uch 
     39   1.8     uch /* attach priority of TX-internal modules. */
     40   1.8     uch enum tx_attach_order {
     41   1.8     uch 	ATTACH_FIRST	= 3,
     42   1.8     uch 	ATTACH_NORMAL	= 2,
     43   1.8     uch 	ATTACH_LAST	= 1,
     44   1.8     uch };
     45   1.8     uch 
     46   1.8     uch /* unified I/O manager */
     47   1.8     uch enum txio_group {
     48   1.8     uch 	MFIO = 0,
     49   1.8     uch 	IO,
     50   1.8     uch 	BETTY,
     51   1.8     uch 	SNOWBALL,
     52   1.8     uch 	PLUM,
     53   1.8     uch 	NTXIO_GROUP
     54   1.8     uch };
     55   1.8     uch 
     56   1.9     uch struct hpcio_chip;
     57   1.8     uch 
     58   1.1     uch struct tx_chipset_tag {
     59   1.8     uch 	enum tx_chipset tc_chipset;
     60   1.1     uch 	void *tc_intrt;  /* interrupt tag */
     61   1.3     uch 	void *tc_powert; /* power tag */
     62   1.3     uch 	void *tc_clockt; /* clock/timer tag */
     63   1.4     uch 	void *tc_soundt; /* sound tag */
     64   1.9     uch 	struct hpcio_chip *tc_iochip[NTXIO_GROUP];
     65   1.6     uch 	void *tc_videot; /* video chip tag */
     66   1.1     uch };
     67   1.1     uch 
     68   1.8     uch typedef struct tx_chipset_tag* tx_chipset_tag_t __attribute__((__unused__));
     69   1.1     uch typedef u_int32_t txreg_t;
     70   1.8     uch extern struct tx_chipset_tag tx_chipset;
     71   1.8     uch #define tx_conf_get_tag() (&tx_chipset)
     72   1.8     uch 
     73   1.8     uch #if defined TX391X && defined TX392X
     74   1.8     uch #define IS_TX391X(t)	((t)->tc_chipset == __TX391X)
     75   1.8     uch #define IS_TX392X(t)	((t)->tc_chipset == __TX392X)
     76   1.8     uch #elif defined TX391X
     77   1.8     uch #define IS_TX391X(t)	(1)
     78   1.8     uch #define IS_TX392X(t)	(0)
     79   1.8     uch #elif defined TX392X
     80   1.8     uch #define IS_TX391X(t)	(0)
     81   1.8     uch #define IS_TX392X(t)	(1)
     82   1.8     uch #endif
     83   1.1     uch 
     84   1.7     uch void	tx_conf_register_intr(tx_chipset_tag_t, void *);
     85   1.7     uch void	tx_conf_register_power(tx_chipset_tag_t, void *);
     86   1.7     uch void	tx_conf_register_clock(tx_chipset_tag_t, void *);
     87   1.7     uch void	tx_conf_register_sound(tx_chipset_tag_t, void *);
     88   1.9     uch void	tx_conf_register_ioman(tx_chipset_tag_t, struct hpcio_chip *);
     89   1.7     uch void	tx_conf_register_video(tx_chipset_tag_t, void *);
     90   1.8     uch 
     91   1.1     uch /*
     92   1.1     uch  *	TX39 Internal Function Register access
     93   1.1     uch  */
     94   1.1     uch #define TX39_SYSADDR_CONFIG_REG_KSEG1	0xb0c00000
     95   1.8     uch #define tx_conf_read(t, reg) (						\
     96   1.7     uch 	(*((volatile txreg_t *)(TX39_SYSADDR_CONFIG_REG_KSEG1 + (reg)))))
     97   1.8     uch #define tx_conf_write(t, reg, val) (					\
     98   1.7     uch 	(*((volatile txreg_t *)(TX39_SYSADDR_CONFIG_REG_KSEG1 + (reg))) \
     99   1.2     uch 	= (val)))
    100   1.1     uch 
    101   1.1     uch /*
    102   1.1     uch  *	txsim attach arguments. (txsim ... TX System Internal Module)
    103   1.1     uch  */
    104   1.1     uch struct txsimbus_attach_args {
    105   1.1     uch 	char *tba_busname;
    106   1.1     uch };
    107   1.1     uch 
    108   1.1     uch /*
    109   1.1     uch  *	txsim module attach arguments.
    110   1.1     uch  */
    111   1.1     uch struct txsim_attach_args {
    112   1.1     uch 	tx_chipset_tag_t ta_tc; /* Chipset tag */
    113   1.1     uch };
    114   1.1     uch 
    115   1.1     uch /*
    116   1.1     uch  *	Interrupt staff
    117   1.1     uch  */
    118   1.7     uch #define MAKEINTR(s, b)	((s) * 32 + (ffs(b) - 1))
    119   1.7     uch void*	tx_intr_establish(tx_chipset_tag_t, int, int, int, int (*)(void *),
    120   1.7     uch 			  void *);
    121   1.7     uch void	tx_intr_disestablish(tx_chipset_tag_t, void *);
    122   1.3     uch 
    123   1.1     uch #ifdef USE_POLL
    124   1.7     uch void*	tx39_poll_establish(tx_chipset_tag_t, int, int, int (*)(void *),
    125   1.7     uch 			    void *);
    126   1.7     uch void	tx39_poll_disestablish(tx_chipset_tag_t, void *);
    127   1.3     uch #define POLL_CONT	0
    128   1.3     uch #define POLL_END	1
    129   1.1     uch #endif /* USE_POLL */
    130   1.1     uch 
    131   1.7     uch u_int32_t tx_intr_status(tx_chipset_tag_t, int);
    132   1.5     uch extern u_int32_t tx39intrvec;
    133   1.5     uch 
    134   1.7     uch /*
    135   1.7     uch  *	Power management staff
    136   1.7     uch  */
    137   1.7     uch void tx39power_suspend_cpu(void);
    138   1.7     uch 
    139   1.1     uch /*
    140  1.12     abs  *	Debug print configuration.
    141   1.1     uch  */
    142  1.10     uch #define USE_HPC_DPRINTF
    143  1.10     uch #define __DPRINTF_EXT
    144