Method for dynamically adjusting hardware configuration instruction and electronic apparatus
Patent Information
- Authority / Receiving Office
- TW · TW
- Patent Type
- Patents
- Current Assignee / Owner
- ACER INC
- Filing Date
- 2024-11-26
- Publication Date
- 2026-08-01
AI Technical Summary
The current method of recording hardware configuration commands in BIOS code and compiling them into the BIOS device is inconvenient and time-consuming, especially during hardware testing, requiring repeated flashing or updating, which wastes time.
A method and electronic device that dynamically adjusts hardware configuration instructions by generating a binary raw data file based on the hardware configuration instruction set, writing it to the BIOS variable storage space, and then reading and writing these instructions into temporary registers of hardware devices using BIOS code, allowing independent updates without re-flashing the BIOS.
Enables independent updates of hardware configuration instructions without re-flashing the BIOS, significantly saving testing time for hardware components.
Smart Images

Figure TWG2TB001903688_001 
Figure TWG2TB001903688_002 
Figure TWG2TB001903688_003
Abstract
Description
Technical Field
[0001] This invention relates to an electronic device, and more particularly to a method and electronic device for dynamically adjusting hardware configuration instructions. Prior Technology
[0002] The Basic Input / Output System (BIOS) is firmware loaded after a computer device is powered on and before the operating system runs. The BIOS checks the computer device's hardware and performs hardware initialization. It also provides runtime services to the operating system, such as power management and hardware configuration.
[0003] During the BIOS boot process, various hardware configuration commands are typically issued to the temporary registers of some hardware devices. As computer hardware designs differ, these hardware configuration commands also need to be modified accordingly. For example, due to variations in the pin widget designs of different motherboards, the hardware configuration commands for the audio processor must be different. Currently, the hardware configuration command set is generally recorded in the BIOS code and compiled before being burned into the BIOS device. However, when a change in the hardware configuration command set is required, developers need to re-flash or update the BIOS device, which is relatively inconvenient and time-consuming. This is especially true when developers need to test the hardware within the computer; repeatedly flashing or updating the BIOS is a significant waste of time. Summary of the Invention
[0004] In view of this, the present invention proposes a method and electronic device for dynamically adjusting hardware configuration instructions, which can solve the above-mentioned technical problems.
[0005] This invention provides a method for dynamically adjusting hardware configuration instructions, applicable to electronic devices including a Basic Input / Output System (BIOS) device and hardware devices. The method includes the following steps: Generating a binary raw data file based on a hardware configuration instruction set of the hardware device, wherein the hardware configuration instruction set includes at least one hardware configuration instruction; writing the binary raw data file to the BIOS variable storage space of the BIOS device; reading the hardware configuration instruction from the binary raw data file from the BIOS variable storage space by executing BIOS code; and writing the hardware configuration instruction read from the BIOS variable storage space into a temporary register of the hardware device by executing BIOS code.
[0006] This invention provides an electronic device including a BIOS device, a hardware device, and a processor. The processor is coupled to the BIOS device and the hardware device and configured to perform the following operations: A binary raw data file is generated according to a hardware configuration instruction set of the hardware device, wherein the hardware configuration instruction set includes at least one hardware configuration instruction. The binary raw data file is written to the BIOS variable storage space of the BIOS device. The hardware configuration instruction in the binary raw data file is read from the BIOS variable storage space by executing BIOS code. The hardware configuration instruction read from the BIOS variable storage space is written to a temporary register of the hardware device by executing BIOS code.
[0007] Based on the above, in embodiments of the present invention, hardware configuration instructions are written to the BIOS variable storage space, and the hardware configuration instructions recorded in the BIOS variable storage space are written to the temporary register of the hardware device by executing BIOS code. Therefore, developers can independently update the hardware configuration instructions required by the hardware device without re-flashing the BIOS device, thereby significantly saving testing time for hardware components. Simple Explanation of the Diagram
[0008] Figure 1 is a block diagram of an electronic device according to an embodiment of the present invention. Figure 2 is a flowchart of a method for dynamically adjusting hardware configuration instructions according to an embodiment of the present invention. Figure 3 is a schematic diagram of a method for dynamically adjusting hardware configuration instructions according to an embodiment of the present invention. Figure 4 is a flowchart of writing a binary raw data file into the BIOS variable storage space according to an embodiment of the present invention. Figure 5 is a flowchart of writing hardware configuration instructions into a temporary register of a hardware device according to an embodiment of the present invention. Implementation
[0009] Some embodiments of the present invention will now be described in detail with reference to the accompanying drawings. Component symbols used in the following description are considered identical or similar when they appear in different drawings. These embodiments are only a part of the present invention and do not disclose all possible implementations of the invention. More precisely, these embodiments are merely examples of the methods and apparatuses within the scope of the present invention's patent application.
[0010] Figure 1 is a block diagram of an electronic device according to an embodiment of the present invention. Referring to Figure 1, the electronic device 100 is a computer device having a basic input / output system (BIOS), such as a notebook computer or a desktop computer, etc. The electronic device 100 may include a basic input / output system device 110, hardware device 120, input device 130, display 140, and processor 150. This processor 150 is coupled to the basic input / output system device 110, output device 130, and input device 140.
[0011] The Basic Input / Output System (PIOS) device 110 stores Basic Input / Output System Code B1. Basic Input / Output System Code B1 is the first piece of code executed after the electronic device 100 is powered on. In some embodiments, the PIOS device 110 may be, for example, electrically-erasable programmable read-only memory (EEPROM). In other embodiments, the PIOS device 110 may be, for example, flash memory. Alternatively, the PIOS device 110 may be a chip storing system firmware such as Basic Input / Output System Code B1. When the electronic device 100 is powered on, Basic Input / Output System Code B1 is executed to initialize and detect various hardware devices on the electronic device 100.
[0012] In addition, in some embodiments, the electronic device 100 may also include system memory (not shown), such as any type of volatile random access memory (RAM).
[0013] Hardware device 120 includes a register for storing a hardware configuration instruction set. In one embodiment, hardware device 120 may be an audio processor (also known as an audio codec). Alternatively, in another embodiment, hardware device 120 may be an embedded controller (EC). During the power-on process of electronic device 100, basic input / output system code B1 writes one or more hardware configuration instructions from the hardware configuration instruction set into the register of hardware device 120.
[0014] The input device 130 is used to receive user commands input by the user. The input device 130 may be a keyboard, mouse, or touch device, etc., and the present invention is not limited thereto.
[0015] The display 140 is used to display information, setting interface, and operation interface. In different embodiments, the display 140 may be a liquid crystal display (LCD), a light-emitting diode (LED) display, an organic light-emitting diode (OLED) display, or other types of displays, and the present invention is not limited thereto.
[0016] Processor 150 may be, for example, a central processing unit (CPU), an application processor (AP), or other programmable general-purpose or special-purpose microprocessor, digital signal processor (DSP), or other similar device, integrated circuit, or combination thereof. Processor 150 may access and execute program code, instructions, or program codes recorded in the basic input / output system device 110 and system memory to implement the method of dynamically adjusting hardware configuration instructions in embodiments of the present invention.
[0017] Figure 2 is a flowchart of a method for dynamically adjusting hardware configuration instructions according to an embodiment of the present invention, and the method flowchart in Figure 2 can be implemented by the electronic device 100 in Figure 1. Referring to Figures 1 and 2, the steps of the method for dynamically adjusting hardware configuration instructions according to this embodiment will be described below with reference to the various components of the electronic device 100 in Figure 1. In addition, for the purpose of clearly explaining the present invention, Figure 3 will be used as an aid in the following description.
[0018] In step S210, the processor 150 generates a binary raw data file F1 according to the hardware configuration instruction set of the hardware device 120. The hardware configuration instruction set may include at least one hardware configuration instruction.
[0019] In some embodiments, the hardware device 120 may be an audio processor, and the hardware configuration instruction set may include a Verb-Table for the audio processor. The Verb-Table is a sequence of commands for configuring and controlling the audio processor, and includes at least one hardware configuration instruction for writing to a register R1 of the hardware device 120. Alternatively, in some embodiments, the hardware device 120 may be an embedded controller, and the hardware configuration instruction set may include a thermal table for controlling a fan.
[0020] In some embodiments, the processor 150 may define the file format of the binary raw data file F1. Specifically, based on the need for subsequent operations to write the binary raw data file F1 to the BIOS variable storage space 31 of the BIOS device, the file format of the binary raw data file F1 may be defined according to the requirements of the unified extensible firmware interface tool (UEFI tool). For example, the file extension of the binary raw data file F1 may be ".bin". Next, the processor 150 may convert the hardware configuration instruction set of the hardware device 120 into the binary raw data file F1 according to the file format of the binary raw data file F1. In some embodiments, the processor 150 may execute tools under the Windows operating system to generate the binary raw data file F1. For example, the processor 150 may convert the hardware configuration instruction set of the hardware device 120 into the binary raw data file F1 through a programming language (such as C language, etc.) or command-line tools.
[0021] In step S220, the processor 150 writes the binary raw data file F1 to the BIOS variable storage space 31 of the BIOS device 110. In some embodiments, the processor 150 can use UEFI tools to write the data in the binary raw data file F1 to the BIOS variable storage space 31 of the BIOS device 110. Specifically, since the file format of the binary raw data file F1 is predefined, the processor 150 can parse the hardware configuration instructions in the binary raw data file F1 and write the hardware configuration instructions in the binary raw data file F1 to the BIOS variable storage space 31.
[0022] In some embodiments, the BIOS variable storage space 31 includes non-volatile random access memory (NVRAM) space of the BIOS device 110. The NVRAM space of the BIOS device 110 is readable and writable and can be considered a specific storage area within the BIOS device 110. Generally, the NVRAM space of the BIOS device 110 can be used to store BIOS variables, system variables, or user settings.
[0023] In detail, referring to Figure 3, the storage space of the BIOS device 110 may include a BIOS variable storage space 31 and BIOS code storage spaces 32 and 33. The BIOS variable storage space 31 is used to record BIOS variables or system variables. The BIOS code storage spaces 32 and 33 are used to record compiled BIOS code B1. In other words, the BIOS code storage spaces 32 and 33 can be used to record BIOS image files. For example, the BIOS code storage space 32 is used to record the code of the SEC stage and PEI stage in the POST procedure. The BIOS code storage space 32 is also used to record the code of the DXE stage in the POST procedure. In some embodiments, the binary raw data file F1 can be written to the BIOS variable storage space 31 of the BIOS device 110 through the Unified Extensible Firmware Interface Tool (UEFI tool). For example, the processor 150 can execute a file with the extension ".efi" to write the binary data in the binary raw data file F1 to the BIOS variable storage space 31. In some embodiments, the binary raw data file F1 includes at least one hardware configuration instruction, and each hardware configuration instruction has a corresponding instruction index.
[0024] In step S230, after the electronic device 100 is powered on, the processor 150 reads the hardware configuration instructions from the binary raw data file F1 from the BIOS variable storage space 31 by executing BIOS code B1. In some embodiments, after the electronic device 100 is powered on, the processor 150 begins executing BIOS code B1. When the processor 150 executes the hardware configuration instruction write module 34 in BIOS code B1, the processor 150 can read the hardware configuration instructions from the binary raw data file F1 from the BIOS variable storage space 31.
[0025] In step S240, by executing BIOS code B1, processor 150 writes the hardware configuration instructions read from BIOS variable storage space 31 into register R1 of hardware device 120. In some embodiments, register R1 of hardware device 120 may be a configuration default register. As shown in FIG3, hardware configuration instruction writing module 34 may be recorded in BIOS code storage space 32. When processor 150 executes hardware configuration instruction writing module 34 in BIOS code B1, processor 150 may write the hardware configuration instructions read from BIOS variable storage space 31 into register R1. The hardware configuration instructions may be written into register R1 of hardware device 120 during the PEI stage of the POST procedure.
[0026] Therefore, compared to the traditional method of recording the hardware configuration instruction set of hardware device 120 in the BIOS code, this embodiment of the invention records the hardware configuration instruction set of hardware device 120 in the readable and writable BIOS variable storage space 31. Thus, this embodiment of the invention can update the hardware configuration instruction set of hardware device 120 separately while the system is running, without having to re-flash the BIOS device 110.
[0027] The following will describe embodiments of writing binary raw data file F1 into BIOS variable storage space 31 and writing hardware configuration instructions into temporary register R1 of hardware device 120.
[0028] Figure 4 is a flowchart of writing a binary raw data file into the BIOS variable storage space according to an embodiment of the present invention. The method flow in Figure 4 can be implemented by the electronic device 100 in Figure 1. Referring to Figures 1 and 4, the steps of this embodiment will be described below with reference to the various components of the electronic device 100 in Figure 1.
[0029] It should be noted that, in some embodiments, the steps shown in FIG4 can be implemented by the processor 150 executing a file with the extension ".efi". In step S402, the processor 150 confirms the user command entered by the user in the configuration interface (e.g., the BIOS configuration interface). For example, the user can issue user commands through the command line or command options of the configuration interface.
[0030] In step S404, the processor 150 determines whether a first user instruction has been received via a configuration interface. The first user instruction is used to indicate the instruction index of the hardware configuration instruction to be updated. If step S404 determines that it is yes, in step S406, in response to receiving the first user command through the Unified Extensible Firmware Interface tool, the processor 150 verifies whether the binary raw data file includes at least one instruction index indicated by the first user command.
[0031] If step S406 determines yes, in step S408, in response to the binary raw data file including at least one instruction index indicating the first user command, processor 150 establishes a flag #Flag 1 equal to a preset value. The preset value is, for example, 1, and flag #Flag 1 is recorded in the BIOS variable storage space of the BIOS device 110. In step S410, processor 150 reports a success execution code. If step S406 determines no, in step S426, processor 150 reports an error code.
[0032] If step S404 determines no, in step S412, processor 150 determines whether a second user command is received via a settings interface. If step S412 determines yes, in step S414, in response to receiving a second user command via a unified extensible firmware interface tool, processor 150 determines whether flag #Flag 1 is equal to a default value.
[0033] If step S414 determines yes, in step S416, reflecting that flag #Flag 1 equals the default value, processor 150 confirms whether the hardware configuration instruction corresponding to at least one instruction index exists in the binary raw data file. If step S414 or step S416 determines no, in step S426, processor 150 reports an error code.
[0034] If step S416 determines that it is true, in step S418, in response to the presence of a hardware configuration instruction corresponding to at least one instruction index in the binary raw data file, processor 150 establishes flags #Flag 2 and #Flag 3 associated with the storage location of the hardware configuration instruction. Furthermore, in response to the presence of a hardware configuration instruction corresponding to at least one instruction index in the binary raw data file, processor 150 writes the hardware configuration instruction corresponding to at least one instruction index to the BIOS variable storage space of the BIOS device 110. In step S420, processor 150 reports a success execution code.
[0035] If step S412 determines no, in step S422, processor 150 determines whether to receive a third-party user instruction. If step S422 determines yes, in step S424, processor 150 performs a checksum verification of the binary raw data file to verify whether the binary raw data file recorded in the BIOS variable storage space is complete and correct.
[0036] Figure 5 is a flowchart of writing hardware configuration instructions into a temporary register of a hardware device according to an embodiment of the present invention. The method flow of Figure 5 can be implemented by the electronic device 100 of Figure 1. Referring to Figures 1 and 5, the steps of this embodiment will be described below with reference to the various components of the electronic device 100 in Figure 1.
[0037] In step S502, the electronic device 100 is powered on. In step S504, by executing BIOS code B1, the processor 150 confirms flag #Flag 1. In step S508, in response to flag #Flag 1 not being equal to the default value or not existing, the processor 150 completes the POST procedure. Additionally, in step S506, in response to flag #Flag 1 being equal to the default value, the processor 150 reads hardware configuration instructions from the binary raw data file in the BIOS variable storage space. For example, the processor 150 can call a hook function to read the hardware configuration instructions recorded in the BIOS variable storage space. The processor 150 can read the hardware configuration instructions recorded in the BIOS variable storage space according to flags #Flag 2 and #Flag 3 associated with the hardware configuration instruction storage location. As shown in the flowchart of Figure 4, when the binary raw data file includes at least one instruction index indicated by a first user command, the processor 150 establishes flag #Flag 1 equal to the default value. When the binary raw data file includes user-specified hardware configuration instructions, processor 150 establishes flags #Flag 2 and #Flag 3 associated with the hardware configuration instruction storage location. In step S510, by executing BIOS code B1, processor 150 writes the hardware configuration instructions recorded in the BIOS variable storage space to the temporary register of hardware device 120. In step S512, processor 150 restarts electronic device 100.
[0038] In summary, in the embodiments of the present invention, hardware configuration instructions are written to the BIOS variable storage space, and the hardware configuration instructions recorded in the BIOS variable storage space are written to the temporary register of the hardware device by executing the BIOS code. Therefore, developers can independently update the hardware configuration instructions required by the hardware device without re-flashing the BIOS device or recompiling the BIOS code, thereby significantly saving testing time for hardware components.
[0039] Although the present invention has been disclosed above by way of embodiments, it is not intended to limit the present invention. Anyone skilled in the art can make some modifications and refinements without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims.
[0040] 100: Electronic devices 110: Basic Input / Output System 120: Hardware 130: Input device 140: Monitor 150: Processor B1: Basic Input / Output System Code 31: BIOS variable storage space 32, 33: BIOS code storage space 34: Hardware configuration instruction writing module R1: Temporary Register F1: Binary Raw Data Archive S210~S240, S402~S426, S502~S512: Steps
Claims
1. A method for dynamically adjusting hardware configuration instructions, applicable to an electronic device including a Basic Input / Output System (BIOS) device and hardware devices, the method comprising: A binary raw data file is generated according to the hardware configuration instruction set of the hardware device, wherein the hardware configuration instruction set includes at least one hardware configuration instruction, and the hardware device includes a register for recording the hardware configuration instruction set; the binary raw data file is written to the BIOS variable storage space of the BIOS device; the hardware configuration instruction in the binary raw data file is read from the BIOS variable storage space by executing BIOS code; and the hardware configuration instruction read from the BIOS variable storage space is written to the register of the hardware device by executing the BIOS code.
2. The method for dynamically adjusting hardware configuration instructions as described in claim 1, wherein the BIOS variable storage space includes the non-volatile random access memory (NVRAM) space of the BIOS device.
3. The method for dynamically adjusting hardware configuration instructions as described in claim 1, wherein the step of reading the hardware configuration instructions from the binary raw data file by executing the BIOS code includes: Confirm a flag; If the flag equals a preset value, the hardware configuration instructions are read from the binary raw data file in the BIOS variable storage space; and if the flag does not equal a preset value or does not exist, the Power-On Self-Test (POST) procedure is completed.
4. The method for dynamically adjusting hardware configuration instructions as described in claim 3, wherein after the step of writing the hardware configuration instructions read from the BIOS variable storage space into a temporary register of the hardware device by executing the BIOS code, the method includes: Restart the electronic device.
5. The method for dynamically adjusting hardware configuration instructions as described in claim 3, wherein the binary raw data file is written to the BIOS variable storage space of the BIOS device via a unified extensible firmware interface tool (UEFI tool).
6. The method for dynamically adjusting hardware configuration instructions as described in claim 5, wherein the step of writing the binary raw data file to the BIOS variable storage space of the BIOS device includes: In response to receiving a first user command through the Unified Extensible Firmware Interface tool, the binary raw data file is verified to include at least one instruction index indicated by the first user command. And in response to the binary raw data file including the at least one instruction index indicated by the first user command, establish the flag equal to the preset value.
7. The method for dynamically adjusting hardware configuration instructions as described in claim 6, wherein the step of writing the binary raw data file to the BIOS variable storage space of the BIOS device further comprises: The response is to receive a second user command through the unified extensible firmware interface tool and determine whether the flag is equal to a preset value. In response to the flag being equal to a preset value, it is confirmed whether the hardware configuration instruction corresponding to the at least one instruction index exists in the binary raw data file; and in response to the hardware configuration instruction corresponding to the at least one instruction index existing in the binary raw data file, the hardware configuration instruction corresponding to the at least one instruction index is written to the BIOS variable storage space of the BIOS device.
8. The method for dynamically adjusting hardware configuration instructions as described in claim 1, wherein the hardware device includes an audio processor, and the hardware configuration instruction set includes a Verb-table of the audio processor.
9. The method for dynamically adjusting hardware configuration instructions as described in claim 1, wherein the step of generating the binary raw data file according to the hardware configuration instruction set of the hardware device includes: Define the file format of the binary raw data file; and convert the hardware configuration instruction set of the hardware device into the binary raw data file according to the file format of the binary raw data file.
10. The method for dynamically adjusting hardware configuration instructions as described in claim 1, wherein the hardware configuration instructions are written into a temporary register of the hardware device during the PEI phase of the POST procedure.
11. An electronic device comprising: A basic input / output system device, which records a basic input / output system code; A hardware device; The system also includes a processor coupled to the basic input / output system device and the hardware device, and configured to: generate a binary raw data file according to a hardware configuration instruction set of the hardware device, wherein the hardware configuration instruction set includes at least one hardware configuration instruction, and the hardware device includes a register for recording the hardware configuration instruction set; write the binary raw data file to a BIOS variable storage space of the BIOS device; read the hardware configuration instruction from the binary raw data file from the BIOS variable storage space by executing BIOS code; and write the hardware configuration instruction read from the BIOS variable storage space into the register of the hardware device by executing the BIOS code.
12. The electronic device of claim 11, wherein the BIOS variable storage space includes the non-volatile random access memory space of the BIOS device.
13. The electronic device of claim 11, wherein the operation of reading the hardware configuration instructions from the binary raw data file by executing the BIOS code includes: Confirm a flag; If the flag equals a preset value, the hardware configuration instruction is read from the binary raw data file in the BIOS variable storage space; if the flag does not equal a preset value or does not exist, the power-on self-test program is completed.
14. The electronic device of claim 13, wherein after the operation of writing the hardware configuration instructions read from the BIOS variable storage space into the temporary register of the hardware device by executing the BIOS code, the processor is further configured to: restart the electronic device.
15. The electronic device of claim 13, wherein the binary raw data file is written to the BIOS variable storage space of the BIOS device via a unified extensible firmware interface tool.
16. The electronic device of claim 15, wherein the operation of writing the binary raw data file to the BIOS variable storage space of the BIOS device includes: In response to receiving a first user command through the Unified Extensible Firmware Interface tool, the binary raw data file is verified to include at least one instruction index indicated by the first user command. And in response to the binary raw data file including the at least one instruction index indicated by the first user command, establish the flag equal to the preset value.
17. The electronic device of claim 16, wherein the operation of writing the binary raw data file to the BIOS variable storage space of the BIOS device further comprises: The response is to receive a second user command through the unified extensible firmware interface tool and determine whether the flag is equal to a preset value. In response to the flag being equal to a preset value, it is confirmed whether the hardware configuration instruction corresponding to the at least one instruction index exists in the binary raw data file; and in response to the hardware configuration instruction corresponding to the at least one instruction index existing in the binary raw data file, the hardware configuration instruction corresponding to the at least one instruction index is written to the BIOS variable storage space of the BIOS device.
18. The electronic device of claim 11, wherein the hardware device includes an audio processor and the hardware configuration instruction set includes a Verb-table of the audio processor.
19. The electronic device of claim 11, wherein the operation of generating the binary raw data file according to the hardware configuration instruction set of the hardware device includes: Define the file format of the binary raw data file; and convert the hardware configuration instruction set of the hardware device into the binary raw data file according to the file format of the binary raw data file.
20. The electronic device as claimed in claim 11, wherein the hardware configuration instructions are written into the temporary register of the hardware device during the PEI phase of the POST procedure.