pci.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef _PLATFORMS_ISERIES_PCI_H
  2. #define _PLATFORMS_ISERIES_PCI_H
  3. /*
  4. * 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/pci-bridge.h>
  32. struct pci_dev; /* For Forward Reference */
  33. /*
  34. * Decodes Linux DevFn to iSeries DevFn, bridge device, or function.
  35. * For Linux, see PCI_SLOT and PCI_FUNC in include/linux/pci.h
  36. */
  37. #define ISERIES_PCI_AGENTID(idsel, func) \
  38. (((idsel & 0x0F) << 4) | (func & 0x07))
  39. #define ISERIES_ENCODE_DEVICE(agentid) \
  40. ((0x10) | ((agentid & 0x20) >> 2) | (agentid & 0x07))
  41. #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7)
  42. #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7)
  43. /*
  44. * Generate a Direct Select Address for the Hypervisor
  45. */
  46. static inline u64 iseries_ds_addr(struct device_node *node)
  47. {
  48. struct pci_dn *pdn = PCI_DN(node);
  49. return ((u64)pdn->busno << 48) + ((u64)pdn->bussubno << 40)
  50. + ((u64)0x10 << 32);
  51. }
  52. extern void iSeries_Device_Information(struct pci_dev*, int);
  53. #endif /* _PLATFORMS_ISERIES_PCI_H */