A device firmware management method, device, storage medium, and product

By determining the main firmware partition of the target operating mode in the bus switch device, loading the current firmware and synchronizing it, the complex and unstable equipment firmware management is solved, and automated management and efficient upgrades are achieved.

CN119356761BActive Publication Date: 2025-06-13INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411889955.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-06-13
Estimated Expiration
2044-12-20

AI Technical Summary

Technical Problem

The firmware management methods of existing equipment are complex and unstable, especially in the firmware management process of different modes of PCIe Switch, there are problems such as multiple restarts and cumbersome operations.

Method used

By determining the main firmware partition corresponding to the target operating mode of the bus switch device, loading the current firmware to enter the target operating mode, and synchronizing the main firmware to the backup firmware partition in the mode, realizing automatic synchronization and management of the device firmware.

Benefits of technology

The firmware management process of the equipment is simplified, the operation steps are reduced, the automation efficiency is improved, and the equipment is stable upgrade and management under different operating modes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119356761B_ABST
    Figure CN119356761B_ABST
Patent Text Reader

Abstract

The present invention discloses a device firmware management method, a device, a storage medium and a product, relating to the technical field of firmware management, including: determining a main firmware partition corresponding to a target operating mode of a bus switch device; the main firmware partition being the main firmware partition in the pre-set firmware partitions that are mutually primary and standby; the bus switch device being a switch device of a high-speed serial computer expansion bus; loading the current firmware saved in the main firmware partition to start the bus switch device to enter the target operating mode; after entering the target operating mode, if the version information of the current firmware and the firmware saved in the standby firmware partition is inconsistent, synchronizing the current firmware to the standby firmware partition to complete the firmware management process. In this way, after the device enters the operating mode through the device firmware saved in the main firmware partition, the present application synchronizes the device firmware in the main firmware partition to the standby firmware partition, which not only ensures normal startup but also realizes partition firmware synchronization, improving the firmware management efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of firmware management, and particularly to a method for managing device firmware, a device, a storage medium, and a product. Background Art

[0002] Currently, the firmware management method of bus switch devices is relatively single. For example, for the firmware upgrade of a PCIe Switch (peripheral component interconnect express, a high-speed serial computer expansion bus standard; Switch, a switch device), the firmware to be upgraded is simply verified and then written into the spare partition. When restarting next time, it is started with the new fw (firmware), and the active partition is swapped. If it is desired to ensure that both partitions are the latest version, it needs to be upgraded twice and restarted twice. And if it involves the firmware of different modes of the PCIe Switch, the corresponding management and upgrade process is more cumbersome because the hardware mode (base mode) only has register parameters without software logic, so it is completely different from the synthetic mode, and it must be burned offline. Once this mode needs to be used for debugging or upgrading, it is relatively cumbersome, and even requires disassembling the machine. Upgrading the base mode firmware through the BMC (Baseboard Management Controller) is not stable enough and takes a long time.

[0003] It can be seen that how to conveniently manage device firmware is a problem that needs to be solved by those skilled in the art. Summary of the Invention

[0004] The purpose of the embodiments of the present invention is to provide a method for managing device firmware, a device, a storage medium, and a product, which can solve the problems of unstable and time-consuming device firmware upgrade.

[0005] To solve the above technical problems, in a first aspect, the embodiments of the present invention provide a method for managing device firmware, including:

[0006] Determine the main firmware partition corresponding to the target operating mode of the bus switch device; the main firmware partition is the main firmware partition in the mutually primary and standby firmware partitions pre-set in the bus switch device corresponding to the target operating mode; the bus switch device is a switch device of a high-speed serial computer expansion bus;

[0007] Load the current firmware saved in the main firmware partition to start the bus switch device into the corresponding target operating mode through the current firmware;

[0008] After entering the target operating mode, if the version information of the current firmware is inconsistent with that of the firmware saved in the standby firmware partition of the bus switch device, synchronize the current firmware to the standby firmware partition to complete the firmware management process of the bus switch device.

[0009] Optionally, determining the main firmware partition corresponding to the target operating mode of the bus switch device includes:

[0010] Determine the target operating mode of the bus switch device through the board part number or cable presence information; the target operating mode is the hardware mode or the synthesis mode;

[0011] Determine the main firmware partition corresponding to the target operating mode at the current moment.

[0012] Optionally, before determining the main firmware partition corresponding to the target operating mode of the bus switch device, it further includes:

[0013] When upgrading the device firmware saved in the bus switch device, perform a consistency check on the firmware type corresponding to the received firmware upgrade command and the firmware type corresponding to the received new device firmware to obtain a first check result;

[0014] When the first check result indicates that the check passes, write the new device firmware into the standby firmware partition at the current moment;

