This source file includes following definitions.
- mgag200_mm_init
- mgag200_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 <drm/drm_pci.h>
30
31 #include "mgag200_drv.h"
32
33 int mgag200_mm_init(struct mga_device *mdev)
34 {
35 struct drm_vram_mm *vmm;
36 int ret;
37 struct drm_device *dev = mdev->dev;
38
39 vmm = drm_vram_helper_alloc_mm(dev, pci_resource_start(dev->pdev, 0),
40 mdev->mc.vram_size,
41 &drm_gem_vram_mm_funcs);
42 if (IS_ERR(vmm)) {
43 ret = PTR_ERR(vmm);
44 DRM_ERROR("Error initializing VRAM MM; %d\n", ret);
45 return ret;
46 }
47
48 arch_io_reserve_memtype_wc(pci_resource_start(dev->pdev, 0),
49 pci_resource_len(dev->pdev, 0));
50
51 mdev->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
52 pci_resource_len(dev->pdev, 0));
53
54 return 0;
55 }
56
57 void mgag200_mm_fini(struct mga_device *mdev)
58 {
59 struct drm_device *dev = mdev->dev;
60
61 drm_vram_helper_release_mm(dev);
62
63 arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0),
64 pci_resource_len(dev->pdev, 0));
65 arch_phys_wc_del(mdev->fb_mtrr);
66 mdev->fb_mtrr = 0;
67 }