drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c- Extension
.c- Size
- 4340 bytes
- Lines
- 165
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
priv.h
Detected Declarations
function nvkm_pcie_speedfunction nvkm_pcie_get_versionfunction nvkm_pcie_get_max_versionfunction nvkm_pcie_set_versionfunction nvkm_pcie_oneinitfunction nvkm_pcie_initfunction nvkm_pcie_set_link
Annotated Snippet
#include "priv.h"
static char *nvkm_pcie_speeds[] = {
"2.5GT/s",
"5.0GT/s",
"8.0GT/s",
};
static enum nvkm_pcie_speed
nvkm_pcie_speed(enum pci_bus_speed speed)
{
switch (speed) {
case PCIE_SPEED_2_5GT:
return NVKM_PCIE_SPEED_2_5;
case PCIE_SPEED_5_0GT:
return NVKM_PCIE_SPEED_5_0;
case PCIE_SPEED_8_0GT:
return NVKM_PCIE_SPEED_8_0;
default:
/* XXX 0x16 is 8_0, assume 0x17 will be 16_0 for now */
if (speed == 0x17)
return NVKM_PCIE_SPEED_8_0;
return -1;
}
}
static int
nvkm_pcie_get_version(struct nvkm_pci *pci)
{
if (!pci->func->pcie.version)
return -ENOSYS;
return pci->func->pcie.version(pci);
}
static int
nvkm_pcie_get_max_version(struct nvkm_pci *pci)
{
if (!pci->func->pcie.version_supported)
return -ENOSYS;
return pci->func->pcie.version_supported(pci);
}
static int
nvkm_pcie_set_version(struct nvkm_pci *pci, int version)
{
if (!pci->func->pcie.set_version)
return -ENOSYS;
nvkm_trace(&pci->subdev, "set to version %i\n", version);
pci->func->pcie.set_version(pci, version);
return nvkm_pcie_get_version(pci);
}
int
nvkm_pcie_oneinit(struct nvkm_pci *pci)
{
if (pci->func->pcie.max_speed)
nvkm_debug(&pci->subdev, "pcie max speed: %s\n",
nvkm_pcie_speeds[pci->func->pcie.max_speed(pci)]);
return 0;
}
int
nvkm_pcie_init(struct nvkm_pci *pci)
{
struct nvkm_subdev *subdev = &pci->subdev;
int ret;
/* raise pcie version first */
ret = nvkm_pcie_get_version(pci);
if (ret > 0) {
int max_version = nvkm_pcie_get_max_version(pci);
if (max_version > 0 && max_version > ret)
ret = nvkm_pcie_set_version(pci, max_version);
if (ret < max_version)
nvkm_error(subdev, "couldn't raise version: %i\n", ret);
}
if (pci->func->pcie.init)
pci->func->pcie.init(pci);
if (pci->pcie.speed != -1)
nvkm_pcie_set_link(pci, pci->pcie.speed, pci->pcie.width);
return 0;
}
Annotation
- Immediate include surface: `priv.h`.
- Detected declarations: `function nvkm_pcie_speed`, `function nvkm_pcie_get_version`, `function nvkm_pcie_get_max_version`, `function nvkm_pcie_set_version`, `function nvkm_pcie_oneinit`, `function nvkm_pcie_init`, `function nvkm_pcie_set_link`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.