iPXE
Data Structures | Macros | Functions
bofm.h File Reference

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

#include <stdint.h>
#include <ipxe/list.h>
#include <ipxe/pci.h>
#include <config/sideband.h>

Go to the source code of this file.

Data Structures

struct  bofm_global_header
 BOFM table header. More...
 
struct  bofm_section_header
 BOFM section header. More...
 
struct  bofm_en
 BOFM Ethernet parameter entry. More...
 
struct  bofm_device
 A BOFM device. More...
 
struct  bofm_operations
 BOFM device operations. More...
 

Macros

#define IBMs_SIGNATURE   ( ( 'I' << 24 ) + ( 'B' << 16 ) + ( 'M' << 8 ) + ' ' )
 'IBM ' signature More...
 
#define sIBM_SIGNATURE   ( ( ' ' << 24 ) + ( 'I' << 16 ) + ( 'B' << 8 ) + 'M' )
 ' IBM' signature More...
 
#define BOFM_SUCCESS   0x00
 Successful. More...
 
#define BOFM_ERR_INVALID_ACTION   0x01
 Invalid action string. More...
 
#define BOFM_ERR_UNSUPPORTED   0x02
 Unsupported parameter structure version. More...
 
#define BOFM_ERR_DEVICE_ERROR   0x03
 Device error prohibited MAC/WWN update. More...
 
#define BOFM_PCI_RESET   0x80
 PCI reset required (may be combined with another return code) More...
 
#define BOFM_SKIP_INIT   0x80000000UL
 Skip option ROM initialisation. More...
 
#define BOFM_IOAA_MAGIC   ( 'I' + ( 'O' << 8 ) + ( 'A' << 16 ) + ( 'A' << 24 ) )
 BOFM table header signature. More...
 
#define BOFM_ACTION_UPDT   ( 'U' + ( 'P' << 8 ) + ( 'D' << 16 ) + ( 'T' << 24 ) )
 Update MAC/WWN. More...
 
#define BOFM_ACTION_DFLT   ( 'D' + ( 'F' << 8 ) + ( 'L' << 16 ) + ( 'T' << 24 ) )
 Restore MAC/WWN to factory default. More...
 
#define BOFM_ACTION_HVST   ( 'H' + ( 'V' << 8 ) + ( 'S' << 16 ) + ( 'T' << 24 ) )
 Harvest MAC/WWN. More...
 
#define BOFM_ACTION_PARM   ( 'P' + ( 'A' << 8 ) + ( 'R' << 16 ) + ( 'M' << 24 ) )
 Update MAC/WWN and initialise device. More...
 
#define BOFM_ACTION_NONE   ( 'N' + ( 'O' << 8 ) + ( 'N' << 16 ) + ( 'E' << 24 ) )
 Just initialise the device. More...
 
#define BOFM_EN_MAGIC   ( ' ' + ( ' ' << 8 ) + ( 'E' << 16 ) + ( 'N' << 24 ) )
 EN start marker. More...
 
#define BOFM_DONE_MAGIC   ( 'D' + ( 'O' << 8 ) + ( 'N' << 16 ) + ( 'E' << 24 ) )
 End marker. More...
 
#define BOFM_EN_MAP_MASK   0x0001
 Port mapping mask. More...
 
#define BOFM_EN_MAP_PFA   0x0000
 Port mapping is by PCI bus:dev.fn. More...
 
#define BOFM_EN_MAP_SLOT_PORT   0x0001
 Port mapping is by slot/port. More...
 
#define BOFM_EN_EN_B   0x0002
 MAC address B is present. More...
 
#define BOFM_EN_VLAN_B   0x0004
 VLAN tag for MAC address B is present. More...
 
#define BOFM_EN_EN_A   0x0008
 MAC address A is present. More...
 
#define BOFM_EN_VLAN_A   0x0010
 VLAN tag for MAC address A is present. More...
 