[0015] Swap the primary and standby relationships between the standby firmware partition where the new device firmware is written and the relevant main firmware partition so as to start the device with the new device firmware next time.

[0016] Optionally, if the operating mode of the bus switch device is the hardware mode, writing the new device firmware into the standby firmware partition at the current moment includes:

[0017] Write the new device firmware into the standby firmware partition corresponding to the hardware mode at the current moment to complete the upgrade operation of the device firmware saved in the corresponding standby firmware partition.

[0018] Optionally, if the operating mode of the bus switch device is the synthesis mode, writing the new device firmware into the standby firmware partition at the current moment includes:

[0019] Determine the device operating mode corresponding to the new device firmware, and write the new device firmware into the standby firmware partition of the device operating mode at the current moment to complete the upgrade operation of the device firmware saved in the corresponding standby firmware partition; the device operating mode is the hardware mode or the synthesis mode.

[0020] Optionally, before loading the current firmware saved in the main firmware partition, it further includes:

[0021] Perform validity and integrity verification on the current firmware saved in the main firmware partition to obtain a second verification result, so as to determine whether to load the current firmware according to the second verification result.

[0022] Optionally, the determining whether to load the current firmware according to the second verification result includes:

[0023] If the second verification result indicates that the verification is passed, load the current firmware;

[0024] If the second verification result indicates that the verification fails, load the firmware saved in the backup firmware partition corresponding to the main firmware partition.

[0025] Optionally, before determining the main firmware partition corresponding to the target operating mode of the bus switch device, it further includes:

[0026] Obtain parameter information for the device debugging firmware through a preset method; the device debugging firmware is the firmware saved in the flash memory of the bus switch device in advance for starting the bus switch device into the debugging mode;

[0027] If the parameter information indicates that the debugging mode is enabled, use the target firmware serial number in the parameter information to load the target debugging firmware with the corresponding serial number from several debugging firmwares pre-saved in the bus switch device to start the bus switch device into the debugging mode.

[0028] Optionally, the obtaining parameter information for the device debugging firmware through a preset method includes:

[0029] Obtain the corresponding parameter information through a command control unit for the device debugging firmware set in advance;

[0030] Or, read the parameter information for the device debugging firmware set at a preset position in the flash memory of the bus switch device in advance.

[0031] Optionally, the using the target firmware serial number in the parameter information to load the target debugging firmware with the corresponding serial number from several debugging firmwares pre-saved in the bus switch device includes:

[0032] Perform verification on the target debugging firmware that matches the target firmware serial number in the parameter information among several debugging firmwares pre-saved in the bus switch device to obtain a corresponding third verification result;

[0033] If the third verification result indicates passing, load the target debug firmware from the bus switch device;

[0034] If the third verification result indicates failing, load each of the other debug firmwares in the bus switch device except the target debug firmware in sequence according to the firmware serial number until the bus switch device is started to enter the debug mode;

[0035] If the bus switch device cannot be started to enter the debug mode after traversing each of the debug firmwares, set the target operating mode of the bus switch device to the synthesis mode.

[0036] Optionally, the method further includes:

[0037] After the debug task corresponding to the debug mode ends, jump to the step of determining the main firmware partition corresponding to the target operating mode of the bus switch device.

[0038] Optionally, the method further includes:

[0039] Record each operation information related to the firmware management of the bus switch device, and cache each of the operation information through a preset log area, so as to directly query each of the operation information related to the firmware management in the preset log area.

[0040] In a second aspect, an embodiment of the present invention provides an electronic device, including:

[0041] A memory for storing a computer program;

[0042] A processor for executing the computer program to implement the steps of the device firmware management method as described above.

[0043] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the device firmware management method as described above are implemented.

[0044] In a fourth aspect, an embodiment of the present invention provides a computer program product, including a computer program / instructions, and when the computer program / instructions are executed by a processor, the steps of the above device firmware management method are implemented.

[0045] As can be seen from the above technical solution, in this application, first, the main firmware partition corresponding to the target operating mode of the bus switch device is determined; the main firmware partition is the main firmware partition in the mutually primary and standby firmware partitions pre-set in the bus switch device corresponding to the target operating mode; the bus switch device is a switch device for the high-speed serial computer expansion bus; then, the current firmware saved in the main firmware partition is loaded to start the bus switch device into the corresponding target operating mode through the current firmware; after entering the target operating mode, if the version information of the current firmware and the firmware saved in the standby firmware partition in the bus switch device is inconsistent, the current firmware is synchronized to the standby firmware partition to complete the firmware management process of the bus switch device. In this way, after the device enters the corresponding operating mode through the device firmware saved in the main firmware partition, this application can directly synchronize the device firmware in the main firmware partition to the corresponding standby firmware partition, which not only ensures that the device can be started normally, but also realizes the firmware synchronization of the primary and standby firmware partitions, ensures the firmware management quality and reduces the operation steps, and can improve the automation efficiency of device management. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.

