162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _ASM_IA64_PCI_H
362306a36Sopenharmony_ci#define _ASM_IA64_PCI_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/mm.h>
662306a36Sopenharmony_ci#include <linux/slab.h>
762306a36Sopenharmony_ci#include <linux/spinlock.h>
862306a36Sopenharmony_ci#include <linux/string.h>
962306a36Sopenharmony_ci#include <linux/types.h>
1062306a36Sopenharmony_ci#include <linux/scatterlist.h>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <asm/io.h>
1362306a36Sopenharmony_ci#include <asm/hw_irq.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistruct pci_vector_struct {
1662306a36Sopenharmony_ci	__u16 segment;	/* PCI Segment number */
1762306a36Sopenharmony_ci	__u16 bus;	/* PCI Bus number */
1862306a36Sopenharmony_ci	__u32 pci_id;	/* ACPI split 16 bits device, 16 bits function (see section 6.1.1) */
1962306a36Sopenharmony_ci	__u8 pin;	/* PCI PIN (0 = A, 1 = B, 2 = C, 3 = D) */
2062306a36Sopenharmony_ci	__u32 irq;	/* IRQ assigned */
2162306a36Sopenharmony_ci};
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci/*
2462306a36Sopenharmony_ci * Can be used to override the logic in pci_scan_bus for skipping already-configured bus
2562306a36Sopenharmony_ci * numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the
2662306a36Sopenharmony_ci * loader.
2762306a36Sopenharmony_ci */
2862306a36Sopenharmony_ci#define pcibios_assign_all_busses()     0
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define PCIBIOS_MIN_IO		0x1000
3162306a36Sopenharmony_ci#define PCIBIOS_MIN_MEM		0x10000000
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define HAVE_PCI_MMAP
3462306a36Sopenharmony_ci#define ARCH_GENERIC_PCI_MMAP_RESOURCE
3562306a36Sopenharmony_ci#define arch_can_pci_mmap_wc()	1
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci#define HAVE_PCI_LEGACY
3862306a36Sopenharmony_ciextern int pci_mmap_legacy_page_range(struct pci_bus *bus,
3962306a36Sopenharmony_ci				      struct vm_area_struct *vma,
4062306a36Sopenharmony_ci				      enum pci_mmap_state mmap_state);
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_cichar *pci_get_legacy_mem(struct pci_bus *bus);
4362306a36Sopenharmony_ciint pci_legacy_read(struct pci_bus *bus, u16 port, u32 *val, u8 size);
4462306a36Sopenharmony_ciint pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size);
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_cistruct pci_controller {
4762306a36Sopenharmony_ci	struct acpi_device *companion;
4862306a36Sopenharmony_ci	void *iommu;
4962306a36Sopenharmony_ci	int segment;
5062306a36Sopenharmony_ci	int node;		/* nearest node with memory or NUMA_NO_NODE for global allocation */
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci	void *platform_data;
5362306a36Sopenharmony_ci};
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci#define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
5762306a36Sopenharmony_ci#define pci_domain_nr(busdev)    (PCI_CONTROLLER(busdev)->segment)
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ciextern struct pci_ops pci_root_ops;
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_cistatic inline int pci_proc_domain(struct pci_bus *bus)
6262306a36Sopenharmony_ci{
6362306a36Sopenharmony_ci	return (pci_domain_nr(bus) != 0);
6462306a36Sopenharmony_ci}
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci#endif /* _ASM_IA64_PCI_H */
67