summaryrefslogtreecommitdiffstats
path: root/src/drivers/net
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
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')
-rw-r--r--src/drivers/net/thunderx.c24
-rw-r--r--src/drivers/net/thunderxcfg.h146
2 files changed, 60 insertions, 110 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,
diff --git a/src/drivers/net/thunderxcfg.h b/src/drivers/net/thunderxcfg.h
index 235c5431..ffb34d36 100644
--- a/src/drivers/net/thunderxcfg.h
+++ b/src/drivers/net/thunderxcfg.h
@@ -63,104 +63,6 @@ FILE_LICENCE ( BSD2 );
#define THUNDERX_CPU_ID(node, cluster, core) (((node) << 16) | ((cluster) << 8) | (core))
-//TODO: Put common type definitions in separate common include file
-typedef enum {
- BGX_MODE_SGMII, /* 1 lane, 1.250 Gbaud */
- BGX_MODE_XAUI, /* 4 lanes, 3.125 Gbaud */
- BGX_MODE_DXAUI, /* 4 lanes, 6.250 Gbaud */
- BGX_MODE_RXAUI, /* 2 lanes, 6.250 Gbaud */
- BGX_MODE_XFI, /* 1 lane, 10.3125 Gbaud */
- BGX_MODE_XLAUI, /* 4 lanes, 10.3125 Gbaud */
- BGX_MODE_10G_KR,/* 1 lane, 10.3125 Gbaud */
- BGX_MODE_40G_KR,/* 4 lanes, 10.3125 Gbaud */
- BGX_MODE_UNKNOWN
-} BGX_MODE_T;
-
-typedef enum {
- EBB8800,
- EBB8804,
- CRB_1S,
- CRB_2S,
- ASIANCAT,
- GBT_MT60,
- INVENTEC_P3E003,
- BOARD_MAX
-} BOARD_TYPE;
-
-typedef struct {
- BOOLEAN Enabled;
- UINT64 LaneToSds;
- UINT64 MacAddress;
-} LMAC_CFG;
-
-typedef struct {
- BOOLEAN BgxEnabled;
- BGX_MODE_T BgxMode;
- UINTN LmacCount; //Maximum number of LMAcs
- UINT64 BaseAddress;
- UINT64 LmacType;
- /* Bit mask of QLMs connected to this BGX */
- UINT64 QlmMask;
- UINT64 QlmFreq;
- BOOLEAN UseTraining;
- LMAC_CFG Lmacs[LMAC_PER_BGX_COUNT];
-} BGX_CFG;
-
-typedef struct {
- BOOLEAN PemUsable;
-} PEM_CFG;
-
-typedef struct {
- enum { NotPresent, Empty, Available } Status;
- UINT8 Type;
- UINT8 SubType;
- UINT8 Rank;
- UINT16 Mfg;
- UINTN SizeMb;
- UINTN Speed;
- CHAR8 Serial[16];
- CHAR8 PartNo[24];
-} DIMM_CFG;
-
-typedef struct {
- DIMM_CFG DimmCfg[DIMM_PER_LMC_COUNT];
-} LMC_CFG;
-
-typedef struct {
- BOOLEAN Core[CORE_COUNT];
- BGX_CFG BgxCfg[BGX_PER_NODE_COUNT];
- PEM_CFG PemCfg[PEM_PER_NODE_COUNT];
- LMC_CFG LmcCfg[LMC_PER_NODE_COUNT];
- UINT64 RamStart;
- UINT64 RamReserve;
- UINT64 RamSize;
- UINTN CPUSpeed;
- UINTN CPUVersion;
-} NODE_CFG;
-
-#define MAX_SERIAL 32
-#define MAX_REVISION 32
-typedef struct {
- BOARD_TYPE BoardType;
- CHAR8 Serial[MAX_SERIAL];
- CHAR8 Revision[MAX_REVISION];
- UINTN NumNodes;
- UINTN BmcBootTwsiBus;
- UINTN BmcBootTwsiAddr;
- UINTN RtcTwsiBus;
- UINTN RtcTwsiAddr;
- /* IPMI support*/
- UINTN BmcIpmiTwsiBus;
- UINTN BmcIpmiTwsiAddr;
- NODE_CFG Node[MAX_NODES];
- UINT16 CpuClusterCount;
- UINT16 CpuPerClusterCount;
- UINT16 PcieSegmentCount;
- UINT64 MacAddrRangeStart;
- UINTN DdrSpeed;
- UINT64 AcpiOemTableId;
-} BOARD_CFG;
-
/******************************************************************************
*
* From ThunderConfigProtocol.h
@@ -183,13 +85,30 @@ typedef struct {
*/
#define EFI_THUNDER_CONFIG_PROTOCOL_GUID \
- {0xb75a0608, 0x99ff, 0x11e5, {0x9b, 0xeb, 0x00, 0x14, 0xd1, 0xfa, 0x23, 0x5c}}
+ {0xc12b1873, 0xac17, 0x4176, {0xac, 0x77, 0x7e, 0xcb, 0x4d, 0xef, 0xff, 0xec}}
///
/// Forward declaration
///
typedef struct _EFI_THUNDER_CONFIG_PROTOCOL EFI_THUNDER_CONFIG_PROTOCOL;
+typedef enum {
+ BGX_ENABLED,
+ BGX_MODE,
+ LMAC_COUNT,
+ BASE_ADDRESS,
+ LMAC_TYPE_BGX,
+ QLM_MASK,
+ QLM_FREQ,
+ USE_TRAINING
+} BGX_PROPERTY;
+
+typedef enum {
+ ENABLED,
+ LANE_TO_SDS,
+ MAC_ADDRESS
+} LMAC_PROPERTY;
+
///
/// Function prototypes
///
@@ -197,7 +116,30 @@ typedef
EFI_STATUS
(EFIAPI *EFI_THUNDER_CONFIG_PROTOCOL_GET_CONFIG)(
IN EFI_THUNDER_CONFIG_PROTOCOL *This,
- OUT BOARD_CFG** cfg
+ OUT VOID** cfg
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_THUNDER_CONFIG_PROTOCOL_GET_BGX_PROP)(
+ IN EFI_THUNDER_CONFIG_PROTOCOL *This,
+ IN UINTN NodeId,
+ IN UINTN BgxId,
+ IN BGX_PROPERTY BgxProp,
+ IN UINT64 ValueSize,
+ OUT UINT64 *Value
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_THUNDER_CONFIG_PROTOCOL_GET_LMAC_PROP)(
+ IN EFI_THUNDER_CONFIG_PROTOCOL *This,
+ IN UINTN NodeId,
+ IN UINTN BgxId,
+ IN UINTN LmacId,
+ IN LMAC_PROPERTY LmacProp,
+ IN UINT64 ValueSize,
+ OUT UINT64 *Value
);
///
@@ -205,7 +147,9 @@ EFI_STATUS
///
struct _EFI_THUNDER_CONFIG_PROTOCOL {
EFI_THUNDER_CONFIG_PROTOCOL_GET_CONFIG GetConfig;
- BOARD_CFG* BoardConfig;
+ EFI_THUNDER_CONFIG_PROTOCOL_GET_BGX_PROP GetBgxProp;
+ EFI_THUNDER_CONFIG_PROTOCOL_GET_LMAC_PROP GetLmacProp;
+ VOID* BoardConfig;
};
#endif /* _THUNDERXCFG_H */