Path: blob/master/arch/powerpc/platforms/pseries/pci.c
10818 views
/*1* Copyright (C) 2001 Dave Engebretsen, IBM Corporation2* Copyright (C) 2003 Anton Blanchard <[email protected]>, IBM3*4* pSeries specific routines for PCI.5*6* This program is free software; you can redistribute it and/or modify7* it under the terms of the GNU General Public License as published by8* the Free Software Foundation; either version 2 of the License, or9* (at your option) any later version.10*11* This program is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14* GNU General Public License for more details.15*16* You should have received a copy of the GNU General Public License17* along with this program; if not, write to the Free Software18* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19*/2021#include <linux/init.h>22#include <linux/ioport.h>23#include <linux/kernel.h>24#include <linux/pci.h>25#include <linux/string.h>2627#include <asm/eeh.h>28#include <asm/pci-bridge.h>29#include <asm/prom.h>30#include <asm/ppc-pci.h>3132#if 033void pcibios_name_device(struct pci_dev *dev)34{35struct device_node *dn;3637/*38* Add IBM loc code (slot) as a prefix to the device names for service39*/40dn = pci_device_to_OF_node(dev);41if (dn) {42const char *loc_code = of_get_property(dn, "ibm,loc-code", 0);43if (loc_code) {44int loc_len = strlen(loc_code);45if (loc_len < sizeof(dev->dev.name)) {46memmove(dev->dev.name+loc_len+1, dev->dev.name,47sizeof(dev->dev.name)-loc_len-1);48memcpy(dev->dev.name, loc_code, loc_len);49dev->dev.name[loc_len] = ' ';50dev->dev.name[sizeof(dev->dev.name)-1] = '\0';51}52}53}54}55DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device);56#endif5758static void __init pSeries_request_regions(void)59{60if (!isa_io_base)61return;6263request_region(0x20,0x20,"pic1");64request_region(0xa0,0x20,"pic2");65request_region(0x00,0x20,"dma1");66request_region(0x40,0x20,"timer");67request_region(0x80,0x10,"dma page reg");68request_region(0xc0,0x20,"dma2");69}7071void __init pSeries_final_fixup(void)72{73pSeries_request_regions();7475pci_addr_cache_build();76}7778/*79* Assume the winbond 82c105 is the IDE controller on a80* p610/p615/p630. We should probably be more careful in case81* someone tries to plug in a similar adapter.82*/83static void fixup_winbond_82c105(struct pci_dev* dev)84{85int i;86unsigned int reg;8788if (!machine_is(pseries))89return;9091printk("Using INTC for W82c105 IDE controller.\n");92pci_read_config_dword(dev, 0x40, ®);93/* Enable LEGIRQ to use INTC instead of ISA interrupts */94pci_write_config_dword(dev, 0x40, reg | (1<<11));9596for (i = 0; i < DEVICE_COUNT_RESOURCE; ++i) {97/* zap the 2nd function of the winbond chip */98if (dev->resource[i].flags & IORESOURCE_IO99&& dev->bus->number == 0 && dev->devfn == 0x81)100dev->resource[i].flags &= ~IORESOURCE_IO;101if (dev->resource[i].start == 0 && dev->resource[i].end) {102dev->resource[i].flags = 0;103dev->resource[i].end = 0;104}105}106}107DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,108fixup_winbond_82c105);109110111