#define BOFM_EN_CSM_MASK   0x00c0
 Entry consumption indicator mask. More...
 
#define BOFM_EN_CSM_UNUSED   0x0000
 Entry has not been used. More...
 
#define BOFM_EN_CSM_SUCCESS   0x0040
 Entry has been used successfully. More...
 
#define BOFM_EN_CSM_FAILED   0x0080
 Entry has been used but failed. More...
 
#define BOFM_EN_CHG_MASK   0x0100
 Consumed entry change mask. More...
 
#define BOFM_EN_CHG_UNCHANGED   0x0000
 Consumed entry is same as previous active entry. More...
 
#define BOFM_EN_CHG_CHANGED   0x0100
 Consumed entry is different than previous active entry. More...
 
#define BOFM_EN_USAGE_HARVEST   0x1000
 Ignore values - it's harvest time. More...
 
#define BOFM_EN_USAGE_ENTRY   0x0800
 Use entry values for assignment. More...
 
#define BOFM_EN_USAGE_DEFAULT   0x0400
 Use factory default values. More...
 
#define BOFM_EN_HVST   0x2000
 Harvest complete. More...
 
#define BOFM_EN_RQ_HVST_MASK   0xc000
 Harvest request mask. More...
 
#define BOFM_EN_RQ_HVST_NONE   0x0000
 Do not harvest. More...
 
#define BOFM_EN_RQ_HVST_DEFAULT   0x4000
 Harvest factory default values. More...
 
#define BOFM_EN_RQ_HVST_ACTIVE   0xc000
 Harvest active values. More...
 
#define BOFM_MAGIC_FMT   "'%c%c%c%c'"
 BOFM magic value debug message format. More...
 
#define BOFM_MAGIC_ARGS(magic)
 BOFM magic value debug message arguments. More...
 
#define BOFM_DRIVERS   __table ( struct pci_driver, "bofm_drivers" )
 BOFM driver table. More...
 
#define __bofm_driver
 Declare a BOFM driver. More...
 
#define __bofm_test_driver   __table_entry ( BOFM_DRIVERS, 02 )
 Declare a BOFM test driver. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static void bofm_init (struct bofm_device *bofm, struct pci_device *pci, struct bofm_operations *op)
 Initialise BOFM device. More...
 
int bofm_register (struct bofm_device *bofm)
 Register BOFM device. More...
 
void bofm_unregister (struct bofm_device *bofm)
 Unregister BOFM device. More...
 
int bofm_find_driver (struct pci_device *pci)
 Find BOFM driver for PCI device. More...
 
int bofm (void *bofmtab, struct pci_device *pci)
 Process BOFM table. More...
 
void bofm_test (struct pci_device *pci)
 Perform BOFM test. More...
 

Detailed Description

IBM BladeCenter Open Fabric Manager (BOFM)

Definition in file bofm.h.

Macro Definition Documentation

◆ IBMs_SIGNATURE

#define IBMs_SIGNATURE   ( ( 'I' << 24 ) + ( 'B' << 16 ) + ( 'M' << 8 ) + ' ' )

'IBM ' signature

Present in edi when the BIOS initialisation entry point is called, with the BOFM table pointer in esi.

Defined in section 4.1.2 of the POST/BIOS BOFM I/O Address Re-Assignment Architecture document.

Definition at line 26 of file bofm.h.

◆ sIBM_SIGNATURE

#define sIBM_SIGNATURE   ( ( ' ' << 24 ) + ( 'I' << 16 ) + ( 'B' << 8 ) + 'M' )

' IBM' signature

Returned in edi from the BIOS initialisation entry point, with the return code in dl.

Defined in section 4.1.2 of the POST/BIOS BOFM I/O Address Re-Assignment Architecture document.

Definition at line 36 of file bofm.h.

◆ BOFM_SKIP_INIT

#define BOFM_SKIP_INIT   0x80000000UL

Skip option ROM initialisation.

