@@ -597,6 +597,11 @@ static bool ixgbe_parse_e610_caps(struct ixgbe_hw *hw,
597597 case IXGBE_ACI_CAPS_PENDING_NET_VER :
598598 caps -> nvm_update_pending_netlist = true;
599599 break ;
600+ case IXGBE_ACI_CAPS_NVM_MGMT :
601+ caps -> nvm_unified_update =
602+ (number & IXGBE_NVM_MGMT_UNIFIED_UPD_SUPPORT ) ?
603+ true : false;
604+ break ;
600605 case IXGBE_ACI_CAPS_MAX_MTU :
601606 caps -> max_mtu = number ;
602607 break ;
@@ -2294,6 +2299,131 @@ int ixgbe_aci_read_nvm(struct ixgbe_hw *hw, u16 module_typeid, u32 offset,
22942299 return ixgbe_aci_send_cmd (hw , & desc , data , length );
22952300}
22962301
2302+ /**
2303+ * ixgbe_aci_erase_nvm - erase NVM sector
2304+ * @hw: pointer to the HW struct
2305+ * @module_typeid: module pointer location in words from the NVM beginning
2306+ *
2307+ * Erase the NVM sector using the ACI command (0x0702).
2308+ *
2309+ * Return: the exit code of the operation.
2310+ */
2311+ int ixgbe_aci_erase_nvm (struct ixgbe_hw * hw , u16 module_typeid )
2312+ {
2313+ struct ixgbe_aci_cmd_nvm * cmd ;
2314+ struct ixgbe_aci_desc desc ;
2315+ __le16 len ;
2316+ int err ;
2317+
2318+ /* Read a length value from SR, so module_typeid is equal to 0,
2319+ * calculate offset where module size is placed from bytes to words
2320+ * set last command and read from SR values to true.
2321+ */
2322+ err = ixgbe_aci_read_nvm (hw , 0 , 2 * module_typeid + 2 , 2 , & len , true,
2323+ true);
2324+ if (err )
2325+ return err ;
2326+
2327+ cmd = & desc .params .nvm ;
2328+
2329+ ixgbe_fill_dflt_direct_cmd_desc (& desc , ixgbe_aci_opc_nvm_erase );
2330+
2331+ cmd -> module_typeid = cpu_to_le16 (module_typeid );
2332+ cmd -> length = len ;
2333+ cmd -> offset_low = 0 ;
2334+ cmd -> offset_high = 0 ;
2335+
2336+ return ixgbe_aci_send_cmd (hw , & desc , NULL , 0 );
2337+ }
2338+
2339+ /**
2340+ * ixgbe_aci_update_nvm - update NVM
2341+ * @hw: pointer to the HW struct
2342+ * @module_typeid: module pointer location in words from the NVM beginning
2343+ * @offset: byte offset from the module beginning
2344+ * @length: length of the section to be written (in bytes from the offset)
2345+ * @data: command buffer (size [bytes] = length)
2346+ * @last_command: tells if this is the last command in a series
2347+ * @command_flags: command parameters
2348+ *
2349+ * Update the NVM using the ACI command (0x0703).
2350+ *
2351+ * Return: the exit code of the operation.
2352+ */
2353+ int ixgbe_aci_update_nvm (struct ixgbe_hw * hw , u16 module_typeid ,
2354+ u32 offset , u16 length , void * data ,
2355+ bool last_command , u8 command_flags )
2356+ {
2357+ struct ixgbe_aci_cmd_nvm * cmd ;
2358+ struct ixgbe_aci_desc desc ;
2359+
2360+ cmd = & desc .params .nvm ;
2361+
2362+ /* In offset the highest byte must be zeroed. */
2363+ if (offset & 0xFF000000 )
2364+ return - EINVAL ;
2365+
2366+ ixgbe_fill_dflt_direct_cmd_desc (& desc , ixgbe_aci_opc_nvm_write );
2367+
2368+ cmd -> cmd_flags |= command_flags ;
2369+
2370+ /* If this is the last command in a series, set the proper flag. */
2371+ if (last_command )
2372+ cmd -> cmd_flags |= IXGBE_ACI_NVM_LAST_CMD ;
2373+ cmd -> module_typeid = cpu_to_le16 (module_typeid );
2374+ cmd -> offset_low = cpu_to_le16 (offset & 0xFFFF );
2375+ cmd -> offset_high = FIELD_GET (IXGBE_ACI_NVM_OFFSET_HI_U_MASK , offset );
2376+ cmd -> length = cpu_to_le16 (length );
2377+
2378+ desc .flags |= cpu_to_le16 (IXGBE_ACI_FLAG_RD );
2379+
2380+ return ixgbe_aci_send_cmd (hw , & desc , data , length );
2381+ }
2382+
2383+ /**
2384+ * ixgbe_nvm_write_activate - NVM activate write
2385+ * @hw: pointer to the HW struct
2386+ * @cmd_flags: flags for write activate command
2387+ * @response_flags: response indicators from firmware
2388+ *
2389+ * Update the control word with the required banks' validity bits
2390+ * and dumps the Shadow RAM to flash using ACI command (0x0707).
2391+ *
2392+ * cmd_flags controls which banks to activate, the preservation level to use
2393+ * when activating the NVM bank, and whether an EMP reset is required for
2394+ * activation.
2395+ *
2396+ * Note that the 16bit cmd_flags value is split between two separate 1 byte
2397+ * flag values in the descriptor.
2398+ *
2399+ * On successful return of the firmware command, the response_flags variable
2400+ * is updated with the flags reported by firmware indicating certain status,
2401+ * such as whether EMP reset is enabled.
2402+ *
2403+ * Return: the exit code of the operation.
2404+ */
2405+ int ixgbe_nvm_write_activate (struct ixgbe_hw * hw , u16 cmd_flags ,
2406+ u8 * response_flags )
2407+ {
2408+ struct ixgbe_aci_cmd_nvm * cmd ;
2409+ struct ixgbe_aci_desc desc ;
2410+ s32 err ;
2411+
2412+ cmd = & desc .params .nvm ;
2413+ ixgbe_fill_dflt_direct_cmd_desc (& desc ,
2414+ ixgbe_aci_opc_nvm_write_activate );
2415+
2416+ cmd -> cmd_flags = (u8 )(cmd_flags & 0xFF );
2417+ cmd -> offset_high = (u8 )FIELD_GET (IXGBE_ACI_NVM_OFFSET_HI_A_MASK ,
2418+ cmd_flags );
2419+
2420+ err = ixgbe_aci_send_cmd (hw , & desc , NULL , 0 );
2421+ if (!err && response_flags )
2422+ * response_flags = cmd -> cmd_flags ;
2423+
2424+ return err ;
2425+ }
2426+
22972427/**
22982428 * ixgbe_nvm_validate_checksum - validate checksum
22992429 * @hw: pointer to the HW struct
@@ -3171,6 +3301,85 @@ int ixgbe_get_flash_data(struct ixgbe_hw *hw)
31713301 return err ;
31723302}
31733303
3304+ /* ixgbe_nvm_set_pkg_data - NVM set package data
3305+ * @hw: pointer to the HW struct
3306+ * @del_pkg_data_flag: If is set then the current pkg_data store by FW
3307+ * is deleted.
3308+ * If bit is set to 1, then buffer should be size 0.
3309+ * @data: pointer to buffer
3310+ * @length: length of the buffer
3311+ *
3312+ * Set package data using ACI command (0x070A).
3313+ * This command is equivalent to the reception of
3314+ * a PLDM FW Update GetPackageData cmd. This command should be sent
3315+ * as part of the NVM update as the first cmd in the flow.
3316+ *
3317+ * Return: the exit code of the operation.
3318+ */
3319+ int ixgbe_nvm_set_pkg_data (struct ixgbe_hw * hw , bool del_pkg_data_flag ,
3320+ u8 * data , u16 length )
3321+ {
3322+ struct ixgbe_aci_cmd_nvm_pkg_data * cmd ;
3323+ struct ixgbe_aci_desc desc ;
3324+
3325+ if (length != 0 && !data )
3326+ return - EINVAL ;
3327+
3328+ cmd = & desc .params .pkg_data ;
3329+
3330+ ixgbe_fill_dflt_direct_cmd_desc (& desc , ixgbe_aci_opc_nvm_pkg_data );
3331+ desc .flags |= cpu_to_le16 (IXGBE_ACI_FLAG_RD );
3332+
3333+ if (del_pkg_data_flag )
3334+ cmd -> cmd_flags |= IXGBE_ACI_NVM_PKG_DELETE ;
3335+
3336+ return ixgbe_aci_send_cmd (hw , & desc , data , length );
3337+ }
3338+
3339+ /* ixgbe_nvm_pass_component_tbl - NVM pass component table
3340+ * @hw: pointer to the HW struct
3341+ * @data: pointer to buffer
3342+ * @length: length of the buffer
3343+ * @transfer_flag: parameter for determining stage of the update
3344+ * @comp_response: a pointer to the response from the 0x070B ACI.
3345+ * @comp_response_code: a pointer to the response code from the 0x070B ACI.
3346+ *
3347+ * Pass component table using ACI command (0x070B). This command is equivalent
3348+ * to the reception of a PLDM FW Update PassComponentTable cmd.
3349+ * This command should be sent once per component. It can be only sent after
3350+ * Set Package Data cmd and before actual update. FW will assume these
3351+ * commands are going to be sent until the TransferFlag is set to End or
3352+ * StartAndEnd.
3353+ *
3354+ * Return: the exit code of the operation.
3355+ */
3356+ int ixgbe_nvm_pass_component_tbl (struct ixgbe_hw * hw , u8 * data , u16 length ,
3357+ u8 transfer_flag , u8 * comp_response ,
3358+ u8 * comp_response_code )
3359+ {
3360+ struct ixgbe_aci_cmd_nvm_pass_comp_tbl * cmd ;
3361+ struct ixgbe_aci_desc desc ;
3362+ int err ;
3363+
3364+ if (!data || !comp_response || !comp_response_code )
3365+ return - EINVAL ;
3366+
3367+ cmd = & desc .params .pass_comp_tbl ;
3368+
3369+ ixgbe_fill_dflt_direct_cmd_desc (& desc ,
3370+ ixgbe_aci_opc_nvm_pass_component_tbl );
3371+ desc .flags |= cpu_to_le16 (IXGBE_ACI_FLAG_RD );
3372+
3373+ cmd -> transfer_flag = transfer_flag ;
3374+ err = ixgbe_aci_send_cmd (hw , & desc , data , length );
3375+ if (!err ) {
3376+ * comp_response = cmd -> component_response ;
3377+ * comp_response_code = cmd -> component_response_code ;
3378+ }
3379+
3380+ return err ;
3381+ }
3382+
31743383/**
31753384 * ixgbe_read_sr_word_aci - Reads Shadow RAM via ACI
31763385 * @hw: pointer to the HW structure
0 commit comments