From patchwork Sun Sep 1 13:36:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 2852563 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 C43F29F313 for ; Sun, 1 Sep 2013 13:42:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F3F19202A7 for ; Sun, 1 Sep 2013 13:42:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D3217202A1 for ; Sun, 1 Sep 2013 13:41:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A56BDE6503 for ; Sun, 1 Sep 2013 06:41:59 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ea0-f171.google.com (mail-ea0-f171.google.com [209.85.215.171]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C95CE60A0 for ; Sun, 1 Sep 2013 06:37:07 -0700 (PDT) Received: by mail-ea0-f171.google.com with SMTP id n15so1820931ead.30 for ; Sun, 01 Sep 2013 06:37:07 -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:in-reply-to:references; bh=9AVfd6ALOhRThARXxqzM6Ul26kyH7QKHx8YEtM2mQV8=; b=qHQ654zAakSC+MRCx2Io7VX1j+OdglChHEq+W9+9dsduUFmpq6UhTr6S03ND4EcpMD NMhiK4grVw2/NUOLHdEINtVkyTdWVY4vZSMg4utZ/8ouskB+4WWZdpTzY4DwH4Bc2FMz ngUyXIUeotPceQrgBdAbLQuL7w2HuWeLcyVEV7VJAdc6ZaarPFd5vbz0ABJIxE4zO//v cC5ffEMQhBDTnMbGrp4YUykkDRax7HIL7ogwt0uKc2t2vLM1hTuhiVrLNH2sCaVt+6T4 f3paeP3Rz2U+/Oud3qovGMiVz5ngWPZE5VKm7AwtBV/OEXzs+4M4fgMyQPrTwdpgFnFo V4+A== X-Received: by 10.14.88.65 with SMTP id z41mr28455526eee.38.1378042627338; Sun, 01 Sep 2013 06:37:07 -0700 (PDT) Received: from localhost.localdomain (stgt-5f719c52.pool.mediaWays.net. [95.113.156.82]) by mx.google.com with ESMTPSA id r48sm13381024eev.14.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 01 Sep 2013 06:37:06 -0700 (PDT) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [PATCH v4 4/6] drm: nouveau: kick out firmware drivers during probe Date: Sun, 1 Sep 2013 15:36:50 +0200 Message-Id: <1378042612-5354-5-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1378042612-5354-1-git-send-email-dh.herrmann@gmail.com> References: <1378042612-5354-1-git-send-email-dh.herrmann@gmail.com> Cc: Ben Skeggs 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=-6.5 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. Cc: Maarten Lankhorst Cc: Ben Skeggs 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 62c6118..452cc21 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -252,13 +252,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); @@ -284,8 +282,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); @@ -336,10 +344,14 @@ 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; + dev->dev_private = drm; drm->dev = dev; @@ -444,6 +456,9 @@ fail_ttm: nouveau_vga_fini(drm); fail_device: nouveau_cli_destroy(&drm->client); +fail_apert: + kfree(dev->apertures); + dev->apertures = NULL; return ret; }