A BOFM BIOS may call the initialisation entry point multiple times; only the last call should result in actual initialisation.

This flag is internal to iPXE.

Definition at line 70 of file bofm.h.

◆ BOFM_IOAA_MAGIC

#define BOFM_IOAA_MAGIC   ( 'I' + ( 'O' << 8 ) + ( 'A' << 16 ) + ( 'A' << 24 ) )

BOFM table header signature.

Defined in section 4.1.2 of the POST/BIOS BOFM I/O Address Re-Assignment Architecture document.

Definition at line 103 of file bofm.h.

◆ BOFM_MAGIC_FMT

#define BOFM_MAGIC_FMT   "'%c%c%c%c'"

BOFM magic value debug message format.

Definition at line 278 of file bofm.h.

◆ BOFM_MAGIC_ARGS

#define BOFM_MAGIC_ARGS (   magic)
Value:
( ( (magic) >> 0 ) & 0xff ), ( ( (magic) >> 8 ) & 0xff ), \
( ( (magic) >> 16 ) & 0xff ), ( ( (magic) >> 24 ) & 0xff )
uint16_t magic
Magic signature.
Definition: bzimage.h:6

BOFM magic value debug message arguments.

Definition at line 281 of file bofm.h.

◆ BOFM_DRIVERS

#define BOFM_DRIVERS   __table ( struct pci_driver, "bofm_drivers" )

BOFM driver table.

Definition at line 318 of file bofm.h.

◆ __bofm_driver

#define __bofm_driver

Declare a BOFM driver.

In the common case of non-BOFM-enabled builds, allow any BOFM code to be garbage-collected at link time to save space.

Definition at line 328 of file bofm.h.

◆ __bofm_test_driver

#define __bofm_test_driver   __table_entry ( BOFM_DRIVERS, 02 )

Declare a BOFM test driver.

Definition at line 332 of file bofm.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ bofm_init()

static void bofm_init ( struct bofm_device bofm,
struct pci_device pci,
struct bofm_operations op 
)
inlinestatic

Initialise BOFM device.

Parameters
bofmBOFM device
pciPCI device
opBOFM device operations

Definition at line 342 of file bofm.h.

343  {
344  bofm->pci = pci;
345  bofm->op = op;
346 }
int bofm(void *bofmtab, struct pci_device *pci)
Process BOFM table.
Definition: bofm.c:235
static uint16_t struct vmbus_xfer_pages_operations * op
Definition: netvsc.h:327

References bofm(), op, and bofm_device::pci.

Referenced by bofm_test_init(), and hermon_bofm_probe().

◆ bofm_register()

int bofm_register ( struct bofm_device bofm)

Register BOFM device.

Parameters
bofmBOFM device
Return values
rcReturn status code

Definition at line 48 of file bofm.c.

48  {
49 
50  list_add ( &bofm->list, &bofmdevs );
51  DBG ( "BOFM: " PCI_FMT " registered using driver \"%s\"\n",
52  PCI_ARGS ( bofm->pci ), bofm->pci->id->name );
53  return 0;
54 }
#define list_add(new, head)
Add a new entry to the head of a list.
Definition: list.h:69
#define PCI_FMT
PCI device debug message format.
Definition: pci.h:311
int bofm(void *bofmtab, struct pci_device *pci)
Process BOFM table.
Definition: bofm.c:235
#define PCI_ARGS(pci)
PCI device debug message arguments.
Definition: pci.h:314
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498

References bofm(), DBG, list_add, PCI_ARGS, and PCI_FMT.

Referenced by bofm_dummy_probe(), and hermon_bofm_probe().

◆ bofm_unregister()

void bofm_unregister ( struct bofm_device bofm)

Unregister BOFM device.

Parameters
bofmBOFM device

Definition at line 61 of file bofm.c.

