pci_internal.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Internal PCI functions, not exported outside drivers/pci
  4. *
  5. * Copyright (c) 2015 Google, Inc
  6. * Written by Simon Glass <sjg@chromium.org>
  7. */
  8. #ifndef __pci_internal_h
  9. #define __pci_internal_h
  10. /**
  11. * dm_pciauto_prescan_setup_bridge() - Set up a bridge for scanning
  12. *
  13. * This gets a bridge ready so that its downstream devices can be scanned.
  14. * It sets up the bus number and memory range registers. Once the scan is
  15. * completed, dm_pciauto_postscan_setup_bridge() should be called.
  16. *
  17. * @dev: Bridge device to be scanned
  18. * @sub_bus: Bus number of the 'other side' of the bridge
  19. */
  20. void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus);
  21. /**
  22. * dm_pciauto_postscan_setup_bridge() - Finish set up of a bridge after scanning
  23. *
  24. * This should be called after a bus scan is complete. It adjusts the memory
  25. * ranges to fit with the devices actually found on the other side (downstream)
  26. * of the bridge.
  27. *
  28. * @dev: Bridge device that was scanned
  29. * @sub_bus: Bus number of the 'other side' of the bridge
  30. */
  31. void dm_pciauto_postscan_setup_bridge(struct udevice *dev, int sub_bus);
  32. /**
  33. * dm_pciauto_config_device() - Configure a PCI device ready for use
  34. *
  35. * If the device is a bridge, downstream devices will be probed.
  36. *
  37. * @dev: Device to configure
  38. * @return the maximum PCI bus number found by this device. If there are no
  39. * bridges, this just returns the device's bus number. If the device is a
  40. * bridge then it will return a larger number, depending on the devices on
  41. * that bridge. On error, returns a -ve error number.
  42. */
  43. int dm_pciauto_config_device(struct udevice *dev);
  44. /**
  45. * pci_get_bus() - Get a pointer to a bus, given its number
  46. *
  47. * This looks up a PCI bus based on its bus number. The bus is probed if
  48. * necessary.
  49. *
  50. * @busnum: PCI bus number to look up
  51. * @busp: Returns PCI bus on success
  52. * @return 0 on success, or -ve error
  53. */
  54. int pci_get_bus(int busnum, struct udevice **busp);
  55. #endif