aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_reg.c58
-rw-r--r--arch/ia64/sn/pci/tioca_provider.c31
-rw-r--r--arch/ia64/sn/pci/tioce_provider.c29
-rw-r--r--include/asm-ia64/sn/io.h9
-rw-r--r--include/asm-ia64/sn/tioca_provider.h14
5 files changed, 76 insertions, 65 deletions
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_reg.c b/arch/ia64/sn/pci/pcibr/pcibr_reg.c
index 21426d02fbe6..1624b39cb3ec 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_reg.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_reg.c
@@ -29,10 +29,10 @@ void pcireg_control_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits)
29 if (pcibus_info) { 29 if (pcibus_info) {
30 switch (pcibus_info->pbi_bridge_type) { 30 switch (pcibus_info->pbi_bridge_type) {
31 case PCIBR_BRIDGETYPE_TIOCP: 31 case PCIBR_BRIDGETYPE_TIOCP:
32 ptr->tio.cp_control &= ~bits; 32 __sn_clrq_relaxed(&ptr->tio.cp_control, bits);
33 break; 33 break;
34 case PCIBR_BRIDGETYPE_PIC: 34 case PCIBR_BRIDGETYPE_PIC:
35 ptr->pic.p_wid_control &= ~bits; 35 __sn_clrq_relaxed(&ptr->pic.p_wid_control, bits);
36 break; 36 break;
37 default: 37 default:
38 panic 38 panic
@@ -49,10 +49,10 @@ void pcireg_control_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
49 if (pcibus_info) { 49 if (pcibus_info) {
50 switch (pcibus_info->pbi_bridge_type) { 50 switch (pcibus_info->pbi_bridge_type) {
51 case PCIBR_BRIDGETYPE_TIOCP: 51 case PCIBR_BRIDGETYPE_TIOCP:
52 ptr->tio.cp_control |= bits; 52 __sn_setq_relaxed(&ptr->tio.cp_control, bits);
53 break; 53 break;
54 case PCIBR_BRIDGETYPE_PIC: 54 case PCIBR_BRIDGETYPE_PIC:
55 ptr->pic.p_wid_control |= bits; 55 __sn_setq_relaxed(&ptr->pic.p_wid_control, bits);
56 break; 56 break;
57 default: 57 default:
58 panic 58 panic
@@ -73,10 +73,10 @@ uint64_t pcireg_tflush_get(struct pcibus_info *pcibus_info)
73 if (pcibus_info) { 73 if (pcibus_info) {
74 switch (pcibus_info->pbi_bridge_type) { 74 switch (pcibus_info->pbi_bridge_type) {
75 case PCIBR_BRIDGETYPE_TIOCP: 75 case PCIBR_BRIDGETYPE_TIOCP:
76 ret = ptr->tio.cp_tflush; 76 ret = __sn_readq_relaxed(&ptr->tio.cp_tflush);
77 break; 77 break;
78 case PCIBR_BRIDGETYPE_PIC: 78 case PCIBR_BRIDGETYPE_PIC:
79 ret = ptr->pic.p_wid_tflush; 79 ret = __sn_readq_relaxed(&ptr->pic.p_wid_tflush);
80 break; 80 break;
81 default: 81 default:
82 panic 82 panic
@@ -103,10 +103,10 @@ uint64_t pcireg_intr_status_get(struct pcibus_info * pcibus_info)
103 if (pcibus_info) { 103 if (pcibus_info) {
104 switch (pcibus_info->pbi_bridge_type) { 104 switch (pcibus_info->pbi_bridge_type) {
105 case PCIBR_BRIDGETYPE_TIOCP: 105 case PCIBR_BRIDGETYPE_TIOCP:
106 ret = ptr->tio.cp_int_status; 106 ret = __sn_readq_relaxed(&ptr->tio.cp_int_status);
107 break; 107 break;
108 case PCIBR_BRIDGETYPE_PIC: 108 case PCIBR_BRIDGETYPE_PIC:
109 ret = ptr->pic.p_int_status; 109 ret = __sn_readq_relaxed(&ptr->pic.p_int_status);
110 break; 110 break;
111 default: 111 default:
112 panic 112 panic
@@ -127,10 +127,10 @@ void pcireg_intr_enable_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits)
127 if (pcibus_info) { 127 if (pcibus_info) {
128 switch (pcibus_info->pbi_bridge_type) { 128 switch (pcibus_info->pbi_bridge_type) {
129 case PCIBR_BRIDGETYPE_TIOCP: 129 case PCIBR_BRIDGETYPE_TIOCP:
130 ptr->tio.cp_int_enable &= ~bits; 130 __sn_clrq_relaxed(&ptr->tio.cp_int_enable, bits);
131 break; 131 break;
132 case PCIBR_BRIDGETYPE_PIC: 132 case PCIBR_BRIDGETYPE_PIC:
133 ptr->pic.p_int_enable &= ~bits; 133 __sn_clrq_relaxed(&ptr->pic.p_int_enable, ~bits);
134 break; 134 break;
135 default: 135 default:
136 panic 136 panic
@@ -147,10 +147,10 @@ void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
147 if (pcibus_info) { 147 if (pcibus_info) {
148 switch (pcibus_info->pbi_bridge_type) { 148 switch (pcibus_info->pbi_bridge_type) {
149 case PCIBR_BRIDGETYPE_TIOCP: 149 case PCIBR_BRIDGETYPE_TIOCP:
150 ptr->tio.cp_int_enable |= bits; 150 __sn_setq_relaxed(&ptr->tio.cp_int_enable, bits);
151 break; 151 break;
152 case PCIBR_BRIDGETYPE_PIC: 152 case PCIBR_BRIDGETYPE_PIC:
153 ptr->pic.p_int_enable |= bits; 153 __sn_setq_relaxed(&ptr->pic.p_int_enable, bits);
154 break; 154 break;
155 default: 155 default:
156 panic 156 panic
@@ -171,14 +171,16 @@ void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n,
171 if (pcibus_info) { 171 if (pcibus_info) {
172 switch (pcibus_info->pbi_bridge_type) { 172 switch (pcibus_info->pbi_bridge_type) {
173 case PCIBR_BRIDGETYPE_TIOCP: 173 case PCIBR_BRIDGETYPE_TIOCP:
174 ptr->tio.cp_int_addr[int_n] &= ~TIOCP_HOST_INTR_ADDR; 174 __sn_clrq_relaxed(&ptr->tio.cp_int_addr[int_n],
175 ptr->tio.cp_int_addr[int_n] |= 175 TIOCP_HOST_INTR_ADDR);
176 (addr & TIOCP_HOST_INTR_ADDR); 176 __sn_setq_relaxed(&ptr->tio.cp_int_addr[int_n],
177 (addr & TIOCP_HOST_INTR_ADDR));
177 break; 178 break;
178 case PCIBR_BRIDGETYPE_PIC: 179 case PCIBR_BRIDGETYPE_PIC:
179 ptr->pic.p_int_addr[int_n] &= ~PIC_HOST_INTR_ADDR; 180 __sn_clrq_relaxed(&ptr->pic.p_int_addr[int_n],
180 ptr->pic.p_int_addr[int_n] |= 181 PIC_HOST_INTR_ADDR);
181 (addr & PIC_HOST_INTR_ADDR); 182 __sn_setq_relaxed(&ptr->pic.p_int_addr[int_n],
183 (addr & PIC_HOST_INTR_ADDR));
182 break; 184 break;
183 default: 185 default:
184 panic 186 panic
@@ -198,10 +200,10 @@ void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n)
198 if (pcibus_info) { 200 if (pcibus_info) {
199 switch (pcibus_info->pbi_bridge_type) { 201 switch (pcibus_info->pbi_bridge_type) {
200 case PCIBR_BRIDGETYPE_TIOCP: 202 case PCIBR_BRIDGETYPE_TIOCP:
201 ptr->tio.cp_force_pin[int_n] = 1; 203 writeq(1, &ptr->tio.cp_force_pin[int_n]);
202 break; 204 break;
203 case PCIBR_BRIDGETYPE_PIC: 205 case PCIBR_BRIDGETYPE_PIC:
204 ptr->pic.p_force_pin[int_n] = 1; 206 writeq(1, &ptr->pic.p_force_pin[int_n]);
205 break; 207 break;
206 default: 208 default:
207 panic 209 panic
@@ -222,10 +224,12 @@ uint64_t pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device)
222 if (pcibus_info) { 224 if (pcibus_info) {
223 switch (pcibus_info->pbi_bridge_type) { 225 switch (pcibus_info->pbi_bridge_type) {
224 case PCIBR_BRIDGETYPE_TIOCP: 226 case PCIBR_BRIDGETYPE_TIOCP:
225 ret = ptr->tio.cp_wr_req_buf[device]; 227 ret =
228 __sn_readq_relaxed(&ptr->tio.cp_wr_req_buf[device]);
226 break; 229 break;
227 case PCIBR_BRIDGETYPE_PIC: 230 case PCIBR_BRIDGETYPE_PIC:
228 ret = ptr->pic.p_wr_req_buf[device]; 231 ret =
232 __sn_readq_relaxed(&ptr->pic.p_wr_req_buf[device]);
229 break; 233 break;
230 default: 234 default:
231 panic("pcireg_wrb_flush_get: unknown bridgetype bridge 0x%p", (void *)ptr); 235 panic("pcireg_wrb_flush_get: unknown bridgetype bridge 0x%p", (void *)ptr);
@@ -244,10 +248,10 @@ void pcireg_int_ate_set(struct pcibus_info *pcibus_info, int ate_index,
244 if (pcibus_info) { 248 if (pcibus_info) {
245 switch (pcibus_info->pbi_bridge_type) { 249 switch (pcibus_info->pbi_bridge_type) {
246 case PCIBR_BRIDGETYPE_TIOCP: 250 case PCIBR_BRIDGETYPE_TIOCP:
247 ptr->tio.cp_int_ate_ram[ate_index] = (uint64_t) val; 251 writeq(val, &ptr->tio.cp_int_ate_ram[ate_index]);
248 break; 252 break;
249 case PCIBR_BRIDGETYPE_PIC: 253 case PCIBR_BRIDGETYPE_PIC:
250 ptr->pic.p_int_ate_ram[ate_index] = (uint64_t) val; 254 writeq(val, &ptr->pic.p_int_ate_ram[ate_index]);
251 break; 255 break;
252 default: 256 default:
253 panic 257 panic
@@ -265,12 +269,10 @@ uint64_t *pcireg_int_ate_addr(struct pcibus_info *pcibus_info, int ate_index)
265 if (pcibus_info) { 269 if (pcibus_info) {
266 switch (pcibus_info->pbi_bridge_type) { 270 switch (pcibus_info->pbi_bridge_type) {
267 case PCIBR_BRIDGETYPE_TIOCP: 271 case PCIBR_BRIDGETYPE_TIOCP:
268 ret = 272 ret = &ptr->tio.cp_int_ate_ram[ate_index];
269 (uint64_t *) & (ptr->tio.cp_int_ate_ram[ate_index]);
270 break; 273 break;
271 case PCIBR_BRIDGETYPE_PIC: 274 case PCIBR_BRIDGETYPE_PIC:
272 ret = 275 ret = &ptr->pic.p_int_ate_ram[ate_index];
273 (uint64_t *) & (ptr->pic.p_int_ate_ram[ate_index]);
274 break; 276 break;
275 default: 277 default:
276 panic 278 panic
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
index ea09c12f0258..eaae2472d6b4 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -37,7 +37,7 @@ tioca_gart_init(struct tioca_kernel *tioca_kern)
37 uint64_t offset; 37 uint64_t offset;
38 struct page *tmp; 38 struct page *tmp;
39 struct tioca_common *tioca_common; 39 struct tioca_common *tioca_common;
40 volatile struct tioca *ca_base; 40 struct tioca *ca_base;
41 41
42 tioca_common = tioca_kern->ca_common; 42 tioca_common = tioca_kern->ca_common;
43 ca_base = (struct tioca *)tioca_common->ca_common.bs_base; 43 ca_base = (struct tioca *)tioca_common->ca_common.bs_base;
@@ -174,27 +174,29 @@ tioca_gart_init(struct tioca_kernel *tioca_kern)
174 * DISABLE GART PREFETCHING due to hw bug tracked in SGI PV930029 174 * DISABLE GART PREFETCHING due to hw bug tracked in SGI PV930029
175 */ 175 */
176 176
177 ca_base->ca_control1 |= CA_AGPDMA_OP_ENB_COMBDELAY; /* PV895469 ? */ 177 __sn_setq_relaxed(&ca_base->ca_control1,
178 ca_base->ca_control2 &= ~(CA_GART_MEM_PARAM); 178 CA_AGPDMA_OP_ENB_COMBDELAY); /* PV895469 ? */
179 ca_base->ca_control2 |= (0x2ull << CA_GART_MEM_PARAM_SHFT); 179 __sn_clrq_relaxed(&ca_base->ca_control2, CA_GART_MEM_PARAM);
180 __sn_setq_relaxed(&ca_base->ca_control2,
181 (0x2ull << CA_GART_MEM_PARAM_SHFT));
180 tioca_kern->ca_gart_iscoherent = 1; 182 tioca_kern->ca_gart_iscoherent = 1;
181 ca_base->ca_control2 &= 183 __sn_clrq_relaxed(&ca_base->ca_control2,
182 ~(CA_GART_WR_PREFETCH_ENB | CA_GART_RD_PREFETCH_ENB); 184 (CA_GART_WR_PREFETCH_ENB | CA_GART_RD_PREFETCH_ENB));
183 185
184 /* 186 /*
185 * Unmask GART fetch error interrupts. Clear residual errors first. 187 * Unmask GART fetch error interrupts. Clear residual errors first.
186 */ 188 */
187 189
188 ca_base->ca_int_status_alias = CA_GART_FETCH_ERR; 190 writeq(CA_GART_FETCH_ERR, &ca_base->ca_int_status_alias);
189 ca_base->ca_mult_error_alias = CA_GART_FETCH_ERR; 191 writeq(CA_GART_FETCH_ERR, &ca_base->ca_mult_error_alias);
190 ca_base->ca_int_mask &= ~CA_GART_FETCH_ERR; 192 __sn_clrq_relaxed(&ca_base->ca_int_mask, CA_GART_FETCH_ERR);
191 193
192 /* 194 /*
193 * Program the aperature and gart registers in TIOCA 195 * Program the aperature and gart registers in TIOCA
194 */ 196 */
195 197
196 ca_base->ca_gart_aperature = ap_reg; 198 writeq(ap_reg, &ca_base->ca_gart_aperature);
197 ca_base->ca_gart_ptr_table = tioca_kern->ca_gart_coretalk_addr | 1; 199 writeq(tioca_kern->ca_gart_coretalk_addr|1, &ca_base->ca_gart_ptr_table);
198 200
199 return 0; 201 return 0;
200} 202}
@@ -211,7 +213,6 @@ void
211tioca_fastwrite_enable(struct tioca_kernel *tioca_kern) 213tioca_fastwrite_enable(struct tioca_kernel *tioca_kern)
212{ 214{
213 int cap_ptr; 215 int cap_ptr;
214 uint64_t ca_control1;
215 uint32_t reg; 216 uint32_t reg;
216 struct tioca *tioca_base; 217 struct tioca *tioca_base;
217 struct pci_dev *pdev; 218 struct pci_dev *pdev;
@@ -256,9 +257,7 @@ tioca_fastwrite_enable(struct tioca_kernel *tioca_kern)
256 */ 257 */
257 258
258 tioca_base = (struct tioca *)common->ca_common.bs_base; 259 tioca_base = (struct tioca *)common->ca_common.bs_base;
259 ca_control1 = tioca_base->ca_control1; 260 __sn_setq_relaxed(&tioca_base->ca_control1, CA_AGP_FW_ENABLE);
260 ca_control1 |= CA_AGP_FW_ENABLE;
261 tioca_base->ca_control1 = ca_control1;
262} 261}
263 262
264EXPORT_SYMBOL(tioca_fastwrite_enable); /* used by agp-sgi */ 263EXPORT_SYMBOL(tioca_fastwrite_enable); /* used by agp-sgi */
@@ -345,7 +344,7 @@ tioca_dma_d48(struct pci_dev *pdev, uint64_t paddr)
345 return 0; 344 return 0;
346 } 345 }
347 346
348 agp_dma_extn = ca_base->ca_agp_dma_addr_extn; 347 agp_dma_extn = __sn_readq_relaxed(&ca_base->ca_agp_dma_addr_extn);
349 if (node_upper != (agp_dma_extn >> CA_AGP_DMA_NODE_ID_SHFT)) { 348 if (node_upper != (agp_dma_extn >> CA_AGP_DMA_NODE_ID_SHFT)) {
350 printk(KERN_ERR "%s: coretalk upper node (%u) " 349 printk(KERN_ERR "%s: coretalk upper node (%u) "
351 "mismatch with ca_agp_dma_addr_extn (%lu)\n", 350 "mismatch with ca_agp_dma_addr_extn (%lu)\n",
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c
index 8e75db2b825d..204826c2fa44 100644
--- a/arch/ia64/sn/pci/tioce_provider.c
+++ b/arch/ia64/sn/pci/tioce_provider.c
@@ -227,7 +227,7 @@ tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port,
227 227
228 ate = ATE_MAKE(addr, pagesize); 228 ate = ATE_MAKE(addr, pagesize);
229 ate_shadow[i + j] = ate; 229 ate_shadow[i + j] = ate;
230 ate_reg[i + j] = ate; 230 writeq(ate, &ate_reg[i + j]);
231 addr += pagesize; 231 addr += pagesize;
232 } 232 }
233 233
@@ -268,10 +268,10 @@ tioce_dma_d32(struct pci_dev *pdev, uint64_t ct_addr)
268 pcidev_to_tioce(pdev, &ce_mmr, &ce_kern, &port); 268 pcidev_to_tioce(pdev, &ce_mmr, &ce_kern, &port);
269 269
270 if (ce_kern->ce_port[port].dirmap_refcnt == 0) { 270 if (ce_kern->ce_port[port].dirmap_refcnt == 0) {
271 volatile uint64_t tmp; 271 uint64_t tmp;
272 272
273 ce_kern->ce_port[port].dirmap_shadow = ct_upper; 273 ce_kern->ce_port[port].dirmap_shadow = ct_upper;
274 ce_mmr->ce_ure_dir_map[port] = ct_upper; 274 writeq(ct_upper, &ce_mmr->ce_ure_dir_map[port]);
275 tmp = ce_mmr->ce_ure_dir_map[port]; 275 tmp = ce_mmr->ce_ure_dir_map[port];
276 dma_ok = 1; 276 dma_ok = 1;
277 } else 277 } else
@@ -343,7 +343,7 @@ tioce_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir)
343 if (TIOCE_D32_ADDR(bus_addr)) { 343 if (TIOCE_D32_ADDR(bus_addr)) {
344 if (--ce_kern->ce_port[port].dirmap_refcnt == 0) { 344 if (--ce_kern->ce_port[port].dirmap_refcnt == 0) {
345 ce_kern->ce_port[port].dirmap_shadow = 0; 345 ce_kern->ce_port[port].dirmap_shadow = 0;
346 ce_mmr->ce_ure_dir_map[port] = 0; 346 writeq(0, &ce_mmr->ce_ure_dir_map[port]);
347 } 347 }
348 } else { 348 } else {
349 struct tioce_dmamap *map; 349 struct tioce_dmamap *map;
@@ -582,18 +582,18 @@ tioce_kern_init(struct tioce_common *tioce_common)
582 */ 582 */
583 583
584 tioce_mmr = (struct tioce *)tioce_common->ce_pcibus.bs_base; 584 tioce_mmr = (struct tioce *)tioce_common->ce_pcibus.bs_base;
585 tioce_mmr->ce_ure_page_map &= ~CE_URE_PAGESIZE_MASK; 585 __sn_clrq_relaxed(&tioce_mmr->ce_ure_page_map, CE_URE_PAGESIZE_MASK);
586 tioce_mmr->ce_ure_page_map |= CE_URE_256K_PAGESIZE; 586 __sn_setq_relaxed(&tioce_mmr->ce_ure_page_map, CE_URE_256K_PAGESIZE);
587 tioce_kern->ce_ate3240_pagesize = KB(256); 587 tioce_kern->ce_ate3240_pagesize = KB(256);
588 588
589 for (i = 0; i < TIOCE_NUM_M40_ATES; i++) { 589 for (i = 0; i < TIOCE_NUM_M40_ATES; i++) {
590 tioce_kern->ce_ate40_shadow[i] = 0; 590 tioce_kern->ce_ate40_shadow[i] = 0;
591 tioce_mmr->ce_ure_ate40[i] = 0; 591 writeq(0, &tioce_mmr->ce_ure_ate40[i]);
592 } 592 }
593 593
594 for (i = 0; i < TIOCE_NUM_M3240_ATES; i++) { 594 for (i = 0; i < TIOCE_NUM_M3240_ATES; i++) {
595 tioce_kern->ce_ate3240_shadow[i] = 0; 595 tioce_kern->ce_ate3240_shadow[i] = 0;
596 tioce_mmr->ce_ure_ate3240[i] = 0; 596 writeq(0, &tioce_mmr->ce_ure_ate3240[i]);
597 } 597 }
598 598
599 return tioce_kern; 599 return tioce_kern;
@@ -665,7 +665,7 @@ tioce_force_interrupt(struct sn_irq_info *sn_irq_info)
665 default: 665 default:
666 return; 666 return;
667 } 667 }
668 ce_mmr->ce_adm_force_int = force_int_val; 668 writeq(force_int_val, &ce_mmr->ce_adm_force_int);
669} 669}
670 670
671/** 671/**
@@ -686,6 +686,7 @@ tioce_target_interrupt(struct sn_irq_info *sn_irq_info)
686 struct tioce_common *ce_common; 686 struct tioce_common *ce_common;
687 struct tioce *ce_mmr; 687 struct tioce *ce_mmr;
688 int bit; 688 int bit;
689 uint64_t vector;
689 690
690 pcidev_info = (struct pcidev_info *)sn_irq_info->irq_pciioinfo; 691 pcidev_info = (struct pcidev_info *)sn_irq_info->irq_pciioinfo;
691 if (!pcidev_info) 692 if (!pcidev_info)
@@ -696,11 +697,11 @@ tioce_target_interrupt(struct sn_irq_info *sn_irq_info)
696 697
697 bit = sn_irq_info->irq_int_bit; 698 bit = sn_irq_info->irq_int_bit;
698 699
699 ce_mmr->ce_adm_int_mask |= (1UL << bit); 700 __sn_setq_relaxed(&ce_mmr->ce_adm_int_mask, (1UL << bit));
700 ce_mmr->ce_adm_int_dest[bit] = 701 vector = (uint64_t)sn_irq_info->irq_irq << INTR_VECTOR_SHFT;
701 ((uint64_t)sn_irq_info->irq_irq << INTR_VECTOR_SHFT) | 702 vector |= sn_irq_info->irq_xtalkaddr;
702 sn_irq_info->irq_xtalkaddr; 703 writeq(vector, &ce_mmr->ce_adm_int_dest[bit]);
703 ce_mmr->ce_adm_int_mask &= ~(1UL << bit); 704 __sn_clrq_relaxed(&ce_mmr->ce_adm_int_mask, (1UL << bit));
704 705
705 tioce_force_interrupt(sn_irq_info); 706 tioce_force_interrupt(sn_irq_info);
706} 707}
diff --git a/include/asm-ia64/sn/io.h b/include/asm-ia64/sn/io.h
index 42209733f6b1..7597a52b426c 100644
--- a/include/asm-ia64/sn/io.h
+++ b/include/asm-ia64/sn/io.h
@@ -36,6 +36,15 @@ extern void sn_dma_flush(unsigned long);
36#define __sn_readq_relaxed ___sn_readq_relaxed 36#define __sn_readq_relaxed ___sn_readq_relaxed
37 37
38/* 38/*
39 * Convenience macros for setting/clearing bits using the above accessors
40 */
41
42#define __sn_setq_relaxed(addr, val) \
43 writeq((__sn_readq_relaxed(addr) | (val)), (addr))
44#define __sn_clrq_relaxed(addr, val) \
45 writeq((__sn_readq_relaxed(addr) & ~(val)), (addr))
46
47/*
39 * The following routines are SN Platform specific, called when 48 * The following routines are SN Platform specific, called when
40 * a reference is made to inX/outX set macros. SN Platform 49 * a reference is made to inX/outX set macros. SN Platform
41 * inX set of macros ensures that Posted DMA writes on the 50 * inX set of macros ensures that Posted DMA writes on the
diff --git a/include/asm-ia64/sn/tioca_provider.h b/include/asm-ia64/sn/tioca_provider.h
index 5ccec608d325..b532ef6148ed 100644
--- a/include/asm-ia64/sn/tioca_provider.h
+++ b/include/asm-ia64/sn/tioca_provider.h
@@ -182,11 +182,11 @@ tioca_tlbflush(struct tioca_kernel *tioca_kernel)
182 * touch every CL aligned GART entry. 182 * touch every CL aligned GART entry.
183 */ 183 */
184 184
185 ca_base->ca_control2 &= ~(CA_GART_MEM_PARAM); 185 __sn_clrq_relaxed(&ca_base->ca_control2, CA_GART_MEM_PARAM);
186 ca_base->ca_control2 |= CA_GART_FLUSH_TLB; 186 __sn_setq_relaxed(&ca_base->ca_control2, CA_GART_FLUSH_TLB);
187 ca_base->ca_control2 |= 187 __sn_setq_relaxed(&ca_base->ca_control2,
188 (0x2ull << CA_GART_MEM_PARAM_SHFT); 188 (0x2ull << CA_GART_MEM_PARAM_SHFT));
189 tmp = ca_base->ca_control2; 189 tmp = __sn_readq_relaxed(&ca_base->ca_control2);
190 } 190 }
191 191
192 return; 192 return;
@@ -196,8 +196,8 @@ tioca_tlbflush(struct tioca_kernel *tioca_kernel)
196 * Gart in uncached mode ... need an explicit flush. 196 * Gart in uncached mode ... need an explicit flush.
197 */ 197 */
198 198
199 ca_base->ca_control2 |= CA_GART_FLUSH_TLB; 199 __sn_setq_relaxed(&ca_base->ca_control2, CA_GART_FLUSH_TLB);
200 tmp = ca_base->ca_control2; 200 tmp = __sn_readq_relaxed(&ca_base->ca_control2);
201} 201}
202 202
203extern uint32_t tioca_gart_found; 203extern uint32_t tioca_gart_found;