CN115129379A - Hardware initialization method and device, electronic equipment and computer readable storage medium - Google Patents

Hardware initialization method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN115129379A
CN115129379A CN202210765163.3A CN202210765163A CN115129379A CN 115129379 A CN115129379 A CN 115129379A CN 202210765163 A CN202210765163 A CN 202210765163A CN 115129379 A CN115129379 A CN 115129379A
Authority
CN
China
Prior art keywords
initialization
equipment
target
sequence
initialization sequence
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.)
Pending
Application number
CN202210765163.3A
Other languages
Chinese (zh)
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.)
Phytium Technology Co Ltd
Original Assignee
Phytium Technology Co 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 Phytium Technology Co Ltd filed Critical Phytium Technology Co Ltd
Priority to CN202210765163.3A priority Critical patent/CN115129379A/en
Publication of CN115129379A publication Critical patent/CN115129379A/en
Pending legal-status Critical Current

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/4401Bootstrapping
    • G06F9/4411Configuring for operating with peripheral devices; Loading of device drivers
    • G06F9/4413Plug-and-play [PnP]
    • G06F9/4415Self describing peripheral devices

Landscapes

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

Abstract

The invention provides a hardware initialization method, which is executed in an initialization control device and comprises the following steps: acquiring equipment information of the target equipment; according to the equipment information, whether the target equipment stores an initialization sequence is confirmed; wherein the initialization sequence is an initialization sequence that matches the target device; and when the target equipment stores an initialization sequence, initializing the target equipment by adopting the initialization sequence. According to the hardware initialization method provided by the invention, the initialization sequence matched with the hardware initialization method carried by the target equipment can be inquired through the equipment information of the target equipment, and the target equipment is initialized by adopting the initialization sequence, so that the dynamic loading of the initialization sequence is realized.

Description

