Disclosure of Invention
The invention aims to provide a method for storing reset information of communication equipment, which aims to solve the defect that various reset information of the equipment cannot be comprehensively recorded in the prior art, so that the reset information of the equipment can be accurately positioned, and the reason of equipment failure can be conveniently determined.
The purpose of the invention is realized by the following technical scheme:
a communication device reset information preservation method, the method comprising:
A. setting a reset information shared storage area in a memory of the equipment, and setting the shared storage area as a reserved memory;
B. when software is reset, recording software reset information to a corresponding position in the shared storage area;
C. when the equipment is started, judging the equipment reset type by the BIOS;
D. modifying the software reset information according to the equipment reset type;
E. and when the software of the equipment runs, storing the modified software reset information on a power-down maintaining medium.
The step A comprises the following steps:
a2, dividing the shared storage area into a first storage area and a second storage area.
The software reset comprises: BIOS software reset and business software reset.
The step B comprises the following steps:
recording service software reset information to the first storage area;
and recording the BIOS software reset information to the second storage area.
The step C is specifically as follows: and the BIOS judges whether the hardware is reset or the software is reset according to a reset state register provided by the hardware of the equipment.
The step D is specifically as follows:
when the reset type is hardware reset, clearing the content of the first storage area, and storing hardware reset information into the first storage area;
and simultaneously, clearing the content of the second storage area and saving the hardware reset information to the second storage area.
The step E specifically comprises the following steps: and respectively storing the reset information of the first storage area and the reset information of the second storage area on a power-down maintaining medium.
The power down retention medium includes: electrically erasable read only memory, flash memory.
The software reset information includes: reset type, software type, reset time, status information.
The hardware reset information includes: reset type, reset time, status information.
It can be seen from the above technical solutions that, in the present invention, the memory of the board in the device is divided into different storage areas, and the reset information in different states is stored respectively, so that the reset information of the service software can still be correctly stored when the BIOS is reset, and whether the service software is reset or the BIOS is reset is distinguished. By storing the reset information into the power failure holding medium, the equipment maintainer can accurately position the reset reason, which is beneficial to positioning the problem when the single board returns to maintenance.
Detailed Description
The core of the invention is that the memory of the single board in the device is divided into different storage areas, the reset information under different states is respectively stored, and the reset information is stored in the power failure holding medium.
As known to those skilled in the art, the reset of a device is typically of several types: power-on reset, cold reset (also called hard reset), hot reset (also called soft reset), button reset, hardware dog reset, software dog reset, and the like. Wherein,
power-on reset: namely, the startup of the single board power-on software means the reset generated when the single board is powered on once.
Cold reset: and resetting the CPU and key service chips, such as a DSP (digital signal processing) chip and an FPGA (programmable logic array) chip.
And (3) hot resetting: the CPU is reset or the software is re-run, but the key business chip is not reset. Typically an active reset of the software.
Resetting the button: the reset caused by the button on the single board is generally operated manually.
Hardware dog reset: reset of the CPU or the service chip caused by hardware watchdog circuit overflow.
And (3) resetting the dongle: and in the software running process, the software is actively reset when the CPU occupancy rate is 100 percent for a long time.
For the different reset types, the power-on reset, the cold reset, the button reset and the hardware dog reset can be collectively referred to as hardware reset; the hot reset and the software dog reset are collectively called as software reset.
Since the boot of the BIOS is required for starting the device service software, the software that knows the current reset reason is the BIOS (basic input/output system), and thus a mechanism is required to transfer the reset information queried in the BIOS to the software, and then the software records the reset information in a power-down maintaining medium, for example, a FLASH memory.
Based on the thought, the invention identifies different reset types by the BIOS when the equipment is started, and effectively and completely records the reset information in different states for inquiry.
In order that those skilled in the art will better understand the technical solution of the present invention, the following detailed description of the present invention is provided in conjunction with the accompanying drawings and embodiments.
Referring to fig. 2, fig. 2 is a flow chart of the method of the present invention, comprising the steps of:
step 201: a reset information shared storage area is set in a memory of the device.
The shared memory area is used as a reserved memory for temporary storage and transfer of reset information, for example, a front-end or rear-end space of the memory is used as the shared memory area, and the space is invisible to an operating system and a general program user, so the space cannot be rewritten or cleared.
As known to those skilled in the art, the BIOS may also be regarded as software, but it is important to be different from general software, and is closely connected to device hardware, and is responsible for storing the most important basic input/output programs, system setting information, power-on self-test program, system startup self-test program, and the like of the device. After the equipment is connected with a power supply and started, the BIOS starts to take over all self-checking work of the equipment starting. Generally, a system firstly checks each internal unit by a power-on self-test program, including testing a CPU, a memory, a ROM, a serial-parallel port, and the like; then BIOS reads the operation system guiding record, and finally gives the system control right to the guiding record, and guides the operation of the service program through the guiding record. If the hardware of the equipment is reset, for example, power-on reset, button reset and the like, the BIOS needs to be operated again, and the system is reset; if the software reset is generated in the operation process of the service software, the BIOS does not need to reset the system, and only needs to reboot the operation of the service program through the boot record; if the active BIOS reset is generated in the BIOS running process, the reset information also needs to be recorded so as to accurately distinguish different reset categories.
Therefore, in order to better distinguish the reset category, it is also necessary to divide the shared memory area into a first memory area and a second memory area. The first storage area is used for storing the reset information of the service software, and the second storage area is used for storing the reset information of the BIOS software, so that the reset types can be distinguished accurately.
Step 202: and when the software is reset, recording the software reset information to the corresponding position in the shared storage area. Wherein the software reset comprises: BIOS software reset and business software reset. That is, if it is a reset generated by the service software, the reset information is stored in the first storage area; if the reset is generated by BIOS software, the reset information is stored in the second storage area.
The following software reset information may be saved: reset type, software type, reset time, status information.
In this way, when the software is reset, the reset information stored in the area can be acquired when the software is re-run.
Step 203: when the device is started, the BIOS judges the type of the device reset.
The BIOS may determine whether to hard or soft reset based on the state of a reset status register provided by the device hardware. For soft reset, the information such as the type of software can be acquired through the reset information recorded in the memory. For the hard reset, the reset type, specifically, power-on reset, hardware dog reset, button reset, or the like, may be read in a reset status register provided by the hardware.
Step 204: and modifying the software reset information according to the equipment reset type.
Because the BIOS can identify the reset type of the equipment, if the equipment is reset by software, the reset information can be directly recorded into a corresponding storage area; if the hardware reset is performed, only information of the restart time can be recorded as hardware reset information, and the hardware reset information includes: reset type, reset time, status information. And setting the reset type to be hardware reset during recording, wherein the reset time is the time of restarting.
Therefore, when the reset type is hardware reset, the content of the first storage area is cleared, and the hardware reset information is saved in the first storage area; and simultaneously, clearing the content of the second storage area and saving the hardware reset information to the second storage area.
Therefore, the same hardware reset information is respectively stored in the first storage area and the second storage area, and after software runs, the information can be respectively stored in the power-down medium, for example, the hardware reset information of the first storage area is stored in an area of the power-down medium, where the service software reset information is stored, and the hardware reset information of the second storage area is stored in an area of the power-down medium, where the BIOS software reset information is stored. Since the reset of the hardware not only affects the operation of the service software, but also affects the operation of the BIOS software, the hardware reset information can be queried regardless of whether the service software reset information or the BIOS software reset information is queried.
Step 205: and when the service software of the equipment runs, storing the modified software reset information to a power-down maintaining medium. And respectively storing the reset information of the first storage area and the reset information of the second storage area on the power-down maintaining medium. The power-down holding medium can use an electrically erasable read-only memory, a flash memory and the like, a special memory chip can be designed on a single board of the equipment, and the power-down holding medium can also share the same chip with other information needing power-down storage, so that the design is simplified, and the design cost is reduced.
In order to make the skilled person better understand the present invention, the following describes the saving process of the reset information under different types of resets in detail with reference to the starting and running processes of the device.
Referring to fig. 3, fig. 3 is a process of saving hardware reset information when a device is started, including the following steps:
step 301: a hardware reset causes the device to restart, such as a button reset, but may also be a power-on start of the device.
At this point, go to step 302: the BIOS software operates to complete the functions according to the basic input and output program, the system setting information, the power-on self-test program and the system startup self-test program stored in the BIOS.
Proceeding to step 303: the BIOS determines whether a hardware reset is present.
If it is a hardware reset, proceed to step 304: hardware reset information is recorded in the first storage area and the second storage area, respectively, and of course, the recorded reset time information is time information of the starting time, not time information of the actual reset action generation time.
If not, proceed directly to step 305: and saving the hardware reset information in the second storage area to the power-down maintaining medium.
Then, go to step 306: the BIOS boots the business software to run.
Proceeding to step 307: and saving the hardware reset information in the first storage area to the power-down maintaining medium.
Proceeding to step 308: and continuously running the service software.
Referring to fig. 4, fig. 4 is a process of saving reset information when a BIOS software reset is generated, including the following steps:
step 401: a hardware reset causes the device to restart, such as a button reset, but may also be a power-on start of the device.
Step 402: the BIOS software operates to complete the functions according to the basic input and output program, the system setting information, the power-on self-test program and the system startup self-test program stored in the BIOS.
Step 403: the BIOS determines whether a hardware reset is present.
If it is a hardware reset, proceed to step 404: the information in the first storage area and the second storage area is cleared. Because data in the memory may exist or be unstable even if the device is powered off momentarily, in order to ensure that information in the first storage area and the second storage area is reliable, data which may exist in the memory is cleared first when the hardware is reset.
Then, proceed to step 405: hardware reset information is recorded to the first storage area and the second storage area, respectively.
Then, go to step 406: the BIOS boots the business software to run.
If not, proceed directly to step 406: the BIOS boots the business software to run.
Then, proceed to step 407: and saving the reset information in the first storage area to the power-down maintaining medium.
Step 408: when the service software runs abnormally, active reset is needed.
At this point, it is necessary to advance to step 409: and writing the reset information of the service software into the first storage area.
Then, proceed to step 410: and resetting the service software.
After the service software is reset, the step 402 is returned to: the BIOS software operates again to complete the functions according to the basic input and output program, the system setting information, the power-on and power-on self-test program and the system startup self-test program stored in the BIOS.
Referring to fig. 5, fig. 5 is a saving process of reset information when a reset of service software is generated, including the following steps:
step 501: a hardware reset causes the device to restart, such as a button reset, but may also be a power-on start of the device.
Step 502: the BIOS software operates to complete the functions according to the basic input and output program, the system setting information, the power-on self-test program and the system startup self-test program stored in the BIOS.
Step 503: the BIOS determines whether a hardware reset is present.
If it is a hardware reset, proceed to step 504: the information in the first storage area and the second storage area is cleared.
Then, go to step 505: hardware reset information is recorded to the first storage area and the second storage area, respectively.
Then, go to step 506: and saving the reset information in the second storage area to the power-down maintaining medium.
If not, proceed directly to step 506: and saving the reset information in the second storage area to the power-down maintaining medium.
Then, go to step 507: the BIOS boots the business software to run.
Proceeding to step 508: it is determined whether the boot was successful.
If the boot is successful, proceed to step 509: and the service software runs.
If the boot is not successful, proceed to step 510: the BIOS waits to load the correct business software.
Then, go to step 511: when the BIOS operation is abnormal, the active reset is needed.
In this case, step 512 is required: and writing the reset information of the BIOS software into the second storage area.
Then, go to step 513: and resetting the BIOS software.
After the BIOS software is reset, return to step 502: the BIOS software operates again to complete the functions according to the basic input and output program, the system setting information, the power-on and power-on self-test program and the system startup self-test program stored in the BIOS.
In the above-described flows shown in fig. 4 and 5, only the saving process of the reset information when the business software and the BIOS software are reset is described, respectively. However, during actual operation of the system, various resets may occur, and thus, the present invention is not limited to the two states shown in fig. 4 and 5. The other types of reset information are stored in a manner similar to that described above, and are not described herein again.
While the present invention has been described with respect to the embodiments, those skilled in the art will appreciate that there are numerous variations and permutations of the present invention without departing from the spirit of the invention, and it is intended that the appended claims cover such variations and modifications as fall within the true spirit of the invention.