Linux 4.1.18
[linux/fpc-iii.git] / arch / mips / pci / fixup-loongson3.c
blobd708ae46d32532a38f5e3356ca291106524990a6
1 /*
2 * fixup-loongson3.c
4 * Copyright (C) 2012 Lemote, Inc.
5 * Author: Xiang Yu, xiangy@lemote.com
6 * Chen Huacai, chenhc@lemote.com
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #include <linux/pci.h>
27 #include <boot_param.h>
29 static void print_fixup_info(const struct pci_dev *pdev)
31 dev_info(&pdev->dev, "Device %x:%x, irq %d\n",
32 pdev->vendor, pdev->device, pdev->irq);
35 int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
37 print_fixup_info(dev);
38 return dev->irq;
41 static void pci_fixup_radeon(struct pci_dev *pdev)
43 if (pdev->resource[PCI_ROM_RESOURCE].start)
44 return;
46 if (!loongson_sysconf.vgabios_addr)
47 return;
49 pdev->resource[PCI_ROM_RESOURCE].start =
50 loongson_sysconf.vgabios_addr;
51 pdev->resource[PCI_ROM_RESOURCE].end =
52 loongson_sysconf.vgabios_addr + 256*1024 - 1;
53 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_COPY;
55 dev_info(&pdev->dev, "BAR %d: assigned %pR for Radeon ROM\n",
56 PCI_ROM_RESOURCE, &pdev->resource[PCI_ROM_RESOURCE]);
59 DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, PCI_ANY_ID,
60 PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_radeon);
62 /* Do platform specific device initialization at pci_enable_device() time */
63 int pcibios_plat_dev_init(struct pci_dev *dev)
65 return 0;