Method, device and equipment for starting print function control of firmware and storage medium

By obtaining the print function address of the startup firmware initialization module and reading the print function switch instruction, the problem of being unable to control the print function in the early stage of startup in the prior art is solved, and flexible, safe and efficient print function control of the startup firmware is realized.

CN122152377APending Publication Date: 2026-06-05LOONGSON TECH CORP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
LOONGSON TECH CORP
Filing Date
2026-02-13
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In the existing technology, the method of dynamically controlling the startup firmware printing function relies on non-volatile memory, which results in low universality and security risks, and cannot effectively control the printing function in the early stage of startup.

Method used

By obtaining the printing function addresses of each initialization module in the startup firmware and reading the printing function switch instructions in the early stages, the printing function of the startup firmware can be dynamically controlled using the platform configuration database and stage handover information table. The printing function can be switched directly within the firmware without accessing external memory.

Benefits of technology

It enables flexible control in the early stages of startup, improves the feasibility and versatility of printing functions, reduces unnecessary hardware access, and enhances the security and performance of the startup firmware.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122152377A_ABST
    Figure CN122152377A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a printing function control method and device of a startup firmware, an electronic device and a computer readable storage medium. Specifically, the printing function control method comprises: obtaining a printing function address corresponding to each initialization module in the startup firmware; reading a printing function switch instruction of the startup firmware; calling a target function according to the printing function switch instruction and the printing function address, to control the printing function of the startup firmware to switch output; and the target function is used to control the output behavior of the startup firmware according to the current state of the printing function. The printing function of the startup firmware can be controlled only by relying on the printing function address and the printing switch instruction generated internally by the startup firmware, the feasibility and universality of controlling the printing function of the startup firmware are improved, unnecessary hardware access is reduced, the security of the startup firmware is improved, and the loss caused by frequent access to the memory can also be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and computer-readable storage medium for controlling the printing function of startup firmware. Background Technology

[0002] For existing boot firmware, such as firmware implemented according to the Unified Extensible Firmware Interface (UEFI) specification, the binary files used during debugging and production are usually different. During debugging, printing is enabled to view debugging information, while during production, printing is disabled to improve boot speed. Therefore, it is often necessary to dynamically control the printing function of the boot firmware. In related technologies, the method of dynamically controlling the printing function of the boot firmware typically requires using non-volatile memory on the board to store corresponding characteristic values. During boot firmware development, these characteristic values ​​are read to select whether to enable or disable the printing function.

[0003] Currently, non-volatile memory can only be used after the corresponding memory device has been initialized, which makes it dependent on memory, has low universality, and can also lead to unnecessary memory access at different stages of startup, posing security risks.

[0004] Application content This application provides a method, apparatus, electronic device, and computer-readable storage medium for controlling the printing function of boot firmware, which can improve the feasibility and universality of dynamically controlling the printing function of boot firmware; at the same time, it reduces unnecessary hardware access and can improve the security of boot firmware.

[0005] Firstly, this application provides a method for controlling the printing function of boot firmware, the method comprising: Obtain the print function addresses corresponding to each initialization module in the boot firmware; Read the print function switch command from the boot firmware; The target function is called based on the print function switch command and the print function address to control the output switching of the printing function of the boot firmware; the target function is used to control the output behavior of the boot firmware according to the current state of the printing function.

[0006] Secondly, this application provides a printing function control device for startup firmware, the device comprising: an acquisition module, a reading module, and a control module.

[0007] The acquisition module is used to obtain the address of the print function corresponding to each initialization module in the boot firmware; The reading module is used to read the print function switch instructions of the boot firmware; The control module is used to call the target function according to the print function switch command and the print function address to control the output switching of the print function of the startup firmware; the target function is used to control the output behavior of the startup firmware according to the current state of the print function.

[0008] Thirdly, this application provides an electronic device including a memory and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by one or more processors as described above for the system-on-a-chip data processing method.

[0009] Fourthly, this application provides a computer-readable storage medium that, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the data processing method of the aforementioned system-on-a-chip.

[0010] The embodiments of this application have the following advantages: This application embodiment obtains the print function addresses corresponding to each initialization module in the boot firmware; after the boot firmware enters the initialization module loading stage, it reads the print function switch instructions of the boot firmware; this allows direct reading of print function switch instructions in the early stages of booting, enabling the print switch to cover the entire boot process and avoiding situations where the print function cannot be controlled in the early boot stages. Finally, the target function is called according to the print function switch instructions and print function addresses to control the output switching of the boot firmware's print function; and the target function is limited to controlling the output behavior of the boot firmware according to the current state of the print function. This application embodiment can achieve control of the boot firmware's print function solely based on the print function addresses and print switch instructions generated internally within the boot firmware, without accessing external board memory, thus improving the feasibility and universality of controlling the boot firmware's print function; at the same time, it reduces unnecessary hardware access, compresses the security attack surface during the boot process, and improves the security of the boot firmware. Since no additional hardware access is required during the module operation phase of the boot firmware, the operating performance of the boot firmware can be improved, and the wear caused by frequent memory access can be reduced. Attached Figure Description

[0011] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 This is a flowchart illustrating a method for controlling the printing function of startup firmware in the related technology provided in the embodiments of this application; Figure 2This is a flowchart illustrating the steps of a firmware printing function control method provided in an embodiment of this application. Figure 3 This is a flowchart of another method for controlling the printing function of startup firmware provided in an embodiment of this application; Figure 4 This is a schematic diagram illustrating the specific implementation process of a printing function control method for startup firmware provided in an embodiment of this application; Figure 5 This is a structural block diagram of a printing function control device for startup firmware provided in an embodiment of this application; Figure 6 This is a structural block diagram of an electronic device for controlling the printing function of startup firmware, provided in an embodiment of this application. Detailed Implementation

