Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/815808/?format=api
{ "id": 815808, "url": "http://patchwork.ozlabs.org/api/patches/815808/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170919201808.11433-2-tuomas.tynkkynen@iki.fi/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "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": "<20170919201808.11433-2-tuomas.tynkkynen@iki.fi>", "list_archive_url": null, "date": "2017-09-19T20:18:03", "name": "[U-Boot,v2,1/6] pci: Add helper for implementing memory-mapped config space accesses", "commit_ref": "badb99220a42f88bc823c884e487657bfe734a4d", "pull_url": null, "state": "accepted", "archived": false, "hash": "536b96fd377254dc6db79090bfea222728727a3d", "submitter": { "id": 32296, "url": "http://patchwork.ozlabs.org/api/people/32296/?format=api", "name": "Tuomas Tynkkynen", "email": "tuomas.tynkkynen@iki.fi" }, "delegate": { "id": 3651, "url": "http://patchwork.ozlabs.org/api/users/3651/?format=api", "username": "trini", "first_name": "Tom", "last_name": "Rini", "email": "trini@ti.com" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170919201808.11433-2-tuomas.tynkkynen@iki.fi/mbox/", "series": [ { "id": 3961, "url": "http://patchwork.ozlabs.org/api/series/3961/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=3961", "date": "2017-09-19T20:18:02", "name": "Board for QEMU's '-machine virt' on ARM", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/3961/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/815808/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/815808/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=\"D9sDK25x\"; dkim-atps=neutral" ], "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxZ3J0N56z9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 06:19:23 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid 900C3C21D8D; Tue, 19 Sep 2017 20:18:46 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id F0AB1C21D84;\n\tTue, 19 Sep 2017 20:18:28 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid 6FAC8C21C40; Tue, 19 Sep 2017 20:18:25 +0000 (UTC)", "from mail-lf0-f68.google.com (mail-lf0-f68.google.com\n\t[209.85.215.68])\n\tby lists.denx.de (Postfix) with ESMTPS id 014E5C21C34\n\tfor <u-boot@lists.denx.de>; Tue, 19 Sep 2017 20:18:25 +0000 (UTC)", "by mail-lf0-f68.google.com with SMTP id l196so355761lfl.3\n\tfor <u-boot@lists.denx.de>; Tue, 19 Sep 2017 13:18:24 -0700 (PDT)", "from localhost.localdomain (85-76-68-181-nat.elisa-mobile.fi.\n\t[85.76.68.181]) by smtp.gmail.com with ESMTPSA id\n\ta197sm21154lfe.95.2017.09.19.13.18.23\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 19 Sep 2017 13:18:23 -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=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=1mnxGoP6TkeV9pkO20yAXpSKnV619KC7EbpSMEclnwc=;\n\tb=D9sDK25xqkYyz6qynFLARihOPqcQeQVM3/QaE8AqwWyDt4Ov1xgkzW+KIk5KS38u2f\n\tIjWX3lcqQa3BZaIg2h7w9PS15itFOhZy0x/O0XJPkJrIday5PHi2YcESQvqvmDko1FGr\n\t0KRrCyTQA3dv/CpGUqcxPVmGD8aQo3jAjqPWi9hIrf0WrHbs9UQ1fbECWFDmbPGtkWDr\n\tPbn8aawpSZcK28VbZUB0LPNZX6oHCsGoDrg80PCCJ79pjUxgOy88Jyjs6o12NYIK97XC\n\ti57VoSeXPK7x895MsxwyhtqrazJ/qz2mFe0P0C6NvdHJZGcTvwEGs34gJdiayJEBKnKS\n\tyN6Q==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references;\n\tbh=1mnxGoP6TkeV9pkO20yAXpSKnV619KC7EbpSMEclnwc=;\n\tb=lIDZHfN35NwLSx1qRGv4T1tgStQO9AfI9FP5FZKEYk4Qu12KCCAulLjcM5tf0tNDKm\n\tCjyS/o7+KEoc1CNB1U2P5ptcRiy//6xkKpCigjvnpa22vkklwpaxfv7h60A3IifkMA+l\n\t3NsJWxoloX8/bqtCyvD5VlABnBgCUIUkZwM0tMxLU3zLvXFirIVqhuFPbWyhanHwFi9H\n\tXu2OpYP2UjCDFU5IgD4aq4O+sHpD2JtENV9h5+4y5czxI/4G0IgTKY7ph3vIgxZltXeA\n\tY0tT+bkDbxHiqu1gNqsUmoVYPtCHkRBqcXpKKW01b8lCvMty0/2YqzWKwOiBrFZ++YCl\n\tsdfQ==", "X-Gm-Message-State": "AHPjjUgrq4Gtidq2Ke5kEYEM3ro/EvwnRSp6aW9arjSz40wt9SkPoRBr\n\tsJ6aCd2qExRxZuZKVbHxl5Tf3A==", "X-Google-Smtp-Source": "AOwi7QAgviftgeJXrfh//QHL0OvIx99SpUFchof7EdoDQLCiSvk15No04J2BXRBoWcJ9WXWq7tJB0Q==", "X-Received": "by 10.25.15.98 with SMTP id e95mr1044815lfi.141.1505852304129;\n\tTue, 19 Sep 2017 13:18:24 -0700 (PDT)", "From": "Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>", "To": "u-boot@lists.denx.de", "Date": "Tue, 19 Sep 2017 23:18:03 +0300", "Message-Id": "<20170919201808.11433-2-tuomas.tynkkynen@iki.fi>", "X-Mailer": "git-send-email 2.13.0", "In-Reply-To": "<20170919201808.11433-1-tuomas.tynkkynen@iki.fi>", "References": "<20170919201808.11433-1-tuomas.tynkkynen@iki.fi>", "Cc": "Tom Rini <trini@konsulko.com>", "Subject": "[U-Boot] [PATCH v2 1/6] pci: Add helper for implementing\n\tmemory-mapped config space accesses", "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": "This sort of pattern for implementing memory-mapped PCI config space\naccesses appears in U-Boot twice already, and a third user is coming up.\nSo add helper functions to avoid code duplication, similar to how Linux\nhas pci_generic_config_write and pci_generic_config_read.\n\nSigned-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>\n---\n drivers/pci/pci-uclass.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++\n include/pci.h | 51 ++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 109 insertions(+)", "diff": "diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c\nindex 86df141d60..5a24eb6428 100644\n--- a/drivers/pci/pci-uclass.c\n+++ b/drivers/pci/pci-uclass.c\n@@ -518,6 +518,64 @@ int pci_auto_config_devices(struct udevice *bus)\n \treturn sub_bus;\n }\n \n+int pci_generic_mmap_write_config(\n+\tstruct udevice *bus,\n+\tint (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),\n+\tpci_dev_t bdf,\n+\tuint offset,\n+\tulong value,\n+\tenum pci_size_t size)\n+{\n+\tvoid *address;\n+\n+\tif (addr_f(bus, bdf, offset, &address) < 0)\n+\t\treturn 0;\n+\n+\tswitch (size) {\n+\tcase PCI_SIZE_8:\n+\t\twriteb(value, address);\n+\t\treturn 0;\n+\tcase PCI_SIZE_16:\n+\t\twritew(value, address);\n+\t\treturn 0;\n+\tcase PCI_SIZE_32:\n+\t\twritel(value, address);\n+\t\treturn 0;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+}\n+\n+int pci_generic_mmap_read_config(\n+\tstruct udevice *bus,\n+\tint (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),\n+\tpci_dev_t bdf,\n+\tuint offset,\n+\tulong *valuep,\n+\tenum pci_size_t size)\n+{\n+\tvoid *address;\n+\n+\tif (addr_f(bus, bdf, offset, &address) < 0) {\n+\t\t*valuep = pci_get_ff(size);\n+\t\treturn 0;\n+\t}\n+\n+\tswitch (size) {\n+\tcase PCI_SIZE_8:\n+\t\t*valuep = readb(address);\n+\t\treturn 0;\n+\tcase PCI_SIZE_16:\n+\t\t*valuep = readw(address);\n+\t\treturn 0;\n+\tcase PCI_SIZE_32:\n+\t\t*valuep = readl(address);\n+\t\treturn 0;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+}\n+\n int dm_pci_hose_probe_bus(struct udevice *bus)\n {\n \tint sub_bus;\ndiff --git a/include/pci.h b/include/pci.h\nindex c8ef997d0d..7adc04301c 100644\n--- a/include/pci.h\n+++ b/include/pci.h\n@@ -1086,6 +1086,57 @@ int pci_read_config32(pci_dev_t pcidev, int offset, u32 *valuep);\n int pci_read_config16(pci_dev_t pcidev, int offset, u16 *valuep);\n int pci_read_config8(pci_dev_t pcidev, int offset, u8 *valuep);\n \n+/**\n+ * pci_generic_mmap_write_config() - Generic helper for writing to\n+ * memory-mapped PCI configuration space.\n+ * @bus: Pointer to the PCI bus\n+ * @addr_f: Callback for calculating the config space address\n+ * @bdf: Identifies the PCI device to access\n+ * @offset: The offset into the device's configuration space\n+ * @value: The value to write\n+ * @size: Indicates the size of access to perform\n+ *\n+ * Write the value @value of size @size from offset @offset within the\n+ * configuration space of the device identified by the bus, device & function\n+ * numbers in @bdf on the PCI bus @bus. The callback function @addr_f is\n+ * responsible for calculating the CPU address of the respective configuration\n+ * space offset.\n+ *\n+ * Return: 0 on success, else -EINVAL\n+ */\n+int pci_generic_mmap_write_config(\n+\tstruct udevice *bus,\n+\tint (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),\n+\tpci_dev_t bdf,\n+\tuint offset,\n+\tulong value,\n+\tenum pci_size_t size);\n+\n+/**\n+ * pci_generic_mmap_read_config() - Generic helper for reading from\n+ * memory-mapped PCI configuration space.\n+ * @bus: Pointer to the PCI bus\n+ * @addr_f: Callback for calculating the config space address\n+ * @bdf: Identifies the PCI device to access\n+ * @offset: The offset into the device's configuration space\n+ * @valuep: A pointer at which to store the read value\n+ * @size: Indicates the size of access to perform\n+ *\n+ * Read a value of size @size from offset @offset within the configuration\n+ * space of the device identified by the bus, device & function numbers in @bdf\n+ * on the PCI bus @bus. The callback function @addr_f is responsible for\n+ * calculating the CPU address of the respective configuration space offset.\n+ *\n+ * Return: 0 on success, else -EINVAL\n+ */\n+int pci_generic_mmap_read_config(\n+\tstruct udevice *bus,\n+\tint (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),\n+\tpci_dev_t bdf,\n+\tuint offset,\n+\tulong *valuep,\n+\tenum pci_size_t size);\n+\n #ifdef CONFIG_DM_PCI_COMPAT\n /* Compatibility with old naming */\n static inline int pci_write_config_dword(pci_dev_t pcidev, int offset,\n", "prefixes": [ "U-Boot", "v2", "1/6" ] }