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...
 

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 (userptr_t 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 )
uint32_t magic
Magic signature.
Definition: fdt.h:12

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.

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 339 of file bofm.h.

340  {
341  bofm->pci = pci;
342  bofm->op = op;
343 }
static uint16_t struct vmbus_xfer_pages_operations * op
Definition: netvsc.h:327
int bofm(userptr_t bofmtab, struct pci_device *pci)
Process BOFM table.
Definition: bofm.c:238

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

Referenced by 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 49 of file bofm.c.

49  {
50 
51  list_add ( &bofm->list, &bofmdevs );
52  DBG ( "BOFM: " PCI_FMT " registered using driver \"%s\"\n",
53  PCI_ARGS ( bofm->pci ), bofm->pci->id->name );
54  return 0;
55 }
#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:287
int bofm(userptr_t bofmtab, struct pci_device *pci)
Process BOFM table.
Definition: bofm.c:238
#define PCI_ARGS(pci)
PCI device debug message arguments.
Definition: pci.h:290
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498

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

Referenced by hermon_bofm_probe().

◆ bofm_unregister()

void bofm_unregister ( struct bofm_device bofm)

Unregister BOFM device.

Parameters
bofmBOFM device

Definition at line 62 of file bofm.c.

62  {
63 
64  list_del ( &bofm->list );
65  DBG ( "BOFM: " PCI_FMT " unregistered\n", PCI_ARGS ( bofm->pci ) );
66 }
#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:287
int bofm(userptr_t bofmtab, struct pci_device *pci)
Process BOFM table.
Definition: bofm.c:238
#define PCI_ARGS(pci)
PCI device debug message arguments.
Definition: pci.h:290
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498

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

Referenced by 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 90 of file bofm.c.

90  {
91  struct pci_driver *driver;
92  struct pci_device_id *id;
93  unsigned int i;
94 
96  for ( i = 0 ; i < driver->id_count ; i++ ) {
97  id = &driver->ids[i];
98  if ( ( id->vendor == pci->vendor ) &&
99  ( id->device == pci->device ) ) {
100  pci_set_driver ( pci, driver, id );
101  return 0;
102  }
103  }
104  }
105  return -ENOENT;
106 }
A PCI driver.
Definition: pci.h:224
unsigned int id_count
Number of entries in PCI ID table.
Definition: pci.h:228
struct pci_device_id * ids
PCI ID table.
Definition: pci.h:226
static void pci_set_driver(struct pci_device *pci, struct pci_driver *driver, struct pci_device_id *id)
Set PCI driver.
Definition: pci.h:324
#define ENOENT
No such file or directory.
Definition: errno.h:514
uint16_t device
Device ID.
Definition: pci.h:204
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:358
A PCI device ID list entry.
Definition: pci.h:151
uint16_t vendor
Vendor ID.
Definition: pci.h:202
#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 ( userptr_t  bofmtab,
struct pci_device pci 
)

Process BOFM table.

Parameters
bofmtabBOFM table
pciPCI device
Return values
bofmrcBOFM return status

Definition at line 238 of file bofm.c.

