pci.h 1.5 KB
Newer Older
B
Ben Skeggs 已提交
1 2 3 4
#ifndef __NVKM_PCI_H__
#define __NVKM_PCI_H__
#include <core/subdev.h>

5 6 7 8 9 10
enum nvkm_pcie_speed {
	NVKM_PCIE_SPEED_2_5,
	NVKM_PCIE_SPEED_5_0,
	NVKM_PCIE_SPEED_8_0,
};

B
Ben Skeggs 已提交
11 12 13
struct nvkm_pci {
	const struct nvkm_pci_func *func;
	struct nvkm_subdev subdev;
14 15
	struct pci_dev *pdev;
	int irq;
16 17 18 19 20 21 22 23 24 25 26

	struct {
		struct agp_bridge_data *bridge;
		u32 mode;
		u64 base;
		u64 size;
		int mtrr;
		bool cma;
		bool acquired;
	} agp;

27 28 29 30 31
	struct {
		enum nvkm_pcie_speed speed;
		u8 width;
	} pcie;

32
	bool msi;
B
Ben Skeggs 已提交
33 34 35 36 37
};

u32 nvkm_pci_rd32(struct nvkm_pci *, u16 addr);
void nvkm_pci_wr08(struct nvkm_pci *, u16 addr, u8 data);
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);
B
Ben Skeggs 已提交
39 40 41 42
void nvkm_pci_rom_shadow(struct nvkm_pci *, bool shadow);

int nv04_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
int nv40_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
43
int nv46_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
B
Ben Skeggs 已提交
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 **);
B
Ben Skeggs 已提交
47
int gf100_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
48
int gf106_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
49
int gk104_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
50
int gp100_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
51 52 53

/* pcie functions */
int nvkm_pcie_set_link(struct nvkm_pci *, enum nvkm_pcie_speed, u8 width);
B
Ben Skeggs 已提交
54
#endif