[0047] Figure 1 It is a schematic diagram of the hardware architecture for device operation disclosed in this application;

[0048] Figure 2 It is a flowchart of a device firmware management method disclosed in this application;

[0049] Figure 3 It is a flowchart of a specific device firmware management method disclosed in this application;

[0050] Figure 4 It is a schematic diagram of a firmware partition disclosed in this application;

[0051] Figure 5 It is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0052] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0053] The terms "comprising" and "having" in the specification of the present invention and any variations related to "comprising" and "having" are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may include steps or units not listed.

[0054] In order to enable those skilled in the art of the present technology to better understand the solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0055] It should be noted that the hardware architecture in which the bus switch device in the present application operates is as Figure 1 shown. The bus switch device is connected to the processor in the high-speed bus network through a bus port, and the bus switch device can expand ports. The expanded ports can be externally connected to network cards, hard disks, graphics processors, etc.; the expansion of the bus port can be realized through the bus switch device. Further, in the solution of the present application, the device firmware can be saved in the main and standby firmware partitions in the bus switch device; after entering the corresponding operating mode by using the main firmware partition, the device firmware in the main firmware partition can be directly synchronized to the corresponding standby firmware partition, which not only ensures that the device can be normally started, but also realizes the firmware synchronization of the main and standby firmware partitions, ensures the firmware management quality and reduces the operation steps, and can improve the automation efficiency of device management.

[0056] As Figure 2 shown, the embodiments of the present application disclose a method for managing device firmware, including:

[0057] Step S11, determining the main firmware partition corresponding to the target operating mode of the bus switch device; the main firmware partition is the main firmware partition in the firmware partitions that are set in advance in the bus switch device and are mutually the main and standby corresponding to the target operating mode; the bus switch device is a switch device of a high-speed serial computer expansion bus.

[0058] In the embodiments of the present application, it can be understood that several firmware corresponding to different operating modes are pre-set in the switch device of the high-speed serial computer expansion bus. One operating mode can correspond to two firmware partitions that are mutually the master and the standby; moreover, the markings of the master and standby firmware partitions are automatically switched in the device. For example, the first firmware partition at the previous moment is the master firmware partition, and then the standby firmware partition represented by the corresponding second firmware partition is updated with firmware. After the firmware update is completed, the second firmware partition is automatically set as the master firmware partition at the next moment, and the corresponding first firmware partition is the standby firmware partition at the next moment. Further, when the device starts up, it is necessary to determine the master firmware partition corresponding to the target operating mode set for the bus switch device, so as to load the corresponding device firmware from this master firmware partition.

[0059] In a specific embodiment, the determining of the master firmware partition corresponding to the target operating mode of the bus switch device may include: determining the target operating mode of the bus switch device through the board part number or the cable presence information; the target operating mode is the hardware mode or the synthesis mode; determining the master firmware partition corresponding to the target operating mode at the current moment. It can be understood that the switching between the corresponding hardware mode or synthesis mode of the device usually requires replacing the board part number or the cable. Therefore, when the device starts up, it can determine the target operating mode of the bus switch device through the board part number or the presence information of the cable, and no manual intervention is required in this process; after determining the target operating mode, the storage location (master and standby firmware partitions) of the firmware corresponding to the corresponding target operating mode is also automatically judged, and the master firmware partition corresponding to the target operating mode of the device at the current moment is determined.

[0060] In another specific embodiment, before determining the main firmware partition corresponding to the target operating mode of the bus switch device, the following steps may further be included: When upgrading the device firmware stored in the bus switch device, perform a consistency check on the firmware type corresponding to the received firmware upgrade command and the firmware type corresponding to the received new device firmware to obtain a first verification result; when the first verification result indicates that the verification is passed, write the new device firmware into the standby firmware partition at the current moment; swap the primary / standby relationship between the standby firmware partition written with the new device firmware and the relevant main firmware partition, so as to start the device with the new device firmware next time. Specifically, when storing relevant device firmware through firmware partitions, the device firmware corresponding to a certain operating mode of the device can be upgraded; first, receive a firmware upgrade command and the corresponding new device firmware, and then perform a consistency check on the firmware type corresponding to the firmware upgrade command and the firmware type of the corresponding new device firmware to obtain a first verification result; only when the first verification result indicates that the verification is passed, the new device firmware can be written into the standby firmware partition corresponding to the corresponding operating mode of the device at the current moment; it can be understood that after writing the new device firmware, the relationship between the primary and standby firmware partitions should be swapped so that the device can be started with the new device firmware saved in the main firmware partition next time.

[0061] Further, in a specific embodiment, if the operating mode of the bus switch device is the hardware mode, writing the new device firmware into the standby firmware partition at the current moment may include: writing the new device firmware into the standby firmware partition corresponding to the hardware mode at the current moment to complete the upgrade operation of the device firmware stored in the corresponding standby firmware partition. Specifically, when the operating mode of the bus switch device is the hardware mode, since the management function of the hardware mode is relatively simple compared to that of the synthetic mode, therefore, in this hardware mode, the new device firmware matching its own operating mode can be written into the standby firmware partition at the current moment to complete the upgrade operation of the device firmware stored in the standby firmware partition, and swap the relationship between the primary and standby firmware partitions, so as to enter the hardware mode of the device with the new device firmware next time.

[0062] Correspondingly, if the operating mode of the bus switch device is the synthesis mode, writing the new device firmware into the backup firmware partition at the current moment may include: determining the device operating mode corresponding to the new device firmware, and writing the new device firmware into the backup firmware partition of the device operating mode at the current moment, so as to complete the upgrade operation of the device firmware saved in the corresponding backup firmware partition; the device operating mode is the hardware mode or the synthesis mode. Specifically, the synthesis mode is run by the on-chip management unit and has richer management functions. During the process of firmware upgrade when the device is in the synthesis mode, it is necessary to determine the device operating mode (hardware mode or synthesis mode) corresponding to the received new device firmware, and then write the new device firmware into the backup firmware partition of the device operating mode at the current moment, complete the upgrade operation of the corresponding device firmware, and swap the relationship between the relevant main and backup firmware partitions, so as to use the new device firmware to start the device and enter the corresponding operating mode next time.

[0063] Step S12: Load the current firmware saved in the main firmware partition, so as to start the bus switch device into the corresponding target operating mode through the current firmware.

[0064] In the embodiment of the present application, after determining the main firmware partition corresponding to the bus switch device in the target operating mode through the above steps, the current firmware saved in the main firmware partition can be loaded, so as to start the bus switch device into the corresponding target operating mode through the current firmware.

[0065] In a specific embodiment, before loading the current firmware saved in the main firmware partition, it may further include: performing validity and integrity verification on the current firmware saved in the main firmware partition to obtain a second verification result, so as to determine whether to load the current firmware according to the second verification result. Specifically, before loading the current firmware saved in the main firmware partition, it is necessary to verify the validity and integrity of the current firmware to obtain the corresponding second verification result; then determine whether to load the current firmware based on the second verification result.

[0066] Further, determining whether to load the current firmware according to the second verification result may include: if the second verification result indicates that the verification is passed, loading the current firmware; if the second verification result indicates that the verification fails, loading the firmware saved in the backup firmware partition corresponding to the main firmware partition. Specifically, if the second verification result indicates that the verification is passed, the current firmware can be directly loaded; if the second verification result indicates that the verification fails, it means that there is a security risk in the current firmware, and the device firmware saved in the backup firmware partition should be used during the startup process of the bus switch device.

[0067] Step S13: After entering the target operating mode, if the version information of the current firmware is inconsistent with that of the firmware saved in the standby firmware partition of the bus switch device, synchronize the current firmware to the standby firmware partition to complete the firmware management process of the bus switch device.

[0068] In the embodiment of the present application, after loading the current firmware saved in the main firmware partition through the above steps and entering the corresponding target operating mode, it can be determined whether the version information of the current firmware in the main firmware partition is consistent with that of the device firmware saved in the corresponding standby firmware partition; if not, it indicates that the current firmware is the firmware obtained after upgrading the device firmware in the standby firmware partition; at this time, the current firmware can normally start the device and enter the corresponding target operating mode, indicating that the upgraded firmware is correct, so the current firmware in the main firmware partition can be synchronized to the corresponding standby firmware partition to update the device firmware saved in the standby firmware partition, so that the device firmware can be automatically synchronized to complete the firmware management process of the bus switch device.

[0069] In a specific embodiment, before determining the main firmware partition corresponding to the target operating mode of the bus switch device, it may further include: obtaining parameter information for the device debugging firmware through a preset method; the device debugging firmware is the firmware pre-saved in the flash memory of the bus switch device for starting the bus switch device into the debugging mode; if the parameter information indicates enabling the debugging mode, use the target firmware serial number in the parameter information to load the corresponding serial number of the target debugging firmware from several debugging firmware pre-saved in the bus switch device to start the bus switch device into the debugging mode. Specifically, when debugging the device at the problem site, the device can be made to enter the debugging mode through the relevant device debugging firmware; several firmware for starting the device into the debugging mode need to be pre-saved in the flash memory of the device, and then the relevant parameter information for the device debugging firmware can be obtained through a preset method, and this parameter information can be the location, serial number, etc. of the device debugging firmware; further, if the obtained parameter information indicates starting the debugging mode, the target firmware serial number in the parameter information can be used to load the corresponding serial number of the target debugging firmware from several debugging firmware pre-saved in the bus switch device to start the bus switch device into the corresponding debugging mode.

