get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1174152/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1174152,
    "url": "http://patchwork.ozlabs.org/api/patches/1174152/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20191009140953.14087-4-anthony.l.nguyen@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20191009140953.14087-4-anthony.l.nguyen@intel.com>",
    "list_archive_url": null,
    "date": "2019-10-09T14:09:42",
    "name": "[S31,04/15] ice: Update Boot Configuration Section read of NVM",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e6bc2221cdc65be783f82f8fdc751ce1c79dd9fe",
    "submitter": {
        "id": 68875,
        "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api",
        "name": "Tony Nguyen",
        "email": "anthony.l.nguyen@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20191009140953.14087-4-anthony.l.nguyen@intel.com/mbox/",
    "series": [
        {
            "id": 135203,
            "url": "http://patchwork.ozlabs.org/api/series/135203/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=135203",
            "date": "2019-10-09T14:09:45",
            "name": "[S31,01/15] ice: implement set_eeprom functionality",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/135203/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1174152/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1174152/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.138; helo=whitealder.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 46pTgm0XNJz9sPF\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 10 Oct 2019 09:40:19 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 07F6187C99;\n\tWed,  9 Oct 2019 22:40:18 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id FA4hBKQoJ07T; Wed,  9 Oct 2019 22:40:12 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 9B9FC87CAB;\n\tWed,  9 Oct 2019 22:40:10 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 543441BF3CC\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  9 Oct 2019 22:40:05 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 514E8883A4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  9 Oct 2019 22:40:05 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id tyJmWNOyYd+n for <intel-wired-lan@lists.osuosl.org>;\n\tWed,  9 Oct 2019 22:40:01 +0000 (UTC)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 855FA8837F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  9 Oct 2019 22:40:01 +0000 (UTC)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t09 Oct 2019 15:40:00 -0700",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby orsmga003.jf.intel.com with ESMTP; 09 Oct 2019 15:40:00 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.67,277,1566889200\"; d=\"scan'208\";a=\"197052253\"",
        "From": "Tony Nguyen <anthony.l.nguyen@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Wed,  9 Oct 2019 07:09:42 -0700",
        "Message-Id": "<20191009140953.14087-4-anthony.l.nguyen@intel.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20191009140953.14087-1-anthony.l.nguyen@intel.com>",
        "References": "<20191009140953.14087-1-anthony.l.nguyen@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH S31 04/15] ice: Update Boot Configuration\n\tSection read of NVM",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Md Fahad Iqbal Polash <md.fahad.iqbal.polash@intel.com>\n\nThe Boot Configuration Section Block has been moved to the Preserved Field\nArea (PFA) of NVM. Update the NVM reads that involves Boot Configuration\nSection.\n\nSigned-off-by: Md Fahad Iqbal Polash <md.fahad.iqbal.polash@intel.com>\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_common.c | 66 +++++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_common.h |  3 +\n drivers/net/ethernet/intel/ice/ice_nvm.c    | 51 +++++++++++++---\n drivers/net/ethernet/intel/ice/ice_nvm.h    |  1 +\n drivers/net/ethernet/intel/ice/ice_type.h   |  3 +\n 5 files changed, 115 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c\nindex 494e51be2eac..003790d2822c 100644\n--- a/drivers/net/ethernet/intel/ice/ice_common.c\n+++ b/drivers/net/ethernet/intel/ice/ice_common.c\n@@ -1088,6 +1088,72 @@ enum ice_status ice_reset(struct ice_hw *hw, enum ice_reset_req req)\n \treturn ice_check_reset(hw);\n }\n \n+/**\n+ * ice_get_pfa_module_tlv - Reads sub module TLV from NVM PFA\n+ * @hw: pointer to hardware structure\n+ * @module_tlv: pointer to module TLV to return\n+ * @module_tlv_len: pointer to module TLV length to return\n+ * @module_type: module type requested\n+ *\n+ * Finds the requested sub module TLV type from the Preserved Field\n+ * Area (PFA) and returns the TLV pointer and length. The caller can\n+ * use these to read the variable length TLV value.\n+ */\n+enum ice_status\n+ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len,\n+\t\t       u16 module_type)\n+{\n+\tenum ice_status status;\n+\tu16 pfa_len, pfa_ptr;\n+\tu16 next_tlv;\n+\n+\tstatus = ice_read_sr_word(hw, ICE_SR_PFA_PTR, &pfa_ptr);\n+\tif (status) {\n+\t\tice_debug(hw, ICE_DBG_INIT, \"Preserved Field Array pointer.\\n\");\n+\t\treturn status;\n+\t}\n+\tstatus = ice_read_sr_word(hw, pfa_ptr, &pfa_len);\n+\tif (status) {\n+\t\tice_debug(hw, ICE_DBG_INIT, \"Failed to read PFA length.\\n\");\n+\t\treturn status;\n+\t}\n+\t/* Starting with first TLV after PFA length, iterate through the list\n+\t * of TLVs to find the requested one.\n+\t */\n+\tnext_tlv = pfa_ptr + 1;\n+\twhile (next_tlv < pfa_ptr + pfa_len) {\n+\t\tu16 tlv_sub_module_type;\n+\t\tu16 tlv_len;\n+\n+\t\t/* Read TLV type */\n+\t\tstatus = ice_read_sr_word(hw, next_tlv, &tlv_sub_module_type);\n+\t\tif (status) {\n+\t\t\tice_debug(hw, ICE_DBG_INIT, \"Failed to read TLV type.\\n\");\n+\t\t\tbreak;\n+\t\t}\n+\t\t/* Read TLV length */\n+\t\tstatus = ice_read_sr_word(hw, next_tlv + 1, &tlv_len);\n+\t\tif (status) {\n+\t\t\tice_debug(hw, ICE_DBG_INIT, \"Failed to read TLV length.\\n\");\n+\t\t\tbreak;\n+\t\t}\n+\t\tif (tlv_sub_module_type == module_type) {\n+\t\t\tif (tlv_len) {\n+\t\t\t\t*module_tlv = next_tlv;\n+\t\t\t\t*module_tlv_len = tlv_len;\n+\t\t\t\treturn 0;\n+\t\t\t}\n+\t\t\treturn ICE_ERR_INVAL_SIZE;\n+\t\t}\n+\t\t/* Check next TLV, i.e. current TLV pointer + length + 2 words\n+\t\t * (for current TLV's type and length)\n+\t\t */\n+\t\tnext_tlv = next_tlv + tlv_len + 2;\n+\t}\n+\t/* Module does not exist */\n+\treturn ICE_ERR_DOES_NOT_EXIST;\n+}\n+\n /**\n  * ice_copy_rxq_ctx_to_hw\n  * @hw: pointer to the hardware structure\ndiff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h\nindex e416721f5d9a..1972f397cf97 100644\n--- a/drivers/net/ethernet/intel/ice/ice_common.h\n+++ b/drivers/net/ethernet/intel/ice/ice_common.h\n@@ -24,6 +24,9 @@ void\n ice_debug_cq(struct ice_hw *hw, u32 mask, void *desc, void *buf, u16 buf_len);\n enum ice_status ice_init_hw(struct ice_hw *hw);\n void ice_deinit_hw(struct ice_hw *hw);\n+enum ice_status\n+ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len,\n+\t\t       u16 module_type);\n enum ice_status ice_check_reset(struct ice_hw *hw);\n enum ice_status ice_reset(struct ice_hw *hw, enum ice_reset_req req);\n enum ice_status ice_create_all_ctrlq(struct ice_hw *hw);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_nvm.c b/drivers/net/ethernet/intel/ice/ice_nvm.c\nindex bd19ce9b5bfd..28e1972e2bc9 100644\n--- a/drivers/net/ethernet/intel/ice/ice_nvm.c\n+++ b/drivers/net/ethernet/intel/ice/ice_nvm.c\n@@ -168,8 +168,7 @@ void ice_release_nvm(struct ice_hw *hw)\n  *\n  * Reads one 16 bit word from the Shadow RAM using the ice_read_sr_word_aq.\n  */\n-static enum\n-ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data)\n+enum ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data)\n {\n \tenum ice_status status;\n \n@@ -191,9 +190,10 @@ ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data)\n  */\n enum ice_status ice_init_nvm(struct ice_hw *hw)\n {\n+\tu16 oem_hi, oem_lo, boot_cfg_tlv, boot_cfg_tlv_len;\n \tstruct ice_nvm_info *nvm = &hw->nvm;\n \tu16 eetrack_lo, eetrack_hi;\n-\tenum ice_status status = 0;\n+\tenum ice_status status;\n \tu32 fla, gens_stat;\n \tu8 sr_size;\n \n@@ -210,15 +210,15 @@ enum ice_status ice_init_nvm(struct ice_hw *hw)\n \tfla = rd32(hw, GLNVM_FLA);\n \tif (fla & GLNVM_FLA_LOCKED_M) { /* Normal programming mode */\n \t\tnvm->blank_nvm_mode = false;\n-\t} else { /* Blank programming mode */\n+\t} else {\n+\t\t/* Blank programming mode */\n \t\tnvm->blank_nvm_mode = true;\n-\t\tstatus = ICE_ERR_NVM_BLANK_MODE;\n \t\tice_debug(hw, ICE_DBG_NVM,\n \t\t\t  \"NVM init error: unsupported blank mode.\\n\");\n-\t\treturn status;\n+\t\treturn ICE_ERR_NVM_BLANK_MODE;\n \t}\n \n-\tstatus = ice_read_sr_word(hw, ICE_SR_NVM_DEV_STARTER_VER, &hw->nvm.ver);\n+\tstatus = ice_read_sr_word(hw, ICE_SR_NVM_DEV_STARTER_VER, &nvm->ver);\n \tif (status) {\n \t\tice_debug(hw, ICE_DBG_INIT,\n \t\t\t  \"Failed to read DEV starter version.\\n\");\n@@ -236,9 +236,42 @@ enum ice_status ice_init_nvm(struct ice_hw *hw)\n \t\treturn status;\n \t}\n \n-\thw->nvm.eetrack = (eetrack_hi << 16) | eetrack_lo;\n+\tnvm->eetrack = (eetrack_hi << 16) | eetrack_lo;\n \n-\treturn status;\n+\tstatus = ice_get_pfa_module_tlv(hw, &boot_cfg_tlv, &boot_cfg_tlv_len,\n+\t\t\t\t\tICE_SR_BOOT_CFG_PTR);\n+\tif (status) {\n+\t\tice_debug(hw, ICE_DBG_INIT,\n+\t\t\t  \"Failed to read Boot Configuration Block TLV.\\n\");\n+\t\treturn status;\n+\t}\n+\n+\t/* Boot Configuration Block must have length at least 2 words\n+\t * (Combo Image Version High and Combo Image Version Low)\n+\t */\n+\tif (boot_cfg_tlv_len < 2) {\n+\t\tice_debug(hw, ICE_DBG_INIT,\n+\t\t\t  \"Invalid Boot Configuration Block TLV size.\\n\");\n+\t\treturn ICE_ERR_INVAL_SIZE;\n+\t}\n+\n+\tstatus = ice_read_sr_word(hw, (boot_cfg_tlv + ICE_NVM_OEM_VER_OFF),\n+\t\t\t\t  &oem_hi);\n+\tif (status) {\n+\t\tice_debug(hw, ICE_DBG_INIT, \"Failed to read OEM_VER hi.\\n\");\n+\t\treturn status;\n+\t}\n+\n+\tstatus = ice_read_sr_word(hw, (boot_cfg_tlv + ICE_NVM_OEM_VER_OFF + 1),\n+\t\t\t\t  &oem_lo);\n+\tif (status) {\n+\t\tice_debug(hw, ICE_DBG_INIT, \"Failed to read OEM_VER lo.\\n\");\n+\t\treturn status;\n+\t}\n+\n+\tnvm->oem_ver = ((u32)oem_hi << 16) | oem_lo;\n+\n+\treturn 0;\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/ice/ice_nvm.h b/drivers/net/ethernet/intel/ice/ice_nvm.h\nindex 75d167b7ebe3..b6dd6226e81c 100644\n--- a/drivers/net/ethernet/intel/ice/ice_nvm.h\n+++ b/drivers/net/ethernet/intel/ice/ice_nvm.h\n@@ -76,4 +76,5 @@ ice_aq_read_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset, u16 length,\n \t\tvoid *data, bool last_command, bool read_shadow_ram,\n \t\tstruct ice_sq_cd *cd);\n enum ice_status ice_init_nvm(struct ice_hw *hw);\n+enum ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data);\n #endif /* _ICE_NVM_H_ */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h\nindex 53fcb9b18e78..8fa27030fdf2 100644\n--- a/drivers/net/ethernet/intel/ice/ice_type.h\n+++ b/drivers/net/ethernet/intel/ice/ice_type.h\n@@ -559,6 +559,8 @@ struct ice_hw_port_stats {\n };\n \n /* Checksum and Shadow RAM pointers */\n+#define ICE_SR_BOOT_CFG_PTR\t\t0x132\n+#define ICE_NVM_OEM_VER_OFF\t\t0x02\n #define ICE_SR_NVM_DEV_STARTER_VER\t0x18\n #define ICE_SR_NVM_EETRACK_LO\t\t0x2D\n #define ICE_SR_NVM_EETRACK_HI\t\t0x2E\n@@ -572,6 +574,7 @@ struct ice_hw_port_stats {\n #define ICE_OEM_VER_BUILD_MASK\t\t(0xffff << ICE_OEM_VER_BUILD_SHIFT)\n #define ICE_OEM_VER_SHIFT\t\t24\n #define ICE_OEM_VER_MASK\t\t(0xff << ICE_OEM_VER_SHIFT)\n+#define ICE_SR_PFA_PTR\t\t\t0x40\n #define ICE_SR_SECTOR_SIZE_IN_WORDS\t0x800\n #define ICE_SR_WORDS_IN_1KB\t\t512\n \n",
    "prefixes": [
        "S31",
        "04/15"
    ]
}