A kind of operating system for power supply dormancy mechanism and hardware platform exchange method
Technical field
The invention belongs to technical field of power management, specifically, being related to a kind of operation system for power supply dormancy mechanism
System and hardware platform exchange method.
Background technology
Domestic series processors of soaring include multiple models, including the 1500A that soars, soar 2000,2000+ that soars etc..It adopts
Computer platform with domestic series processors of soaring includes a variety of different forms, including notebook, server, all-in-one machine
Deng.
Domestic series processors of soaring can all integrate a GPIO (universal input/output) module, which supports multiple
GPIO port, these GPIO ports can be used for realizing some spies by soar platform computer hardware or operating system design personnel
Fixed purpose or function, for example, cycle power function or some hardware module status indicator lamp etc..Current multiple ends GPIO
Mouth is not fully used, and is had many all idle unused.One can be selected to leave unused unused GPIO to realize that power management is stopped
The software and hardware interactive function of dormancy mechanism.
Power management is an important mechanisms of computer system, and the electrical energy that it can reduce computer system disappears
Consumption, improves the Energy Efficiency Ratio of computer system, to reduce use cost, generates huge economic and social benefit.
Electric power management mechanism includes multiple functions module, including power management etc. when suspend mode, sleep and operation, specifically such as
Under:
(1) the execution context of operating system preserves in memory, when computer enters suspend mode shape when suspend mode refers to suspend mode
When state, not all hardware component has all broken power supply, and memory and the hardware component for waking up computer are in activity
State, CPU is not also fully powered-off but is in a kind of low-power consumption mode, can return to activity at any time when receiving wake-up signal
State.The advantages of suspend mode is exactly the special block of speed waken up;
(2) operating system context preserves in a hard disk when sleep refers to sleep, when computer enters sleep state, meter
The electricity of all components of calculation machine is all broken, and electric quantity consumption is approximately zero at this time.When needing to wake up, computer is restarted, is entered
After system, it can be loaded from hard disk again and restore to execute context;
(3) power management refers to power management of the computer system in normal work when running, and computer system is just
It is not that each component is working simultaneously, for example possible network interface card now may be idle, at this moment can reduce net often when work
The power consumption of card, to the electric quantity consumption of entire computer.
Suspend mode is different from sleep, and sleep is unified power-off during normal startup and shutdown, and suspend mode needs individually
The power supply of some or multiple components is broken, while other component being kept to be in active state.That is, into suspend mode shape is entered
To two parts involved in state and the whole flow process normally executed from dormant state recovery:Software flow and hardware pipeline.Wherein,
Software flow is primarily referred to as being preserved and recovered the execution context of operating system, including the freezing of all processes, memory mirror
Make and preserve etc.;Hardware pipeline is primarily referred to as power-off and the power up of each hardware component.
It can lead to there are one hardware component such as embedded controller (Embeded Controller, EC) on usual computer
Lower electric sequential when electrifying timing sequence and the closing of control computer startup is crossed, power supply sequential and some letters of computer can be managed
Single peripheral hardware.Therefore, the powering down and up action of hardware component power supply is controlled in suspend mode to be completed by EC.
Feiteng processor follows ARM64 frameworks, supports the psci power management specifications of CPU, is ordered when sending psci to CPU
When enabling, CPU can enter the dormant state of low-power consumption mode, consume less electricity, just when CPU receives any interrupt signal
It can terminate low-power consumption mode, into normal mode of operation, execute software program.Although Feiteng processor platform can use psci
Order carrys out the power supply of management processor, but psci ordering norms is not provided with the power management function of peripheral hardware.Therefore, be
Feiteng processor platform realizes sleep mode, other than using psci orders to carry out the power supply of management processor, it is necessary to can
The power supply of closing and enabled peripheral hardware.
Although there is ripe electric power management mechanism, using a kind of standard on existing x86 architecture processors platform
The power supply of peripheral hardware is closed and enabled to ACPI Specification, sends commands to processor register realize the disconnected of processor by ACPI
Electric and upper Electricity Functional, but this set of common mechanism is being soared on platform and is being not suitable for.
Chinese invention patent " a method of realizing standby, suspend mode and wake-up in domestic Feiteng processor " (application number
CN201410167068.9), a kind of side realizing standby, suspend mode and wake-up in domestic Feiteng processor of the disclosure of the invention
Method is related to field of computer information security.Operating system of the present invention and CPU are sent out by SMBUS agreements to programmable control chip
Standby, suspend mode power management is executed after sending standby, sleep operation order, programmable control chip to be connected to order.Although the hair
It is bright to realize power management between operating system and CPU by introducing programmable control chip, but exist with the difference of the present invention
In:There is no consider using the GPIO port to leave unused in Feiteng processor, but by being fully introduced into a PLC technology
Chip realizes power management sleep mode, increases development difficulty, and in the exchange method of operating system and hardware platform
On, the two is also different.
Chinese invention patent " control device and method of the CPU power consumption under platform of soaring " (application number
CN201710082179.3), the control device of the CPU power consumption under a kind of platform of soaring of the disclosure of the invention, including:It soars processing
Device, there are three GPIO interfaces for configuration;Programmable controller is connect by three GPIO interfaces with Feiteng processor, processing of soaring
Standby, suspend mode and high load condition are sent to programmable controller by device by GPIO interface;Analog switching circuit, including respectively
Three switching channels of series resistance, programmable controller control the break-make of three switching channels;Power-supply controller of electric, power supply control
Three feedback divider resistances of device processed correspond to three concatenated resistance of switching channels respectively, and power-supply controller of electric is corresponded to according to resistance value
Export scheduled voltage.Although the invention utilizes programmable controller, is realized on Feiteng processor platform and reduce CPU power consumption
Control method, but with the present invention difference lies in:By using in Feiteng processor leave unused three GPIO ports, in conjunction with
One programmable control chip is come the operating system and hardware platform realizing power management sleep mode, but proposed in the present invention
Exchange method it is more simple, only need a GPIO that can complete corresponding function, workload is small, realizes simple.
Invention content
In view of this, the present invention provides one kind and stops for power supply to solve defect and deficiency of the existing technology
The operating system of dormancy mechanism and hardware platform exchange method, can realize the sleep mode for platform power management of soaring, make to soar
Platform reduces power consumption, promotes the Energy Efficiency Ratio of platform.
In order to solve the above-mentioned technical problem, the invention discloses a kind of operating systems and hardware for power supply dormancy mechanism
Platform exchange method, and realized using following technical scheme.
A kind of operating system for power supply dormancy mechanism and hardware platform exchange method, step include:
S1, it executes into dormant state flow, preserves the execution context of the operating system;
S2, computer hardware platforms are notified to execute suspend mode behaviour by being configured to the level for the GPIO port that suspend mode interacts
Make;
S3, the computer hardware platforms execute the power-off sequential of hardware;
S4, the CPU that soars enter dormant state;
S5, pass through the CPU that soars described in interruption wake-up;
S6, by configuring the GPIO port level to the level opposite with level in the S2, notify the calculating
Machine hardware platform executes wake operation;
S7, the computer hardware platforms execute electrifying timing sequence;
S8, the flow for restoring normal execution mode is executed, restores the execution context preserved.
Further, the specific steps of execution into dormant state flow include in the S1:
S11, the file system for synchronizing the operating system;
S12, freeze the process being carrying out before the operating system suspend mode;
S13, the state for preserving each equipment;If the equipment has low power consumpting state, the equipment is made to enter
Low power consumpting state;
S14, two or more CPU is judged whether, if so, closing all CPU in addition to host CPU;If it is not,
Then enter in next step;
S15, all interruptions are closed.
Further, the particular content of the S11 is interim in the caching that the file system is located in memory
In file synchronization to hard disk.
Further, the specific steps of the flow of the recovery normal execution mode in the S8 include:
S81, enabled interruption;
S82, the state for restoring the equipment preserved;
If S83, there are two or more CPU, restore the state of all CPU in addition to the host CPU;If there is only
One CPU, then skip this step;
The process that S84, recovery are freezed, makes the process enter the execution state before freezing.
Further, the S2 is specially that the GPIO port is configured to high level, notifies that the computer hardware is flat
EC components in platform execute the sleep operation.
Further, the S3 is specially the power-off sequential that the EC components execute hardware, closes the power supply of peripheral hardware.
Further, the S4 is specially to send order to the CPU that soars, and the CPU that soars is made to enter dormant state.
Further, the S5 is called out specifically by the computer system for waking up key wake-up suspend mode by wake-up interrupts
Wake up the CPU that soars;The S7 is specially to execute electrifying timing sequence by the EC components in the computer hardware platforms.
A kind of computer readable storage medium, the computer-readable recording medium storage have computer program, the meter
The operating system described above for power supply dormancy mechanism and the hardware platform side of interaction are realized when calculation machine program is executed by processor
The step of method.
A kind of device of double BIOS systems based on platform of soaring, including memory, processor and it is stored in described deposit
In reservoir and the computer program that can run on the processor, the processor realized when executing the computer program with
The step of upper operating system for power supply dormancy mechanism is with hardware platform exchange method.
Compared with prior art, the present invention can be obtained including following technique effect:It can realize platform power pipe of soaring
The sleep mode of reason makes platform reduction power consumption of soaring, promotes its Energy Efficiency Ratio;Use the end GPIO left unused in Feiteng processor
Mouthful realize that the operating system of power management sleep mode is interacted with embedded controller, implementation method is simple, takes up less resources,
It is at low cost;The embedded controller of introducing only needs to be performed the work of the power-on and power-off sequential corresponding to sleep mode, workload
It is small, it realizes simple.
Certainly, implementing any of the products of the present invention must be not necessarily required to reach all the above technique effect simultaneously.
Description of the drawings
Attached drawing described herein is used to provide further understanding of the present invention, and constitutes the part of the present invention, this hair
Bright illustrative embodiments and their description are not constituted improper limitations of the present invention for explaining the present invention.In the accompanying drawings:
Fig. 1 is that the operating system and hardware for platform power management dormancy mechanism of soaring of one embodiment of the invention are flat
Platform exchange method flow chart.
Fig. 2 is that the operating system of one embodiment of the invention is executed with hardware platform exchange method into dormant state
Flow diagram.
The operating system and recovery normal execution mode in hardware platform exchange method that Fig. 3 is one embodiment of the invention
Flow diagram.
Specific implementation mode
Carry out the embodiment that the present invention will be described in detail below in conjunction with accompanying drawings and embodiments, thereby how the present invention is applied
Technological means solves technical problem and reaches the realization process of technical effect to fully understand and implement.
A kind of operating system for power supply dormancy mechanism and hardware platform exchange method, as shown in Figure 1, specific steps packet
It includes:
S1, when operating system needs suspend mode, execute into dormant state software flow, preserve operating system execute on
Hereafter;
S2, the GPIO port interacted for suspend mode is set to high level, notifies the EC components in computer hardware platforms existing
In sleep operation to be executed;
S3, EC component execute the power-off sequential of hardware, close the power supply of the peripheral hardwares such as PCIe, reduce the power consumption of computer;
S4, psci orders are sent to the domestic CPU that soars, CPU is made to enter dormant state;
S5, when needing to wake up the computer system of suspend mode, press wake-up key, to wake up CPU by interruption, CPU opens
Begin to execute software program;
S6, the GPIO port interacted for suspend mode is set to low level, notifies the EC components in computer hardware platforms existing
In wake operation to be executed;
S7, EC component execute electrifying timing sequence, and the peripheral hardwares such as PCIe powered off in step S3 are powered back up, and peripheral hardware is made to enter activity
State;
S8, the software flow for restoring normal execution mode is executed, the operating system preserved in recovering step S1 executes up and down
Text.
EC components are embedded controller, i.e., independent embedding independently of one of CPU and peripheral hardware in computer hardware platforms
Enter the controller of computer hardware platforms, it is generally used to management computer hardware platforms, for example realizes entire computer hardware
Electrifying timing sequence and lower electric sequential operation.
The flow into dormant state is executed in step S1 as shown in Fig. 2, specific steps include:
S11, synchronization file system;In operating system normal operation, exist in the caching that file system is located in memory
A large amount of temporary file, synchronization file system operation can be synchronized to the temporary file in caching in hard disk, to make file
System reaches consistent state;
S12, freeze process, when suspend mode, which will preserve, executes context it is necessary to preserve all states of a process of a certain moment, because
This must freeze process, and process is allowed no longer to execute, and such process is located at relevant information in memory and is only and current process execution shape
A consistent static mirror image of state;
S13, equipment state preserve, each device drives in Ergodic Theory, preserve the state of peripheral hardware driving and peripheral hardware, such as
There are low power consumpting states for fruit equipment, then so that equipment is entered low power consumpting state;There is no the equipment of low power consumpting state only to preserve its state;
If there are multiple CPU in S14, system, all CPU in addition to host CPU are closed;
S15, all interruptions are closed, this when, system should no longer respond interruption, it is therefore desirable to turn off interruption.
Restore the flow of normal execution mode in step S8 as shown in figure 3, specific steps include:
S81, enabled interruption;Enabled interruption refers to reopening the interruption closed before, enables a system to receive again simultaneously
Processing is interrupted;
S82, equipment state are restored, and each device drives in Ergodic Theory restore driving and peripheral state;
The state of all CPU of S83, recovery in addition to host CPU;
The process that S84, recovery are freezed, makes process enter normal execution mode.In this way, preserving mirror in memory when suspend mode
As the state before being then restored to continues to execute.
GPIO in the present invention:General Purpose Input Output (universal input/output) or bus extension
Device, people simplify I/O mouthfuls of extension using industrial standard I2C, SMBus or SPI interface.When microcontroller or chipset do not have
Enough ports I/O, or when system is needed using distal end serial communication or control, GPIO products are capable of providing additional control
And function for monitoring.Each GPIO port can be each configured to input or be exported by software.
PCIe peripheral hardwares:PCIe buses are the IO buses of industrial standard in current all-purpose computer, it provides expansion for computer
Open up the function of peripheral hardware.Peripheral hardware based on PCIe bus interface is referred to as PCIe peripheral hardwares, such as PCIe video cards, PCIe network interface cards etc..
The beneficial effects of the invention are as follows:The sleep mode that can realize platform power management of soaring makes platform reduction of soaring
Power consumption promotes its Energy Efficiency Ratio;Power management sleep mode is realized using the GPIO port to leave unused in Feiteng processor
Operating system is interacted with embedded controller, and implementation method is simple, is taken up less resources, at low cost;The embedded controller of introducing
The work of the power-on and power-off sequential corresponding to sleep mode is only needed to be performed, workload is small, realizes simple.
A kind of operating system for power supply dormancy mechanism is provided for the embodiments of the invention above to hand over hardware platform
Mutual method, is described in detail.The explanation of above example is only intended to help to understand that the method for the present invention and its core are thought
Think;Meanwhile for those of ordinary skill in the art, according to the thought of the present invention, in specific embodiments and applications
There will be changes, in conclusion the content of the present specification should not be construed as limiting the invention.
Some vocabulary has such as been used to censure specific components or module in specification and claim.Art technology
Personnel are, it is to be appreciated that different institutions may call the same component or module with different nouns.This specification and right are wanted
In a manner of asking the difference not by title to be used as differentiation component, but area is used as with the difference of component or module functionally
The criterion divided.As being open language, therefore should solve in specification in the whole text and claim "comprising", " comprising " mentioned in
It is interpreted into " including but not limited to "." substantially " refer in receivable error range, those skilled in the art can be certain
The technical problem is solved in error range, basically reaches the technique effect.Specification subsequent descriptions are to implement the present invention's
Better embodiment, so description is being not limited to the model of the present invention for the purpose of the rule for illustrating the present invention
It encloses.Protection scope of the present invention is when subject to appended claims institute defender.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
Including so that commodity or system including a series of elements include not only those elements, but also include not clear
The other element listed, or further include for this commodity or the intrinsic element of system.In the feelings not limited more
Under condition, the element that is limited by sentence "including a ...", it is not excluded that including the element commodity or system in also
There are other identical elements.
Several preferred embodiments of the present invention have shown and described in above description, but as previously described, it should be understood that the present invention
Be not limited to form disclosed herein, be not to be taken as excluding other embodiments, and can be used for various other combinations,
Modification and environment, and can in innovation and creation contemplated scope described herein, by the technology of above-mentioned introduction or related field or
Knowledge is modified.And changes and modifications made by those skilled in the art do not depart from the spirit and scope of the present invention, then it all should be
In the protection domain of appended claims of the present invention.