forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/char/agp/parisc-agp.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * HP Quicksilver AGP GART routines
34 *
....@@ -6,11 +7,6 @@
67 * Based on drivers/char/agpgart/hp-agp.c which is
78 * (c) Copyright 2002, 2003 Hewlett-Packard Development Company, L.P.
89 * 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
- *
1410 */
1511
1612 #include <linux/module.h>
....@@ -94,6 +90,9 @@
9490 {
9591 struct _parisc_agp_info *info = &parisc_agp_info;
9692
93
+ /* force fdc ops to be visible to IOMMU */
94
+ asm_io_sync();
95
+
9796 writeq(info->gart_base | ilog2(info->gart_size), info->ioc_regs+IOC_PCOM);
9897 readq(info->ioc_regs+IOC_PCOM); /* flush */
9998 }
....@@ -162,6 +161,7 @@
162161 info->gatt[j] =
163162 parisc_agp_mask_memory(agp_bridge,
164163 paddr, type);
164
+ asm_io_fdc(&info->gatt[j]);
165165 }
166166 }
167167
....@@ -195,7 +195,16 @@
195195 parisc_agp_mask_memory(struct agp_bridge_data *bridge, dma_addr_t addr,
196196 int type)
197197 {
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);
199208 }
200209
201210 static void
....@@ -385,8 +394,6 @@
385394 static int __init
386395 parisc_agp_init(void)
387396 {
388
- extern struct sba_device *sba_list;
389
-
390397 int err = -1;
391398 struct parisc_device *sba = NULL, *lba = NULL;
392399 struct lba_device *lbadev = NULL;