Loading...
Searching...
No Matches
L4vbus::Device Class Reference
L4Re C++ Interface » Vbus API

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< Vbus > | bus_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 (unsigned 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 83 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

  bus | The vbus capability where this device is assigned.
  dev | The device handle of the device.

Definition at line 100 of file vbus.

References _bus, and _dev.

## 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 107 of file vbus.

References _bus.

Referenced by L4vbus::Pci_dev::cfg_read(), L4vbus::Pci_host_bridge::cfg_read(), L4vbus::Pci_dev::cfg_write(), L4vbus::Pci_host_bridge::cfg_write(), L4vbus::Pci_dev::irq_enable(), and L4vbus::Pci_host_bridge::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 116 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] | devinfo | Information structure which contains details about the device. The pointer might be NULL.

Return values

  0 | Success.
  -L4_ENODEV | No device with the given device handle dev could be found.

Definition at line 189 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] | child | Handle 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.
  | hid | HID of the device
  | depth | Maximum depth for the recursive lookup
  [out] | devinfo | Device information structure (might be NULL)

Return values

  >=0 | A device with the given HID was found.
  -L4_ENOENT | No device with the given HID could be found on the vbus.
  -L4_EINVAL | Invalid or no HID provided.
  -L4_ENODEV | Function called on a non-existing device.

Definition at line 148 of file vbus.

References _bus, _dev, Device(), and l4vbus_get_device_by_hid().

Here is the call graph for this function:

## get_resource()

int L4vbus::Device::get_resource | ( | unsigned | res_idx,
|  | l4vbus_resource_t * | res ) const

inline

Obtain the resource description of an individual device resource.

Parameters

  | res_idx | Index 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] | res | Descriptor of the resource.

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

Return values

  0 | Success.
  -L4_ENOENT | Invalid resource index res_idx.

Definition at line 209 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

  cid | the 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 223 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] | child | Handle 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.
  | depth | Depth to look for
  [out] | devinfo | Device information (might be NULL)

Returns
  0 on success, else failure

Definition at line 171 of file vbus.

References _bus, _dev, Device(), 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 239 of file vbus.

References _bus, _dev, and Device().

Here is the call graph for this function:

## 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 230 of file vbus.

References _bus, _dev, and Device().

Here is the call graph for this function:

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

- l4/vbus/vbus