iPXE
Data Structures | Defines | Typedefs | Functions | Variables
efi_bofm.c File Reference

IBM BladeCenter Open Fabric Manager (BOFM) EFI interface. More...

#include <errno.h>
#include <ipxe/bofm.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_pci.h>
#include <ipxe/efi/efi_driver.h>

Go to the source code of this file.

Data Structures

struct  BOFM_EPID_Results_t
struct  BOFM_Parameters_t
struct  BOFM_Results_t
struct  BOFM_DataStructure_t
struct  _IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL
struct  _IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL2

Defines

#define IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL_GUID
#define IBM_BOFM_DRIVER_CONFIGURATION2_PROTOCOL_GUID
#define IBM_BOFM_TABLE   BOFM_DataStructure_t

Typedefs

typedef struct
_IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL 
IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL
typedef struct
_IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL2 
IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL2
typedef EFI_HANDLE ControllerHandle
typedef EFI_HANDLE UINT8 SupporttedOptions
typedef EFI_HANDLE UINT8 UINT8 iSCSI_Parameter_Version
typedef EFI_HANDLE UINT8 UINT8
UINT8 
BOFM_Parameter_Version
typedef EFI_HANDLE BOOLEAN ResetRequired
typedef EFI_HANDLE BOOLEAN UINT8 BOFMReturnCode

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
typedef EFI_STATUS (EFIAPI *IBM_BOFM_DRIVER_CONFIGURATION_SUPPORT)(IN IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL *This
static int efi_bofm_supported (EFI_HANDLE device)
 Check if device is supported.
static int efi_bofm_start (struct efi_device *efidev)
 Attach driver to device.
static void efi_bofm_stop (struct efi_device *efidev __unused)
 Detach driver from device.
struct efi_driver efi_bofm_driver __efi_driver (EFI_DRIVER_EARLY)
 EFI BOFM driver.

Variables

static EFI_GUID bofm1_protocol_guid
 BOFM1 protocol GUID.
static EFI_GUID bofm2_protocol_guid
 BOFM2 protocol GUID.

Detailed Description

IBM BladeCenter Open Fabric Manager (BOFM) EFI interface.

Definition in file efi_bofm.c.


Define Documentation

Value:
{ 0x03207ce2, 0xd9c7, 0x11dc,                                   \
          { 0xa9, 0x4d, 0x00, 0x19, 0x7d, 0x89, 0x02, 0x38 } }

Definition at line 48 of file efi_bofm.c.

Value:
{ 0xe82a9763, 0x0584, 0x4e41,                                   \
          { 0xbb, 0x39, 0xe0, 0xcd, 0xb8, 0xc1, 0xf0, 0xfc } }

Definition at line 52 of file efi_bofm.c.

Definition at line 99 of file efi_bofm.c.

Referenced by efi_bofm_start().


Typedef Documentation

Definition at line 101 of file efi_bofm.c.

Definition at line 104 of file efi_bofm.c.

Definition at line 109 of file efi_bofm.c.

Definition at line 109 of file efi_bofm.c.

Definition at line 109 of file efi_bofm.c.

Definition at line 109 of file efi_bofm.c.

Definition at line 117 of file efi_bofm.c.

Definition at line 117 of file efi_bofm.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
typedef EFI_STATUS ( EFIAPI IBM_BOFM_DRIVER_CONFIGURATION_SUPPORT)
static int efi_bofm_supported ( EFI_HANDLE  device) [static]

Check if device is supported.

Parameters:
deviceEFI device handle
Return values:
rcReturn status code

Definition at line 165 of file efi_bofm.c.

References bofm_find_driver(), EFI_SYSTEM_TABLE::BootServices, DBGC, DBGCP, EEFI, efi_handle_name(), efi_systab, efipci_info(), pci_device::id, EFI_BOOT_SERVICES::LocateProtocol, pci_device_id::name, NULL, rc, and strerror().

                                                    {
        EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
        struct pci_device pci;
        union {
                IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL *bofm1;
                void *interface;
        } bofm1;
        EFI_STATUS efirc;
        int rc;

        /* Get PCI device information */
        if ( ( rc = efipci_info ( device, &pci ) ) != 0 )
                return rc;

        /* Look for a BOFM driver */
        if ( ( rc = bofm_find_driver ( &pci ) ) != 0 ) {
                DBGCP ( device, "EFIBOFM %s has no driver\n",
                        efi_handle_name ( device ) );
                return rc;
        }

        /* Locate BOFM protocol */
        if ( ( efirc = bs->LocateProtocol ( &bofm1_protocol_guid, NULL,
                                            &bofm1.interface ) ) != 0 ) {
                rc = -EEFI ( efirc );
                DBGC ( device, "EFIBOFM %s cannot find BOFM protocol\n",
                       efi_handle_name ( device ) );
                return rc;
        }

        /* Register support for this device */
        if ( ( efirc = bofm1.bofm1->RegisterSupport ( bofm1.bofm1, device,
                                                      0x04 /* Can change MAC */,
                                                      0x00 /* No iSCSI */,
                                                      0x02 /* Version */ ))!=0){
                rc = -EEFI ( efirc );
                DBGC ( device, "EFIBOFM %s could not register support: %s\n",
                       efi_handle_name ( device ), strerror ( rc ) );
                return rc;
        }

        DBGC ( device, "EFIBOFM %s has driver \"%s\"\n",
               efi_handle_name ( device ), pci.id->name );
        return 0;
}
static int efi_bofm_start ( struct efi_device efidev) [static]

Attach driver to device.

Parameters:
efidevEFI device
Return values:
rcReturn status code

Definition at line 217 of file efi_bofm.c.

References assert, bofm(), EFI_SYSTEM_TABLE::BootServices, DBGC, DBGC2, DBGC2_HD, efi_device::device, EAGAIN, EEFI, efi_handle_name(), EFI_OPEN_PROTOCOL_GET_PROTOCOL, efi_systab, efipci_close(), efipci_open(), FALSE, IBM_BOFM_TABLE, EFI_BOOT_SERVICES::LocateProtocol, NULL, rc, strerror(), and virt_to_user().

                                                        {
        EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
        EFI_HANDLE device = efidev->device;
        union {
                IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL *bofm1;
                void *interface;
        } bofm1;
        union {
                IBM_BOFM_DRIVER_CONFIGURATION_PROTOCOL2 *bofm2;
                void *interface;
        } bofm2;
        struct pci_device pci;
        IBM_BOFM_TABLE *bofmtab;
        IBM_BOFM_TABLE *bofmtab2;
        int bofmrc;
        EFI_STATUS efirc;
        int rc;

        /* Open PCI device, if possible */
        if ( ( rc = efipci_open ( device, EFI_OPEN_PROTOCOL_GET_PROTOCOL,
                                  &pci ) ) != 0 )
                goto err_open;

        /* Locate BOFM protocol */
        if ( ( efirc = bs->LocateProtocol ( &bofm1_protocol_guid, NULL,
                                            &bofm1.interface ) ) != 0 ) {
                rc = -EEFI ( efirc );
                DBGC ( device, "EFIBOFM %s cannot find BOFM protocol\n",
                       efi_handle_name ( device ) );
                goto err_locate_bofm;
        }
        bofmtab = &bofm1.bofm1->BofmTable;
        DBGC ( device, "EFIBOFM %s found version 1 BOFM table at %p+%04x\n",
               efi_handle_name ( device ), bofmtab, bofmtab->Parameters.Length);

        /* Locate BOFM2 protocol, if available */
        if ( ( efirc = bs->LocateProtocol ( &bofm2_protocol_guid, NULL,
                                            &bofm2.interface ) ) == 0 ) {
                bofmtab2 = &bofm2.bofm2->BofmTable;
                DBGC ( device, "EFIBOFM %s found version 2 BOFM table at "
                       "%p+%04x\n", efi_handle_name ( device ), bofmtab2,
                       bofmtab2->Parameters.Length );
                assert ( bofm2.bofm2->RegisterSupport ==
                         bofm1.bofm1->RegisterSupport );
        } else {
                DBGC ( device, "EFIBOFM %s cannot find BOFM2 protocol\n",
                       efi_handle_name ( device ) );
                /* Not a fatal error; may be a BOFM1-only system */
                bofmtab2 = NULL;
        }

        /* Process BOFM table */
        DBGC2 ( device, "EFIBOFM %s version 1 before processing:\n",
                efi_handle_name ( device ) );
        DBGC2_HD ( device, bofmtab, bofmtab->Parameters.Length );
        if ( bofmtab2 ) {
                DBGC2 ( device, "EFIBOFM %s version 2 before processing:\n",
                        efi_handle_name ( device ) );
                DBGC2_HD ( device, bofmtab2, bofmtab2->Parameters.Length );
        }
        bofmrc = bofm ( virt_to_user ( bofmtab2 ? bofmtab2 : bofmtab ), &pci );
        DBGC ( device, "EFIBOFM %s status %08x\n",
               efi_handle_name ( device ), bofmrc );
        DBGC2 ( device, "EFIBOFM %s version 1 after processing:\n",
                efi_handle_name ( device ) );
        DBGC2_HD ( device, bofmtab, bofmtab->Parameters.Length );
        if ( bofmtab2 ) {
                DBGC2 ( device, "EFIBOFM %s version 2 after processing:\n",
                        efi_handle_name ( device ) );
                DBGC2_HD ( device, bofmtab2, bofmtab2->Parameters.Length );
        }

        /* Return BOFM status */
        if ( bofmtab2 ) {
                if ( ( efirc = bofm2.bofm2->SetStatus ( bofm2.bofm2, device,
                                                        FALSE, bofmrc ) ) != 0){
                        rc = -EEFI ( efirc );
                        DBGC ( device, "EFIBOFM %s could not set BOFM2 "
                               "status: %s\n", efi_handle_name ( device ),
                               strerror ( rc ) );
                        goto err_set_status;
                }
        } else {
                if ( ( efirc = bofm1.bofm1->SetStatus ( bofm1.bofm1, device,
                                                        FALSE, bofmrc ) ) != 0){
                        rc = -EEFI ( efirc );
                        DBGC ( device, "EFIBOFM %s could not set BOFM "
                               "status: %s\n", efi_handle_name ( device ),
                               strerror ( rc ) );
                        goto err_set_status;
                }
        }

        /* BOFM (ab)uses the "start" method to mean "process and exit" */
        rc = -EAGAIN;

 err_set_status:
 err_locate_bofm:
        efipci_close ( device );
 err_open:
        return rc;
}
static void efi_bofm_stop ( struct efi_device *efidev  __unused) [static]

Detach driver from device.

Parameters:
deviceEFI device

Definition at line 325 of file efi_bofm.c.

References assert.

                                                                 {

        /* Should never happen */
        assert ( 0 );
}
struct efi_driver efi_bofm_driver __efi_driver ( EFI_DRIVER_EARLY  ) [read]

EFI BOFM driver.


Variable Documentation

Initial value:

BOFM1 protocol GUID.

Definition at line 152 of file efi_bofm.c.

Initial value:

BOFM2 protocol GUID.

Definition at line 156 of file efi_bofm.c.