From owner-svn-src-all@freebsd.org Mon Jan 18 06:18:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6F3EA8777D; Mon, 18 Jan 2016 06:18:03 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A79B1553; Mon, 18 Jan 2016 06:18:03 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0I6I2Ma038617; Mon, 18 Jan 2016 06:18:02 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0I6I2Wf038611; Mon, 18 Jan 2016 06:18:02 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201601180618.u0I6I2Wf038611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Mon, 18 Jan 2016 06:18:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294252 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2016 06:18:03 -0000 Author: arybchik Date: Mon Jan 18 06:18:01 2016 New Revision: 294252 URL: https://svnweb.freebsd.org/changeset/base/294252 Log: sfxge: convert nvram set_version method to use partition id Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_nvram.c head/sys/dev/sfxge/common/hunt_impl.h head/sys/dev/sfxge/common/hunt_nvram.c head/sys/dev/sfxge/common/siena_impl.h head/sys/dev/sfxge/common/siena_nvram.c Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Mon Jan 18 06:16:51 2016 (r294251) +++ head/sys/dev/sfxge/common/efx_impl.h Mon Jan 18 06:18:01 2016 (r294252) @@ -484,9 +484,6 @@ typedef struct efx_nvram_ops_s { #if EFSYS_OPT_DIAG efx_rc_t (*envo_test)(efx_nic_t *); #endif /* EFSYS_OPT_DIAG */ - efx_rc_t (*envo_set_version)(efx_nic_t *, efx_nvram_type_t, - uint16_t *); - efx_rc_t (*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t, uint32_t *); efx_rc_t (*envo_partn_size)(efx_nic_t *, uint32_t, size_t *); @@ -500,6 +497,8 @@ typedef struct efx_nvram_ops_s { void (*envo_partn_rw_finish)(efx_nic_t *, uint32_t); efx_rc_t (*envo_partn_get_version)(efx_nic_t *, uint32_t, uint32_t *, uint16_t *); + efx_rc_t (*envo_partn_set_version)(efx_nic_t *, uint32_t, + uint16_t *); } efx_nvram_ops_t; #endif /* EFSYS_OPT_NVRAM */ Modified: head/sys/dev/sfxge/common/efx_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/efx_nvram.c Mon Jan 18 06:16:51 2016 (r294251) +++ head/sys/dev/sfxge/common/efx_nvram.c Mon Jan 18 06:18:01 2016 (r294252) @@ -42,7 +42,6 @@ static efx_nvram_ops_t __efx_nvram_falco #if EFSYS_OPT_DIAG falcon_nvram_test, /* envo_test */ #endif /* EFSYS_OPT_DIAG */ - falcon_nvram_set_version, /* envo_set_version */ falcon_nvram_type_to_partn, /* envo_type_to_partn */ falcon_nvram_partn_size, /* envo_partn_size */ falcon_nvram_partn_rw_start, /* envo_partn_rw_start */ @@ -51,6 +50,7 @@ static efx_nvram_ops_t __efx_nvram_falco falcon_nvram_partn_write, /* envo_partn_write */ falcon_nvram_partn_rw_finish, /* envo_partn_rw_finish */ falcon_nvram_partn_get_version, /* envo_partn_get_version */ + falcon_nvram_partn_set_version, /* envo_partn_set_version */ }; #endif /* EFSYS_OPT_FALCON */ @@ -61,7 +61,6 @@ static efx_nvram_ops_t __efx_nvram_siena #if EFSYS_OPT_DIAG siena_nvram_test, /* envo_test */ #endif /* EFSYS_OPT_DIAG */ - siena_nvram_set_version, /* envo_set_version */ siena_nvram_type_to_partn, /* envo_type_to_partn */ siena_nvram_partn_size, /* envo_partn_size */ siena_nvram_partn_rw_start, /* envo_partn_rw_start */ @@ -70,6 +69,7 @@ static efx_nvram_ops_t __efx_nvram_siena siena_nvram_partn_write, /* envo_partn_write */ siena_nvram_partn_rw_finish, /* envo_partn_rw_finish */ siena_nvram_partn_get_version, /* envo_partn_get_version */ + siena_nvram_partn_set_version, /* envo_partn_set_version */ }; #endif /* EFSYS_OPT_SIENA */ @@ -80,7 +80,6 @@ static efx_nvram_ops_t __efx_nvram_ef10_ #if EFSYS_OPT_DIAG ef10_nvram_test, /* envo_test */ #endif /* EFSYS_OPT_DIAG */ - ef10_nvram_set_version, /* envo_set_version */ ef10_nvram_type_to_partn, /* envo_type_to_partn */ ef10_nvram_partn_size, /* envo_partn_size */ ef10_nvram_partn_rw_start, /* envo_partn_rw_start */ @@ -89,6 +88,7 @@ static efx_nvram_ops_t __efx_nvram_ef10_ ef10_nvram_partn_write, /* envo_partn_write */ ef10_nvram_partn_rw_finish, /* envo_partn_rw_finish */ ef10_nvram_partn_get_version, /* envo_partn_get_version */ + ef10_nvram_partn_set_version, /* envo_partn_set_version */ }; #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ @@ -414,6 +414,7 @@ efx_nvram_set_version( __in_ecount(4) uint16_t version[4]) { efx_nvram_ops_t *envop = enp->en_envop; + uint32_t partn; efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); @@ -429,11 +430,16 @@ efx_nvram_set_version( */ EFSYS_ASSERT3U(enp->en_nvram_locked, ==, EFX_NVRAM_INVALID); - if ((rc = envop->envo_set_version(enp, type, version)) != 0) + if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0) goto fail1; + if ((rc = envop->envo_partn_set_version(enp, partn, version)) != 0) + goto fail2; + return (0); +fail2: + EFSYS_PROBE(fail2); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); Modified: head/sys/dev/sfxge/common/hunt_impl.h ============================================================================== --- head/sys/dev/sfxge/common/hunt_impl.h Mon Jan 18 06:16:51 2016 (r294251) +++ head/sys/dev/sfxge/common/hunt_impl.h Mon Jan 18 06:18:01 2016 (r294252) @@ -387,18 +387,6 @@ ef10_nvram_test( #endif /* EFSYS_OPT_DIAG */ extern __checkReturn efx_rc_t -ef10_nvram_partn_set_version( - __in efx_nic_t *enp, - __in uint32_t partn, - __in_ecount(4) uint16_t version[4]); - -extern __checkReturn efx_rc_t -ef10_nvram_set_version( - __in efx_nic_t *enp, - __in efx_nvram_type_t type, - __in_ecount(4) uint16_t version[4]); - -extern __checkReturn efx_rc_t ef10_nvram_type_to_partn( __in efx_nic_t *enp, __in efx_nvram_type_t type, @@ -451,6 +439,12 @@ ef10_nvram_partn_get_version( __out uint32_t *subtypep, __out_ecount(4) uint16_t version[4]); +extern __checkReturn efx_rc_t +ef10_nvram_partn_set_version( + __in efx_nic_t *enp, + __in uint32_t partn, + __in_ecount(4) uint16_t version[4]); + #endif /* EFSYS_OPT_NVRAM */ Modified: head/sys/dev/sfxge/common/hunt_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/hunt_nvram.c Mon Jan 18 06:16:51 2016 (r294251) +++ head/sys/dev/sfxge/common/hunt_nvram.c Mon Jan 18 06:18:01 2016 (r294252) @@ -1770,31 +1770,6 @@ ef10_nvram_partn_rw_finish( ef10_nvram_partn_unlock(enp, partn); } - __checkReturn efx_rc_t -ef10_nvram_set_version( - __in efx_nic_t *enp, - __in efx_nvram_type_t type, - __in_ecount(4) uint16_t version[4]) -{ - uint32_t partn; - efx_rc_t rc; - - if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) - goto fail1; - - if ((rc = ef10_nvram_partn_set_version(enp, partn, version)) != 0) - goto fail2; - - return (0); - -fail2: - EFSYS_PROBE(fail2); -fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); - - return (rc); -} - #endif /* EFSYS_OPT_NVRAM */ #endif /* EFSYS_OPT_HUNTINGTON */ Modified: head/sys/dev/sfxge/common/siena_impl.h ============================================================================== --- head/sys/dev/sfxge/common/siena_impl.h Mon Jan 18 06:16:51 2016 (r294251) +++ head/sys/dev/sfxge/common/siena_impl.h Mon Jan 18 06:18:01 2016 (r294252) @@ -187,12 +187,6 @@ siena_nvram_get_subtype( __out uint32_t *subtypep); extern __checkReturn efx_rc_t -siena_nvram_set_version( - __in efx_nic_t *enp, - __in efx_nvram_type_t type, - __in_ecount(4) uint16_t version[4]); - -extern __checkReturn efx_rc_t siena_nvram_type_to_partn( __in efx_nic_t *enp, __in efx_nvram_type_t type, @@ -245,6 +239,11 @@ siena_nvram_partn_get_version( __out uint32_t *subtypep, __out_ecount(4) uint16_t version[4]); +extern __checkReturn efx_rc_t +siena_nvram_partn_set_version( + __in efx_nic_t *enp, + __in uint32_t partn, + __in_ecount(4) uint16_t version[4]); #endif /* EFSYS_OPT_NVRAM */ Modified: head/sys/dev/sfxge/common/siena_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/siena_nvram.c Mon Jan 18 06:16:51 2016 (r294251) +++ head/sys/dev/sfxge/common/siena_nvram.c Mon Jan 18 06:18:01 2016 (r294252) @@ -594,15 +594,15 @@ siena_nvram_partn_rw_finish( } __checkReturn efx_rc_t -siena_nvram_set_version( +siena_nvram_partn_set_version( __in efx_nic_t *enp, - __in efx_nvram_type_t type, + __in uint32_t partn, __in_ecount(4) uint16_t version[4]) { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); siena_mc_dynamic_config_hdr_t *dcfg = NULL; siena_mc_fw_version_t *fwverp; - uint32_t dcfg_partn, partn; + uint32_t dcfg_partn; size_t dcfg_size; unsigned int hdr_length; unsigned int vpd_length; @@ -615,15 +615,12 @@ siena_nvram_set_version( size_t length; efx_rc_t rc; - if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) - goto fail1; - dcfg_partn = (emip->emi_port == 1) ? MC_CMD_NVRAM_TYPE_DYNAMIC_CFG_PORT0 : MC_CMD_NVRAM_TYPE_DYNAMIC_CFG_PORT1; if ((rc = siena_nvram_partn_size(enp, dcfg_partn, &dcfg_size)) != 0) - goto fail2; + goto fail1; if ((rc = siena_nvram_partn_lock(enp, dcfg_partn)) != 0) goto fail2;