summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/thunderx.c
diff options
context:
space:
mode:
authorAdamczyk, Konrad2017-03-30 15:54:59 +0200
committerMichael Brown2017-03-31 08:08:13 +0200
commitfd6d1f4660a37d75acba1c64e2e5f137307bbc31 (patch)
treee388a79ad9af808f3cb4c8482cb6121605ed9d6e /src/drivers/net/thunderx.c
parent[scsi] Retry TEST UNIT READY command (diff)
downloadipxe-fd6d1f4660a37d75acba1c64e2e5f137307bbc31.tar.gz
ipxe-fd6d1f4660a37d75acba1c64e2e5f137307bbc31.tar.xz
ipxe-fd6d1f4660a37d75acba1c64e2e5f137307bbc31.zip
[thunderx] Use ThunderxConfigProtocol to obtain board configuration
Following changes were introduced: - added GetBgxProp and GetLmacProp methods to ThunderxConfigProtocol - replaced direct BOARD_CFG access with usage of introduced methods - removed redundant BOARD_CFG - changed GUID of ThunderxConfigProtocol, as this is not compatible with previous version - changed UINTN* to UINT64* buffer type to fix issue on 32-bit platforms with MAC address This change allows us to avoid alignment of BOARD_CFG definitions every time it changes in UEFI. Signed-off-by: Konrad Adamczyk <konrad.adamczyk@cavium.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net/thunderx.c')
-rw-r--r--src/drivers/net/thunderx.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/drivers/net/thunderx.c b/src/drivers/net/thunderx.c
index c9c246cb..9ddb98ab 100644
--- a/src/drivers/net/thunderx.c
+++ b/src/drivers/net/thunderx.c
@@ -1494,18 +1494,24 @@ static void txnic_bgx_init ( struct txnic_bgx *bgx, unsigned int type ) {
*/
static void txnic_bgx_mac ( struct txnic_lmac *lmac ) {
struct txnic_bgx *bgx = lmac->bgx;
- BOARD_CFG *boardcfg;
- NODE_CFG *nodecfg;
- BGX_CFG *bgxcfg;
- LMAC_CFG *lmaccfg;
+ unsigned int lmac_idx = TXNIC_LMAC_IDX ( lmac->idx );
+ uint64_t mac;
+ EFI_STATUS efirc;
+ int rc;
/* Extract MAC from Board Configuration protocol, if available */
if ( txcfg ) {
- boardcfg = txcfg->BoardConfig;
- nodecfg = &boardcfg->Node[ bgx->node % MAX_NODES ];
- bgxcfg = &nodecfg->BgxCfg[ bgx->idx % BGX_PER_NODE_COUNT ];
- lmaccfg = &bgxcfg->Lmacs[ lmac->idx % LMAC_PER_BGX_COUNT ];
- lmac->mac.be64 = cpu_to_be64 ( lmaccfg->MacAddress );
+ if ( ( efirc = txcfg->GetLmacProp ( txcfg, bgx->node, bgx->idx,
+ lmac_idx, MAC_ADDRESS,
+ sizeof ( mac ),
+ &mac ) ) == 0 ) {
+ lmac->mac.be64 = cpu_to_be64 ( mac );
+ } else {
+ rc = -EEFI ( efirc );
+ DBGC ( TXNICCOL ( bgx ), "TXNIC %d/%d/%d could not get "
+ "MAC address: %s\n", bgx->node, bgx->idx,
+ lmac->idx, strerror ( rc ) );
+ }
} else {
DBGC ( TXNICCOL ( bgx ), "TXNIC %d/%d/%d has no board "
"configuration protocol\n", bgx->node, bgx->idx,