Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/drm2/i915/i915_gem_gtt.c
Show First 20 Lines • Show All 643 Lines • ▼ Show 20 Lines | static inline unsigned int gen7_get_stolen_size(u16 snb_gmch_ctl) | ||||
return stolen_decoder[snb_gmch_ctl] << 20; | return stolen_decoder[snb_gmch_ctl] << 20; | ||||
} | } | ||||
int i915_gem_gtt_init(struct drm_device *dev) | int i915_gem_gtt_init(struct drm_device *dev) | ||||
{ | { | ||||
struct drm_i915_private *dev_priv = dev->dev_private; | struct drm_i915_private *dev_priv = dev->dev_private; | ||||
vm_paddr_t gtt_bus_addr; | vm_paddr_t gtt_bus_addr; | ||||
u16 snb_gmch_ctl; | u16 snb_gmch_ctl; | ||||
struct intel_gtt *gtt; | |||||
int ret; | int ret; | ||||
/* On modern platforms we need not worry ourself with the legacy | /* On modern platforms we need not worry ourself with the legacy | ||||
* hostbridge query stuff. Skip it entirely | * hostbridge query stuff. Skip it entirely | ||||
*/ | */ | ||||
gtt = dev_priv->mm.gtt = malloc(sizeof(*dev_priv->mm.gtt), DRM_I915_GEM, M_WAITOK | M_ZERO); | |||||
if (INTEL_INFO(dev)->gen < 6) { | if (INTEL_INFO(dev)->gen < 6) { | ||||
size_t gtt_total, stolen_size; | |||||
unsigned long mappable_end; | |||||
#ifdef FREEBSD_WIP | #ifdef FREEBSD_WIP | ||||
ret = intel_gmch_probe(dev_priv->bridge_dev, dev->pdev, NULL); | ret = intel_gmch_probe(dev_priv->bridge_dev, dev->pdev, NULL); | ||||
if (!ret) { | if (!ret) { | ||||
DRM_ERROR("failed to set up gmch\n"); | DRM_ERROR("failed to set up gmch\n"); | ||||
return -EIO; | return -EIO; | ||||
} | } | ||||
#endif /* FREEBSD_WIP */ | #endif /* FREEBSD_WIP */ | ||||
dev_priv->mm.gtt = intel_gtt_get(); | intel_gtt_get(>t_total, &stolen_size, >t->gma_bus_addr, &mappable_end); | ||||
gtt->gtt_total_entries = gtt_total; | |||||
gtt->stolen_size = stolen_size; | |||||
gtt->gtt_mappable_entries = mappable_endi >> PAGE_SHIFT; | |||||
if (!dev_priv->mm.gtt) { | if (!dev_priv->mm.gtt) { | ||||
DRM_ERROR("Failed to initialize GTT\n"); | DRM_ERROR("Failed to initialize GTT\n"); | ||||
#ifdef FREEBSD_WIP | #ifdef FREEBSD_WIP | ||||
intel_gmch_remove(); | intel_gmch_remove(); | ||||
#endif /* FREEBSD_WIP */ | #endif /* FREEBSD_WIP */ | ||||
return -ENODEV; | return -ENODEV; | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
dev_priv->mm.gtt = malloc(sizeof(*dev_priv->mm.gtt), DRM_I915_GEM, M_WAITOK | M_ZERO); | |||||
if (!dev_priv->mm.gtt) | |||||
return -ENOMEM; | |||||
#ifdef FREEBSD_WIP | #ifdef FREEBSD_WIP | ||||
if (!pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(40))) | if (!pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(40))) | ||||
pci_set_consistent_dma_mask(dev->pdev, DMA_BIT_MASK(40)); | pci_set_consistent_dma_mask(dev->pdev, DMA_BIT_MASK(40)); | ||||
#endif /* FREEBSD_WIP */ | #endif /* FREEBSD_WIP */ | ||||
#ifdef CONFIG_INTEL_IOMMU | #ifdef CONFIG_INTEL_IOMMU | ||||
dev_priv->mm.gtt->needs_dmar = 1; | dev_priv->mm.gtt->needs_dmar = 1; | ||||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |