L4Re Operating System Framework – Interface and Usage Documentation
Loading...
Searching...
No Matches
L4vbus::Device Class Reference

Device on a L4vbus::Vbus. More...

#include <vbus>

+ Inheritance diagram for L4vbus::Device:
+ Collaboration diagram for L4vbus::Device:

Public Member Functions

 Device ()
 Construct a new vbus device using the NULL device L4VBUS_NULL.
 
 Device (L4::Cap< Vbus > bus, l4vbus_device_handle_t dev)
 Construct a new vbus device using a device handle.
 
L4::Cap< Vbusbus_cap () const
 Access the Vbus capability of the underlying virtual bus.
 
l4vbus_device_handle_t dev_handle () const
 Access the device handle of this device.
 
int device_by_hid (Device *child, char const *hid, int depth=L4VBUS_MAX_DEPTH, l4vbus_device_t *devinfo=0) const
 Find a device by the hardware interface identifier (HID).
 
int next_device (Device *child, int depth=L4VBUS_MAX_DEPTH, l4vbus_device_t *devinfo=0) const
 Find next child following child.
 
int device (l4vbus_device_t *devinfo) const
 Obtain detailed information about a Vbus device.
 
int get_resource (int res_idx, l4vbus_resource_t *res) const
 Obtain the resource description of an individual device resource.
 
int is_compatible (char const *cid) const
 Check if the given device has a compatibility ID (CID) or HID that matches cid.
 
bool operator== (Device const &o) const
 Test if two devices are the same Vbus device.
 
bool operator!= (Device const &o) const
 Test if two Vbus devices are not the same.
 
- Public Member Functions inherited from L4vbus::Pm< Device >
int pm_suspend () const
 Suspend the device.
 
int pm_resume () const
 Resume the device.
 

Protected Attributes

L4::Cap< Vbus_bus
 The Vbus capability where this device is located on.
 
l4vbus_device_handle_t _dev
 The device handle for this device.
 

Detailed Description

Device on a L4vbus::Vbus.

Definition at line 85 of file vbus.

Constructor & Destructor Documentation

◆ Device()

L4vbus::Device::Device ( L4::Cap< Vbus bus,
l4vbus_device_handle_t  dev 
)
inline

Construct a new vbus device using a device handle.

Specifying the special root bus device handle L4VBUS_ROOT_BUS forms the root device of the corresponding vbus, see Vbus::root.

Parameters
busThe vbus capability where this device is assigned.
devThe device handle of the device.

Definition at line 102 of file vbus.

Member Function Documentation

◆ bus_cap()

L4::Cap< Vbus > L4vbus::Device::bus_cap ( ) const
inline

Access the Vbus capability of the underlying virtual bus.

Returns
the capability to the underlying Vbus.

Definition at line 109 of file vbus.

References _bus.

Referenced by L4vbus::Pci_host_bridge::cfg_read(), L4vbus::Pci_dev::cfg_read(), L4vbus::Pci_host_bridge::cfg_write(), L4vbus::Pci_dev::cfg_write(), L4vbus::Pci_host_bridge::irq_enable(), and L4vbus::Pci_dev::irq_enable().

+ Here is the caller graph for this function:

◆ dev_handle()

l4vbus_device_handle_t L4vbus::Device::dev_handle ( ) const
inline

Access the device handle of this device.

Returns
the device handle for this device.

The device handle is used to directly address the device on its virtual bus.

Definition at line 118 of file vbus.

References _dev.

◆ device()

int L4vbus::Device::device ( l4vbus_device_t devinfo) const
inline

Obtain detailed information about a Vbus device.

Parameters
[out]devinfoInformation structure which contains details about the device. The pointer might be NULL.
Return values
0Success.
-L4_ENODEVNo device with the given device handle dev could be found.

Definition at line 191 of file vbus.

References _bus, _dev, and l4vbus_get_device().

+ Here is the call graph for this function:

◆ device_by_hid()

int L4vbus::Device::device_by_hid ( Device child,
char const *  hid,
int  depth = L4VBUS_MAX_DEPTH,
l4vbus_device_t devinfo = 0 
) const
inline

Find a device by the hardware interface identifier (HID).

This function searches the vbus for a device with the given HID and returns a handle to the first matching device. The HID usually conforms to an ACPI HID or a Linux device tree compatible identifier.

It is possible to have multiple devices with the same HID on a vbus. In order to find all matching devices this function has to be called repeatedly with child pointing to the device found in the previous iteration. The iteration starts at child that might be any device node in the tree.

Parameters
[in,out]childHandle of the device from where in the device tree the search should start. To start searching from the beginning child must be initialized using the default (L4VBUS_NULL). If a matching device is found, its handle is returned through this parameter.
hidHID of the device
depthMaximum depth for the recursive lookup
[out]devinfoDevice information structure (might be NULL)
Return values
>=0A device with the given HID was found.
-L4_ENOENTNo device with the given HID could be found on the vbus.
-L4_EINVALInvalid or no HID provided.
-L4_ENODEVFunction called on a non-existing device.

Definition at line 150 of file vbus.

References _bus, _dev, and l4vbus_get_device_by_hid().

+ Here is the call graph for this function:

◆ get_resource()

int L4vbus::Device::get_resource ( int  res_idx,
l4vbus_resource_t res 
) const
inline

Obtain the resource description of an individual device resource.

Parameters
res_idxIndex of the resource for which the resource description should be returned. The total number of resources for a device is available in the l4vbus_device_t structure that is returned by L4vbus::Device::device_by_hid() and L4vbus::Device::next_device().
[out]resDescriptor of the resource.

This function returns the resource descriptor of an individual device resource selected by the res_idx parameter.

Return values
0Success.
-L4_ENOENTInvalid resource index res_idx.

Definition at line 211 of file vbus.

References _bus, _dev, and l4vbus_get_resource().

+ Here is the call graph for this function:

◆ is_compatible()

int L4vbus::Device::is_compatible ( char const *  cid) const
inline

Check if the given device has a compatibility ID (CID) or HID that matches cid.

Parameters
cidthe compatibility ID to test
Returns
1 when the given ID (cid) matches this device, 0 when the given ID does not match, <0 on error.

Definition at line 225 of file vbus.

References _bus, _dev, and l4vbus_is_compatible().

+ Here is the call graph for this function:

◆ next_device()

int L4vbus::Device::next_device ( Device child,
int  depth = L4VBUS_MAX_DEPTH,
l4vbus_device_t devinfo = 0 
) const
inline

Find next child following child.

Parameters
[in,out]childHandle of the device that precedes the device that shall be returned. To start from the beginning, child must be initialized with L4VBUS_NULL (Device::Device). If a device is found, its handle is returned through this parameter.
depthDepth to look for
[out]devinfoDevice information (might be NULL)
Returns
0 on success, else failure

Definition at line 173 of file vbus.

References _bus, _dev, and l4vbus_get_next_device().

+ Here is the call graph for this function:

◆ operator!=()

bool L4vbus::Device::operator!= ( Device const &  o) const
inline

Test if two Vbus devices are not the same.

Returns
true if the two devices are different, false else.

Definition at line 241 of file vbus.

References _bus, and _dev.

◆ operator==()

bool L4vbus::Device::operator== ( Device const &  o) const
inline

Test if two devices are the same Vbus device.

Returns
true if the two devices are the same, false else.

Definition at line 232 of file vbus.

References _bus, and _dev.


The documentation for this class was generated from the following file: