[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN107346162B - Power management method and device under UEFI (unified extensible firmware interface) - Google Patents

Power management method and device under UEFI (unified extensible firmware interface) Download PDF

Info

Publication number
CN107346162B
CN107346162B CN201610293851.9A CN201610293851A CN107346162B CN 107346162 B CN107346162 B CN 107346162B CN 201610293851 A CN201610293851 A CN 201610293851A CN 107346162 B CN107346162 B CN 107346162B
Authority
CN
China
Prior art keywords
power management
port
function
calling
power
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610293851.9A
Other languages
Chinese (zh)
Other versions
CN107346162A (en
Inventor
邱国武
徐成泽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yanxiang Smart Iot Technology Co ltd
Original Assignee
EVOC Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by EVOC Intelligent Technology Co Ltd filed Critical EVOC Intelligent Technology Co Ltd
Priority to CN201610293851.9A priority Critical patent/CN107346162B/en
Publication of CN107346162A publication Critical patent/CN107346162A/en
Application granted granted Critical
Publication of CN107346162B publication Critical patent/CN107346162B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Power Sources (AREA)

Abstract

The invention provides a power management method and device under UEFI. The method comprises the following steps: receiving a power supply operation command of an operating system; searching a power management device on the PCI bus, and returning a structural body pointing to the power management device; accessing a configuration space of the power management device according to the structural body; reading an I/O port address value in the configuration space; applying for an input/output domain for the I/O port according to the I/O port address value; writing an instruction value matched with the power supply operation command to the I/O port; and executing corresponding power supply operation on the power supply management equipment according to the instruction value. The invention can solve the problem that UEFI is incompatible with the old version system in the aspect of power management without spending too much time and resources.

Description

Power management method and device under UEFI (unified extensible firmware interface)
Technical Field
The invention relates to the technical field of computer power management, in particular to a power management method and device under UEFI.
Background
According to the difference of Power Management modes, the operating System is divided into an APM (Advanced Power Management) operating System and an ACPI (Advanced Configuration and Power Management Interface) operating System, the APM System has a large degree of dependence on the BIOS, the Power Management is performed by calling an interrupt service provided by the BIOS (Basic Input Output System), and the function that can be realized is very limited due to the space limitation of the BIOS chip. The ACPI system performs hardware configuration and power management by the driver provided by the operating system itself according to the table provided by the BIOS, so that the function that can be implemented is much stronger than that of the APM system, and the ACPI system has wide application in medium-high end applications.
ACPI is the advanced power management in mainstream use today, and its compatibility aspects all make a good job. The APM is a relatively laggard power management, which is slowly eliminated at present, and only some specific industries use the APM. For example, when the machine chipset used by a certain organization is H61, the Linux operating system is a relatively backward version 2.4.18 kernel, and when the BIOS of the machine motherboard is upgraded to UEFI (Unified Extensible Firmware Interface), the APM module is no longer supported, because the new version of UEFI has removed this module, part of the commands related to power management may fail, such as the shutdown command poweroff, and the system upgrade needs to be adopted to solve the problem.
In the process of implementing the invention, the inventor finds that at least the following technical problems exist in the prior art:
aiming at the problem that partial commands of related power management are invalid when a machine mainboard BIOS is upgraded to UEFI, if a measure of upgrading a system is adopted to solve the problem, time and resources are required to be huge, and some related programs need to be changed integrally.
Disclosure of Invention
The invention provides a power management method and device under UEFI (unified extensible firmware interface), which can solve the problem that UEFI is incompatible with an old version system in the aspect of power management without upgrading the system and replacing program application, and does not need to spend much time and resources.
In a first aspect, the present invention provides a method for power management under UEFI, where the method includes:
receiving a power supply operation command of an operating system;
searching a power management device on the PCI bus, and returning a structural body pointing to the power management device;
accessing a configuration space of the power management device according to the structural body;
reading an I/O port address value in the configuration space;
applying for an input/output domain for the I/O port according to the I/O port address value;
writing an instruction value matched with the power supply operation command to the I/O port;
and executing corresponding power supply operation on the power supply management equipment according to the instruction value.
Optionally, the receiving a power operation command of an operating system includes:
and receiving a power supply operation command sent by the operating system by calling a system calling function.
Optionally, the searching for the power management device on the PCI bus includes: and searching the power management equipment on the PCI bus by calling a PCI equipment search function, wherein the input parameters of the PCI equipment search function are the PCI bus and the slot number of the power management equipment.
Optionally, the accessing the configuration space of the power management device according to the structural body includes: and accessing the configuration space of the power management equipment by calling a configuration space access function, wherein the input parameter of the configuration space access function is the structural body.
Optionally, the applying for a block of input/output domain for the I/O port according to the I/O port address value includes: and applying for an input/output domain for the I/O port by calling an input/output domain application function.
Optionally, the writing, to the I/O port, the instruction value matching the power operation command includes: writing the instruction value to the I/O port by calling a write function.
In a second aspect, the present invention provides a power management apparatus under UEFI, including:
the receiving module is used for receiving a power supply operation command of an operating system;
the searching module is used for searching the power management equipment on the PCI bus and returning a structural body pointing to the power management equipment;
the access module is used for accessing the configuration space of the power management equipment according to the structural body;
a reading module, configured to read an I/O port address value in the configuration space;
the application module is used for applying an input/output domain for the I/O port according to the I/O port address value;
a write-in module, configured to write an instruction value matching the power operation command into the I/O port;
and the execution module is used for executing corresponding power supply operation on the power supply management equipment according to the instruction value.
Optionally, the receiving module is configured to receive a power operation command sent by the operating system by calling a system call function.
Optionally, the search module is configured to search for the power management device on the PCI bus by calling a PCI device search function, where input parameters of the PCI device search function are the PCI bus and the slot number of the power management device.
Optionally, the access module is configured to access the configuration space of the power management device by calling a configuration space access function, where an input parameter of the configuration space access function is the structural body.
Optionally, the application module is configured to apply for an I/O domain for the I/O port by calling an I/O domain application function.
Optionally, the writing module is configured to write the instruction value to the I/O port by calling a writing function.
According to the power management method and device under UEFI provided by the embodiment of the invention, under the condition that the UEFI does not support an APM (advanced persistent execution model), the problem that the UEFI is incompatible with an old version system in the aspect of power management can be solved under the conditions that the system is not upgraded and a program is not changed, and too much time and resources are not needed.
Drawings
FIG. 1 is a flow chart of power operation in a prior art APM-based power management mode;
fig. 2 is a flowchart of a power management method under UEFI according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a power management apparatus under UEFI according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart illustrating a conventional power management mode power operation based on an APM power management mode, in which an intel H61 chipset platform, an operating system of turbo linux7.0, and a kernel of 2.4.18 are used as examples, and a power off command poweroff is used as an example. The user outputs a poweroff command at the terminal, and sends a message of turning off the power supply of the computer through an event notification chain notifier _ call _ chain by calling sys _ rebot function. And then calling a machine _ power _ off function, judging whether the function pointer of pm _ power _ off is empty when the machine _ power _ off function is called, finishing the operation when the function pointer is empty, and performing shutdown by calling the pm _ power _ off function when the function pointer is not empty. In the case that the APM has been loaded, the actual pm _ power _ off points to APM _ power _ off, switching to real mode shutdown by the value of the APM _ info structure in the function; or the power-off is carried out by using apm _ bios _ call _ single function to call the apm interface in the protection mode.
This is the shutdown command execution flow under normal conditions, but after the machine BIOS has been upgraded to UEFI, the APM power management mode is no longer supported. When the program is executed to the machine _ power _ off, because the UEFI does not support the APM, when the actual pm _ power _ off points to APM _ power _ off, the corresponding function call cannot be realized, and the shutdown cannot be successfully realized. The solution proposed by the present invention is improved at the position shown in fig. 1.
The invention provides a power management method under UEFI (unified extensible firmware interface), which comprises the following steps of:
s21, receiving a power supply operation command of an operating system;
s22, searching the power management equipment on the PCI bus, and returning a structural body pointing to the power management equipment;
s23, accessing the configuration space of the power management equipment according to the structural body;
s24, reading an I/O port address value in the configuration space;
s25, applying for an input/output domain for the I/O port according to the I/O port address value;
s26, writing an instruction value matched with the power supply operation command into the I/O port;
and S27, executing corresponding power supply operation on the power supply management equipment according to the instruction value.
According to the power management method under UEFI provided by the embodiment of the invention, under the condition that the UEFI does not support an APM (advanced persistent framework) module, the problem that the UEFI is incompatible with an old version system in the aspect of power management can be solved under the conditions that the system is not upgraded and a program is not changed, and too much time and resources are not needed.
Optionally, the receiving a power operation command of an operating system includes:
and receiving a power supply operation command sent by the operating system by calling a system calling function.
The embodiment of the invention takes an Intel H61 chipset platform, an operating system of Turbolinux7.0 and a kernel of 2.4.18 as examples for analysis, and when a BIOS of a machine is upgraded to UEFI, an APM power management mode is not supported. When a user outputs a power supply operation command at a terminal, an operating system calls a system call function, namely a sys _ reboot function, and sends a message of turning off the power supply of the computer through an event notification chain notifier _ call _ chain.
Optionally, the power management device is found on the PCI bus by calling a PCI device lookup function, where input parameters of the PCI device lookup function are the PCI bus and the slot number of the power management device.
The corresponding device, namely the power management device on the south bridge chip, is found on the PCI bus by calling a PCI _ find _ slot (signaled int bus, signaled int devfn) function. The input parameter of the PCI _ find _ slot function is bus, i.e. the PCI bus parameter where the power management device is located, the other parameter of the function is devfn, i.e. the slot number of the power management device, and the input parameters bus and devfn are determined according to the parameter data of the chip used by the mainboard. And searching the power management equipment in a system global chain of the PCI equipment by calling a PCI _ find _ slot function according to the PCI bus parameter and the slot number parameter of the power management equipment, if the power management equipment is searched, returning a structure struct PCI _ dev pointing to the power management equipment, and otherwise returning to the null state. Wherein the structure struct pci _ dev comprises parameter data of the power management equipment.
Optionally, the accessing the configuration space of the power management device according to the structural body includes: and accessing the configuration space of the power management equipment by calling a configuration space access function, wherein the input parameter of the configuration space access function is the structural body.
Accessing the configuration space of the power management device by calling a configuration space access function, namely a pci _ read _ configuration _ word (struct pci _ dev pdev, int where, u8 val) function, wherein a parameter pdev of an input of the pci _ read _ configuration _ word function is a structure body returned in the last step, reading data from a configuration register of the power management device identified by the structure body through the function, wherein a where parameter is a byte offset from the beginning of the configuration register, and a value obtained from the configuration space is returned through a val pointer. The I/O port address value needed by the power management device when the power management device works is obtained from the configuration space of the power management device, and the address value is returned through a val pointer.
Optionally, applying for an input/output domain for the I/O port according to the I/O port address value includes: and applying for an input/output domain for the I/O port by calling an input/output domain application function.
And applying for an input/output domain for the I/O port by calling an input/output domain application function, namely a request _ region function, to ensure that the port is not used. The input parameter From of the request _ region function is the base address of the I/O port, num is the occupation range of the I/O port, and name is the device name using the segment of I/O address.
Optionally, the writing, to the I/O port, the instruction value matching the power operation command includes: writing the instruction value to the I/O port by calling a write function.
An instruction value is written into the I/O port by calling a write function, i.e. an outb (port) function, whose input parameter value is the value to be written and port is the corresponding port. And executing corresponding power supply operation on the power supply management equipment according to different instruction values.
In the flow chart corresponding to fig. 1, after receiving a power operation command sent by an operating system, the method for power management under UEFI according to the embodiment of the present invention may call a machine _ power _ off function, and then perform a corresponding power management operation using the method for power management under UEFI according to the embodiment of the present invention, or may call the machine _ power _ off function first, and if the power operation command can be executed correctly, perform a corresponding power operation normally. If the power operation instruction cannot be executed correctly, the operation step after calling the pci _ find _ slot function is started to be executed, and the power management method under UEFI provided by the embodiment of the invention is adopted to carry out corresponding power management operation.
An embodiment of the present invention further provides a power management apparatus under UEFI, as shown in fig. 3, the apparatus includes:
a receiving module 31, configured to receive a power operation command of an operating system;
the searching module 32 is used for searching the power management device on the PCI bus and returning a structural body pointing to the power management device;
an access module 33, configured to access a configuration space of the power management device according to the structural body;
a reading module 34, configured to read an I/O port address value in the configuration space;
an application module 35, configured to apply for an I/O domain for the I/O port according to the I/O port address value;
a write module 36, configured to write an instruction value matching the power operation command to the I/O port;
and the execution module 37 is configured to execute a corresponding power operation on the power management device according to the instruction value.
According to the power management device under UEFI provided by the embodiment of the invention, under the condition that the UEFI does not support an APM (advanced persistent execution mode), the problem that the UEFI is incompatible with an old version system in the aspect of power management can be solved under the conditions that the system is not upgraded and a program is not changed, and too much time and resources are not needed.
Optionally, the receiving module 31 is configured to receive a power operation command issued by the operating system by calling a system call function.
Optionally, the search module 32 is configured to search the power management device on the PCI bus by calling a PCI device search function, where input parameters of the PCI device search function are the PCI bus and the slot number of the power management device.
Optionally, the accessing module 33 is configured to access the configuration space of the power management device by calling a configuration space access function, where an input parameter of the configuration space access function is the structural body.
Optionally, the application module 35 is configured to apply for an I/O domain for the I/O port by calling an I/O domain application function.
Optionally, the writing module 36 is configured to write the instruction value to the I/O port by calling a writing function.
The work flow of the power management device under the UEFI provided by the embodiment of the present invention has been described in detail in the power management method under the UEFI, and is not described herein again.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A power management method under UEFI is characterized by comprising the following steps:
receiving a power supply operation command of an operating system;
searching a power management device on the PCI bus, and returning a structural body pointing to the power management device;
accessing a configuration space of the power management device according to the structural body;
reading an I/O port address value in the configuration space;
applying for an input/output domain for the I/O port according to the I/O port address value;
writing an instruction value matched with the power supply operation command to the I/O port;
and executing corresponding power supply operation on the power supply management equipment according to the instruction value.
2. The method of power management under UEFI according to claim 1, wherein the receiving a power operation command of an operating system comprises:
and receiving a power supply operation command sent by the operating system by calling a system calling function.
3. The method of power management under UEFI of claim 2, wherein the locating a power management device on the PCI bus comprises: and searching the power management equipment on the PCI bus by calling a PCI equipment search function, wherein the input parameters of the PCI equipment search function are the PCI bus and the slot number of the power management equipment.
4. The UEFI power management method of claim 3, wherein accessing the configuration space of the power management device according to the fabric comprises: and accessing the configuration space of the power management equipment by calling a configuration space access function, wherein the input parameter of the configuration space access function is the structural body.
5. The UEFI power management method of claim 4, wherein applying for a block of I/O domain for the I/O port according to the I/O port address value comprises: applying for an input/output domain for the I/O port by calling an input/output domain application function;
the writing to the I/O port an instruction value that matches the power operation command comprises: writing the instruction value to the I/O port by calling a write function.
6. A power management device under UEFI, comprising:
the receiving module is used for receiving a power supply operation command of an operating system;
the searching module is used for searching the power management equipment on the PCI bus and returning a structural body pointing to the power management equipment;
the access module is used for accessing the configuration space of the power management equipment according to the structural body;
a reading module, configured to read an I/O port address value in the configuration space;
the application module is used for applying an input/output domain for the I/O port according to the I/O port address value;
a write-in module, configured to write an instruction value matching the power operation command into the I/O port;
and the execution module is used for executing corresponding power supply operation on the power supply management equipment according to the instruction value.
7. The apparatus for power management under UEFI according to claim 6, wherein the receiving module is configured to receive a power operation command issued by an operating system by calling a system call function.
8. The apparatus for power management under UEFI according to claim 7, wherein the lookup module is configured to find the power management device on the PCI bus by calling a PCI device lookup function, and input parameters of the PCI device lookup function are a PCI bus and a slot number of the power management device.
9. The apparatus for power management under UEFI according to claim 8, wherein the accessing module is configured to access the configuration space of the power management device by calling a configuration space access function, and an input parameter of the configuration space access function is the structure.
10. The apparatus for power management under UEFI according to claim 9, wherein the application module is configured to apply for an I/O domain for the I/O port by calling an I/O domain application function;
and the writing module is used for writing the instruction value into the I/O port by calling a writing function.
CN201610293851.9A 2016-05-05 2016-05-05 Power management method and device under UEFI (unified extensible firmware interface) Active CN107346162B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610293851.9A CN107346162B (en) 2016-05-05 2016-05-05 Power management method and device under UEFI (unified extensible firmware interface)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610293851.9A CN107346162B (en) 2016-05-05 2016-05-05 Power management method and device under UEFI (unified extensible firmware interface)

Publications (2)

Publication Number Publication Date
CN107346162A CN107346162A (en) 2017-11-14
CN107346162B true CN107346162B (en) 2021-03-19

Family

ID=60253893

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610293851.9A Active CN107346162B (en) 2016-05-05 2016-05-05 Power management method and device under UEFI (unified extensible firmware interface)

Country Status (1)

Country Link
CN (1) CN107346162B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102955921A (en) * 2012-10-19 2013-03-06 威盛电子股份有限公司 Electronic device and safe starting method
CN103294564A (en) * 2012-03-05 2013-09-11 联想(北京)有限公司 Shutdown method, information processing method, and electronic device
CN104572163A (en) * 2014-03-21 2015-04-29 中电科技(北京)有限公司 UEFI (Unified Extensible Firmware Interface) firmware implementation method based on Loongson desk computer

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5519712B2 (en) * 2012-01-20 2014-06-11 レノボ・シンガポール・プライベート・リミテッド Method of booting a computer and computer

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103294564A (en) * 2012-03-05 2013-09-11 联想(北京)有限公司 Shutdown method, information processing method, and electronic device
CN102955921A (en) * 2012-10-19 2013-03-06 威盛电子股份有限公司 Electronic device and safe starting method
CN104572163A (en) * 2014-03-21 2015-04-29 中电科技(北京)有限公司 UEFI (Unified Extensible Firmware Interface) firmware implementation method based on Loongson desk computer

Also Published As

Publication number Publication date
CN107346162A (en) 2017-11-14

Similar Documents

Publication Publication Date Title
US8484631B2 (en) Supporting hardware configuration changes in a UEFI firmware component
CN109478135B (en) Computer system and method for rebooting a computer system
US8423991B2 (en) Embedded network device and firmware upgrading method
US8001368B2 (en) Hot-pluggable information processing device and setting method
US9116743B2 (en) Storage medium, information processing apparatus, and migration method
US9558016B2 (en) Platform system, method for changing support hardware configuration of universal extensible firmware interface basic input output system and computer program product
US7454547B1 (en) Data exchange between a runtime environment and a computer firmware in a multi-processor computing system
US10572434B2 (en) Intelligent certificate discovery in physical and virtualized networks
US11972243B2 (en) Memory device firmware update and activation without memory access quiescence
US20190004818A1 (en) Method of UEFI Shell for Supporting Power Saving Mode and Computer System thereof
US20220229658A1 (en) Application downtime reduction using detached mode operation during operating system updates
CN111338698A (en) Method and system for accurately booting server by BIOS (basic input output System)
US20070260761A1 (en) Inter-module data communication control method and system for ACPI and BIOS
US20040225874A1 (en) Method for reduced BIOS boot time
TW201342236A (en) Method for updating firmware
CN113377586B (en) Automatic detection method and device for server and storage medium
CN107346162B (en) Power management method and device under UEFI (unified extensible firmware interface)
CN102455919A (en) Automatic optimization setting method for basic input/output system
US9858085B2 (en) Information processing including BIOS apparatus, information processing method thereof, and storage medium
TW201430702A (en) Method and system for updating firmware
CN113778485A (en) System operation method and device of electronic chip, electronic chip and storage medium
CN106933558B (en) Power supply control method and device
CN112559336A (en) Method, device and system for adaptively debugging heterogeneous computing chip and mainboard chip
CN112114882B (en) Mainboard starting method and device
CN115328522A (en) Method and related equipment for realizing immediate effect of SSD firmware upgrade

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20230630

Address after: 518057 1701, Yanxiang science and technology building, 31 Gaoxin middle Fourth Road, Maling community, Yuehai street, Nanshan District, Shenzhen City, Guangdong Province

Patentee after: Yanxiang smart IOT Technology Co.,Ltd.

Address before: 518107 5th floor, No.1, Yanxiang Zhigu chuangxiangdi, No.11, Gaoxin Road, Guangming New District, Shenzhen City, Guangdong Province

Patentee before: EVOC INTELLIGENT TECHNOLOGY Co.,Ltd.