iPXE
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...

Macros

#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 BUS_TYPE_DT   11
 Devicetree 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)

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
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.

Macro Definition Documentation

◆ BUS_TYPE_PCI

◆ BUS_TYPE_ISAPNP

#define BUS_TYPE_ISAPNP   2

ISAPnP bus type.

Definition at line 47 of file device.h.

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

◆ BUS_TYPE_EISA

#define BUS_TYPE_EISA   3

EISA bus type.

Definition at line 50 of file device.h.

Referenced by eisabus_probe(), and netdev_fetch_bustype().

◆ BUS_TYPE_MCA

#define BUS_TYPE_MCA   4

MCA bus type.

Definition at line 53 of file device.h.

Referenced by mcabus_probe(), and netdev_fetch_bustype().

◆ BUS_TYPE_ISA

#define BUS_TYPE_ISA   5

ISA bus type.

Definition at line 56 of file device.h.

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

◆ BUS_TYPE_TAP

#define BUS_TYPE_TAP   6

TAP bus type.

Definition at line 59 of file device.h.

Referenced by netdev_fetch_bustype().

◆ BUS_TYPE_EFI

#define BUS_TYPE_EFI   7

EFI bus type.

Definition at line 62 of file device.h.

Referenced by efi_device_info(), efidev_alloc(), and netdev_fetch_bustype().

◆ BUS_TYPE_XEN

#define BUS_TYPE_XEN   8

Xen bus type.

Definition at line 65 of file device.h.

Referenced by netdev_fetch_bustype(), and xenbus_probe_device().

◆ BUS_TYPE_HV

#define BUS_TYPE_HV   9

Hyper-V bus type.

Definition at line 68 of file device.h.

Referenced by netdev_fetch_bustype(), and vmbus_probe_channels().

◆ BUS_TYPE_USB

#define BUS_TYPE_USB   10

USB bus type.

Definition at line 71 of file device.h.

Referenced by netdev_fetch_bustype(), and usb_probe_all().

◆ BUS_TYPE_DT

#define BUS_TYPE_DT   11

Devicetree bus type.

Definition at line 74 of file device.h.

Referenced by dt_probe_node(), and netdev_fetch_bustype().

◆ ROOT_DEVICES

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

Root device table.

Definition at line 133 of file device.h.

Referenced by probe_devices().

◆ __root_device

#define __root_device   __table_entry ( ROOT_DEVICES, 01 )

Declare a root device.

Definition at line 136 of file device.h.

◆ identify_device_TYPE

#define identify_device_TYPE ( object_type)
Value:
typeof ( struct device * ( object_type ) )
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition acpi.c:48
A hardware device.
Definition device.h:77

Definition at line 178 of file device.h.

178#define identify_device_TYPE( object_type ) \
179 typeof ( struct device * ( object_type ) )

Referenced by identify_device().

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ rootdev_set_drvdata()

void rootdev_set_drvdata ( struct root_device * rootdev,
void * priv )
inlinestatic

Set root device driver-private data.

Parameters
rootdevRoot device
privPrivate data

Definition at line 144 of file device.h.

145 {
146 rootdev->priv = priv;
147}
void * priv
Driver-private data.
Definition device.h:107
static struct tlan_private * priv
Definition tlan.c:225

References priv, and root_device::priv.

Referenced by hv_probe(), and hv_remove().

◆ rootdev_get_drvdata()

void * rootdev_get_drvdata ( struct root_device * rootdev)
inlinestatic

Get root device driver-private data.

Parameters
rootdevRoot device
Return values
privPrivate data

Definition at line 155 of file device.h.

155 {
156 return rootdev->priv;
157}

References root_device::priv.

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

◆ devices_get()

void devices_get ( void )
inlinestatic

Prevent devices from being removed on shutdown.

Definition at line 165 of file device.h.

165 {
167}
int device_keep_count
Device removal inhibition counter.
Definition device.c:45

References device_keep_count.

Referenced by int13_hook(), and pxe_activate().

◆ devices_put()

void devices_put ( void )
inlinestatic

Allow devices to be removed on shutdown.

Definition at line 173 of file device.h.

173 {
175}

References device_keep_count.

Referenced by int13_unhook(), and pxe_deactivate().

◆ identify_device()

struct device * identify_device ( struct interface * intf)
extern

Identify a device behind an interface.

Parameters
intfInterface
Return values
deviceDevice, or NULL

Definition at line 126 of file device.c.

126 {
127 struct interface *dest;
128 identify_device_TYPE ( void * ) *op =
130 void *object = intf_object ( dest );
131 void *device;
132
133 if ( op ) {
134 device = op ( object );
135 } else {
136 /* Default is to return NULL */
137 device = NULL;
138 }
139
140 intf_put ( dest );
141 return device;
142}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" retur dest)
Definition string.h:151
struct device * identify_device(struct interface *intf)
Identify a device behind an interface.
Definition device.c:126
#define identify_device_TYPE(object_type)
Definition device.h:178
void * intf_object(struct interface *intf)
Get pointer to object containing object interface.
Definition interface.c:160
void intf_put(struct interface *intf)
Decrement reference count on an object interface.
Definition interface.c:150
#define intf_get_dest_op(intf, type, dest)
Get object interface destination and operation method.
Definition interface.h:270
static uint16_t struct vmbus_xfer_pages_operations * op
Definition netvsc.h:327
An object interface.
Definition interface.h:125
struct interface * intf
Original interface.
Definition interface.h:159

References dest, identify_device(), identify_device_TYPE, interface::intf, intf_get_dest_op, intf_object(), intf_put(), NULL, and op.

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

Variable Documentation

◆ device_keep_count

int device_keep_count
extern

Device removal inhibition counter.

Definition at line 45 of file device.c.

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