iPXE
Data Structures | Macros | 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...
 

Macros

#define BUS_TYPE_PCI   1
 PCI bus type. More...
 
#define BUS_TYPE_ISAPNP   2
 ISAPnP bus type. More...
 
#define BUS_TYPE_EISA   3
 EISA bus type. More...
 
#define BUS_TYPE_MCA   4
 MCA bus type. More...
 
#define BUS_TYPE_ISA   5
 ISA bus type. More...
 
#define BUS_TYPE_TAP   6
 TAP bus type. More...
 
#define BUS_TYPE_EFI   7
 EFI bus type. More...
 
#define BUS_TYPE_XEN   8
 Xen bus type. More...
 
#define BUS_TYPE_HV   9
 Hyper-V bus type. More...
 
#define BUS_TYPE_USB   10
 USB bus type. More...
 
#define ROOT_DEVICES   __table ( struct root_device, "root_devices" )
 Root device table. More...
 
#define __root_device   __table_entry ( ROOT_DEVICES, 01 )
 Declare a root device. More...
 
#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. More...
 
static void * rootdev_get_drvdata (struct root_device *rootdev)
 Get root device driver-private data. More...
 
static void devices_get (void)
 Prevent devices from being removed on shutdown. More...
 
static void devices_put (void)
 Allow devices to be removed on shutdown. More...
 
struct deviceidentify_device (struct interface *intf)
 Identify a device behind an interface. More...
 

Variables

int device_keep_count
 Device removal inhibition counter. More...
 

Detailed Description

Device model.

Definition in file device.h.

Macro Definition Documentation

◆ BUS_TYPE_PCI

#define BUS_TYPE_PCI   1

PCI bus type.

Definition at line 43 of file device.h.

◆ BUS_TYPE_ISAPNP

#define BUS_TYPE_ISAPNP   2

ISAPnP bus type.

Definition at line 46 of file device.h.

◆ BUS_TYPE_EISA

#define BUS_TYPE_EISA   3

EISA bus type.

Definition at line 49 of file device.h.

◆ BUS_TYPE_MCA

#define BUS_TYPE_MCA   4

MCA bus type.

Definition at line 52 of file device.h.

◆ BUS_TYPE_ISA

#define BUS_TYPE_ISA   5

ISA bus type.

Definition at line 55 of file device.h.

◆ BUS_TYPE_TAP

#define BUS_TYPE_TAP   6

TAP bus type.

Definition at line 58 of file device.h.

◆ BUS_TYPE_EFI

#define BUS_TYPE_EFI   7

EFI bus type.

Definition at line 61 of file device.h.

◆ BUS_TYPE_XEN

#define BUS_TYPE_XEN   8

Xen bus type.

Definition at line 64 of file device.h.

◆ BUS_TYPE_HV

#define BUS_TYPE_HV   9

Hyper-V bus type.

Definition at line 67 of file device.h.

◆ BUS_TYPE_USB

#define BUS_TYPE_USB   10

USB bus type.

Definition at line 70 of file device.h.

◆ ROOT_DEVICES

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

Root device table.

Definition at line 129 of file device.h.

◆ __root_device

#define __root_device   __table_entry ( ROOT_DEVICES, 01 )

Declare a root device.

Definition at line 132 of file device.h.

◆ identify_device_TYPE

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

Definition at line 174 of file device.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ rootdev_set_drvdata()

static 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 140 of file device.h.

141  {
142  rootdev->priv = priv;
143 }
void * priv
Driver-private data.
Definition: device.h:103
static struct tlan_private * priv
Definition: tlan.c:224

References root_device::priv, and priv.

Referenced by hv_probe(), and hv_remove().

◆ rootdev_get_drvdata()

static 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 151 of file device.h.

151  {
152  return rootdev->priv;
153 }
void * priv
Driver-private data.
Definition: device.h:103

References root_device::priv.

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

◆ devices_get()

static void devices_get ( void  )
inlinestatic

Prevent devices from being removed on shutdown.

Definition at line 161 of file device.h.

161  {
163 }
int device_keep_count
Device removal inhibition counter.
Definition: device.c:44

References device_keep_count.

Referenced by int13_hook(), and pxe_activate().

◆ devices_put()

static void devices_put ( void  )
inlinestatic

Allow devices to be removed on shutdown.

Definition at line 169 of file device.h.

169  {
171 }
int device_keep_count
Device removal inhibition counter.
Definition: device.c:44

References device_keep_count.

Referenced by int13_unhook(), and pxe_deactivate().

◆ identify_device()

struct device* identify_device ( struct interface intf)

Identify a device behind an interface.

Parameters
intfInterface
Return values
deviceDevice, or NULL

Definition at line 125 of file device.c.

125  {
126  struct interface *dest;
127  identify_device_TYPE ( void * ) *op =
129  void *object = intf_object ( dest );
130  void *device;
131 
132  if ( op ) {
133  device = op ( object );
134  } else {
135  /* Default is to return NULL */
136  device = NULL;
137  }
138 
139  intf_put ( dest );
140  return device;
141 }
uint16_t device
Device ID.
Definition: ena.h:24
void * intf_object(struct interface *intf)
Get pointer to object containing object interface.
Definition: interface.c:159
struct interface * intf
Original interface.
Definition: interface.h:158
A hardware device.
Definition: device.h:73
An object interface.
Definition: interface.h:124
static void * dest
Definition: strings.h:176
static uint16_t struct vmbus_xfer_pages_operations * op
Definition: netvsc.h:327
void intf_put(struct interface *intf)
Decrement reference count on an object interface.
Definition: interface.c:149
#define identify_device_TYPE(object_type)
Definition: device.h:174
struct device * identify_device(struct interface *intf)
Identify a device behind an interface.
Definition: device.c:125
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
#define intf_get_dest_op(intf, type, dest)
Get object interface destination and operation method.
Definition: interface.h:269

References dest, device, 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

Device removal inhibition counter.

Definition at line 44 of file device.c.

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