This source file includes following definitions.
- ast_mm_init
- ast_mm_fini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #include <linux/pci.h>
30
31 #include <drm/drm_print.h>
32 #include <drm/drm_gem_vram_helper.h>
33 #include <drm/drm_vram_mm_helper.h>
34
35 #include "ast_drv.h"
36
37 int ast_mm_init(struct ast_private *ast)
38 {
39 struct drm_vram_mm *vmm;
40 int ret;
41 struct drm_device *dev = ast->dev;
42
43 vmm = drm_vram_helper_alloc_mm(
44 dev, pci_resource_start(dev->pdev, 0),
45 ast->vram_size, &drm_gem_vram_mm_funcs);
46 if (IS_ERR(vmm)) {
47 ret = PTR_ERR(vmm);
48 DRM_ERROR("Error initializing VRAM MM; %d\n", ret);
49 return ret;
50 }
51
52 arch_io_reserve_memtype_wc(pci_resource_start(dev->pdev, 0),
53 pci_resource_len(dev->pdev, 0));
54 ast->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
55 pci_resource_len(dev->pdev, 0));
56
57 return 0;
58 }
59
60 void ast_mm_fini(struct ast_private *ast)
61 {
62 struct drm_device *dev = ast->dev;
63
64 drm_vram_helper_release_mm(dev);
65
66 arch_phys_wc_del(ast->fb_mtrr);
67 arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0),
68 pci_resource_len(dev->pdev, 0));
69 }