xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/pci/priv.h (revision c0c914eca7f251c70facc37dfebeaf176601918d)
1 #ifndef __NVKM_PCI_PRIV_H__
2 #define __NVKM_PCI_PRIV_H__
3 #define nvkm_pci(p) container_of((p), struct nvkm_pci, subdev)
4 #include <subdev/pci.h>
5 
6 int nvkm_pci_new_(const struct nvkm_pci_func *, struct nvkm_device *,
7 		  int index, struct nvkm_pci **);
8 
9 struct nvkm_pci_func {
10 	void (*init)(struct nvkm_pci *);
11 	u32 (*rd32)(struct nvkm_pci *, u16 addr);
12 	void (*wr08)(struct nvkm_pci *, u16 addr, u8 data);
13 	void (*wr32)(struct nvkm_pci *, u16 addr, u32 data);
14 	void (*msi_rearm)(struct nvkm_pci *);
15 
16 	struct {
17 		int (*init)(struct nvkm_pci *);
18 		int (*set_link)(struct nvkm_pci *, enum nvkm_pcie_speed, u8);
19 
20 		enum nvkm_pcie_speed (*max_speed)(struct nvkm_pci *);
21 		enum nvkm_pcie_speed (*cur_speed)(struct nvkm_pci *);
22 
23 		void (*set_version)(struct nvkm_pci *, u8);
24 		int (*version)(struct nvkm_pci *);
25 		int (*version_supported)(struct nvkm_pci *);
26 	} pcie;
27 };
28 
29 u32 nv40_pci_rd32(struct nvkm_pci *, u16);
30 void nv40_pci_wr08(struct nvkm_pci *, u16, u8);
31 void nv40_pci_wr32(struct nvkm_pci *, u16, u32);
32 void nv40_pci_msi_rearm(struct nvkm_pci *);
33 
34 void nv46_pci_msi_rearm(struct nvkm_pci *);
35 
36 void g84_pci_init(struct nvkm_pci *pci);
37 
38 /* pcie functions */
39 void g84_pcie_set_version(struct nvkm_pci *, u8);
40 int g84_pcie_version(struct nvkm_pci *);
41 void g84_pcie_set_link_speed(struct nvkm_pci *, enum nvkm_pcie_speed);
42 enum nvkm_pcie_speed g84_pcie_cur_speed(struct nvkm_pci *);
43 enum nvkm_pcie_speed g84_pcie_max_speed(struct nvkm_pci *);
44 int g84_pcie_init(struct nvkm_pci *);
45 int g84_pcie_set_link(struct nvkm_pci *, enum nvkm_pcie_speed, u8);
46 
47 int g94_pcie_version_supported(struct nvkm_pci *);
48 
49 void gf100_pcie_set_version(struct nvkm_pci *, u8);
50 int gf100_pcie_version(struct nvkm_pci *);
51 void gf100_pcie_set_cap_speed(struct nvkm_pci *, bool);
52 int gf100_pcie_cap_speed(struct nvkm_pci *);
53 int gf100_pcie_init(struct nvkm_pci *);
54 int gf100_pcie_set_link(struct nvkm_pci *, enum nvkm_pcie_speed, u8);
55 
56 int nvkm_pcie_oneinit(struct nvkm_pci *);
57 int nvkm_pcie_init(struct nvkm_pci *);
58 #endif
59