Subversion Repositories Kolibri OS

Rev

Rev 5271 | Rev 6938 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5271 Rev 6296
Line 31... Line 31...
31
#define ioread32(addr)          readl(addr)
31
#define ioread32(addr)          readl(addr)
Line 32... Line 32...
32
 
32
 
33
#include 
33
#include 
34
#include 
34
#include 
35
#include 
35
#include 
36
//#include 
36
#include 
37
//#include 
37
//#include 
38
#include 
38
#include 
39
#include 
39
#include 
40
//#include 
40
#include 
Line 41... Line 41...
41
#include 
41
#include 
Line 42... Line 42...
42
 
42
 
Line 161... Line 161...
161
		bdev->driver->io_mem_free(bdev, mem);
161
		bdev->driver->io_mem_free(bdev, mem);
Line 162... Line 162...
162
 
162
 
163
}
163
}
Line 164... Line -...
164
EXPORT_SYMBOL(ttm_mem_io_free);
-
 
165
 
164
EXPORT_SYMBOL(ttm_mem_io_free);
166
#if 0
165
 
167
int ttm_mem_io_reserve_vm(struct ttm_buffer_object *bo)
166
int ttm_mem_io_reserve_vm(struct ttm_buffer_object *bo)
168
{
167
{
Line 181... Line 180...
181
			list_add_tail(&bo->io_reserve_lru,
180
			list_add_tail(&bo->io_reserve_lru,
182
				      &man->io_reserve_lru);
181
				      &man->io_reserve_lru);
183
	}
182
	}
184
	return 0;
183
	return 0;
185
}
184
}
186
#endif
-
 
Line 187... Line 185...
187
 
185
 
188
void ttm_mem_io_free_vm(struct ttm_buffer_object *bo)
186
void ttm_mem_io_free_vm(struct ttm_buffer_object *bo)
189
{
187
{
Line 214... Line 212...
214
		addr = mem->bus.addr;
212
		addr = mem->bus.addr;
215
	} else {
213
	} else {
216
		if (mem->placement & TTM_PL_FLAG_WC)
214
		if (mem->placement & TTM_PL_FLAG_WC)
217
			addr = ioremap_wc(mem->bus.base + mem->bus.offset, mem->bus.size);
215
			addr = ioremap_wc(mem->bus.base + mem->bus.offset, mem->bus.size);
218
		else
216
		else
219
            addr = ioremap(mem->bus.base + mem->bus.offset, mem->bus.size);
217
			addr = ioremap_nocache(mem->bus.base + mem->bus.offset, mem->bus.size);
220
		if (!addr) {
218
		if (!addr) {
221
			(void) ttm_mem_io_lock(man, false);
219
			(void) ttm_mem_io_lock(man, false);
222
			ttm_mem_io_free(bdev, mem);
220
			ttm_mem_io_free(bdev, mem);
223
			ttm_mem_io_unlock(man);
221
			ttm_mem_io_unlock(man);
224
			return -ENOMEM;
222
			return -ENOMEM;
Line 481... Line 479...
481
		map->bo_kmap_type = ttm_bo_map_iomap;
479
		map->bo_kmap_type = ttm_bo_map_iomap;
482
		if (mem->placement & TTM_PL_FLAG_WC)
480
		if (mem->placement & TTM_PL_FLAG_WC)
483
			map->virtual = ioremap_wc(bo->mem.bus.base + bo->mem.bus.offset + offset,
481
			map->virtual = ioremap_wc(bo->mem.bus.base + bo->mem.bus.offset + offset,
484
						  size);
482
						  size);
485
		else
483
		else
486
			map->virtual = ioremap(bo->mem.bus.base + bo->mem.bus.offset + offset,
484
			map->virtual = ioremap_nocache(bo->mem.bus.base + bo->mem.bus.offset + offset,
487
						       size);
485
						       size);
488
	}
486
	}
489
	return (!map->virtual) ? -ENOMEM : 0;
487
	return (!map->virtual) ? -ENOMEM : 0;
490
}
488
}
Line 512... Line 510...
512
		 * page protection is consistent with the bo.
510
		 * page protection is consistent with the bo.
513
		 */
511
		 */
Line 514... Line 512...
514
 
512
 
515
		map->bo_kmap_type = ttm_bo_map_kmap;
513
		map->bo_kmap_type = ttm_bo_map_kmap;
516
		map->page = ttm->pages[start_page];
514
		map->page = ttm->pages[start_page];
517
		map->virtual = (void*)MapIoMem(page_to_phys(map->page), 4096, PG_SW);
515
		map->virtual = kmap(map->page);
518
	} else {
516
	} else {
519
		/*
517
		/*
520
		 * We need to use vmap to get the desired page protection
518
		 * We need to use vmap to get the desired page protection
521
		 * or to make the buffer object look contiguous.
519
		 * or to make the buffer object look contiguous.
522
		 */
-
 
523
		prot = (mem->placement & TTM_PL_FLAG_CACHED) ?
-
 
524
			PAGE_KERNEL :
520
		 */
525
			ttm_io_prot(mem->placement, PAGE_KERNEL);
521
		prot = ttm_io_prot(mem->placement, PAGE_KERNEL);
526
		map->bo_kmap_type = ttm_bo_map_vmap;
522
		map->bo_kmap_type = ttm_bo_map_vmap;
527
		map->virtual = vmap(ttm->pages + start_page, num_pages,
523
		map->virtual = vmap(ttm->pages + start_page, num_pages,
528
				    0, prot);
524
				    0, prot);
529
	}
525
	}
Line 576... Line 572...
576
	switch (map->bo_kmap_type) {
572
	switch (map->bo_kmap_type) {
577
	case ttm_bo_map_iomap:
573
	case ttm_bo_map_iomap:
578
		iounmap(map->virtual);
574
		iounmap(map->virtual);
579
		break;
575
		break;
580
	case ttm_bo_map_vmap:
576
	case ttm_bo_map_vmap:
-
 
577
		break;
581
	case ttm_bo_map_kmap:
578
	case ttm_bo_map_kmap:
582
        FreeKernelSpace(map->virtual);
579
		kunmap(map->page);
583
		break;
580
		break;
584
	case ttm_bo_map_premapped:
581
	case ttm_bo_map_premapped:
585
		break;
582
		break;
586
	default:
583
	default:
587
		BUG();
584
		BUG();