pal4_pci.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:2k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * arch/ppc/platforms/pal4_pci.c
  3.  * 
  4.  * PCI support for SBS Palomar IV
  5.  *
  6.  * Author: Dan Cox 
  7.  *
  8.  * Copyright 2002 MontaVista Software Inc.
  9.  *
  10.  * This program is free software; you can redistribute  it and/or modify it
  11.  * under  the terms of  the GNU General Public License as published by the
  12.  * Free Software Foundation;  either version 2 of the  License, or (at your
  13.  * option) any later version.
  14.  */
  15. #include <linux/kernel.h>
  16. #include <linux/init.h>
  17. #include <linux/pci.h>
  18. #include <asm/byteorder.h>
  19. #include <asm/machdep.h>
  20. #include <asm/io.h>
  21. #include <asm/pci-bridge.h>
  22. #include <asm/uaccess.h>
  23. #include "cpc700.h"
  24. #include "pal4.h"
  25. /* not much to this.... */
  26. static inline int __init
  27. pal4_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
  28. {
  29. if (idsel == 9)
  30. return PAL4_ETH;
  31. else
  32. return PAL4_INTA + (idsel - 3);
  33. }
  34. void __init
  35. pal4_find_bridges(void)
  36. {
  37. struct pci_controller *hose;
  38. hose = pcibios_alloc_controller();
  39. if (!hose)
  40. return;
  41. hose->first_busno = 0;
  42. hose->last_busno = 0xff;
  43. hose->pci_mem_offset = 0;
  44. /* Could snatch these from the CPC700.... */
  45. pci_init_resource(&hose->io_resource,
  46.   0x0, 
  47.   0x03ffffff,
  48.   IORESOURCE_IO,
  49.   "PCI host bridge");
  50. pci_init_resource(&hose->mem_resources[0],
  51.   0x90000000,
  52.   0x9fffffff,
  53.   IORESOURCE_MEM,
  54.   "PCI host bridge");
  55. hose->io_space.start = 0x00800000;
  56. hose->io_space.end = 0x03ffffff;
  57. hose->mem_space.start = 0x90000000;
  58. hose->mem_space.end = 0x9fffffff;
  59. hose->io_base_virt = (void *) 0xf8000000;
  60. setup_indirect_pci(hose, CPC700_PCI_CONFIG_ADDR,
  61.    CPC700_PCI_CONFIG_DATA);
  62. hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
  63. ppc_md.pci_swizzle = common_swizzle;
  64. ppc_md.pci_map_irq = pal4_map_irq;
  65. }