From patchwork Thu Jul 4 12:25:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 2823271 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 61E2ABF4A1 for ; Thu, 4 Jul 2013 12:37:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5704D2017E for ; Thu, 4 Jul 2013 12:37:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4A6352017B for ; Thu, 4 Jul 2013 12:37:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 569C7E66C9 for ; Thu, 4 Jul 2013 05:37:22 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f47.google.com (mail-ee0-f47.google.com [74.125.83.47]) by gabe.freedesktop.org (Postfix) with ESMTP id D08CBE66B2 for ; Thu, 4 Jul 2013 05:26:47 -0700 (PDT) Received: by mail-ee0-f47.google.com with SMTP id e49so732164eek.6 for ; Thu, 04 Jul 2013 05:26:47 -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=EWujJI9fpmqSBpacl7lJOMbhWdbGMBhX6tgFjkEp3CU=; b=Jtv16mgndZhmffn6FahvkVe2U1/7L0T3HyXxvtSzo5/x2n3XC0aKjhTmCE0YyYvmzq Pfc9c/58NX2/iPutxyKYAIuMkZu3iaRwIjs4WMd1bpT5npV1bWVxR94WTGios05X1Ukr I5KAnrJl7livHGBeF1lc5Trx/8uXrCl1cYd+1wWCiex33YEfsDRTJ4YgRTW++OgsNW4R g/tk4dTdPqZf6hLOPJ08296JznSLDRPPkO6pEb4ef/mCU6fCKfo94JcMhfk9bCk10BxV 8aMj2V+FB/3+Mg2ODXOTxHOqsG9qovjmUnHMPDf5A7LS1sTXdmUn8vGD53l5fw7muAJA OSpg== X-Received: by 10.14.203.8 with SMTP id e8mr6374440eeo.96.1372940807057; Thu, 04 Jul 2013 05:26:47 -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.44 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Jul 2013 05:26:46 -0700 (PDT) From: David Herrmann To: linux-kernel@vger.kernel.org Subject: [PATCH v2 12/14] drm: nouveau: kick out firmware drivers during probe Date: Thu, 4 Jul 2013 14:25:12 +0200 Message-Id: <1372940714-12470-13-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 Use the new DRM infrastructure to kick out firmware drivers before probing the real driver. Signed-off-by: David Herrmann --- drivers/gpu/drm/nouveau/nouveau_drm.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 383f4e6..418867f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -233,13 +233,11 @@ nouveau_accel_init(struct nouveau_drm *drm) nouveau_bo_move_init(drm); } -static int nouveau_drm_probe(struct pci_dev *pdev, - const struct pci_device_id *pent) +static int nouveau_kick_out_firmware(struct drm_device *dev) { - struct nouveau_device *device; struct apertures_struct *aper; bool boot = false; - int ret; + struct pci_dev *pdev = dev->pdev; /* remove conflicting drivers (vesafb, efifb etc) */ aper = alloc_apertures(3); @@ -265,8 +263,18 @@ static int nouveau_drm_probe(struct pci_dev *pdev, #ifdef CONFIG_X86 boot = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; #endif - remove_conflicting_framebuffers(aper, "nouveaufb", boot); - kfree(aper); + + drm_kick_out_firmware(aper, boot); + dev->apertures = aper; + dev->apert_boot = boot; + return 0; +} + +static int nouveau_drm_probe(struct pci_dev *pdev, + const struct pci_device_id *pent) +{ + struct nouveau_device *device; + int ret; ret = nouveau_device_create(pdev, nouveau_name(pdev), pci_name(pdev), nouveau_config, nouveau_debug, &device); @@ -294,9 +302,13 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) struct nouveau_drm *drm; int ret; - ret = nouveau_cli_create(pdev, "DRM", sizeof(*drm), (void**)&drm); + ret = nouveau_kick_out_firmware(dev); if (ret) return ret; + + ret = nouveau_cli_create(pdev, "DRM", sizeof(*drm), (void**)&drm); + if (ret) + goto fail_apert; lockdep_set_class(&drm->client.mutex, &drm_client_lock_class_key); dev->dev_private = drm; @@ -392,6 +404,9 @@ fail_ttm: nouveau_vga_fini(drm); fail_device: nouveau_cli_destroy(&drm->client); +fail_apert: + kfree(dev->apertures); + dev->apertures = NULL; return ret; }