Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  arch/arm/include/asm/mach/pci.h
0004  *
0005  *  Copyright (C) 2000 Russell King
0006  */
0007 
0008 #ifndef __ASM_MACH_PCI_H
0009 #define __ASM_MACH_PCI_H
0010 
0011 #include <linux/ioport.h>
0012 
0013 struct pci_sys_data;
0014 struct pci_ops;
0015 struct pci_bus;
0016 struct pci_host_bridge;
0017 struct device;
0018 
0019 struct hw_pci {
0020     struct pci_ops  *ops;
0021     int     nr_controllers;
0022     void        **private_data;
0023     int     (*setup)(int nr, struct pci_sys_data *);
0024     int     (*scan)(int nr, struct pci_host_bridge *);
0025     void        (*preinit)(void);
0026     void        (*postinit)(void);
0027     u8      (*swizzle)(struct pci_dev *dev, u8 *pin);
0028     int     (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
0029 };
0030 
0031 /*
0032  * Per-controller structure
0033  */
0034 struct pci_sys_data {
0035     struct list_head node;
0036     int     busnr;      /* primary bus number           */
0037     u64     mem_offset; /* bus->cpu memory mapping offset   */
0038     unsigned long   io_offset;  /* bus->cpu IO mapping offset       */
0039     struct pci_bus  *bus;       /* PCI bus              */
0040     struct list_head resources; /* root bus resources (apertures)       */
0041     struct resource io_res;
0042     char        io_res_name[12];
0043                     /* Bridge swizzling         */
0044     u8      (*swizzle)(struct pci_dev *, u8 *);
0045                     /* IRQ mapping              */
0046     int     (*map_irq)(const struct pci_dev *, u8, u8);
0047     void        *private_data;  /* platform controller private data */
0048 };
0049 
0050 /*
0051  * Call this with your hw_pci struct to initialise the PCI system.
0052  */
0053 void pci_common_init_dev(struct device *, struct hw_pci *);
0054 
0055 /*
0056  * Compatibility wrapper for older platforms that do not care about
0057  * passing the parent device.
0058  */
0059 static inline void pci_common_init(struct hw_pci *hw)
0060 {
0061     pci_common_init_dev(NULL, hw);
0062 }
0063 
0064 /*
0065  * Setup early fixed I/O mapping.
0066  */
0067 #if defined(CONFIG_PCI)
0068 extern void pci_map_io_early(unsigned long pfn);
0069 #else
0070 static inline void pci_map_io_early(unsigned long pfn) {}
0071 #endif
0072 
0073 /*
0074  * PCI controllers
0075  */
0076 extern struct pci_ops iop3xx_ops;
0077 extern int iop3xx_pci_setup(int nr, struct pci_sys_data *);
0078 extern void iop3xx_pci_preinit(void);
0079 extern void iop3xx_pci_preinit_cond(void);
0080 
0081 extern struct pci_ops dc21285_ops;
0082 extern int dc21285_setup(int nr, struct pci_sys_data *);
0083 extern void dc21285_preinit(void);
0084 extern void dc21285_postinit(void);
0085 
0086 #endif /* __ASM_MACH_PCI_H */