Hardware initialization method and device, electronic equipment and computer readable storage medium
Technical Field
The present invention relates to the field of hardware device initialization technologies, and in particular, to a hardware initialization method and apparatus, an electronic device, and a computer-readable storage medium.
Background
When a complete machine manufacturer integrates equipment, different models of equipment are often used in a product due to material supply problems, and firmware usually only initializes one model by hardware, so that even if an operating system is driven, the equipment hardware cannot be used due to the fact that the hardware is not initialized. Therefore, it is important to initialize the device to be compatible with various devices. The prior art generally finds a completely compatible material for standby replacement by hardware, or a device of one type corresponds to a firmware, which is very limited. With the first scheme, it is difficult to find a completely compatible material, and it is also impossible to determine whether the supply is sufficient; by adopting the second scheme, too many firmware files can be caused, the management is inconvenient, and the matching error is easy to occur. In the two schemes, either scheme is limited by the matching problem of the firmware and the equipment, and flexible selection of different hardware equipment is difficult to realize.
Disclosure of Invention
According to the hardware initialization method, the hardware initialization device, the electronic equipment and the computer readable storage medium, the initialization sequence matched with the hardware initialization device carried by the target equipment can be inquired through the equipment information of the target equipment, the target equipment is initialized through the initialization sequence, and dynamic loading of the initialization sequence is achieved.
In a first aspect, the present invention provides a hardware initialization method, executed in an initialization control device, including:
acquiring equipment information of the target equipment;
according to the equipment information, whether the target equipment stores an initialization sequence is confirmed; wherein the initialization sequence is an initialization sequence that matches the target device;
and when the target equipment stores an initialization sequence, initializing the target equipment by adopting the initialization sequence.
Optionally, after determining whether the initialization sequence is stored in the target device according to the device information, the method further includes:
when the initialization sequence is not stored in the target equipment, traversing the initialization sequence stored in the initialization control equipment according to the equipment information of the target equipment;
and when the initialization sequence corresponding to the equipment information is obtained through traversal, initializing the target equipment by adopting the obtained initialization sequence.
Optionally, traversing the initialization sequence stored in the initialization control device according to the device information of the target device includes:
and traversing the identity identifier corresponding to the initialization sequence stored in the initialization control device, and comparing the identity identifier corresponding to the initialization sequence obtained by traversing with the identity identifier of the target device.
Optionally, after traversing the initialization sequence stored in the initialization control device, the method further includes:
and when the initialization sequence corresponding to the equipment information is not obtained through traversal, initializing the target equipment by adopting a predefined initialization sequence.
Optionally, the obtaining the device information of the target device includes:
sending an initialization instruction to an equipment controller to enable the equipment controller to complete initialization;
and after the initialization of the equipment controller is completed, sending an instruction for reading the equipment information to the equipment controller so that the equipment controller reads and returns the equipment information from the target equipment according to the instruction.
Optionally, the determining, according to the device information, whether the initialization sequence is stored in the target device includes:
judging whether the device information has a storage identifier;
when the storage identifier is available, the target device stores an initialization sequence;
when not having a storage identity, the target device does not store the initialization sequence.
In a second aspect, the present invention provides a hardware initialization method, executed in a device controller, including:
responding to an interaction request of the initialization control equipment, acquiring equipment information of target equipment and sending the equipment information to the initialization control equipment; so that the initialization control device judges whether the target device stores an initialization sequence and determines an initialization instruction to be sent; wherein the initialization sequence is an initialization sequence matched with a target device;
receiving an initialization instruction sent by initialization control equipment;
judging the type of the target equipment according to the initialization instruction;
and when the target equipment is equipment stored with an initialization sequence, responding to the initialization instruction, reading the initialization sequence from the target equipment, and initializing the target equipment by adopting the read initialization sequence.
Optionally, after the determining the type of the target device according to the initialization instruction, the method further includes:
when the target equipment is equipment which does not store an initialization sequence, responding to the initialization instruction, and initializing the target equipment by adopting the initialization sequence carried in the initialization instruction; the initialization instruction is an initialization sequence obtained by traversing the initialization control device according to the device information of the target device, or an initialization sequence predefined in the initialization control device.
Optionally, the obtaining the device information of the target device and sending the device information to the initialization control device in response to the interaction request of the initialization control device includes:
executing an initialization process of the device controller in response to an initialization request to initialize the control device;
after the initialization is completed, the device information of the target device is read in response to a read request of the initialization control device.
In a third aspect, the present invention provides a hardware initialization method, executed in a target device, including:
responding to an interaction request of an equipment controller, sending equipment information to the equipment controller so that the equipment controller sends the equipment information to initialization control equipment, and the initialization control equipment confirms whether target equipment stores an initialization sequence or not according to the equipment information and sends a corresponding initialization instruction;
and responding to a read request of the equipment controller, and sending the stored initialization sequence to the equipment controller so that the equipment controller executes initialization operation according to the initialization sequence.
Optionally, when the device information indicates that the initialization sequence is not stored in the target device, responding to an initialization request of the device controller, and completing initialization by using the initialization sequence carried by the initialization request in cooperation with the device controller; wherein the initialization sequence is acquired by the device controller by the initialization control device.
In a fourth aspect, the present invention provides a hardware initialization apparatus, applied in an initialization control device, including:
the information acquisition module is used for acquiring the equipment information of the target equipment;
the confirming module is used for confirming whether the target equipment stores the initialization sequence or not according to the equipment information; wherein the initialization sequence is an initialization sequence that matches the target device;
and the initialization module is used for initializing the target equipment by adopting the initialization sequence when the target equipment stores the initialization sequence.
In a fifth aspect, the present invention provides a hardware initialization apparatus, applied in a device controller, including:
the information forwarding module is used for responding to an interaction request of the initialization control equipment, acquiring equipment information of target equipment and sending the equipment information to the initialization control equipment so that the initialization control equipment can judge whether the target equipment stores an initialization sequence and determine an initialization instruction needing to be sent; wherein the initialization sequence is an initialization sequence matched with a target device;
the receiving module is used for receiving an initialization instruction sent by the initialization control equipment;
the judging module is used for judging the type of the target equipment according to the initialization instruction;
and the execution module is used for responding to the initialization instruction when the target equipment is the equipment stored with the initialization sequence, reading the initialization sequence from the target equipment and initializing the target equipment by adopting the read initialization sequence.
In a sixth aspect, the present invention provides a hardware initialization apparatus, applied in a target device, including:
the device comprises an information sending module, an initialization control device and a target device, wherein the information sending module is used for responding to an interaction request of the device controller, sending device information to the device controller so as to enable the device controller to send the device information to the initialization control device, and the initialization control device confirms whether the target device stores an initialization sequence or not according to the device information and sends a corresponding initialization instruction;
and the sequence sending module is used for responding to a reading request of the equipment controller when the equipment information indicates that the target equipment stores the initialization sequence, and sending the stored initialization sequence to the equipment controller so that the equipment controller executes initialization operation according to the initialization sequence.
In a seventh aspect, the present invention provides an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any of the methods described above.
In an eighth aspect, the present invention provides a computer readable storage medium, wherein the computer readable storage medium stores computer instructions which, when executed by a processor, implement the method of any one of the above.
In the invention, the hardware equipment carries the initialization sequence matched with the hardware equipment, in the initialization process, the initialization control equipment firstly judges whether the target carries the initialization sequence matched with the hardware equipment, and the initialization control equipment preferentially adopts the initialization sequence carried by the target equipment to carry out initialization, so that the use of the equipment is not limited by the compatibility problem of the initialization control equipment and the hardware equipment, and the equipment can be installed and used as long as the hardware equipment carries the initialization sequence no matter what hardware equipment is adopted. In the invention, the hardware equipment carries the initialization sequence, and the initialization control equipment only needs to read and apply the initialization sequence carried by the hardware equipment and does not depend on the initialization sequence programmed in the initialization control equipment any more, thereby eliminating the matching obstacle between the initialization control equipment and the hardware equipment.
Drawings
FIG. 1 is a flowchart of a hardware initialization method according to an embodiment of the present invention;
FIG. 2 is a flowchart of a hardware initialization method according to another embodiment of the present invention;
FIG. 3 is a flowchart of a hardware initialization method according to another embodiment of the present invention;
FIG. 4 is a flowchart of a hardware initialization method according to another embodiment of the present invention;
FIG. 5 is a flowchart of a hardware initialization method according to another embodiment of the present invention;
FIG. 6 is a flowchart of a hardware initialization method according to another embodiment of the present invention;
FIG. 7 is a flowchart of a hardware initialization method according to another embodiment of the present invention;
FIG. 8 is a diagram of an application system of another embodiment of the hardware initialization method of the present invention;
fig. 9 is an exemplary flowchart of a hardware initialization method according to another embodiment of 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 only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
An embodiment of the present invention provides a hardware initialization method, which is executed in a computer initialization control device, as shown in fig. 1, and includes:
step 110, acquiring device information of the target device;
in some embodiments, the process of the initialization control device interacting with the target device includes instruction sending by the initialization control device via a device controller, and data acquisition by the device controller. The device information represents the basic attribute information of the device, and the device information at least includes the condition of representing the initialization sequence stored by the target device because the condition of storing the initialization sequence by the target device needs to be judged in the subsequent steps. The initialization control device refers to a device for controlling the device to complete an initialization process, and for example, the initialization control device may be firmware in a computer.
Step 120, confirming whether the target device stores an initialization sequence according to the device information; wherein the initialization sequence is an initialization sequence that matches the target device;
in some embodiments, the device information may include an identifier indicating the storage of the initialization sequence, such as a storage identifier stored in an identifier register. When the identifier exists, different values may be used to indicate different conditions of storing the initialization sequence, for example, when the flag bit in the register is 1, it indicates that the target device carries the initialization sequence, and when the flag bit in the register is 0, it indicates that the target device does not carry the initialization sequence. Of course, there may be a case where the target device does not have an identifier register, and in this case, the storage identifier cannot be successfully acquired, and at this time, it should be determined that the target device does not carry the initialization sequence.
Step 130, when the target device stores an initialization sequence, initializing the target device by using the initialization sequence.
In some embodiments, the initialization sequence stored by the target device should generally be the same as the initialization sequence, that is, the initialization sequence stored by the target device is adopted, so that the initialization of the target device can be successfully and accurately completed. In the process of initializing the target device by using the initialization sequence, the initialization mode can be designed according to requirements, for example, when the initialization sequence needs to be verified by the initialization control device, the initialization control device sends a command to the device controller, the device controller reads the initialization sequence and then sends the command to the initialization control device for verification, and after the initialization control device is verified, the command is sent to the device controller to initialize the target device. For example, when the initialization sequence can be used directly, the initialization control device may directly transmit an instruction to the device controller, and the device controller may read the initialization sequence and then directly initialize the target device.
In this embodiment, the hardware device is adopted to carry the self-matching initialization sequence, in the initialization process, the initialization control device firstly judges whether the target carries the self-matching initialization sequence, and the initialization sequence carried by the target device is preferentially adopted for initialization, so that the use of the device is not limited by the compatibility problem of the initialization control device and the hardware device, and the device can be installed and used as long as the hardware device carries the initialization sequence no matter what kind of hardware device is adopted. In this embodiment, the hardware device carries the initialization sequence, and the initialization control device only needs to read and apply the initialization sequence carried by the hardware device, and does not depend on the initialization sequence programmed in the initialization control device, thereby eliminating a matching obstacle between the initialization control device and the hardware device.
As an optional implementation manner, as shown in fig. 2, after determining whether the initialization sequence is stored in the target device according to the device information in step 120, the method further includes:
step 140, when the initialization sequence is not stored in the target device, traversing the initialization sequence stored in the initialization control device according to the device information of the target device;
in some embodiments, a plurality of initialization sequences may be stored in the initialization control device, the plurality of initialization sequences corresponding to the plurality of target devices, respectively. Each initialization sequence has an identity, and the initialization sequences that match each other are identical to the identity of the target device. For a plurality of initialization sequences, the initialization sequences can be written in different executable files respectively, or can be written in the same file to form a code segment which is executed by jumping with the identity as a condition.
And 150, when the initialization sequence corresponding to the equipment information is obtained through traversal, initializing the target equipment by using the obtained initialization sequence.
In some embodiments, when the initialization sequence corresponding to the device information is obtained through traversal, it indicates that the initialization sequence can be applied to the corresponding target device, and initialization of the target device can be successfully completed by using the initialization sequence.
In the present embodiment, by storing a plurality of initialization sequences in the initialization control device, it is possible to have good compatibility with existing hardware devices. Since the legacy device usually does not carry the initialization sequence, in order to implement dynamic loading of the legacy device, in this embodiment, a plurality of initialization sequences are stored in the initialization control device, so that the initialization control device can find a suitable initialization sequence through matching of device information.
As an optional implementation manner, in step 140, traversing the initialization sequence stored in the initialization control device according to the device information of the target device includes:
and traversing the identity identifier corresponding to the initialization sequence stored in the initialization control device, and comparing the identity identifier corresponding to the initialization sequence obtained by traversing with the identity identifier of the target device.
In some embodiments, the identity represents an identity attribute of the device, for example, the identity may be a device ID, and the device usually carries its own identity, and when the initialization control device is programmed, the identity is also given to the initialization sequence, and when the target device matches the initialization sequence, the target device should have the same identity.
As an alternative implementation, as shown in fig. 3, after traversing the initialization sequence stored in the initialization control device in step 140, the method further includes:
and step 160, when the initialization sequence corresponding to the device information is not obtained through traversal, initializing the target device by adopting a predefined initialization sequence.
In some embodiments, multiple initialization sequences may be programmed into the initialization control device, however, the initialization control device may not cover the initialization sequences of all hardware devices. In order to increase the success rate of initialization, the case where the corresponding initialization sequence fails to be traversed should be considered. In this embodiment, a predefined initialization sequence, that is, a default initialization sequence, is used to initialize a target device when a corresponding initialization sequence cannot be traversed. The predefined initialization sequence may be one of the plurality of initialization sequences described above, or may be an initialization sequence separately defined from the plurality of initialization sequences. Those skilled in the art will appreciate that the predefined initialization sequence may be the initialization sequence most applied by the hardware device.
As an optional implementation manner, in step 110, acquiring the device information of the target device includes:
step 111, sending an initialization instruction to an equipment controller to enable the equipment controller to complete initialization;
in some embodiments, to ensure successful interaction of the initialization controlling device with the target device, the device controller should first complete initialization, since the device controller's functionality is generally not successfully used until the device controller completes initialization at the beginning of device power-up.
And 112, after the initialization of the device controller is completed, sending a command for reading the device information to the device controller, so that the device controller reads and returns the device information from the target device according to the command.
In some embodiments, the device controller may read the device information of the target device at one time or in multiple times, for example, the reading of the storage identifier and the identity identifier in the foregoing embodiments may be completed at one time, or the storage identifier may be read first to determine that the target device carries the initialization sequence, and the identity identifier may be read again when the target device does not carry the initialization sequence.
As an optional implementation manner, in step 120, confirming whether the target device stores the initialization sequence according to the device information includes:
step 121, judging whether the device information has a storage identifier;
step 122, when the storage identifier is available, the target device stores an initialization sequence;
in step 123, when there is no storage identity, the target device does not store the initialization sequence.
In this embodiment, for a previous device, the initialization sequence is not usually carried, that is, the characterization of the initialization sequence carrying condition is not needed, but for a hardware device provided in each embodiment of the present invention, the initialization sequence is carried, that is, the characterization of the initialization sequence carrying condition is needed to be characterized. Therefore, in this step, the presence or absence of the storage flag is directly used as the determination condition in order to simplify the determination logic.
An embodiment of the present invention further provides a hardware initialization method, which is executed in an apparatus controller, as shown in fig. 4, and includes:
step 210, responding to an interaction request of the initialization control device, acquiring device information of a target device and sending the device information to the initialization control device; so that the initialization control device judges whether the target device stores an initialization sequence and determines an initialization instruction to be sent; wherein the initialization sequence is an initialization sequence matched with a target device;
in some embodiments, the process of the initialization control device interacting with the target device includes instruction sending by the initialization control device via a device controller, and data acquisition by the device controller. The device information represents basic attribute information of the device, and since the condition of storing the initialization sequence by the target device needs to be judged in the subsequent steps, the device information at least comprises the condition of representing the storage initialization sequence by the target device. The device information may include an identifier indicating the storage of the initialization sequence, such as a storage identifier stored in an identifier register. When the identifier exists, different values may be used to indicate different conditions of storing the initialization sequence, for example, when the flag bit in the register is 1, it indicates that the target device carries the initialization sequence, and when the flag bit in the register is 0, it indicates that the target device does not carry the initialization sequence. Of course, there may be a case where the target device does not have an identifier register, and in this case, the storage identifier cannot be successfully acquired, and at this time, it should be determined that the target device does not carry the initialization sequence.
Step 220, receiving an initialization instruction sent by initialization control equipment;
in some embodiments, the initialization instruction sent by the initialization control device generally includes two types, one is an initialization instruction that instructs the device controller to read an initialization sequence from the target device and initialize the target device, and the other is an initialization instruction that carries the initialization sequence.
Step 230, judging the type of the target device according to the initialization instruction;
in some embodiments, the types of target devices are distinguished by whether the target devices carry an initialization sequence. When the target device carries the initialization sequence, the initialization process should first read the initialization sequence of the target device and then perform initialization, and when the target device does not carry the initialization sequence, the corresponding initialization sequence should be carried in the instruction sent by the initialization control device. The difference between the two initialization instructions can be used to distinguish the type of target device.
And 240, when the target device is a device stored with an initialization sequence, responding to the initialization instruction, reading the initialization sequence from the target device, and initializing the target device by using the read initialization sequence.
In some embodiments, the initialization sequence stored by the target device should generally be an initialization sequence matching itself, that is, the initialization of the target device can be successfully and accurately completed by using the initialization sequence stored by the target device. In the process of initializing the target device by using the initialization sequence, the initialization mode can be designed according to requirements, for example, when the initialization sequence needs to be verified by the initialization control device, the initialization control device sends a command to the device controller, the device controller reads the initialization sequence and then sends the command to the initialization control device for verification, and after the initialization control device is verified, the command is sent to the device controller to initialize the target device. For example, when the initialization sequence can be used directly, the initialization control device may directly transmit an instruction to the device controller, and the device controller may read the initialization sequence and then directly initialize the target device.
In this embodiment, the hardware device is adopted to carry the self-matching initialization sequence, in the initialization process, the initialization control device firstly judges whether the target carries the self-matching initialization sequence, and the initialization sequence carried by the target device is preferentially adopted for initialization, so that the use of the device is not limited by the compatibility problem of the initialization control device and the hardware device, and the device can be installed and used as long as the hardware device carries the initialization sequence no matter what kind of hardware device is adopted. In this embodiment, the hardware device carries the initialization sequence, and the initialization control device only needs to read and apply the initialization sequence carried by the hardware device, and does not rely on the initialization sequence programmed in the initialization control device, thereby eliminating a matching obstacle between the initialization control device and the hardware device.
As an alternative implementation manner, as shown in fig. 5, after determining the type of the target device according to the initialization instruction in step 230, the method further includes:
step 250, when the target device is a device which does not store an initialization sequence, responding to the initialization instruction, and initializing the target device by adopting the initialization sequence carried in the initialization instruction; the initialization instruction is an initialization sequence obtained by traversing the initialization control device according to the device information of the target device, or an initialization sequence predefined in the initialization control device.
In some embodiments, a plurality of initialization sequences may be stored in the initialization control device, the plurality of initialization sequences corresponding to the plurality of target devices, respectively. Each initialization sequence has an identity, and the initialization sequences that match each other are identical to the identity of the target device. For a plurality of initialization sequences, the initialization sequences can be written in different executable files respectively, or can be written in the same file to form a code segment which is jumped to execute by taking the identity as a condition. The initialization control device searches an initialization sequence corresponding to the target device in a traversal mode, when the initialization sequence corresponding to the device information is obtained in a traversal mode, the initialization sequence can be applied to the corresponding target device, and the target device can be successfully initialized by adopting the initialization sequence. By storing a plurality of initialization sequences in the initialization control device, it is possible to have good compatibility with past hardware devices. Since the previous device usually does not carry the initialization sequence, in order to implement dynamic loading of the previous device, in this embodiment, a plurality of initialization sequences are stored in the initialization control device, so that the initialization control device can find a suitable initialization sequence through matching of device information. A plurality of initialization sequences may be programmed in the initialization control device, but the initialization control device may not cover the initialization sequences of all hardware devices. In order to increase the success rate of initialization, a case where a corresponding initialization sequence fails to be traversed should be considered. In this embodiment, a predefined initialization sequence, that is, a default initialization sequence, is used to initialize a target device when a corresponding initialization sequence cannot be traversed. The predefined initialization sequence may be one of the plurality of initialization sequences described above, or may be an initialization sequence separately defined from the plurality of initialization sequences. Those skilled in the art will appreciate that the predefined initialization sequence may be the most applicable initialization sequence by the hardware device.
As an optional implementation manner, in step 210, in response to the interaction request of the initialization control device, acquiring device information of the target device and sending the device information to the initialization control device includes:
step 211, responding to the initialization request of the initialization control device, executing the initialization process of the device controller;
in some embodiments, to ensure successful interaction of the initialization controlling device with the target device, the device controller should first complete initialization, since the device controller's functionality is generally not successfully used until the device controller completes initialization at the beginning of device power-up.
In step 212, after the initialization is completed, the device information of the target device is read in response to the read request of the initialization control device.
In some embodiments, the device controller may read the device information of the target device at one time or in multiple times, for example, the reading of the storage identifier and the identity identifier in the foregoing embodiments may be completed at one time, or the storage identifier may be read first to determine that the target device carries the initialization sequence, and the identity identifier may be read again when the target device does not carry the initialization sequence.
An embodiment of the present invention further provides a hardware initialization method, executed in a target device, as shown in fig. 6, including:
step 310, in response to an interaction request of an equipment controller, sending equipment information to the equipment controller so that the equipment controller sends the equipment information to initialization control equipment, and the initialization control equipment confirms whether target equipment stores an initialization sequence according to the equipment information and sends a corresponding initialization instruction;
in some embodiments, the process of the initialization control device interacting with the target device includes instruction sending by the initialization control device via a device controller, and data acquisition by the device controller. The device information represents basic attribute information of the device, and since the condition of storing the initialization sequence by the target device needs to be judged in the subsequent steps, the device information at least comprises the condition of representing the storage initialization sequence by the target device. The device information may include an identifier indicating the storage of the initialization sequence, for example, a storage identifier stored in an identifier register. When the identifier exists, different values may be used to indicate different conditions of storing the initialization sequence, for example, when the flag bit in the register is 1, it indicates that the target device carries the initialization sequence, and when the flag bit in the register is 0, it indicates that the target device does not carry the initialization sequence. Of course, there may be a case where the target device does not have an identifier register, and in this case, the storage identifier cannot be successfully acquired, and at this time, it should be determined that the target device does not carry the initialization sequence.
And 320, when the device information indicates that the target device stores the initialization sequence, responding to a read request of the device controller, and sending the stored initialization sequence to the device controller so that the device controller executes initialization operation according to the initialization sequence.
In some embodiments, the initialization sequence stored by the target device should generally be an initialization sequence matching itself, that is, the initialization of the target device can be successfully and accurately completed by using the initialization sequence stored by the target device. In the process of initializing the target device by using the initialization sequence, the initialization mode can be designed according to requirements, for example, when the initialization sequence needs to be verified by the initialization control device, the initialization control device sends an instruction to the device controller, the device controller reads the initialization sequence and then sends the instruction to the initialization control device for verification, and after the initialization control device is verified, the initialization control device sends the instruction to the device controller to initialize the target device. For example, when the initialization sequence can be used directly, the initialization control device may directly transmit an instruction to the device controller, and the device controller may read the initialization sequence and then directly initialize the target device. The process of the device controller completing initialization refers to the process of the device controller writing parameters into registers of the hardware device.
In this embodiment, the hardware device is adopted to carry the self-matching initialization sequence, in the initialization process, the initialization control device firstly judges whether the target carries the self-matching initialization sequence, and the initialization sequence carried by the target device is preferentially adopted for initialization, so that the use of the device is not limited by the compatibility problem of the initialization control device and the hardware device, and the device can be installed and used as long as the hardware device carries the initialization sequence no matter what kind of hardware device is adopted. In this embodiment, the hardware device carries the initialization sequence, and the initialization control device only needs to read and apply the initialization sequence carried by the hardware device, and does not rely on the initialization sequence programmed in the initialization control device, thereby eliminating a matching obstacle between the initialization control device and the hardware device.
As an optional implementation manner, as shown in fig. 7, further includes, in step 330, when the device information indicates that the target device does not store the initialization sequence, responding to the initialization request of the device controller, and completing initialization by using the initialization sequence carried in the initialization request in cooperation with the device controller; wherein the initialization sequence is acquired by the device controller by the initialization control device.
In some embodiments, a plurality of initialization sequences may be stored in the initialization control device, the plurality of initialization sequences corresponding to the plurality of target devices, respectively. Each initialization sequence has an identity, and the initialization sequences that match each other are identical to the identity of the target device. For a plurality of initialization sequences, the initialization sequences can be written in different executable files respectively, or can be written in the same file to form a code segment which is executed by jumping with the identity as a condition. When the initialization sequence corresponding to the device information is obtained through traversal, the initialization sequence can be applied to the corresponding target device, and the target device can be successfully initialized by adopting the initialization sequence. By storing a plurality of initialization sequences in the initialization control device, it is possible to have good compatibility with past hardware devices. Since the previous device usually does not carry the initialization sequence, in order to implement dynamic loading of the previous device, in this embodiment, a plurality of initialization sequences are stored in the initialization control device, so that the initialization control device can find a suitable initialization sequence through matching of device information. A plurality of initialization sequences may be programmed in the initialization control device, but the initialization control device may not cover the initialization sequences of all hardware devices. In order to increase the success rate of initialization, a case where a corresponding initialization sequence fails to be traversed should be considered. In this embodiment, a predefined initialization sequence, that is, a default initialization sequence, is used to initialize a target device when a corresponding initialization sequence cannot be traversed. The predefined initialization sequence may be one of the plurality of initialization sequences described above, or may be an initialization sequence separately defined from the plurality of initialization sequences. Those skilled in the art will appreciate that the predefined initialization sequence may be the initialization sequence most applied by the hardware device. In this embodiment, the initialization sequence acquired by the initialization control device by the device controller may be obtained by traversing the initialization control device, or may be a default initialization sequence of the initialization control device.
An embodiment of the present invention further provides a hardware initialization apparatus, applied to an initialization control device, including:
the information acquisition module is used for acquiring the equipment information of the target equipment;
the confirming module is used for confirming whether the target equipment stores the initialization sequence or not according to the equipment information; wherein the initialization sequence is an initialization sequence that matches the target device;
and the initialization module is used for initializing the target equipment by adopting the initialization sequence when the target equipment stores the initialization sequence.
An embodiment of the present invention further provides a hardware initialization apparatus, applied to a device controller, including:
the information forwarding module is used for responding to an interaction request of the initialization control equipment, acquiring equipment information of target equipment and sending the equipment information to the initialization control equipment so that the initialization control equipment can judge whether the target equipment stores an initialization sequence and determine an initialization instruction needing to be sent; wherein the initialization sequence is an initialization sequence matched with a target device;
the receiving module is used for receiving an initialization instruction sent by the initialization control equipment;
the judging module is used for judging the type of the target equipment according to the initialization instruction;
and the execution module is used for responding to the initialization instruction when the target equipment is the equipment stored with the initialization sequence, reading the initialization sequence from the target equipment and initializing the target equipment by adopting the read initialization sequence.
An embodiment of the present invention further provides a hardware initialization apparatus, applied to a target device, including:
the device comprises an information sending module, an initialization control device and a target device, wherein the information sending module is used for responding to an interaction request of the device controller, sending device information to the device controller so as to enable the device controller to send the device information to the initialization control device, and the initialization control device confirms whether the target device stores an initialization sequence or not according to the device information and sends a corresponding initialization instruction;
and the sequence sending module is used for responding to a reading request of the equipment controller when the equipment information indicates that the target equipment stores the initialization sequence, and sending the stored initialization sequence to the equipment controller so that the equipment controller executes initialization operation according to the initialization sequence.
An embodiment of the present invention further provides an electronic device, where the electronic device includes:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any of the methods described above.
Embodiments of the present invention further provide a computer-readable storage medium, where the computer-readable storage medium stores computer instructions, and when executed by a processor, the computer instructions implement any one of the methods described above.
As shown in fig. 8, an application system according to embodiments of the present invention is provided by taking an initialization process of a sound card device as an example, and the system includes a hardware layer and a firmware layer. The hardware layer includes a device controller and a target device. The firmware layer comprises an initialization module of the device controller, a device information acquisition module, a device information analysis module and an initialization sequence transmission module. The device information acquisition module is used for interacting with the target device through the device controller to acquire device information. The device information analysis module is configured to determine an initialization sequence to be used, where the initialization sequence may be an initialization sequence carried by the target device itself, an initialization sequence obtained by firmware traversal, or a default initialization sequence. The initialization sequence transmission module is configured to send an initialization instruction, where the initialization instruction may be used to instruct an apparatus controller to acquire an initialization sequence carried by a target apparatus to perform initialization processing, and may also carry an initialization sequence obtained by traversal of an initialization firmware or a default initialization sequence determined by the firmware. The device controller is adapted to perform the method described above in relation to the device controller.
As shown in fig. 9, taking the system shown in fig. 8 as an example, an initialization process of a sound card device is shown, which comprises the following steps: after the mainboard is powered on, the firmware is started first, and after the firmware is started, in order to ensure that the device controller can be normally used, the device controller is initialized first. And if the initialization of the equipment controller fails, returning to perform the initialization process of the equipment controller again. If the device controller is successfully initialized, the firmware interacts with the target device through the device controller to acquire device information of the target device, namely sound card information. And if the acquisition fails, returning to the step of acquiring the target equipment information and executing again. If the acquisition is successful, the firmware judges whether the equipment information has an equipment initialization sequence storage mark, and if the equipment information has the equipment initialization sequence storage mark, the firmware directly acquires the initialization sequence stored in the equipment. If the storage mark is not stored, the device is indicated not to store the initialization sequence, and the firmware determines whether the pre-programmed initialization sequence has a corresponding initialization sequence in a traversal mode. And when the initialization sequence written in advance by the firmware has a corresponding initialization sequence, initializing the equipment by adopting the corresponding initialization sequence. And when the initialization sequence written in advance by the firmware does not have a corresponding initialization sequence, initializing the equipment by adopting a default initialization sequence.
All or part of the processes in the embodiments of the methods described above may be implemented by a computer program that can be stored in a computer-readable storage medium and that, when executed, can include the processes in the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are also within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (16)

