18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Based on powerpc version
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef __ASM_MICROBLAZE_PCI_H
88c2ecf20Sopenharmony_ci#define __ASM_MICROBLAZE_PCI_H
98c2ecf20Sopenharmony_ci#ifdef __KERNEL__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/types.h>
128c2ecf20Sopenharmony_ci#include <linux/slab.h>
138c2ecf20Sopenharmony_ci#include <linux/string.h>
148c2ecf20Sopenharmony_ci#include <linux/dma-mapping.h>
158c2ecf20Sopenharmony_ci#include <linux/pci.h>
168c2ecf20Sopenharmony_ci#include <linux/scatterlist.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#include <asm/io.h>
198c2ecf20Sopenharmony_ci#include <asm/pci-bridge.h>
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define PCIBIOS_MIN_IO		0x1000
228c2ecf20Sopenharmony_ci#define PCIBIOS_MIN_MEM		0x10000000
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/* Values for the `which' argument to sys_pciconfig_iobase syscall.  */
258c2ecf20Sopenharmony_ci#define IOBASE_BRIDGE_NUMBER	0
268c2ecf20Sopenharmony_ci#define IOBASE_MEMORY		1
278c2ecf20Sopenharmony_ci#define IOBASE_IO		2
288c2ecf20Sopenharmony_ci#define IOBASE_ISA_IO		3
298c2ecf20Sopenharmony_ci#define IOBASE_ISA_MEM		4
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define pcibios_scan_all_fns(a, b)	0
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/*
348c2ecf20Sopenharmony_ci * Set this to 1 if you want the kernel to re-assign all PCI
358c2ecf20Sopenharmony_ci * bus numbers (don't do that on ppc64 yet !)
368c2ecf20Sopenharmony_ci */
378c2ecf20Sopenharmony_ci#define pcibios_assign_all_busses()	0
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciextern int pci_domain_nr(struct pci_bus *bus);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* Decide whether to display the domain number in /proc */
428c2ecf20Sopenharmony_ciextern int pci_proc_domain(struct pci_bus *bus);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistruct vm_area_struct;
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/* Tell PCI code what kind of PCI resource mappings we support */
478c2ecf20Sopenharmony_ci#define HAVE_PCI_MMAP			1
488c2ecf20Sopenharmony_ci#define ARCH_GENERIC_PCI_MMAP_RESOURCE	1
498c2ecf20Sopenharmony_ci#define arch_can_pci_mmap_io()		1
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ciextern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val,
528c2ecf20Sopenharmony_ci			   size_t count);
538c2ecf20Sopenharmony_ciextern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val,
548c2ecf20Sopenharmony_ci			   size_t count);
558c2ecf20Sopenharmony_ciextern int pci_mmap_legacy_page_range(struct pci_bus *bus,
568c2ecf20Sopenharmony_ci				      struct vm_area_struct *vma,
578c2ecf20Sopenharmony_ci				      enum pci_mmap_state mmap_state);
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define HAVE_PCI_LEGACY	1
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciextern void pcibios_resource_survey(void);
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_cistruct file;
648c2ecf20Sopenharmony_ciextern pgprot_t	pci_phys_mem_access_prot(struct file *file,
658c2ecf20Sopenharmony_ci					 unsigned long pfn,
668c2ecf20Sopenharmony_ci					 unsigned long size,
678c2ecf20Sopenharmony_ci					 pgprot_t prot);
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci/* This part of code was originally in xilinx-pci.h */
708c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI_XILINX
718c2ecf20Sopenharmony_ciextern void __init xilinx_pci_init(void);
728c2ecf20Sopenharmony_ci#else
738c2ecf20Sopenharmony_cistatic inline void __init xilinx_pci_init(void) { return; }
748c2ecf20Sopenharmony_ci#endif
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#endif	/* __KERNEL__ */
778c2ecf20Sopenharmony_ci#endif /* __ASM_MICROBLAZE_PCI_H */
78