sba_iommu.c (983daeec99f07fca0a8a9180ba1ca65bbd40c820) sba_iommu.c (08a6436816f7a16113c73be767ee8d50440e494e)
1/*
2** System Bus Adapter (SBA) I/O MMU manager
3**
4** (c) Copyright 2000-2004 Grant Grundler <grundler @ parisc-linux x org>
5** (c) Copyright 2004 Naresh Kumar Inna <knaresh at india x hp x com>
6** (c) Copyright 2000-2004 Hewlett-Packard Company
7**
8** Portions (c) 1999 Dave S. Miller (from sparc64 I/O MMU code)

--- 75 unchanged lines hidden (view full) ---

84#else
85#define DBG_RES(x...)
86#endif
87
88#define SBA_INLINE __inline__
89
90#define DEFAULT_DMA_HINT_REG 0
91
1/*
2** System Bus Adapter (SBA) I/O MMU manager
3**
4** (c) Copyright 2000-2004 Grant Grundler <grundler @ parisc-linux x org>
5** (c) Copyright 2004 Naresh Kumar Inna <knaresh at india x hp x com>
6** (c) Copyright 2000-2004 Hewlett-Packard Company
7**
8** Portions (c) 1999 Dave S. Miller (from sparc64 I/O MMU code)

--- 75 unchanged lines hidden (view full) ---

84#else
85#define DBG_RES(x...)
86#endif
87
88#define SBA_INLINE __inline__
89
90#define DEFAULT_DMA_HINT_REG 0
91
92static struct sba_device *sba_list;
92struct sba_device *sba_list;
93EXPORT_SYMBOL_GPL(sba_list);
93
94static unsigned long ioc_needs_fdc = 0;
95
96/* global count of IOMMUs in the system */
97static unsigned int global_ioc_cnt = 0;
98
99/* PA8700 (Piranha 2.2) bug workaround */
100static unsigned long piranha_bad_128k = 0;
101
102/* Looks nice and keeps the compiler happy */
103#define SBA_DEV(d) ((struct sba_device *) (d))
104
94
95static unsigned long ioc_needs_fdc = 0;
96
97/* global count of IOMMUs in the system */
98static unsigned int global_ioc_cnt = 0;
99
100/* PA8700 (Piranha 2.2) bug workaround */
101static unsigned long piranha_bad_128k = 0;
102
103/* Looks nice and keeps the compiler happy */
104#define SBA_DEV(d) ((struct sba_device *) (d))
105
106#ifdef CONFIG_AGP_PARISC
107#define SBA_AGP_SUPPORT
108#endif /*CONFIG_AGP_PARISC*/
109
105#ifdef SBA_AGP_SUPPORT
110#ifdef SBA_AGP_SUPPORT
106static int reserve_sba_gart = 1;
111static int sba_reserve_agpgart = 1;
112module_param(sba_reserve_agpgart, int, 1);
113MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART");
107#endif
108
109#define ROUNDUP(x,y) ((x + ((y)-1)) & ~((y)-1))
110
111
112/************************************
113** SBA register read and write support
114**

--- 1180 unchanged lines hidden (view full) ---

1295
1296 /*
1297 ** Clear I/O TLB of any possible entries.
1298 ** (Yes. This is a bit paranoid...but so what)
1299 */
1300 WRITE_REG(ioc->ibase | 31, ioc->ioc_hpa + IOC_PCOM);
1301
1302#ifdef SBA_AGP_SUPPORT
114#endif
115
116#define ROUNDUP(x,y) ((x + ((y)-1)) & ~((y)-1))
117
118
119/************************************
120** SBA register read and write support
121**

--- 1180 unchanged lines hidden (view full) ---

1302
1303 /*
1304 ** Clear I/O TLB of any possible entries.
1305 ** (Yes. This is a bit paranoid...but so what)
1306 */
1307 WRITE_REG(ioc->ibase | 31, ioc->ioc_hpa + IOC_PCOM);
1308
1309#ifdef SBA_AGP_SUPPORT
1310{
1311 struct klist_iter i;
1312 struct device *dev = NULL;
1313
1303 /*
1304 ** If an AGP device is present, only use half of the IOV space
1305 ** for PCI DMA. Unfortunately we can't know ahead of time
1306 ** whether GART support will actually be used, for now we
1307 ** can just key on any AGP device found in the system.
1308 ** We program the next pdir index after we stop w/ a key for
1309 ** the GART code to handshake on.
1310 */
1314 /*
1315 ** If an AGP device is present, only use half of the IOV space
1316 ** for PCI DMA. Unfortunately we can't know ahead of time
1317 ** whether GART support will actually be used, for now we
1318 ** can just key on any AGP device found in the system.
1319 ** We program the next pdir index after we stop w/ a key for
1320 ** the GART code to handshake on.
1321 */
1311 device=NULL;
1312 for (lba = sba->child; lba; lba = lba->sibling) {
1322 klist_iter_init(&sba->dev.klist_children, &i);
1323 while (dev = next_device(&i)) {
1324 struct parisc_device *lba = to_parisc_device(dev);
1313 if (IS_QUICKSILVER(lba))
1325 if (IS_QUICKSILVER(lba))
1314 break;
1326 agp_found = 1;
1315 }
1327 }
1328 klist_iter_exit(&sba->dev.klist_children, &i);
1316
1329
1317 if (lba) {
1318 DBG_INIT("%s: Reserving half of IOVA space for AGP GART support\n", __FUNCTION__);
1330 if (agp_found && sba_reserve_agpgart) {
1331 printk(KERN_INFO "%s: reserving %dMb of IOVA space for agpgart\n",
1332 __FUNCTION__, (iova_space_size/2) >> 20);
1319 ioc->pdir_size /= 2;
1333 ioc->pdir_size /= 2;
1320 ((u64 *)ioc->pdir_base)[PDIR_INDEX(iova_space_size/2)] = SBA_IOMMU_COOKIE;
1321 } else {
1322 DBG_INIT("%s: No GART needed - no AGP controller found\n", __FUNCTION__);
1334 ioc->pdir_base[PDIR_INDEX(iova_space_size/2)] = SBA_AGPGART_COOKIE;
1323 }
1335 }
1324#endif /* 0 */
1336}
1337#endif /*SBA_AGP_SUPPORT*/
1325
1326}
1327
1328static void
1329sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1330{
1331 u32 iova_space_size, iova_space_mask;
1332 unsigned int pdir_size, iov_order;

--- 726 unchanged lines hidden ---
1338
1339}
1340
1341static void
1342sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1343{
1344 u32 iova_space_size, iova_space_mask;
1345 unsigned int pdir_size, iov_order;

--- 726 unchanged lines hidden ---