Blame view

include/linux/pci-ecam.h 2.03 KB
35ff9477d   Jayachandran C   PCI: Provide comm...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  /*
   * Copyright 2016 Broadcom
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License, version 2, as
   * published by the Free Software Foundation (the "GPL").
   *
   * This program is distributed in the hope that it will be useful, but
   * WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   * General Public License version 2 (GPLv2) for more details.
   *
   * You should have received a copy of the GNU General Public License
   * version 2 (GPLv2) along with this source code.
   */
  #ifndef DRIVERS_PCI_ECAM_H
  #define DRIVERS_PCI_ECAM_H
  
  #include <linux/kernel.h>
  #include <linux/platform_device.h>
  
  /*
   * struct to hold pci ops and bus shift of the config window
   * for a PCI controller.
   */
  struct pci_config_window;
  struct pci_ecam_ops {
  	unsigned int			bus_shift;
  	struct pci_ops			pci_ops;
5c3d14f76   Jayachandran C   PCI: Add parent d...
30
  	int				(*init)(struct pci_config_window *);
35ff9477d   Jayachandran C   PCI: Provide comm...
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  };
  
  /*
   * struct to hold the mappings of a config space window. This
   * is expected to be used as sysdata for PCI controllers that
   * use ECAM.
   */
  struct pci_config_window {
  	struct resource			res;
  	struct resource			busr;
  	void				*priv;
  	struct pci_ecam_ops		*ops;
  	union {
  		void __iomem		*win;	/* 64-bit single mapping */
  		void __iomem		**winp; /* 32-bit per-bus mapping */
  	};
5c3d14f76   Jayachandran C   PCI: Add parent d...
47
  	struct device			*parent;/* ECAM res was from this dev */
35ff9477d   Jayachandran C   PCI: Provide comm...
48
49
50
51
52
53
54
55
56
57
58
59
60
  };
  
  /* create and free pci_config_window */
  struct pci_config_window *pci_ecam_create(struct device *dev,
  		struct resource *cfgres, struct resource *busr,
  		struct pci_ecam_ops *ops);
  void pci_ecam_free(struct pci_config_window *cfg);
  
  /* map_bus when ->sysdata is an instance of pci_config_window */
  void __iomem *pci_ecam_map_bus(struct pci_bus *bus, unsigned int devfn,
  			       int where);
  /* default ECAM ops */
  extern struct pci_ecam_ops pci_generic_ecam_ops;
1958e7173   Jayachandran C   PCI: generic, thu...
61
62
63
64
65
  #ifdef CONFIG_PCI_HOST_GENERIC
  /* for DT-based PCI controllers that support ECAM */
  int pci_host_common_probe(struct platform_device *pdev,
  			  struct pci_ecam_ops *ops);
  #endif
35ff9477d   Jayachandran C   PCI: Provide comm...
66
  #endif