From patchwork Thu Jul 4 12:25:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 2823301 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E5B979F7D6 for ; Thu, 4 Jul 2013 12:39:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC87920188 for ; Thu, 4 Jul 2013 12:38:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BB7F720181 for ; Thu, 4 Jul 2013 12:38:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C7C66E66D1 for ; Thu, 4 Jul 2013 05:38:58 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ea0-f169.google.com (mail-ea0-f169.google.com [209.85.215.169]) by gabe.freedesktop.org (Postfix) with ESMTP id 3BCFAE6699 for ; Thu, 4 Jul 2013 05:26:51 -0700 (PDT) Received: by mail-ea0-f169.google.com with SMTP id h15so748656eak.14 for ; Thu, 04 Jul 2013 05:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=Pdanxig/Qfu+vlk7BfJUxuFEony71UmUzpLSvNWMmwQ=; b=WPPGcTFiCJYfTQgJNwfjrjbhneAcrBQ3Jwx7s9q1dB07HLklYc21rRTivC1gz1Jaxy DULBdAVeL/yY4Ma99/5S3H9+5wvkwdS3+Dgpq7FPHi+/RT8++Oy7S4Km03otRfmh7JGX 8vD+SVlkzEanWhG+hZDom3fIW/BE9YOGikHtwSm0PxlmYdPPSR2WvGizrVmuO5OZTmTX e7SNbmqWuzkk1nIzGLs/QH+GXL2vSU1Ayzm1UEdYtetQSiP0pqL5cfETgLUmOhstxwwS Kxx9WCqlgzpp+xTpaNdYnI6W7lfXsAS1TkXD0s7O8Q6iliOWYnc8SkaULJgkvDjqocn8 +AxA== X-Received: by 10.14.211.67 with SMTP id v43mr6607586eeo.55.1372940810355; Thu, 04 Jul 2013 05:26:50 -0700 (PDT) Received: from localhost.localdomain (stgt-5f718597.pool.mediaWays.net. [95.113.133.151]) by mx.google.com with ESMTPSA id n5sm4678843eed.9.2013.07.04.05.26.48 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Jul 2013 05:26:49 -0700 (PDT) From: David Herrmann To: linux-kernel@vger.kernel.org Subject: [PATCH v2 14/14] drm/radeon: use new drm_kick_out_firmware() Date: Thu, 4 Jul 2013 14:25:14 +0200 Message-Id: <1372940714-12470-15-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1372940714-12470-1-git-send-email-dh.herrmann@gmail.com> References: <1372940714-12470-1-git-send-email-dh.herrmann@gmail.com> Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Kick out firmware DRM and fbdev drivers via the new drm_kick_out_firmware() before loading radeon. Signed-off-by: David Herrmann --- drivers/gpu/drm/radeon/radeon_drv.c | 28 ---------------------------- drivers/gpu/drm/radeon/radeon_kms.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 094e7e5..8ed3ab3 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -308,37 +308,9 @@ static struct drm_driver driver_old = { static struct drm_driver kms_driver; -static int radeon_kick_out_firmware_fb(struct pci_dev *pdev) -{ - struct apertures_struct *ap; - bool primary = false; - - ap = alloc_apertures(1); - if (!ap) - return -ENOMEM; - - ap->ranges[0].base = pci_resource_start(pdev, 0); - ap->ranges[0].size = pci_resource_len(pdev, 0); - -#ifdef CONFIG_X86 - primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; -#endif - remove_conflicting_framebuffers(ap, "radeondrmfb", primary); - kfree(ap); - - return 0; -} - static int radeon_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { - int ret; - - /* Get rid of things like offb */ - ret = radeon_kick_out_firmware_fb(pdev); - if (ret) - return ret; - return drm_get_pci_dev(pdev, ent, &kms_driver); } diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 4f2d4f4..f199b3c 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -62,6 +62,30 @@ done_free: return 0; } +static int radeon_kick_out_firmware(struct drm_device *dev) +{ + struct pci_dev *pdev = dev->pdev; + struct apertures_struct *ap; + bool primary = false; + + ap = alloc_apertures(1); + if (!ap) + return -ENOMEM; + + ap->ranges[0].base = pci_resource_start(pdev, 0); + ap->ranges[0].size = pci_resource_len(pdev, 0); + +#ifdef CONFIG_X86 + primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; +#endif + + drm_kick_out_firmware(ap, primary); + dev->apertures = ap; + dev->apert_boot = primary; + + return 0; +} + /** * radeon_driver_load_kms - Main load function for KMS. * @@ -86,6 +110,12 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) } dev->dev_private = (void *)rdev; + r = radeon_kick_out_firmware(dev); + if (r) { + kfree(rdev); + return r; + } + /* update BUS flag */ if (drm_pci_device_is_agp(dev)) { flags |= RADEON_IS_AGP;