CN112069102B - GPIO controller configuration method and system - Google Patents
GPIO controller configuration method and system Download PDFInfo
- Publication number
- CN112069102B CN112069102B CN202010923798.2A CN202010923798A CN112069102B CN 112069102 B CN112069102 B CN 112069102B CN 202010923798 A CN202010923798 A CN 202010923798A CN 112069102 B CN112069102 B CN 112069102B
- Authority
- CN
- China
- Prior art keywords
- target
- gpio controller
- configuration information
- attribute
- gpio
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/40—Bus structure
- G06F13/4063—Device-to-bus coupling
- G06F13/4068—Electrical coupling
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/02—Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Stored Programmes (AREA)
Abstract
The embodiment of the invention provides a method and a system for configuring a GPIO controller, which comprises the following steps: when a target GPIO controller is initialized, acquiring a target device identifier corresponding to the target GPIO controller; calling target configuration information corresponding to the target equipment identifier from an ACPI table; wherein the target configuration information is preconfigured in the ACPI table for the target GPIO controller; configuring attributes of the target GPIO controller based on the target configuration information. The embodiment of the invention can realize the initialization of the GPIO controller based on the ACIP table, so that the GPIO controller can normally work based on the appointed configuration information.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a GPIO controller configuration method and a GPIO controller configuration system.
Background
GPIO (General-purpose input/output) is a short term for General-purpose programmable input/output port, and many external devices or circuits with simple structures need to be controlled in an operating system, some of the devices need to be controlled by a CPU, and some of the devices need to provide input signals to the CPU. If the traditional serial port or parallel port is used for controlling the equipment, the GPIO is usually used on a microprocessor.
The GPIO controller is a device for controlling the input and output of GPIO. In the kernel of the operating system, various attributes of all the GPIO controllers need to be initialized, however, at present, the attributes of the GPIO controllers are rarely specified for the GPIO controllers, and the initialization scheme of the GPIO controllers is completed.
Disclosure of Invention
In view of the above, embodiments of the present invention are proposed to provide a GPIO controller configuration method and a corresponding GPIO controller configuration system that overcome or at least partially solve the above-mentioned problems.
In order to solve the above problem, an embodiment of the present invention discloses a GPIO controller configuration method based on ACPI, including:
when a target GPIO controller is initialized, acquiring a target device identifier corresponding to the target GPIO controller;
calling target configuration information corresponding to the target equipment identifier from an ACPI table; wherein the target configuration information is preconfigured in the ACPI table for the target GPIO controller;
and configuring the attribute of the target GPIO controller based on the target configuration information, and finishing the initialization of the target GPIO controller.
Optionally, when initializing the target GPIO controller, before acquiring the device identifier corresponding to the target GPIO controller, the method further includes:
in the DSDT of the ACPI table, determining corresponding configuration information based on the device identification of the GPIO controller;
and setting the attribute and the corresponding attribute value of the GPIO controller in the configuration information.
Optionally, setting the attribute and the corresponding attribute value of the GPIO controller in the configuration information includes:
determining a DSD object in the configuration information;
and setting the attribute and the corresponding attribute value of the GPIO controller in the DSD object.
Optionally, the retrieving the target configuration information corresponding to the target device identifier from the ACPI table includes:
and taking the configuration information corresponding to the equipment identifier matched with the target equipment identifier from the DSDT of the ACPI table as target configuration information.
Optionally, the configuring, based on the target configuration information, the attribute of the target GPIO controller includes:
acquiring a target attribute value corresponding to a target attribute from the DSD object of the target configuration information;
and configuring the attribute value of the attribute corresponding to the target attribute in the target GPIO controller as the target attribute value.
Optionally, after configuring the attribute of the target GPIO controller based on the target configuration information and completing initialization of the target GPIO controller, the method further includes:
when the target GPIO controller is initialized to be failed, calling a device tree;
configuring the attribute of the target GPIO controller based on the target attribute and the corresponding target attribute value of the target GPIO controller in the device tree, and finishing the initialization of the target GPIO controller.
The embodiment of the invention also discloses a GPIO controller configuration system based on ACPI, which comprises:
the device identification acquisition module is used for acquiring a target device identification corresponding to a target GPIO controller when the target GPIO controller is initialized;
the configuration information calling module is used for calling target configuration information corresponding to the target equipment identifier from an ACPI (application program interface) table; wherein the target configuration information is preconfigured in the ACPI table for the target GPIO controller;
and the attribute configuration module is used for configuring the attribute of the target GPIO controller based on the target configuration information and finishing the initialization of the target GPIO controller.
Optionally, the system further comprises:
the configuration information determining module is used for determining corresponding configuration information based on the device identification of the GPIO controller in the DSDT of the ACPI table;
and the attribute setting module is used for setting the attribute and the corresponding attribute value of the GPIO controller in the configuration information.
Optionally, the attribute setting module is configured to determine a DSD object in the configuration information; and setting the attribute and the corresponding attribute value of the GPIO controller in the DSD object.
Optionally, the configuration information retrieving module is configured to use, as the target configuration information, the configuration information corresponding to the device identifier that is matched with the target device identifier from the DSDT in the ACPI table.
Optionally, the attribute configuration module is configured to obtain a target attribute value corresponding to a target attribute from the DSD object of the target configuration information; and configuring the attribute value of the attribute corresponding to the target attribute in the target GPIO controller into the target attribute value.
Optionally, the system further comprises: the switching module is used for calling the device tree when the target GPIO controller is initialized to be failed; configuring the attribute of the target GPIO controller based on the target attribute and the corresponding target attribute value of the target GPIO controller in the device tree, and finishing the initialization of the target GPIO controller.
The embodiment of the invention discloses an electronic device, which comprises a processor, a memory and a computer program which is stored on the memory and can run on the processor, wherein when the computer program is executed by the processor, the steps of the GPIO controller configuration method are realized.
The embodiment of the invention discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the steps of the GPIO controller configuration method are realized.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, when the target GPIO controller is initialized, the target device identifier corresponding to the target GPIO controller is acquired, so that the target configuration information corresponding to the target device identifier is called from the ACPI table, and therefore, the attribute of the target GPIO controller can be configured based on the target configuration information. The embodiment of the invention can realize the initialization of the GPIO controller based on the advanced configuration and power management interface (ACIP) table, so that the GPIO controller can normally work based on the appointed configuration information, and because the configuration information of the GPIO controller is only required to be pre-configured on the advanced configuration and power management interface (ACIP) table in the operating system and then called during initialization, the additional burden of the system can not be caused, and the smoothness of the system is ensured.
Drawings
Fig. 1 is a flowchart illustrating steps of an embodiment of a GPIO controller configuration method according to the present invention;
fig. 2 is a block diagram of an embodiment of a GPIO controller configuration system according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the GPIO controller configuration method and system of the embodiments of the present invention, in the GPIO controller initialization process, a plurality of attributes and corresponding attribute values of the GPIO controller may be specified by using the DSD object corresponding to the DSDT in the ACPI table, so that initialization of the GPIO controller based on the ACPI is achieved, and the GPIO controller may start to operate normally.
Referring to fig. 1, a flowchart of steps of an embodiment of a GPIO controller configuration method according to the present invention is shown, and is applied to a platform having an advanced configuration and power management interface ACPI table, and specifically includes the following steps:
In a specific implementation, when the device is started, the device needs to be initialized (registered), for example, the GPIO controller needs to be initialized, so that the GPIO controller can start to operate normally. The device identifier refers to a code or name that can be used to uniquely identify the device, for example, the device identifier of the GPIO controller may be GPO 0.
In the embodiment of the invention, the initialized GPIO controller is a target GPIO controller, and when the target GPIO controller is determined, the target device identifier corresponding to the target GPIO controller is obtained.
102, calling target configuration information corresponding to the target equipment identifier from an ACPI table; wherein the target configuration information is preconfigured in the ACPI table for the target GPIO controller.
ACPI (advanced Configuration and Power Management interface) is a standard firmware specification of platforms such as Intel (i386, x86_64, IA64), and most information required by operating systems from BIOS (Basic Input Output System) can be obtained from ACPI. Specifically, the information of ACPI may include: the configuration information, ACPI related equipment, bottom hardware, power management and equipment hot plug are composed of a plurality of ACPI tables, the ACPI tables are stored in a memory, and all the ACPI tables can be acquired from the memory when needed.
In the embodiment of the invention, the configuration information corresponding to all GPIO controllers is pre-configured in the ACPI table. Specifically, the configuration information may include attributes such as a register base address, a register end address, a pin number included in the controller, and the like, and corresponding attribute values, and the configuration information is bound to the device identifier of the GPIO controller, so that when a target GPIO controller that needs to be initialized is determined, target configuration information corresponding to the target device identifier may be acquired from the ACIP table according to the target device identifier of the target GPIO controller.
After the target configuration information corresponding to the target GPIO controller is acquired, the attributes related to the target GPIO controller, such as the address of a configuration register, may be configured based on the target configuration information, thereby completing initialization of the target GPIO controller.
In the embodiment of the invention, when the target GPIO controller is initialized, the target device identifier corresponding to the target GPIO controller is acquired, so that the target configuration information corresponding to the target device identifier is called from the ACPI table, and therefore, the attribute of the target GPIO controller can be configured based on the target configuration information. The embodiment of the invention can realize the initialization of the GPIO controller based on the ACIP table, so that the GPIO controller can normally work based on the appointed configuration information, and because the configuration information of the GPIO controller is only required to be updated on the existing ACIP table, the additional burden of the system can not be caused, and the fluency of the system is ensured.
In an exemplary embodiment, in step 101, before acquiring a device identifier corresponding to a target GPIO controller when the target GPIO controller is initialized, the method may further include: in the DSDT of the ACPI table, determining corresponding configuration information based on the device identification of the GPIO controller; and setting the attribute and the corresponding attribute value of the GPIO controller in the configuration information.
Among them, there are many tables in the ACPI Table, where DSDT (Differentiated System Description Table) is one of the most important ACPI tables, and the DSDT can provide execution and configuration information about the basic System. Therefore, in the DSDT of the ACPI table according to the embodiments of the present invention, the attribute specified by the user and the corresponding attribute value may be preset in the configuration information corresponding to the device identifier of each GPIO controller.
In the above example, when the DSDT configures corresponding configuration information for each GPIO controller in advance, so that subsequent initialization of the GPIO controller can be completed based on the configuration information in the DSDT in the ACPI table.
In an exemplary embodiment, setting the attribute and the corresponding attribute value of the GPIO controller in the configuration information may include: determining a DSD object in the configuration information; and setting the attribute and the corresponding attribute value of the GPIO controller in the DSD object.
Where a DSDT has a DSD object (_ DSD), the transfer of data, such as hardware-related attribute configuration data, may be implemented based on the DSD object. In the embodiment of the invention, the attribute and the attribute value which are specified by a user and correspond to each GPIO controller are set in the DSD object of the configuration information corresponding to each GPIO controller in the DSDT.
In the above example, when the DSD object of the DSDT configures the corresponding attribute and attribute value for each GPIO controller in advance, so that the initialization can be completed based on the configuration information in the DSD object in the DSDT in the ACPI table when the GPIO controller is initialized subsequently.
In one specific example, the firmware needs to specify an attribute and a corresponding attribute value in a _ DSD object of configuration information corresponding to a GPIO controller of the DSDT, as an attribute value of an attribute for configuring the GPIO controller by the core. Specifically, the configuration information of the GPIO controller in the DSDT is as follows:
Device(GPO0){
Name(_DSD,Package()
ToUUID(xxx-xxx-xxx-xxx)
Package(){
Package(0x02){
"conf_offset"
0xXXXX
},
Package(){
Package(0x02){
"ngpios",
0xXXXX}}......}
in the above example, for one GPIO controller (GPO0), two attributes and corresponding attribute values, respectively conf _ offset (register offset address) and corresponding attribute value, and ngpios (number of interfaces of GPIO) corresponding attribute values, are set in _ DSD of its configuration information.
In an exemplary embodiment, the step 102 of retrieving target configuration information corresponding to the target device identifier from an ACPI table may include: and taking the configuration information corresponding to the equipment identifier matched with the target equipment identifier from the DSDT of the ACPI table as target configuration information.
In the embodiment of the present invention, after the target device identifier of the target GPIO controller is obtained, corresponding configuration information may be called from the DSDT of the ACPI table as the target configuration information of the target GPIO controller. In the above example, when the target GPIO controller needs to be initialized, the corresponding target configuration information can be called from the DSDT only based on the target device identifier, and the data calling method is simple and easy to implement.
In an exemplary embodiment, the step 103 of configuring the attribute of the target GPIO controller based on the target configuration information may include: acquiring a target attribute value corresponding to a target attribute from the DSD object of the target configuration information; and configuring the attribute value of the attribute corresponding to the target attribute in the target GPIO controller as the target attribute value.
After the target configuration information of the target GPIO controller is called, the target attribute and the corresponding target attribute value can be further acquired from the DSD object in the target configuration information, and then the attribute which is the same as the target attribute in the target GPIO controller is configured to be the target attribute value.
Specifically, the kernel parses a DSD object in the configuration information corresponding to the target GPIO controller, and then configures an attribute value of an attribute corresponding to the target GPIO controller using a target attribute value of a target attribute in the DSD object. For example:
device_property_read_u32(dev,"ngpios",(u32*)&lgpio->chip.ngpio);
device_property_read_u32(dev,"conf_offset",(u32*)&lgpio->conf_offset)。
in the above example, if the attribute and the attribute value obtained from the target configuration information are: ngpios: 0xxxx, the attribute value of the chip. ngpio attribute in the target GPIO controller may be configured as 0 xxxx. If the attributes and attribute values obtained from the target configuration information are: conf _ offset: 0xxxx, the attribute value of the conf _ offset attribute in the target GPIO controller may be configured as 0 xxxxxx.
In an exemplary embodiment, after configuring the attributes of the target GPIO controller based on the target configuration information, the method may further include: when the target GPIO controller is initialized to be failed, calling a device tree; and configuring the attribute of the target GPIO controller based on the target attribute and the corresponding target attribute value of the target GPIO controller in the device tree, and finishing the initialization of the target GPIO controller.
In a specific implementation, after the initialization of the target GPIO controller is completed based on the ACPI table, the target GPIO controller may be normally operated in the system. In practice, however, the initialization of the target GPIO controller cannot be completed based on the ACPI table due to software or hardware reasons, and if the initialization fails, the initialization mode may be switched, for example, to initialize the target GPIO controller based on a Device Tree (Device Tree).
The device tree is a data structure for describing hardware, and many hardware information can be directly transmitted to the system through the device tree, so that the attribute and the corresponding attribute value of each GPIO controller specified by a user are pre-configured in the node of the device tree in the embodiment of the invention.
Specifically, after the initialization target GPIO controller fails, a device tree may be called, and then the attributes in the target GPIO controller are configured to be target attribute values corresponding to the target attributes based on the target attributes and corresponding target attribute values preset for the target GPIO controller in the called device tree.
Specifically, the configuration information of the GPIO controller in a device tree is as follows:
gpiodc:gpio@0{
......
conf_offset=<0xXXXX>;
out_offset=<0xXXXX>;
ngpios=<XX>;
......}
in the above example, the attribute and the attribute value corresponding to the attribute are set in the device tree for the GPIO controller GPIO @ 0. When the target GPIO controller is initialized based on the device tree, the attribute and the attribute value corresponding to the GPIO controller may be obtained from the device tree to configure the attribute value of the attribute of the target GPIO controller, thereby completing the initialization of the target GPIO controller.
Optionally, if the initialization of the target GPIO controller based on the device tree fails, the initialization of the target GPIO controller may be implemented based on the attribute value of the attribute of the GPIO controller that is fixedly configured by the kernel, so as to further improve the robustness of the system.
In one specific example, the configuration information of the GPIO controller in the core is as follows:
void acpi_loongson_gpio_get_props(struct platform_device*pdev,structloongson_gpio_chip*lgpio)
{
structplatform_gpio_data*gpio_data=
(structplatform_gpio_data*)pdev->dev.platform_data;
lgpio->chip.ngpio=gpio_data->ngpio;
lgpio->chip.base=gpio_data->gpio_base;
......}
in the above example, the attributes of the GPIO controller are passed and configured through the dev.
By applying the embodiment of the invention, when the target GPIO controller initialized based on the ACPI table fails, the initialization can be switched to be based on the device tree, or the configuration information of the target GPIO controller is configured in the kernel to realize the initialization, the device does not need to be restarted, and the robustness of the system is improved.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those of skill in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the embodiments of the invention.
Referring to fig. 2, a block diagram of a configuration system of a GPIO controller according to an embodiment of the present invention is shown, and is applied to a platform having an advanced configuration and power management interface ACPI table, and specifically includes the following modules:
the device identifier obtaining module 201 is configured to obtain a target device identifier corresponding to a target GPIO controller when the target GPIO controller is initialized;
a configuration information retrieving module 202, configured to retrieve target configuration information corresponding to the target device identifier from an ACPI table; wherein the target configuration information is preconfigured in the ACPI table for the target GPIO controller;
and the attribute configuration module 203 is configured to configure the attribute of the target GPIO controller based on the target configuration information, and complete initialization of the target GPIO controller.
In a preferred embodiment of the present invention, the system further comprises:
the configuration information determining module is used for determining corresponding configuration information based on the device identification of the GPIO controller in the DSDT of the ACPI table;
and the attribute setting module is used for setting the attribute and the corresponding attribute value of the GPIO controller in the configuration information.
In a preferred embodiment of the present invention, the attribute setting module is configured to determine a DSD object in the configuration information; and setting the attribute and the corresponding attribute value of the GPIO controller in the DSD object.
In a preferred embodiment of the present invention, the configuration information retrieving module 202 is configured to use, as the target configuration information, the configuration information corresponding to the device identifier matching the target device identifier from the DSDT in the ACPI table.
In a preferred embodiment of the present invention, the attribute configuration module 203 is configured to obtain a target attribute value corresponding to a target attribute from the DSD object of the target configuration information; and configuring the attribute value of the attribute corresponding to the target attribute in the target GPIO controller as the target attribute value.
In a preferred embodiment of the present invention, the system further comprises: the switching module is used for calling the device tree when the target GPIO controller is initialized to be failed; configuring the attribute of the target GPIO controller based on the target attribute and the corresponding target attribute value of the target GPIO controller in the device tree, and finishing the initialization of the target GPIO controller.
To sum up, in the embodiment of the present invention, when the target GPIO controller is initialized, the target device identifier corresponding to the target GPIO controller is obtained to retrieve the target configuration information corresponding to the target device identifier from the ACPI table, so that the attribute of the target GPIO controller can be configured based on the target configuration information. The embodiment of the invention can realize the initialization of the GPIO controller based on the ACIP table, so that the GPIO controller can normally work based on the appointed configuration information, and because the configuration information of the GPIO controller is only required to be preset on the existing ACIP table on the operating system and then is called during initialization, the additional burden of the system can not be caused, and the fluency of the system is ensured.
For the system embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiment of the invention discloses electronic equipment, which comprises a processor, a memory and a computer program which is stored on the memory and can run on the processor, wherein when the computer program is executed by the processor, the steps of the GPIO controller configuration method embodiment are realized.
The embodiment of the invention discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the steps of the embodiment of the GPIO controller configuration method are realized.
The embodiments in the present specification are all described in a progressive manner, and each embodiment focuses on differences from other embodiments, and portions that are the same and similar between the embodiments may be referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create a system for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, in this document, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The GPIO controller configuration method, the GPIO controller configuration system, the electronic device, and the storage medium provided by the present invention are described in detail above, and specific examples are applied herein to explain the principles and embodiments of the present invention, and the descriptions of the above examples are only used to help understand the method and the core ideas of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (8)
1. A general purpose programmable input/output port GPIO controller configuration method is applied to a platform with an advanced configuration and power management interface ACPI table, and comprises the following steps:
in a system difference description table DSDT of an ACPI table, determining corresponding configuration information based on the device identification of the GPIO controller;
setting the attribute and the corresponding attribute value of the GPIO controller in the configuration information;
when a target GPIO controller is initialized, acquiring a target device identifier corresponding to the target GPIO controller;
taking the configuration information corresponding to the equipment identifier matched with the target equipment identifier from the DSDT of the ACPI table as target configuration information;
configuring the attribute of the target GPIO controller based on the target configuration information, and completing the initialization of the target GPIO controller;
wherein the method further comprises:
and pre-configuring configuration information corresponding to all GPIO controllers in the ACPI table.
2. The method of claim 1, wherein setting the attributes and corresponding attribute values of the GPIO controller in the configuration information comprises:
determining a system difference description (DSD) object in the configuration information;
and setting the attribute and the corresponding attribute value of the GPIO controller in the DSD object.
3. The method of claim 2, wherein the configuring the attributes of the target GPIO controller based on the target configuration information comprises:
acquiring a target attribute value corresponding to a target attribute from the DSD object of the target configuration information;
and configuring the attribute value of the attribute corresponding to the target attribute in the target GPIO controller into the target attribute value.
4. The method of any one of claims 1-3, wherein after configuring the attributes of the target GPIO controller based on the target configuration information, the method further comprises, after completing initialization of the target GPIO controller:
when the target GPIO controller is initialized to be failed, calling a device tree;
configuring the attribute of the target GPIO controller based on the target attribute and the corresponding target attribute value of the target GPIO controller in the device tree, and finishing the initialization of the target GPIO controller.
5. A GPIO controller configuration system for use with a platform having an ACPI table, the system comprising:
the configuration information determining module is used for determining corresponding configuration information based on the device identification of the GPIO controller in the DSDT of the ACPI table;
the attribute setting module is used for setting the attribute and the corresponding attribute value of the GPIO controller in the configuration information;
the device identifier acquisition module is used for acquiring a target device identifier corresponding to a target GPIO controller when the target GPIO controller is initialized;
the configuration information calling module is used for calling target configuration information corresponding to the target equipment identifier from an ACPI (application program interface) table; wherein the target configuration information is preconfigured in the ACPI table for the target GPIO controller;
the attribute configuration module is used for configuring the attribute of the target GPIO controller based on the target configuration information and finishing the initialization of the target GPIO controller;
wherein the system is further configured to:
and pre-configuring configuration information corresponding to all GPIO controllers in the ACPI table.
6. The system of claim 5, further comprising: the switching module is used for calling the device tree when the target GPIO controller is initialized to be failed; configuring the attribute of the target GPIO controller based on the target attribute and the corresponding target attribute value of the target GPIO controller in the device tree, and finishing the initialization of the target GPIO controller.
7. An electronic device comprising a processor, a memory, and a computer program stored on the memory and capable of running on the processor, the computer program when executed by the processor implementing the steps of the GPIO controller configuration method of any one of claims 1-4.
8. A computer-readable storage medium, characterized in that a computer program is stored thereon, which, when executed by a processor, implements the steps of the GPIO controller configuration method of any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010923798.2A CN112069102B (en) | 2020-09-04 | 2020-09-04 | GPIO controller configuration method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010923798.2A CN112069102B (en) | 2020-09-04 | 2020-09-04 | GPIO controller configuration method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112069102A CN112069102A (en) | 2020-12-11 |
CN112069102B true CN112069102B (en) | 2022-08-26 |
Family
ID=73665571
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010923798.2A Active CN112069102B (en) | 2020-09-04 | 2020-09-04 | GPIO controller configuration method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112069102B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115794259B (en) * | 2023-02-01 | 2023-06-02 | 麒麟软件有限公司 | Method for generating device tree through ACPI |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101046777A (en) * | 2006-03-28 | 2007-10-03 | 泰安电脑科技(上海)有限公司 | Bridge module, computer system and its initialize method |
US9417801B2 (en) * | 2014-03-27 | 2016-08-16 | Intel Corporation | Virtual general-purpose I/O controller |
CN106708596B (en) * | 2015-11-13 | 2020-02-14 | 华为技术有限公司 | Method for adjusting input and output virtualized resources and processor |
CN110096314B (en) * | 2019-05-07 | 2022-05-24 | 苏州浪潮智能科技有限公司 | Interface initialization method, device, equipment and computer readable storage medium |
-
2020
- 2020-09-04 CN CN202010923798.2A patent/CN112069102B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN112069102A (en) | 2020-12-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11385908B1 (en) | Cloning of firmware configuration settings using rest over IPMI interface | |
US10409584B1 (en) | Peripheral device firmware update using rest over IPMI interface firmware update module | |
US9122501B1 (en) | System and method for managing multiple bios default configurations | |
US10416988B1 (en) | Peripheral device firmware update using rest over IPMI interface firmware shell utility | |
US9632806B1 (en) | Remote platform configuration | |
TWI537748B (en) | Apparatus, method and non-transitory computer-readable medium for network basic input/output system management | |
US10572242B1 (en) | Firmware update using rest over IPMI interface | |
US10628176B1 (en) | Firmware configuration using REST over IPMI interface | |
US10489142B1 (en) | Secure firmware integrity monitoring using rest over IPMI interface | |
CN103412769A (en) | External card parameter configuration method, equipment and system | |
US10776286B1 (en) | Rest over IPMI interface for firmware to BMC communication | |
US20130007428A1 (en) | System and method for customized configuration of information handling systems | |
WO2023147748A1 (en) | Method and apparatus for initializing smart network interface card by server, device, and medium | |
US11288078B1 (en) | Providing firmware specific information via ACPI tables | |
US20170337064A1 (en) | System and method for booting an information handling system | |
US9672047B1 (en) | Systems and methods for accessing a bootable partition on a serial peripheral interface device | |
CN111124508A (en) | Method and device for adjusting PXE (PCI extensions for instrumentation) starting sequence of network card | |
CN112069102B (en) | GPIO controller configuration method and system | |
US11113070B1 (en) | Automated identification and disablement of system devices in a computing system | |
US10467173B2 (en) | Hot plugging of virtual bridges in a virtual PCI system | |
US20200015296A1 (en) | Computer system and method thereof for sharing of wireless connection information between uefi firmware and os | |
CN112417800B (en) | Integrated circuit processing method, integrated circuit verification device and electronic equipment | |
CN116627513B (en) | Method and device for starting boot of computer | |
CN115495161B (en) | BIOS option modification validation method and device and storage medium | |
CN112069113B (en) | I2C device configuration method and system |
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 | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing Applicant after: Loongson Zhongke Technology Co.,Ltd. Address before: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing Applicant before: LOONGSON TECHNOLOGY Corp.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |