| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * HP Quicksilver AGP GART routines |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * Based on drivers/char/agpgart/hp-agp.c which is |
|---|
| 7 | 8 | * (c) Copyright 2002, 2003 Hewlett-Packard Development Company, L.P. |
|---|
| 8 | 9 | * Bjorn Helgaas <bjorn.helgaas@hp.com> |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 12 | | - * published by the Free Software Foundation. |
|---|
| 13 | | - * |
|---|
| 14 | 10 | */ |
|---|
| 15 | 11 | |
|---|
| 16 | 12 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 94 | 90 | { |
|---|
| 95 | 91 | struct _parisc_agp_info *info = &parisc_agp_info; |
|---|
| 96 | 92 | |
|---|
| 93 | + /* force fdc ops to be visible to IOMMU */ |
|---|
| 94 | + asm_io_sync(); |
|---|
| 95 | + |
|---|
| 97 | 96 | writeq(info->gart_base | ilog2(info->gart_size), info->ioc_regs+IOC_PCOM); |
|---|
| 98 | 97 | readq(info->ioc_regs+IOC_PCOM); /* flush */ |
|---|
| 99 | 98 | } |
|---|
| .. | .. |
|---|
| 162 | 161 | info->gatt[j] = |
|---|
| 163 | 162 | parisc_agp_mask_memory(agp_bridge, |
|---|
| 164 | 163 | paddr, type); |
|---|
| 164 | + asm_io_fdc(&info->gatt[j]); |
|---|
| 165 | 165 | } |
|---|
| 166 | 166 | } |
|---|
| 167 | 167 | |
|---|
| .. | .. |
|---|
| 195 | 195 | parisc_agp_mask_memory(struct agp_bridge_data *bridge, dma_addr_t addr, |
|---|
| 196 | 196 | int type) |
|---|
| 197 | 197 | { |
|---|
| 198 | | - return SBA_PDIR_VALID_BIT | addr; |
|---|
| 198 | + unsigned ci; /* coherent index */ |
|---|
| 199 | + dma_addr_t pa; |
|---|
| 200 | + |
|---|
| 201 | + pa = addr & IOVP_MASK; |
|---|
| 202 | + asm("lci 0(%1), %0" : "=r" (ci) : "r" (phys_to_virt(pa))); |
|---|
| 203 | + |
|---|
| 204 | + pa |= (ci >> PAGE_SHIFT) & 0xff;/* move CI (8 bits) into lowest byte */ |
|---|
| 205 | + pa |= SBA_PDIR_VALID_BIT; /* set "valid" bit */ |
|---|
| 206 | + |
|---|
| 207 | + return cpu_to_le64(pa); |
|---|
| 199 | 208 | } |
|---|
| 200 | 209 | |
|---|
| 201 | 210 | static void |
|---|
| .. | .. |
|---|
| 385 | 394 | static int __init |
|---|
| 386 | 395 | parisc_agp_init(void) |
|---|
| 387 | 396 | { |
|---|
| 388 | | - extern struct sba_device *sba_list; |
|---|
| 389 | | - |
|---|
| 390 | 397 | int err = -1; |
|---|
| 391 | 398 | struct parisc_device *sba = NULL, *lba = NULL; |
|---|
| 392 | 399 | struct lba_device *lbadev = NULL; |
|---|