[0070] Further, in a specific embodiment, the obtaining of parameter information for the device debugging firmware through a preset manner may include: obtaining corresponding parameter information through a command control unit preset for the device debugging firmware; or, reading parameter information for the device debugging firmware preset at a preset position in the flash memory of the bus switch device. Specifically, the parameter information corresponding to the device debugging firmware may be obtained by presetting a command control unit to receive a command to load the corresponding debugging firmware; alternatively, the parameter information corresponding to the device debugging firmware may be preset at a preset position in the flash memory of the device, and the unused area in the flash memory may be used to store the parameter information of each debugging firmware.

[0071] In a specific embodiment, the loading of the target debugging firmware with the corresponding serial number from several debugging firmware pre-stored in the bus switch device by using the target firmware serial number in the parameter information may include: verifying the target debugging firmware that matches the target firmware serial number in the parameter information among several debugging firmware pre-stored in the bus switch device to obtain a corresponding third verification result; if the third verification result indicates passing, loading the target debugging firmware from the bus switch device; if the third verification result indicates not passing, sequentially loading other debugging firmware in the bus switch device except the target debugging firmware according to the firmware serial number until the bus switch device is started to enter the debugging mode; if the bus switch device cannot be started to enter the debugging mode after traversing all the debugging firmware, setting the target operation mode of the bus switch device to the synthesis mode. Specifically, if the parameter information indicates enabling the debugging mode, it is necessary to verify the target debugging firmware that matches the target firmware serial number in the parameter information among the debugging firmware pre-stored in the bus switch device to obtain a corresponding third verification result; check whether the debugging firmware has a security risk. If the third verification result indicates passing, the target debugging firmware can be directly loaded from the bus switch device to start the device into the corresponding debugging mode; correspondingly, if the third verification result indicates not passing, it means that the target debugging firmware has a security risk. At this time, other debugging firmware stored in the bus switch device can be sequentially loaded until the bus switch device is started into the corresponding debugging mode. Further, if all the debugging firmware stored in the bus switch device fails to pass the verification, the target operation mode of the bus switch device can be set to the synthesis mode to perform relevant management tasks as much as possible through the rich management functions in the synthesis mode.

[0072] In another specific embodiment, it may further include: after the debugging task corresponding to the debugging mode ends, jumping to the step of determining the main firmware partition corresponding to the target operating mode of the bus switch device. Specifically, after the bus switch device completes relevant debugging tasks through its own debugging mode, it can re-select to enter other operating modes of the device to start the device into the target operating mode by using relevant firmware.

[0073] In yet another specific embodiment, it may further include: recording each operation information related to the firmware management of the bus switch device, and caching each operation information through a preset log area, so as to directly query each operation information related to the firmware management in the preset log area. Specifically, in this embodiment, each operation information related to the firmware management of the bus switch device can be recorded, such as operation information of firmware parameter distribution, exceptions in firmware transfer, and firmware upgrade, etc., so as to facilitate subsequent staff to check the operation log; and each operation information related to the firmware management can be directly cached through the preset log area, which is convenient for subsequent information query.

[0074] Thus, after the device enters the corresponding operating mode through the device firmware saved in the main firmware partition, the present application can directly synchronize the device firmware in the main firmware partition to the corresponding backup firmware partition, which not only ensures that the device can be normally started, but also realizes the firmware synchronization between the main and backup firmware partitions; it can be seen that during the device initialization process, the new version of the device firmware in the main firmware partition can check the device firmware in the backup firmware partition. If the firmware versions of the device firmware saved in the main and backup firmware partitions are inconsistent and firmware synchronization can be performed currently, the device can synchronize the new version of the device firmware in the main firmware partition to the corresponding backup firmware partition, synchronize the new firmware to another partition without manual intervention, ensure that both firmware partitions are the latest and the same firmware, solve the problem that two operations and two restarts are required for production or online upgrade, greatly save time, and improve the automation efficiency. And several debugging firmware partitions are set up to facilitate on-site debugging and analysis. The debugging firmware can be started through commands, which improves the operation efficiency and friendliness. Further, the present application can improve the efficiency and convenience of subsequent log checking through separate recording and management of log classification.

[0075] As Figure 3 shown, the embodiment of the present application discloses a device firmware management method, which specifically includes:

