[PATCH] w1: Added the triplet w1 master method and changes w1_search() to use it.
[linux-2.6/verdex.git] / arch / ia64 / sn / pci / pcibr / pcibr_reg.c
blob865c11c3b50a06cbcd31d39b1bf152bfe12e8606
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
6 * Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved.
7 */
9 #include <linux/types.h>
10 #include <linux/interrupt.h>
11 #include <asm/sn/pcibus_provider_defs.h>
12 #include <asm/sn/pcidev.h>
13 #include "pci/tiocp.h"
14 #include "pci/pic.h"
15 #include "pci/pcibr_provider.h"
17 union br_ptr {
18 struct tiocp tio;
19 struct pic pic;
23 * Control Register Access -- Read/Write 0000_0020
25 void pcireg_control_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits)
27 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base;
29 if (pcibus_info) {
30 switch (pcibus_info->pbi_bridge_type) {
31 case PCIBR_BRIDGETYPE_TIOCP:
32 ptr->tio.cp_control &= ~bits;
33 break;
34 case PCIBR_BRIDGETYPE_PIC:
35 ptr->pic.p_wid_control &= ~bits;
36 break;
37 default:
38 panic
39 ("pcireg_control_bit_clr: unknown bridgetype bridge 0x%p",
40 (void *)ptr);
45 void pcireg_control_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
47 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base;
49 if (pcibus_info) {
50 switch (pcibus_info->pbi_bridge_type) {
51 case PCIBR_BRIDGETYPE_TIOCP:
52 ptr->tio.cp_control |= bits;
53 break;
54 case PCIBR_BRIDGETYPE_PIC:
55 ptr->pic.p_wid_control |= bits;
56 break;
57 default:
58 panic
59 ("pcireg_control_bit_set: unknown bridgetype bridge 0x%p",
60 (void *)ptr);
66 * PCI/PCIX Target Flush Register Access -- Read Only 0000_0050
68 uint64_t pcireg_tflush_get(struct pcibus_info *pcibus_info)
70 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base;
71 uint64_t ret = 0;
73 if (pcibus_info) {
74 switch (pcibus_info->pbi_bridge_type) {
75 case PCIBR_BRIDGETYPE_TIOCP:
76 ret = ptr->tio.cp_tflush;
77 break;
78 case PCIBR_BRIDGETYPE_PIC:
79 ret = ptr->pic.p_wid_tflush;
80 break;
81 default:
82 panic
83 ("pcireg_tflush_get: unknown bridgetype bridge 0x%p",
84 (void *)ptr);
88 /* Read of the Target Flush should always return zero */
89 if (ret != 0)
90 panic("pcireg_tflush_get:Target Flush failed\n");
92 return ret;
96 * Interrupt Status Register Access -- Read Only 0000_0100
98 uint64_t pcireg_intr_status_get(struct pcibus_info * pcibus_info)
100 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base;
101 uint64_t ret = 0;
103 if (pcibus_info) {
104 switch (pcibus_info->pbi_bridge_type) {
105 case PCIBR_BRIDGETYPE_TIOCP:
106 ret = ptr->tio.cp_int_status;
107 break;
108 case PCIBR_BRIDGETYPE_PIC:
109 ret = ptr->pic.p_int_status;
110 break;
111 default:
112 panic
113 ("pcireg_intr_status_get: unknown bridgetype bridge 0x%p",
114 (void *)ptr);
117 return ret;
121 * Interrupt Enable Register Access -- Read/Write 0000_0108
123 void pcireg_intr_enable_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits)
125 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base;
127 if (pcibus_info) {
128 switch (pcibus_info->pbi_bridge_type) {
129 case PCIBR_BRIDGETYPE_TIOCP:
130 ptr->tio.cp_int_enable &= ~bits;
131 break;
132 case PCIBR_BRIDGETYPE_PIC:
133 ptr->pic.p_int_enable &= ~bits;
134 break;
135 default:
136 panic
137 ("pcireg_intr_enable_bit_clr: unknown bridgetype bridge 0x%p",
138 (void *)ptr);
143 void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
145 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base;
147 if (pcibus_info) {
148 switch (pcibus_info->pbi_bridge_type) {
149 case PCIBR_BRIDGETYPE_TIOCP:
150 ptr->tio.cp_int_enable |= bits;
151 break;
152 case PCIBR_BRIDGETYPE_PIC:
153 ptr->pic.p_int_enable |= bits;
154 break;
155 default:
156 panic
157 ("pcireg_intr_enable_bit_set: unknown bridgetype bridge 0x%p",
158 (void *)ptr);
164 * Intr Host Address Register (int_addr) -- Read/Write 0000_0130 - 0000_0168
166 void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n,
167 uint64_t addr)
169 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base;
171 if (pcibus_info) {
172 switch (pcibus_info->pbi_bridge_type) {
173 case PCIBR_BRIDGETYPE_TIOCP:
174 ptr->tio.cp_int_addr[int_n] &= ~TIOCP_HOST_INTR_ADDR;
175 ptr->tio.cp_int_addr[int_n] |=
176 (addr & TIOCP_HOST_INTR_ADDR);
177 break;
178 case PCIBR_BRIDGETYPE_PIC:
179 ptr->pic.p_int_addr[int_n] &= ~PIC_HOST_INTR_ADDR;
180 ptr->pic.p_int_addr[int_n] |=
181 (addr & PIC_HOST_INTR_ADDR);
182 break;
183 default:
184 panic
185 ("pcireg_intr_addr_addr_get: unknown bridgetype bridge 0x%p",
186 (void *)ptr);
192 * Force Interrupt Register Access -- Write Only 0000_01C0 - 0000_01F8
194 void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n)
196 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base;
198 if (pcibus_info) {
199 switch (pcibus_info->pbi_bridge_type) {
200 case PCIBR_BRIDGETYPE_TIOCP:
201 ptr->tio.cp_force_pin[int_n] = 1;
202 break;
203 case PCIBR_BRIDGETYPE_PIC:
204 ptr->pic.p_force_pin[int_n] = 1;
205 break;
206 default:
207 panic
208 ("pcireg_force_intr_set: unknown bridgetype bridge 0x%p",
209 (void *)ptr);
215 * Device(x) Write Buffer Flush Reg Access -- Read Only 0000_0240 - 0000_0258
217 uint64_t pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device)
219 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base;
220 uint64_t ret = 0;
222 if (pcibus_info) {
223 switch (pcibus_info->pbi_bridge_type) {
224 case PCIBR_BRIDGETYPE_TIOCP:
225 ret = ptr->tio.cp_wr_req_buf[device];
226 break;
227 case PCIBR_BRIDGETYPE_PIC:
228 ret = ptr->pic.p_wr_req_buf[device];
229 break;
230 default:
231 panic("pcireg_wrb_flush_get: unknown bridgetype bridge 0x%p", (void *)ptr);
235 /* Read of the Write Buffer Flush should always return zero */
236 return ret;
239 void pcireg_int_ate_set(struct pcibus_info *pcibus_info, int ate_index,
240 uint64_t val)
242 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base;
244 if (pcibus_info) {
245 switch (pcibus_info->pbi_bridge_type) {
246 case PCIBR_BRIDGETYPE_TIOCP:
247 ptr->tio.cp_int_ate_ram[ate_index] = (uint64_t) val;
248 break;
249 case PCIBR_BRIDGETYPE_PIC:
250 ptr->pic.p_int_ate_ram[ate_index] = (uint64_t) val;
251 break;
252 default:
253 panic
254 ("pcireg_int_ate_set: unknown bridgetype bridge 0x%p",
255 (void *)ptr);
260 uint64_t *pcireg_int_ate_addr(struct pcibus_info *pcibus_info, int ate_index)
262 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base;
263 uint64_t *ret = (uint64_t *) 0;
265 if (pcibus_info) {
266 switch (pcibus_info->pbi_bridge_type) {
267 case PCIBR_BRIDGETYPE_TIOCP:
268 ret =
269 (uint64_t *) & (ptr->tio.cp_int_ate_ram[ate_index]);
270 break;
271 case PCIBR_BRIDGETYPE_PIC:
272 ret =
273 (uint64_t *) & (ptr->pic.p_int_ate_ram[ate_index]);
274 break;
275 default:
276 panic
277 ("pcireg_int_ate_addr: unknown bridgetype bridge 0x%p",
278 (void *)ptr);
281 return ret;