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