Most if not all ARM PCI host controller device drivers either ignore the domain field in the pci_sys_data structure or just increment it every time a host controller is probed, using it as a domain counter. Therefore, instead of relying on pci_sys_data to stash the domain number in a standard location, ARM pcibios code can be moved to the newly introduced generic PCI domains code, implemented in commits:41e5c0f81d
("of/pci: Add pci_get_new_domain_nr() and of_get_pci_domain_nr()")670ba0c888
("PCI: Add generic domain handling") ARM code is made to select PCI_DOMAINS_GENERIC by default, which builds core PCI code that assigns the domain number through the generic function: void pci_bus_assign_domain_nr(...) that relies on a DT property to define the domain number or falls back to a counter according to a predefined logic; its usage replaces the current domain assignment code in PCI host controllers present in the kernel. Tested-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Yijing Wang <wangyijing@huawei.com> Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> # mvebu Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Phil Edworthy <phil.edworthy@renesas.com> Acked-by: Arnd Bergmann <arnd@arndb.de> CC: Mohit Kumar <mohit.kumar@st.com>
106 lines
2.8 KiB
C
106 lines
2.8 KiB
C
/*
|
|
* arch/arm/include/asm/mach/pci.h
|
|
*
|
|
* Copyright (C) 2000 Russell King
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#ifndef __ASM_MACH_PCI_H
|
|
#define __ASM_MACH_PCI_H
|
|
|
|
#include <linux/ioport.h>
|
|
|
|
struct pci_sys_data;
|
|
struct pci_ops;
|
|
struct pci_bus;
|
|
struct device;
|
|
|
|
struct hw_pci {
|
|
#ifdef CONFIG_PCI_MSI
|
|
struct msi_controller *msi_ctrl;
|
|
#endif
|
|
struct pci_ops *ops;
|
|
int nr_controllers;
|
|
void **private_data;
|
|
int (*setup)(int nr, struct pci_sys_data *);
|
|
struct pci_bus *(*scan)(int nr, struct pci_sys_data *);
|
|
void (*preinit)(void);
|
|
void (*postinit)(void);
|
|
u8 (*swizzle)(struct pci_dev *dev, u8 *pin);
|
|
int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
|
|
resource_size_t (*align_resource)(struct pci_dev *dev,
|
|
const struct resource *res,
|
|
resource_size_t start,
|
|
resource_size_t size,
|
|
resource_size_t align);
|
|
};
|
|
|
|
/*
|
|
* Per-controller structure
|
|
*/
|
|
struct pci_sys_data {
|
|
#ifdef CONFIG_PCI_MSI
|
|
struct msi_controller *msi_ctrl;
|
|
#endif
|
|
struct list_head node;
|
|
int busnr; /* primary bus number */
|
|
u64 mem_offset; /* bus->cpu memory mapping offset */
|
|
unsigned long io_offset; /* bus->cpu IO mapping offset */
|
|
struct pci_bus *bus; /* PCI bus */
|
|
struct list_head resources; /* root bus resources (apertures) */
|
|
struct resource io_res;
|
|
char io_res_name[12];
|
|
/* Bridge swizzling */
|
|
u8 (*swizzle)(struct pci_dev *, u8 *);
|
|
/* IRQ mapping */
|
|
int (*map_irq)(const struct pci_dev *, u8, u8);
|
|
/* Resource alignement requirements */
|
|
resource_size_t (*align_resource)(struct pci_dev *dev,
|
|
const struct resource *res,
|
|
resource_size_t start,
|
|
resource_size_t size,
|
|
resource_size_t align);
|
|
void *private_data; /* platform controller private data */
|
|
};
|
|
|
|
/*
|
|
* Call this with your hw_pci struct to initialise the PCI system.
|
|
*/
|
|
void pci_common_init_dev(struct device *, struct hw_pci *);
|
|
|
|
/*
|
|
* Compatibility wrapper for older platforms that do not care about
|
|
* passing the parent device.
|
|
*/
|
|
static inline void pci_common_init(struct hw_pci *hw)
|
|
{
|
|
pci_common_init_dev(NULL, hw);
|
|
}
|
|
|
|
/*
|
|
* Setup early fixed I/O mapping.
|
|
*/
|
|
#if defined(CONFIG_PCI)
|
|
extern void pci_map_io_early(unsigned long pfn);
|
|
#else
|
|
static inline void pci_map_io_early(unsigned long pfn) {}
|
|
#endif
|
|
|
|
/*
|
|
* PCI controllers
|
|
*/
|
|
extern struct pci_ops iop3xx_ops;
|
|
extern int iop3xx_pci_setup(int nr, struct pci_sys_data *);
|
|
extern void iop3xx_pci_preinit(void);
|
|
extern void iop3xx_pci_preinit_cond(void);
|
|
|
|
extern struct pci_ops dc21285_ops;
|
|
extern int dc21285_setup(int nr, struct pci_sys_data *);
|
|
extern void dc21285_preinit(void);
|
|
extern void dc21285_postinit(void);
|
|
|
|
#endif /* __ASM_MACH_PCI_H */
|