pci.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * linux/include/asm-generic/pci.h
  3. *
  4. * Copyright (C) 2003 Russell King
  5. */
  6. #ifndef _ASM_GENERIC_PCI_H
  7. #define _ASM_GENERIC_PCI_H
  8. /**
  9. * pcibios_resource_to_bus - convert resource to PCI bus address
  10. * @dev: device which owns this resource
  11. * @region: converted bus-centric region (start,end)
  12. * @res: resource to convert
  13. *
  14. * Convert a resource to a PCI device bus address or bus window.
  15. */
  16. static inline void
  17. pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
  18. struct resource *res)
  19. {
  20. region->start = res->start;
  21. region->end = res->end;
  22. }
  23. static inline void
  24. pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
  25. struct pci_bus_region *region)
  26. {
  27. res->start = region->start;
  28. res->end = region->end;
  29. }
  30. static inline struct resource *
  31. pcibios_select_root(struct pci_dev *pdev, struct resource *res)
  32. {
  33. struct resource *root = NULL;
  34. if (res->flags & IORESOURCE_IO)
  35. root = &ioport_resource;
  36. if (res->flags & IORESOURCE_MEM)
  37. root = &iomem_resource;
  38. return root;
  39. }
  40. #ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
  41. static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
  42. {
  43. return channel ? 15 : 14;
  44. }
  45. #endif /* HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ */
  46. /*
  47. * By default, assume that no iommu is in use and that the PCI
  48. * space is mapped to address physical 0.
  49. */
  50. #ifndef PCI_DMA_BUS_IS_PHYS
  51. #define PCI_DMA_BUS_IS_PHYS (1)
  52. #endif
  53. #endif /* _ASM_GENERIC_PCI_H */