iPXE
Functions
dummy_sanboot.c File Reference

Dummy SAN device. More...

#include <string.h>
#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 45 of file dummy_sanboot.c.

46  {
47  struct san_device *sandev;
48  int rc;
49 
50  /* Allocate SAN device */
51  sandev = alloc_sandev ( uris, count, 0 );
52  if ( ! sandev ) {
53  rc = -ENOMEM;
54  goto err_alloc;
55  }
56 
57  /* Register SAN device */
58  if ( ( rc = register_sandev ( sandev, drive, flags ) ) != 0 ) {
59  DBGC ( sandev->drive, "SAN %#02x could not register: %s\n",
60  sandev->drive, strerror ( rc ) );
61  goto err_register;
62  }
63 
64  return drive;
65 
66  unregister_sandev ( sandev );
67  err_register:
68  sandev_put ( sandev );
69  err_alloc:
70  return rc;
71 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void unregister_sandev(struct san_device *sandev)
Unregister SAN device.
Definition: sanboot.c:941
#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:879
static unsigned int count
Number of entries.
Definition: dwmac.h:225
uint8_t flags
Flags.
Definition: ena.h:18
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
A SAN device.
Definition: sanboot.h:58
struct san_device * alloc_sandev(struct uri **uris, unsigned int count, size_t priv_size)
Allocate SAN device.
Definition: sanboot.c:836

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 78 of file dummy_sanboot.c.

78  {
79  struct san_device *sandev;
80 
81  /* Find drive */
82  sandev = sandev_find ( drive );
83  if ( ! sandev ) {
84  DBGC ( drive, "SAN %#02x does not exist\n", drive );
85  return;
86  }
87 
88  /* Unregister SAN device */
89  unregister_sandev ( sandev );
90 
91  /* Drop reference to drive */
92  sandev_put ( sandev );
93 }
void unregister_sandev(struct san_device *sandev)
Unregister SAN device.
Definition: sanboot.c:941
#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:91

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 102 of file dummy_sanboot.c.

103  {
104 
105  return -EOPNOTSUPP;
106 }
#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 114 of file dummy_sanboot.c.

114  {
115 
116  DBGC ( acpi, "ACPI table %s:\n", acpi_name ( acpi->signature ) );
117  DBGC_HDA ( acpi, 0, acpi, le32_to_cpu ( acpi->length ) );
118  return 0;
119 }
#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:66
static const char * acpi_name(uint32_t signature)
Transcribe ACPI table signature (for debugging)
Definition: acpi.h:206

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 126 of file dummy_sanboot.c.

126  {
127 
128  return acpi_install ( dummy_install );
129 }
int acpi_install(int(*install)(struct acpi_header *acpi))
Install ACPI tables.
Definition: acpi.c:343
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   
)