diff options
author | Adamczyk, Konrad <Konrad.Adamczyk@cavium.com> | 2017-03-30 13:54:59 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2017-03-31 09:08:13 +0300 |
commit | fd6d1f4660a37d75acba1c64e2e5f137307bbc31 (patch) | |
tree | e388a79ad9af808f3cb4c8482cb6121605ed9d6e /src/drivers/net/thunderx.c | |
parent | a66ac07165855d8144f69a68d5c0ab0eb36e97e2 (diff) | |
download | ipxe-fd6d1f4660a37d75acba1c64e2e5f137307bbc31.tar.gz |
[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.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/drivers/net/thunderx.c b/src/drivers/net/thunderx.c index c9c246cb8..9ddb98ab8 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, |