Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ALPHA_PCI_H
0003 #define __ALPHA_PCI_H
0004 
0005 #ifdef __KERNEL__
0006 
0007 #include <linux/spinlock.h>
0008 #include <linux/dma-mapping.h>
0009 #include <linux/scatterlist.h>
0010 #include <asm/machvec.h>
0011 
0012 /*
0013  * The following structure is used to manage multiple PCI busses.
0014  */
0015 
0016 struct pci_iommu_arena;
0017 struct page;
0018 
0019 /* A controller.  Used to manage multiple PCI busses.  */
0020 
0021 struct pci_controller {
0022     struct pci_controller *next;
0023         struct pci_bus *bus;
0024     struct resource *io_space;
0025     struct resource *mem_space;
0026 
0027     /* The following are for reporting to userland.  The invariant is
0028        that if we report a BWX-capable dense memory, we do not report
0029        a sparse memory at all, even if it exists.  */
0030     unsigned long sparse_mem_base;
0031     unsigned long dense_mem_base;
0032     unsigned long sparse_io_base;
0033     unsigned long dense_io_base;
0034 
0035     /* This one's for the kernel only.  It's in KSEG somewhere.  */
0036     unsigned long config_space_base;
0037 
0038     unsigned int index;
0039     /* For compatibility with current (as of July 2003) pciutils
0040        and XFree86. Eventually will be removed. */
0041     unsigned int need_domain_info;
0042 
0043     struct pci_iommu_arena *sg_pci;
0044     struct pci_iommu_arena *sg_isa;
0045 
0046     void *sysdata;
0047 };
0048 
0049 /* Override the logic in pci_scan_bus for skipping already-configured
0050    bus numbers.  */
0051 
0052 #define pcibios_assign_all_busses() 1
0053 
0054 #define PCIBIOS_MIN_IO      alpha_mv.min_io_address
0055 #define PCIBIOS_MIN_MEM     alpha_mv.min_mem_address
0056 
0057 /* IOMMU controls.  */
0058 
0059 #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
0060 
0061 static inline int pci_proc_domain(struct pci_bus *bus)
0062 {
0063     struct pci_controller *hose = bus->sysdata;
0064     return hose->need_domain_info;
0065 }
0066 
0067 #endif /* __KERNEL__ */
0068 
0069 /* Values for the `which' argument to sys_pciconfig_iobase.  */
0070 #define IOBASE_HOSE     0
0071 #define IOBASE_SPARSE_MEM   1
0072 #define IOBASE_DENSE_MEM    2
0073 #define IOBASE_SPARSE_IO    3
0074 #define IOBASE_DENSE_IO     4
0075 #define IOBASE_ROOT_BUS     5
0076 #define IOBASE_FROM_HOSE    0x10000
0077 
0078 extern struct pci_dev *isa_bridge;
0079 
0080 extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val,
0081                size_t count);
0082 extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val,
0083                 size_t count);
0084 extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
0085                       struct vm_area_struct *vma,
0086                       enum pci_mmap_state mmap_state);
0087 extern void pci_adjust_legacy_attr(struct pci_bus *bus,
0088                    enum pci_mmap_state mmap_type);
0089 #define HAVE_PCI_LEGACY 1
0090 
0091 extern int pci_create_resource_files(struct pci_dev *dev);
0092 extern void pci_remove_resource_files(struct pci_dev *dev);
0093 
0094 #endif /* __ALPHA_PCI_H */