{"id":804520,"url":"http://patchwork.ozlabs.org/api/1.2/patches/804520/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1503414919-30820-3-git-send-email-bmeng.cn@gmail.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1503414919-30820-3-git-send-email-bmeng.cn@gmail.com>","list_archive_url":null,"date":"2017-08-22T15:15:07","name":"[U-Boot,02/14] nvme: Fix getting PCI vendor id of the NVMe block device","commit_ref":"e5dc2d266539786730eab6cac3c3e26dcb8abc87","pull_url":null,"state":"accepted","archived":false,"hash":"b3e06a43d4ac84f205c3d8f8e10441ad253db9ac","submitter":{"id":64981,"url":"http://patchwork.ozlabs.org/api/1.2/people/64981/?format=json","name":"Bin Meng","email":"bmeng.cn@gmail.com"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/1.2/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1503414919-30820-3-git-send-email-bmeng.cn@gmail.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/804520/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/804520/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"rPNzrNGJ\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xcDbk1RjDz9sRm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 23 Aug 2017 01:13:54 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid AF628C21EC2; Tue, 22 Aug 2017 15:12:02 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 390F5C21F04;\n\tTue, 22 Aug 2017 15:11:20 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 5CDDCC21EE0; Tue, 22 Aug 2017 15:11:04 +0000 (UTC)","from mail-it0-f67.google.com (mail-it0-f67.google.com\n\t[209.85.214.67])\n\tby lists.denx.de (Postfix) with ESMTPS id B3186C21E8E\n\tfor <u-boot@lists.denx.de>; Tue, 22 Aug 2017 15:11:00 +0000 (UTC)","by mail-it0-f67.google.com with SMTP id s132so11800278ita.1\n\tfor <u-boot@lists.denx.de>; Tue, 22 Aug 2017 08:11:00 -0700 (PDT)","from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com.\n\t[147.11.156.139]) by smtp.gmail.com with ESMTPSA id\n\ta189sm5182572itd.5.2017.08.22.08.10.57\n\t(version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tTue, 22 Aug 2017 08:10:58 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID\n\tautolearn=unavailable autolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:subject:date:message-id:in-reply-to:references;\n\tbh=TU9Rfp81U87aiyPO8B5AyjJaIOLwcoBdBfZObjietQE=;\n\tb=rPNzrNGJTIs5AmLnfrnJPnaiDoVUvrpOpeFdD1EORG8rYO2k8mD8l/lPEpxGMlPclT\n\teq8RmsRohnHZJ/iHTGZsGtGQvsFHrL2kDuYGmns+E5qJUC5Wus1j/UUUeTwm92dj0W4k\n\t/a5UQ/uxXcoUCvrN+wKnuZghDZlTWz7lBCI6qAmDEiZd2W4nkQ/qA6XS4I9x3QCNoGJY\n\tA1hJYmcfWZgVloH6i0cAI/rEV/vVFe9+cnr1fR+/IEFOD++hc9+2fVnL5OQGhf3RlPli\n\tSnSPTwP16Vc7HEFqu5gqofjysp5PbyQxd/UkHYNVsy4qpA7EYIbNwtITfuRainSZQpBX\n\t8DCQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=TU9Rfp81U87aiyPO8B5AyjJaIOLwcoBdBfZObjietQE=;\n\tb=nELRIxfp2xzknqSZQGUALXnrNwRCGVT2q2nVz1Q6WFyMgu9xK8H8gsbgWllth57fZt\n\t6tsZ5QbV6yNn9bOThhOTkMN1RSdahkc3aXDucXgDlpsEtAZW6DJ/DbGrG3gfHnxRxjHN\n\t+UzA4Y0upZdz9ZJmdhLQ0gdWLLbhO4bo6Iqgrpy7YNOCMpyNeYmCyQEiddXVRLvpZeVG\n\t+UigOIORz4aA9IT8H+44bZb3VnpKkb1V9pxaNpOPyeHiBVpEek31qncCaf+1WEbNhnb6\n\tdo4VIQleex3d/i9mObUZcUNil/Zz4HDQzAswOzNLOPeOrTsbAlB5qjopvSnhZYhuvo9J\n\tUdQw==","X-Gm-Message-State":"AHYfb5hjuVPfBV8dugtT26J+TGRg7AT4GCXTpYVNd0NRaiUWVdfQYngj\n\trLxMIKnM1pC1KJVL","X-Received":"by 10.36.50.150 with SMTP id j144mr185262ita.91.1503414659647;\n\tTue, 22 Aug 2017 08:10:59 -0700 (PDT)","From":"Bin Meng <bmeng.cn@gmail.com>","To":"Tom Rini <trini@konsulko.com>, U-Boot Mailing List <u-boot@lists.denx.de>","Date":"Tue, 22 Aug 2017 08:15:07 -0700","Message-Id":"<1503414919-30820-3-git-send-email-bmeng.cn@gmail.com>","X-Mailer":"git-send-email 1.7.9.5","In-Reply-To":"<1503414919-30820-1-git-send-email-bmeng.cn@gmail.com>","References":"<1503414919-30820-1-git-send-email-bmeng.cn@gmail.com>","Subject":"[U-Boot] [PATCH 02/14] nvme: Fix getting PCI vendor id of the NVMe\n\tblock device","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"The codes currently try to read PCI vendor id of the NVMe block\ndevice by dm_pci_read_config16() with its parameter set as its\nroot complex controller (ndev->pdev) instead of itself. This is\nseriously wrong. We can read the vendor id by passing the correct\nudevice parameter to the dm_pci_read_config16() API, however there\nis a shortcut by reading the cached vendor id from the PCI device's\nstruct pci_child_platdata.\n\nWhile we are here fixing this bug, apparently the quirk stuff handle\ncodes in nvme_get_info_from_identify() never takes effect since its\nlogic has never been true at all. Remove these codes completely.\n\nSigned-off-by: Bin Meng <bmeng.cn@gmail.com>\n---\n\n drivers/nvme/nvme.c | 24 +++---------------------\n drivers/nvme/nvme.h |  1 -\n 2 files changed, 3 insertions(+), 22 deletions(-)","diff":"diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c\nindex 151fe92..2ac0870 100644\n--- a/drivers/nvme/nvme.c\n+++ b/drivers/nvme/nvme.c\n@@ -547,7 +547,6 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)\n \n static int nvme_get_info_from_identify(struct nvme_dev *dev)\n {\n-\tu16 vendor, device;\n \tstruct nvme_id_ctrl buf, *ctrl = &buf;\n \tint ret;\n \tint shift = NVME_CAP_MPSMIN(nvme_readq(&dev->bar->cap)) + 12;\n@@ -585,22 +584,6 @@ static int nvme_get_info_from_identify(struct nvme_dev *dev)\n \t\tdev->max_transfer_shift = 20;\n \t}\n \n-\t/* Apply quirk stuff */\n-\tdm_pci_read_config16(dev->pdev, PCI_VENDOR_ID, &vendor);\n-\tdm_pci_read_config16(dev->pdev, PCI_DEVICE_ID, &device);\n-\tif ((vendor == PCI_VENDOR_ID_INTEL) &&\n-\t    (device == 0x0953) && ctrl->vs[3]) {\n-\t\tunsigned int max_transfer_shift;\n-\t\tdev->stripe_size = (ctrl->vs[3] + shift);\n-\t\tmax_transfer_shift = (ctrl->vs[3] + 18);\n-\t\tif (dev->max_transfer_shift) {\n-\t\t\tdev->max_transfer_shift = min(max_transfer_shift,\n-\t\t\t\t\t\t      dev->max_transfer_shift);\n-\t\t} else {\n-\t\t\tdev->max_transfer_shift = max_transfer_shift;\n-\t\t}\n-\t}\n-\n \treturn 0;\n }\n \n@@ -629,8 +612,8 @@ static int nvme_blk_probe(struct udevice *udev)\n \tstruct blk_desc *desc = dev_get_uclass_platdata(udev);\n \tstruct nvme_ns *ns = dev_get_priv(udev);\n \tu8 flbas;\n-\tu16 vendor;\n \tstruct nvme_id_ns buf, *id = &buf;\n+\tstruct pci_child_platdata *pplat;\n \n \tmemset(ns, 0, sizeof(*ns));\n \tns->dev = ndev;\n@@ -649,8 +632,8 @@ static int nvme_blk_probe(struct udevice *udev)\n \tdesc->log2blksz = ns->lba_shift;\n \tdesc->blksz = 1 << ns->lba_shift;\n \tdesc->bdev = udev;\n-\tdm_pci_read_config16(ndev->pdev, PCI_VENDOR_ID, &vendor);\n-\tsprintf(desc->vendor, \"0x%.4x\", vendor);\n+\tpplat = dev_get_parent_platdata(udev->parent);\n+\tsprintf(desc->vendor, \"0x%.4x\", pplat->vendor);\n \tmemcpy(desc->product, ndev->serial, sizeof(ndev->serial));\n \tmemcpy(desc->revision, ndev->firmware_rev, sizeof(ndev->firmware_rev));\n \tpart_init(desc);\n@@ -791,7 +774,6 @@ static int nvme_probe(struct udevice *udev)\n \tstruct nvme_dev *ndev = dev_get_priv(udev);\n \tu64 cap;\n \n-\tndev->pdev = pci_get_controller(udev);\n \tndev->instance = trailing_strtol(udev->name);\n \n \tINIT_LIST_HEAD(&ndev->namespaces);\ndiff --git a/drivers/nvme/nvme.h b/drivers/nvme/nvme.h\nindex 267884e..cd411be 100644\n--- a/drivers/nvme/nvme.h\n+++ b/drivers/nvme/nvme.h\n@@ -608,7 +608,6 @@ struct nvme_dev {\n \tstruct list_head node;\n \tstruct nvme_queue **queues;\n \tu32 __iomem *dbs;\n-\tstruct udevice *pdev;\n \tint instance;\n \tunsigned queue_count;\n \tunsigned online_queues;\n","prefixes":["U-Boot","02/14"]}