1. A hardware initialization method executed in an initialization control apparatus, comprising:
acquiring equipment information of the target equipment;
according to the equipment information, whether the target equipment stores an initialization sequence is confirmed; wherein the initialization sequence is an initialization sequence that matches the target device;
and when the target equipment stores an initialization sequence, initializing the target equipment by adopting the initialization sequence.
2. The method according to claim 1, further comprising, after the determining whether the initialization sequence is stored in the target device according to the device information, the step of:
when the initialization sequence is not stored in the target equipment, traversing the initialization sequence stored in the initialization control equipment according to the equipment information of the target equipment;
and when the initialization sequence corresponding to the equipment information is obtained through traversal, initializing the target equipment by adopting the obtained initialization sequence.
3. The method of claim 2, wherein traversing the initialization sequence stored in the initialization control device in accordance with the device information of the target device comprises:
and traversing the identity identifier corresponding to the initialization sequence stored in the initialization control device, and comparing the identity identifier corresponding to the initialization sequence obtained by traversing with the identity identifier of the target device.
4. The method of claim 2, further comprising, after traversing the initialization sequence stored in the initialization control device:
and when the initialization sequence corresponding to the equipment information is not obtained through traversal, initializing the target equipment by adopting a predefined initialization sequence.
5. The method of claim 1, wherein the obtaining device information of the target device comprises:
sending an initialization instruction to an equipment controller to enable the equipment controller to complete initialization;
and after the initialization of the equipment controller is completed, sending an instruction for reading the equipment information to the equipment controller, so that the equipment controller reads the equipment information from the target equipment according to the instruction and returns the equipment information.
6. The method of claim 1, wherein the determining whether the target device stores the initialization sequence according to the device information comprises:
judging whether the device information has a storage identifier;
when the storage identifier is available, the target device stores an initialization sequence;
when not having a storage identity, the target device does not store the initialization sequence.
7. A hardware initialization method, implemented in a device controller, comprising:
responding to an interaction request of an initialization control device, acquiring device information of a target device and sending the device information to the initialization control device, so that the initialization control device judges whether the target device stores an initialization sequence and determines an initialization instruction needing to be sent; wherein the initialization sequence is an initialization sequence matched with a target device;
receiving an initialization instruction sent by initialization control equipment;
judging the type of the target equipment according to the initialization instruction;
and when the target equipment is equipment stored with an initialization sequence, responding to the initialization instruction, reading the initialization sequence from the target equipment, and initializing the target equipment by adopting the read initialization sequence.
8. The method according to claim 7, further comprising, after said determining the type of the target device according to the initialization instruction:
when the target equipment is equipment which does not store an initialization sequence, responding to the initialization instruction and initializing the target equipment by adopting the initialization sequence carried in the initialization instruction; the initialization instruction is an initialization sequence obtained by traversing the initialization control device according to the device information of the target device, or an initialization sequence predefined in the initialization control device.
9. The method of claim 7, wherein the obtaining device information of the target device and sending the device information to the initialization control device in response to the interactive request of the initialization control device comprises:
executing an initialization process of the device controller in response to an initialization request to initialize the control device;
after the initialization is completed, the device information of the target device is read in response to a read request of the initialization control device.
10. A hardware initialization method executed in a target device, comprising:
responding to an interaction request of an equipment controller, sending equipment information to the equipment controller so that the equipment controller sends the equipment information to initialization control equipment, and the initialization control equipment confirms whether target equipment stores an initialization sequence or not according to the equipment information and sends a corresponding initialization instruction;
and when the device information indicates that the target device stores the initialization sequence, responding to a reading request of the device controller, and sending the stored initialization sequence to the device controller so that the device controller executes initialization operation according to the initialization sequence.
11. The method according to claim 10, wherein when the device information indicates that the target device does not store the initialization sequence, in response to an initialization request of the device controller, the initialization is completed by using the initialization sequence carried by the initialization request in cooperation with the device controller; wherein the initialization sequence is acquired by the device controller by the initialization control device.
12. A hardware initialization device is applied to initialization control equipment and is characterized by comprising the following components:
the information acquisition module is used for acquiring the equipment information of the target equipment;
the confirming module is used for confirming whether the target equipment stores the initialization sequence or not according to the equipment information; wherein the initialization sequence is an initialization sequence that matches the target device;
and the initialization module is used for initializing the target equipment by adopting the initialization sequence when the target equipment stores the initialization sequence.
13. A hardware initialization apparatus for use in a device controller, comprising:
the information forwarding module is used for responding to an interaction request of the initialization control equipment, acquiring equipment information of target equipment and sending the equipment information to the initialization control equipment so that the initialization control equipment can judge whether the target equipment stores an initialization sequence and determine an initialization instruction needing to be sent; wherein the initialization sequence is an initialization sequence matched with a target device;
the receiving module is used for receiving an initialization instruction sent by the initialization control equipment;
the judging module is used for judging the type of the target equipment according to the initialization instruction;
and the execution module is used for responding to the initialization instruction when the target equipment is the equipment stored with the initialization sequence, reading the initialization sequence from the target equipment and initializing the target equipment by adopting the read initialization sequence.
14. A hardware initialization device applied to a target device, comprising:
the device comprises an information sending module, an initialization control device and a target device, wherein the information sending module is used for responding to an interaction request of the device controller, sending device information to the device controller so as to enable the device controller to send the device information to the initialization control device, and the initialization control device confirms whether the target device stores an initialization sequence or not according to the device information and sends a corresponding initialization instruction;
and the sequence sending module is used for responding to a reading request of the equipment controller when the equipment information indicates that the target equipment stores the initialization sequence, and sending the stored initialization sequence to the equipment controller so that the equipment controller executes initialization operation according to the initialization sequence.
15. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 6, or to enable the at least one processor to perform the method of any one of claims 7 to 9, or to enable the at least one processor to perform the method of any one of claims 10 to 11.
16. A computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions which, when executed by a processor, implement the method of any one of claims 1 to 4, or implement the at least one processor to be capable of performing the method of any one of claims 7 to 9, or implement the at least one processor to be capable of performing the method of any one of claims 10 to 11.
CN202210765163.3A 2022-06-30 2022-06-30 Hardware initialization method and device, electronic equipment and computer readable storage medium Pending CN115129379A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210765163.3A CN115129379A (en) 2022-06-30 2022-06-30 Hardware initialization method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210765163.3A CN115129379A (en) 2022-06-30 2022-06-30 Hardware initialization method and device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN115129379A true CN115129379A (en) 2022-09-30