61  {
62 
63  list_del ( &bofm->list );
64  DBG ( "BOFM: " PCI_FMT " unregistered\n", PCI_ARGS ( bofm->pci ) );
65 }
#define list_del(list)
Delete an entry from a list.
Definition: list.h:119
#define PCI_FMT
PCI device debug message format.
Definition: pci.h:311
int bofm(void *bofmtab, struct pci_device *pci)
Process BOFM table.
Definition: bofm.c:235
#define PCI_ARGS(pci)
PCI device debug message arguments.
Definition: pci.h:314
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498

References bofm(), DBG, list_del, PCI_ARGS, and PCI_FMT.

Referenced by bofm_dummy_remove(), and hermon_bofm_remove().

◆ bofm_find_driver()

int bofm_find_driver ( struct pci_device pci)

Find BOFM driver for PCI device.

Parameters
pciPCI device
Return values
rcReturn status code

Definition at line 89 of file bofm.c.

89  {
90  struct pci_driver *driver;
91  struct pci_device_id *id;
92  unsigned int i;
93 
95  for ( i = 0 ; i < driver->id_count ; i++ ) {
96  id = &driver->ids[i];
97  if ( ( id->vendor == pci->vendor ) &&
98  ( id->device == pci->device ) ) {
99  pci_set_driver ( pci, driver, id );
100  return 0;
101  }
102  }
103  }
104  return -ENOENT;
105 }
A PCI driver.
Definition: pci.h:251
unsigned int id_count
Number of entries in PCI ID table.
Definition: pci.h:255
struct pci_device_id * ids
PCI ID table.
Definition: pci.h:253
static void pci_set_driver(struct pci_device *pci, struct pci_driver *driver, struct pci_device_id *id)
Set PCI driver.
Definition: pci.h:351
#define ENOENT
No such file or directory.
Definition: errno.h:514
uint16_t device
Device ID.
Definition: pci.h:229
uint8_t id
Request identifier.
Definition: ena.h:12
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Definition: tables.h:385
A PCI device ID list entry.
Definition: pci.h:174
uint16_t vendor
Vendor ID.
Definition: pci.h:227
#define BOFM_DRIVERS
BOFM driver table.
Definition: bofm.h:318

References BOFM_DRIVERS, pci_device::device, ENOENT, for_each_table_entry, id, pci_driver::id_count, pci_driver::ids, pci_set_driver(), and pci_device::vendor.

Referenced by bofm(), and efi_bofm_supported().

◆ bofm()

int bofm ( void *  bofmtab,
struct pci_device pci 
)

Process BOFM table.

Parameters
bofmtabBOFM table
pciPCI device
Return values
bofmrcBOFM return status

Definition at line 235 of file bofm.c.

