0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/pci.h>
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 resource_size_t pcibios_align_resource(void *data, const struct resource *res,
0025 resource_size_t size, resource_size_t align)
0026 {
0027 struct pci_dev *dev = data;
0028 resource_size_t start = res->start;
0029 struct pci_host_bridge *host_bridge;
0030
0031 if (res->flags & IORESOURCE_IO && start & 0x300)
0032 start = (start + 0x3ff) & ~0x3ff;
0033
0034 start = (start + align - 1) & ~(align - 1);
0035
0036 host_bridge = pci_find_host_bridge(dev->bus);
0037
0038 if (host_bridge->align_resource)
0039 return host_bridge->align_resource(dev, res,
0040 start, size, align);
0041
0042 return start;
0043 }
0044
0045 void pcibios_fixup_bus(struct pci_bus *bus)
0046 {
0047 pci_read_bridge_bases(bus);
0048 }
0049
0050 #ifdef pci_remap_iospace
0051 int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr)
0052 {
0053 unsigned long vaddr;
0054
0055 if (res->start != 0) {
0056 WARN_ONCE(1, "resource start address is not zero\n");
0057 return -ENODEV;
0058 }
0059
0060 vaddr = (unsigned long)ioremap(phys_addr, resource_size(res));
0061 set_io_port_base(vaddr);
0062 return 0;
0063 }
0064 #endif