2005-04-17 06:20:36 +08:00
|
|
|
#ifndef _ASM_IA64_PCI_H
|
|
|
|
#define _ASM_IA64_PCI_H
|
|
|
|
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/scatterlist.h>
|
2007-02-12 14:12:01 +08:00
|
|
|
#include <asm/hw_irq.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-03-29 01:30:02 +08:00
|
|
|
struct pci_vector_struct {
|
|
|
|
__u16 segment; /* PCI Segment number */
|
|
|
|
__u16 bus; /* PCI Bus number */
|
|
|
|
__u32 pci_id; /* ACPI split 16 bits device, 16 bits function (see section 6.1.1) */
|
|
|
|
__u8 pin; /* PCI PIN (0 = A, 1 = B, 2 = C, 3 = D) */
|
|
|
|
__u32 irq; /* IRQ assigned */
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Can be used to override the logic in pci_scan_bus for skipping already-configured bus
|
|
|
|
* numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the
|
|
|
|
* loader.
|
|
|
|
*/
|
|
|
|
#define pcibios_assign_all_busses() 0
|
|
|
|
|
|
|
|
#define PCIBIOS_MIN_IO 0x1000
|
|
|
|
#define PCIBIOS_MIN_MEM 0x10000000
|
|
|
|
|
|
|
|
void pcibios_config_init(void);
|
|
|
|
|
|
|
|
struct pci_dev;
|
|
|
|
|
|
|
|
/*
|
2006-10-10 22:01:19 +08:00
|
|
|
* PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct
|
|
|
|
* correspondence between device bus addresses and CPU physical addresses.
|
|
|
|
* Platforms with a hardware I/O MMU _must_ turn this off to suppress the
|
|
|
|
* bounce buffer handling code in the block and network device layers.
|
|
|
|
* Platforms with separate bus address spaces _must_ turn this off and provide
|
|
|
|
* a device DMA mapping implementation that takes care of the necessary
|
2005-04-17 06:20:36 +08:00
|
|
|
* address translation.
|
|
|
|
*
|
2006-10-10 22:01:19 +08:00
|
|
|
* For now, the ia64 platforms which may have separate/multiple bus address
|
|
|
|
* spaces all have I/O MMUs which support the merging of physically
|
|
|
|
* discontiguous buffers, so we can use that as the sole factor to determine
|
|
|
|
* the setting of PCI_DMA_BUS_IS_PHYS.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
extern unsigned long ia64_max_iommu_merge_mask;
|
|
|
|
#define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL)
|
|
|
|
|
|
|
|
static inline void
|
2005-04-01 13:07:31 +08:00
|
|
|
pcibios_penalize_isa_irq (int irq, int active)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
/* We don't do dynamic PCI IRQ allocation */
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <asm-generic/pci-dma-compat.h>
|
|
|
|
|
2005-06-07 14:07:46 +08:00
|
|
|
#ifdef CONFIG_PCI
|
2005-06-03 03:55:50 +08:00
|
|
|
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
|
|
|
|
enum pci_dma_burst_strategy *strat,
|
|
|
|
unsigned long *strategy_parameter)
|
|
|
|
{
|
|
|
|
unsigned long cacheline_size;
|
|
|
|
u8 byte;
|
|
|
|
|
|
|
|
pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
|
|
|
|
if (byte == 0)
|
|
|
|
cacheline_size = 1024;
|
|
|
|
else
|
|
|
|
cacheline_size = (int) byte * 4;
|
|
|
|
|
|
|
|
*strat = PCI_DMA_BURST_MULTIPLE;
|
|
|
|
*strategy_parameter = cacheline_size;
|
|
|
|
}
|
2005-06-07 14:07:46 +08:00
|
|
|
#endif
|
2005-06-03 03:55:50 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#define HAVE_PCI_MMAP
|
|
|
|
extern int pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
|
|
|
|
enum pci_mmap_state mmap_state, int write_combine);
|
|
|
|
#define HAVE_PCI_LEGACY
|
|
|
|
extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
|
2008-10-03 17:49:32 +08:00
|
|
|
struct vm_area_struct *vma,
|
|
|
|
enum pci_mmap_state mmap_state);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define pci_get_legacy_mem platform_pci_get_legacy_mem
|
|
|
|
#define pci_legacy_read platform_pci_legacy_read
|
|
|
|
#define pci_legacy_write platform_pci_legacy_write
|
|
|
|
|
2013-06-06 15:34:50 +08:00
|
|
|
struct iospace_resource {
|
|
|
|
struct list_head list;
|
|
|
|
struct resource res;
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
struct pci_controller {
|
ACPI / driver core: Store an ACPI device pointer in struct acpi_dev_node
Modify struct acpi_dev_node to contain a pointer to struct acpi_device
associated with the given device object (that is, its ACPI companion
device) instead of an ACPI handle corresponding to it. Introduce two
new macros for manipulating that pointer in a CONFIG_ACPI-safe way,
ACPI_COMPANION() and ACPI_COMPANION_SET(), and rework the
ACPI_HANDLE() macro to take the above changes into account.
Drop the ACPI_HANDLE_SET() macro entirely and rework its users to
use ACPI_COMPANION_SET() instead. For some of them who used to
pass the result of acpi_get_child() directly to ACPI_HANDLE_SET()
introduce a helper routine acpi_preset_companion() doing an
equivalent thing.
The main motivation for doing this is that there are things
represented by struct acpi_device objects that don't have valid
ACPI handles (so called fixed ACPI hardware features, such as
power and sleep buttons) and we would like to create platform
device objects for them and "glue" them to their ACPI companions
in the usual way (which currently is impossible due to the
lack of valid ACPI handles). However, there are more reasons
why it may be useful.
First, struct acpi_device pointers allow of much better type checking
than void pointers which are ACPI handles, so it should be more
difficult to write buggy code using modified struct acpi_dev_node
and the new macros. Second, the change should help to reduce (over
time) the number of places in which the result of ACPI_HANDLE() is
passed to acpi_bus_get_device() in order to obtain a pointer to the
struct acpi_device associated with the given "physical" device,
because now that pointer is returned by ACPI_COMPANION() directly.
Finally, the change should make it easier to write generic code that
will build both for CONFIG_ACPI set and unset without adding explicit
compiler directives to it.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> # on Haswell
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Aaron Lu <aaron.lu@intel.com> # for ATA and SDIO part
2013-11-12 05:41:56 +08:00
|
|
|
struct acpi_device *companion;
|
2005-04-17 06:20:36 +08:00
|
|
|
void *iommu;
|
|
|
|
int segment;
|
2005-07-08 07:59:00 +08:00
|
|
|
int node; /* nearest node with memory or -1 for global allocation */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
void *platform_data;
|
|
|
|
};
|
|
|
|
|
2013-06-06 15:34:48 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
|
|
|
|
#define pci_domain_nr(busdev) (PCI_CONTROLLER(busdev)->segment)
|
|
|
|
|
|
|
|
extern struct pci_ops pci_root_ops;
|
|
|
|
|
|
|
|
static inline int pci_proc_domain(struct pci_bus *bus)
|
|
|
|
{
|
|
|
|
return (pci_domain_nr(bus) != 0);
|
|
|
|
}
|
|
|
|
|
2009-06-22 22:08:07 +08:00
|
|
|
static inline struct resource *
|
|
|
|
pcibios_select_root(struct pci_dev *pdev, struct resource *res)
|
|
|
|
{
|
|
|
|
struct resource *root = NULL;
|
|
|
|
|
|
|
|
if (res->flags & IORESOURCE_IO)
|
|
|
|
root = &ioport_resource;
|
|
|
|
if (res->flags & IORESOURCE_MEM)
|
|
|
|
root = &iomem_resource;
|
|
|
|
|
|
|
|
return root;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-01-27 20:46:54 +08:00
|
|
|
#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
|
|
|
|
static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
|
|
|
|
{
|
2007-02-12 14:12:01 +08:00
|
|
|
return channel ? isa_irq_to_vector(15) : isa_irq_to_vector(14);
|
2007-01-27 20:46:54 +08:00
|
|
|
}
|
|
|
|
|
2011-08-24 08:05:25 +08:00
|
|
|
#ifdef CONFIG_INTEL_IOMMU
|
2008-10-18 03:14:13 +08:00
|
|
|
extern void pci_iommu_alloc(void);
|
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif /* _ASM_IA64_PCI_H */
|