235  {
236  struct bofm_global_header *bofmhdr;
237  struct bofm_section_header *bofmsec;
238  struct bofm_en *en;
239  struct bofm_device *bofm;
240  size_t offset;
241  int skip;
242  int rc;
243  int bofmrc;
244 
245  /* Read BOFM structure */
246  bofmhdr = bofmtab;
247  if ( bofmhdr->magic != BOFM_IOAA_MAGIC ) {
248  DBG ( "BOFM: invalid table signature " BOFM_MAGIC_FMT "\n",
249  BOFM_MAGIC_ARGS ( bofmhdr->magic ) );
250  bofmrc = BOFM_ERR_INVALID_ACTION;
251  goto err_bad_signature;
252  }
253  DBG ( "BOFM: " BOFM_MAGIC_FMT " (profile \"%s\")\n",
254  BOFM_MAGIC_ARGS ( bofmhdr->action ), bofmhdr->profile );
255 
256  /* Determine whether or not we should skip normal POST
257  * initialisation.
258  */
259  switch ( bofmhdr->action ) {
260  case BOFM_ACTION_UPDT:
261  case BOFM_ACTION_DFLT:
262  case BOFM_ACTION_HVST:
263  skip = BOFM_SKIP_INIT;
264  break;
265  case BOFM_ACTION_PARM:
266  case BOFM_ACTION_NONE:
267  skip = 0;
268  break;
269  default:
270  DBG ( "BOFM: invalid action " BOFM_MAGIC_FMT "\n",
271  BOFM_MAGIC_ARGS ( bofmhdr->action ) );
272  bofmrc = BOFM_ERR_INVALID_ACTION;
273  goto err_bad_action;
274  }
275 
276  /* Find BOFM driver */
277  if ( ( rc = bofm_find_driver ( pci ) ) != 0 ) {
278  DBG ( "BOFM: " PCI_FMT " has no driver\n", PCI_ARGS ( pci ) );
279  bofmrc = BOFM_ERR_DEVICE_ERROR;
280  goto err_find_driver;
281  }
282 
283  /* Probe driver for PCI device */
284  if ( ( rc = bofm_probe ( pci ) ) != 0 ) {
285  bofmrc = BOFM_ERR_DEVICE_ERROR;
286  goto err_probe;
287  }
288 
289  /* Locate EN section, if present */
290  bofmsec = bofm_locate_section ( bofmhdr, BOFM_EN_MAGIC );
291  if ( ! bofmsec ) {
292  DBG ( "BOFM: No EN section found\n" );
293  bofmrc = ( BOFM_SUCCESS | skip );
294  goto err_no_en_section;
295  }
296 
297  /* Iterate through EN entries */
298  for ( offset = sizeof ( *bofmsec ) ; offset < bofmsec->length ;
299  offset += sizeof ( *en ) ) {
300  en = ( ( ( void * ) bofmsec ) + offset );
301  DBG2 ( "BOFM: EN entry found:\n" );
302  DBG2_HDA ( offset, en, sizeof ( *en ) );
303  if ( ( en->options & BOFM_EN_MAP_MASK ) != BOFM_EN_MAP_PFA ) {
304  DBG ( "BOFM: slot %d port %d has no PCI mapping\n",
305  en->slot, ( en->port + 1 ) );
306  continue;
307  }
308  DBG ( "BOFM: slot %d port %d%s is " PCI_FMT " mport %d\n",
309  en->slot, ( en->port + 1 ),
310  ( ( en->slot || en->port ) ? "" : "(?)" ), 0,
311  PCI_BUS ( en->busdevfn ), PCI_SLOT ( en->busdevfn ),
312  PCI_FUNC ( en->busdevfn ), en->mport );
314  if ( ! bofm ) {
315  DBG ( "BOFM: " PCI_FMT " mport %d ignored\n", 0,
316  PCI_BUS ( en->busdevfn ),
317  PCI_SLOT ( en->busdevfn ),
318  PCI_FUNC ( en->busdevfn ), en->mport );
319  continue;
320  }
321  if ( ( rc = bofm_en ( bofm, en ) ) == 0 ) {
323  } else {
325  }
326  DBG2 ( "BOFM: EN entry after processing:\n" );
327  DBG2_HDA ( offset, en, sizeof ( *en ) );
328  }
329 
330  bofmrc = ( BOFM_SUCCESS | skip );
331 
332  err_no_en_section:
333  bofm_remove ( pci );
334  err_probe:
335  err_find_driver:
336  err_bad_action:
337  err_bad_signature:
338  return bofmrc;
339 }
#define PCI_FUNC(busdevfn)
Definition: pci.h:285
struct bofm_en en
Definition: bofm_test.c:45
#define PCI_BUS(busdevfn)
Definition: pci.h:283
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static void bofm_remove(struct pci_device *pci)
Remove PCI device.
Definition: bofm.c:131
uint8_t slot
Slot or mezzanine number.
Definition: bofm.h:175
#define BOFM_EN_CSM_FAILED
Entry has been used but failed.
Definition: bofm.h:240
uint32_t magic
Signature.
Definition: bofm.h:79
#define BOFM_EN_MAGIC
EN start marker.
Definition: bofm.h:151
struct pci_device * pci
Underlying PCI device.
Definition: bofm.h:288
#define BOFM_SUCCESS
Successful.
Definition: bofm.h:47
static struct bofm_section_header * bofm_locate_section(struct bofm_global_header *bofmhdr, uint32_t magic)
Locate BOFM table section.
Definition: bofm.c:157
#define BOFM_ACTION_UPDT
Update MAC/WWN.
Definition: bofm.h:114
uint8_t mport
Multi-port index.
Definition: bofm.h:182
#define BOFM_MAGIC_FMT
BOFM magic value debug message format.
Definition: bofm.h:278
uint16_t length
Length.
Definition: bofm.h:139
#define BOFM_SKIP_INIT
Skip option ROM initialisation.
Definition: bofm.h:70
#define BOFM_EN_MAP_PFA
Port mapping is by PCI bus:dev.fn.
Definition: bofm.h:213
uint32_t action
Subsignature (action string)
Definition: bofm.h:81
#define BOFM_ACTION_NONE
Just initialise the device.
Definition: bofm.h:126
uint16_t busdevfn
PCI bus:dev.fn.
Definition: bofm.h:170
#define BOFM_IOAA_MAGIC
BOFM table header signature.
Definition: bofm.h:103
static int bofm_probe(struct pci_device *pci)
Probe PCI device for BOFM driver.
Definition: bofm.c:113
uint16_t options
Options.
Definition: bofm.h:165
#define BOFM_ERR_DEVICE_ERROR
Device error prohibited MAC/WWN update.
Definition: bofm.h:56
BOFM table header.
Definition: bofm.h:77
#define PCI_FMT
PCI device debug message format.
Definition: pci.h:311
#define DBG2_HDA(...)
Definition: compiler.h:516
#define PCI_SLOT(busdevfn)
Definition: pci.h:284
#define BOFM_MAGIC_ARGS(magic)
BOFM magic value debug message arguments.
Definition: bofm.h:281
A BOFM device.
Definition: bofm.h:286
static struct bofm_device * bofm_find_busdevfn(unsigned int busdevfn)
Find BOFM device matching PCI bus:dev.fn address.
Definition: bofm.c:73
#define BOFM_ACTION_PARM
Update MAC/WWN and initialise device.
Definition: bofm.h:123
BOFM section header.
Definition: bofm.h:135
uint8_t port
Port number.
Definition: bofm.h:180
int bofm(void *bofmtab, struct pci_device *pci)
Process BOFM table.
Definition: bofm.c:235
#define BOFM_EN_MAP_MASK
Port mapping mask.
Definition: bofm.h:210
BOFM Ethernet parameter entry.
Definition: bofm.h:163
#define PCI_ARGS(pci)
PCI device debug message arguments.
Definition: pci.h:314
#define BOFM_ERR_INVALID_ACTION
Invalid action string.
Definition: bofm.h:50
int bofm_find_driver(struct pci_device *pci)
Find BOFM driver for PCI device.
Definition: bofm.c:89
#define BOFM_EN_CSM_SUCCESS
Entry has been used successfully.
Definition: bofm.h:237
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define BOFM_ACTION_HVST
Harvest MAC/WWN.
Definition: bofm.h:120
char profile[32]
Data structure profile.
Definition: bofm.h:91
#define BOFM_ACTION_DFLT
Restore MAC/WWN to factory default.
Definition: bofm.h:117
#define DBG2(...)
Definition: compiler.h:515

