iPXE
Functions | Variables
bofm_test.c File Reference

IBM BladeCenter Open Fabric Manager (BOFM) tests. More...

#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <ipxe/uaccess.h>
#include <ipxe/init.h>
#include <ipxe/pci.h>
#include <ipxe/ethernet.h>
#include <ipxe/bofm.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
void bofm_test (struct pci_device *pci)
 Perform BOFM test.
static void bofm_test_init (void)
 Perform BOFM test at initialisation time.
struct init_fn bofm_test_init_fn __init_fn (INIT_NORMAL)
 BOFM test initialisation function.

Variables

struct {
   struct bofm_global_header   header
   struct bofm_section_header   en_header
   struct bofm_en   en
   struct bofm_section_header   done
bofmtab_harvest
 Harvest test table.
struct {
   struct bofm_global_header   header
   struct bofm_section_header   en_header
   struct bofm_en   en
   struct bofm_section_header   done
bofmtab_update
 Update test table.

Detailed Description

IBM BladeCenter Open Fabric Manager (BOFM) tests.

Definition in file bofm_test.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
void bofm_test ( struct pci_device pci)

Perform BOFM test.

Parameters:
pciPCI device

Definition at line 105 of file bofm_test.c.

References bofm(), BOFM_EN_CSM_SUCCESS, BOFM_EN_HVST, pci_device::busdevfn, DBG_HDA, eth_ntoa(), PCI_ARGS, PCI_FMT, printf(), and virt_to_user().

Referenced by bofm_test_init().

                                          {
        int bofmrc;

        printf ( "BOFMTEST using " PCI_FMT "\n", PCI_ARGS ( pci ) );

        /* Perform harvest test */
        printf ( "BOFMTEST performing harvest\n" );
        bofmtab_harvest.en.busdevfn = pci->busdevfn;
        DBG_HDA ( 0, &bofmtab_harvest, sizeof ( bofmtab_harvest ) );
        bofmrc = bofm ( virt_to_user ( &bofmtab_harvest ), pci );
        printf ( "BOFMTEST harvest result %08x\n", bofmrc );
        if ( bofmtab_harvest.en.options & BOFM_EN_HVST ) {
                printf ( "BOFMTEST harvested MAC address %s\n",
                         eth_ntoa ( &bofmtab_harvest.en.mac_a ) );
        } else {
                printf ( "BOFMTEST failed to harvest a MAC address\n" );
        }
        DBG_HDA ( 0, &bofmtab_harvest, sizeof ( bofmtab_harvest ) );

        /* Perform update test */
        printf ( "BOFMTEST performing update\n" );
        bofmtab_update.en.busdevfn = pci->busdevfn;
        DBG_HDA ( 0, &bofmtab_update, sizeof ( bofmtab_update ) );
        bofmrc = bofm ( virt_to_user ( &bofmtab_update ), pci );
        printf ( "BOFMTEST update result %08x\n", bofmrc );
        if ( bofmtab_update.en.options & BOFM_EN_CSM_SUCCESS ) {
                printf ( "BOFMTEST updated MAC address to %s\n",
                         eth_ntoa ( &bofmtab_update.en.mac_a ) );
        } else {
                printf ( "BOFMTEST failed to update MAC address\n" );
        }
        DBG_HDA ( 0, &bofmtab_update, sizeof ( bofmtab_update ) );
}
static void bofm_test_init ( void  ) [static]

Perform BOFM test at initialisation time.

Definition at line 143 of file bofm_test.c.

References bofm_test(), pci_device::busdevfn, memset(), PCI_ARGS, PCI_FMT, pci_init(), pci_read_config(), printf(), rc, and strerror().

                                    {
        struct pci_device pci;
        int busdevfn = -1;
        int rc;

        /* Uncomment the following line and specify the correct PCI
         * bus:dev.fn address in order to perform a BOFM test at
         * initialisation time.
         */
        // busdevfn = PCI_BUSDEVFN ( <bus>, <dev>, <fn> );

        /* Skip test if no PCI bus:dev.fn is defined */
        if ( busdevfn < 0 )
                return;

        /* Initialise PCI device */
        memset ( &pci, 0, sizeof ( pci ) );
        pci_init ( &pci, busdevfn );
        if ( ( rc = pci_read_config ( &pci ) ) != 0 ) {
                printf ( "BOFMTEST could not create " PCI_FMT " device: %s\n",
                         PCI_ARGS ( &pci ), strerror ( rc ) );
                return;
        }

        /* Perform test */
        bofm_test ( &pci );
}
struct init_fn bofm_test_init_fn __init_fn ( INIT_NORMAL  ) [read]

BOFM test initialisation function.


Variable Documentation

Definition at line 43 of file bofm_test.c.

Definition at line 44 of file bofm_test.c.

struct bofm_en en

Definition at line 45 of file bofm_test.c.

Referenced by bofm().

struct { ... } bofmtab_harvest [static]

Harvest test table.

struct { ... } bofmtab_update [static]

Update test table.