-
- Downloads
rust: add basic PCI driver abstractions
This commit implements the abstractions necessary to bind a most basic PCI driver to a PCI device. It also serves as a ground layer for further PCI functionality. Specifically, a basic PCI driver has to provide register() and unregister() methods, a PCI device structure for Rust, and probe() and remove() callbacks for the C side. A PCI driver shall be able to register itself for the desired devices, recognized by their device ID. Another basic necessity is the ability to store driver data, i.e., through pci_set_drvdata(). In congruency with the C implementation of pci_dev, a Rust PCI device holds a basic device (device::Device) which is always reference counted to ensure it cannot disappear as long as there are still users. Holding a basic device allows for both using interfaces that require a device, as well as such that demand a pci_dev, which can be obtained through as_raw(), using the established container_of() macro. Implement a basic driver model with probe() and remove() callbacks, implementing the corresponding traits from the 'driver' crate. Implement PCI device IDs. Implement pci::Device with basic methods, holding an always reference counted device::Device. Signed-off-by:FUJITA Tomonori <fujita.tomonori@gmail.com> Co-developed-by:
Philipp Stanner <pstanner@redhat.com> Signed-off-by:
Philipp Stanner <pstanner@redhat.com> Co-developed-by:
Danilo Krummrich <dakr@redhat.com> Signed-off-by:
Danilo Krummrich <dakr@redhat.com>
Loading
Please register or sign in to comment