[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0014] For existing boot firmware, such as firmware implemented according to the Unified Extensible Firmware Interface (UEFI) specification, the binary files used during debugging and production are usually different. During debugging, the printing function is enabled to view debugging information, while during production, the printing function is disabled to improve boot speed. However, for faulty devices in the production environment, the only solution is to replace the boot firmware with the printing function disabled with the one with the printing function enabled to troubleshoot the problem. But replacing the boot firmware will greatly affect the production schedule. Therefore, it is necessary to dynamically control the printing function of the boot firmware to flexibly and conveniently view the output debugging information.

[0015] In related technologies, the method of dynamically controlling the printing function of the startup firmware typically uses non-volatile memory on the board to store corresponding feature values. During startup firmware development, these feature values ​​are read to select which printing function to call. However, using the non-volatile memory on the board can only be used after the corresponding memory device has been initialized, which creates a dependency on the memory, has low universality, and can also lead to unnecessary access to memory at different stages of startup, posing a security risk.

[0016] For example, UEFI's printing function can be understood as a pre-boot phase information output mechanism provided by the UEFI firmware layer. Its core function is to output debug logs, hardware status, error information, etc., to a specified device (such as a serial port, screen, or log file) before the operating system loads, for technical personnel to reference during development debugging, troubleshooting, and status monitoring. Essentially, it is a standardized information output interface defined by the UEFI specification and is one of the core auxiliary functions of UEFI firmware.

[0017] Figure 1 This is a flowchart illustrating a method for controlling the printing function of startup firmware according to an embodiment of this application. Figure 1 As shown, after entering the pre-compilation configuration phase, i.e., after development or compilation begins, S1 is executed to determine whether the DEBUG function is enabled. The DEBUG function can be understood as a pre-compilation configuration option, which can be manually configured by the developer. The core is to determine whether to retain the printing function in the final output. If yes, i.e., the DEBUG function is enabled, then S2 is executed to configure the initial printing option to be enabled; the operation of enabling the printing function can be performed to output necessary information, such as fault logs. If no, i.e., the DEBUG function is disabled, then S3 is executed to configure the initial printing option to be disabled; the operation of disabling the printing function can be performed, and no information is output. Then S4 is executed to compile; the project code is compiled to generate a program containing the corresponding printing logic (enabled or disabled). Finally, S5 is executed to run, i.e., the compiled program is run.

[0018] In related technologies, the method of dynamically controlling the firmware printing function can reserve a flag bit in a non-volatile memory on the motherboard. For example, one byte: 0x01 indicates printing is enabled, and 0x00 indicates printing is disabled. The firmware code retains the printing function code, but a judgment logic is added at the entry point. When the device leaves the factory, the above flag bit is set to 0x00. When a machine malfunctions, maintenance personnel can use remote management tools, such as the Intelligent Platform Management Interface (IPMI) command of the Baseboard Management Controller (BMC), or enter the equipment room and use special tools to modify this flag bit to 0x01, and then restart the device. The device can then output debugging information.

[0019] The UEFI boot process can include the following phases: Security Phase (SEC), Pre-EFI Initialization (PEI), Driver Execution Environment (DXE), Boot Device Selection (BDS), Transient System Load (TSL), Runtime (RT), and Afterlife (AL). Here, EFI stands for Extensible Firmware Interface.

[0020] Accessing external non-volatile memory, such as Serial Peripheral Interface Flash Memory (SPI Flash) and Electrically Erasable Programmable Read-Only Memory (EEPROM), requires corresponding drivers. These drivers are typically loaded and initialized during the DXE phase. If the failure occurs during the PEI phase, the memory may not be ready yet, and the memory containing the storage flags cannot be read because the driver for accessing the storage flags has not yet run. Therefore, the dynamic switch is ineffective during the early initialization phase.

[0021] Different manufacturers and models of motherboards may use completely different types and addresses of non-volatile memory. For example, a flag setting tool written for server A may be completely ineffective on server B. This requires the operations and maintenance team to maintain a set of tools and knowledge for each type of hardware, resulting in low universality and high management costs.

[0022] In normal production mode (with the flag set to 0x00), the firmware still calls the code path that reads memory every time the print function is executed, increasing the complexity of the firmware code and the possibility of attack. If this flag storage area is exposed to the operating system or malware, it may be illegally modified, causing the production machine to unexpectedly output debugging information, posing a risk of information leakage.

[0023] Figure 2 This is a flowchart illustrating the steps of a firmware printing function control method provided in an embodiment of this application. Figure 2 As shown, the method may include steps 201-203.

[0024] Step 201: Obtain the address of the print function corresponding to each initialization module in the boot firmware.

[0025] In this embodiment, after the boot firmware completes the basic initialization of core hardware such as the Central Processing Unit (CPU) and memory, it can enter the initialization module loading stage. This stage is the core execution stage of the boot firmware. The core layer can load all PEI initialization modules and DXE initialization modules sequentially according to a preset priority. The PEI initialization module can be understood as the initialization module existing in the PEI stage; the DXE initialization module can be understood as the initialization module existing in the DXE stage. The PEI initialization module may include a memory detection module, a clock configuration module, and a serial port initialization module, etc.; the DXE initialization module may include a serial port initialization module. Each initialization module has an independent and unique print function address, which can be read from the boot firmware after the initialization module is loaded and before the core logic of the module is executed.

[0026] For example, when the firmware enters the initialization module loading phase, all initialization modules can be traversed, and the address of the print function in each initialization module can be extracted. The print function corresponding to the above print function address can be used to output parameter information such as the initialization status and fault log of each initialization module.

[0027] Step 202: Read the printing function switch command of the startup firmware.

[0028] For example, taking UEFI as the boot firmware, during UEFI operation, the predefined print function switch variable value is obtained through the standard interface of the UEFI's built-in Platform Configuration Database (PCD), and mapped to the corresponding print function switch command. For example, if the predefined print function switch variable value is 1, then the variable value "1" can be mapped to the print function switch command corresponding to "1" according to the preset mapping relationship. If the preset mapping relationship indicates that the print function switch command corresponding to "1" is "Start Printing", then the print function switch command read from the boot firmware is "Start Printing".