References bofm_global_header::action, bofm(), BOFM_ACTION_DFLT, BOFM_ACTION_HVST, BOFM_ACTION_NONE, BOFM_ACTION_PARM, BOFM_ACTION_UPDT, BOFM_EN_CSM_FAILED, BOFM_EN_CSM_SUCCESS, BOFM_EN_MAGIC, BOFM_EN_MAP_MASK, BOFM_EN_MAP_PFA, BOFM_ERR_DEVICE_ERROR, BOFM_ERR_INVALID_ACTION, bofm_find_busdevfn(), bofm_find_driver(), BOFM_IOAA_MAGIC, bofm_locate_section(), BOFM_MAGIC_ARGS, BOFM_MAGIC_FMT, bofm_probe(), bofm_remove(), BOFM_SKIP_INIT, BOFM_SUCCESS, bofm_en::busdevfn, DBG, DBG2, DBG2_HDA, en, bofm_section_header::length, bofm_global_header::magic, bofm_en::mport, offset, bofm_en::options, bofm_device::pci, PCI_ARGS, PCI_BUS, PCI_FMT, PCI_FUNC, PCI_SLOT, bofm_en::port, bofm_global_header::profile, rc, and bofm_en::slot.

Referenced by bofm(), bofm_dummy_harvest(), bofm_en(), bofm_find_busdevfn(), bofm_init(), bofm_register(), bofm_test(), bofm_unregister(), efi_bofm_start(), hermon_bofm_harvest(), and hermon_bofm_update().