[0076] It can be seen that when the PCIe Switch starts up, it can determine whether the parameter setting information indicates enabling the debug firmware; on the one hand, in the case of not enabling the debug firmware, the firmware address of the firmware corresponding to the target operating mode can be controlled through GPIO (General-purpose input / output) pins to load the device; firmware partitions are added to the device in advance to save the base mode firmware and the synthetic mode firmware respectively; among them, when the device is in the synthetic mode operating mode, the base mode firmware can also be updated, and only need to switch the target operating mode to the base mode when restarting. For the update process of the primary and secondary or dual-partition firmware, after the device updates the device firmware in the secondary firmware partition at the current moment with the new version of the device firmware, a mark of the upgraded version is made in this secondary firmware partition, and then the relationship between the primary and secondary firmware partitions is swapped, so that when the device is started up next time, the firmware partition with the upgraded version mark can be used as the primary firmware partition, and the device can be started up into the corresponding operating mode with the new version of the device firmware in this primary firmware partition. During the process of the new version of the device firmware being loaded and initialized by the device, the device firmware saved in the corresponding secondary firmware partition (the primary firmware partition before firmware upgrade) can be checked at the same time. If the versions of these two device firmwares are inconsistent, the new version of the device firmware in the primary firmware partition can be synchronized to the secondary firmware partition. In the case that there is no firmware upgrade or update for the primary and secondary firmware partitions, the device firmware in the primary firmware partition when the device was started up last time can be directly used, and the device can be started up with the firmware in the original partition.

[0077] On the other hand, when performing firmware debug (debugging) for the problem site, the debug firmware needs to be enabled through the set parameter information; specifically, the device can be optimized in two aspects. One is to add a module controlled and managed by commands to accept commands to enable the debug module; the other is to reserve a debug fw (debug firmware) area in the unused area of the device flash (flash memory). When it is necessary to update the firmware to locate the problem, multiple debug firmwares can be updated to the debug fw area, and the serial number of the debug firmware for the next startup can be set. When starting up next time, the debug firmware saved in the corresponding area can be pulled up according to the parameter information in the flash; and when the debug function is enabled, the automatic synchronization function of the partition firmware is turned off. After the debug task is completed, the debug mode can be turned off through commands to resume operation in the previous regular partition (hardware mode or synthetic mode), and the relevant debug firmware can be erased or retained through commands. Further, if there is a security risk in the debug firmware, the device can be started up into the synthetic mode, and relevant tasks can be executed through the rich management functions of the synthetic mode. It should be noted that any operation information related to the firmware management of the device can be recorded as the corresponding operation log for the staff to check and review.

[0078] In a specific embodiment, the firmware management process of the device involves four modules, namely the Boot Loader module, the firmware management module, the external control management module, and the logging module. Among them, the Boot Loader module can boot the firmware to load the firmware. By reading the parameter information at a fixed position in the device's flash, it determines whether to enable the debug fw module. If it is enabled, it loads the corresponding serial number address in the debug fw area according to the serial number in the parameters. If it is not enabled, it reads the GPIO pin information to determine whether it is the base fw or the synthetic mode area. Before executing the loading of the corresponding address, the BootLoader checks the validity and integrity of the fw. If it is abnormal, it switches to the backup partition. Specifically, in the device, 4 normal firmware partitions can be set according to the actual situation. Two partitions that are mutually primary and backup save the base mode firmware, and two partitions that are mutually primary and backup save the synthetic mode firmware. The debug fw partition can be set to 6. The starting addresses of these 10 firmware partitions are fixed and written into the Boot Loader module. Each firmware partition is as Figure 4 shown.

[0079] Furthermore, the firmware management module mainly has two functions. One is to verify the firmware during firmware upgrade and write it into the corresponding area. If the upgrade is successful, the new firmware needs to be marked to ensure that it can be started from the new firmware location after restart. To prevent incorrect flashing, a firmware type can be added to the firmware update command, and a new firmware type field can also be added to the header of the firmware. The firmware management module checks whether they match after receiving the upgrade command and the firmware file. If they do not match, it returns failure and does not write to the corresponding firmware partition. Only when the verification is successful will the new firmware file be written into the corresponding firmware partition. In addition, the base mode and synthetic mode do not require position parameters. The two partitions are mutually primary and backup, and are automatically written into the inactive partition (the backup firmware partition at the current moment). During the debug firmware upgrade process, a serial number needs to be carried in the execution of the upgrade command, and the firmware management module will write the firmware to the corresponding serial number position. The other is to determine whether to perform dual-partition synchronization after the new firmware starts, and whether to synchronize the new firmware to the backup firmware partition. This can not only upgrade once and update both the primary and backup firmware partitions at the same time, but also ensure that it will not fail to start due to incompatibility of the new firmware. The backup firmware partition is actively synchronized after the new firmware runs.

