]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - arch/arm64/kernel/pci.c
ARM64: PCI: ACPI support for legacy IRQs parsing and consolidation with DT code
[mirror_ubuntu-zesty-kernel.git] / arch / arm64 / kernel / pci.c
CommitLineData
d1e6dc91
LD
1/*
2 * Code borrowed from powerpc/kernel/pci-common.c
3 *
4 * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM
5 * Copyright (C) 2014 ARM Ltd.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 */
12
a9cb97fe 13#include <linux/acpi.h>
d1e6dc91
LD
14#include <linux/init.h>
15#include <linux/io.h>
16#include <linux/kernel.h>
17#include <linux/mm.h>
18#include <linux/of_pci.h>
19#include <linux/of_platform.h>
2ab51dde 20#include <linux/pci.h>
d1e6dc91
LD
21#include <linux/slab.h>
22
d1e6dc91
LD
23/*
24 * Called after each bus is probed, but before its children are examined
25 */
26void pcibios_fixup_bus(struct pci_bus *bus)
27{
28 /* nothing to do, expected to be removed in the future */
29}
30
31/*
32 * We don't have to worry about legacy ISA devices, so nothing to do here
33 */
34resource_size_t pcibios_align_resource(void *data, const struct resource *res,
35 resource_size_t size, resource_size_t align)
36{
37 return res->start;
38}
39
72407514
LP
40/**
41 * pcibios_enable_device - Enable I/O and memory.
42 * @dev: PCI device to be enabled
43 * @mask: bitmask of BARs to enable
44 */
45int pcibios_enable_device(struct pci_dev *dev, int mask)
46{
47 if (pci_has_flag(PCI_PROBE_ONLY))
48 return 0;
49
50 return pci_enable_resources(dev, mask);
51}
52
d1e6dc91 53/*
d8ed75d5 54 * Try to assign the IRQ number when probing a new device
d1e6dc91 55 */
d8ed75d5 56int pcibios_alloc_irq(struct pci_dev *dev)
d1e6dc91 57{
d8ed75d5
TN
58 if (acpi_disabled)
59 dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
60#ifdef CONFIG_ACPI
61 else
62 return acpi_pci_irq_enable(dev);
63#endif
d1e6dc91
LD
64
65 return 0;
66}
a9cb97fe
HG
67
68/*
69 * raw_pci_read/write - Platform-specific PCI config space access.
70 */
71int raw_pci_read(unsigned int domain, unsigned int bus,
72 unsigned int devfn, int reg, int len, u32 *val)
73{
74 return -ENXIO;
75}
76
77int raw_pci_write(unsigned int domain, unsigned int bus,
78 unsigned int devfn, int reg, int len, u32 val)
79{
80 return -ENXIO;
81}
82
1a2db300
GK
83#ifdef CONFIG_NUMA
84
85int pcibus_to_node(struct pci_bus *bus)
86{
87 return dev_to_node(&bus->dev);
88}
89EXPORT_SYMBOL(pcibus_to_node);
90
91#endif
92
a9cb97fe 93#ifdef CONFIG_ACPI
2ab51dde
TN
94
95int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
96{
97 return 0;
98}
99
a9cb97fe
HG
100/* Root bridge scanning */
101struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
102{
103 /* TODO: Should be revisited when implementing PCI on ACPI */
104 return NULL;
105}
106#endif