[0029] For example, preset mappings can be stored in the read-only data segment of the boot firmware. Preset mappings can be presented in the form of a mapping table; this mapping table can be stored as a structure array containing two elements; for example, element 0: {original value=0, instruction code=0x00, instruction description="turn off printing"}; element 1: {original value=1, instruction code=0x01, instruction description="turn on printing"}.

[0030] If the core layer reads the value of the print function switch variable as 1 from the read-only data segment of the boot firmware, then 1 can be used as the query key; then the mapping table is traversed to find the instruction code corresponding to 1, and the instruction description of the instruction code corresponding to 1 is used as the print function switch instruction.

[0031] Step 203: Call the target function according to the print function switch command and print function address to control the output switching of the print function of the startup firmware.

[0032] In this embodiment, the print function address points to the memory address of the function that actually performs the print operation. After obtaining the print function switch instruction and the print function address, the target function pointed to by the print function address can be called according to the print function switch instruction to control the printing function of the startup firmware.

[0033] The objective function controls the output behavior of the boot firmware based on the current state of the printing function. The objective function's interface is completely consistent with the native printing functions of each initialization module, meaning the return value type and parameter list (which can include fixed and variable parameters) match perfectly. The objective function can include a printing function that implements log output and an empty function with no output. Printing functions and empty functions are mutually exclusive; only one can be called at a time within the same initialization module. The selection of the objective function is determined by the printing function switch instruction, which is dynamically switched based on the printing function switch instruction read from the platform configuration database. The switching logic is handled by the core layer, and the objective function directly determines the final output behavior of the boot firmware: either outputting the module's running logs or outputting nothing.

[0034] For example, the aforementioned print function switch instructions are typically stored in the global configuration area of ​​the boot firmware; such as the configuration header, specific registers, or non-volatile memory. The print function address of each initialization module can be stored in the structured description information of that initialization module; this description information may be organized into an array, linked list, or table, stored in the firmware's data segment or read-only memory, with each module's print function address pointing to a specific function in that module's code segment.

[0035] After the firmware boots into the initialization module loading phase, the core layer can read function switch instructions from the global configuration area to determine whether the printing function is enabled. If the switch instruction indicates that the printing function is "enabled," the core layer can set the address of the function pointer variable of each module to the actual printing function address of that module, and calling this actual printing function address will produce real output. If the switch instruction indicates "disabled," the core layer sets the address of the function pointer variable to a preset empty function address, and calling this empty function address will not produce output. Thus, the global switch instruction controls the calling of local printing function addresses to switch the output.

[0036] For example, if the print function switch instruction is to enable the print function, and the print function address is 0x08001234, the system can jump to address 0x08001234, call the target function stored at address 0x08001234, perform the print operation, and output the execution log of the target function for use by technicians during debugging.

[0037] This embodiment of the application, in response to the boot firmware entering the initialization module loading stage, obtains the print function addresses of each initialization module in the boot firmware; after the boot firmware enters the initialization module loading stage, it reads the print function switch instructions of the boot firmware; this allows for direct reading of print function switch instructions in the early stages of booting, enabling the print switch to cover the entire boot process and avoiding situations where the print function cannot be controlled in the early boot stages. Finally, based on the print function switch instructions and print function addresses, a target function is called to control the print function of the boot firmware; and the target function is limited to controlling the output behavior of the boot firmware based on the current state of the print function; this enables control of the boot firmware's print function solely based on the print function addresses and print switch instructions generated internally within the boot firmware, improving the feasibility and universality of controlling the boot firmware's print function; it also reduces unnecessary hardware access, compresses the security attack surface during the boot process, and improves the security of the boot firmware. Furthermore, directly obtaining the print function addresses and combining them with switch instructions for control reduces the probability of additional access to other hardware during the module operation phase of the boot firmware, which can improve the operating performance of the boot firmware and reduce the wear caused by frequent memory access.

[0038] Figure 3 This is a flowchart illustrating the steps of another method for controlling the printing function of startup firmware provided in this application embodiment. Figure 3 As shown, the printing function control method of the startup firmware may include steps 301-307.

[0039] Step 301: Call the preset interface of the startup firmware to create the basic framework of the phase handover information table.

[0040] In this embodiment, the Core layer can actively call the standardized preset interface of the boot firmware, request independent memory space in the firmware's memory area, generate an empty Hand-Off Block (HOB) with a standardized data structure, which is the basic framework of the Hand-Off Block, and complete the initialization verification of the basic framework of the Hand-Off Block to ensure that subsequent initialization modules can write data to the table normally.

[0041] For example, taking the PEI phase of UEFI as an example, the Core layer can call the UEFI standard preset interface PeiServicesCreateHob at the earliest stage of the PEI phase to create an empty HOB table basic framework at memory address 0x20000000. This framework can preset 10 print function address storage bits to store the print function addresses of the initialization modules loaded later. At this time, these 10 storage bits are all blank and have no address data. Only the creation of the table structure framework and memory allocation are completed.

[0042] Step 302: In response to the firmware entering the initialization module loading phase, generate a phase handover information table.

[0043] In this embodiment, the phase handover information table is formed by each initialization module writing its corresponding print function address into the basic framework. Based on UEFI's own mechanism of using HOB tables to transfer data between different modules, HOB data containing print function addresses can be added to each PEI and DXE module. Specifically, this can be achieved by having all PEI and DXE modules include the same header file. This header file is responsible for recording the print function in the HOB table's print function pointer; essentially, it directly assigns the print function address to the HOB table's print function address storage bit, thus recording the specific address of the print function in each PEI and DXE module. Simultaneously, the contents of this header file are called at the module entry point, allowing each PEI and DXE module to call its corresponding print function address.

