#include <linux/bitfield.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/of_address.h>
#include <linux/of_pci.h>
#include <linux/pci-acpi.h>
#include <linux/pci-ecam.h>
#include <linux/platform_device.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include "../pci.h"
#if defined(CONFIG_PCI_HOST_THUNDER_PEM) || (defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS))
#define PEM_CFG_WR …
#define PEM_CFG_RD …
#define THUNDER_PCIE_ECAM_BUS_SHIFT …
struct thunder_pem_pci { … };
static int thunder_pem_bridge_read(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 *val)
{ … }
static int thunder_pem_config_read(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 *val)
{ … }
static u32 thunder_pem_bridge_w1c_bits(u64 where_aligned)
{ … }
static u32 thunder_pem_bridge_w1_bits(u64 where_aligned)
{ … }
static int thunder_pem_bridge_write(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 val)
{ … }
static int thunder_pem_config_write(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 val)
{ … }
static int thunder_pem_init(struct device *dev, struct pci_config_window *cfg,
struct resource *res_pem)
{ … }
#if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS)
#define PEM_RES_BASE …
#define PEM_NODE_MASK …
#define PEM_INDX_MASK …
#define PEM_MIN_DOM_IN_NODE …
#define PEM_MAX_DOM_IN_NODE …
static void thunder_pem_reserve_range(struct device *dev, int seg,
struct resource *r)
{ … }
static void thunder_pem_legacy_fw(struct acpi_pci_root *root,
struct resource *res_pem)
{ … }
static int thunder_pem_acpi_init(struct pci_config_window *cfg)
{ … }
const struct pci_ecam_ops thunder_pem_ecam_ops = …;
#endif
#ifdef CONFIG_PCI_HOST_THUNDER_PEM
static int thunder_pem_platform_init(struct pci_config_window *cfg)
{ … }
static const struct pci_ecam_ops pci_thunder_pem_ops = …;
static const struct of_device_id thunder_pem_of_match[] = …;
static struct platform_driver thunder_pem_driver = …;
builtin_platform_driver(…) …;
#endif
#endif