◆ bofm_test()

void bofm_test ( struct pci_device pci)

Perform BOFM test.

Parameters
pciPCI device

Definition at line 105 of file bofm_test.c.

105  {
106  int bofmrc;
107 
108  printf ( "BOFMTEST using " PCI_FMT "\n", PCI_ARGS ( pci ) );
109 
110  /* Perform harvest test */
111  printf ( "BOFMTEST performing harvest\n" );
112  bofmtab_harvest.en.busdevfn = pci->busdevfn;
113  DBG_HDA ( 0, &bofmtab_harvest, sizeof ( bofmtab_harvest ) );
114  bofmrc = bofm ( &bofmtab_harvest, pci );
115  printf ( "BOFMTEST harvest result %08x\n", bofmrc );
116  if ( bofmtab_harvest.en.options & BOFM_EN_HVST ) {
117  printf ( "BOFMTEST harvested MAC address %s\n",
118  eth_ntoa ( &bofmtab_harvest.en.mac_a ) );
119  } else {
120  printf ( "BOFMTEST failed to harvest a MAC address\n" );
121  }
122  DBG_HDA ( 0, &bofmtab_harvest, sizeof ( bofmtab_harvest ) );
123 
124  /* Perform update test */
125  printf ( "BOFMTEST performing update\n" );
126  bofmtab_update.en.busdevfn = pci->busdevfn;
127  DBG_HDA ( 0, &bofmtab_update, sizeof ( bofmtab_update ) );
128  bofmrc = bofm ( &bofmtab_update, pci );
129  printf ( "BOFMTEST update result %08x\n", bofmrc );
130  if ( bofmtab_update.en.options & BOFM_EN_CSM_SUCCESS ) {
131  printf ( "BOFMTEST updated MAC address to %s\n",
132  eth_ntoa ( &bofmtab_update.en.mac_a ) );
133  } else {
134  printf ( "BOFMTEST failed to update MAC address\n" );
135  }
136  DBG_HDA ( 0, &bofmtab_update, sizeof ( bofmtab_update ) );
137 }
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
#define DBG_HDA(...)
Definition: compiler.h:499
struct pci_device * pci
Underlying PCI device.
Definition: bofm.h:288
static struct @439 bofmtab_harvest
Harvest test table.
static struct @440 bofmtab_update
Update test table.
#define PCI_FMT
PCI device debug message format.
Definition: pci.h:311
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
#define BOFM_EN_HVST
Harvest complete.
Definition: bofm.h:261
uint32_t busdevfn
Segment, bus, device, and function (bus:dev.fn) number.
Definition: pci.h:237
int bofm(void *bofmtab, struct pci_device *pci)
Process BOFM table.
Definition: bofm.c:235
#define PCI_ARGS(pci)
PCI device debug message arguments.
Definition: pci.h:314
#define BOFM_EN_CSM_SUCCESS
Entry has been used successfully.
Definition: bofm.h:237

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

Referenced by bofm_test_init().