Disclosure of Invention
The invention aims to overcome one or more defects in the prior art and provides a method for realizing nationwide general-purpose computer firmware based on a Feiteng processor.
The purpose of the invention is realized by the following technical scheme: the implementation method of nationwide universal computer firmware based on the Feiteng processor comprises the following steps:
acquiring the model information of a chip to be used;
acquiring general basic firmware of the Feiteng processor;
acquiring basic information, wherein the basic information is chip basic firmware of a chip of the same type as a chip to be used, technical parameters of the chip to be used, a drive file of the chip to be used or a script file of the chip to be used;
if the basic information is the chip basic firmware of the chip of the same type as the chip to be used, modifying the chip basic firmware according to the chip to be used, and generating a Feiteng new firmware according to the modified chip basic firmware and the Feiteng processor general basic firmware;
if the basic information is the technical parameters of the chip to be used, the chip to be used is in communication connection with a Feiteng processor, the Feiteng processor reads or writes the parameter information of the chip to be used in the UEFI starting process to carry out mutual communication, and temporary equipment driving is established;
if the basic information is the drive file of the chip to be used, the drive file is placed in a file directory corresponding to the Feiteng processor, and the modified general basic firmware of the Feiteng processor is packaged again to generate Feiteng new firmware;
and if the basic information is the script file of the chip to be used, configuring the hardware protocol parameters of the general basic firmware of the Feiteng processor through the script file to generate a configuration file, and loading the configuration file into the general basic firmware of the Feiteng processor to generate Feiteng new firmware.
Preferably, the file directory corresponding to the Feiteng processor general basic firmware is a D2000_ UEFI _ taishiji-Y/UEFI _ code _3.3.4/edk-code-v3.3.4/edk2-for-support/Phytium Pkg/Phytium D2000Pkg/Drivers file directory of the Feiteng processor general basic firmware.
Preferably, the execution flow of the general basic firmware of the soar processor includes:
running PBF in Flash to initialize the processor chip;
the System Firmware sequentially calls initialization services of all modules provided by the PBF to complete initialization of the corresponding modules;
the System Firmware explicitly calls relocation service provided by the PBF, the PBF is loaded into a memory by the PBF relocation service, and the memory relocation of the PBF service is completed;
and after the System Firmware finishes the preset System initialization, loading the operating System.
Preferably, the completing the initialization of the corresponding module includes completing the initialization of the PLL frequency multiplier controller, the SOC memory controller, the DDR, the PCIe controller, and the SOC module.
The invention has the beneficial effects that: the invention realizes the adaptation of various chips in various modes on the basis of the Feiteng general basic firmware, so that a plurality of domestic chips which are developed successfully can be quickly compatible with the Feiteng processor.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the following embodiments, and it should be apparent 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 inventive effort based on the embodiments of the present invention, are within the scope of the present invention.
Referring to fig. 1-7, the embodiment provides a method for implementing a nationwide general-purpose computer firmware based on a FT processor:
as shown in fig. 1, a method for implementing a universal computer firmware for nationwide production based on a FT processor includes:
and S100, obtaining the model information of the chip to be used.
Typically, the chip to be used is a chip that needs to be compatible with the Feiteng processor.
S200, acquiring general basic firmware of the Feiteng processor.
In one embodiment, the Feiteng firmware is divided into two layers: a Processor Base Firmware (PBF) and a System Firmware (SFW), as shown in fig. 2. The Feiteng processor base firmware is responsible for basic initialization of the processor chip and provides related services, as well as loading the Secure OS running in Secure World.
As shown in fig. 3, the firmware boot execution flow of the FT processor is as follows: after the Feiteng processor is powered on, the PBF in Flash is operated firstly, the initialization of the most basic processor chip is completed, and then the System Firmware in Flash is jumped to. The System Firmware calls the initialization services of each module provided by the PBF, such as a PLL (phase locked loop), an SOC (System on chip) memory controller, a DDR (double data rate), a PCIe (peripheral component interface express) controller, an SoC module and the like in sequence according to the System requirements to complete the initialization of the corresponding modules.
The PBF also provides some query resets, such as a reason for query system Reset (Reset Source). When the PBF enters the System Firmware for the first time, the memory is not initialized, and the PBF has no available memory and is limited in function. For this reason, after the System Firmware completes the memory initialization based on the memory initialization service (Mem Ctrl, DDR, etc.) of the PBF, a Relocation service (Relocation) provided by the PBF must be explicitly called, and the PBF Relocation service loads the PBF itself into the memory and completes the memory Relocation of the PBF service. And after the System Firmware completes the related System initialization, loading the operating System.
S300, obtaining basic information, wherein the basic information is chip basic firmware of a chip of the same type as the chip to be used, technical parameters of the chip to be used, a drive file of the chip to be used or a script file of the chip to be used.
S400, if the basic information is the chip basic firmware of the chip with the same type as the chip to be used, modifying the chip basic firmware according to the chip to be used, and generating Feiteng new firmware according to the modified chip basic firmware and the Feiteng processor general basic firmware, as shown in FIG. 4.
And S500, if the basic information is the technical parameters of the chip to be used, the chip to be used is in communication connection with a Feiteng processor, the Feiteng processor reads or writes the parameter information of the chip to be used in the UEFI starting process to carry out mutual communication, and temporary equipment driving is established, as shown in FIG. 5. The method can repeatedly establish the driving information every time the system is powered on, is convenient for research and development personnel to quickly debug when encountering problems, finds and positions the problems, and can better know the realization flow of the internal functions of the chip.
S600, if the basic information is the driver file of the chip to be used, putting the driver file into a file directory corresponding to the general basic firmware of the FT processor (such as a driver directory in the general basic firmware of the FT processor), and packing the modified general basic firmware of the FT processor again to generate the new firmware of the FT, as shown in fig. 6.
In one embodiment, the to-be-used chip driver applicable to the ARM platform FT processor and given by a chip manufacturer is put into the FT processor universal basic firmware under the directory of a D2000_ UEFI _ taishiji-Y/UEFI _ code _3.3.4/edk-code-v3.3.4/edk 2-for-support/byte Pkg/byte D2000Pkg/Drivers file, and then the Feiteng universal basic firmware is repackaged to form the all-country Feiteng new firmware.
And S700, if the basic information is the script file of the chip to be used, configuring hardware protocol parameters of the Feiteng processor through the script file to generate a configuration file, and loading the configuration file into general basic firmware of the Feiteng processor to generate Feiteng new firmware, as shown in FIG. 7.
The method of this embodiment will be described below by way of example.
Taking the feiteng D2000 as an example, in the feiteng D2000 firmware, a firmware mainly simulates a system to initialize various peripherals, so that the sound card chip and the network card chip perform self-test at a firmware stage and perform initialization configuration on GPIOs that may be involved in the system, so as to ensure that the sound card chip and the network card chip can be normally used after entering the system.
The sound card chip adopts Reyi ALC662, and in the firmware of Feiteng D2000, there is no driver of Reyi ALC662, so the ALC662 sound card driver needs to be added to the firmware. The implementation is embodied in a D2000_ UEFI _ tashiji-Y/UEFI _ code _3.3.4/edk-code-v3.3.4/edk2-for-support/Phytium Pkg/Phytium D2000Pkg/Drivers/Hda/HdaDxe.C file in Firestum D2000 nationwide desktop firmware, the file is embodied in initialization of each use pin of a chip, and an ALC662 drive unique identification ID is established, so that the system can conveniently identify a sound card loading drive.
The network card PHY chip adopts a domestic Yutai micro YT8521S, and only the PHY chip AR8035 is adapted in the universal firmware of Feiteng D2000. Therefore, YT8521S drive needs to be added to the Feiteng firmware, which is implemented by constructing at edk2-for-support \ Phytium Pkg \ Phytium2004Pkg \ Drivers \ DwEmacSnpDxe/PhyDdXeUtil.
When the GPIO of the Feiteng D2000 is not initialized, the default state belongs to a high-impedance state, so when the system needs to use the GPIO, the used GPIO needs to be initialized, an input and output state is given by default when the system is started, and the situation that the abnormal output of the GPIO is caused because the uncertain state of the used GPIO does not occur at the UEFI stage is ensured. Is concretely realized in
PhytiumPkg \ PhytiumD2000Pkg \ PlatformPerei \ PlatformPerei.c, the function needs to be added: referring to a programming manual, GPIO is defined, function multiplexing is defined, input and output are defined, and the function is executed in InitializePlatformPerform ().
After the configuration is completed and all the peripheral drivers are adapted, the startup icon of the Feiteng D2000 is finally needed to be customized and modified into a preset icon (such as an icon owned by an operator/company), the setting interface is firstly modified, the PHYTIUM is changed into the preset icon, and the modification is realized in the macro definition of the title of the modified file Phytium Pkg/Phytium2004Pkg/Include/Smbios data. Then, the picture of the Logo needs to be put into a corresponding file, the starting picture is stored in a PhytiumPkg/Phytium2004Pkg/Logo directory, the resolution of the starting interface is 800 x 600 at present, and the picture is displayed in the middle. And repackaging through a packaging tool provided by Feiteng to generate final firmware.
The foregoing is illustrative of the preferred embodiments of this invention, and it is to be understood that the invention is not limited to the precise form disclosed herein and that various other combinations, modifications, and environments may be resorted to, falling within the scope of the concept as disclosed herein, either as described above or as apparent to those skilled in the relevant art. And that modifications and variations may be effected by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.