[0044] For example, the pseudocode for the header file is as follows: static inline EFI_STATUS BuildPrintHob (void) { Hob.PrintFuncAddr = DebugPrint; } Based on the above embodiments, for example, in the earliest stage of the PEI phase, the Core layer calls the UEFI standard preset interface to create an empty HOB table basic framework at memory address 0x20000000, and writes the signature value 0x484F4254 at 0x20000000 (table start address). After the Core layer loads each initialization module, the initialization module can automatically identify the HOB table basic framework before executing its own core business logic. For example, each module has built-in UEFI standard HOB table identification parameters (such as the HOB table signature value being 0x484F4254). After the module is loaded, it will automatically scan the signature values ​​in memory. When the module scans the signature value at 0x20000000 and it is the same as its built-in 0x484F4254, it immediately determines that the HOB table basic framework has been identified. According to the UEFI standard specification, the print function address is written into the preset storage location of the HOB table basic framework. The initialization module loading is batched, and the writing action is also batched. That is, when an initialization module is loaded, the initialization module completes one print function address writing. After all the initialization modules to be loaded have completed the print function writing, the HOB table basic framework is filled with the print function addresses of all initialization modules, forming a complete stage handover information table with actual data. At this time, the Core layer can read the HOB table through the standard interface.

[0045] For example, after initialization module A recognizes the basic framework of the HOB table, it writes its own dedicated print function address into the first bit of the print function address storage bit of the HOB table (e.g., physical location 0x20000010) according to the UEFI standard specification, and at the same time writes the module identifier Mod001 into the first bit of the module identifier area (e.g., physical location 0x2000000C); the HOB table at this time can be represented by Table 1.

[0046] Table 1

[0047] Step 303: Based on the phase handover information table, obtain the print function address corresponding to each initialization module in the startup firmware.

[0048] In this embodiment of the application, the contents of each storage bit in the table can be read sequentially according to the UEFI HOB table data structure specification, and the initialization module and print function address corresponding to each storage bit can be matched to extract the print function address corresponding to each initialization module.

[0049] For example, if after obtaining the complete HOB table at memory address 0x20000000, the Core layer confirms that the HOB table base address is 0x20000000 and that the validity verification is completed (i.e., the signature value is 0x484F4254 and the status is "completed"), it can locate two core counting fields: the total table capacity identifier and the written address count. The total table capacity identifier is located at the HOB table base address + 0x04 - 0x07 offset (this offset is a fixed offset in the UEFI standard), and its function is to mark the maximum number of module addresses that the HOB table can store. The written address count is located at the HOB table base address + 0x08 - 0x0B offset (this offset is a fixed offset in the UEFI standard), and its function is to record the number of module addresses that have actually been written in real time. The Core calls the UEFI standard memory read interface to read 4 bytes of data at the base address + 0x04 - 0x07 offset, obtaining a total table capacity identifier value of 0x00000003, indicating that the table can store a maximum of 3 module addresses. It then calls the same interface again to read 4 bytes of data at the base address + 0x08 - 0x0B offset, obtaining a written address count value of 0x00000003. The Core layer compares these two values; if the written count is the same as the total table capacity, it determines that the print function addresses of three modules have been written into the HOB table. The complete HOB table is then parsed and read. After locating the HOB table base address 0x20000000, the Core layer reads the content at physical location 0x2000000C to obtain the module identifier Mod001. Then, it locates the corresponding address storage offset 0x10-0x13 and reads 4 bytes of data, specifically 4 bytes at physical location 0x20000010, to obtain the print function address value 0x10008000. Similarly, the print function addresses corresponding to each initialization module in the table can be extracted sequentially. For example, the print function address 0x10008000 bound to the memory detection module, 0x10009000 bound to the clock configuration module, and 0x1000A000 bound to the serial port initialization module can be read from the table.

[0050] This embodiment creates a basic framework for a phase handover information table by calling a preset interface of the boot firmware. It provides a standardized data structure, adaptable to all boot firmware models, improving universality and reducing compatibility issues. In response to the boot firmware entering the initialization module loading phase, it obtains the phase handover information table. Subsequently, based on the phase handover information table, it obtains the print function addresses of each initialization module in the boot firmware. The phase handover information table is defined as being formed by each initialization module writing its own print function address into the basic framework. This allows each initialization module to automatically write its own print function address after loading, according to the UEFI native development specifications, supporting dynamic loading and unloading of modules.

[0051] Step 304: Call the platform configuration database access interface corresponding to the boot firmware to read the variable values ​​of the platform configuration database.

[0052] In this embodiment, the platform configuration database is bound to the user configuration interface to receive user settings for enabling or disabling the printing function of the startup firmware, and to store these settings as variable values ​​in the platform configuration database. During firmware development, the printing switch option in the user configuration interface is hard-bound one-to-one with a preset PCD variable. The state of the front-end option (e.g., on / off) is directly synchronized with the value of the PCD variable; for example, a value of 1 indicates that the printing function is enabled, and a value of 0 indicates that the printing function is disabled.

[0053] When users interact with front-end options, there's no need to manually modify the underlying code; the values ​​are automatically written to the PCD variable. Users can select the printing function status through the user configuration interface. For example, users can select the printing function status through the debug printing switch checkbox in the Basic Input / Output System (BIOS) interface. If the user selects the "on" option, the bound PCD variable value is automatically set to 1 through the response trigger event in the GUI interface; if the user selects the "off" option, the bound PCD variable value is automatically set to 0 through the response trigger event in the GUI interface.

[0054] Step 305: Determine the printing function switch command for the startup firmware based on the variable value.

[0055] In this embodiment, during the firmware development phase, the Core layer can have a built-in one-to-one numerical and instruction mapping rule, which is unique and unambiguous. During the initialization module loading phase, the UEFI standard PCD access interface (e.g., PeiServicesGetPcd8 in the PEI phase and GetPcd8 in the DXE phase) can be called to read the current value of the bound PCD variable; based on the current value of the PCD variable, the printing function switch instruction for starting the firmware is determined.

[0056] For example, Table 2 can be used to represent the rules for mapping values ​​to instructions.

[0057] Table 2

