1 /* $NetBSD: tx39var.h,v 1.13 2005/12/11 12:17:34 christos 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 #include "opt_use_poll.h" 40 41 enum tx_chipset { 42 __TX391X, 43 __TX392X, 44 }; 45 46 /* attach priority of TX-internal modules. */ 47 enum tx_attach_order { 48 ATTACH_FIRST = 3, 49 ATTACH_NORMAL = 2, 50 ATTACH_LAST = 1, 51 }; 52 53 /* unified I/O manager */ 54 enum txio_group { 55 MFIO = 0, 56 IO, 57 BETTY, 58 SNOWBALL, 59 PLUM, 60 NTXIO_GROUP 61 }; 62 63 struct hpcio_chip; 64 65 struct tx_chipset_tag { 66 enum tx_chipset tc_chipset; 67 void *tc_intrt; /* interrupt tag */ 68 void *tc_powert; /* power tag */ 69 void *tc_clockt; /* clock/timer tag */ 70 void *tc_soundt; /* sound tag */ 71 struct hpcio_chip *tc_iochip[NTXIO_GROUP]; 72 void *tc_videot; /* video chip tag */ 73 }; 74 75 typedef struct tx_chipset_tag* tx_chipset_tag_t __attribute__((__unused__)); 76 typedef u_int32_t txreg_t; 77 extern struct tx_chipset_tag tx_chipset; 78 #define tx_conf_get_tag() (&tx_chipset) 79 80 #if defined TX391X && defined TX392X 81 #define IS_TX391X(t) ((t)->tc_chipset == __TX391X) 82 #define IS_TX392X(t) ((t)->tc_chipset == __TX392X) 83 #elif defined TX391X 84 #define IS_TX391X(t) (1) 85 #define IS_TX392X(t) (0) 86 #elif defined TX392X 87 #define IS_TX391X(t) (0) 88 #define IS_TX392X(t) (1) 89 #endif 90 91 void tx_conf_register_intr(tx_chipset_tag_t, void *); 92 void tx_conf_register_power(tx_chipset_tag_t, void *); 93 void tx_conf_register_clock(tx_chipset_tag_t, void *); 94 void tx_conf_register_sound(tx_chipset_tag_t, void *); 95 void tx_conf_register_ioman(tx_chipset_tag_t, struct hpcio_chip *); 96 void tx_conf_register_video(tx_chipset_tag_t, void *); 97 98 /* 99 * TX39 Internal Function Register access 100 */ 101 #define TX39_SYSADDR_CONFIG_REG_KSEG1 0xb0c00000 102 #define tx_conf_read(t, reg) ( \ 103 (*((volatile txreg_t *)(TX39_SYSADDR_CONFIG_REG_KSEG1 + (reg))))) 104 #define tx_conf_write(t, reg, val) ( \ 105 (*((volatile txreg_t *)(TX39_SYSADDR_CONFIG_REG_KSEG1 + (reg))) \ 106 = (val))) 107 108 /* 109 * txsim attach arguments. (txsim ... TX System Internal Module) 110 */ 111 struct txsimbus_attach_args { 112 char *tba_busname; 113 }; 114 115 /* 116 * txsim module attach arguments. 117 */ 118 struct txsim_attach_args { 119 tx_chipset_tag_t ta_tc; /* Chipset tag */ 120 }; 121 122 /* 123 * Interrupt staff 124 */ 125 #define MAKEINTR(s, b) ((s) * 32 + (ffs(b) - 1)) 126 void* tx_intr_establish(tx_chipset_tag_t, int, int, int, int (*)(void *), 127 void *); 128 void tx_intr_disestablish(tx_chipset_tag_t, void *); 129 130 #ifdef USE_POLL 131 void* tx39_poll_establish(tx_chipset_tag_t, int, int, int (*)(void *), 132 void *); 133 void tx39_poll_disestablish(tx_chipset_tag_t, void *); 134 #define POLL_CONT 0 135 #define POLL_END 1 136 #endif /* USE_POLL */ 137 138 u_int32_t tx_intr_status(tx_chipset_tag_t, int); 139 extern u_int32_t tx39intrvec; 140 141 /* 142 * Power management staff 143 */ 144 void tx39power_suspend_cpu(void); 145 146 /* 147 * Debug print configuration. 148 */ 149 #define USE_HPC_DPRINTF 150 #define __DPRINTF_EXT 151