238  {
239  struct bofm_global_header bofmhdr;
240  struct bofm_section_header bofmsec;
241  struct bofm_en en;
242  struct bofm_device *bofm;
243  size_t en_region_offset;
244  size_t en_offset;
245  int skip;
246  int rc;
247  int bofmrc;
248 
249  /* Read BOFM structure */
250  copy_from_user ( &bofmhdr, bofmtab, 0, sizeof ( bofmhdr ) );
251  if ( bofmhdr.magic != BOFM_IOAA_MAGIC ) {
252  DBG ( "BOFM: invalid table signature " BOFM_MAGIC_FMT "\n",
253  BOFM_MAGIC_ARGS ( bofmhdr.magic ) );
254  bofmrc = BOFM_ERR_INVALID_ACTION;
255  goto err_bad_signature;
256  }
257  DBG ( "BOFM: " BOFM_MAGIC_FMT " (profile \"%s\")\n",
258  BOFM_MAGIC_ARGS ( bofmhdr.action ), bofmhdr.profile );
259 
260  /* Determine whether or not we should skip normal POST
261  * initialisation.
262  */
263  switch ( bofmhdr.action ) {
264  case BOFM_ACTION_UPDT:
265  case BOFM_ACTION_DFLT:
266  case BOFM_ACTION_HVST:
267  skip = BOFM_SKIP_INIT;
268  break;
269  case BOFM_ACTION_PARM:
270  case BOFM_ACTION_NONE:
271  skip = 0;
272  break;
273  default:
274  DBG ( "BOFM: invalid action " BOFM_MAGIC_FMT "\n",
275  BOFM_MAGIC_ARGS ( bofmhdr.action ) );
276  bofmrc = BOFM_ERR_INVALID_ACTION;
277  goto err_bad_action;
278  }
279 
280  /* Find BOFM driver */
281  if ( ( rc = bofm_find_driver ( pci ) ) != 0 ) {
282  DBG ( "BOFM: " PCI_FMT " has no driver\n", PCI_ARGS ( pci ) );
283  bofmrc = BOFM_ERR_DEVICE_ERROR;
284  goto err_find_driver;
285  }
286 
287  /* Probe driver for PCI device */
288  if ( ( rc = bofm_probe ( pci ) ) != 0 ) {
289  bofmrc = BOFM_ERR_DEVICE_ERROR;
290  goto err_probe;
291  }
292 
293  /* Locate EN section, if present */
294  en_region_offset = bofm_locate_section ( bofmtab, bofmhdr.length,
295  BOFM_EN_MAGIC, &bofmsec );
296  if ( ! en_region_offset ) {
297  DBG ( "BOFM: No EN section found\n" );
298  bofmrc = ( BOFM_SUCCESS | skip );
299  goto err_no_en_section;
300  }
301 
302  /* Iterate through EN entries */
303  for ( en_offset = ( en_region_offset + sizeof ( bofmsec ) ) ;
304  en_offset < ( en_region_offset + sizeof ( bofmsec ) +
305  bofmsec.length ) ; en_offset += sizeof ( en ) ) {
306  copy_from_user ( &en, bofmtab, en_offset, sizeof ( en ) );
307  DBG2 ( "BOFM: EN entry found:\n" );
308  DBG2_HDA ( en_offset, &en, sizeof ( en ) );
309  if ( ( en.options & BOFM_EN_MAP_MASK ) != BOFM_EN_MAP_PFA ) {
310  DBG ( "BOFM: slot %d port %d has no PCI mapping\n",
311  en.slot, ( en.port + 1 ) );
312  continue;
313  }
314  DBG ( "BOFM: slot %d port %d%s is " PCI_FMT " mport %d\n",
315  en.slot, ( en.port + 1 ),
316  ( ( en.slot || en.port ) ? "" : "(?)" ), 0,
318  PCI_FUNC ( en.busdevfn ), en.mport );
320  if ( ! bofm ) {
321  DBG ( "BOFM: " PCI_FMT " mport %d ignored\n", 0,
323  PCI_FUNC ( en.busdevfn ), en.mport );
324  continue;
325  }
326  if ( ( rc = bofm_en ( bofm, &en ) ) == 0 ) {
328  } else {
330  }
331  DBG2 ( "BOFM: EN entry after processing:\n" );
332  DBG2_HDA ( en_offset, &en, sizeof ( en ) );
333  copy_to_user ( bofmtab, en_offset, &en, sizeof ( en ) );
334  }
335 
336  bofmrc = ( BOFM_SUCCESS | skip );
337 
338  err_no_en_section:
339  bofm_remove ( pci );
340  err_probe:
341  err_find_driver:
342  err_bad_action:
343  err_bad_signature:
344  return bofmrc;
345 }
#define PCI_FUNC(busdevfn)
Definition: pci.h:258
struct bofm_en en
Definition: bofm_test.c:45
#define PCI_BUS(busdevfn)
Definition: pci.h:256
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static void bofm_remove(struct pci_device *pci)
Remove PCI device.
Definition: bofm.c:132
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
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
Definition: uaccess.h:337
#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
#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
#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
#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:114
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:287
#define DBG2_HDA(...)
Definition: compiler.h:516
#define PCI_SLOT(busdevfn)
Definition: pci.h:257
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
Definition: uaccess.h:324
#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:74
#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
static size_t bofm_locate_section(userptr_t bofmtab, size_t len, uint32_t magic, struct bofm_section_header *bofmsec)
Locate BOFM table section.
Definition: bofm.c:159
#define BOFM_EN_MAP_MASK
Port mapping mask.
Definition: bofm.h:210
int bofm(userptr_t bofmtab, struct pci_device *pci)
Process BOFM table.
Definition: bofm.c:238
BOFM Ethernet parameter entry.
Definition: bofm.h:163
#define PCI_ARGS(pci)
PCI device debug message arguments.
Definition: pci.h:290
#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:90
#define BOFM_EN_CSM_SUCCESS
Entry has been used successfully.
Definition: bofm.h:237
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define BOFM_ACTION_HVST
Harvest MAC/WWN.
Definition: bofm.h:120
#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, copy_from_user(), copy_to_user(), DBG, DBG2, DBG2_HDA, en, bofm_global_header::length, bofm_section_header::length, bofm_global_header::magic, bofm_en::mport, 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_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 ( virt_to_user ( &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 ( virt_to_user ( &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
static struct @421 bofmtab_update
Update test table.
static struct @420 bofmtab_harvest
Harvest test table.
struct pci_device * pci
Underlying PCI device.
Definition: bofm.h:288
#define PCI_FMT
PCI device debug message format.
Definition: pci.h:287
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:210
int bofm(userptr_t bofmtab, struct pci_device *pci)
Process BOFM table.
Definition: bofm.c:238
#define PCI_ARGS(pci)
PCI device debug message arguments.
Definition: pci.h:290
userptr_t virt_to_user(volatile const void *addr)
Convert virtual address to user pointer.
#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, printf(), and virt_to_user().

Referenced by bofm_test_init().