drivers/pci/doe.c
Source file repositories/reference/linux-study-clean/drivers/pci/doe.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/doe.c- Extension
.c- Size
- 23410 bytes
- Lines
- 894
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/delay.hlinux/device.hlinux/jiffies.hlinux/mutex.hlinux/pci.hlinux/pci-doe.hlinux/sysfs.hlinux/workqueue.hpci.h
Detected Declarations
struct pci_doe_mbstruct pci_doe_featurestruct pci_doe_taskfunction doe_discovery_showfunction pci_doe_features_sysfs_group_visiblefunction pci_doe_sysfs_feature_showfunction pci_doe_sysfs_feature_removefunction pci_doe_sysfs_feature_populatefunction pci_doe_sysfs_teardownfunction pci_doe_sysfs_initfunction xa_for_eachfunction pci_doe_waitfunction pci_doe_write_ctrlfunction pci_doe_abortfunction pci_doe_send_reqfunction pci_doe_data_obj_readyfunction pci_doe_recv_respfunction signal_task_completefunction signal_task_abortfunction doe_statemachine_workfunction pci_doe_task_completefunction pci_doe_discoveryfunction pci_doe_cache_featuresfunction pci_doe_cancel_tasksfunction pci_doe_create_mbfunction pci_doe_destroy_mbfunction pci_doe_supports_featfunction pci_doe_submit_taskfunction pci_doefunction pci_find_doe_mailboxfunction pci_doe_initfunction pci_doe_destroyfunction pci_doe_disconnectedexport pci_doeexport pci_find_doe_mailbox
Annotated Snippet
struct pci_doe_mb {
struct pci_dev *pdev;
u16 cap_offset;
struct xarray feats;
wait_queue_head_t wq;
struct workqueue_struct *work_queue;
unsigned long flags;
#ifdef CONFIG_SYSFS
struct device_attribute *sysfs_attrs;
#endif
};
struct pci_doe_feature {
u16 vid;
u8 type;
};
/**
* struct pci_doe_task - represents a single query/response
*
* @feat: DOE Feature
* @request_pl: The request payload
* @request_pl_sz: Size of the request payload (bytes)
* @response_pl: The response payload
* @response_pl_sz: Size of the response payload (bytes)
* @rv: Return value. Length of received response or error (bytes)
* @complete: Called when task is complete
* @private: Private data for the consumer
* @work: Used internally by the mailbox
* @doe_mb: Used internally by the mailbox
*/
struct pci_doe_task {
struct pci_doe_feature feat;
const __le32 *request_pl;
size_t request_pl_sz;
__le32 *response_pl;
size_t response_pl_sz;
int rv;
void (*complete)(struct pci_doe_task *task);
void *private;
/* initialized by pci_doe_submit_task() */
struct work_struct work;
struct pci_doe_mb *doe_mb;
};
#ifdef CONFIG_SYSFS
static ssize_t doe_discovery_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return sysfs_emit(buf, "0001:00\n");
}
static DEVICE_ATTR_RO(doe_discovery);
static struct attribute *pci_doe_sysfs_feature_attrs[] = {
&dev_attr_doe_discovery.attr,
NULL
};
static bool pci_doe_features_sysfs_group_visible(struct kobject *kobj)
{
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
return !xa_empty(&pdev->doe_mbs);
}
DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(pci_doe_features_sysfs)
const struct attribute_group pci_doe_sysfs_group = {
.name = "doe_features",
.attrs = pci_doe_sysfs_feature_attrs,
.is_visible = SYSFS_GROUP_VISIBLE(pci_doe_features_sysfs),
};
static ssize_t pci_doe_sysfs_feature_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return sysfs_emit(buf, "%s\n", attr->attr.name);
}
static void pci_doe_sysfs_feature_remove(struct pci_dev *pdev,
struct pci_doe_mb *doe_mb)
{
struct device_attribute *attrs = doe_mb->sysfs_attrs;
struct device *dev = &pdev->dev;
unsigned long i;
void *entry;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/delay.h`, `linux/device.h`, `linux/jiffies.h`, `linux/mutex.h`, `linux/pci.h`, `linux/pci-doe.h`, `linux/sysfs.h`.
- Detected declarations: `struct pci_doe_mb`, `struct pci_doe_feature`, `struct pci_doe_task`, `function doe_discovery_show`, `function pci_doe_features_sysfs_group_visible`, `function pci_doe_sysfs_feature_show`, `function pci_doe_sysfs_feature_remove`, `function pci_doe_sysfs_feature_populate`, `function pci_doe_sysfs_teardown`, `function pci_doe_sysfs_init`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: integration 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.