[0058] Taking the PEI stage as an example, the Core layer calls the PCD access interface. During the initialization module loading phase, a trigger event is executed to read the PCD variable value. The interface called is: PeiServicesGetPcd8; the input parameter is the PCD variable name PcdDebugPrintEnable; the interface execution logic is to locate the storage address of PcdDebugPrintEnable in the PCD database (e.g., 0x40000001) and read the 8-bit data at that address; the interface returns a UINT8 type value of 1 (this value is the value configured and saved by the user through the BIOS interface). Subsequently, the Core layer compares the value 1 returned by the interface with the built-in mapping rules, extracts the instruction "Enable Printing" corresponding to the PCD variable value 1, and uses "Enable Printing" as the printing function switch instruction for the startup firmware.

[0059] This embodiment reads variable values ​​from the platform configuration database by calling the platform configuration database access interface of the boot firmware. It also binds the platform configuration database to the user configuration interface to receive user settings for enabling or disabling the printing function in the boot firmware and stores these settings as variable values ​​in the platform configuration database. The reading action is completed based on the firmware's built-in PCD component and standard interface. Users only need to operate the switch options through the visual interface, and the configuration results are automatically synchronized to the PCD, improving debugging efficiency. Based on the variable values ​​in the platform configuration database, the boot firmware's printing function on / off command is determined. This allows for the connection between user configuration and function calls, providing an execution basis for subsequent printing control actions.

[0060] Optionally, step 305 above can be sub-steps 3051-3052.

[0061] Sub-step 3051: If the variable value in the platform configuration database is the first value, determine that the printing function switch instruction indicates that the printing function of the firmware is currently enabled.

[0062] Sub-step 3052: If the variable value in the platform configuration database is the second value, determine that the printing function switch instruction indicates that the printing function of the startup firmware is currently in the off state.

[0063] For example, regarding sub-steps 3051-3052, if the first value is 1 and the second value is 0, the user selects the printing function switch to be enabled in the BIOS user configuration interface. This configuration is synchronously written to the PCD database, and the PCD variable value is set to 1. The Core layer can pass the parameter PcdDebugPrintEnable to the PCD access interface to initiate an 8-bit value read request. The interface locates the physical storage address 0x40000001 of the variable in the PCD database through the PcdDebugPrintEnable macro; reads the 8-bit (1-byte) binary data at this address: 00000001; and converts the binary data into a decimal value of type UINT8, 1, as the return value and passes it to the Core layer. If the variable value is 1, it can be determined that the printing function switch instruction is an enable instruction, that is, the printing function of the firmware is currently enabled. In the BIOS user configuration interface, the user selects the printing function switch to be off. This configuration is synchronously written to the PCD database after being triggered by the user, and the PCD variable value is set to 0. When the Core layer calls the PCD access interface and reads that the variable value is 0, it can be determined that the printing function switch instruction is a shutdown instruction, that is, the printing function of the firmware is currently in a disabled state.

[0064] In this embodiment, when the variable value in the platform configuration database is a first value, the print function switch instruction indicates that the printing function of the startup firmware is currently enabled. When the variable value in the platform configuration database is a second value, the print function switch instruction indicates that the printing function of the startup firmware is currently disabled. This standardizes and universalizes the mapping rule between values ​​and switch states, improves the versatility of dynamically controlling the printing function of the startup firmware, and allows for flexible and controllable dynamic switching of the printing function state, reducing the development and maintenance costs of the firmware.

[0065] Step 306: When the printing function of the startup firmware is currently enabled as indicated by the printing function switch instruction, call the printing function according to the printing function address to control the output switching of the printing function of the startup firmware.

[0066] In this embodiment, when the print function switch instruction indicates that the print function of the startup firmware is currently enabled, calling the print function according to the print function address can be understood as the Core layer locating the function body of the print function through the print function address of the initialization module, that is, calling the native print function of each initialization module to control the print function of the startup firmware.

[0067] For example, if the print function switch instruction indicates that the printing function of the boot firmware is currently enabled, and the print function address of the memory detection module of the boot firmware is 0x10008000, then the print function at address 0x10008000 will be called. At this time, executing the print function can output information such as the running log of the memory detection module.

[0068] Step 307: When the printing function of the startup firmware is currently off as indicated by the printing function switch instruction, modify the printing function corresponding to the printing function address to an empty function and call it to control the output switching of the printing function of the startup firmware.

[0069] In this embodiment, when the print function switch instruction indicates that the printing function of the boot firmware is currently off, the native print function pointed to by the print function address can be replaced with a pre-built empty function whose interface is completely consistent with the native print function. The return value type and complete parameter list (including fixed parameters, variable parameters, etc.) of the empty function are completely consistent with the native print function. The Core layer can locate the function body of the empty function through the print function address of the initialization module, and then execute the code logic of the empty function to control the printing function of the boot firmware.

[0070] Based on the above embodiments, for example, if the print function switch instruction indicates that the printing function of the startup firmware is currently in a closed state by comparing the PCD variable value with the built-in value-instruction mapping rule, for the memory detection module of the startup firmware, the print function address of the memory detection module is 0x10008000, then the function at address 0x10008000 is called, that is, the preset empty function is called, and the code logic of the empty function is executed subsequently.

[0071] This embodiment controls the printing function of the boot firmware by calling the printing function according to its address when the printing function switch instruction indicates that the printing function is currently enabled; and by modifying the printing function corresponding to the printing function address to an empty function and calling the empty function according to the printing function address when the printing function switch instruction indicates that the printing function is currently disabled. This allows the printing function addresses of all initialization modules to remain unchanged throughout the process; only the function body corresponding to the printing function address needs to be modified, enabling dynamic switching of the printing function. Furthermore, the fixed address and function call method achieve a lightweight computation effect, reducing the probability of accessing hardware peripherals and thus improving the performance of the boot firmware.

[0072] Optionally, step 306 may include sub-steps 3061-3062.

[0073] Sub-step 3061: Call the print function based on its address; Sub-step 3062: Execute the print function to output the running logs of each initialization module.

