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