pci: Add driver_data to pci_device_id_s

so driver writer could save the private data here
and get it back in the probe function.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2024-03-21 02:49:07 +08:00 committed by Xiang Xiao
parent 639843ade3
commit 1d586c3bee
2 changed files with 14 additions and 10 deletions

View File

@ -1839,6 +1839,7 @@ int pci_register_driver(FAR struct pci_driver_s *drv)
{
if (pci_match_one_device(id, dev))
{
dev->id = id;
if (drv->probe(dev) >= 0)
{
dev->drv = drv;
@ -1927,6 +1928,7 @@ int pci_register_device(FAR struct pci_device_s *dev)
{
if (pci_match_one_device(id, dev))
{
dev->id = id;
if (drv->probe(dev) >= 0)
{
dev->drv = drv;

View File

@ -219,6 +219,17 @@ enum
/* The pci_device_s structure is used to describe PCI devices. */
struct pci_device_id_s
{
uint16_t vendor; /* Vendor id */
uint16_t device; /* Device id */
uint32_t subvendor; /* Sub vendor id */
uint32_t subdevice; /* Sub device id */
uint32_t class; /* (Class, subclass, prog-if) triplet */
uint32_t class_mask;
uintptr_t driver_data;
};
struct pci_device_s
{
struct list_node node;
@ -239,6 +250,7 @@ struct pci_device_s
struct pci_resource_s resource[PCI_NUM_RESOURCES];
FAR const struct pci_device_id_s *id;
FAR struct pci_driver_s *drv;
FAR void *priv; /* Used by pci driver */
};
@ -306,16 +318,6 @@ struct pci_controller_s
uint8_t busno;
};
struct pci_device_id_s
{
uint16_t vendor; /* Vendor id */
uint16_t device; /* Device id */
uint32_t subvendor; /* Sub vendor id */
uint32_t subdevice; /* Sub device id */
uint32_t class; /* (Class, subclass, prog-if) triplet */
uint32_t class_mask;
};
struct pci_driver_s
{
FAR const struct pci_device_id_s *id_table;