pci-host-generic.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef PCI_HOST_GENERIC_H
  2. #define PCI_HOST_GENERIC_H
  3. /*
  4. * PCI host bridge supporting structures and constants
  5. *
  6. * Copyright (C) 2016, Red Hat Inc, Alexander Gordeev <agordeev@redhat.com>
  7. *
  8. * This work is licensed under the terms of the GNU LGPL, version 2.
  9. */
  10. #include "libcflat.h"
  11. struct pci_addr_space {
  12. phys_addr_t pci_start;
  13. phys_addr_t start;
  14. phys_addr_t size;
  15. phys_addr_t allocated;
  16. int type;
  17. };
  18. struct pci_host_bridge {
  19. phys_addr_t start;
  20. phys_addr_t size;
  21. int bus;
  22. int bus_max;
  23. int nr_addr_spaces;
  24. struct pci_addr_space addr_space[];
  25. };
  26. /*
  27. * The following constants are derived from Linux, see this source:
  28. *
  29. * drivers/pci/host/pci-host-generic.c
  30. * struct gen_pci_cfg_bus_ops::bus_shift
  31. * int gen_pci_parse_map_cfg_windows(struct gen_pci *pci)
  32. *
  33. * Documentation/devicetree/bindings/pci/host-generic-pci.txt describes
  34. * ECAM Configuration Space is be memory-mapped by concatenating the various
  35. * components to form an offset:
  36. *
  37. * cfg_offset(bus, device, function, register) =
  38. * bus << 20 | device << 15 | function << 12 | register
  39. */
  40. #define PCI_ECAM_BUS_SHIFT 20
  41. #define PCI_ECAM_DEVFN_SHIFT 12
  42. #endif