~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/include/asm/gart.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _ASM_X86_GART_H
  3 #define _ASM_X86_GART_H
  4 
  5 #include <asm/e820/api.h>
  6 
  7 extern void set_up_gart_resume(u32, u32);
  8 
  9 extern int fallback_aper_order;
 10 extern int fallback_aper_force;
 11 extern int fix_aperture;
 12 
 13 /* PTE bits. */
 14 #define GPTE_VALID      1
 15 #define GPTE_COHERENT   2
 16 
 17 /* Aperture control register bits. */
 18 #define GARTEN          (1<<0)
 19 #define DISGARTCPU      (1<<4)
 20 #define DISGARTIO       (1<<5)
 21 #define DISTLBWALKPRB   (1<<6)
 22 
 23 /* GART cache control register bits. */
 24 #define INVGART         (1<<0)
 25 #define GARTPTEERR      (1<<1)
 26 
 27 /* K8 On-cpu GART registers */
 28 #define AMD64_GARTAPERTURECTL   0x90
 29 #define AMD64_GARTAPERTUREBASE  0x94
 30 #define AMD64_GARTTABLEBASE     0x98
 31 #define AMD64_GARTCACHECTL      0x9c
 32 
 33 #ifdef CONFIG_GART_IOMMU
 34 extern int gart_iommu_aperture;
 35 extern int gart_iommu_aperture_allowed;
 36 extern int gart_iommu_aperture_disabled;
 37 
 38 extern void early_gart_iommu_check(void);
 39 extern int gart_iommu_init(void);
 40 extern void __init gart_parse_options(char *);
 41 void gart_iommu_hole_init(void);
 42 
 43 #else
 44 #define gart_iommu_aperture            0
 45 #define gart_iommu_aperture_allowed    0
 46 #define gart_iommu_aperture_disabled   1
 47 
 48 static inline void early_gart_iommu_check(void)
 49 {
 50 }
 51 static inline void gart_parse_options(char *options)
 52 {
 53 }
 54 static inline void gart_iommu_hole_init(void)
 55 {
 56 }
 57 #endif
 58 
 59 extern int agp_amd64_init(void);
 60 
 61 static inline void gart_set_size_and_enable(struct pci_dev *dev, u32 order)
 62 {
 63         u32 ctl;
 64 
 65         /*
 66          * Don't enable translation but enable GART IO and CPU accesses.
 67          * Also, set DISTLBWALKPRB since GART tables memory is UC.
 68          */
 69         ctl = order << 1;
 70 
 71         pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl);
 72 }
 73 
 74 static inline void enable_gart_translation(struct pci_dev *dev, u64 addr)
 75 {
 76         u32 tmp, ctl;
 77 
 78         /* address of the mappings table */
 79         addr >>= 12;
 80         tmp = (u32) addr<<4;
 81         tmp &= ~0xf;
 82         pci_write_config_dword(dev, AMD64_GARTTABLEBASE, tmp);
 83 
 84         /* Enable GART translation for this hammer. */
 85         pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl);
 86         ctl |= GARTEN | DISTLBWALKPRB;
 87         ctl &= ~(DISGARTCPU | DISGARTIO);
 88         pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl);
 89 }
 90 
 91 static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
 92 {
 93         if (!aper_base)
 94                 return 0;
 95 
 96         if (aper_base + aper_size > 0x100000000ULL) {
 97                 printk(KERN_INFO "Aperture beyond 4GB. Ignoring.\n");
 98                 return 0;
 99         }
100         if (e820__mapped_any(aper_base, aper_base + aper_size, E820_TYPE_RAM)) {
101                 printk(KERN_INFO "Aperture pointing to e820 RAM. Ignoring.\n");
102                 return 0;
103         }
104         if (aper_size < min_size) {
105                 printk(KERN_INFO "Aperture too small (%d MB) than (%d MB)\n",
106                                  aper_size>>20, min_size>>20);
107                 return 0;
108         }
109 
110         return 1;
111 }
112 
113 #endif /* _ASM_X86_GART_H */
114 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php