drivers/gpu/drm/loongson/lsdc_probe.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/loongson/lsdc_probe.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/loongson/lsdc_probe.c- Extension
.c- Size
- 1239 bytes
- Lines
- 57
- 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.
Dependency Surface
lsdc_drv.hlsdc_probe.h
Detected Declarations
function Copyright
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2023 Loongson Technology Corporation Limited
*/
#include "lsdc_drv.h"
#include "lsdc_probe.h"
/*
* Processor ID (implementation) values for bits 15:8 of the PRID register.
*/
#define LOONGSON_CPU_IMP_MASK 0xff00
#define LOONGSON_CPU_IMP_SHIFT 8
#define LOONGARCH_CPU_IMP_LS2K1000 0xa0
#define LOONGARCH_CPU_IMP_LS2K2000 0xb0
#define LOONGARCH_CPU_IMP_LS3A5000 0xc0
#define LOONGSON_CPU_MIPS_IMP_LS2K 0x61 /* Loongson 2K Mips series SoC */
/*
* Particular Revision values for bits 7:0 of the PRID register.
*/
#define LOONGSON_CPU_REV_MASK 0x00ff
#define LOONGARCH_CPUCFG_PRID_REG 0x0
/*
* We can achieve fine-grained control with the information about the host.
*/
unsigned int loongson_cpu_get_prid(u8 *imp, u8 *rev)
{
unsigned int prid = 0;
#if defined(__loongarch__)
__asm__ volatile("cpucfg %0, %1\n\t"
: "=&r"(prid)
: "r"(LOONGARCH_CPUCFG_PRID_REG)
);
#endif
#if defined(__mips__)
__asm__ volatile("mfc0\t%0, $15\n\t"
: "=r" (prid)
);
#endif
if (imp)
*imp = (prid & LOONGSON_CPU_IMP_MASK) >> LOONGSON_CPU_IMP_SHIFT;
if (rev)
*rev = prid & LOONGSON_CPU_REV_MASK;
return prid;
}
Annotation
- Immediate include surface: `lsdc_drv.h`, `lsdc_probe.h`.
- Detected declarations: `function Copyright`.
- 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.