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 12 struct pci_addr_space { 13 phys_addr_t pci_start; 14 phys_addr_t start; 15 phys_addr_t size; 16 phys_addr_t allocated; 17 int type; 18 }; 19 20 struct pci_host_bridge { 21 void __iomem *start; 22 size_t size; 23 int bus; 24 int bus_max; 25 int nr_addr_spaces; 26 struct pci_addr_space addr_space[]; 27 }; 28 29 /* 30 * The following constants are derived from Linux, see this source: 31 * 32 * drivers/pci/host/pci-host-generic.c 33 * struct gen_pci_cfg_bus_ops::bus_shift 34 * int gen_pci_parse_map_cfg_windows(struct gen_pci *pci) 35 * 36 * Documentation/devicetree/bindings/pci/host-generic-pci.txt describes 37 * ECAM Configuration Space is be memory-mapped by concatenating the various 38 * components to form an offset: 39 * 40 * cfg_offset(bus, device, function, register) = 41 * bus << 20 | device << 15 | function << 12 | register 42 */ 43 #define PCI_ECAM_BUS_SHIFT 20 44 #define PCI_ECAM_DEVFN_SHIFT 12 45 46 #endif 47