drivers/accel/amdxdna/amdxdna_sysfs.c
Source file repositories/reference/linux-study-clean/drivers/accel/amdxdna/amdxdna_sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/accel/amdxdna/amdxdna_sysfs.c- Extension
.c- Size
- 1705 bytes
- Lines
- 71
- Domain
- Driver Families
- Bucket
- drivers/accel
- 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
drm/amdxdna_accel.hdrm/drm_device.hdrm/drm_gem_shmem_helper.hdrm/drm_print.hdrm/gpu_scheduler.hlinux/types.hamdxdna_gem.hamdxdna_pci_drv.h
Detected Declarations
function Copyrightfunction device_type_showfunction fw_version_showfunction amdxdna_sysfs_initfunction amdxdna_sysfs_fini
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2023-2024, Advanced Micro Devices, Inc.
*/
#include <drm/amdxdna_accel.h>
#include <drm/drm_device.h>
#include <drm/drm_gem_shmem_helper.h>
#include <drm/drm_print.h>
#include <drm/gpu_scheduler.h>
#include <linux/types.h>
#include "amdxdna_gem.h"
#include "amdxdna_pci_drv.h"
static ssize_t vbnv_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct amdxdna_dev *xdna = dev_get_drvdata(dev);
if (!xdna->vbnv)
return sprintf(buf, "\n");
return sprintf(buf, "%s\n", xdna->vbnv);
}
static DEVICE_ATTR_RO(vbnv);
static ssize_t device_type_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct amdxdna_dev *xdna = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", xdna->dev_info->device_type);
}
static DEVICE_ATTR_RO(device_type);
static ssize_t fw_version_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct amdxdna_dev *xdna = dev_get_drvdata(dev);
return sprintf(buf, "%d.%d.%d.%d\n", xdna->fw_ver.major,
xdna->fw_ver.minor, xdna->fw_ver.sub,
xdna->fw_ver.build);
}
static DEVICE_ATTR_RO(fw_version);
static struct attribute *amdxdna_attrs[] = {
&dev_attr_device_type.attr,
&dev_attr_vbnv.attr,
&dev_attr_fw_version.attr,
NULL,
};
static struct attribute_group amdxdna_attr_group = {
.attrs = amdxdna_attrs,
};
int amdxdna_sysfs_init(struct amdxdna_dev *xdna)
{
int ret;
ret = sysfs_create_group(&xdna->ddev.dev->kobj, &amdxdna_attr_group);
if (ret)
XDNA_ERR(xdna, "Create attr group failed");
return ret;
}
void amdxdna_sysfs_fini(struct amdxdna_dev *xdna)
{
sysfs_remove_group(&xdna->ddev.dev->kobj, &amdxdna_attr_group);
}
Annotation
- Immediate include surface: `drm/amdxdna_accel.h`, `drm/drm_device.h`, `drm/drm_gem_shmem_helper.h`, `drm/drm_print.h`, `drm/gpu_scheduler.h`, `linux/types.h`, `amdxdna_gem.h`, `amdxdna_pci_drv.h`.
- Detected declarations: `function Copyright`, `function device_type_show`, `function fw_version_show`, `function amdxdna_sysfs_init`, `function amdxdna_sysfs_fini`.
- Atlas domain: Driver Families / drivers/accel.
- 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.