Method and device for acquiring hot key information and computer program product
By initializing the UART controller and redirecting input and output during the PEI phase of BIOS startup, and receiving hotkey information, the problem of long waiting time for the BIOS hotkey function is solved, enabling quick entry into the BIOS setting interface and improving the user experience.
Patent Information
- Application Number
- CN202410703713.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-30
AI Technical Summary
The implementation of the existing BIOS hotkey function requires waiting for the later stages of the UEFI standard startup process, resulting in long wait times for users from booting to being able to operate the hotkey function, which is inefficient.
During the PEI phase of BIOS startup, initialize the UART controller in the BMC, load the driver of the target UART controller, redirect the input and output of the BIOS to the target UART serial port, and receive hotkey information to trigger entry into the BIOS setup interface during the BDS phase. .
It shortens the waiting time for operating the hot key function, enables users to quickly select startup items during the boot process, and improves operating efficiency.
Smart Images

Figure CN118567728A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the computer field, and in particular, to a method and device for obtaining hotkey information, and a computer program product. Background Art
[0002] With the promotion and application of the Unified Extensible Firmware Interface (UEFI) standard, users can quickly enter the UEFI setting interface through hotkeys to configure and manage the system, which improves user experience and ease of operation. However, the current implementation of the Basic Input / Output System (BIOS) hotkey function always has two dependencies: one is the platform for user interaction; the other is the server external input device. Due to these two dependencies, the implementation of the BIOS hotkey function needs to wait until the Boot Device Selection (BDS) stage in the later stage of the UEFI standard boot process. Therefore, there are disadvantages such as the user's waiting time from booting to being able to operate the hotkey function is too long, the time interval from booting to effective hotkey input is unpredictable, and the efficiency is low. Summary of the invention
[0003] The embodiments of the present application provide a method and apparatus for obtaining hotkey information, and a computer program product, so as to at least solve the problem of long waiting time for operating hotkey functions in the related art.
[0004] According to an embodiment of the present application, a method for obtaining hotkey information is provided, which is applied to a basic input and output system BIOS, wherein the BIOS is deployed in a server, and the server also includes a baseboard management controller BMC connected to the BIOS, and the method includes: in a PEI phase started by the BIOS, initializing multiple UART controllers set in the BMC, and loading a UART driver corresponding to a target UART controller to start the target UART controller, wherein the target UART controller is a controller with serial communication capability among the multiple UART controllers, and the PEI phase is used to indicate the phase of initializing and configuring the hardware devices in the server segment; when the target UART controller is in the started state, it is determined from the target configuration information that the target UART controller is allowed to be redirected, and when the target UART device corresponding to the target UART controller is determined, the input and output of the BIOS are redirected to the target UART serial port connected to the target UART device; hotkey information sent by the target device is received through the target UART serial port, wherein the hotkey information is used to trigger entry into the BIOS setup interface in the BDS stage of the BIOS startup, the BIOS setup interface is used to set the configuration parameters of the server, and the BDS stage is used to indicate the stage of starting the hardware devices in the server.
[0005] In an exemplary embodiment, in the PEI phase of the BIOS startup, multiple UART controllers set in the BMC are initialized, and a UART driver corresponding to the target UART controller is loaded to start the target UART controller, including: determining a UART controller in an idle state to obtain multiple UART controllers, wherein one UART controller corresponds to one UART device; reading a base address and a memory range of each UART controller in the memory of the server, and writing first serial communication information in the memory range based on a serial communication protocol and the base address to initialize the multiple UART controllers, wherein the first serial communication information is used to instruct the UART controller to perform serial communication according to a communication format set by the serial communication protocol; determining the target UART controller from the multiple UART controllers according to preset performance information, wherein the preset performance information includes at least one of the following: data transmission speed, supported data format, and interface type supported by the UART controller; loading the UART read and write functions supported by the target UART controller in the UART driver to start the target UART controller, wherein the UART read and write functions are read and write functions determined based on the UART protocol.
[0006] In an exemplary embodiment, when the target UART controller is in an activated state, it is determined from the target configuration information that the target UART controller is allowed to be redirected, and when the target UART device corresponding to the target UART controller is determined, before redirecting the input and output of the BIOS to the target UART serial port connected to the target UART device, the method further includes: reading the redirection field in the target configuration information, and when the redirection field is the target field, determining that the target UART controller is allowed to be redirected; reading the target UART device field in the target configuration information, and determining the target UART device matching the target UART controller from multiple UART devices in an idle state according to the target UART device field.
[0007] In an exemplary embodiment, when the target UART controller is in a started state, it is determined from the target configuration information that the target UART controller is allowed to be redirected, and when the target UART device corresponding to the target UART controller is determined, the input and output of the BIOS are redirected to the target UART serial port connected to the target UART device, including: when the target UART controller is in a started state, setting the second serial communication information of the target UART serial port in the configuration interface of the BMC, wherein the second serial communication information is used to instruct the target UART serial port to perform serial communication according to the communication format set by the serial communication protocol; establishing a first serial communication transmission channel between the BIOS and the target UART device through the target UART serial port; and redirecting the input and output of the BIOS to the target UART serial port through the first serial communication transmission channel.
[0008] In an exemplary embodiment, before receiving the hotkey information sent by the target device through the target UART serial port, the method further includes: receiving a SOL startup command sent by the BMC, and responding to the SOL startup command, configuring third serial communication information of the target device, wherein the third serial communication information is used to instruct the target device to perform serial communication according to the communication format set by the serial communication protocol, and the SOL startup command is used to implement serial communication through a local area network; receiving an IPMI session redirection command sent by the target device, and responding to the IPMI session redirection command, establishing a second serial communication transmission channel between the target device and the target UART serial port, and the IPMI session redirection command is used to establish a connection relationship between the target device and the target UART device in the BMC; transmitting the input and output of the BIOS to the target device through the second serial communication transmission channel; and outputting hotkey prompt information when it is determined that the target device responds to the input and output of the BIOS, wherein the hotkey prompt information is used to prompt the target device to trigger a hotkey operation.
[0009] In an exemplary embodiment, receiving hotkey information sent by a target device through the target UART serial port includes: receiving the hotkey information sent by a serial port console through the target UART serial port, wherein the serial port console is a controller set in the target device, and the hotkey information is determined by the serial port console in the following manner: receiving a target hotkey operation, converting the target hotkey operation into the hotkey information according to a preset escape sequence, wherein the target hotkey operation is used to load the startup item started by the BIOS.
[0010] In an exemplary embodiment, after receiving the hotkey information sent by the serial port console through the target UART serial port, the method further includes: when the target hotkey operation is identified from the hotkey information, storing the hotkey information; when the BIOS starts to enter the BDS stage and the stored hotkey information is obtained, triggering entry into the BIOS setting interface based on the hotkey information to set the configuration parameters of the server in the BIOS setting interface.
[0011] According to another embodiment of the present application, there is provided a device for obtaining hotkey information, which is applied to a basic input and output system BIOS, wherein the BIOS is deployed in a server, and the server also includes a baseboard management controller BMC connected to the BIOS, and the device includes: a first startup module, which is used to initialize multiple UART controllers set in the BMC during the PEI phase of the BIOS startup, and load a UART driver corresponding to a target UART controller to start the target UART controller, wherein the target UART controller is a controller with serial communication capability among the multiple UART controllers, and the PEI phase is used to indicate a phase of initializing and configuring hardware devices in the server; a first A determination module, used to, when the target UART controller is in the started state, determine from the target configuration information that the target UART controller is allowed to be redirected, and when the target UART device corresponding to the target UART controller is determined, redirect the input and output of the BIOS to the target UART serial port connected to the target UART device; a first receiving module, used to receive hotkey information sent by the target device through the target UART serial port, wherein the hotkey information is used to trigger entry into the BIOS setup interface during the BDS phase of BIOS startup, the BIOS setup interface is used to set the configuration parameters of the server, and the BDS phase is used to indicate the phase of starting the hardware devices in the server.
[0012] In an exemplary embodiment, the first startup module includes: a first determination submodule, used to determine a UART controller in an idle state, and obtain multiple UART controllers, wherein one UART controller corresponds to one UART device; a first reading submodule, used to read the base address and memory range of each UART controller in the memory of the server, and write first serial communication information in the memory range based on the serial communication protocol and the base address to initialize the multiple UART controllers, wherein the first serial communication information is used to instruct the UART controller to perform serial communication according to the communication format set by the serial communication protocol; a first determination submodule, used to determine the target UART controller from the multiple UART controllers according to preset performance information, wherein the preset performance information includes at least one of the following: data transmission speed, supported data format, and interface type supported by the UART controller; a first loading submodule, used to load the UART read and write functions supported by the target UART controller in the UART driver to start the target UART controller, wherein the UART read and write functions are read and write functions determined based on the UART protocol.
[0013] In an exemplary embodiment, the above-mentioned device also includes: a first reading module, which is used to determine from the target configuration information that the above-mentioned target UART controller is allowed to be redirected when the above-mentioned target UART controller is in an started state, and when the target UART device corresponding to the above-mentioned target UART controller is determined, before redirecting the input and output of the above-mentioned BIOS to the target UART serial port connected to the above-mentioned target UART device, read the redirection field in the above-mentioned target configuration information, and when the above-mentioned redirection field is the target field, determine that the above-mentioned target UART controller is allowed to be redirected; a second reading module, which is used to read the target UART device field in the above-mentioned target configuration information, and determine the above-mentioned target UART device matching the above-mentioned target UART controller from multiple UART devices in an idle state according to the above-mentioned target UART device field.
[0014] In an exemplary embodiment, the above-mentioned first determination module includes: a first setting submodule, used to set the second serial communication information of the above-mentioned target UART serial port in the configuration interface of the above-mentioned BMC when the above-mentioned target UART controller is in an started state, wherein the above-mentioned second serial communication information is used to instruct the above-mentioned target UART serial port to perform serial communication according to the communication format set by the serial communication protocol; a first establishment submodule, used to establish a first serial communication transmission channel between the above-mentioned BIOS and the above-mentioned target UART device through the above-mentioned target UART serial port; and a first redirection submodule, used to redirect the input and output of the above-mentioned BIOS to the above-mentioned target UART serial port through the above-mentioned first serial communication transmission channel.
[0015] In an exemplary embodiment, the apparatus further includes: a second receiving module, for receiving a SOL startup command sent by the BMC before receiving the hotkey information sent by the target device through the target UART serial port, and responding to the SOL startup command to configure third serial communication information of the target device, wherein the third serial communication information is used to instruct the target device to perform serial communication according to the communication format set by the serial communication protocol, and the SOL startup command is used to implement serial communication through a local area network; a second receiving module, for receiving an IPMI session redirection command sent by the target device, and responding to the IPMI session redirection command to establish a second serial communication transmission channel between the target device and the target UART serial port, wherein the IPMI session redirection command is used to establish a connection relationship between the target device and the target UART device in the BMC; a first transmission module, for transmitting the input and output of the BIOS to the target device through the second serial communication transmission channel; and a first output module, for outputting hotkey prompt information when it is determined that the target device responds to the input and output of the BIOS, wherein the hotkey prompt information is used to prompt the target device to trigger a hotkey operation.
[0016] In an exemplary embodiment, the above-mentioned first receiving module includes: a first receiving sub-module, used to receive the above-mentioned hotkey information sent by the serial port console through the above-mentioned target UART serial port, wherein the above-mentioned serial port console is a controller set in the above-mentioned target device, and the above-mentioned hotkey information is determined by the above-mentioned serial port console in the following manner: receiving the target hotkey operation, converting the above-mentioned target hotkey operation into the above-mentioned hotkey information according to a preset escape sequence, wherein the above-mentioned target hotkey operation is used to load the startup item started by the above-mentioned BIOS.
[0017] In an exemplary embodiment, the above-mentioned device also includes: a first storage module, which is used to store the above-mentioned hot key information after receiving the above-mentioned hot key information sent by the serial port console through the above-mentioned target UART serial port, when the above-mentioned target hot key operation is identified from the above-mentioned hot key information; a first setting module, which is used to trigger entry into the above-mentioned BIOS setting interface based on the above-mentioned hot key information when the above-mentioned BIOS starts to enter the above-mentioned BDS stage and obtains the above-mentioned stored hot key information, so as to set the configuration parameters of the above-mentioned server in the above-mentioned BIOS setting interface.
[0018] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when running.
[0019] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0020] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0021] Through this application, first, in the PEI stage of BIOS startup, the UART controller in the BMC is initialized, and the UART driver corresponding to the target UART controller is loaded. Then, when it is determined from the target configuration information that the target UART controller is allowed to be redirected, and when it is determined that the target UART device corresponding to the target UART controller is determined, the input and output of the BIOS are redirected to the target UART serial port connected to the target UART device, and the connection between the BIOS serial port and the target UART serial port is established. Finally, the hotkey information sent by the target device is received through the target UART serial port, and the BIOS setting interface is triggered in the BDS stage of BIOS startup. Therefore, the problem of too long waiting time for operating the hotkey function in the related art can be solved, and the effect of shortening the waiting time for operating the hotkey function is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a hardware structure block diagram of a server device of a method for obtaining hot key information in an embodiment of the present application;
[0023] Figure 2 is a flow chart of a method for obtaining hotkey information according to an embodiment of the present application;
[0024] Figure 3 is an architectural diagram of a method for obtaining hotkey information according to a specific embodiment of the present application;
[0025] Figure 4 is a flow chart of a method for obtaining hotkey information according to a specific embodiment of the present application;
[0026] Figure 5 It is a structural block diagram of a device for obtaining hot key information according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0029] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a method for obtaining hot key information in an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0030] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a method for obtaining hot key information in an embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0031] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0032] In this embodiment, a method for obtaining hotkey information is provided, which is applied to a basic input / output system BIOS, wherein the BIOS is deployed in a server, and the server further includes a baseboard management controller BMC connected to the BIOS. Figure 2 is a flow chart of a method for obtaining hot key information according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:
[0033] Step S202, in the PEI phase of BIOS startup, multiple UART controllers set in the BMC are initialized, and a UART driver corresponding to a target UART controller is loaded to start the target UART controller, wherein the target UART controller is a controller with serial communication capability among multiple UART controllers, and the PEI phase is used to represent a phase of initializing and configuring hardware devices in the server;
[0034] Step S204, when the target UART controller is in the started state, it is determined from the target configuration information that the target UART controller allows redirection, and when a target UART device corresponding to the target UART controller is determined, the input and output of the BIOS are redirected to the target UART serial port connected to the target UART device;
[0035] Step S206, receiving hotkey information sent by the target device through the target UART serial port, wherein the hotkey information is used to trigger entry into the BIOS setup interface in the BDS phase of BIOS startup, the BIOS setup interface is used to set the configuration parameters of the server, and the BDS phase is used to indicate the phase of starting the hardware devices in the server.
[0036] Optionally, the UEFI standard BIOS boot process includes the following 7 stages: Security Verification (SEC) → Pre-EFI Initialization (PEI) → Driver Execution Environment (DXE) → Boot Device Selection (BDS) → Transition to Secure Load (TSL) → System Runtime (RT) → System Disaster Recovery or Shutdown (Automatic or Acoustic Alarm, AL). In the related art, the user is allowed to use the BIOS hotkeys as soon as possible after the boot process enters the BDS stage. The PEI stage of BIOS boot in this embodiment is specifically: the time after the BIOS boot is completed after the PEI stage prepares the memory.
[0037] Optionally, a Universal Asynchronous Receiver / Transmitter (UART) driver is a function for executing UART read and write actions, and the above function is packaged according to the UART protocol, which is equivalent to loading the available functions of the UART controller.
[0038] Optionally, the target configuration information may be information about the UART serial port and redirection in the BIOS code library. The BIOS may determine whether to perform the BIOS serial port redirection action and check how many UART devices are currently available based on the BIOS code.
[0039] Optionally, the target device includes but is not limited to a remote server, a computer, etc. that interacts with the BIOS via a local area network.
[0040] Through the above steps, first, in the PEI stage of BIOS startup, the UART controller in the BMC is initialized, and the UART driver corresponding to the target UART controller is loaded. Then, when it is determined from the target configuration information that the target UART controller is allowed to be redirected, and the target UART device corresponding to the target UART controller is determined, the input and output of the BIOS are redirected to the target UART serial port connected to the target UART device, and the connection between the BIOS serial port and the target UART serial port is established. Finally, the hotkey information sent by the target device is received through the target UART serial port, and the BIOS setting interface is triggered in the BDS stage of BIOS startup. Therefore, the problem of too long waiting time for operating the hotkey function in the related art can be solved, and the effect of shortening the waiting time for operating the hotkey function is achieved.
[0041] In an exemplary embodiment, in the PEI phase of the BIOS startup, multiple UART controllers set in the BMC are initialized, and a UART driver corresponding to the target UART controller is loaded to start the target UART controller, including: determining a UART controller in an idle state to obtain multiple UART controllers, wherein one UART controller corresponds to one UART device; reading a base address and a memory range of each UART controller in the memory of the server, and writing first serial communication information in the memory range based on a serial communication protocol and the base address to initialize the multiple UART controllers, wherein the first serial communication information is used to instruct the UART controller to perform serial communication according to a communication format set by the serial communication protocol; determining the target UART controller from the multiple UART controllers according to preset performance information, wherein the preset performance information includes at least one of the following: data transmission speed, supported data format, and interface type supported by the UART controller; loading the UART read and write functions supported by the target UART controller in the UART driver to start the target UART controller, wherein the UART read and write functions are read and write functions determined based on the UART protocol.
[0042] Optionally, in this embodiment, the first serial communication information includes but is not limited to: baud rate-UART communication rate baud rate, data bit-data size of each serial communication transmission, stop bit-marking the end of the data packet, parity check-detecting errors in serial communication transmission, etc. BIOS reads the base address and memory range of UART in the server, and writes the first serial communication information, such as baud rate, etc., in the memory range according to the provisions in the UART protocol, and then loads the UART driver. The specific BIOS can finally judge whether the UART is successfully initialized by basic read operations based on whether the return value is correct. In this embodiment, by initializing the UART controller and loading the UART driver, the purpose of BIOS inputting and outputting in the format of the UART protocol specification is achieved.
[0043] In an exemplary embodiment, when the target UART controller is in an activated state, it is determined from the target configuration information that the target UART controller is allowed to be redirected, and when the target UART device corresponding to the target UART controller is determined, before redirecting the input and output of the BIOS to the target UART serial port connected to the target UART device, the method further includes: reading the redirection field in the target configuration information, and when the redirection field is the target field, determining that the target UART controller is allowed to be redirected; reading the target UART device field in the target configuration information, and determining the target UART device matching the target UART controller from multiple UART devices in an idle state according to the target UART device field.
[0044] Optionally, in this embodiment, the target configuration information may be information about the UART serial port and redirection in the BIOS code library. The BIOS may determine whether to perform the BIOS serial port redirection action and check how many UART devices are currently available based on the BIOS code. The specific redirection field may be a value of 0 or 1, wherein 1 represents that the serial port redirection can be performed, and 0 represents that the serial port redirection cannot be performed. The target UART device field may be the number of the UART device, such as UART3, which represents that the data transmitted by the BIOS will be transmitted through UART3. In this embodiment, by reading the redirection field and the target UART device field, the purpose of subsequently determining the redirection and redirecting to which UART device is achieved.
[0045] In an exemplary embodiment, when the target UART controller is in a started state, it is determined from the target configuration information that the target UART controller is allowed to be redirected, and when the target UART device corresponding to the target UART controller is determined, the input and output of the BIOS are redirected to the target UART serial port connected to the target UART device, including: when the target UART controller is in a started state, setting the second serial communication information of the target UART serial port in the configuration interface of the BMC, wherein the second serial communication information is used to instruct the target UART serial port to perform serial communication according to the communication format set by the serial communication protocol; establishing a first serial communication transmission channel between the BIOS and the target UART device through the target UART serial port; and redirecting the input and output of the BIOS to the target UART serial port through the first serial communication transmission channel.
[0046] Optionally, in this embodiment, a baseboard management controller (Baseboard Management Controller, referred to as BMC) is a microcontroller integrated on a server motherboard, responsible for monitoring and managing the hardware status of the server. If the input and output of BIOS are to be redirected to the target UART serial port to establish a serial communication channel between BIOS and a UART device, it is first necessary to determine that the server or motherboard has a serial over LAN (Serial Over LAN, referred to as SOL) function of the BMC, enable the SOL function, and then set the second serial communication information of the target UART serial port, such as baud rate, data bit, stop bit and parity bit, etc. The second serial communication information should match the first serial communication information configuration in the BIOS, and finally establish the first serial communication transmission channel between the BIOS and the target UART device through the target UART serial port. In this embodiment, by redirecting the input and output of BIOS to the target UART serial port, the BIOS and the target UART device are serially communicated in a communication format set according to the serial communication protocol, replacing the display for input and output.
[0047] In an exemplary embodiment, before receiving the hotkey information sent by the target device through the target UART serial port, the method further includes: receiving a SOL startup command sent by the BMC, and responding to the SOL startup command, configuring third serial communication information of the target device, wherein the third serial communication information is used to instruct the target device to perform serial communication according to the communication format set by the serial communication protocol, and the SOL startup command is used to implement serial communication through a local area network; receiving an IPMI session redirection command sent by the target device, and responding to the IPMI session redirection command, establishing a second serial communication transmission channel between the target device and the target UART serial port, and the IPMI session redirection command is used to establish a connection relationship between the target device and the target UART device in the BMC; transmitting the input and output of the BIOS to the target device through the second serial communication transmission channel; and outputting hotkey prompt information when it is determined that the target device responds to the input and output of the BIOS, wherein the hotkey prompt information is used to prompt the target device to trigger a hotkey operation.
[0048] Optionally, in this embodiment, the third serial communication information and the second serial communication information include but are not limited to: baud rate-UART communication baud rate, data bit-data size of each serial communication transmission, stop bit-marking the end of the data packet, parity check-detecting errors in serial communication transmission, etc. The user can use the SOL function of BMC on the local computer or server using server management software, remote access tools or third-party serial console clients. In the BMC management interface, the user first configures the SOL settings, such as port number, authentication method, etc., then starts the SOL session, and finally opens the Intelligent Platform Management Interface (IPMI) session redirection. After the BIOS successfully responds to the SOL startup command and the IPMI session redirection command, the connection relationship between the target device and the target UART device on the BMC can be established, and the information output by the BIOS to the target UART device on the BMC can be further obtained, and the BIOS interacts with the BIOS. If the interaction is successful, a hot key prompt will be output to prompt the user to enter a hot key operation. In this embodiment, by establishing a connection relationship between the target device and the target UART device on the BMC, the purpose of the target device interacting with the BIOS through the UART driver is achieved.
[0049] In an exemplary embodiment, receiving hotkey information sent by a target device through the target UART serial port includes: receiving the hotkey information sent by a serial port console through the target UART serial port, wherein the serial port console is a controller set in the target device, and the hotkey information is determined by the serial port console in the following manner: receiving a target hotkey operation, converting the target hotkey operation into the hotkey information according to a preset escape sequence, wherein the target hotkey operation is used to load the startup item started by the BIOS.
[0050] Optionally, in the present embodiment, the serial port console is a method for remotely accessing and managing a computer or other device through a serial communication port. After the user receives the hot key prompt information output by BIOS, the hot key operation that can be input in the serial port console, the serial port console can convert the target hot key operation into hot key information according to the escape standard by the hot key operation. For example, the action of the user pressing the F1 1 key will be translated into [0x1b, 0x32, 0x33, 0x7e] according to the ANSI escape sequence definition. The present embodiment receives the hot key information sent by the serial port console based on the target UART serial port, and realizes the purpose of shortening the waiting time for the operation of the hot key function.
[0051] In an exemplary embodiment, after receiving the hotkey information sent by the serial port console through the target UART serial port, the method further includes: when the target hotkey operation is identified from the hotkey information, storing the hotkey information; when the BIOS starts to enter the BDS stage and the stored hotkey information is obtained, triggering entry into the BIOS setting interface based on the hotkey information to set the configuration parameters of the server in the BIOS setting interface.
[0052] Optionally, in this embodiment, when the BIOS recognizes the target hotkey operation in the PEI stage, the hotkey information corresponding to the target hotkey operation will be saved, the hotkey input waiting interface will be exited, and the normal BIOS startup process will be continued until the BDS startup stage. The BIOS first detects whether there is a valid hotkey input in the PEI stage. If so, the corresponding startup item is directly loaded based on the saved hotkey information, and the hardware configuration parameters, such as CPU frequency, memory settings, etc., are adjusted. If not, the default startup process is continued. In this embodiment, by receiving hotkey information in the PEI stage and responding to hotkey information in the BDS stage, the user can quickly select the startup item during the boot process, saving the user's time and improving the operation efficiency.
[0053] The present application is described below in conjunction with specific embodiments:
[0054] In the related art, during the process of power-on self-test operation to entering the operating system, the server allows users to quickly and conveniently enter the BIOS Setup interface or select different boot items through hotkeys, so that users can conveniently manage and configure the computer system. However, the extended functions that can be associated with hotkeys are limited to the hotkey implementation in the later stage of the BIOS startup process, mainly for the selection of boot items. If the system configuration needs to be changed, it is also necessary to restart after the change.
[0055] The UEFI standard BIOS boot process includes the following 7 stages: Security Verification (SEC) → Pre-EFI Initialization (PEI) → Driver Execution Environment (DXE) → Boot Device Selection (BDS) → Transition to Secure Load (TSL) → Runtime (RT) → Automatic or Acoustic Alarm (AL). In this boot process, the preparation work for BIOS hotkey implementation involves the late PEI stage, DXE stage, and early BDS stage, allowing users to use BIOS hotkeys as soon as possible after entering the BDS stage during the boot process.
[0056] In the related art, if a user wants to use the hotkey function, he must wait until the server boot process enters the BDS stage, which has the disadvantages of long waiting time for the user and unpredictable time interval from booting to effective hotkey input. At the same time, for users who need to restart the computer frequently, waiting for hotkey input every time restarting will waste a lot of time and energy, reducing work efficiency.
[0057] In view of the above technical problems, this specific embodiment provides a method for obtaining hotkey information, such as Figure 3 As shown, Figure 3 It is an architectural diagram of a method for obtaining hotkey information according to a specific embodiment of the present application, which is as follows:
[0058] Through the SOL function of BMC, the UART controller of BMC can be redirected through IPMI session, the serial port output of BIOS can be converted into a protocol that conforms to IPMI, a serial communication channel can be established between the BIOS serial port and the UART device, and the input and output of BIOS can be sent to the LAN controller through the SMBus system bus. Other servers and computers in a LAN can use IPMI to receive data from the BIOS serial port on the target server and interact with the BIOS, that is, remote control of the operating system or BIOS through the serial port can be achieved. Specifically, in the hotkey implementation, the user can open the BMC serial port in the serial console of the local computer through the IPMI session. In the serial console, the keyboard has no physical interruption. The action of the user pressing the F1 1 key will be translated into [0x1b, 0x32, 0x33, 0x7e] according to the ANSI escape sequence definition, and this sequence will be passed to the BIOS through the UART serial port for recognition. The specific process is as follows Figure 4 As shown, Figure 4 This is a flow chart of a method for obtaining hotkey information according to a specific embodiment of the present application:
[0059] S402, initializing memory;
[0060] S404, after the BIOS boots up and prepares the memory in the PEI phase, the BIOS reads the base address and memory range of the UART in the server, and writes the first serial communication information, such as the baud rate, etc., in the memory range according to the provisions of the UART protocol, and then loads the UART driver. The specific BIOS can finally determine whether the UART is successfully initialized through basic read operations according to whether the return value is correct, thereby achieving the purpose of initializing the UART controller, loading the UART driver, and the BIOS performing input and output in the format of the UART protocol specification;
[0061] S406, after the BIOS determines whether to perform the BIOS serial port redirection action according to the BIOS code and checks how many UART devices are currently available, it is determined that the server or motherboard has the serial over LAN (Serial Over LAN, SOL) function of the BMC, the SOL function is enabled, and then the second serial communication information of the target UART serial port is set, such as the baud rate, data bit, stop bit and parity bit, etc. The second serial communication information should match the first serial communication information configuration in the BIOS, and finally a first serial communication transmission channel between the BIOS and the target UART device is established through the target UART serial port, the BIOS terminal type setting is read, the corresponding terminal driver is loaded and selected, and the BIOS terminal is redirected to the serial port connected to the target UART device in the BMC;
[0062] S408, in the BMC management interface, the user first configures the SOL settings, such as port number, authentication method, etc., then starts the SOL session, and finally opens the Intelligent Platform Management Interface (IPMI) session redirection. After the BIOS successfully responds to the SOL startup command and the IPMI session redirection command, it can establish a connection between the target device and the target UART device on the BMC, and further obtain the information output by the BIOS to the target UART device on the BMC, and interact with the BIOS. If the interaction is successful, a hotkey prompt will be output to prompt the user to enter the hotkey operation;
[0063] S410, the serial console driver receives key input from the serial port;
[0064] S412, the user inputs the hotkey in the serial console, the serial console reads the input according to the ANSI escape sequence standard, transmits it to the BIOS through the serial port of the target UART device and processes it. When the BIOS recognizes the target hotkey operation in the PEI stage, it will save the hotkey information corresponding to the target hotkey operation, exit the hotkey input waiting interface, and continue the normal BIOS startup process;
[0065] S414, save and pass hotkey options;
[0066] S416, normal execution;
[0067] S418, in the BDS startup phase, the BIOS first detects whether there is a valid hotkey input in the PEI phase. If so, the corresponding startup item is directly loaded based on the saved hotkey information and the hardware configuration parameters are adjusted, such as CPU frequency, memory settings, etc. If not, the default startup process is continued.
[0068] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0069] In the present embodiment, a device for obtaining hotkey information is also provided, which is applied to a basic input and output system BIOS. The BIOS is deployed in a server, and the server also includes a baseboard management controller BMC connected to the BIOS. The device is used to implement the above embodiments and preferred implementations, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0070] Figure 5 is a structural block diagram of a device for obtaining hot key information according to an embodiment of the present application, such as Figure 5 As shown, the device comprises:
[0071] The first startup module 502 is used to initialize the multiple UART controllers set in the above-mentioned BMC during the PEI phase of the above-mentioned BIOS startup, and load the UART driver corresponding to the target UART controller to start the above-mentioned target UART controller, wherein the above-mentioned target UART controller is a controller with serial communication capability among the multiple above-mentioned UART controllers, and the above-mentioned PEI phase is used to represent the phase of initializing and configuring the hardware devices in the above-mentioned server;
[0072] A first determining module 504 is configured to, when the target UART controller is in an activated state, determine from the target configuration information that the target UART controller is allowed to be redirected, and when a target UART device corresponding to the target UART controller is determined, redirect the input and output of the BIOS to a target UART serial port connected to the target UART device;
[0073] The first receiving module 506 is used to receive hotkey information sent by the target device through the above-mentioned target UART serial port, wherein the above-mentioned hotkey information is used to trigger entering the BIOS setting interface in the BDS stage of the above-mentioned BIOS startup, the above-mentioned BIOS setting interface is used to set the configuration parameters of the above-mentioned server, and the above-mentioned BDS stage is used to indicate the stage of starting the hardware device in the above-mentioned server.
[0074] In an exemplary embodiment, the first startup module includes: a first determination submodule, used to determine a UART controller in an idle state, and obtain multiple UART controllers, wherein one UART controller corresponds to one UART device; a first reading submodule, used to read the base address and memory range of each UART controller in the memory of the server, and write first serial communication information in the memory range based on the serial communication protocol and the base address to initialize the multiple UART controllers, wherein the first serial communication information is used to instruct the UART controller to perform serial communication according to the communication format set by the serial communication protocol; a first determination submodule, used to determine the target UART controller from the multiple UART controllers according to preset performance information, wherein the preset performance information includes at least one of the following: data transmission speed, supported data format, and interface type supported by the UART controller; a first loading submodule, used to load the UART read and write functions supported by the target UART controller in the UART driver to start the target UART controller, wherein the UART read and write functions are read and write functions determined based on the UART protocol.
[0075] In an exemplary embodiment, the above-mentioned device also includes: a first reading module, which is used to determine from the target configuration information that the above-mentioned target UART controller is allowed to be redirected when the above-mentioned target UART controller is in an started state, and when the target UART device corresponding to the above-mentioned target UART controller is determined, before redirecting the input and output of the above-mentioned BIOS to the target UART serial port connected to the above-mentioned target UART device, read the redirection field in the above-mentioned target configuration information, and when the above-mentioned redirection field is the target field, determine that the above-mentioned target UART controller is allowed to be redirected; a second reading module, which is used to read the target UART device field in the above-mentioned target configuration information, and determine the above-mentioned target UART device matching the above-mentioned target UART controller from multiple UART devices in an idle state according to the above-mentioned target UART device field.
[0076] In an exemplary embodiment, the above-mentioned first determination module includes: a first setting submodule, used to set the second serial communication information of the above-mentioned target UART serial port in the configuration interface of the above-mentioned BMC when the above-mentioned target UART controller is in an started state, wherein the above-mentioned second serial communication information is used to instruct the above-mentioned target UART serial port to perform serial communication according to the communication format set by the serial communication protocol; a first establishment submodule, used to establish a first serial communication transmission channel between the above-mentioned BIOS and the above-mentioned target UART device through the above-mentioned target UART serial port; and a first redirection submodule, used to redirect the input and output of the above-mentioned BIOS to the above-mentioned target UART serial port through the above-mentioned first serial communication transmission channel.
[0077] In an exemplary embodiment, the apparatus further includes: a second receiving module, for receiving a SOL startup command sent by the BMC before receiving the hotkey information sent by the target device through the target UART serial port, and responding to the SOL startup command to configure third serial communication information of the target device, wherein the third serial communication information is used to instruct the target device to perform serial communication according to the communication format set by the serial communication protocol, and the SOL startup command is used to implement serial communication through a local area network; a second receiving module, for receiving an IPMI session redirection command sent by the target device, and responding to the IPMI session redirection command to establish a second serial communication transmission channel between the target device and the target UART serial port, wherein the IPMI session redirection command is used to establish a connection relationship between the target device and the target UART device in the BMC; a first transmission module, for transmitting the input and output of the BIOS to the target device through the second serial communication transmission channel; and a first output module, for outputting hotkey prompt information when it is determined that the target device responds to the input and output of the BIOS, wherein the hotkey prompt information is used to prompt the target device to trigger a hotkey operation.
[0078] In an exemplary embodiment, the above-mentioned first receiving module includes: a first receiving sub-module, used to receive the above-mentioned hotkey information sent by the serial port console through the above-mentioned target UART serial port, wherein the above-mentioned serial port console is a controller set in the above-mentioned target device, and the above-mentioned hotkey information is determined by the above-mentioned serial port console in the following manner: receiving the target hotkey operation, converting the above-mentioned target hotkey operation into the above-mentioned hotkey information according to a preset escape sequence, wherein the above-mentioned target hotkey operation is used to load the startup item started by the above-mentioned BIOS.
[0079] In an exemplary embodiment, the above-mentioned device also includes: a first storage module, which is used to store the above-mentioned hot key information after receiving the above-mentioned hot key information sent by the serial port console through the above-mentioned target UART serial port, when the above-mentioned target hot key operation is identified from the above-mentioned hot key information; a first setting module, which is used to trigger entry into the above-mentioned BIOS setting interface based on the above-mentioned hot key information when the above-mentioned BIOS starts to enter the above-mentioned BDS stage and obtains the above-mentioned stored hot key information, so as to set the configuration parameters of the above-mentioned server in the above-mentioned BIOS setting interface.
[0080] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0081] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0082] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0083] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0084] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0085] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0086] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0087] The embodiments of the present application also provide a computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any one of the above method embodiments.
[0088] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0089] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0090] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for obtaining hot key information, characterized in that: Applied to a basic input and output system BIOS, the BIOS is deployed in a server, and the server also includes a baseboard management controller BMC connected to the BIOS. The method includes: in a PEI phase when the BIOS is started, initializing multiple UART controllers set in the BMC, and loading a UART driver corresponding to a target UART controller to start the target UART controller, wherein the target UART controller is a controller with serial communication capability among the multiple UART controllers, and the PEI phase is used to represent a phase of initializing and configuring hardware devices in the server; When the target UART controller is in a started state, it is determined from the target configuration information that the target UART controller allows redirection, and when a target UART device corresponding to the target UART controller is determined, the input and output of the BIOS are redirected to a target UART serial port connected to the target UART device; Hot key information sent by the target device is received through the target UART serial port, wherein the hot key information is used to trigger entry into a BIOS setup interface during the BDS phase of BIOS startup, the BIOS setup interface is used to set configuration parameters of the server, and the BDS phase is used to indicate a phase for starting a hardware device in the server.
2. The method according to claim 1, characterized in that In the PEI phase of the BIOS startup, multiple UART controllers set in the BMC are initialized, and a UART driver corresponding to a target UART controller is loaded to start the target UART controller, including: Determine a UART controller in an idle state, and obtain a plurality of the UART controllers, wherein one UART controller corresponds to one UART device; Reading a base address and a memory range of each of the UART controllers in the memory of the server, and writing first serial communication information in the memory range based on a serial communication protocol and the base address to initialize the plurality of UART controllers, wherein the first serial communication information is used to instruct the UART controllers to perform serial communication according to a communication format set by the serial communication protocol; Determining the target UART controller from the plurality of UART controllers according to preset performance information, wherein the preset performance information includes at least one of the following: data transmission speed, supported data format, and interface type supported by the UART controller; The UART read / write function supported by the target UART controller in the UART driver is loaded to start the target UART controller, wherein the UART read / write function is a read / write function determined based on the UART protocol.
3. The method according to claim 1, characterized in that When the target UART controller is in a started state, it is determined from the target configuration information that the target UART controller allows redirection, and when a target UART device corresponding to the target UART controller is determined, before redirecting the input and output of the BIOS to the target UART serial port connected to the target UART device, the method further includes: Reading a redirection field in the target configuration information, and determining that the target UART controller is allowed to be redirected when the redirection field is a target field; The target UART device field in the target configuration information is read, and the target UART device matching the target UART controller is determined from a plurality of UART devices in an idle state according to the target UART device field.
4. The method according to claim 1, characterized in that When the target UART controller is in a started state, it is determined from the target configuration information that the target UART controller allows redirection, and when a target UART device corresponding to the target UART controller is determined, the input and output of the BIOS are redirected to a target UART serial port connected to the target UART device, including: When the target UART controller is in a started state, second serial communication information of the target UART serial port is set in the configuration interface of the BMC, wherein the second serial communication information is used to instruct the target UART serial port to perform serial communication according to a communication format set by a serial communication protocol; Establishing a first serial communication transmission channel between the BIOS and the target UART device through the target UART serial port; The input and output of the BIOS are redirected to the target UART serial port through the first serial communication transmission channel.
5. The method according to claim 1, characterized in that Before receiving the hotkey information sent by the target device through the target UART serial port, the method further includes: receiving a SOL startup command sent by the BMC, and in response to the SOL startup command, configuring third serial communication information of the target device, wherein the third serial communication information is used to instruct the target device to perform serial communication according to a communication format set by a serial communication protocol, and the SOL startup command is used to implement serial communication through a local area network; Receiving an IPMI session redirection command sent by the target device, and responding to the IPMI session redirection command to establish a second serial communication transmission channel between the target device and the target UART serial port, wherein the IPMI session redirection command is used to establish a connection relationship between the target device and the target UART device in the BMC; transmitting the input and output of the BIOS to the target device through the second serial communication transmission channel; In the case of determining that the target device responds to the input and output of the BIOS, hotkey prompt information is output, wherein the hotkey prompt information is used to prompt the target device to trigger a hotkey operation.
6. The method according to claim 1, characterized in that Receiving hotkey information sent by the target device through the target UART serial port includes: The hotkey information sent by the serial port console is received through the target UART serial port, wherein the serial port console is a controller set in the target device, and the hotkey information is determined by the serial port console in the following manner: receiving a target hotkey operation, and converting the target hotkey operation into the hotkey information according to a preset escape sequence, wherein the target hotkey operation is used to load the startup item started by the BIOS.
7. The method according to claim 6, characterized in that After receiving the hot key information sent by the serial port console through the target UART serial port, the method further includes: In case the target hotkey operation is identified from the hotkey information, storing the hotkey information; When the BIOS boots up and enters the BDS stage, and the stored hotkey information is obtained, the BIOS setting interface is triggered to enter based on the hotkey information, so as to set the configuration parameters of the server in the BIOS setting interface.
8. A device for obtaining hot key information, characterized in that: Applied to a basic input and output system BIOS, the BIOS is deployed in a server, and the server also includes a baseboard management controller BMC connected to the BIOS. The device includes: a first startup module, which is used to initialize multiple UART controllers set in the BMC during the PEI phase of the BIOS startup, and load a UART driver corresponding to a target UART controller to start the target UART controller, wherein the target UART controller is a controller with serial communication capability among the multiple UART controllers, and the PEI phase is used to indicate a phase of initializing and configuring hardware devices in the server; A first determination module is used for, when the target UART controller is in an activated state, determining from target configuration information that the target UART controller allows redirection, and when a target UART device corresponding to the target UART controller is determined, redirecting the input and output of the BIOS to a target UART serial port connected to the target UART device; The first receiving module is used to receive hotkey information sent by the target device through the target UART serial port, wherein the hotkey information is used to trigger entering the BIOS setup interface in the BDS stage of the BIOS startup, the BIOS setup interface is used to set the configuration parameters of the server, and the BDS stage is used to indicate the stage of starting the hardware device in the server.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 7 when executed by a processor.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Basic input and output system automatic test method, product, equipment and medium
CN119046075A
Basic input and output system automated testing methods, products, equipment and media
CN119046075B
Server
CN120179584A
