CN112732361B - Function realization method, device and equipment - Google Patents

Function realization method, device and equipment Download PDF

Info

Publication number
CN112732361B
CN112732361B CN202110060837.5A CN202110060837A CN112732361B CN 112732361 B CN112732361 B CN 112732361B CN 202110060837 A CN202110060837 A CN 202110060837A CN 112732361 B CN112732361 B CN 112732361B
Authority
CN
China
Prior art keywords
function
hardware information
target function
information
matching
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110060837.5A
Other languages
Chinese (zh)
Other versions
CN112732361A (en
Inventor
杨瀛陆
李雪峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Loongson Technology Corp Ltd
Original Assignee
Loongson Technology Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Loongson Technology Corp Ltd filed Critical Loongson Technology Corp Ltd
Priority to CN202110060837.5A priority Critical patent/CN112732361B/en
Publication of CN112732361A publication Critical patent/CN112732361A/en
Application granted granted Critical
Publication of CN112732361B publication Critical patent/CN112732361B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44536Selecting among different versions
    • G06F9/44542Retargetable
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention provides a function realization method, a device and equipment, wherein the method comprises the steps of obtaining first hardware information corresponding to a target function filled by firmware according to SMBIOS specifications, obtaining second hardware information, wherein the second hardware information is hardware information corresponding to a sub-function of the target function, matching the second hardware information with the first hardware information corresponding to the target function to obtain a matching result, obtaining pre-stored basic code data corresponding to the target function if the matching result is successful, obtaining identification information corresponding to the second hardware information, obtaining pre-stored matching code data corresponding to the sub-function of the target function according to the identification information, and obtaining code data corresponding to the target function according to the basic code data corresponding to the target function and the matching code data corresponding to the sub-function of the target function. The embodiment simplifies the realization process of the target function, thereby ensuring the normal realization of the corresponding function.

Description

Function realization method, device and equipment
Technical Field
The embodiment of the invention relates to the technical field of data processing, in particular to a method, a device and equipment for realizing functions.
Background
SMBIOS (System Management BIOS) is a unified specification that a motherboard or system manufacturer needs to follow to display product management information in a standard format, according to which the firmware fills in the information and provides it to the operating system.
In implementing certain functions (e.g. charging, lighting an indicator light, fingerprint unlocking) the terminal device is also indispensable to hardware devices, in addition to relying on the necessary software. When some functions are implemented, the types of hardware devices involved in implementing the functions may be various, so before implementing the functions, the firmware needs to acquire a plurality of pieces of hardware device information corresponding to the functions, which are filled in according to the SMBIOS standard, and if the plurality of pieces of hardware device information corresponding to any one sub-function of the functions are changed with the hardware device information corresponding to the sub-function which has been implemented before, all implementation processes corresponding to the functions need to be recoded according to the acquired new hardware device information.
However, for a plurality of pieces of hardware device information corresponding to the same function, there may be only one or several pieces of hardware device information corresponding to the sub-function, if all implementation processes of the function need to be recoded each time, the implementation process is complicated, and the workload of a programmer is increased, so that the normal implementation of the corresponding function is affected.
Disclosure of Invention
The embodiment of the invention provides a method, a device and equipment for realizing functions, which are used for simplifying the realization process of each function.
In a first aspect, an embodiment of the present invention provides a method for implementing a function, including:
acquiring first hardware information corresponding to a target function filled in by firmware according to SMBIOS specifications;
acquiring second hardware information, wherein the second hardware information is hardware information corresponding to a sub-function of the target function;
matching the second hardware information with the first hardware information corresponding to the target function to obtain a matching result;
if the matching result is successful, pre-stored basic code data corresponding to the target function is obtained, identification information corresponding to the second hardware information is obtained, and pre-stored matching code data corresponding to the sub-function of the target function is obtained according to the identification information;
and obtaining code data corresponding to the target function according to the basic code data corresponding to the target function and the matching code data corresponding to the sub-function of the target function.
Optionally, the matching the second hardware information with the first hardware information corresponding to the target function to obtain a matching result includes:
matching each item of parameter information in the second hardware information with each item of parameter information in the first hardware information corresponding to the target function according to characters;
if each item of parameter information in the second hardware information can be matched with the parameter information in the first hardware information corresponding to the target function, the matching result is that the matching is successful;
and if any parameter information in the second hardware information and the parameter information in the first hardware information corresponding to the target function cannot be matched, the matching result is that the matching is failed.
Optionally, before the obtaining the first hardware information corresponding to the target function filled in by the firmware according to the SMBIOS specification, the method further includes:
receiving and storing basic code data corresponding to the target function;
determining second hardware information corresponding to different implementation modes of the sub-functions of the target function, and receiving matching code data corresponding to each piece of second hardware information;
and uniformly distributing identification information for each piece of second hardware information and the matched code data corresponding to each piece of second hardware information.
Optionally, the target function includes:
any one or more of a charging function, an indicator light lighting function, a fingerprint unlocking function, and a keypad opening function.
Optionally, the method further comprises:
if the target function is a charging function, the second hardware information comprises any one or more of a CPU model, a charging interface type, a battery model and development board information;
if the target function is an indicator lamp lighting function, the second hardware information comprises any one or more of a CPU model, an indicator lamp type, an indicator lamp number and development board information;
if the target function is a fingerprint unlocking function, the second hardware information comprises any one or more of a CPU model, a type of a fingerprint unlocking module and development board information;
and if the target function is a small keyboard opening function, the second hardware information comprises any one or more of CPU model, small keyboard type and development board information.
Optionally, the obtaining the first hardware information corresponding to the target function filled in by the firmware according to the SMBIOS specification includes:
and acquiring first hardware information corresponding to the target function filled in by the firmware according to the SMBIOS specification from the data structure.
In a second aspect, an embodiment of the present invention provides a function implementation apparatus, including:
the acquisition module is used for acquiring first hardware information corresponding to the target function filled in by the firmware according to the SMBIOS specification;
the processing module is used for acquiring second hardware information, wherein the second hardware information is hardware information corresponding to a sub-function of the target function;
the processing module is further used for matching the second hardware information with the first hardware information corresponding to the target function to obtain a matching result;
the processing module is further configured to obtain pre-stored basic code data corresponding to the target function if the matching result is that the matching is successful, obtain identification information corresponding to the second hardware information, and obtain pre-stored matching code data corresponding to a sub-function of the target function according to the identification information;
the processing module is further configured to obtain code data corresponding to the target function according to the basic code data corresponding to the target function and the matching code data corresponding to the sub-function of the target function.
Optionally, the processing module is further configured to:
matching each item of parameter information in the second hardware information with each item of parameter information in the first hardware information corresponding to the target function according to characters;
if each item of parameter information in the second hardware information can be matched with the parameter information in the first hardware information corresponding to the target function, the matching result is that the matching is successful;
and if any parameter information in the second hardware information and the parameter information in the first hardware information corresponding to the target function cannot be matched, the matching result is that the matching is failed.
In a third aspect, an embodiment of the present invention provides a function implementing apparatus, including: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing computer-executable instructions stored in the memory causes the at least one processor to perform the method of implementing the functions of any one of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where computer-executable instructions are stored, and when executed by a processor, implement the method for implementing a function according to any one of the first aspects.
After the scheme is adopted, the first hardware information corresponding to the target function and the second hardware information corresponding to the sub-function of the target function, which are filled in by the firmware according to the SMBIOS specification, can be obtained, then the second hardware information can be matched with the first hardware information corresponding to the target function to obtain a matching result, if the matching result is successful, the pre-stored basic code data corresponding to the target function is obtained, the identification information corresponding to the second hardware information is obtained, the pre-stored matching code data corresponding to the sub-function of the target function is obtained according to the identification information, the code data corresponding to the target function is obtained according to the basic code data corresponding to the target function and the matching code data corresponding to the sub-function of the target function, and when the target function is realized, if the hardware equipment corresponding to the sub-function has a change, the mode of only modifying the matching code data corresponding to the sub-function can be obtained, so that the realization of the target function is simplified, the corresponding work load of a normal program is reduced, and the normal function is guaranteed.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are only some embodiments of the invention, and that other drawings can be obtained according to these drawings without inventive faculty for a person skilled in the art.
Fig. 1 is a schematic architecture diagram of an application system of a function implementation method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for implementing functions according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a function implementation device according to an embodiment of the present invention;
fig. 4 is a schematic hardware structure of a function implementation device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be capable of including other sequential examples in addition to those illustrated or described. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In implementing certain functions (e.g. charging, lighting an indicator light, fingerprint unlocking) the terminal device is also indispensable to hardware devices, in addition to relying on the necessary software. For example, when implementing the charging function, hardware devices such as a charging interface are required in addition to the necessary software functions.
However, when implementing certain functions, there may be a plurality of kinds of hardware devices involved in implementing the functions. For example, continuing to use the foregoing charging function, the types of charging interfaces that may be involved are Mini USB interface, micro USB interface, dock interface, lightning interface, and Type C interface, and when the charging function is implemented using different interfaces, the corresponding implementation codes are also different. Therefore, before implementing the function, the firmware needs to acquire the hardware information corresponding to the plurality of hardware devices corresponding to the function filled in according to the SMBIOS standard, and if the plurality of hardware device information corresponding to any one sub-function of the function is changed from the hardware device information corresponding to the sub-function implemented before, all implementation processes corresponding to the function need to be recoded according to the acquired new hardware device information. However, for a plurality of pieces of hardware device information corresponding to the same function, there may be only one or several pieces of hardware device information corresponding to the sub-functions (for example, related code data corresponding to different interface types for implementing the charging function), if all implementation processes of the function need to be recoded each time, the implementation process is complicated, and the workload of a programmer is increased, so that the normal implementation of the corresponding function is affected.
Based on the above problems, the method and the device divide the code data corresponding to the target function into the basic code data which does not need to be modified and the matching code data corresponding to each sub-function which needs to be modified, and when the target function is realized, if the hardware equipment corresponding to the sub-function is changed, only the matching code data corresponding to the sub-function can be modified, so that the realization process of the target function is simplified, the workload of a programmer is reduced, and the technical effect of normal realization of the corresponding function is ensured.
Fig. 1 is a schematic architecture diagram of an application system of a method for implementing functions provided in an embodiment of the present invention, as shown in fig. 1, where the system may include: the terminal device 101, the database 102, the firmware 103 and the structure 104, the firmware 103 fills in the first hardware information corresponding to each acquired function into the database 102 according to the SMBIOS specification. The terminal device 101 obtains the first hardware information corresponding to the target function from the database, matches the second hardware information corresponding to the sub-function of the target function obtained from the structure, obtains a matching result, and further processes according to the matching result to finally realize the target function. The terminal equipment can be equipment which can realize corresponding functions, such as a smart phone, a tablet, a personal computer, a private network terminal and the like.
The technical scheme of the invention is described in detail below by specific examples. The following embodiments may be combined with each other, and some embodiments may not be repeated for the same or similar concepts or processes.
Fig. 2 is a flowchart illustrating a method for implementing functions provided in an embodiment of the present invention, where the method in the embodiment may be executed by the terminal device 101. As shown in fig. 2, the method of the present embodiment may include:
s201: and acquiring first hardware information corresponding to the target function filled in by the firmware according to the SMBIOS specification.
In this embodiment, the firmware may fill in all hardware information for implementing each function according to the SMBIOS specification, which may be called as first hardware information, and then, if the hardware device type of one sub-function in any target function changes, may first acquire the first hardware information corresponding to the target function, and then further process according to the acquired first hardware information corresponding to the target function.
Wherein the first hardware information may include a plurality of hardware information tables, and each hardware information table may represent specific information of one hardware device. Illustratively, a hardware information table may be used to describe specific information of the CPU and a hardware information table may be used to describe specific information of the memory.
Further, several items of information may be included in each hardware information table, for example, dmi_sys_vector, dmi_product_name, and dmi_passis_type may be included in the hardware information table, where dmi_sys_vector may represent system VENDOR information, for example, loongson company. Dmi_product_name may represent PRODUCT information, dmi_passis_type may be used to describe the TYPE of device, and a value of 9 may represent a notebook device.
The hardware information table corresponding to the development board may include a 2HSoC development board and a 3a780E two-way development board, where manufacturer codes of the two development boards are longson, a CPU model of the 2HSoC development board is LS2H, a bridge chip is SoC, a CPU way number is 1W, and a board card version number is vi.01. The CPU model of the 3A780E two-way development board is LS3A, the bridge piece is RS780E, the CPU road number is 2W, and the board card version number is VI.03.
The first hardware information corresponding to different terminal devices may be the same or different. And when the first hardware information corresponding to the terminal equipment is the same, indicating that the composition and the type of each hardware equipment in the terminal equipment are completely the same. When the first hardware information corresponding to the terminal device is different, it may indicate that the components of each hardware device in the terminal device are different (i.e., indicate that the functions that can be implemented by each terminal device are different), or may indicate that the components of each hardware device in the terminal device are the same, but the types or models of the devices are different (i.e., indicate that the functions that can be implemented by each terminal device are the same, and that the implementation manner of a certain sub-function in the functions is different). For example, two smart phones manufactured by the same manufacturer have the same components of each hardware device, but different charging interfaces (one is a Mini USB interface and the other is a Type C interface).
Furthermore, to facilitate subsequent management of the hardware information, the hardware information may be stored into a data structure. When the first hardware information needs to be acquired, the first hardware information filled in by the firmware according to the SMBIOS specification can be directly acquired from the data structure.
S202: and acquiring second hardware information, wherein the second hardware information is hardware information corresponding to the sub-function of the target function.
In this embodiment, after the first hardware information corresponding to the target function is acquired, the second hardware information corresponding to the sub-function of the target function that needs to be verified may be acquired. Wherein the second hardware information may be determined for the kernel driver to match the system driver using a detection function. The detection function may be a custom structure, or an existing detection function may be used. Illustratively, the target function may be a charging function, and the sub-function of the target function may be a configuration function of the charging interface.
S203: and matching the second hardware information with the first hardware information corresponding to the target function to obtain a matching result.
In this embodiment, when the second hardware information is matched with the first hardware information corresponding to the target function, if each item of parameter information in the second hardware information can be matched with the parameter information in the first hardware information corresponding to the target function, the matching result is that the matching is successful. If any one of the second hardware information and the parameter information in the first hardware information corresponding to the target function cannot be matched, the matching result is that the matching is failed. That is, the second hardware information is part or all of the first hardware information, and no other information than the first hardware information is allowed.
Further, the first hardware information and the second hardware information may include a plurality of pieces of parameter information, and each piece of parameter information may further include a plurality of characters, so each piece of parameter information in the second hardware information and each piece of parameter information in the first hardware information corresponding to the target function may be matched one by one according to the characters in units of each piece of parameter information.
Specifically, when each item of parameter information in the first hardware information and the second hardware information corresponding to the target function is matched according to the characters, the matching success can be considered only if the characters can be completely matched, and the matching failure can be considered if any character is not matched successfully. For example, if the first hardware information is A1, B2, C1, and the second hardware information is A1, B2, C1, or A1, C1, or the like, the matching may be considered successful. If the characters of the second hardware information and the first hardware information are different, for example, the second hardware information is A2, B2, C1, or the second hardware information is A2, B2, or the like, it may be considered that the matching fails.
S204: if the matching result is successful, the pre-stored basic code data corresponding to the target function is obtained, the identification information corresponding to the second hardware information is obtained, and the pre-stored matching code data corresponding to the sub-function of the target function is obtained according to the identification information.
S205: and obtaining code data corresponding to the target function according to the basic code data corresponding to the target function and the matching code data corresponding to the sub-function of the target function.
In this embodiment, the same target function may involve multiple different hardware devices, most of which are identical, and only individual hardware devices may involve multiple types. Correspondingly, most of the codes for realizing the target function are the same, and only the realization codes of the sub-function parts corresponding to the hardware devices with different types can be different. For example, the target function is a charging function, the charging function may involve a Mini USB interface, a Micro USB interface, a Dock interface, a lighting interface, and a Type C interface, code data corresponding to each interface for implementing the charging function is mostly the same, and only code data corresponding to sub functions related to interface configuration may be different.
In order to reduce the storage space occupied by the code data and improve the working efficiency of the programmer, the code data may be divided into basic code data and matching code data corresponding to the sub-functions of the target function when the target function is implemented, and then the basic code data corresponding to the target function and each matching code data corresponding to the sub-functions of the target function may be stored, wherein the sub-functions of the target function correspond to different hardware device types.
Further, the implementation manner of storing the basic code data corresponding to the target function and each matching code data corresponding to the sub-function of the target function may specifically be:
and receiving and storing basic code data corresponding to the target function.
And determining second hardware information corresponding to different implementation modes of the sub-functions of the target function, and receiving matching code data corresponding to each piece of second hardware information.
And uniformly distributing identification information for each piece of second hardware information and the matched code data corresponding to each piece of second hardware information.
Specifically, the basic code data corresponding to each target function may be received and stored first, and then second hardware information corresponding to different implementation manners of the sub-functions of the target function is determined, where each second hardware information corresponds to an implementation manner of one sub-function, that is, the matching code data. And allocating identification information to each piece of second hardware information and corresponding matching code data, and acquiring the matching code data corresponding to the second hardware information through the identification information.
In addition, when the identification information is allocated to the second hardware information of the same target function and the corresponding matching code data, in order to indicate different sub-functions belonging to the same target function, when the identification information is set, each identification information may carry a character belonging to the same target function. For example, if F may identify the target function, the first letter of each piece of second hardware information and the corresponding piece of identification information of the matching code data belonging to the same target function may be set to F, and exemplary, the identification information may be F-11, F-22, F-33, etc., F represents the charging function, and 11, 22, and 33 represent different implementations of the sub-functions of the charging function (i.e., the second hardware information and the corresponding matching code data corresponding to the charging interface configuration function). Furthermore, the foregoing description is only one embodiment, and other embodiments capable of expressing this meaning are also within the scope of the present application.
After the second hardware information and the corresponding matching code data are distributed to complete identification information, and after the matching result is that the matching is successful, the pre-stored basic code data corresponding to the target function can be directly obtained, the identification information corresponding to the second hardware information is obtained, and then the pre-stored matching code data corresponding to the sub-function of the target function is obtained according to the identification information. And obtaining code data corresponding to the target function according to the basic code data corresponding to the target function and the matching code data corresponding to the sub-function of the target function, and running the code data corresponding to the target function to realize the target function.
After the scheme is adopted, the first hardware information corresponding to the target function and the second hardware information corresponding to the sub-function of the target function, which are filled in by the firmware according to the SMBIOS specification, can be obtained first, then the second hardware information can be matched with the first hardware information corresponding to the target function to obtain a matching result, if the matching result is successful, the pre-stored basic code data corresponding to the target function is obtained, the identification information corresponding to the second hardware information is obtained, the pre-stored matching code data corresponding to the sub-function of the target function is obtained according to the identification information, the code data corresponding to the target function is obtained according to the basic code data corresponding to the target function and the matching code data corresponding to the sub-function of the target function, and when the target function is realized, if the hardware equipment corresponding to the sub-function has a change, the matching code data corresponding to the sub-function can be modified only, the realization process of the target function is simplified, and the workload of a programmer is reduced, and the normal realization of the corresponding function is ensured.
The examples of the present specification also provide some specific embodiments of the method based on the method of fig. 2, which is described below.
In another embodiment, the method may further include:
if the matching result is that the matching fails, a matching failure prompt is generated, and the matching failure prompt is sent to the terminal equipment for display.
In this embodiment, if the matching between the first hardware information and the second hardware information corresponding to the target function fails, a matching failure prompt may be generated, and the matching failure prompt is sent to the terminal device of the relevant programmer for display, so as to remind the programmer that the matching of the hardware information is unsuccessful, and the programmer needs to correct in time. For example, the match failure prompt may be a related text prompt that semantically is "not a matched device".
In another embodiment, the target function may include:
any one or more of a charging function, an indicator light lighting function, a fingerprint unlocking function, and a keypad opening function.
Specifically, if the target function is a charging function, the second hardware information includes any one or more of a CPU model, a charging interface type, a battery model, and development board information.
And if the target function is an indicator lamp lighting function, the second hardware information comprises any one or more of a CPU model, an indicator lamp type, an indicator lamp number and development board information.
And if the target function is a fingerprint unlocking function, the second hardware information comprises any one or more of a CPU model, a fingerprint unlocking module type and development board information.
And if the target function is a small keyboard opening function, the second hardware information comprises any one or more of CPU model, small keyboard type and development board information.
For example, the CPU model may be LS3A, the charging interface Type may be Mini USB interface, micro USB interface, dock interface, lighting interface, or Type C interface, and the indicator lamp number may be 0, 1, 2.
In addition, in a specific embodiment, the specific implementation procedure of the function implementation method may be: when software corresponding to a target function starts to run, an initialization function loongson_xxx_laptop_init can be executed first, in the process of executing the initialization function, whether second hardware information described by a detection function dmi_check_system detection structure is consistent with first hardware information corresponding to the target function filled by firmware according to an SMBIOS specification or not can be detected by using the detection function dmi_check_system, if the two pieces of information are consistent, a function dmi_check_cb is called to obtain a specific variable value driver_data, namely identification information, basic code data of the target function and matching code data corresponding to the second hardware information are determined according to the identification information, and code data corresponding to the target function is obtained. If the two information are inconsistent, a match failure prompt can be generated. The detection function dmi_check_system can detect the characters one by taking each item of parameter information as a unit. The second hardware information may be stored in a table format, and for example, may be stored in a table format in which a loongson_device_table is set in advance. In addition, other storage modes are also within the scope of the present application, and will not be discussed in detail herein.
Based on the same idea, the embodiment of the present disclosure further provides a device corresponding to the method, and fig. 3 is a schematic structural diagram of a function implementation device provided by the embodiment of the present disclosure, where, as shown in fig. 3, the device provided by the embodiment may include:
the obtaining module 301 is configured to obtain first hardware information corresponding to a target function filled in by firmware according to an SMBIOS specification.
And the processing module 302 is configured to obtain second hardware information, where the second hardware information is hardware information corresponding to a sub-function of the target function.
The processing module 302 is further configured to match the second hardware information with the first hardware information corresponding to the target function, so as to obtain a matching result.
In this embodiment, the processing module is further configured to:
and matching each item of parameter information in the second hardware information with each item of parameter information in the first hardware information corresponding to the target function according to characters.
And if each item of parameter information in the second hardware information can be matched with the parameter information in the first hardware information corresponding to the target function, the matching result is that the matching is successful.
And if any parameter information in the second hardware information and the parameter information in the first hardware information corresponding to the target function cannot be matched, the matching result is that the matching is failed.
The processing module 302 is further configured to obtain pre-stored basic code data corresponding to the target function if the matching result is that the matching is successful, obtain identification information corresponding to the second hardware information, and obtain pre-stored matching code data corresponding to a sub-function of the target function according to the identification information.
The processing module 302 is further configured to obtain code data corresponding to the target function according to the basic code data corresponding to the target function and the matching code data corresponding to the sub-function of the target function.
The obtaining module 301 is further configured to:
and receiving and storing basic code data corresponding to the target function.
And determining second hardware information corresponding to different implementation modes of the sub-functions of the target function, and receiving matching code data corresponding to each piece of second hardware information.
And uniformly distributing identification information for each piece of second hardware information and the matched code data corresponding to each piece of second hardware information.
In another embodiment, the target function includes:
any one or more of a charging function, an indicator light lighting function, a fingerprint unlocking function, and a keypad opening function.
In another embodiment, the processing module 302 is further configured to:
and if the target function is a charging function, the second hardware information comprises any one or more of a CPU model, a charging interface type, a battery model and development board information.
And if the target function is an indicator lamp lighting function, the second hardware information comprises any one or more of a CPU model, an indicator lamp type, an indicator lamp number and development board information.
And if the target function is a fingerprint unlocking function, the second hardware information comprises any one or more of a CPU model, a fingerprint unlocking module type and development board information.
And if the target function is a small keyboard opening function, the second hardware information comprises any one or more of CPU model, small keyboard type and development board information.
In another embodiment, the processing module 302 is further configured to:
and acquiring first hardware information corresponding to the target function filled in by the firmware according to the SMBIOS specification from the data structure.
The device provided by the embodiment of the present invention can implement the method of the embodiment shown in fig. 2, and its implementation principle and technical effects are similar, and will not be described herein.
Fig. 4 is a schematic hardware structure of a function implementation device according to an embodiment of the present invention. As shown in fig. 4, the apparatus 400 provided in this embodiment includes: at least one processor 401 and a memory 402. The processor 401 and the memory 402 are connected by a bus 403.
In a specific implementation, at least one processor 401 executes computer-executable instructions stored in the memory 402, so that the at least one processor 401 performs the method in the above method embodiment.
The specific implementation process of the processor 401 may refer to the above-mentioned method embodiment, and its implementation principle and technical effects are similar, and this embodiment will not be described herein again.
In the embodiment shown in fig. 4, it should be understood that the processor may be a central processing unit (english: central Processing Unit, abbreviated as CPU), or may be other general purpose processors, digital signal processors (english: digital Signal Processor, abbreviated as DSP), application specific integrated circuits (english: application Specific Integrated Circuit, abbreviated as ASIC), or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
The memory may comprise high speed RAM memory or may further comprise non-volatile storage NVM, such as at least one disk memory.
The bus may be an industry standard architecture (Industry Standard Architecture, ISA) bus, an external device interconnect (Peripheral Component Interconnect, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, the buses in the drawings of the present application are not limited to only one bus or one type of bus.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores computer execution instructions, and when a processor executes the computer execution instructions, the function implementation method of the method embodiment is realized.
The computer readable storage medium described above may be implemented by any type of volatile or non-volatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk. A readable storage medium can be any available medium that can be accessed by a general purpose or special purpose computer.
An exemplary readable storage medium is coupled to the processor such the processor can read information from, and write information to, the readable storage medium. In the alternative, the readable storage medium may be integral to the processor. The processor and the readable storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuits, ASIC for short). The processor and the readable storage medium may reside as discrete components in a device.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the invention.

Claims (9)

1. A method for implementing a function, comprising:
acquiring first hardware information corresponding to a target function filled in by firmware according to SMBIOS specifications;
acquiring second hardware information, wherein the second hardware information is hardware information corresponding to a sub-function of the target function;
matching the second hardware information with the first hardware information corresponding to the target function to obtain a matching result;
if the matching result is successful, pre-stored basic code data corresponding to the target function is obtained, identification information corresponding to the second hardware information is obtained, and pre-stored matching code data corresponding to the sub-function of the target function is obtained according to the identification information;
obtaining code data corresponding to the target function according to basic code data corresponding to the target function and matching code data corresponding to a sub-function of the target function;
before the obtaining the first hardware information corresponding to the target function filled in by the firmware according to the SMBIOS specification, the method further comprises:
receiving and storing basic code data corresponding to the target function;
determining second hardware information corresponding to different implementation modes of the sub-functions of the target function, and receiving matching code data corresponding to each piece of second hardware information;
and uniformly distributing identification information for each piece of second hardware information and the matched code data corresponding to each piece of second hardware information.
2. The method of claim 1, wherein the matching the second hardware information with the first hardware information corresponding to the target function to obtain a matching result includes:
matching each item of parameter information in the second hardware information with each item of parameter information in the first hardware information corresponding to the target function according to characters;
if each item of parameter information in the second hardware information can be matched with the parameter information in the first hardware information corresponding to the target function, the matching result is that the matching is successful;
and if any parameter information in the second hardware information and the parameter information in the first hardware information corresponding to the target function cannot be matched, the matching result is that the matching is failed.
3. The method according to claim 1 or 2, wherein the target function comprises:
any one or more of a charging function, an indicator light lighting function, a fingerprint unlocking function, and a keypad opening function.
4. A method according to claim 3, further comprising:
if the target function is a charging function, the second hardware information comprises any one or more of a CPU model, a charging interface type, a battery model and development board information;
if the target function is an indicator lamp lighting function, the second hardware information comprises any one or more of a CPU model, an indicator lamp type, an indicator lamp number and development board information;
if the target function is a fingerprint unlocking function, the second hardware information comprises any one or more of a CPU model, a type of a fingerprint unlocking module and development board information;
and if the target function is a small keyboard opening function, the second hardware information comprises any one or more of CPU model, small keyboard type and development board information.
5. The method according to claim 1 or 2, wherein the obtaining the first hardware information corresponding to the target function filled in by the firmware according to the SMBIOS specification includes:
and acquiring first hardware information corresponding to the target function filled in by the firmware according to the SMBIOS specification from the data structure.
6. A function realizing apparatus, comprising:
the acquisition module is used for acquiring first hardware information corresponding to the target function filled in by the firmware according to the SMBIOS specification;
the processing module is used for acquiring second hardware information, wherein the second hardware information is hardware information corresponding to a sub-function of the target function;
the processing module is further used for matching the second hardware information with the first hardware information corresponding to the target function to obtain a matching result;
the processing module is further configured to obtain pre-stored basic code data corresponding to the target function if the matching result is that the matching is successful, obtain identification information corresponding to the second hardware information, and obtain pre-stored matching code data corresponding to a sub-function of the target function according to the identification information;
the processing module is further used for obtaining code data corresponding to the target function according to the basic code data corresponding to the target function and the matching code data corresponding to the sub-function of the target function;
the acquisition module is further configured to: receiving and storing basic code data corresponding to the target function; determining second hardware information corresponding to different implementation modes of the sub-functions of the target function, and receiving matching code data corresponding to each piece of second hardware information; and uniformly distributing identification information for each piece of second hardware information and the matched code data corresponding to each piece of second hardware information.
7. The apparatus of claim 6, wherein the processing module is further configured to:
matching each item of parameter information in the second hardware information with each item of parameter information in the first hardware information corresponding to the target function according to characters;
if each item of parameter information in the second hardware information can be matched with the parameter information in the first hardware information corresponding to the target function, the matching result is that the matching is successful;
and if any parameter information in the second hardware information and the parameter information in the first hardware information corresponding to the target function cannot be matched, the matching result is that the matching is failed.
8. A function realizing apparatus, characterized by comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing computer-executable instructions stored in the memory causes the at least one processor to perform the function implementation method of any of claims 1 to 5.
9. A computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, implement the function implementing method of any one of claims 1 to 5.
CN202110060837.5A 2021-01-18 2021-01-18 Function realization method, device and equipment Active CN112732361B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110060837.5A CN112732361B (en) 2021-01-18 2021-01-18 Function realization method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110060837.5A CN112732361B (en) 2021-01-18 2021-01-18 Function realization method, device and equipment

Publications (2)

Publication Number Publication Date
CN112732361A CN112732361A (en) 2021-04-30
CN112732361B true CN112732361B (en) 2023-05-16

Family

ID=75591968

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110060837.5A Active CN112732361B (en) 2021-01-18 2021-01-18 Function realization method, device and equipment

Country Status (1)

Country Link
CN (1) CN112732361B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0488427A (en) * 1990-07-25 1992-03-23 Nec Corp Simple execution performance information generation system
CN107357558A (en) * 2016-05-10 2017-11-17 阿里巴巴集团控股有限公司 Build the method and device of code
CN107817987A (en) * 2016-09-13 2018-03-20 腾讯科技(深圳)有限公司 A kind of hardware configuration method, system, terminal and server
CN108920212A (en) * 2018-06-29 2018-11-30 郑州云海信息技术有限公司 A kind of product starting method, system and associated component based on linux kernel

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0488427A (en) * 1990-07-25 1992-03-23 Nec Corp Simple execution performance information generation system
CN107357558A (en) * 2016-05-10 2017-11-17 阿里巴巴集团控股有限公司 Build the method and device of code
CN107817987A (en) * 2016-09-13 2018-03-20 腾讯科技(深圳)有限公司 A kind of hardware configuration method, system, terminal and server
CN108920212A (en) * 2018-06-29 2018-11-30 郑州云海信息技术有限公司 A kind of product starting method, system and associated component based on linux kernel

Also Published As

Publication number Publication date
CN112732361A (en) 2021-04-30

Similar Documents

Publication Publication Date Title
US8214541B2 (en) Method and system for uniquely identifying peripheral component devices
US20150074386A1 (en) Boot method and boot system
CN111158968B (en) BIOS configuration information self-checking method, device and storage medium
CN110096314B (en) Interface initialization method, device, equipment and computer readable storage medium
US9058257B2 (en) Persistent block storage attached to memory bus
US20090300588A1 (en) Method and apparatus for acquiring definitions of debug code of basic input/output system
US7600106B2 (en) System and method for enabling/disabling write-protection of a basic input output system
US20190087208A1 (en) Method and apparatus for loading elf file of linux system in windows system
CN110119623A (en) A kind of credible main board implementation method for realizing that firmware is actively measured using TPCM
US12008171B2 (en) Program download method for intelligent terminal with memory card identifier and intelligent terminal with memory card identifier
CN110515671B (en) Initialization method, initialization device, terminal device and readable storage medium
US20110055533A1 (en) System management interrupt interface wrapper
CN110297726B (en) Computer system with serial presence detection data and memory module control method
CN103455750B (en) The high peace verification method of a kind of embedded device and device
CN115454512A (en) Chip drive loading configuration method, device, equipment and storage medium
CN114385251A (en) Operating system booting method, system, terminal and storage medium based on memory
CN112732361B (en) Function realization method, device and equipment
CN116450046A (en) Cloud disk implementation method and device, intelligent network card, server and storage medium
CN115878327A (en) Bus reservation method, device, server, electronic equipment and storage medium
CN113760810B (en) Information processing method, information processing device, equipment and storage medium
CN110119625A (en) A kind of trusted computing method
CN115617419A (en) Intelligent loading method, device, equipment and medium for driving of Internet of things operating system
CN106293620B (en) Method for detecting parameters in Flash Rom by intel platform
CN109344005B (en) Basic input output system BIOS redundancy backup method and device
CN110609988A (en) Form verification method and equipment

Legal Events

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