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

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * Copyright 2002 Momentum Computer Inc.
  3.  * Author: Matthew Dharm <mdharm@momenco.com>
  4.  *
  5.  * Based on work for the Linux port to the Ocelot board, which is
  6.  * Copyright 2001 MontaVista Software Inc.
  7.  * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
  8.  *
  9.  * arch/mips/momentum/ocelot_g/pci.c
  10.  *     Board-specific PCI routines for gt64240 controller.
  11.  *
  12.  * This program is free software; you can redistribute  it and/or modify it
  13.  * under  the terms of  the GNU General  Public License as published by the
  14.  * Free Software Foundation;  either version 2 of the  License, or (at your
  15.  * option) any later version.
  16.  */
  17. #include <linux/types.h>
  18. #include <linux/pci.h>
  19. #include <linux/kernel.h>
  20. #include <linux/version.h>
  21. #include <linux/init.h>
  22. #include <asm/pci.h>
  23. void __init gt64240_board_pcibios_fixup_bus(struct pci_bus *bus)
  24. {
  25. struct pci_bus *current_bus = bus;
  26. struct pci_dev *devices;
  27. struct list_head *devices_link;
  28. u16 cmd;
  29. /* loop over all known devices on this bus */
  30. list_for_each(devices_link, &(current_bus->devices)) {
  31. devices = pci_dev_b(devices_link);
  32. if (devices == NULL)
  33. continue;
  34. if ((current_bus->number == 0) &&
  35. PCI_SLOT(devices->devfn) == 1) {
  36. /* Intel 82543 Gigabit MAC */
  37. devices->irq = 2;       /* irq_nr is 2 for INT0 */
  38. } else if ((current_bus->number == 0) &&
  39. PCI_SLOT(devices->devfn) == 2) {
  40. /* Intel 82543 Gigabit MAC */
  41. devices->irq = 3;       /* irq_nr is 3 for INT1 */
  42. } else if ((current_bus->number == 1) &&
  43. PCI_SLOT(devices->devfn) == 3) {
  44. /* Intel 21555 bridge */
  45. devices->irq = 5;       /* irq_nr is 8 for INT6 */
  46. } else if ((current_bus->number == 1) &&
  47. PCI_SLOT(devices->devfn) == 4) {
  48. /* PMC Slot */
  49. devices->irq = 9;       /* irq_nr is 9 for INT7 */
  50. } else {
  51. /* We don't have assign interrupts for other devices. */
  52. devices->irq = 0xff;
  53. }
  54. /* Assign an interrupt number for the device */
  55. bus->ops->write_byte(devices, PCI_INTERRUPT_LINE, devices->irq);
  56. /* enable master for everything but the GT-64240 */
  57. if (((current_bus->number != 0) && (current_bus->number != 1))
  58. || (PCI_SLOT(devices->devfn) != 0)) {
  59. bus->ops->read_word(devices, PCI_COMMAND, &cmd);
  60. cmd |= PCI_COMMAND_MASTER;
  61. bus->ops->write_word(devices, PCI_COMMAND, cmd);
  62. }
  63. }
  64. }