[0074] For example, regarding sub-steps 3061-3062, if the print function switch instruction indicates that the printing function of the startup firmware is currently enabled, for the memory detection module of the startup firmware, the print function address of the memory detection module is 0x10008000. Then, the print function at address 0x10008000 is called and executed. After the execution is completed, the running log of the memory detection module is output. For example, PEI stage - memory detection completed, total physical memory capacity 8GB, available memory capacity 7.8GB, no memory verification abnormalities.

[0075] Based on the above embodiments, for example, the PCD interface of the PEI stage can be called, such as PeiServicesGetPcd8(PcdDebugPrintEnable), to read the PCD variable value as 1; by comparing with the built-in mapping rules of the Core layer, it is detected that the instruction corresponding to the value 1 is "start printing", thus determining that the printing function of the startup firmware is currently enabled. Subsequently, the Core layer reads the print function address of Mod001 as 0x10008000 from the HOB table, sets the current print function address corresponding to Mod001 to 0x10008000, calls the print function at address 0x10008000 through the function pointer, and executes the print function.

[0076] In this embodiment, when the printing function switch instruction indicates that the printing function of the startup firmware is currently enabled, the printing function is called according to the printing function address; then the printing function is executed, and the running logs of each initialization module are output. The calling action is only address addressing, and the execution action is only standardized log output, without complex calculations or frequent hardware access, and the execution time is small. It is adapted to the hardware characteristics of the early stage of firmware startup, such as scarce memory, low CPU frequency, and strict startup time requirements, and will not increase the firmware startup time or consume excessive resources due to enabling the printing function.

[0077] Optionally, step 307 may include sub-steps 3071-3072.

[0078] Sub-step 3071: Modify the print function corresponding to the address of the print function to an empty function.

[0079] Sub-step 3072: Call an empty function based on the address of the print function, and after executing the empty function, the output is empty.

[0080] For example, for sub-steps 3071-3072, the interface of the empty function is completely consistent with the native print function. The empty function is a single instance that is globally reused, and there is no need to build an independent empty function for each initialization module. When the user sets the firmware print function switch to off in the BIOS visual configuration interface, the configuration is synchronously written to the platform configuration database through the corresponding trigger event, and the corresponding PCD variable value is set to 0. After reading the PCD variable value, the Core layer determines that the print function switch instruction is in the off state. Referring to the relevant content of step 303 above, the Core layer can parse and obtain the print function address of each initialization module from the HOB table. For example, the print function address of the memory detection module is 0x10008000, the print function address of the clock configuration module is 0x10009000, and the print function address of the serial port initialization module is 0x1000A000. All addresses are fixed values ​​and are not modified throughout the process. The Core layer has pre-built a standard empty function with an interface completely consistent with the native print function at memory address 0x30000000.

[0081] For example, the code for an empty function can be: VOID FakePrint INUINTNErrorLevel, INCONST CHAR8*Format, …){return;} After jumping to the address of the print function, the internal code of the empty function can be run. The internal code of the empty function does not contain logic such as log formatting, serial port hardware calls, or data processing. It only contains empty instructions and function return instructions. There are no valid business actions during the execution process. After the execution is completed, there is no output content, that is, the output is empty.

[0082] In this embodiment, when the printing function switch instruction indicates that the printing function of the startup firmware is currently disabled, the printing function corresponding to the printing function address is modified to an empty function. The empty function is called and executed according to the printing function address, and the output is empty. The empty function does not contain any valid business logic, only empty instructions and return instructions. The execution time is low, and there is no need to perform operations such as log formatting and serial port data transmission after execution. This reduces CPU computing resources, memory cache resources, and serial port hardware interface resources, shortens firmware startup time, avoids unnecessary occupation of hardware such as serial ports, and prevents leakage of firmware running parameters, thus balancing operating efficiency and security.

[0083] Optionally, the above method may also include steps 308-309.

[0084] Step 308: Assign the address of the print function to the preset function pointer.

[0085] In this embodiment, the preset function pointer can be understood as a standard function pointer declared in advance during the firmware's code initialization phase. Its type matches the print function interface, and its essence is a memory space capable of storing memory addresses. The print function address can be copied into the memory space represented by the preset function pointer, giving the preset function pointer a clear target.

[0086] For example, if the preset function pointer variable is named PrintFuncPtr, and the empty function FakePrint has been constructed, its interface is completely consistent with the printing function. For each initialization module, the Core layer can sequentially assign the address of the printing function to the preset function pointer. For instance, for the memory detection module, whose printing function address is 0x10008000, the assignment PrintFuncPtr = 0x10008000 can be performed, and the pointer PrintFuncPtr successfully stores the address of the module's printing function.

[0087] Based on the above embodiments, for example, the Core layer can read the dedicated storage address of the preset function pointer variable PrintFuncPtr, for example, 0x60000000; the Core layer can generate assignment instructions and send them to the CPU. After receiving the assignment instructions, the CPU can initiate a write request to memory address 0x60000000, writing 4 bytes of data 0x10008000 byte by byte (0x60000000=0x80, 0x60000001=0x08, 0x60000002=0x00, 0x60000003=0x10); after the assignment is completed, the value at the storage address of PrintFuncPtr at 0x60000000 changes from the initial value 0x00000000 to 0x10008000, that is, the assignment of the print function address to the preset function pointer is completed.

[0088] Step 309: Based on the print function switch instruction and the print function address, call the target function through the preset function pointer to control the printing function of the startup firmware.

[0089] In this embodiment, the target function includes a print function and an empty function. A print function switch instruction can be used to control the call direction, and the print function address serves as the source of the pointer. Based on the print function switch instruction and the print function address, it can be determined which type of target function to call, thereby controlling the printing function of the boot firmware.

[0090] For example, when the print function switch instruction indicates that the printing function of the boot firmware is currently enabled, the preset function pointer stores the address of the print function. At this time, the print function address points to the print function, and the target function called through the preset function pointer is the print function. After executing the print function, the running logs of each initialization module can be output. When the print function switch instruction indicates that the printing function of the boot firmware is currently disabled, the preset function pointer still stores the address of the print function. At this time, the print function corresponding to the print function address is modified to an empty function, and the target function called through the preset function pointer is the empty function. After execution, the output is empty.

