1 /**************************************************************************
2 * Copyright (c) 2007-2011, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 **************************************************************************/
18 struct psb_mmu_driver
{
19 /* protects driver- and pd structures. Always take in read mode
20 * before taking the page table spinlock.
22 struct rw_semaphore sem
;
24 /* protects page tables, directory tables and pt tables.
29 atomic_t needs_tlbflush
;
30 atomic_t
*msvdx_mmu_invaldc
;
31 struct psb_mmu_pd
*default_pd
;
35 unsigned long clflush_mask
;
37 struct drm_device
*dev
;
43 struct psb_mmu_pd
*pd
;
51 struct psb_mmu_driver
*driver
;
53 struct psb_mmu_pt
**tables
;
55 struct page
*dummy_pt
;
56 struct page
*dummy_page
;
62 extern struct psb_mmu_driver
*psb_mmu_driver_init(struct drm_device
*dev
,
65 atomic_t
*msvdx_mmu_invaldc
);
66 extern void psb_mmu_driver_takedown(struct psb_mmu_driver
*driver
);
67 extern struct psb_mmu_pd
*psb_mmu_get_default_pd(struct psb_mmu_driver
69 extern struct psb_mmu_pd
*psb_mmu_alloc_pd(struct psb_mmu_driver
*driver
,
72 extern void psb_mmu_free_pagedir(struct psb_mmu_pd
*pd
);
73 extern void psb_mmu_flush(struct psb_mmu_driver
*driver
);
74 extern void psb_mmu_remove_pfn_sequence(struct psb_mmu_pd
*pd
,
75 unsigned long address
,
77 extern int psb_mmu_insert_pfn_sequence(struct psb_mmu_pd
*pd
,
79 unsigned long address
,
80 uint32_t num_pages
, int type
);
81 extern int psb_mmu_virtual_to_pfn(struct psb_mmu_pd
*pd
, uint32_t virtual,
83 extern void psb_mmu_set_pd_context(struct psb_mmu_pd
*pd
, int hw_context
);
84 extern int psb_mmu_insert_pages(struct psb_mmu_pd
*pd
, struct page
**pages
,
85 unsigned long address
, uint32_t num_pages
,
86 uint32_t desired_tile_stride
,
87 uint32_t hw_tile_stride
, int type
);
88 extern void psb_mmu_remove_pages(struct psb_mmu_pd
*pd
,
89 unsigned long address
, uint32_t num_pages
,
90 uint32_t desired_tile_stride
,
91 uint32_t hw_tile_stride
);