iPXE
Functions
dummy_sanboot.c File Reference

Dummy SAN device. More...

#include <errno.h>
#include <ipxe/sanboot.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static int dummy_san_hook (unsigned int drive, struct uri **uris, unsigned int count, unsigned int flags)
 Hook dummy SAN device. More...
 
static void dummy_san_unhook (unsigned int drive)
 Unhook dummy SAN device. More...
 
static int dummy_san_boot (unsigned int drive __unused, struct san_boot_config *config __unused)
 Boot from dummy SAN device. More...
 
static int dummy_install (struct acpi_header *acpi)
 Install ACPI table. More...
 
static int dummy_san_describe (void)
 Describe dummy SAN device. More...
 
 PROVIDE_SANBOOT (dummy, san_hook, dummy_san_hook)
 
 PROVIDE_SANBOOT (dummy, san_unhook, dummy_san_unhook)
 
 PROVIDE_SANBOOT (dummy, san_boot, dummy_san_boot)
 
 PROVIDE_SANBOOT (dummy, san_describe, dummy_san_describe)
 

Detailed Description

Dummy SAN device.

Definition in file dummy_sanboot.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ dummy_san_hook()

static int dummy_san_hook ( unsigned int  drive,
struct uri **  uris,
unsigned int  count,
unsigned int  flags 
)
static

Hook dummy SAN device.

Parameters
driveDrive number
urisList of URIs
countNumber of URIs
flagsFlags
Return values
driveDrive number, or negative error

Definition at line 44 of file dummy_sanboot.c.

45  {
46  struct san_device *sandev;
47  int rc;
48 
49  /* Allocate SAN device */
50  sandev = alloc_sandev ( uris, count, 0 );
51  if ( ! sandev ) {
52  rc = -ENOMEM;
53  goto err_alloc;
54  }
55 
56  /* Register SAN device */
57  if ( ( rc = register_sandev ( sandev, drive, flags ) ) != 0 ) {
58  DBGC ( sandev->drive, "SAN %#02x could not register: %s\n",
59  sandev->drive, strerror ( rc ) );
60  goto err_register;
61  }
62 
63  return drive;
64 
65  unregister_sandev ( sandev );
66  err_register:
67  sandev_put ( sandev );
68  err_alloc:
69  return rc;
70 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void unregister_sandev(struct san_device *sandev)
Unregister SAN device.
Definition: sanboot.c:939
#define DBGC(...)
Definition: compiler.h:505
static void sandev_put(struct san_device *sandev)
Drop reference to SAN device.
Definition: sanboot.h:225
uint8_t drive
Drive number.
Definition: int13.h:16
#define ENOMEM
Not enough space.
Definition: errno.h:534
unsigned int drive
Drive number.
Definition: sanboot.h:65
int register_sandev(struct san_device *sandev, unsigned int drive, unsigned int flags)
Register SAN device.
Definition: sanboot.c:877
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
A SAN device.
Definition: sanboot.h:58
uint16_t count
Number of entries.
Definition: ena.h:22
struct san_device * alloc_sandev(struct uri **uris, unsigned int count, size_t priv_size)
Allocate SAN device.
Definition: sanboot.c:834
uint8_t flags
Flags.
Definition: ena.h:18

References alloc_sandev(), count, DBGC, drive, san_device::drive, ENOMEM, flags, rc, register_sandev(), sandev_put(), strerror(), and unregister_sandev().

◆ dummy_san_unhook()

static void dummy_san_unhook ( unsigned int  drive)
static

Unhook dummy SAN device.

Parameters
driveDrive number

Definition at line 77 of file dummy_sanboot.c.

77  {
78  struct san_device *sandev;
79 
80  /* Find drive */
81  sandev = sandev_find ( drive );
82  if ( ! sandev ) {
83  DBGC ( drive, "SAN %#02x does not exist\n", drive );
84  return;
85  }
86 
87  /* Unregister SAN device */
88  unregister_sandev ( sandev );
89 
90  /* Drop reference to drive */
91  sandev_put ( sandev );
92 }
void unregister_sandev(struct san_device *sandev)
Unregister SAN device.
Definition: sanboot.c:939
#define DBGC(...)
Definition: compiler.h:505
static void sandev_put(struct san_device *sandev)
Drop reference to SAN device.
Definition: sanboot.h:225
uint8_t drive
Drive number.
Definition: int13.h:16
A SAN device.
Definition: sanboot.h:58
struct san_device * sandev_find(unsigned int drive)
Find SAN device by drive number.
Definition: sanboot.c:90

References DBGC, drive, sandev_find(), sandev_put(), and unregister_sandev().

◆ dummy_san_boot()

static int dummy_san_boot ( unsigned int drive  __unused,
struct san_boot_config *config  __unused 
)
static

Boot from dummy SAN device.

Parameters
driveDrive number
configBoot configuration parameters
Return values
rcReturn status code

Definition at line 101 of file dummy_sanboot.c.

102  {
103 
104  return -EOPNOTSUPP;
105 }
#define EOPNOTSUPP
Operation not supported on socket.
Definition: errno.h:604

References EOPNOTSUPP.

◆ dummy_install()

static int dummy_install ( struct acpi_header acpi)
static

Install ACPI table.

Parameters
acpiACPI description header
Return values
rcReturn status code

Definition at line 113 of file dummy_sanboot.c.

113  {
114 
115  DBGC ( acpi, "ACPI table %s:\n", acpi_name ( acpi->signature ) );
116  DBGC_HDA ( acpi, 0, acpi, le32_to_cpu ( acpi->length ) );
117  return 0;
118 }
#define le32_to_cpu(value)
Definition: byteswap.h:113
#define DBGC(...)
Definition: compiler.h:505
#define DBGC_HDA(...)
Definition: compiler.h:506
static EFI_ACPI_TABLE_PROTOCOL * acpi
ACPI table protocol protocol.
Definition: efi_block.c:65
static const char * acpi_name(uint32_t signature)
Transcribe ACPI table signature (for debugging)
Definition: acpi.h:190

References acpi, acpi_name(), DBGC, DBGC_HDA, and le32_to_cpu.

Referenced by dummy_san_describe().

◆ dummy_san_describe()

static int dummy_san_describe ( void  )
static

Describe dummy SAN device.

Return values
rcReturn status code

Definition at line 125 of file dummy_sanboot.c.

125  {
126 
127  return acpi_install ( dummy_install );
128 }
int acpi_install(int(*install)(struct acpi_header *acpi))
Install ACPI tables.
Definition: acpi.c:336
static int dummy_install(struct acpi_header *acpi)
Install ACPI table.

References acpi_install(), and dummy_install().

◆ PROVIDE_SANBOOT() [1/4]

PROVIDE_SANBOOT ( dummy  ,
san_hook  ,
dummy_san_hook   
)

◆ PROVIDE_SANBOOT() [2/4]

PROVIDE_SANBOOT ( dummy  ,
san_unhook  ,
dummy_san_unhook   
)

◆ PROVIDE_SANBOOT() [3/4]

PROVIDE_SANBOOT ( dummy  ,
san_boot  ,
dummy_san_boot   
)

◆ PROVIDE_SANBOOT() [4/4]

PROVIDE_SANBOOT ( dummy  ,
san_describe  ,
dummy_san_describe   
)