[0091] Based on the above embodiments, for example, during the development phase, the print entry point in each initialization module of PEI and DXE, i.e., the macro DEBUG, can be rewritten as follows: #define DEBUG(Expression) (*PrintFuncPointer)(Expression) PrintFuncPointer = Hob.PrintFuncAddr; Based on the rewritten content, the print function address can be assigned to a preset function pointer. According to the print function switch instruction and the print function address, the target function can be called through the preset function pointer, thereby controlling the printing function of the startup firmware.

[0092] This embodiment controls the printing function of the startup firmware by assigning the address of the printing function to a preset function pointer. Based on the printing function on / off command and the printing function address, the target function is called through the preset function pointer. Using the function pointer as a unified entry point, switching the printing function on or off only requires modifying the function body pointed to by the pointer, without altering the core calling logic, thus improving the flexibility of printing function control.

[0093] Optionally, the above method may also include step 310.

[0094] Step 310: Read the printing function switch command of the startup firmware to modify the on or off settings of the printing function of the startup firmware.

[0095] For example, users can manually modify the on / off state of the printing function through the firmware's visual configuration interface (such as the BIOS debug configuration page, development terminal, etc.). After the user modifies and saves the settings, the firmware automatically synchronizes the configuration results to the platform configuration database, that is, converting the visual state of being on or off into the value of the PCD variable (e.g., on = 1, off = 0). After the firmware detects a change in the value of the PCD variable, it can restart the UEFI firmware, thereby initiating the step of reading the printing function switch command, ensuring that the configuration takes effect throughout the entire firmware startup cycle.

[0096] This embodiment responds to user modifications to the printing function's on / off settings in the startup firmware by reading the printing function switch command from the startup firmware. This allows users to switch printing states simply by saving and restarting after modifying the configuration, without needing to recompile the firmware. This reduces the development and mass production costs of the startup firmware and improves the versatility of dynamic control over the startup firmware's printing function.

[0097] Figure 4 This is a schematic diagram illustrating the specific implementation flow of a printing function control method for startup firmware provided in an embodiment of this application. For example... Figure 4 As shown, each initialization module in the PEI or DXE stage of the boot firmware can write its own print function address into the HOB table, i.e., S1, pass the print information HOB; modify the mapping relationship between the print function address and the target function, i.e., S2, implement the redirection function in PEICore and DXECore; and then execute S3, compile, S4, and run in sequence. PEICore and DXECore can be understood as the core management layers of the PEI and DXE stages, respectively. After the boot firmware enters the initialization module loading stage, it can execute S5, PEICore and DXECore read the print function switch instruction PCD; S6, determine whether the print function is enabled based on the print function switch instruction PCD; if yes, execute S7, do not perform print function redirection, i.e., the print function address points to the print function of the initialization module; if no, execute S8, the print function is redirected to empty, i.e., the print function pointed to by the print function address is modified to an empty function. Redirection can be understood as not changing the address of the printing function itself, but only changing the function code segment pointed to by that address; then S9 is executed to determine whether the printing configuration has been modified; if so, S10 is executed to restart the firmware, and then S5 is entered, where PEICore and DXECore read the printing switch instruction to make the modified configuration take effect; if not, the startup process ends.

[0098] In summary, this application's embodiments obtain the printing function addresses corresponding to each initialization module in the boot firmware; after the boot firmware enters the initialization module loading stage, it reads the printing function switch instructions of the boot firmware; this allows for direct reading of the printing function switch instructions in the early stages of booting, enabling the printing switch to cover the entire boot process and avoiding situations where the printing function cannot be controlled in the early boot stages. Finally, the target function is called according to the printing function switch instructions and printing function addresses to control the output switching of the boot firmware's printing function; and the target function is limited to controlling the output behavior of the boot firmware based on the current state of the printing function; this enables control of the boot firmware's printing function solely based on the printing function addresses and printing switch instructions generated internally within the boot firmware, improving the feasibility and universality of controlling the boot firmware's printing function; it also reduces unnecessary hardware access, compresses the security attack surface during the boot process, and improves the security of the boot firmware. Furthermore, directly obtaining the printing function addresses and combining them with switch instructions for control reduces the probability of additional access to other hardware during the module operation phase of the boot firmware, which can improve the operating performance of the boot firmware and reduce the wear caused by frequent memory access.

[0099] This application also provides a control device for the printing function of the startup firmware. Figure 5 This is a structural block diagram of a printing function control device for startup firmware provided in an embodiment of this application. For example... Figure 5 As shown, the printing function control setting 500 of the startup firmware may include: an acquisition module 501, a reading module 502, and a control module 503.

[0100] Module 501 is used to obtain the address of the print function corresponding to each initialization module in the boot firmware; The reading module 502 is used to read the printing function switch command of the startup firmware; The control module 503 is used to call the target function according to the print function switch command and the print function address to control the output switching of the print function of the startup firmware; the target function is used to control the output behavior of the startup firmware according to the current state of the print function.

[0101] Optionally, the target function includes a print function and an empty function; the control module 503 is specifically used to call the print function according to the print function address when the print function of the startup firmware indicated by the print function switch instruction is currently in the enabled state, so as to control the output switching of the print function of the startup firmware; when the print function of the startup firmware indicated by the print function switch instruction is currently in the disabled state, modify the print function corresponding to the print function address to an empty function and call it, so as to control the output switching of the print function of the startup firmware.

[0102] Optionally, the control module 503 is specifically used to call the print function according to the print function address; execute the print function, and output the running logs corresponding to each initialization module respectively.

[0103] Optionally, the control module 503 is specifically used to modify the printing function corresponding to the printing function address to an empty function; call the empty function according to the printing function address, and output empty after executing the empty function.

