1 #ifndef __NVKM_PCI_H__
2 #define __NVKM_PCI_H__
3 #include <core/subdev.h>
4 
5 enum nvkm_pcie_speed {
6 	NVKM_PCIE_SPEED_2_5,
7 	NVKM_PCIE_SPEED_5_0,
8 	NVKM_PCIE_SPEED_8_0,
9 };
10 
11 struct nvkm_pci {
12 	const struct nvkm_pci_func *func;
13 	struct nvkm_subdev subdev;
14 	struct pci_dev *pdev;
15 	int irq;
16 
17 	struct {
18 		struct agp_bridge_data *bridge;
19 		u32 mode;
20 		u64 base;
21 		u64 size;
22 		int mtrr;
23 		bool cma;
24 		bool acquired;
25 	} agp;
26 
27 	struct {
28 		enum nvkm_pcie_speed speed;
29 		u8 width;
30 	} pcie;
31 
32 	bool msi;
33 };
34 
35 u32 nvkm_pci_rd32(struct nvkm_pci *, u16 addr);
36 void nvkm_pci_wr08(struct nvkm_pci *, u16 addr, u8 data);
37 void nvkm_pci_wr32(struct nvkm_pci *, u16 addr, u32 data);
38 u32 nvkm_pci_mask(struct nvkm_pci *, u16 addr, u32 mask, u32 value);
39 void nvkm_pci_rom_shadow(struct nvkm_pci *, bool shadow);
40 
41 int nv04_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
42 int nv40_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
43 int nv46_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
44 int nv4c_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
45 int g84_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
46 int g92_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
47 int g94_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
48 int gf100_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
49 int gf106_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
50 int gk104_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
51 int gp100_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
52 
53 /* pcie functions */
54 int nvkm_pcie_set_link(struct nvkm_pci *, enum nvkm_pcie_speed, u8 width);
55 #endif
56