Firmware upgrading method and device, equipment and medium
By directly reading the firmware upgrade package using the host memory buffer in NVMe devices, the problems of slow firmware upgrade speed and high resource consumption in the existing technology are solved, and an efficient firmware upgrade process is achieved.
Patent Information
- Application Number
- CN202510617782.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-14
- Publication Date
- 2025-08-12
AI Technical Summary
During the firmware upgrade process of existing NVMe devices, multiple command interactions are required through two independent standard NVMe Admin commands, resulting in increased communication burden and excessive system resource consumption, affecting the firmware upgrade speed and normal system operation.
Using host memory as a buffer, through the direct memory access interface, the firmware upgrade package is read directly from the host memory buffer, and upgraded in local non-volatile memory to reduce command interaction between the host and the disk array card.
It improves the firmware upgrade speed, reduces system resource consumption, reduces communication burden, and achieves efficient firmware upgrades under the conditions of fewer system resources.
Smart Images

Figure CN120469707A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of firmware upgrades, and in particular to a firmware upgrade method, device, equipment and medium. Background Art
[0002] Firmware upgrades are crucial for ensuring device functionality and security in embedded systems and data storage devices. As firmware continues to gain increasing importance in embedded systems, the need for fast and reliable firmware upgrades has become increasingly critical. Upgrading existing NVMe (Non-Volatile Memory Express) devices, such as RAID (Redundant Array of Independent Disks) cards, typically requires using two independent standard NVMe Admin commands issued by the host over the PCIe (Peripheral Component Interconnect Express) bus: the fw-download command (which instructs the disk array card to download firmware data from the host) and the fw-commit command (which activates the downloaded firmware data on the disk array card for the firmware upgrade).
[0003] However, using two independent standard NVMe Admin commands to perform firmware upgrades requires multiple command interactions, which not only increases the communication burden between the host and the disk array card and increases the consumption of system resources, but also requires a certain amount of time to execute each command. This can easily cause the firmware upgrade to take too long, and more seriously, may affect the normal operation of the system.
[0004] It can be seen that how to increase the speed of firmware upgrade while using fewer system resources is a technical problem that those skilled in the art need to solve. Summary of the Invention
[0005] The purpose of the embodiments of the present invention is to provide a firmware upgrade method, apparatus, device, and medium that can improve the speed of firmware upgrade while using fewer system resources. The specific solution is as follows:
[0006] In a first aspect, the present invention provides a firmware upgrade method applied to a disk array card, comprising:
[0007] The memory allocation capacity is initialized and set so that after the host queries the memory allocation capacity from the disk array card, it can apply for a corresponding amount of memory space from the host memory based on the memory allocation capacity to serve as the host memory buffer. The disk array card adopts a non-volatile memory protocol. The host and the disk array card communicate via a high-speed serial bus.
[0008] Get the starting address and capacity of the host memory buffer sent by the host;
[0009] After the host stores the firmware upgrade package in the host memory buffer, the firmware upgrade command issued by the host is obtained and executed, so as to read the firmware upgrade package directly from the host memory buffer by calling the direct memory access interface and based on the starting address and capacity size of the host memory buffer, and use the read firmware upgrade package to upgrade the original firmware stored in the local non-volatile memory.
[0010] Optionally, the firmware upgrade package stored in the host memory buffer is a data packet consisting of a firmware upgrade file and a target signature value; the target signature value is a signature value obtained by digitally signing the target summary information using a private key; the target summary information is information obtained after the host extracts the summary of the firmware upgrade file.
[0011] Optionally, by calling a direct memory access interface and based on the starting address and capacity of the host memory buffer, the firmware upgrade package is directly read from the host memory buffer, and the original firmware stored in the local non-volatile memory is upgraded using the read firmware upgrade package, including:
[0012] By calling the direct memory access interface and based on the starting address and capacity of the host memory buffer, the firmware upgrade package is directly read from the host memory buffer;
[0013] The read firmware upgrade package is stored in a local storage unit, and the read firmware upgrade package is signature verified;
[0014] If the read firmware upgrade package passes verification, the read firmware upgrade package is migrated from the local storage unit to the local non-volatile memory to upgrade the original firmware stored in the non-volatile memory.
[0015] Optionally, perform signature verification on the read firmware upgrade package, including:
[0016] Extract the firmware upgrade file and target signature value from the read firmware upgrade package;
[0017] Extracting a summary of the extracted firmware upgrade file to obtain summary information to be verified;
[0018] Use the public key to digitally verify the extracted target signature value to obtain the target summary information;
[0019] If the summary information to be verified is identical to the target summary information, it is determined that the verification of the read firmware upgrade package has passed.
[0020] Optionally, the firmware upgrade package is read directly from the host memory buffer by calling a direct memory access interface based on the starting address and capacity of the host memory buffer, including:
[0021] Parse the firmware upgrade command to determine the data size of the firmware upgrade package;
[0022] Determining whether the remaining capacity of the local storage unit is not less than the data size of the firmware upgrade package, and determining a data reading method based on the determination result;
[0023] determining a host memory buffer from the host by calling a direct memory access interface based on a starting address and a capacity of the host memory buffer;
[0024] According to the data reading method, the firmware upgrade package is directly read from the host memory buffer;
[0025] Among them, if the remaining capacity in the local storage unit is not less than the data size of the firmware upgrade package, the data reading method is the whole package reading method; if the remaining capacity in the local storage unit is less than the data size of the firmware upgrade package, the data reading method is the sub-package reading method.
[0026] Optionally, the firmware upgrade package is read directly from the host memory buffer according to the data reading method, including:
[0027] When the data reading mode is the whole package reading mode, the complete firmware upgrade package is directly read from the host memory buffer according to the whole package reading mode;
[0028] When the data reading method is the packet reading method, the packet size corresponding to the packet reading method is determined, and sub-data packets of corresponding size are read from the host memory buffer in sequence according to the sub-packet size; the sub-data packets are data packets split from the firmware upgrade package.
[0029] Optionally, initialize and set the memory allocation capacity so that after the host queries the memory allocation capacity from the disk array card, it can apply for a corresponding amount of memory space from the host memory based on the memory allocation capacity to serve as the host memory buffer, including:
[0030] By initializing the memory allocation capacity, the host can determine the remaining capacity of the host memory after querying the memory allocation capacity from the disk array card. Based on the memory allocation capacity and the remaining capacity of the host memory, the host applies for a corresponding amount of memory space from the host memory as the host memory buffer.
[0031] The memory allocation capacity includes a minimum memory allocation capacity and / or an expected memory allocation capacity.
[0032] In a second aspect, the present invention provides a firmware upgrade device, applied to a disk array card, comprising:
[0033] An initialization module is configured to initialize and set a memory allocation capacity so that, after querying the memory allocation capacity from the disk array card, the host can request a corresponding amount of memory space from the host memory based on the memory allocation capacity to serve as a host memory buffer. The disk array card uses a non-volatile memory protocol. The host and the disk array card communicate via a high-speed serial bus.
[0034] The acquisition module is used to obtain the starting address and capacity of the host memory buffer sent by the host;
[0035] The firmware upgrade module is used to obtain and execute the firmware upgrade command issued by the host after the host stores the firmware upgrade package in the host memory buffer, so as to read the firmware upgrade package directly from the host memory buffer by calling the direct memory access interface and based on the starting address and capacity of the host memory buffer, and use the read firmware upgrade package to upgrade the original firmware stored in the local non-volatile memory.
[0036] In a third aspect, the present invention provides an electronic device, comprising:
[0037] memory for storing computer programs;
[0038] The processor is configured to execute a computer program to implement the steps of the aforementioned firmware upgrade method.
[0039] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the aforementioned firmware upgrade method when executed by a processor.
[0040] In the present invention, a disk array card sets a memory allocation capacity through initialization, so that after a host queries the memory allocation capacity from the disk array card, it can apply for a corresponding amount of memory space from the host memory based on the memory allocation capacity to serve as a host memory buffer. The disk array card adopts a non-volatile memory protocol. The host and the disk array card communicate via a high-speed serial bus. The starting address and capacity of the host memory buffer issued by the host are obtained. After the host stores a firmware upgrade package in the host memory buffer, the firmware upgrade command issued by the host is obtained and executed. The firmware upgrade package is directly read from the host memory buffer by calling a direct memory access interface based on the starting address and capacity of the host memory buffer. The original firmware stored in the local non-volatile memory is upgraded using the read firmware upgrade package.
[0041] Beneficial effect: The present invention utilizes the host memory as a buffer and stores the firmware upgrade package in the host memory buffer, so that when the disk array card receives the firmware upgrade command issued by the host, it can directly obtain the firmware upgrade package from the host memory buffer through the direct memory access interface and based on the high-speed serial bus to perform the firmware upgrade. This not only greatly improves the speed of transmitting the firmware upgrade package from the host to the disk array card, but also, compared with two independent standard NVMe Admin commands, the present invention only needs one firmware upgrade command to realize the download of the firmware upgrade package and the upgrade of the firmware, reducing the command interaction between the host and the disk array card, reducing the communication burden between the host and the disk array card, and correspondingly reducing the consumption of system resources. Ultimately, the present invention can improve the speed of firmware upgrade while using fewer system resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0043] Figure 1 A flowchart of a firmware upgrade method provided by an embodiment of the present invention;
[0044] Figure 2 A firmware upgrade package signature flow chart provided in an embodiment of the present invention;
[0045] Figure 3 A firmware upgrade package signature verification flow chart provided by an embodiment of the present invention;
[0046] Figure 4 A firmware upgrade architecture diagram provided by an embodiment of the present invention;
[0047] Figure 5 A firmware upgrade flow chart provided in an embodiment of the present invention;
[0048] Figure 6 A schematic diagram of the structure of a firmware upgrade device provided by an embodiment of the present invention;
[0049] Figure 7 A structural diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0050] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0051] Firmware upgrades are performed using two independent standard NVMe Admin commands. Since multiple command interactions are required, not only does this increase the communication burden between the host and the disk array card and increase system resource consumption, but each command execution requires a certain amount of time, which can easily lead to the firmware upgrade taking too long, and more seriously, may affect the normal operation of the system. To this end, the present invention provides a firmware upgrade method that uses the host memory as a buffer so that the disk array card can read the firmware upgrade package from the host memory buffer and perform the firmware upgrade only through the firmware upgrade command issued by the host. By reducing the command interaction between the host and the disk array card, the speed of the firmware upgrade is improved while using fewer system resources.
[0052] See also Figure 1 As shown, an embodiment of the present invention provides a firmware upgrade method applied to a disk array card, comprising:
[0053] Step S11: Initializing and setting the memory allocation capacity so that after the host queries the memory allocation capacity from the disk array card, it can apply for a corresponding amount of memory space from the host memory based on the memory allocation capacity to serve as a host memory buffer. The disk array card uses a non-volatile memory protocol; the host and the disk array card communicate via a high-speed serial bus.
[0054] In the embodiment of the present invention, if the disk array card wants to use the host memory buffer (HMB) function, it is necessary to adopt the non-volatile memory protocol and the protocol version must be 1.2 or above, that is, NVMe 1.2 or above.
[0055] Specifically, during the power-on initialization phase, the disk array card initializes its memory allocation capacity. This allows the host to query the memory allocation capacity from the disk array card based on the disk array card's identifier and then request a corresponding amount of memory space from the host memory based on the memory allocation capacity to serve as the host memory buffer. It should be noted that the host memory can utilize DRAM (Dynamic Random Access Memory), and the host and disk array card communicate via a high-speed serial bus to accelerate communication between the host and disk array card. For example, the high-speed serial bus can utilize a PCIe bus.
[0056] Furthermore, the disk array card sets the memory allocation capacity through initialization, so that after the host queries the memory allocation capacity from the disk array card, it first determines the remaining capacity of the host memory, and then applies for memory space of corresponding size from the host memory based on the memory allocation capacity and the remaining capacity of the host memory to serve as the host memory buffer.
[0057] The memory allocation capacity includes the minimum memory allocation capacity and / or the expected memory allocation capacity. The minimum memory allocation capacity is the minimum memory allocation capacity required to ensure the disk array card can normally execute the firmware upgrade. If the host memory buffer capacity is lower than the minimum memory allocation capacity, the disk array card's firmware upgrade performance may be affected. For example, the minimum memory allocation capacity can be set to 4KB. The expected memory allocation capacity is the memory capacity expected to be allocated to the host memory buffer. The expected memory allocation capacity can provide optimal firmware upgrade performance for the disk array card. For example, the expected memory allocation capacity can be set to 10MB.
[0058] It should be noted that if the memory allocation capacity includes the minimum memory allocation capacity, the capacity of the host memory buffer should be no less than the minimum memory allocation capacity and less than the remaining capacity of the host memory. If the memory allocation capacity includes the minimum memory allocation capacity and the expected memory allocation capacity, then if the remaining capacity of the host memory is no less than the expected memory allocation capacity, the capacity of the host memory buffer can be equal to the expected memory allocation capacity. If the remaining capacity of the host memory is less than the expected memory allocation capacity, the capacity of the host memory buffer should be less than the remaining capacity of the host memory and no less than the minimum memory allocation capacity.
[0059] Step S12: Obtain the starting address and capacity of the host memory buffer sent by the host.
[0060] In an embodiment of the present invention, after the host obtains a host memory buffer from the host memory, the host sends the starting address and capacity of the host memory buffer to the disk array card. In response, the disk array card receives the starting address and capacity of the host memory buffer sent by the host and saves the starting address and capacity of the host memory buffer so that the host memory buffer can be accessed later based on the starting address and capacity of the host memory buffer.
[0061] Step S13: After the host stores the firmware upgrade package in the host memory buffer, obtain and execute the firmware upgrade command issued by the host, so as to read the firmware upgrade package directly from the host memory buffer by calling the direct memory access interface and based on the starting address and capacity of the host memory buffer, and use the read firmware upgrade package to upgrade the original firmware stored in the local non-volatile memory.
[0062] In an embodiment of the present invention, the host stores a firmware upgrade package in a host memory buffer and issues a firmware upgrade command for the firmware upgrade package to the disk array card. In response, the disk array card receives the firmware upgrade command issued by the host and executes it. By invoking a Direct Memory Access (DMA) interface and based on the starting address and capacity of the host memory buffer, the disk array card directly reads the firmware upgrade package from the host memory buffer. The read firmware upgrade package is then used to upgrade the original firmware stored in the local non-volatile memory. The non-volatile memory can be FLASH memory.
[0063] It should be noted that the firmware upgrade package stored by the host in the host memory buffer can be a mirror image of the original firmware upgrade package. That is, the host performs mirroring on the original firmware upgrade package to obtain a mirror image firmware upgrade package, and then stores the mirror image firmware upgrade package in the host memory buffer. In this way, by mirroring the original firmware upgrade package, the present invention can use the original firmware upgrade package to restore the mirror image firmware upgrade package when an error occurs in the mirror image firmware upgrade package stored in the host memory buffer, thereby improving the security of the firmware upgrade.
[0064] Furthermore, considering that the firmware upgrade package may be lost, tampered with, or misplaced during transmission from the host to the disk array card, in order to ensure the correctness of the firmware upgrade package, the present invention uses the SM3 algorithm (hash algorithm) and the SM2 algorithm (elliptic curve public key cryptography algorithm) to extract the summary and digitally sign the firmware upgrade package to ensure the correctness of the firmware upgrade package, thereby improving the security and reliability of the firmware upgrade.
[0065] Specifically, such as Figure 2As shown, before storing the firmware upgrade package in the host memory buffer, the host first uses the SM3 algorithm to extract the summary of the firmware upgrade file to obtain the target summary information, and then uses the SM2 algorithm to sign the target summary information with a private key to obtain a target signature value. Finally, the target signature value is attached to the end of the firmware upgrade file to form a firmware upgrade package based on the firmware upgrade file and the target signature value. At this time, the firmware upgrade package is stored in the host memory buffer.
[0066] That is, the firmware upgrade package stored in the host memory buffer is a data packet composed of a firmware upgrade file and a target signature value; the target signature value is a signature value obtained by digitally signing the target summary information using a private key; and the target summary information is the information obtained by the host extracting the summary of the firmware upgrade file.
[0067] Accordingly, the disk array card executes the firmware upgrade command issued by the host, calls the direct memory access interface, and reads the firmware upgrade package directly from the host memory buffer based on the starting address and capacity of the host memory buffer. The read firmware upgrade package is then stored in the local memory unit (LMU) and a signature verification is performed on the read firmware upgrade package. If the verification passes, it indicates that the read firmware upgrade package is a correct and legal data packet. The read firmware upgrade package is then transferred from the local memory unit to the local non-volatile memory to upgrade the original firmware stored in the non-volatile memory, thus completing the entire firmware upgrade process. If the verification fails, it indicates that the read firmware upgrade package is an incorrect and illegal data packet. In this case, the firmware upgrade package stored in the local memory unit is first deleted, and a firmware upgrade error prompt is sent to the user terminal. The firmware upgrade package can then be read again from the host memory buffer to attempt the firmware upgrade again.
[0068] Among them, such as Figure 3 As shown, the process of the disk array card performing signature verification on the read firmware upgrade package may specifically include: the disk array card extracting the firmware upgrade file and the target signature value from the read firmware upgrade package; using the SM3 algorithm to extract the digest of the extracted firmware upgrade file to obtain the digest information to be verified; and using the SM2 algorithm to perform public key signature verification on the extracted target signature value to obtain the target digest information; then determining whether the digest information to be verified and the target digest information are the same; if the digest information to be verified and the target digest information are the same, it is determined that the verification of the read firmware upgrade package has passed and the read firmware upgrade package is a correct and legal data packet; if the digest information to be verified and the target digest information are different, it is determined that the verification of the read firmware upgrade package has failed and the read firmware upgrade package is an incorrect and illegal data packet.
[0069] It should also be noted that the disk array card must first store the read firmware upgrade package in the local storage unit. After the firmware upgrade package is verified, it is then transferred from the local storage unit to the non-volatile memory. Since the capacity of non-volatile memory is generally large, while the capacity of the local storage unit is generally small, the present invention needs to further consider the actual remaining capacity of the local storage unit and adopt different data reading methods to read the firmware upgrade package from the host memory buffer.
[0070] Specifically, after receiving a firmware upgrade command from the host, the disk array card parses the firmware upgrade command to determine the data size of the firmware upgrade package. It then determines whether the remaining capacity in the local storage unit is not less than the data size of the firmware upgrade package, and determines a data reading method based on the determination result. If the remaining capacity in the local storage unit is not less than the data size of the firmware upgrade package, the data reading method is a whole-packet read method; if the remaining capacity in the local storage unit is less than the data size of the firmware upgrade package, the data reading method is a sub-packet read method. Furthermore, after determining the data reading method, the disk array card determines a host memory buffer from the host by calling a direct memory access interface based on the starting address and capacity of the host memory buffer. Then, according to the data reading method, the disk array card directly reads the firmware upgrade package from the host memory buffer.
[0071] When the data read mode is full packet read, the disk array card reads the complete firmware upgrade package directly from the host memory buffer in this manner. When the data read mode is packet read, the disk array card first determines the packet size corresponding to the packet read mode and then sequentially reads sub-packets of corresponding sizes from the host memory buffer. Sub-packets are data packets split from the firmware upgrade package.
[0072] For example, if the firmware upgrade package is 8MB, and the data is read in full packets, the disk array card needs to read the 8MB firmware upgrade package directly from the host memory buffer using the full packet read method. If the data is read in sub-packets, the disk array card must first determine the sub-packet size corresponding to the sub-packet read method, such as 4MB. Then, according to the data sequence, the disk array card will split the firmware upgrade package stored in the host memory buffer into 4MB sub-packets and read the split sub-packets into the local storage unit.
[0073] It should be noted that the signature verification of each sub-packet read in the sub-packet is specifically performed using the idea of whole-packet signature and sub-packet verification. Specifically, after the disk array card reads the sub-packet split into the local storage unit, it uses the SM3 algorithm to extract the digest of the sub-packet read this time to obtain partial digest information. Then, the sub-packet read this time is transferred to the non-volatile memory so that the local storage unit can continue to store the sub-packet split next time. This is repeated until the target signature value is read from the firmware upgrade package. The public key signature of the read target signature value is verified using the SM2 algorithm to obtain the target digest information. Then, based on the partial digest information corresponding to each sub-packet read previously, the digest information to be verified is determined, and the digest information to be verified and the target digest information are judged to be identical. If the digest information to be verified and the target digest information are identical, the original firmware stored in the non-volatile memory is upgraded based on each sub-packet. In this way, the present invention can achieve firmware upgrades even when the remaining capacity of the local storage unit is insufficient through the idea of whole-packet signature and sub-packet verification, and can also ensure the correctness and security of the firmware upgrade package.
[0074] Beneficial effect: The present invention utilizes the host memory as a buffer and stores the firmware upgrade package in the host memory buffer, so that when the disk array card receives the firmware upgrade command issued by the host, it can directly obtain the firmware upgrade package from the host memory buffer through the direct memory access interface and based on the high-speed serial bus to perform the firmware upgrade. This not only greatly improves the speed of transmitting the firmware upgrade package from the host to the disk array card, but also, compared with two independent standard NVMe Admin commands, the present invention only needs one firmware upgrade command to realize the download of the firmware upgrade package and the upgrade of the firmware, reducing the command interaction between the host and the disk array card, reducing the communication burden between the host and the disk array card, and correspondingly reducing the consumption of system resources. Ultimately, the present invention can improve the speed of firmware upgrade while using fewer system resources.
[0075] See also Figure 4 and Figure 5 As shown, an embodiment of the present invention provides a firmware upgrade method, including:
[0076] During the power-on initialization phase, the disk array card initializes the functions of its internal controller, firmware upgrade module, local storage unit, and FLASH memory, and initializes the memory allocation capacity through the controller. After the host initializes its internal driver, host memory, and user configuration tool, the driver queries the memory allocation capacity from the disk array card's controller based on the disk array card's identifier. Based on the memory allocation capacity, it requests a corresponding amount of memory space from the host memory to serve as the host memory buffer. The starting address and capacity of the host memory buffer are then sent to the controller in the disk array card, which then saves them.
[0077] After the host completes its application for the host memory buffer, it sends the encrypted and signed firmware upgrade package to the driver through the user configuration tool. The driver then stores the encrypted and signed firmware upgrade package in the host memory buffer. Simultaneously, the host sends a firmware upgrade command to the driver through the user configuration tool, which in turn sends the command to the controller in the disk array card.
[0078] The controller in the disk array card parses the received firmware upgrade command and notifies the firmware upgrade module so that the firmware upgrade module can directly read the firmware upgrade package from the host memory buffer by calling the direct memory access interface and based on the starting address and capacity of the host memory buffer, and store the read firmware upgrade package in the local storage unit, and then perform signature verification on the read firmware upgrade package. If the read firmware upgrade package passes the verification, it indicates that the read firmware upgrade package is a correct and legal data packet. At this time, the read firmware upgrade package is migrated from the local storage unit to the FLASH memory to upgrade the original firmware stored in the FLASH memory. After the firmware upgrade is completed, the controller sends the firmware upgrade success information to the user configuration tool in the host to notify the host that the firmware upgrade is successful.
[0079] Beneficial effect: The present invention utilizes the host memory as a buffer and stores the firmware upgrade package in the host memory buffer, so that when the disk array card receives the firmware upgrade command issued by the host, it can directly obtain the firmware upgrade package from the host memory buffer through the direct memory access interface and based on the high-speed serial bus to perform the firmware upgrade. This not only greatly improves the speed of transmitting the firmware upgrade package from the host to the disk array card, but also, compared with two independent standard NVMe Admin commands, the present invention only needs one firmware upgrade command to realize the download of the firmware upgrade package and the upgrade of the firmware, reducing the command interaction between the host and the disk array card, reducing the communication burden between the host and the disk array card, and correspondingly reducing the consumption of system resources. Ultimately, the present invention can improve the speed of firmware upgrade while using fewer system resources.
[0080] See also Figure 6 As shown, an embodiment of the present invention provides a firmware upgrade device applied to a disk array card, comprising:
[0081] Initialization module 11 is used to initialize and set the memory allocation capacity so that after the host queries the memory allocation capacity from the disk array card, it can apply for a corresponding amount of memory space from the host memory based on the memory allocation capacity to serve as the host memory buffer. The disk array card adopts a non-volatile memory protocol; the host and the disk array card communicate via a high-speed serial bus.
[0082] An acquisition module 12 is configured to acquire the starting address and capacity of the host memory buffer sent by the host;
[0083] The firmware upgrade module 13 is used to obtain and execute the firmware upgrade command issued by the host after the host stores the firmware upgrade package in the host memory buffer, so as to read the firmware upgrade package directly from the host memory buffer by calling the direct memory access interface and based on the starting address and capacity size of the host memory buffer, and use the read firmware upgrade package to upgrade the original firmware stored in the local non-volatile memory.
[0084] Since the embodiments of the device part correspond to the above embodiments, the embodiments of the device part please refer to the description of the embodiments of the method part, and will not be repeated here.
[0085] Beneficial effect: The present invention utilizes the host memory as a buffer and stores the firmware upgrade package in the host memory buffer, so that when the disk array card receives the firmware upgrade command issued by the host, it can directly obtain the firmware upgrade package from the host memory buffer through the direct memory access interface and based on the high-speed serial bus to perform the firmware upgrade. This not only greatly improves the speed of transmitting the firmware upgrade package from the host to the disk array card, but also, compared with two independent standard NVMe Admin commands, the present invention only needs one firmware upgrade command to realize the download of the firmware upgrade package and the upgrade of the firmware, reducing the command interaction between the host and the disk array card, reducing the communication burden between the host and the disk array card, and correspondingly reducing the consumption of system resources. Ultimately, the present invention can improve the speed of firmware upgrade while using fewer system resources.
[0086] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 7 This is a block diagram of an electronic device according to an exemplary embodiment. The content in the diagram should not be considered as any limitation on the scope of use of this application. The electronic device may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the firmware upgrade method disclosed in any of the aforementioned embodiments. In addition, the electronic device in this embodiment may specifically be an electronic computer.
[0087] In this embodiment, the power supply 23 is used to provide operating voltage for various hardware devices on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and external devices. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0088] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0089] The operating system 221 is used to manage and control the hardware devices on the electronic device, as well as the computer program 222, which can be Windows Server, NetWare, Unix, Linux, etc. In addition to including a computer program capable of performing the firmware upgrade method performed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program capable of performing other specific tasks.
[0090] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned firmware upgrade method is implemented. The specific steps of this method can be referred to the corresponding contents disclosed in the aforementioned embodiments and will not be repeated here.
[0091] Furthermore, this application also discloses a computer program product, including a computer program / instructions; wherein, when executed by a processor, the computer program / instructions implement the aforementioned disclosed firmware upgrade method. The specific steps of this method can be referred to the corresponding contents disclosed in the aforementioned embodiments and will not be repeated here.
[0092] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0093] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0094] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0095] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0096] The above is a detailed introduction to the technical solution provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A firmware upgrade method, characterized in that: Applicable to disk array cards, including: The memory allocation capacity is initially set so that after the host queries the memory allocation capacity from the disk array card, the host applies for a corresponding amount of memory space from the host memory based on the memory allocation capacity to serve as a host memory buffer; wherein the disk array card adopts a non-volatile memory protocol; and the host and the disk array card communicate via a high-speed serial bus; Obtaining the starting address and capacity of the host memory buffer sent by the host; After the host stores the firmware upgrade package in the host memory buffer, the firmware upgrade command issued by the host is obtained and executed, so as to directly read the firmware upgrade package from the host memory buffer by calling a direct memory access interface and based on the starting address and capacity of the host memory buffer, and use the read firmware upgrade package to upgrade the original firmware stored in the local non-volatile memory.
2. The firmware upgrade method according to claim 1, wherein: The firmware upgrade package stored in the host memory buffer is a data package consisting of a firmware upgrade file and a target signature value; The target signature value is a signature value obtained by digitally signing the target summary information using a private key; the target summary information is information obtained by the host extracting the summary of the firmware upgrade file.
3. The firmware upgrade method according to claim 2, wherein: The method of calling a direct memory access interface and directly reading the firmware upgrade package from the host memory buffer based on the starting address and capacity of the host memory buffer, and using the read firmware upgrade package to upgrade the original firmware stored in the local non-volatile memory includes: Reading the firmware upgrade package directly from the host memory buffer by calling a direct memory access interface and based on the starting address and capacity of the host memory buffer; The read firmware upgrade package is stored in a local storage unit, and a signature verification is performed on the read firmware upgrade package; If the read firmware upgrade package passes verification, the read firmware upgrade package is migrated from the local storage unit to the local non-volatile memory to upgrade the original firmware stored in the non-volatile memory.
4. The firmware upgrade method according to claim 3, wherein: The performing signature verification on the read firmware upgrade package includes: Extracting the firmware upgrade file and the target signature value from the read firmware upgrade package; Extracting a summary of the extracted firmware upgrade file to obtain summary information to be verified; Using the public key to digitally verify the extracted target signature value to obtain the target summary information; If the summary information to be verified is identical to the target summary information, it is determined that the verification of the read firmware upgrade package has passed.
5. The firmware upgrade method according to claim 3, wherein: The step of directly reading the firmware upgrade package from the host memory buffer by calling a direct memory access interface and based on a starting address and a capacity of the host memory buffer comprises: Parsing the firmware upgrade command to determine the data size of the firmware upgrade package; Determining whether the remaining capacity of the local storage unit is not less than the data size of the firmware upgrade package, and determining a data reading method based on the determination result; Determining the host memory buffer from the host by calling a direct memory access interface and based on a starting address and a capacity of the host memory buffer; According to the data reading method, the firmware upgrade package is directly read from the host memory buffer; Among them, if the remaining capacity in the local storage unit is not less than the data size of the firmware upgrade package, the data reading method is the whole package reading method; if the remaining capacity in the local storage unit is less than the data size of the firmware upgrade package, the data reading method is the sub-package reading method.
6. The firmware upgrade method according to claim 5, wherein: The step of directly reading the firmware upgrade package from the host memory buffer according to the data reading method includes: When the data reading mode is a whole-packet reading mode, the complete firmware upgrade package is directly read from the host memory buffer in the whole-packet reading mode; When the data reading method is a packet reading method, the packet size corresponding to the packet reading method is determined, and sub-packets of corresponding size are read from the host memory buffer in sequence according to the packet size; the sub-packets are packets split from the firmware upgrade package.
7. The firmware upgrade method according to any one of claims 1 to 6, characterized in that: The memory allocation capacity is set by initialization so that after the host queries the memory allocation capacity from the disk array card, the host applies for a memory space of a corresponding size from the host memory based on the memory allocation capacity to serve as a host memory buffer, including: Initializing and setting the memory allocation capacity so that the host can determine the remaining capacity of the host memory after querying the memory allocation capacity from the disk array card, and based on the memory allocation capacity and the remaining capacity of the host memory, apply for a memory space of a corresponding size from the host memory to serve as a host memory buffer; The memory allocation capacity includes a minimum memory allocation capacity and / or an expected memory allocation capacity.
8. A firmware upgrade device, characterized in that: Applicable to disk array cards, including: an initialization module, configured to set a memory allocation capacity by initialization, so that after the host queries the memory allocation capacity from the disk array card, the host applies for a corresponding amount of memory space from the host memory based on the memory allocation capacity to serve as a host memory buffer; wherein the disk array card adopts a non-volatile memory protocol; and the host and the disk array card communicate via a high-speed serial bus; An acquisition module, configured to acquire a starting address and a capacity of the host memory buffer sent by the host; A firmware upgrade module is used to obtain and execute a firmware upgrade command issued by the host after the host stores the firmware upgrade package in the host memory buffer, so as to read the firmware upgrade package directly from the host memory buffer by calling a direct memory access interface and based on the starting address and capacity of the host memory buffer, and use the read firmware upgrade package to upgrade the original firmware stored in the local non-volatile memory.
9. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the firmware upgrade method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the firmware upgrade method according to any one of claims 1 to 7.