Merge tag 'csky-for-linus-4.20-fixup-dtb' of https://github.com/c-sky/csky-linux
[linux-block.git] / arch / mips / pci / pci.c
CommitLineData
1da177e4 1/*
70342287
RB
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
1da177e4
LT
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 *
c539ef7d
RB
7 * Copyright (C) 2003, 04, 11 Ralf Baechle (ralf@linux-mips.org)
8 * Copyright (C) 2011 Wind River Systems,
9 * written by Ralf Baechle (ralf@linux-mips.org)
1da177e4 10 */
c539ef7d 11#include <linux/bug.h>
1da177e4
LT
12#include <linux/kernel.h>
13#include <linux/mm.h>
57c8a661 14#include <linux/memblock.h>
cae39d13 15#include <linux/export.h>
1da177e4
LT
16#include <linux/init.h>
17#include <linux/types.h>
18#include <linux/pci.h>
a48cf37a 19#include <linux/of_address.h>
1da177e4 20
c539ef7d
RB
21#include <asm/cpu-info.h>
22
982f6ffe 23unsigned long PCIBIOS_MIN_IO;
f8091a88 24EXPORT_SYMBOL(PCIBIOS_MIN_IO);
639702bd 25
f8091a88
PB
26unsigned long PCIBIOS_MIN_MEM;
27EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
1da177e4 28
f474ba9d 29static int __init pcibios_set_cache_line_size(void)
c539ef7d 30{
c539ef7d
RB
31 unsigned int lsize;
32
33 /*
34 * Set PCI cacheline size to that of the highest level in the
35 * cache hierarchy.
36 */
73530266
MR
37 lsize = cpu_dcache_line_size();
38 lsize = cpu_scache_line_size() ? : lsize;
39 lsize = cpu_tcache_line_size() ? : lsize;
c539ef7d
RB
40
41 BUG_ON(!lsize);
42
43 pci_dfl_cache_line_size = lsize >> 2;
44
45 pr_debug("PCI: pci_cache_line_size set to %d bytes\n", lsize);
f474ba9d 46 return 0;
c539ef7d 47}
f474ba9d 48arch_initcall(pcibios_set_cache_line_size);
c539ef7d 49
8221a013
BH
50void pci_resource_to_user(const struct pci_dev *dev, int bar,
51 const struct resource *rsrc, resource_size_t *start,
52 resource_size_t *end)
53{
54 phys_addr_t size = resource_size(rsrc);
55
56 *start = fixup_bigphys_addr(rsrc->start, size);
38c0a74f 57 *end = rsrc->start + size - 1;
8221a013 58}