[0080] Correspondingly, the external management control module is divided into two parts. One is to control the high and low levels of GPIO through CPLD (Complex Programmable Logic Device), so as to control the device to start in base mode or synthetic mode. This part is controlled by CPLD instead of being controlled by commands like debug firmware. This is because the switching between base mode and synthetic mode usually requires changing the PN (Part Number) or cables, and the hardware is different. CPLD can automatically determine the operating mode by judging information such as the board card PN or the cable in place, without manual intervention, and the firmware storage location is also automatically determined. The other is to enable and set parameters in the firmware debug module. The PCIe Switch provides two in-band and out-of-band channels to set the firmware upgrade-related parameters and save them to the parameter setting area, and the power-off does not cause loss. Then, the log recording module is a firmware-related log module added for the PCIe Switch firmware management function. It records all aspects such as the firmware parameter distribution, exceptions in firmware transfer, exceptions in the matching check of firmware and command parameters, dual-partition synchronization, exception processes, and debug firmware switching for easy inspection. When searching for logs externally, the firmware-related logs can be classified and transmitted, and this part of the logs can be transmitted separately to avoid the problem that too many all logs are not easy to analyze.

[0081] It can be seen that in the embodiment of the present application, first, the synthetic mode and the debug firmware are partitioned, and the CPLD and external management commands are used to control the loading positions of each firmware partition; firmware verification is performed by adding a type identifier to the head of the device firmware, and it is checked whether dual-partition synchronization is required during the operation of the updated device firmware, and the updated device firmware is synchronized to another firmware partition; this not only ensures that the device firmware can be normally started, but also performs dual-partition firmware synchronization, ensuring quality and reducing operation steps, and improving automation efficiency. The firmware type classification can upgrade the base mode firmware when there is software logic running in the synthetic mode; if you want to run the base mode, you only need to control the GPIO pins during restart, which improves efficiency and reliability; as an intermediate device in the PCIe topology, the PCIe Switch requires more debug analysis and does not need to be frequently operated at the customer site. The debug firmware area can be enabled to update multiple firmwares at one time, and the firmware is controlled to start with commands, which can improve efficiency and operation friendliness.

[0082] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 5 which is a structural diagram of an electronic device shown according to an exemplary embodiment. Figure 5The content therein should not be regarded 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. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the device firmware management method disclosed in any of the foregoing embodiments. In addition, the electronic device in this embodiment may specifically be an electronic computer.

[0083] In this embodiment, the power supply 23 is used to provide operating voltages for each hardware device on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and no specific limitation is imposed on it here; the input / output interface 25 is used to obtain external input data or output data to the outside, and its specific interface type can be selected according to specific application needs, and no specific limitation is made here.

[0084] In addition, as a carrier for resource storage, the memory 22 can be a read-only memory, a random access memory, a magnetic disk, or an optical disc, etc., and the resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0085] Among them, the operating system 221 is used to manage and control each hardware device and the computer program 222 on the electronic device, and it can be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program that can be used to complete the device firmware management method executed by the electronic device disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program that can be used to complete other specific tasks.

[0086] 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, it implements the device firmware management method disclosed above. For the specific steps of this method, reference can be made to the corresponding content disclosed in the foregoing embodiments, and details are not described herein again.

[0087] Furthermore, this application also discloses a computer program product, including a computer program / instructions, and when the computer program / instructions are executed by a processor, they implement the steps of the device firmware management method disclosed above.

[0088] In the present specification, the various embodiments are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method section.

[0089] Those skilled in the art can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0090] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be directly implemented by hardware, software modules executed by a processor, or a combination of the two. The software modules can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.

[0091] Finally, it should be noted that in this document, relational terms such as "first" and "second" are only used 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 term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising a..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.

[0092] The above has introduced the technical solutions provided by this application in detail. Specific examples are used herein to elaborate on the principles and implementation manners of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to this application.

Claims

1. A device firmware management method, characterized in that: include: Determine a main firmware partition corresponding to a target operation mode of a bus switch device; the main firmware partition is a main firmware partition in a mutually primary and standby firmware partition corresponding to the target operation mode pre-set in the bus switch device; the bus switch device is a switch device of a high-speed serial computer expansion bus; Loading the current firmware stored in the main firmware partition to start the bus switch device to enter the corresponding target operation mode through the current firmware; After entering the target operation mode, if the version information of the current firmware and the firmware stored in the backup firmware partition in the bus switch device are inconsistent, the current firmware is synchronized to the backup firmware partition to complete the firmware management process of the bus switch device; Among them, after the firmware update of the current backup firmware partition is completed, it is automatically changed to the main firmware partition at the next moment, and accordingly, the current main firmware partition is automatically changed to the backup firmware partition at the next moment; If the version information of the current firmware and the firmware stored in the backup firmware partition in the bus switch device is inconsistent, it is determined that the current firmware is the firmware obtained by upgrading the device firmware in the backup firmware partition, and if the current firmware can normally start the device to enter the corresponding target operation mode, the current firmware of the main firmware partition is synchronized to the corresponding backup firmware partition to update the device firmware stored in the backup firmware partition, thereby completing the firmware management process of the bus switch device; Obtain parameter information representing the enabling of the debug mode, and load the target debug firmware from the debug firmware of the bus switch device to start the bus switch device into the debug mode, determine the target operating mode by the board part number or the cable presence information, and determine the corresponding main firmware partition; the target operating mode is the hardware mode or the synthetic mode.

