svn commit: r293954 - stable/10/sys/dev/sfxge/common
Andrew Rybchenko
arybchik at FreeBSD.org
Thu Jan 14 15:15:03 UTC 2016
Author: arybchik
Date: Thu Jan 14 15:15:01 2016
New Revision: 293954
URL: https://svnweb.freebsd.org/changeset/base/293954
Log:
MFC r291923
sfxge: [Sorrento] support writing of MUM firmware
When writing the MUM firmware the chunk size must be equal to the erase
size.
Submitted by: Laurence Evans <levans at solarflare.com>
Sponsored by: Solarflare Communications, Inc.
Modified:
stable/10/sys/dev/sfxge/common/efx.h
stable/10/sys/dev/sfxge/common/efx_nvram.c
stable/10/sys/dev/sfxge/common/hunt_nic.c
stable/10/sys/dev/sfxge/common/hunt_nvram.c
stable/10/sys/dev/sfxge/common/siena_nic.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/dev/sfxge/common/efx.h
==============================================================================
--- stable/10/sys/dev/sfxge/common/efx.h Thu Jan 14 15:13:54 2016 (r293953)
+++ stable/10/sys/dev/sfxge/common/efx.h Thu Jan 14 15:15:01 2016 (r293954)
@@ -1176,6 +1176,7 @@ typedef struct efx_nic_cfg_s {
boolean_t enc_allow_set_mac_with_installed_filters;
/* External port identifier */
uint8_t enc_external_port;
+ uint32_t enc_mcdi_max_payload_length;
} efx_nic_cfg_t;
#define EFX_PCI_FUNCTION_IS_PF(_encp) ((_encp)->enc_vf == 0xffff)
Modified: stable/10/sys/dev/sfxge/common/efx_nvram.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/efx_nvram.c Thu Jan 14 15:13:54 2016 (r293953)
+++ stable/10/sys/dev/sfxge/common/efx_nvram.c Thu Jan 14 15:15:01 2016 (r293954)
@@ -749,6 +749,11 @@ fail1:
return (rc);
}
+/*
+ * The NVRAM_WRITE MCDI command is a V1 command and so is supported by both
+ * Sienna and EF10 based boards. However EF10 based boards support the use
+ * of this command with payloads up to the maximum MCDI V2 payload length.
+ */
__checkReturn efx_rc_t
efx_mcdi_nvram_write(
__in efx_nic_t *enp,
@@ -758,11 +763,18 @@ efx_mcdi_nvram_write(
__in size_t size)
{
efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_NVRAM_WRITE_IN_LENMAX,
- MC_CMD_NVRAM_WRITE_OUT_LEN)];
+ uint8_t payload[MAX(MCDI_CTL_SDU_LEN_MAX_V1,
+ MCDI_CTL_SDU_LEN_MAX_V2)];
efx_rc_t rc;
+ size_t max_data_size;
- if (size > MC_CMD_NVRAM_WRITE_IN_LENMAX) {
+ max_data_size = enp->en_nic_cfg.enc_mcdi_max_payload_length
+ - MC_CMD_NVRAM_WRITE_IN_LEN(0);
+ EFSYS_ASSERT3U(enp->en_nic_cfg.enc_mcdi_max_payload_length, >, 0);
+ EFSYS_ASSERT3U(max_data_size, <,
+ enp->en_nic_cfg.enc_mcdi_max_payload_length);
+
+ if (size > max_data_size) {
rc = EINVAL;
goto fail1;
}
Modified: stable/10/sys/dev/sfxge/common/hunt_nic.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/hunt_nic.c Thu Jan 14 15:13:54 2016 (r293953)
+++ stable/10/sys/dev/sfxge/common/hunt_nic.c Thu Jan 14 15:15:01 2016 (r293954)
@@ -1681,6 +1681,7 @@ hunt_nic_init(
}
enp->en_vport_id = EVB_PORT_ID_ASSIGNED;
+ enp->en_nic_cfg.enc_mcdi_max_payload_length = MCDI_CTL_SDU_LEN_MAX_V2;
return (0);
Modified: stable/10/sys/dev/sfxge/common/hunt_nvram.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/hunt_nvram.c Thu Jan 14 15:13:54 2016 (r293953)
+++ stable/10/sys/dev/sfxge/common/hunt_nvram.c Thu Jan 14 15:15:01 2016 (r293954)
@@ -1409,14 +1409,32 @@ hunt_nvram_partn_write(
__in size_t size)
{
size_t chunk;
+ uint32_t write_size;
efx_rc_t rc;
+ if ((rc = efx_mcdi_nvram_info(enp, partn, NULL, NULL,
+ NULL, &write_size)) != 0)
+ goto fail1;
+
+ if (write_size != 0) {
+ /*
+ * Check that the size is a multiple of the write chunk size if
+ * the write chunk size is available.
+ */
+ if (size % write_size != 0) {
+ rc = EINVAL;
+ goto fail2;
+ }
+ } else {
+ write_size = HUNTINGTON_NVRAM_CHUNK;
+ }
+
while (size > 0) {
- chunk = MIN(size, HUNTINGTON_NVRAM_CHUNK);
+ chunk = MIN(size, write_size);
if ((rc = efx_mcdi_nvram_write(enp, partn, offset,
data, chunk)) != 0) {
- goto fail1;
+ goto fail3;
}
size -= chunk;
@@ -1426,6 +1444,10 @@ hunt_nvram_partn_write(
return (0);
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
Modified: stable/10/sys/dev/sfxge/common/siena_nic.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/siena_nic.c Thu Jan 14 15:13:54 2016 (r293953)
+++ stable/10/sys/dev/sfxge/common/siena_nic.c Thu Jan 14 15:15:01 2016 (r293954)
@@ -420,6 +420,8 @@ siena_nic_init(
if ((rc = siena_phy_reconfigure(enp)) != 0)
goto fail2;
+ enp->en_nic_cfg.enc_mcdi_max_payload_length = MCDI_CTL_SDU_LEN_MAX_V1;
+
return (0);
fail2:
More information about the svn-src-stable
mailing list