iPXE
Data Structures | Defines | Functions | Variables
device.h File Reference

Device model. More...

#include <ipxe/list.h>
#include <ipxe/tables.h>

Go to the source code of this file.

Data Structures

struct  device_description
 A hardware device description. More...
struct  device
 A hardware device. More...
struct  root_device
 A root device. More...
struct  root_driver
 A root device driver. More...

Defines

#define BUS_TYPE_PCI   1
 PCI bus type.
#define BUS_TYPE_ISAPNP   2
 ISAPnP bus type.
#define BUS_TYPE_EISA   3
 EISA bus type.
#define BUS_TYPE_MCA   4
 MCA bus type.
#define BUS_TYPE_ISA   5
 ISA bus type.
#define BUS_TYPE_TAP   6
 TAP bus type.
#define BUS_TYPE_EFI   7
 EFI bus type.
#define BUS_TYPE_XEN   8
 Xen bus type.
#define BUS_TYPE_HV   9
 Hyper-V bus type.
#define BUS_TYPE_USB   10
 USB bus type.
#define ROOT_DEVICES   __table ( struct root_device, "root_devices" )
 Root device table.
#define __root_device   __table_entry ( ROOT_DEVICES, 01 )
 Declare a root device.
#define identify_device_TYPE(object_type)   typeof ( struct device * ( object_type ) )

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static void rootdev_set_drvdata (struct root_device *rootdev, void *priv)
 Set root device driver-private data.
static void * rootdev_get_drvdata (struct root_device *rootdev)
 Get root device driver-private data.
static void devices_get (void)
 Prevent devices from being removed on shutdown.
static void devices_put (void)
 Allow devices to be removed on shutdown.
struct deviceidentify_device (struct interface *intf)
 Identify a device behind an interface.

Variables

int device_keep_count
 Device removal inhibition counter.

Detailed Description

Device model.

Definition in file device.h.


Define Documentation

#define BUS_TYPE_PCI   1
#define BUS_TYPE_ISAPNP   2

ISAPnP bus type.

Definition at line 46 of file device.h.

Referenced by isapnpbus_probe(), netdev_fetch_bustype(), pxenv_start_undi(), pxenv_undi_get_nic_type(), and undibus_probe().

#define BUS_TYPE_EISA   3

EISA bus type.

Definition at line 49 of file device.h.

Referenced by eisabus_probe(), and netdev_fetch_bustype().

#define BUS_TYPE_MCA   4

MCA bus type.

Definition at line 52 of file device.h.

Referenced by mcabus_probe(), and netdev_fetch_bustype().

#define BUS_TYPE_ISA   5

ISA bus type.

Definition at line 55 of file device.h.

Referenced by isabus_probe(), netdev_fetch_bustype(), and t509bus_probe().

#define BUS_TYPE_TAP   6

TAP bus type.

Definition at line 58 of file device.h.

Referenced by netdev_fetch_bustype().

#define BUS_TYPE_EFI   7

EFI bus type.

Definition at line 61 of file device.h.

Referenced by efi_device_info(), efi_driver_start(), efidev_parent(), and netdev_fetch_bustype().

#define BUS_TYPE_XEN   8

Xen bus type.

Definition at line 64 of file device.h.

Referenced by netdev_fetch_bustype(), and xenbus_probe_device().

#define BUS_TYPE_HV   9

Hyper-V bus type.

Definition at line 67 of file device.h.

Referenced by netdev_fetch_bustype(), and vmbus_probe_channels().

#define BUS_TYPE_USB   10

USB bus type.

Definition at line 70 of file device.h.

Referenced by netdev_fetch_bustype(), and usb_probe_all().

#define ROOT_DEVICES   __table ( struct root_device, "root_devices" )

Root device table.

Definition at line 129 of file device.h.

Referenced by probe_devices().

Declare a root device.

Definition at line 132 of file device.h.

#define identify_device_TYPE (   object_type)    typeof ( struct device * ( object_type ) )

Definition at line 174 of file device.h.

Referenced by identify_device().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static void rootdev_set_drvdata ( struct root_device rootdev,
void *  priv 
) [inline, static]

Set root device driver-private data.

Parameters:
rootdevRoot device
privPrivate data

Definition at line 140 of file device.h.

References root_device::priv, and priv.

Referenced by hv_probe(), and hv_remove().

                                                     {
        rootdev->priv = priv;
}
static void* rootdev_get_drvdata ( struct root_device rootdev) [inline, static]

Get root device driver-private data.

Parameters:
rootdevRoot device
Return values:
privPrivate data

Definition at line 151 of file device.h.

References root_device::priv.

Referenced by hv_quiesce(), hv_remove(), and hv_unquiesce().

                                                                         {
        return rootdev->priv;
}
static void devices_get ( void  ) [inline, static]

Prevent devices from being removed on shutdown.

Definition at line 161 of file device.h.

References device_keep_count.

Referenced by int13_hook(), and pxe_activate().

static void devices_put ( void  ) [inline, static]

Allow devices to be removed on shutdown.

Definition at line 169 of file device.h.

References device_keep_count.

Referenced by int13_unhook(), and pxe_deactivate().

struct device* identify_device ( struct interface intf) [read]

Identify a device behind an interface.

Parameters:
intfInterface
Return values:
deviceDevice, or NULL

Definition at line 124 of file device.c.

References dest, device, identify_device(), identify_device_TYPE, intf_get_dest_op, intf_object(), intf_put(), NULL, and op.

Referenced by fcpdev_identify_device(), identify_device(), and int13_device_path_info().

                                                           {
        struct interface *dest;
        identify_device_TYPE ( void * ) *op =
                intf_get_dest_op ( intf, identify_device, &dest );
        void *object = intf_object ( dest );
        void *device;

        if ( op ) {
                device = op ( object );
        } else {
                /* Default is to return NULL */
                device = NULL;
        }

        intf_put ( dest );
        return device;
}

Variable Documentation

Device removal inhibition counter.

Definition at line 44 of file device.c.

Referenced by devices_get(), devices_put(), and remove_devices().