Family

ID=83381246

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210765163.3A Pending CN115129379A (en) 2022-06-30 2022-06-30 Hardware initialization method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN115129379A (en)

Similar Documents

Publication Publication Date Title
CN100389395C (en) Memory dump program boot method and mechanism, and computer-readable storage medium
US11256495B2 (en) Onboard system and ECU
CN101047457B (en) Digital broadcasting processing device and upgrade method of bootloader for the same
US6311322B1 (en) Program rewriting apparatus
CN107704282B (en) Loading method and device applied to embedded system
CN112732310B (en) Firmware upgrading method, system, equipment and medium based on embedded guide partition
CN109240748B (en) Mirror image starting and adapting method and system applied to embedded system
CN110543318A (en) control device program updating method and device, storage medium and control device
JP2010044579A (en) Peripheral device, program, and driver installation system
CN109766105A (en) Drive programe installation method, device, server and computer readable storage medium
WO2019080840A1 (en) Method and device for repairing firmware
CN105094877A (en) Method for firmware upgrading, and host side device and system
US7337312B2 (en) Processor and firmware download method for same
CN107315607B (en) Drive self-adaptation loading system
CN115129379A (en) Hardware initialization method and device, electronic equipment and computer readable storage medium
CN116755735A (en) Online upgrading method and device for embedded software, peritoneal dialysis instrument and storage medium
CN108628619B (en) Program updating method and device
CN105278993A (en) Linux system based drive module upgrading method and apparatus
CN110737483B (en) Signaling and data transmission method based on Windows USB MassStorage class
CN105376481B (en) The driving device of driving method for video camera and photographic device
JP2001117779A (en) Electronic instrument and program rewriting method
WO2009156902A1 (en) Easy software upgrade
KR101473633B1 (en) Control device
US10545768B2 (en) Information processing apparatus, information processing method, and recording medium
US11507385B1 (en) Embedded electronic device, boot method, and embedded electronic device readable recording medium with stored program

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