From: liudongdong3@huawei•com (liudongdong (C))
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH V6 11/13] pci, acpi: Match PCI config space accessors against platfrom specific quirks.
Date: Mon, 18 Apr 2016 19:37:26 +0800 [thread overview]
Message-ID: <5714C6F6.8050600@huawei.com> (raw)
In-Reply-To: <1460740008-19489-12-git-send-email-tn@semihalf.com>
Hi Tomasz
I merged my patchset to branch topci-acpi-v6.
The patchset is used for Hisilicon DO2 PCIe ACPI support.
I found some compile errors. The log as below.
drivers/pci/host/pcie-hisi-acpi.c: In function 'hisi_pcie_init':
drivers/pci/host/pcie-hisi-acpi.c:130:6: error: 'struct acpi_pci_root' has no member named 'sysdata'
root->sysdata = reg_base;
In your PATCH V5, add "sysdata" for strcut acpi_pci_root, but PATCH V6 has not add it.
In my patch, I used root->sysdata which will be available along read/write accessor.
I want to know the reason this v6 patchset does not add "sysdata". I need this.
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 14362a8..0fc6f13 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -556,6 +556,7 @@ struct acpi_pci_root {
struct pci_bus *bus;
u16 segment;
struct resource secondary; /* downstream bus range */
+ void *sysdata;
u32 osc_support_set; /* _OSC state of support bits */
u32 osc_control_set; /* _OSC state of control bits */
Thanks
Dongdong
? 2016/4/16 1:06, Tomasz Nowicki ??:
> Some platforms may not be fully compliant with generic set of PCI config
> accessors. For these cases we implement the way to overwrite accessors
> set prior to PCI buses enumeration. Algorithm traverses available quirk
> list, matches against <DMI ID (optional), domain, bus number> tuple and
> an extra match call and returns corresponding PCI config ops.
> All quirks can be defined using:
> DECLARE_ACPI_MCFG_FIXUP() macro and kept self contained. Example:
>
> /* Additional DMI platform identification (optional) */
> static const struct dmi_system_id foo_dmi[] = {
> {
> .ident = "<Platform ident string>",
> .matches = {
> DMI_MATCH(DMI_SYS_VENDOR, "<system vendor>"),
> DMI_MATCH(DMI_PRODUCT_NAME, "<product name>"),
> DMI_MATCH(DMI_PRODUCT_VERSION, "product version"),
> },
> },
> { }
> };
>
> /* Custom PCI config ops */
> static struct pci_generic_ecam_ops foo_pci_ops = {
> .bus_shift = 24,
> .pci_ops = {
> .map_bus = pci_mcfg_dev_base,
> .read = foo_ecam_config_read,
> .write = foo_ecam_config_write,
> }
> };
>
> static int foo_match(struct pci_mcfg_fixup *fixup, struct acpi_pci_root *root)
> {
> if (additional platform identification)
> return true;
> return false;
> }
>
> DECLARE_ACPI_MCFG_FIXUP(foo_dmi, foo_init, &foo_root_ops, <domain_nr>, <bus_nr>);
>
> Signed-off-by: Tomasz Nowicki <tn@semihalf•com>
> ---
> drivers/acpi/pci_gen_host.c | 30 +++++++++++++++++++++++++++++-
> include/asm-generic/vmlinux.lds.h | 7 +++++++
> include/linux/pci-acpi.h | 18 ++++++++++++++++++
> 3 files changed, 54 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/pci_gen_host.c b/drivers/acpi/pci_gen_host.c
> index fd360b5..e55dfca 100644
> --- a/drivers/acpi/pci_gen_host.c
> +++ b/drivers/acpi/pci_gen_host.c
> @@ -11,6 +11,8 @@
> * You should have received a copy of the GNU General Public License
> * version 2 (GPLv2) along with this source code.
> */
> +
> +#include <linux/dmi.h>
> #include <linux/kernel.h>
> #include <linux/pci.h>
> #include <linux/pci-acpi.h>
> @@ -54,6 +56,32 @@ static struct mcfg_entry *pci_mcfg_lookup(u16 seg, u8 bus_start)
> return NULL;
> }
>
> +extern struct pci_cfg_fixup __start_acpi_mcfg_fixups[];
> +extern struct pci_cfg_fixup __end_acpi_mcfg_fixups[];
> +
> +static struct pci_generic_ecam_ops *pci_acpi_get_ops(struct acpi_pci_root *root)
> +{
> + int bus_num = root->secondary.start;
> + int domain = root->segment;
> + struct pci_cfg_fixup *f;
> +
> + /*
> + * Match against platform specific quirks and return corresponding
> + * CAM ops.
> + *
> + * First match against PCI topology <domain:bus> then use DMI or
> + * custom match handler.
> + */
> + for (f = __start_acpi_mcfg_fixups; f < __end_acpi_mcfg_fixups; f++) {
> + if ((f->domain == domain || f->domain == PCI_MCFG_DOMAIN_ANY) &&
> + (f->bus_num == bus_num || f->bus_num == PCI_MCFG_BUS_ANY) &&
> + (f->system ? dmi_check_system(f->system) : 1) &&
> + (f->match ? f->match(f, root) : 1))
> + return f->ops;
> + }
> + /* No quirks, use ECAM */
> + return &pci_generic_ecam_default_ops;
> +}
>
> /*
> * Lookup the bus range for the domain in MCFG, and set up config space
> @@ -95,7 +123,7 @@ static int pci_acpi_setup_ecam_mapping(struct acpi_pci_root *root,
> }
>
> cfg = pci_generic_ecam_create(&root->device->dev, addr, bus_start,
> - bus_end, &pci_generic_ecam_default_ops);
> + bus_end, pci_acpi_get_ops(root));
> if (IS_ERR(cfg)) {
> err = PTR_ERR(cfg);
> pr_err("%04x:%02x-%02x error %d mapping CAM\n", seg,
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 339125b..c53b6b7 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -298,6 +298,13 @@
> VMLINUX_SYMBOL(__end_pci_fixups_suspend_late) = .; \
> } \
> \
> + /* ACPI MCFG quirks */ \
> + .acpi_fixup : AT(ADDR(.acpi_fixup) - LOAD_OFFSET) { \
> + VMLINUX_SYMBOL(__start_acpi_mcfg_fixups) = .; \
> + *(.acpi_fixup_mcfg) \
> + VMLINUX_SYMBOL(__end_acpi_mcfg_fixups) = .; \
> + } \
> + \
> /* Built-in firmware blobs */ \
> .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
> VMLINUX_SYMBOL(__start_builtin_fw) = .; \
> diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
> index a72e22d..9545988 100644
> --- a/include/linux/pci-acpi.h
> +++ b/include/linux/pci-acpi.h
> @@ -71,6 +71,24 @@ struct acpi_pci_root_ops {
> int (*prepare_resources)(struct acpi_pci_root_info *info);
> };
>
> +struct pci_cfg_fixup {
> + const struct dmi_system_id *system;
> + bool (*match)(struct pci_cfg_fixup *, struct acpi_pci_root *);
> + struct pci_generic_ecam_ops *ops;
> + int domain;
> + int bus_num;
> +};
> +
> +#define PCI_MCFG_DOMAIN_ANY -1
> +#define PCI_MCFG_BUS_ANY -1
> +
> +/* Designate a routine to fix up buggy MCFG */
> +#define DECLARE_ACPI_MCFG_FIXUP(system, match, ops, dom, bus) \
> + static const struct pci_cfg_fixup __mcfg_fixup_##system##dom##bus\
> + __used __attribute__((__section__(".acpi_fixup_mcfg"), \
> + aligned((sizeof(void *))))) = \
> + { system, match, ops, dom, bus };
> +
> extern int acpi_pci_probe_root_resources(struct acpi_pci_root_info *info);
> extern struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
> struct acpi_pci_root_ops *ops,
>
next prev parent reply other threads:[~2016-04-18 11:37 UTC|newest]
Thread overview: 105+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-15 17:06 [PATCH V6 00/13] Support for generic ACPI based PCI host controller Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 01/13] pci, acpi, x86, ia64: Move ACPI host bridge device companion assignment to core code Tomasz Nowicki
2016-04-15 20:41 ` kbuild test robot
2016-04-26 22:36 ` Bjorn Helgaas
2016-04-27 10:12 ` Tomasz Nowicki
2016-04-27 2:45 ` Bjorn Helgaas
2016-05-04 8:10 ` Tomasz Nowicki
2016-05-09 22:18 ` Rafael J. Wysocki
2016-05-10 10:27 ` Lorenzo Pieralisi
2016-05-09 22:56 ` Rafael J. Wysocki
2016-05-10 1:53 ` Bjorn Helgaas
2016-05-10 10:07 ` Lorenzo Pieralisi
2016-04-15 17:06 ` [PATCH V6 02/13] pci, acpi: Provide generic way to assign bus domain number Tomasz Nowicki
2016-04-27 2:26 ` Bjorn Helgaas
2016-04-27 11:17 ` Lorenzo Pieralisi
2016-04-27 16:44 ` Bjorn Helgaas
2016-04-27 17:31 ` Lorenzo Pieralisi
2016-04-28 8:13 ` Liviu.Dudau at arm.com
2016-04-28 15:12 ` Bjorn Helgaas
2016-04-28 15:34 ` Arnd Bergmann
2016-04-29 22:50 ` Arnd Bergmann
2016-05-02 12:43 ` Tomasz Nowicki
2016-05-02 13:26 ` Jayachandran C
2016-05-03 11:02 ` Lorenzo Pieralisi
2016-05-03 14:22 ` Jayachandran C
2016-05-03 14:55 ` Lorenzo Pieralisi
2016-04-27 11:59 ` Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 03/13] x86, ia64: Include acpi_pci_{add|remove}_bus to the default pcibios_{add|remove}_bus implementation Tomasz Nowicki
2016-04-27 2:34 ` Bjorn Helgaas
2016-04-27 13:19 ` Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 04/13] pci, of: Move the PCI I/O space management to PCI core code Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 05/13] acpi, pci: Support IO resources when parsing PCI host bridge resources Tomasz Nowicki
2016-04-27 2:39 ` Bjorn Helgaas
2016-04-27 5:36 ` Jon Masters
2016-04-28 21:53 ` Jon Masters
2016-04-27 14:26 ` Lorenzo Pieralisi
2016-04-27 15:10 ` Liviu.Dudau at arm.com
2016-04-27 16:09 ` Lorenzo Pieralisi
2016-04-28 15:45 ` Bjorn Helgaas
2016-04-15 17:06 ` [PATCH V6 06/13] arm64, pci, acpi: ACPI support for legacy IRQs parsing and consolidation with DT code Tomasz Nowicki
2016-04-27 2:44 ` Bjorn Helgaas
2016-04-27 11:46 ` Lorenzo Pieralisi
2016-04-15 17:06 ` [PATCH V6 07/13] PCI: Provide common functions for ECAM mapping Tomasz Nowicki
2016-04-15 18:41 ` Arnd Bergmann
2016-04-28 21:47 ` Bjorn Helgaas
2016-04-29 8:01 ` Jayachandran C
2016-05-05 9:24 ` Jayachandran C
2016-05-05 10:38 ` Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 08/13] PCI: generic, thunder: update to use generic ECAM API Tomasz Nowicki
2016-04-15 18:39 ` Arnd Bergmann
2016-04-16 7:20 ` Jayachandran C
2016-04-16 7:31 ` Arnd Bergmann
2016-04-16 14:36 ` Jayachandran C
2016-04-18 13:03 ` Tomasz Nowicki
2016-04-18 14:44 ` Arnd Bergmann
2016-04-18 19:31 ` Tomasz Nowicki
2016-04-19 13:06 ` Arnd Bergmann
2016-04-21 9:28 ` Tomasz Nowicki
2016-04-21 9:36 ` Arnd Bergmann
2016-04-21 10:08 ` Tomasz Nowicki
2016-04-22 14:30 ` Jon Masters
2016-04-22 16:00 ` David Daney
2016-04-28 20:14 ` Bjorn Helgaas
2016-04-28 20:40 ` Arnd Bergmann
2016-04-28 21:18 ` Bjorn Helgaas
2016-04-28 21:47 ` Jon Masters
2016-04-29 9:41 ` Lorenzo Pieralisi
2016-04-19 21:40 ` Arnd Bergmann
2016-04-20 0:22 ` Jayachandran C
2016-04-15 17:06 ` [PATCH V6 09/13] pci, acpi: Support for ACPI based generic PCI host controller Tomasz Nowicki
2016-04-20 19:12 ` Jayachandran C
2016-04-21 9:06 ` Tomasz Nowicki
2016-04-22 12:49 ` Jayachandran C
2016-04-22 14:40 ` Jon Masters
2016-04-23 15:23 ` Jon Masters
2016-04-28 21:48 ` Bjorn Helgaas
2016-04-29 8:37 ` Lorenzo Pieralisi
2016-04-29 17:35 ` Jayachandran C
2016-05-02 11:31 ` Tomasz Nowicki
2016-05-03 8:46 ` Lorenzo Pieralisi
2016-05-02 11:03 ` Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 10/13] arm64, pci, acpi: Start using ACPI based PCI host controller driver for ARM64 Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 11/13] pci, acpi: Match PCI config space accessors against platfrom specific quirks Tomasz Nowicki
2016-04-18 11:37 ` liudongdong (C) [this message]
2016-04-18 12:21 ` Tomasz Nowicki
2016-04-15 17:06 ` [PATCH V6 12/13] pci, pci-thunder-ecam: Add ACPI support for ThunderX ECAM Tomasz Nowicki
2016-04-19 10:26 ` Tomasz Nowicki
2016-04-19 10:41 ` [Linaro-acpi] " G Gregory
2016-04-19 11:12 ` Graeme Gregory
2016-04-19 11:22 ` Tomasz Nowicki
2016-04-19 12:29 ` G Gregory
2016-04-15 17:06 ` [PATCH V6 13/13] pci, pci-thunder-pem: Add ACPI support for ThunderX PEM Tomasz Nowicki
2016-04-15 18:19 ` [PATCH V6 00/13] Support for generic ACPI based PCI host controller Jon Masters
2016-04-16 15:31 ` Jayachandran C
2016-04-18 13:33 ` Tomasz Nowicki
2016-04-18 14:38 ` Arnd Bergmann
2016-04-18 15:26 ` Tomasz Nowicki
2016-04-18 16:14 ` Mark Langsdorf
2016-04-17 9:23 ` Martinez Kristofer
2016-04-16 18:30 ` Duc Dang
2016-04-17 4:18 ` Sinan Kaya
2016-04-22 16:08 ` Robert Richter
2016-04-22 20:46 ` Suravee Suthikulpanit
2016-04-25 17:23 ` Jeremy Linton
2016-04-26 9:07 ` liudongdong (C)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5714C6F6.8050600@huawei.com \
--to=liudongdong3@huawei$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox