iSeries_pci.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef _ISERIES_64_PCI_H
  2. #define _ISERIES_64_PCI_H
  3. /*
  4. * File iSeries_pci.h created by Allan Trautman on Tue Feb 20, 2001.
  5. *
  6. * Define some useful macros for the iSeries pci routines.
  7. * Copyright (C) 2001 Allan H Trautman, IBM Corporation
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the:
  21. * Free Software Foundation, Inc.,
  22. * 59 Temple Place, Suite 330,
  23. * Boston, MA 02111-1307 USA
  24. *
  25. * Change Activity:
  26. * Created Feb 20, 2001
  27. * Added device reset, March 22, 2001
  28. * Ported to ppc64, May 25, 2001
  29. * End Change Activity
  30. */
  31. #include <asm/iSeries/HvCallPci.h>
  32. #include <asm/abs_addr.h>
  33. struct pci_dev; /* For Forward Reference */
  34. struct iSeries_Device_Node;
  35. /*
  36. * Gets iSeries Bus, SubBus, DevFn using iSeries_Device_Node structure
  37. */
  38. #define ISERIES_BUS(DevPtr) DevPtr->DsaAddr.Dsa.busNumber
  39. #define ISERIES_SUBBUS(DevPtr) DevPtr->DsaAddr.Dsa.subBusNumber
  40. #define ISERIES_DEVICE(DevPtr) DevPtr->DsaAddr.Dsa.deviceId
  41. #define ISERIES_DSA(DevPtr) DevPtr->DsaAddr.DsaAddr
  42. #define ISERIES_DEVNODE(PciDev) ((struct iSeries_Device_Node *)PciDev->sysdata)
  43. #define EADsMaxAgents 7
  44. /*
  45. * Decodes Linux DevFn to iSeries DevFn, bridge device, or function.
  46. * For Linux, see PCI_SLOT and PCI_FUNC in include/linux/pci.h
  47. */
  48. #define ISERIES_PCI_AGENTID(idsel, func) \
  49. (((idsel & 0x0F) << 4) | (func & 0x07))
  50. #define ISERIES_ENCODE_DEVICE(agentid) \
  51. ((0x10) | ((agentid & 0x20) >> 2) | (agentid & 0x07))
  52. #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7)
  53. #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7)
  54. /*
  55. * Converts Virtual Address to Real Address for Hypervisor calls
  56. */
  57. #define ISERIES_HV_ADDR(virtaddr) \
  58. (0x8000000000000000 | virt_to_abs(virtaddr))
  59. /*
  60. * iSeries Device Information
  61. */
  62. struct iSeries_Device_Node {
  63. struct list_head Device_List;
  64. struct pci_dev *PciDev;
  65. union HvDsaMap DsaAddr; /* Direct Select Address */
  66. /* busNumber, subBusNumber, */
  67. /* deviceId, barNumber */
  68. int DevFn; /* Linux devfn */
  69. int Irq; /* Assigned IRQ */
  70. int Flags; /* Possible flags(disable/bist)*/
  71. u8 LogicalSlot; /* Hv Slot Index for Tces */
  72. struct iommu_table *iommu_table;/* Device TCE Table */
  73. };
  74. extern void iSeries_Device_Information(struct pci_dev*, int);
  75. #endif /* _ISERIES_64_PCI_H */