mirror of
https://github.com/xcat2/xNBA.git
synced 2024-11-25 11:00:15 +00:00
[hermon] Use PCI VPD for non-volatile option storage
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
2c011d77ae
commit
c4ee23e7c6
@ -42,6 +42,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
#include <ipxe/fcoe.h>
|
||||
#include <ipxe/vlan.h>
|
||||
#include <ipxe/bofm.h>
|
||||
#include <ipxe/nvsvpd.h>
|
||||
#include <ipxe/nvo.h>
|
||||
#include "hermon.h"
|
||||
|
||||
/**
|
||||
@ -3383,7 +3385,7 @@ static int hermon_register_netdev ( struct hermon *hermon,
|
||||
&query_port ) ) != 0 ) {
|
||||
DBGC ( hermon, "Hermon %p port %d could not query port: %s\n",
|
||||
hermon, ibdev->port, strerror ( rc ) );
|
||||
return rc;
|
||||
goto err_query_port;
|
||||
}
|
||||
mac.dwords[0] = htonl ( MLX_GET ( &query_port, mac_47_32 ) );
|
||||
mac.dwords[1] = htonl ( MLX_GET ( &query_port, mac_31_0 ) );
|
||||
@ -3394,10 +3396,26 @@ static int hermon_register_netdev ( struct hermon *hermon,
|
||||
if ( ( rc = register_netdev ( netdev ) ) != 0 ) {
|
||||
DBGC ( hermon, "Hermon %p port %d could not register network "
|
||||
"device: %s\n", hermon, ibdev->port, strerror ( rc ) );
|
||||
return rc;
|
||||
goto err_register_netdev;
|
||||
}
|
||||
|
||||
/* Register non-volatile options */
|
||||
if ( ( rc = register_nvo ( &port->nvo,
|
||||
netdev_settings ( netdev ) ) ) != 0 ) {
|
||||
DBGC ( hermon, "Hermon %p port %d could not register non-"
|
||||
"volatile options: %s\n",
|
||||
hermon, ibdev->port, strerror ( rc ) );
|
||||
goto err_register_nvo;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
unregister_nvo ( &port->nvo );
|
||||
err_register_nvo:
|
||||
unregister_netdev ( netdev );
|
||||
err_register_netdev:
|
||||
err_query_port:
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3429,6 +3447,7 @@ static void hermon_unregister_netdev ( struct hermon *hermon __unused,
|
||||
struct hermon_port *port ) {
|
||||
struct net_device *netdev = port->netdev;
|
||||
|
||||
unregister_nvo ( &port->nvo );
|
||||
unregister_netdev ( netdev );
|
||||
}
|
||||
|
||||
@ -3822,6 +3841,15 @@ static int hermon_probe ( struct pci_device *pci ) {
|
||||
goto err_set_port_type;
|
||||
}
|
||||
|
||||
/* Initialise non-volatile storage */
|
||||
nvs_vpd_init ( &hermon->nvsvpd, pci );
|
||||
for ( i = 0 ; i < hermon->cap.num_ports ; i++ ) {
|
||||
port = &hermon->port[i];
|
||||
nvs_vpd_nvo_init ( &hermon->nvsvpd,
|
||||
HERMON_VPD_FIELD ( port->ibdev->port ),
|
||||
&port->nvo, NULL );
|
||||
}
|
||||
|
||||
/* Register devices */
|
||||
for ( i = 0 ; i < hermon->cap.num_ports ; i++ ) {
|
||||
port = &hermon->port[i];
|
||||
|
@ -13,6 +13,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
#include <ipxe/uaccess.h>
|
||||
#include <ipxe/ib_packet.h>
|
||||
#include <ipxe/bofm.h>
|
||||
#include <ipxe/nvsvpd.h>
|
||||
#include <ipxe/nvo.h>
|
||||
#include "mlx_bitops.h"
|
||||
#include "MT25408_PRM.h"
|
||||
|
||||
@ -135,6 +137,9 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
#define HERMON_MOD_STAT_CFG_SET 0x01
|
||||
#define HERMON_MOD_STAT_CFG_QUERY 0x03
|
||||
|
||||
#define HERMON_VPD_FIELD( port ) \
|
||||
PCI_VPD_FIELD ( PCI_VPD_TAG_RW, 'V', ( '5' + (port) - 1 ) )
|
||||
|
||||
/*
|
||||
* Datatypes that seem to be missing from the autogenerated documentation
|
||||
*
|
||||
@ -825,6 +830,8 @@ struct hermon_port {
|
||||
struct ib_queue_pair *eth_qp;
|
||||
/** Port type */
|
||||
struct hermon_port_type *type;
|
||||
/** Non-volatile option storage */
|
||||
struct nvo_block nvo;
|
||||
};
|
||||
|
||||
/** A Hermon device */
|
||||
@ -891,6 +898,9 @@ struct hermon {
|
||||
/** QPN base */
|
||||
unsigned long qpn_base;
|
||||
|
||||
/** Non-volatile storage in PCI VPD */
|
||||
struct nvs_vpd_device nvsvpd;
|
||||
|
||||
/** Ports */
|
||||
struct hermon_port port[HERMON_MAX_PORTS];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user