agp/intel: Remove confusion of stolen entries not stolen memory
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
@@ -477,26 +477,17 @@ static const struct aper_size_info_fixed const intel_fake_agp_sizes[] = {
|
|||||||
{512, 131072, 7},
|
{512, 131072, 7},
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned int intel_gtt_stolen_entries(void)
|
static unsigned int intel_gtt_stolen_size(void)
|
||||||
{
|
{
|
||||||
u16 gmch_ctrl;
|
u16 gmch_ctrl;
|
||||||
u8 rdct;
|
u8 rdct;
|
||||||
int local = 0;
|
int local = 0;
|
||||||
static const int ddt[4] = { 0, 16, 32, 64 };
|
static const int ddt[4] = { 0, 16, 32, 64 };
|
||||||
unsigned int overhead_entries;
|
|
||||||
unsigned int stolen_size = 0;
|
unsigned int stolen_size = 0;
|
||||||
|
|
||||||
pci_read_config_word(intel_private.bridge_dev,
|
pci_read_config_word(intel_private.bridge_dev,
|
||||||
I830_GMCH_CTRL, &gmch_ctrl);
|
I830_GMCH_CTRL, &gmch_ctrl);
|
||||||
|
|
||||||
if (INTEL_GTT_GEN > 4 || IS_PINEVIEW)
|
|
||||||
overhead_entries = 0;
|
|
||||||
else
|
|
||||||
overhead_entries = intel_private.base.gtt_mappable_entries
|
|
||||||
/ 1024;
|
|
||||||
|
|
||||||
overhead_entries += 1; /* BIOS popup */
|
|
||||||
|
|
||||||
if (intel_private.bridge_dev->device == PCI_DEVICE_ID_INTEL_82830_HB ||
|
if (intel_private.bridge_dev->device == PCI_DEVICE_ID_INTEL_82830_HB ||
|
||||||
intel_private.bridge_dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) {
|
intel_private.bridge_dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) {
|
||||||
switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
|
switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
|
||||||
@@ -631,7 +622,7 @@ static unsigned int intel_gtt_stolen_entries(void)
|
|||||||
stolen_size = 0;
|
stolen_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return stolen_size/KB(4) - overhead_entries;
|
return stolen_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void i965_adjust_pgetbl_size(unsigned int size_flag)
|
static void i965_adjust_pgetbl_size(unsigned int size_flag)
|
||||||
@@ -817,8 +808,8 @@ static int intel_gtt_init(void)
|
|||||||
global_cache_flush(); /* FIXME: ? */
|
global_cache_flush(); /* FIXME: ? */
|
||||||
|
|
||||||
/* we have to call this as early as possible after the MMIO base address is known */
|
/* we have to call this as early as possible after the MMIO base address is known */
|
||||||
intel_private.base.gtt_stolen_entries = intel_gtt_stolen_entries();
|
intel_private.base.stolen_size = intel_gtt_stolen_size();
|
||||||
if (intel_private.base.gtt_stolen_entries == 0) {
|
if (intel_private.base.stolen_size == 0) {
|
||||||
intel_private.driver->cleanup();
|
intel_private.driver->cleanup();
|
||||||
iounmap(intel_private.registers);
|
iounmap(intel_private.registers);
|
||||||
iounmap(intel_private.gtt);
|
iounmap(intel_private.gtt);
|
||||||
@@ -1006,8 +997,7 @@ static int intel_fake_agp_configure(void)
|
|||||||
|
|
||||||
agp_bridge->gart_bus_addr = intel_private.gma_bus_addr;
|
agp_bridge->gart_bus_addr = intel_private.gma_bus_addr;
|
||||||
|
|
||||||
for (i = intel_private.base.gtt_stolen_entries;
|
for (i = 0; i < intel_private.base.gtt_total_entries; i++) {
|
||||||
i < intel_private.base.gtt_total_entries; i++) {
|
|
||||||
intel_private.driver->write_entry(intel_private.scratch_page_dma,
|
intel_private.driver->write_entry(intel_private.scratch_page_dma,
|
||||||
i, 0);
|
i, 0);
|
||||||
}
|
}
|
||||||
@@ -1065,17 +1055,7 @@ static int intel_fake_agp_insert_entries(struct agp_memory *mem,
|
|||||||
if (mem->page_count == 0)
|
if (mem->page_count == 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (pg_start < intel_private.base.gtt_stolen_entries) {
|
if (pg_start + mem->page_count > intel_private.base.gtt_total_entries)
|
||||||
dev_printk(KERN_DEBUG, &intel_private.pcidev->dev,
|
|
||||||
"pg_start == 0x%.8lx, gtt_stolen_entries == 0x%.8x\n",
|
|
||||||
pg_start, intel_private.base.gtt_stolen_entries);
|
|
||||||
|
|
||||||
dev_info(&intel_private.pcidev->dev,
|
|
||||||
"trying to insert into local/stolen memory\n");
|
|
||||||
goto out_err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((pg_start + mem->page_count) > intel_private.base.gtt_total_entries)
|
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
if (type != mem->type)
|
if (type != mem->type)
|
||||||
@@ -1118,12 +1098,6 @@ static int intel_fake_agp_remove_entries(struct agp_memory *mem,
|
|||||||
if (mem->page_count == 0)
|
if (mem->page_count == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (pg_start < intel_private.base.gtt_stolen_entries) {
|
|
||||||
dev_info(&intel_private.pcidev->dev,
|
|
||||||
"trying to disable local/stolen memory\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (USE_PCI_DMA_API && INTEL_GTT_GEN > 2)
|
if (USE_PCI_DMA_API && INTEL_GTT_GEN > 2)
|
||||||
intel_agp_unmap_memory(mem);
|
intel_agp_unmap_memory(mem);
|
||||||
|
|
||||||
@@ -1629,7 +1603,7 @@ int intel_gmch_probe(struct pci_dev *pdev,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(intel_gmch_probe);
|
EXPORT_SYMBOL(intel_gmch_probe);
|
||||||
|
|
||||||
struct intel_gtt *intel_gtt_get(void)
|
const struct intel_gtt *intel_gtt_get(void)
|
||||||
{
|
{
|
||||||
return &intel_private.base;
|
return &intel_private.base;
|
||||||
}
|
}
|
||||||
|
@@ -1044,7 +1044,7 @@ static unsigned long i915_stolen_to_phys(struct drm_device *dev, u32 offset)
|
|||||||
pci_read_config_byte(pdev, 0x9c, &val);
|
pci_read_config_byte(pdev, 0x9c, &val);
|
||||||
base = val >> 3 << 27;
|
base = val >> 3 << 27;
|
||||||
}
|
}
|
||||||
base -= dev_priv->mm.gtt->gtt_stolen_entries << PAGE_SHIFT;
|
base -= dev_priv->mm.gtt->stolen_size;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return base + offset;
|
return base + offset;
|
||||||
@@ -1168,7 +1168,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
|
|||||||
unsigned long prealloc_size, gtt_size, mappable_size;
|
unsigned long prealloc_size, gtt_size, mappable_size;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
prealloc_size = dev_priv->mm.gtt->gtt_stolen_entries << PAGE_SHIFT;
|
prealloc_size = dev_priv->mm.gtt->stolen_size;
|
||||||
gtt_size = dev_priv->mm.gtt->gtt_total_entries << PAGE_SHIFT;
|
gtt_size = dev_priv->mm.gtt->gtt_total_entries << PAGE_SHIFT;
|
||||||
mappable_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT;
|
mappable_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT;
|
||||||
|
|
||||||
|
@@ -542,7 +542,7 @@ typedef struct drm_i915_private {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
/** Bridge to intel-gtt-ko */
|
/** Bridge to intel-gtt-ko */
|
||||||
struct intel_gtt *gtt;
|
const struct intel_gtt *gtt;
|
||||||
/** Memory allocator for GTT stolen memory */
|
/** Memory allocator for GTT stolen memory */
|
||||||
struct drm_mm stolen;
|
struct drm_mm stolen;
|
||||||
/** Memory allocator for GTT */
|
/** Memory allocator for GTT */
|
||||||
|
@@ -2,17 +2,16 @@
|
|||||||
|
|
||||||
#ifndef _DRM_INTEL_GTT_H
|
#ifndef _DRM_INTEL_GTT_H
|
||||||
#define _DRM_INTEL_GTT_H
|
#define _DRM_INTEL_GTT_H
|
||||||
struct intel_gtt {
|
|
||||||
/* Number of stolen gtt entries at the beginning. */
|
const struct intel_gtt {
|
||||||
unsigned int gtt_stolen_entries;
|
/* Size of memory reserved for graphics by the BIOS */
|
||||||
|
unsigned int stolen_size;
|
||||||
/* Total number of gtt entries. */
|
/* Total number of gtt entries. */
|
||||||
unsigned int gtt_total_entries;
|
unsigned int gtt_total_entries;
|
||||||
/* Part of the gtt that is mappable by the cpu, for those chips where
|
/* Part of the gtt that is mappable by the cpu, for those chips where
|
||||||
* this is not the full gtt. */
|
* this is not the full gtt. */
|
||||||
unsigned int gtt_mappable_entries;
|
unsigned int gtt_mappable_entries;
|
||||||
};
|
} *intel_gtt_get(void);
|
||||||
|
|
||||||
struct intel_gtt *intel_gtt_get(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user