2. The device firmware management method according to claim 1, characterized in that: The determining of the main firmware partition corresponding to the target operation mode of the bus switch device includes: Determine the target operation mode of the bus switch device by the board part number or the cable presence information; the target operation mode is a hardware mode or a synthetic mode; Determine the main firmware partition corresponding to the target operating mode at the current moment.

3. The device firmware management method according to claim 2, characterized in that: Before determining the main firmware partition corresponding to the target operation mode of the bus switch device, the method further includes: When performing an upgrade operation on the device firmware stored in the bus switch device, a consistency check is performed on the firmware type corresponding to the received firmware upgrade command and the firmware type corresponding to the received new device firmware to obtain a first check result; When the first verification result indicates that the verification is passed, writing the new device firmware into the backup firmware partition at the current moment; The master-slave relationship between the standby firmware partition written into the new device firmware and the related master firmware partition is swapped so that the device can be started by the new device firmware next time.

4. The device firmware management method according to claim 3, characterized in that: If the operation mode of the bus switch device is the hardware mode, writing the new device firmware into the standby firmware partition at the current moment includes: The new device firmware is written into the standby firmware partition corresponding to the hardware mode at the current moment, so as to complete the upgrade operation of the device firmware stored in the corresponding standby firmware partition.

5. The device firmware management method according to claim 3, characterized in that: If the operation mode of the bus switch device is the synthesis mode, writing the new device firmware into the standby firmware partition at the current moment includes: Determine a device operation mode corresponding to the new device firmware, and write the new device firmware into a backup firmware partition of the device operation mode at the current moment to complete an upgrade operation on the device firmware stored in the corresponding backup firmware partition; the device operation mode is the hardware mode or the synthetic mode.

6. The device firmware management method according to claim 1, characterized in that: Before loading the current firmware stored in the main firmware partition, the method further includes: The current firmware stored in the main firmware partition is verified for validity and integrity to obtain a second verification result, so as to determine whether to load the current firmware according to the second verification result.

7. The device firmware management method according to claim 6, characterized in that: The determining whether to load the current firmware according to the second verification result includes: If the second verification result indicates that the verification is passed, loading the current firmware; If the second verification result indicates that the verification fails, the firmware stored in the backup firmware partition corresponding to the main firmware partition is loaded.

8. The device firmware management method according to claim 1, characterized in that: Obtain parameter information for device debugging firmware through preset methods, including: Obtain corresponding parameter information through a pre-set command control unit for device debugging firmware; Or, read parameter information for device debugging firmware that is pre-set at a preset position of the flash memory of the bus switch device.

9. The device firmware management method according to claim 1, characterized in that: Using the target firmware serial number in the parameter information, loading the target debugging firmware with the corresponding serial number from a plurality of debugging firmwares pre-stored in the bus switch device, including: Verifying the target debugging firmware that matches the target firmware serial number in the parameter information among the plurality of debugging firmwares pre-stored by the bus switch device, and obtaining a corresponding third verification result; If the third verification result indicates passing, loading the target debugging firmware from the bus switch device; If the third verification result indicates that the device fails, then the other debugging firmwares in the bus switch device except the target debugging firmware are sequentially loaded according to the firmware sequence number until the bus switch device is started to enter the debugging mode; If the bus switch device cannot be started to enter the debugging mode after traversing all the debugging firmwares, the target operation mode of the bus switch device is set to the synthesis mode.

10. The device firmware management method according to any one of claims 1 to 9, characterized in that: Also includes: Each operation information related to the firmware management of the bus switch device is recorded, and each operation information is cached in a preset log area, so that each operation information related to the firmware management can be directly queried in the preset log area.

11. 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 device firmware management method according to any one of claims 1 to 10.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the device firmware management method according to any one of claims 1 to 10 are implemented.

13. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the device firmware management method according to any one of claims 1 to 10 are implemented.

Citation Information

Patent Citations

  • PCIe Switch firmware upgrading method and related components

    CN115113891A

  • Firmware processing method, device and equipment and readable storage medium

    CN117950717A