[0104] Optionally, module 501 is used to call the preset interface of the boot firmware to create the basic framework of the stage handover information table; in response to the boot firmware entering the loading stage of the initialization module, it generates the stage handover information table; the stage handover information table is formed by each initialization module writing its corresponding print function address into the basic framework; based on the stage handover information table, it obtains the print function address corresponding to each initialization module in the boot firmware.

[0105] Optionally, the reading module 502 is specifically used to call the platform configuration database access interface corresponding to the boot firmware and read the variable values ​​of the platform configuration database; the platform configuration database is bound to the user configuration interface and is used to receive the user's settings for enabling or disabling the printing function of the boot firmware, and store the enabling or disabling settings as variable values ​​of the platform configuration database; and determine the boot firmware's printing function on / off instruction based on the variable values ​​of the platform configuration database.

[0106] Optionally, the reading module 502 is specifically used to determine that the printing function switch instruction indicates that the printing function of the startup firmware is currently in the enabled state when the variable value in the platform configuration database is a first value; and to determine that the printing function switch instruction indicates that the printing function of the startup firmware is currently in the disabled state when the variable value in the platform configuration database is a second value.

[0107] Optionally, the control module 503 is specifically used to assign the print function address to a preset function pointer; and to call the target function through the preset function pointer according to the print function switch instruction and the print function address, so as to control the printing function of the startup firmware.

[0108] Optionally, such as Figure 5 As shown, the printing function control setting 500 of the startup firmware may also include: a processing module 504.

[0109] The processing module 504 is used to read the printing function switch command of the startup firmware in order to modify the setting of enabling or disabling the printing function of the startup firmware.

[0110] This application also provides an electronic device, with reference to... Figure 6 , Figure 6This is a structural block diagram of an electronic device for controlling the printing function of startup firmware, provided in an embodiment of this application. Figure 6 As shown, the electronic device includes: a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface communicate with each other through the communication bus. The memory is used to store executable instructions, which cause the processor to execute the image processing method of the aforementioned embodiment.

[0111] The processor can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable devices, transistor logic devices, hardware components, or any combination thereof. The processor can also be a combination that implements computational functions, such as a combination of one or more microprocessors, or a combination of a DSP and a microprocessor.

[0112] The communication bus may include a path for transmitting information between the memory and the communication interface. The communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The symbol is represented by only one line, but this does not mean that there is only one bus or one type of bus.

[0113] This application also provides a non-transitory computer-readable storage medium, which, when the instructions in the storage medium are executed by the processor of an electronic device (server or terminal), enables the processor to perform... Figure 2 or Figure 3 The printing function control method of the startup firmware is shown.

[0114] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0115] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0116] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0117] These computer program instructions may also be stored in a computer-readable storage medium capable of directing a computer or other programmable data processing terminal device to operate in a predictive manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0118] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0119] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.

[0120] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0121] The foregoing has provided a detailed description of the printing function control method, apparatus, electronic device, system-on-a-chip, and computer-readable storage medium for boot firmware provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for controlling the printing of boot firmware, characterized in that, The method includes: Obtain the print function address corresponding to each initialization module in the boot firmware; Read the printing function switch command of the boot firmware; The target function is called according to the print function switch command and the print function address to control the output switching of the print function of the startup firmware; the target function is used to control the output behavior of the startup firmware according to the current state of the print function.

2. The method according to claim 1, characterized in that, The target function includes a print function and an empty function; Then, the step of calling the target function according to the print function switch command and the print function address to control the output switching of the print function of the startup firmware includes: When the printing function is currently enabled as indicated by the printing function switch command, the printing function is called according to the printing function address to control the output switching of the printing function of the startup firmware; When the printing function is currently off as indicated by the printing function switch instruction, the printing function corresponding to the printing function address is modified to an empty function and called to control the output switching of the printing function of the startup firmware.

3. The method according to claim 2, characterized in that, The step of calling the print function according to the print function address to control the output switching of the printing function of the boot firmware includes: The print function is called based on the address of the print function; Execute the print function to output the running logs corresponding to each of the initialization modules.

4. The method according to claim 2, characterized in that, The step of modifying the print function corresponding to the print function address to an empty function and calling it to control the output switching of the print function of the boot firmware includes: Modify the print function corresponding to the address of the print function to the empty function; The empty function is called based on the address of the print function, and after the empty function is executed, the output is empty.

5. The method according to claim 1, characterized in that, Obtaining the print function addresses of each initialization module in the boot firmware includes: Call the preset interface of the boot firmware to create the basic framework of the phase handover information table; In response to the boot firmware entering the loading phase of the initialization module, the phase handover information table is generated; the phase handover information table is formed by each initialization module writing its corresponding print function address into the basic framework; Based on the stage handover information table, obtain the print function address corresponding to each initialization module in the startup firmware.

6. The method according to claim 1, characterized in that, The step of reading the printing function switch command of the boot firmware includes: The platform configuration database access interface corresponding to the boot firmware is invoked to read the variable values ​​of the platform configuration database; the platform configuration database is bound to the user configuration interface and is used to receive the user's settings for enabling or disabling the printing function of the boot firmware, and store the enabling or disabling settings as variable values; The printing function switch command of the startup firmware is determined based on the variable value.

7. The method according to claim 6, characterized in that, The step of determining the printing function switch instruction of the boot firmware based on the variable values ​​of the platform configuration database includes: If the variable value is the first value, it is determined that the printing function of the startup firmware is currently enabled; If the variable value is the second value, it is determined that the printing function of the startup firmware is currently disabled.

8. The method according to claim 1, characterized in that, The method further includes: The printing function switch command of the startup firmware is read to modify the on or off settings of the printing function of the startup firmware.

9. A printing function control device for startup firmware, characterized in that, The device includes: The acquisition module is used to acquire the print function address corresponding to each initialization module in the boot firmware; The reading module is used to read the print function switch command of the startup firmware; The control module is used to call a target function according to the print function switch command and the print function address to control the output switching of the print function of the startup firmware; the target function is used to control the output behavior of the startup firmware according to the current state of the print function.

10. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the method as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the method as described in any one of claims 1 to 8.