Firmware mode switching method and apparatus, electronic device, and storage medium
The set feature of the custom nonvolatile memory expansion protocol realizes a dual-mode firmware switching switch, which solves the problems of high hardware costs and cumbersome switching processes caused by the different firmware modes of standard SSD and ZNS SSD, and realizes online switching of firmware mode in the client room, reducing labor costs, and improving switching efficiency and compatibility.
Patent Information
- Application Number
- PCT/CN2024/095266
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-05
- Filing Date
- 2024-05-24
- Publication Date
- 2025-08-14
AI Technical Summary
In the prior art, the firmware modes of standard SSDs and ZNS SSDs are different, resulting in high hardware costs, and the existing firmware switching process is cumbersome, time-consuming, and requires a lot of manpower to participate.
The set feature of the custom nonvolatile memory expansion protocol realizes a dual-mode firmware switching switch. After the firmware switching check is passed, the firmware in the first mode is written to the nonvolatile storage medium, the reset operation is performed and the firmware in the first mode is loaded, and the firmware in the first mode is initialized.
It realizes that without replacing hardware, reduces labor costs, simplifies the firmware mode switching process, improves switching efficiency, and is compatible with different server platform systems.
Smart Images

Figure CN2024095266_14082025_PF_FP_ABST
Abstract
Description
Firmware mode switching method, device, electronic device and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on February 5, 2024, with application number 202410162162.9 and application name “Firmware mode switching method, device, electronic device and storage medium”, all contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of computer technology, and in particular to a firmware mode switching method, device, electronic device, and storage medium. Background Art
[0004] With the development of information technology, people's demand for data generation and acquisition is increasing. Traditional mechanical hard disk drives (HDDs) can no longer meet the speed requirements for data storage and retrieval. Solid-state drives (SSDs) are increasingly being used. Zoned Namespaces (ZNS) SSDs, a solution based on the Non-Volatile Memory Express (NVME) protocol, offer better performance, more flexible capacity adjustment, and lower energy consumption compared to traditional SSDs. They are suitable for storage scenarios requiring high performance, high reliability, and scalability.
[0005] Current business requirements for SSDs are diverse, with both standard and ZNS SSDs required. However, due to differences in block metadata organization between standard and ZNS SSDs, the SSD firmware requirements are completely different. As business grows, demand for these two types of SSDs will likely increase or decrease. Therefore, to save hardware costs, it is desirable to use the same hardware for ZNS and standard SSDs, with firmware upgrades that can be switched between them. This means that existing SSDs can be switched between different modes based on business needs without purchasing new SSDs.
[0006] Summary of the Invention
[0007] In one aspect, the present application provides a firmware mode switching method, comprising:
[0008] The target solid-state drive receives a firmware activation command sent by the host, where the firmware activation command is used to instruct the target solid-state drive to write the firmware in the first mode into the non-volatile storage medium corresponding to the target slot;
[0009] The target solid-state drive determines whether the first mode is consistent with a current firmware mode of the target solid-state drive, performs a firmware switching check according to the firmware activation command in response to whether the first mode is inconsistent with the current firmware mode of the target solid-state drive, and writes the firmware of the first mode into the non-volatile storage medium corresponding to the target slot after the firmware switching check passes;
[0010] The target solid-state drive performs a reset operation and loads the firmware of the first mode; and
[0011] The target solid-state drive initializes the first-mode firmware.
[0012] According to a firmware mode switching method provided in the present application, the first mode is the standard disk mode, and the current firmware mode of the target solid-state hard disk is the partition namespace mode, or the first mode is the partition namespace mode, and the current firmware mode of the target solid-state hard disk is the standard disk mode.
[0013] According to a firmware mode switching method provided by the present application, the firmware activation command carries information of the slot to be replaced and a firmware validation method.
[0014] According to a firmware mode switching method provided by the present application, a firmware switching check is performed according to a firmware activation command, including:
[0015] Check whether the dual-mode firmware switch is turned on;
[0016] Checking the configuration content of the firmware of the first mode; and
[0017] Check whether the slot to be replaced in the firmware activation command is the target slot and whether the firmware activation method specified in the firmware activation command is controller reset.
[0018] According to a firmware mode switching method provided by the present application, after writing the firmware of the first mode into the non-volatile storage medium corresponding to the target slot, the method further includes:
[0019] Erasing part of the metadata in the non-volatile storage medium, recording the location information of the target slot, and setting the firmware switching flag in the non-volatile storage medium to a first preset value;
[0020] Part of the metadata is metadata that is different between metadata corresponding to the firmware in the first mode and metadata corresponding to the firmware in the original mode of the target solid-state drive.
[0021] According to a firmware mode switching method provided by the present application, a target solid-state drive performs a reset operation, including:
[0022] The target solid-state hard drive receives a subsystem reset instruction sent by the host, determines whether the firmware switch flag in the non-volatile storage medium is a first preset value, and in response to the firmware switch flag in the non-volatile storage medium being the first preset value, resets the controller of the target solid-state hard drive, and in response to the firmware switch flag in the non-volatile storage medium not being the first preset value, executes the subsystem reset process.
[0023] According to a firmware mode switching method provided by the present application, initializing the firmware of the first mode includes:
[0024] Determining whether a firmware switching flag in the non-volatile storage medium is a first preset value, in response to determining that the firmware switching flag in the non-volatile storage medium is the first preset value, performing the following steps:
[0025] Re-establishing the program-erase table of the firmware of the first mode according to the original program-erase table, inheriting the original bad block table; and
[0026] The power-on state is changed to the first power-on state. After all hardware units are successfully initialized, the firmware switching flag in the non-volatile storage medium is updated to a second preset value.
[0027] According to a firmware mode switching method provided by the present application, after the step of initializing the firmware of the first mode, the method further includes:
[0028] The target solid-state drive receives a non-volatile memory extension driver loading instruction sent by the host;
[0029] In response to the load non-volatile memory expansion driver instruction, the target solid-state drive loads the non-volatile memory expansion driver.
[0030] According to a firmware mode switching method provided by the present application, the target slot is slot 1.
[0031] According to a firmware mode switching method provided by the present application, the non-volatile storage medium is a Nor Flash.
[0032] According to a firmware mode switching method provided by the present application, a dual-mode firmware switching switch is implemented by customizing a set feature of a non-volatile memory extension protocol.
[0033] According to a firmware mode switching method provided by the present application, the method further includes:
[0034] Set the Dual Mode Firmware toggle switch to On; and
[0035] Use the target slot as the slot for dual-mode firmware switching.
[0036] According to a firmware mode switching method provided by the present application, a first mode is determined according to the current firmware mode of the target solid-state drive, and the firmware of the first mode is downloaded to the memory of the target solid-state drive through the host.
[0037] According to a firmware mode switching method provided by the present application, the step of setting the state of the dual-mode firmware switching switch to on includes:
[0038] Set the value of set feature to 1 to turn on the dual-mode firmware switch.
[0039] According to a firmware mode switching method provided by the present application, slot 1 is a read-only slot.
[0040] According to a firmware mode switching method provided by the present application, the slot information to be replaced is the slot targeted by this dual-mode firmware switching, and the firmware validation mode is the validation mode after the firmware switching.
[0041] On the other hand, the present application also provides a firmware mode switching device, comprising:
[0042] a receiving unit, configured to receive a firmware activation command sent by a host, wherein the firmware activation command is used to instruct the target solid-state drive to write the firmware in the first mode into the non-volatile storage medium corresponding to the target slot;
[0043] a firmware writing unit, configured to determine whether the first mode is consistent with a current firmware mode of the target solid-state drive, and in response to the first mode being inconsistent with the current firmware mode of the target solid-state drive, perform a firmware switching check according to the firmware activation command, and write the firmware of the first mode into the non-volatile storage medium corresponding to the target slot after the firmware switching check passes;
[0044] a reset unit, configured to perform a reset operation and load the firmware of the first mode; and
[0045] The initialization unit is used to initialize the firmware of the first mode.
[0046] The present application also provides an electronic device, comprising one or more processors; and a memory associated with the one or more processors, the memory being used to store computer-readable instructions, which, when read and executed by the one or more processors, implement any of the firmware mode switching methods described above.
[0047] On the other hand, the present application also provides a non-transitory computer-readable storage medium having computer-readable instructions stored thereon. When the computer-readable instructions are executed by one or more processors, the firmware mode switching method described above is implemented.
[0048] On the other hand, the present application further provides a computer program product, comprising computer-readable instructions, which implement any of the above-mentioned firmware mode switching methods when executed by one or more processors.
[0049] The firmware mode switching method, device, electronic device and storage medium provided in the present application perform a firmware switching check by receiving a firmware activation command sent by a host, and after the firmware switching check passes, write the firmware of the first mode into the non-volatile storage medium corresponding to the target slot; perform a reset operation and load the firmware of the first mode; and initialize the firmware of the first mode. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0051] FIG1 is a schematic diagram of a flow chart of a firmware mode switching method provided in an embodiment of the present application;
[0052] FIG2 is a schematic diagram of a process of updating new firmware in a firmware mode switching method provided in an embodiment of the present application;
[0053] FIG3 is a schematic diagram of a process after reloading new firmware in the firmware mode switching method provided in an embodiment of the present application;
[0054] FIG4 is a logic diagram of a firmware switching function provided in an embodiment of the present application;
[0055] FIG5 is a schematic structural diagram of a firmware mode switching device provided in an embodiment of the present application;
[0056] FIG6 is a schematic diagram of the physical structure of an electronic device provided in an embodiment of the present application;
[0057] FIG7 is a schematic diagram of the structure of a non-transitory computer-readable storage medium provided in an embodiment of the present application;
[0058] FIG8 is a schematic diagram of the structure of a computer program product provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] To make the objectives, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.
[0060] With the development of information technology, the demand for data generation and acquisition is increasing. Traditional mechanical hard disks (HDDs) can no longer meet the speed requirements for data storage and retrieval. SSDs are increasingly used. ZNS (Zoned Namespaces) SSD, a solution based on the non-volatile memory extension protocol, offers advantages over traditional SSDs, such as better performance, more flexible capacity adjustment, and lower energy consumption. It is suitable for storage scenarios requiring high performance, high reliability, and scalability.
[0061] Current business requirements for SSDs are diverse, with both standard and ZNS SSDs required. However, due to differences in block metadata organization between standard and partition namespace modes, the SSD firmware requirements are completely different. As business grows, demand for these two types of SSDs will likely increase or decrease. Therefore, to save hardware costs, it is desirable to use the same hardware for ZNS and standard SSDs, allowing for firmware upgrades to be switched between them. This means that existing SSDs can be switched between different modes based on business needs without purchasing new SSDs.
[0062] The relevant technology involves contacting the SSD manufacturer when a firmware mode switch is required and returning the SSDs to their warehouse. The SSD manufacturer then ships these drives to its own production facility, where they are re-flashed with new firmware and undergo systematic factory security testing. Once these drives pass the tests, they are shipped to customers. Customers are then required to arrange for personnel to re-adapt these drives to their business. This entire process is cumbersome and time-consuming, requiring the involvement of numerous technical personnel and involving significant business interaction between the SSD manufacturer and the customer, resulting in significant time and labor costs.
[0063] The online upgrade solution for the standard non-volatile memory expansion protocol is as follows: download the new firmware to the SSD memory; activate the new firmware through the firmware activation command; reset the SSD controller through the subsystem reset method, load the new firmware, and complete the mode switch.
[0064] This application is implemented through a customized firmware processing flow based on the above-mentioned online upgrade solution.
[0065] The following describes the firmware mode switching method, device, electronic device and storage medium of the present application in conjunction with Figures 1 to 6.
[0066] FIG1 is a flow chart of a firmware mode switching method provided by an embodiment of the present application. As shown in FIG1 , the method includes the following steps: step 110, step 120, step 130, and step 140. The method flow steps are a possible implementation of the present application. The method includes:
[0067] Step 110: The target solid-state drive receives a firmware activation command sent by the host, where the firmware activation command is used to instruct the target solid-state drive to write the firmware in the first mode into the non-volatile storage medium corresponding to the target slot;
[0068] In order to reduce the manpower and time costs of customers and SSD manufacturers, the solution of this application is implemented based on the standard non-volatile memory expansion protocol online upgrade command plus custom commands. Since it is based on the standard non-volatile memory expansion protocol, it can achieve compatibility with different platforms and systems.
[0069] First, select a set feature of the non-volatile memory expansion protocol, customize the feature ID (Identity document) of the field, and use the custom feature as a dual-mode firmware switch.
[0070] The dual-mode firmware switch is implemented by customizing a set feature of the non-volatile memory extension protocol. By customizing a set feature of the non-volatile memory extension protocol as the dual-mode firmware switch, when the dual-mode firmware switch is turned on, it indicates that the target SSD is capable of dual-mode firmware switching.
[0071] By customizing a set feature of a non-volatile memory extension protocol to implement a dual-mode firmware switch, it is possible to ensure that SSDs on different platforms and systems implement the solution of this application, with good compatibility.
[0072] The set feature command can be used to specify the properties of the indicated Feature.
[0073] In some embodiments, after selecting a set feature of a non-volatile memory extension protocol as a dual-mode firmware switch, the method further includes:
[0074] Set the Dual Mode Firmware toggle switch to On;
[0075] Use the target slot as the slot for dual-mode firmware switching.
[0076] In one or more embodiments, the value of the customized feature is set to 1, indicating that the dual-mode firmware switch is turned on; and is set to 0, indicating that the dual-mode firmware switch is turned off.
[0077] It should be noted that this custom feature is set to be disabled when power is off. That is, when the feature is set to 1 and the SSD is powered off, the value of the feature will be 0 when it is powered on again.
[0078] When the dual-mode firmware switching switch is turned on, select the target slot as the slot for dual-mode firmware switching.
[0079] In some embodiments, the target slot is slot 1.
[0080] Since the standard non-volatile memory expansion protocol supports multiple slots, slot 1 corresponds to the factory firmware of the solid-state drive. Therefore, in order to achieve dual-mode firmware switching, slot 1 needs to be operated.
[0081] In the standard non-volatile memory expansion protocol, slot 1 is a read-only slot. This application reuses the standard non-volatile memory expansion protocol. Slot 1 can only switch to dual-mode firmware when the dual-mode firmware switch is turned on. Otherwise, a read-only attribute error is returned for slot 1.
[0082] After performing the above operations, the host downloads the first mode firmware to the memory of the target solid-state drive. In other words, the first mode firmware is downloaded by the host to the memory of the target solid-state drive, and in one or more embodiments, is downloaded to the DDR (Double Data Rate) memory of the target solid-state drive.
[0083] Then, the host sends a firmware activation command to the target solid-state drive, in order to write the firmware of the first mode into the non-volatile storage medium corresponding to the target slot.
[0084] It should be noted that when the host is downloading the firmware, the SSD only checks whether the firmware length exceeds the limit and does not check other items.
[0085] The target solid-state drive receives a firmware activation command sent by the host, where the firmware activation command is used to instruct the target solid-state drive to write the firmware in the first mode into the non-volatile storage medium corresponding to the target slot.
[0086] The first mode is determined according to a current firmware mode of the target solid state drive, and the first mode is different from the current firmware mode of the target solid state drive.
[0087] In some embodiments, the first mode is the standard disk mode, and the current firmware mode of the target solid-state drive is the partition namespace mode. That is, the dual-mode firmware switching in this application refers to switching the firmware mode of the target solid-state drive from the partition namespace mode to the standard disk mode.
[0088] In other embodiments, the first mode is the partition namespace mode, and the current firmware mode of the target solid-state drive is the standard disk mode. That is, the dual-mode firmware switching in this application refers to switching the firmware mode of the target solid-state drive from the standard disk mode to the partition namespace mode.
[0089] Among them, standard disk mode means that the firmware of the SSD produced by the solid-state drive manufacturer is standard firmware, adopts standardized software design, follows the non-volatile memory expansion protocol, and complies with industry standards and specifications.
[0090] The ZNS SSD represents a new functional division between host software and the SSD. The ZNS SSD divides its capacity into spatial zones, each of which can be read in any order but written sequentially. These features allow the ZNS SSD to improve its internal data placement, resulting in better performance.
[0091] Compared with standard SSDs, ZNS SSDs have the following advantages:
[0092] 1) Sequential write performance optimization: ZNS SSD uses sequential write mode, which can significantly reduce the write amplification of the entire disk and increase the service life of the SSD.
[0093] 2) Better compatibility: ZNS SSD can adjust capacity without rebuilding the disk, reducing compatibility issues that may occur during the adjustment process.
[0094] 3) Faster read and write speeds: Since the ZNS SSD has a smaller mapping table and less DRAM (Dynamic Random Access Memory) cache, it can significantly improve read and write speeds while reducing latency.
[0095] 4) Lower energy consumption: Since ZNS SSD adopts a special storage management mechanism, it can reduce the number of disk activities and thus reduce energy consumption.
[0096] 5) More flexible capacity adjustment: ZNS SSD can adjust capacity without reconstructing the disk, making capacity expansion more flexible and convenient.
[0097] In some embodiments, the firmware activation command carries information about the slot to be replaced and a firmware activation method.
[0098] The slot to be replaced information refers to the slot targeted by the current dual-mode firmware switch.
[0099] The firmware activation mode refers to the activation mode after the firmware is switched.
[0100] In an embodiment of the present application, the target solid-state drive can switch the firmware mode on the basis of sharing the same set of hardware by receiving a firmware activation command sent by the host.
[0101] Step 120: The target solid-state drive determines whether the first mode is consistent with the current firmware mode of the target solid-state drive. In response to the first mode being inconsistent with the current firmware mode of the target solid-state drive, a firmware switching check is performed according to the firmware activation command. After the firmware switching check passes, the firmware of the first mode is written into the non-volatile storage medium corresponding to the target slot.
[0102] It can be understood that after the target solid-state drive receives the firmware activation command, it determines whether the first mode is consistent with the current firmware mode of the target solid-state drive. In response to the inconsistency between the first mode and the current firmware mode of the target solid-state drive, it indicates that firmware switching is required. The firmware switching check is performed based on the slot information to be replaced and the firmware effectiveness method carried by the firmware activation command.
[0103] In response to the first mode being consistent with the current firmware mode of the target solid-state drive, it indicates that no firmware switching is required, and the process ends.
[0104] After the target solid-state drive receives the firmware activation command, it determines whether the first mode is consistent with the current firmware mode of the target solid-state drive. After determining that the first mode is inconsistent with the current firmware mode of the target solid-state drive, the firmware switching check operation is performed, thereby avoiding unnecessary firmware switching operations.
[0105] In some embodiments, performing a firmware switching check according to a firmware activation command includes:
[0106] Check whether the dual-mode firmware switch is turned on;
[0107] Checking the configuration content of the firmware of the first mode;
[0108] Check whether the slot to be replaced in the firmware activation command is the target slot and whether the firmware activation method specified in the firmware activation command is controller reset.
[0109] In one or more embodiments, it is first checked whether the dual-mode firmware switch is turned on, and subsequent operations are performed only when the dual-mode firmware switch is turned on.
[0110] Checking the configuration content of the firmware in the first mode includes: checking whether the device ID and vendor ID are as expected; checking whether the firmware encryption key matches; checking the capacity, etc.
[0111] Check whether the slot to be replaced in the firmware activation command is the target slot, that is, slot 1.
[0112] Check whether the firmware takes effect by resetting the controller.
[0113] After the firmware switching check is passed, the firmware of the first mode is written into the non-volatile storage medium corresponding to the target slot, that is, the firmware of the first mode is updated to the slot 1 position of the non-volatile storage medium.
[0114] In the embodiment of the present application, after the firmware switching check is passed, the firmware of the first mode is updated to the slot 1 position of the non-volatile storage medium, which can ensure that the subsequent firmware step switching is smoothly executed and improve the firmware switching efficiency.
[0115] In some embodiments, the non-volatile storage medium is Nor Flash. Nor Flash has slow read and write speeds but good stability.
[0116] In some embodiments, after writing the firmware in the first mode into the non-volatile storage medium corresponding to the target slot, the method further includes:
[0117] Erasing part of the metadata in the non-volatile storage medium, recording the location information of the target slot, and setting the firmware switching flag in the non-volatile storage medium to a first preset value;
[0118] Part of the metadata is metadata that is different between the metadata corresponding to the firmware in the first mode and the metadata corresponding to the firmware in the original mode of the target solid-state drive.
[0119] It should be noted that after the firmware of the first mode is written into the non-volatile storage medium corresponding to the target slot, the SSD is powered on and the firmware will generate metadata corresponding to the firmware of the first mode. Since the current firmware modes of the first mode and the target solid-state drive are different, the metadata generated by the two are also different. There is some differentiated data between the two. In the embodiment of the present application, this part of the differentiated data is called partial metadata.
[0120] This metadata needs to be erased and restored to the default initialization state. This is due to the characteristics of the non-volatile storage medium Nor flash. The corresponding data needs to be erased before writing new data.
[0121] The purpose of recording the location information of the target slot is to read the firmware content through the location recorded in the metadata slot in the non-volatile storage medium after the controller of the target solid-state drive is reset.
[0122] After reading the firmware content, the firmware switch flag in the non-volatile storage medium is set to a first preset value, where the first preset value is used to indicate whether to directly reset the SSD controller. In one or more embodiments, in response to determining that the firmware switch flag in the non-volatile storage medium is 1, the controller of the target solid-state drive is directly reset. In response to determining that the firmware switch flag in the non-volatile storage medium is 0, a normal subsystem reset process is executed, and the subsystem reset instruction is sent by the host to reset the controller of the target solid-state drive.
[0123] Figure 2 is a flow chart of updating new firmware in the firmware mode switching method provided in an embodiment of the present application. Updating new firmware means writing the firmware of the first mode into the non-volatile storage medium corresponding to the target slot.
[0124] As shown in Figure 2, the process of updating the new firmware includes the following steps:
[0125] Custom feature as dual-mode firmware switch;
[0126] The dual-mode firmware switch feature value is 1, and the host downloads the first-mode firmware to the target SSD's memory;
[0127] The host sends a firmware activation command to the target SDD, where the firmware activation command is used to instruct the target SDD to store the first mode firmware in the memory of the target SDD into the non-volatile storage medium Nor flash in slot 1;
[0128] After receiving the firmware activation command, the target SSD performs the following steps:
[0129] Check whether the dual-mode firmware switch is turned on, check the configuration of the first-mode firmware (including checking whether the device identification and vendor ID are as expected and whether the firmware encryption key matches), check whether the slot to be replaced in the firmware activation command is slot 1, and whether the firmware activation method is to reset the controller. After the check is complete, write the first-mode firmware to the Nor flash of slot 1;
[0130] Erase the metadata that differs between the first-mode firmware in the Nor flash and the initial firmware of the target solid-state drive, restore the different metadata to the default initialization state, update the activation slot value of the firmware in the metadata to 1, and set the value of the firmware switch flag (fw_switch_flag) in the Nor flash to 1. The new firmware is then successfully updated.
[0131] In an embodiment of the present application, after the target solid-state hard drive receives the firmware activation command, it performs a firmware switching check, and after the firmware switching check passes, the firmware of the first mode is written into the non-volatile storage medium corresponding to the target slot, which can improve the stability of the firmware update and realize the firmware update.
[0132] Step 130: The target solid-state drive performs a reset operation and loads the firmware of the first mode;
[0133] In some embodiments, the target solid-state drive performs a reset operation, including:
[0134] The target solid-state drive receives a subsystem reset instruction sent by the host, determines whether the firmware switch flag in the non-volatile storage medium is a first preset value, and in response to determining that the firmware switch flag in the non-volatile storage medium is the first preset value, resets the controller of the target solid-state drive; and in response to determining that the firmware switch flag in the non-volatile storage medium is not the first preset value, executes a normal subsystem reset process.
[0135] It can be understood that the target solid-state hard drive writes the firmware of the first mode to the non-volatile storage medium of the target solid-state hard drive, erases part of the metadata in the non-volatile storage medium, records the location information of the target slot, sets the firmware switch flag in the non-volatile storage medium to the first preset value, and then the host sends a subsystem reset instruction to the target solid-state hard drive. The target solid-state hard drive receives the subsystem reset instruction sent by the host and resets the target solid-state hard drive. There are two ways to reset the target solid-state hard drive, one is to reset the controller of the target solid-state hard drive, and the other is to execute a normal subsystem reset process to reset the controller of the target solid-state hard drive through the subsystem reset process. After the controller of the target solid-state hard drive is reset, the firmware of the first mode is loaded.
[0136] In an embodiment of the present application, the target solid-state drive performs a reset operation and loads the firmware of the first mode, thereby realizing online switching of the firmware mode.
[0137] Step 140: The target solid-state drive initializes the firmware of the first mode.
[0138] The target solid-state drive loads the first-mode firmware and initializes the first-mode firmware.
[0139] In some embodiments, initializing the firmware of the first mode includes:
[0140] Determining whether a firmware switching flag in the non-volatile storage medium is a first preset value, in response to determining that the firmware switching flag in the non-volatile storage medium is the first preset value, performing the following steps:
[0141] Re-establishing the programming and erasure table of the firmware of the first mode according to the original programming and erasure table, inheriting the original bad block table;
[0142] The power-on state is changed to the first power-on state. After all hardware units are successfully initialized, the firmware switching flag in the non-volatile storage medium is updated to a second preset value.
[0143] In one or more embodiments, the firmware switching flag in the non-volatile storage medium is updated to 0. It should be noted that after the target solid-state drive is powered on, all data on the NAND flash will be erased because the SSD firmware mode has been changed to the first mode, so the data on the NAND flash must be forcibly erased.
[0144] The original Program Erase (PE) table refers to the erase count table of the NAND flash particles in the target solid-state drive.
[0145] In an embodiment of the present application, by loading the first mode firmware on the target solid-state drive and initializing the first mode firmware, the SSD can be avoided from being returned to the factory, and the switching can be completed in the customer's computer room, which can reduce manual participation and save labor costs; the customer can switch the SSD firmware from standard disk mode to partition namespace mode or from partition namespace mode to standard disk mode without restarting the server or manually plugging in the SSD, and the present application adopts a standard non-volatile memory extension protocol, which can be compatible with different server platform systems.
[0146] In some embodiments, the method further comprises:
[0147] After the firmware initialization of the first mode is completed, the target solid-state drive receives a non-volatile memory expansion driver loading instruction sent by the host;
[0148] In response to the load non-volatile memory expansion driver instruction, the target solid-state drive loads the non-volatile memory expansion driver.
[0149] After the new firmware is initialized, the host will issue a command to load the non-volatile memory expansion driver. After the SSD loads the driver, the host will be able to recognize the SSD, indicating that the firmware mode switch is successful;
[0150] It should be noted that during the entire firmware switching process, the target SSD cannot be powered off, otherwise it may cause the target SSD to not recognize the disk and need to be returned to the SSD manufacturer for factory processing.
[0151] FIG3 is a flow chart of the firmware mode switching method provided in an embodiment of the present application after the new firmware is reloaded. As shown in FIG3 , the new firmware reload includes the following steps:
[0152] After the controller of the target solid-state drive is reset and the firmware of the first mode is loaded, it is determined whether the firmware switching flag in the Nor flash is 1. In response to determining that the firmware switching flag in the Nor flash is 1, the following steps are performed:
[0153] Re-establish the new firmware's programming and erasure table based on the original programming and erasure table, inheriting the original bad block table;
[0154] Change the power-on status to first power-on. After all hardware units are successfully initialized, change the firmware switch flag in the NOR flash to 0.
[0155] After the firmware initialization of the first mode is completed, the host sends a command to load the non-volatile memory extension driver, and the target solid-state drive loads the driver.
[0156] Figure 4 is a logic diagram of the firmware switching function provided by an embodiment of the present application. As shown in Figure 4, the host downloads the first mode firmware to the DDR of the SSD, and the SSD writes the first mode firmware to slot 1. The host controls the SSD controller to reset.
[0157] In another embodiment of the present application, the firmware mode switching method includes the following steps:
[0158] Select a non-volatile memory extension protocol set feature, customize the feature ID of the field, and use the customized feature as a dual-mode firmware switch;
[0159] When the dual-mode firmware switch is turned on, slot 1 is selected as the slot for dual-mode firmware switching;
[0160] The host downloads the first mode firmware to the memory of the target solid state drive;
[0161] The host sends a firmware activation command to the target SDD, where the firmware activation command is used to instruct the target SDD to store the first mode firmware in the memory of the target SDD into the non-volatile storage medium Nor flash in slot 1;
[0162] After receiving the firmware activation command, the target SSD performs the following steps:
[0163] Check whether the dual-mode firmware switch is turned on, check the configuration of the first-mode firmware, check whether the slot to be replaced in the firmware activation command is slot 1, and whether the firmware takes effect by resetting the controller. After the check is complete, write the first-mode firmware to the Nor flash of slot 1.
[0164] Erases the metadata that differs between the first-mode firmware in the Nor flash and the initial firmware of the target solid-state drive, restores the metadata to the default initialization state, updates the firmware activation slot value in the metadata to 1, and sets the firmware switch flag value in the Nor flash to 1;
[0165] The host sends a subsystem reset command. After receiving the subsystem reset command, the target solid-state drive determines whether the firmware switch flag in the Nor flash is 1. In response to determining that the firmware switch flag in the Nor flash is 1, the controller of the target solid-state drive is reset. In response to determining that the firmware switch flag in the Nor flash is not 1, the normal subsystem reset process is executed.
[0166] After the controller of the target solid-state drive is reset and the firmware of the first mode is loaded, it is determined whether the firmware switching flag in the Nor flash is 1. In response to determining that the firmware switching flag in the Nor flash is 1, the following steps are performed:
[0167] Re-establish the new firmware's programming and erasure table based on the original programming and erasure table, inheriting the original bad block table;
[0168] Change the power-on status to first power-on. After all hardware units are successfully initialized, change the firmware switch flag in the NOR flash to 0.
[0169] After the firmware initialization of the first mode is completed, the host sends a command to load the non-volatile memory extension driver, and the target solid-state drive loads the driver.
[0170] The firmware mode switching method provided in the embodiment of the present application receives a firmware activation command sent by the host, performs a firmware switching check, and after the firmware switching check is passed, writes the firmware of the first mode to the non-volatile storage medium corresponding to the target slot; performs a reset operation, and loads the firmware of the first mode; initializes the firmware of the first mode, which can realize online switching of the firmware mode of the SSD, avoid returning the SSD to the factory, and realize online switching of the firmware mode in the customer's computer room, so that the customer can realize the switching of the SSD firmware from the standard disk mode to the partition namespace mode or from the partition namespace mode to the standard disk mode without restarting the server or manually plugging and unplugging the SSD, which can reduce manual participation and save labor costs. In addition, the present application adopts a standard non-volatile memory extension protocol and is compatible with different server platform systems.
[0171] It should be noted that each implementation method of the present application can be freely combined, the order can be changed, or it can be executed separately, and does not need to rely on or depend on a fixed execution order.
[0172] The firmware mode switching device provided in the present application is described below. The firmware mode switching device described below and the firmware mode switching method described above can refer to each other.
[0173] FIG5 is a schematic diagram of the structure of the firmware mode switching device provided in an embodiment of the present application. As shown in FIG5 , the firmware mode switching device includes:
[0174] The receiving unit 510 is configured to receive a firmware activation command sent by the host, where the firmware activation command is configured to instruct the target solid-state drive to write the firmware in the first mode into the non-volatile storage medium corresponding to the target slot;
[0175] a firmware writing unit 520 configured to determine whether the first mode is consistent with the current firmware mode of the target solid-state drive, and in response to the first mode being inconsistent with the current firmware mode of the target solid-state drive, perform a firmware switching check according to the firmware activation command, and write the firmware of the first mode into the non-volatile storage medium corresponding to the target slot after the firmware switching check passes;
[0176] A reset unit 530, configured to perform a reset operation and load the firmware of the first mode;
[0177] The initialization unit 540 is configured to initialize the firmware of the first mode.
[0178] In some embodiments, the first mode is the standard disk mode, and the current firmware mode of the target solid state drive is the partition namespace mode, or the first mode is the partition namespace mode, and the current firmware mode of the target solid state drive is the standard disk mode.
[0179] In some embodiments, the firmware activation command carries information about the slot to be replaced and a firmware activation method.
[0180] In some embodiments, a firmware switching check is performed according to a firmware activation command, including: checking whether the dual-mode firmware switching switch is turned on; checking the configuration content of the firmware of the first mode; checking whether the slot information to be replaced in the firmware activation command is the target slot, and whether the firmware effectiveness method specified in the firmware activation command is to reset the controller.
[0181] In some embodiments, a first processing unit is further included, which is used to: erase part of the metadata in the non-volatile storage medium, record the location information of the target slot, and set the firmware switch flag in the non-volatile storage medium to a first preset value; wherein, the part of the metadata is metadata that is different between the metadata corresponding to the firmware of the first mode and the metadata corresponding to the firmware of the original mode of the target solid-state drive.
[0182] In some embodiments, performing a reset operation includes: receiving a subsystem reset instruction sent by a host, determining whether a firmware switch flag in a non-volatile storage medium is a first preset value, resetting a controller of a target solid-state drive in response to determining that the firmware switch flag in the non-volatile storage medium is the first preset value, and performing a normal subsystem reset process in response to determining that the firmware switch flag in the non-volatile storage medium is not the first preset value.
[0183] In some embodiments, initializing the firmware of the first mode includes:
[0184] Determining whether a firmware switching flag in the non-volatile storage medium is a first preset value, in response to determining that the firmware switching flag in the non-volatile storage medium is the first preset value, performing the following steps:
[0185] The programming and erasure table of the firmware of the first mode is re-established according to the original programming and erasure table, and the original bad block table is inherited; the power-on state is changed to the first power-on, and after the power-on initialization of all hardware units is successful, the firmware switching flag in the non-volatile storage medium is updated to the second preset value.
[0186] In some embodiments, a driving loading unit is further included for:
[0187] A non-volatile memory extension driver loading instruction sent by a host is received; and in response to the non-volatile memory extension driver loading instruction, the non-volatile memory extension driver is loaded.
[0188] In some embodiments, the target slot is slot 1.
[0189] In some embodiments, the non-volatile storage medium is Nor Flash.
[0190] In some embodiments, the dual-mode firmware switch is implemented by customizing a set feature of a non-volatile memory extension protocol.
[0191] In some embodiments, the system further includes a second processing unit configured to:
[0192] Set the dual-mode firmware switch to on; set the target slot as the slot for dual-mode firmware switching.
[0193] In some embodiments, the first mode firmware is downloaded by the host to the memory of the target solid state drive.
[0194] It should be noted here that the firmware mode switching device provided in the embodiment of the present application can implement all the method steps implemented in the above-mentioned firmware mode switching method embodiment, and can achieve the same technical effects. The parts and beneficial effects of this embodiment that are the same as those in the method embodiment will not be repeated here.
[0195] FIG6 illustrates a schematic diagram of the physical structure of an electronic device. As shown in FIG6 , the electronic device may include: one or more processors 610, a communication interface 620, a memory 630 associated with the one or more processors 610, and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other via the communication bus 640. The processor 610 may call logic instructions in the memory 630 to execute a firmware mode switching method, the method comprising: receiving a firmware activation command sent by a host, the firmware activation command being used to instruct a target solid-state drive to write a first mode of firmware into a non-volatile storage medium corresponding to a target slot; determining whether the first mode is consistent with the current firmware mode of the target solid-state drive, and in response to the first mode being inconsistent with the current firmware mode of the target solid-state drive, performing a firmware switching check according to the firmware activation command, and writing the first mode of firmware into the non-volatile storage medium corresponding to the target slot after the firmware switching check passes; performing a reset operation and loading the first mode of firmware; and initializing the first mode of firmware.
[0196] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0197] On the other hand, as shown in Figure 8, the present application also provides a computer program product, which includes computer-readable instructions, which can be stored on a non-transitory computer-readable storage medium. When the computer-readable instructions are executed by one or more processors, the computer can execute the firmware mode switching method provided by the above methods, which includes: receiving a firmware activation command sent by the host, the firmware activation command is used to instruct the target solid-state hard disk to write the firmware of the first mode into the non-volatile storage medium corresponding to the target slot; judging whether the first mode is consistent with the current firmware mode of the target solid-state hard disk, in response to the first mode being inconsistent with the current firmware mode of the target solid-state hard disk, performing a firmware switching check according to the firmware activation command, and after the firmware switching check passes, writing the firmware of the first mode into the non-volatile storage medium corresponding to the target slot; performing a reset operation, and loading the firmware of the first mode; initializing the firmware of the first mode.
[0198] On the other hand, as shown in Figure 7, the present application also provides a non-transitory computer-readable storage medium having computer-readable instructions stored thereon, which are implemented by one or more processors to execute the firmware mode switching method provided by the above methods, the method including: receiving a firmware activation command sent by the host, the firmware activation command being used to instruct the target solid-state hard disk to write the firmware of the first mode into the non-volatile storage medium corresponding to the target slot; determining whether the first mode is consistent with the current firmware mode of the target solid-state hard disk, and in response to the first mode being inconsistent with the current firmware mode of the target solid-state hard disk, performing a firmware switching check according to the firmware activation command, and after the firmware switching check passes, writing the firmware of the first mode into the non-volatile storage medium corresponding to the target slot; performing a reset operation, and loading the firmware of the first mode; and initializing the firmware of the first mode.
[0199] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units. That is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0200] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0201] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A firmware mode switching method, characterized in that: include: The target solid-state drive receives a firmware activation command sent by the host, wherein the firmware activation command is used to instruct the target solid-state drive to write the firmware of the first mode into the non-volatile storage medium corresponding to the target slot; The target solid-state drive determines whether the first mode is consistent with the current firmware mode of the target solid-state drive, In response to the first mode being inconsistent with a current firmware mode in the target solid-state drive, performing a firmware switching check according to the firmware activation command, and writing the firmware of the first mode into the non-volatile storage medium corresponding to the target slot after the firmware switching check passes; The target solid-state drive performs a reset operation and loads the firmware of the first mode; and The target solid-state drive initializes the firmware of the first mode.
2. The firmware mode switching method according to claim 1, wherein: The first mode is the standard disk mode, and the current firmware mode of the target solid-state drive is the partition namespace mode; or The first mode is a partition namespace mode, and the current firmware mode of the target solid-state drive is a standard disk mode.
3. The firmware mode switching method according to claim 1, wherein: The firmware activation command carries the information of the slot to be replaced and the firmware activation mode.
4. The firmware mode switching method according to claim 3, wherein: The performing the firmware switching check according to the firmware activation command includes: Check whether the dual-mode firmware switch is turned on; Checking the configuration content of the firmware of the first mode; and Check whether the slot to be replaced in the firmware activation command is the target slot, and whether the firmware validation mode specified in the firmware activation command is resetting the controller.
5. The firmware mode switching method according to any one of claims 1 to 4, characterized in that: After writing the firmware of the first mode into the non-volatile storage medium corresponding to the target slot, the method further includes: Erasing part of the metadata in the non-volatile storage medium, recording the location information of the target slot, and setting the firmware switching flag in the non-volatile storage medium to a first preset value; The partial metadata is metadata having differences between metadata corresponding to the firmware in the first mode and metadata corresponding to the firmware in the original mode of the target solid-state drive.
6. The firmware mode switching method according to claim 5, characterized in that: The target solid-state hard disk performs a reset operation, including: The target solid-state drive receives a subsystem reset instruction sent by the host, and determines whether the firmware switching flag in the non-volatile storage medium is the first preset value; In response to the firmware switch flag in the non-volatile storage medium being the first preset value, resetting the controller of the target solid-state drive; or In response to the firmware switching flag in the non-volatile storage medium not being the first preset value, a subsystem reset process is executed.
7. The firmware mode switching method according to claim 6, wherein: The firmware for initializing the first mode includes: Determining whether the firmware switching flag in the non-volatile storage medium is the first preset value, and in response to the firmware switching flag in the non-volatile storage medium being the first preset value, performing the following steps: Re-establishing the program-erase table of the firmware of the first mode according to the original program-erase table, inheriting the original bad block table; and The power-on state is changed to the first power-on state. After all hardware units are successfully initialized, the firmware switching flag in the non-volatile storage medium is updated to a second preset value.
8. The firmware mode switching method according to claim 7, wherein: After the step of initializing the firmware of the first mode, the method further includes: The target solid-state drive receives a non-volatile memory extension driver loading instruction sent by the host; and In response to the load non-volatile memory expansion driver instruction, the target solid-state drive loads the non-volatile memory expansion driver.
9. The firmware mode switching method according to claim 1, wherein: The target slot is slot 1.
10. The firmware mode switching method according to claim 1, wherein: The non-volatile storage medium is a Nor Flash.
11. The firmware mode switching method according to claim 4, wherein: The dual-mode firmware switch is implemented by customizing a set feature of a non-volatile memory extension protocol.
12. The firmware mode switching method according to claim 11, wherein: The method further comprises: Setting the dual-mode firmware switch to on; and The target slot is used as the slot for dual-mode firmware switching.
13. The firmware mode switching method according to claim 1 or 2, characterized in that: The first mode is determined according to a current firmware mode of the target solid-state drive, and the firmware of the first mode is downloaded to the memory of the target solid-state drive through the host.
14. The firmware mode switching method according to claim 12, wherein: The step of setting the state of the dual-mode firmware switch to on includes: The value of the set feature is set to 1 to enable the state of the dual-mode firmware switch to be set to on.
15. The firmware mode switching method according to claim 9, wherein: The slot 1 is a read-only slot.
16. The firmware mode switching method according to claim 3, wherein: The slot information to be replaced is the slot targeted by the current dual-mode firmware switch, and the firmware validation mode is the validation mode after the firmware switch.
17. A firmware mode switching device, characterized in that: include: a receiving unit, configured to receive a firmware activation command sent by a host, wherein the firmware activation command is used to instruct the target solid-state drive to write the firmware in the first mode into the non-volatile storage medium corresponding to the target slot; a firmware writing unit, configured to determine whether the first mode is consistent with a current firmware mode of the target solid-state drive, and in response to the first mode being inconsistent with the current firmware mode of the target solid-state drive, perform a firmware switching check according to the firmware activation command, and write the firmware of the first mode into the non-volatile storage medium corresponding to the target slot after the firmware switching check passes; a reset unit, configured to perform a reset operation and load the firmware of the first mode; as well as An initialization unit, configured to initialize the firmware of the first mode.
18. An electronic device, characterized in that: include: one or more processors; as well as A memory associated with the one or more processors, the memory being used to store computer-readable instructions, wherein the computer-readable instructions, when read and executed by the one or more processors, implement the firmware mode switching method according to any one of claims 1 to 16.
19. A non-transitory computer-readable storage medium, characterized in that The non-transitory computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the firmware mode switching method according to any one of claims 1 to 16 is implemented.
20. A computer program product, characterized in that The method comprises computer-readable instructions, which, when executed by one or more processors, implement the firmware mode switching method according to any one of claims 1 to 16.
Citation Information
Patent Citations
A firmware upgrading method and device
CN108958782A
Firmware upgrading method and device and computer readable storage medium
CN109582337A
Firmware upgrading method and device, computer device and storage medium
CN112187544A
Method to switch between traditional SSD and open-channel SSD without data loss
CN113168291A
Firmware upgrading method and device based on solid state disk, computer equipment and storage medium
CN113986318A