sys/dev/drm/i915/i915_drv.c
/* Setup MCHBAR if possible, return true if we should disable it again */
Setup MCHBAR if possible, return true if we should disable it again
Setup MCHBAR if possible return true if we should disable it again
static void
intel_setup_mchbar(struct drm_device *dev)
{
	struct drm_i915_private *dev_priv = dev->dev_private;
	int mchbar_reg = INTEL_INFO(dev)->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915;
	u32 temp;
	bool enabled;
	if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev))
		return;
	dev_priv->mchbar_need_disable = false;
	if (IS_I915G(dev) || IS_I915GM(dev)) {
		pci_read_config_dword(dev_priv->bridge_dev, DEVEN, &temp);
		enabled = !!(temp & DEVEN_MCHBAR_EN);
	} else {
		pci_read_config_dword(dev_priv->bridge_dev, mchbar_reg, &temp);
		enabled = temp & 1;
	}
	if (enabled)
		return;
	if (intel_alloc_mchbar_resource(dev))
		return;
	dev_priv->mchbar_need_disable = true;
	if (IS_I915G(dev) || IS_I915GM(dev)) {
		pci_write_config_dword(dev_priv->bridge_dev, DEVEN,
				       temp | DEVEN_MCHBAR_EN);
	} else {
		pci_read_config_dword(dev_priv->bridge_dev, mchbar_reg, &temp);
		pci_write_config_dword(dev_priv->bridge_dev, mchbar_reg, temp | 1);
	}
}
static void intel_setup_mchbar ( struct drm_device * dev ) { struct drm_i915_private * dev_priv = dev -> dev_private ; int mchbar_reg = INTEL_INFO ( dev ) -> gen >= 4 ? MCHBAR_I965 : MCHBAR_I915 ; u32 temp ; bool enabled ; if ( IS_VALLEYVIEW ( dev ) || IS_CHERRYVIEW ( dev ) ) return ; dev_priv -> mchbar_need_disable = false ; if ( IS_I915G ( dev ) || IS_I915GM ( dev ) ) { pci_read_config_dword ( dev_priv -> bridge_dev , DEVEN , & temp ) ; enabled = ! ! ( temp & DEVEN_MCHBAR_EN ) ; } else { pci_read_config_dword ( dev_priv -> bridge_dev , mchbar_reg , & temp ) ; enabled = temp & 1 ; } if ( enabled ) return ; if ( intel_alloc_mchbar_resource ( dev ) ) return ; dev_priv -> mchbar_need_disable = true ; if ( IS_I915G ( dev ) || IS_I915GM ( dev ) ) { pci_write_config_dword ( dev_priv -> bridge_dev , DEVEN , temp | DEVEN_MCHBAR_EN ) ; } else { pci_read_config_dword ( dev_priv -> bridge_dev , mchbar_reg , & temp ) ; pci_write_config_dword ( dev_priv -> bridge_dev , mchbar_reg , temp | 1 ) ; } }
Setup MCHBAR if possible, return true if we should disable it again
Setup MCHBAR if possible return true if we should disable it again
/* If it's already enabled, don't have to do anything */ /* Space is allocated or reserved, so enable it. */