1222557 玖、發明說明 【發明所屬之技術領域】 本發明係關於一種診斷方法,特別是關於一種可延伸式 韌體介面之診斷方法。 【先前技術】 在電腦系統中是具有一較低階的韌體,一般熟知爲基本 輸出入系統(BIOS,Basic Input/Output System)其是伴隨電 腦主機而來的,並且是放於唯讀記憶體(ROM,Read Only Memory)上面的一段程式,上面包含了許多電腦輸出入的 基本副程式,以及電腦電源開啓之後,會先執行基本輸出 入系統以進行初値設定及開機自我測試(即 POST, Powei-on Self Test),並且,讀取互補式金屬氧化物半導 體(CMOS ’ Complementary Metal-Oxide Semiconductor)中 的資料(硬碟大小、是否有光碟機、系統時間、是否使用映 射隨機存取記憶體(S h a d 〇 w R A Μ )等資訊)。 由於電腦科技進步相當快速,隨著電腦系統發展之傳統 的基本輸出入系統(Legacy BIOS )也發展到達極限。因此, 爲了克服傳統的基本輸出入系統在發展上的瓶頸,英特爾 公司(Intel Corporation)已發展出一種可延伸式韌體介面 之規格’可免除基本輸出入系統的先天限制。而且,此種 可延伸式韌體介面容許使用標準的程式語言工具加入新元 件,具有更佳的擴充性,並且其係以C語言編寫,程式容 易維護、閱讀等優點。 5 326\專利說明書(補件)\92-04\TF924507 1222557 在可延伸式韌體介面的操作環境下,是分成幾個不同的 階段(P h a s e ),例如在初始化階段會執行可延伸式韌體介面 之開機管理程式(EFI boot manager ),進行系統初始値設 定,並相繼載入可延伸式韌體介面驅動程式及應用程式, 而在啓動階段或一操作系統啓動階段可由使用者自行選擇 所要操作的系統與環境,而每個階段之間是各自獨立的, 即前一階段所要執行的動作執行結束,便發出一個訊息通 知次一階段開始動作,但前一階段的操作結果並不會送至 次一階段中。 如上所述,在開發可延伸式韌體介面之系統的過程中, 由於每個階段之間是各自獨立的,因此在進行可延伸式韌 體介面之程式的測試時,對於在初始化階段的各個驅動程 式(Driver)之測試結果並無法得知,因爲無法將在初始化 階段的各個驅動程式(Driver)之測試結果傳送到啓動階段 或一操作系統啓動階段,以顯示其結果;若初始化階段只 有驅動程式需要修正及測試,仍然是對初始化階段所有的 驅動程式進行測試,而無法選擇只對需要測試的驅動程式 進行測試,如此對硏發所需的時程耗費許多時間。 【發明內容】 本發明之目的在於提供一種可延伸式韌體介面之診斷 方法,其在可延伸式韌體介面的每個階段獨立之情況下, 可以得知初始化階段之各個驅動程式的測試結果,而且可 以選擇僅對需要測試的驅動程式進行測試。 本發明提供一種可延伸式韌體介面之診斷方法,係用於 6 326\專利說明書(補件)\92-04\TF924507 1222557 一電腦系統中,在可延伸式韌體介面進行初始化階段,而 對該階段所執行之一驅動程式進行測試。該診斷方法首先 由可延伸式韌體介面之一診斷應用程式選擇要被測試之驅 動程式’並且依據要被測試之驅動程式之一全球唯一識別 碼建立一選擇變數,並存放於一非揮發性記憶體中;在重 新開機後,由可延伸式韌體介面之一核心驅動程式(Core Driver)讀取在非揮發性記憶體中之選擇變數;接著,由可 延伸式初體介面之一服務程式庫驅動程式(Service Library Driver)於一記憶體中建立一全球唯一識別碼型控制區塊 (Globally Unique Identifier Type Control Block5 Guid Type Control Block),並由核心驅動程式執行被測試之驅動程 式,而將被測試之驅動程式的名稱、測試過程中的訊息和 測試結果記錄及將其存放於全球唯一識別碼型控制區塊; 然後,由診斷應用程式搜尋相對應於被測試之驅動程式的 名稱、測試過程中的訊息和測試結果之全球唯一識別碼型 控制區塊,而於可延伸式韌體介面之一啓動階段或一操作 系統啓動階段顯示被測試之驅動程式的測試結果。 【實施方式】 圖1爲本發明之流程圖,圖2爲本發明之系統操作的示 意圖,圖3爲本發明之全球唯一識別碼型控制區塊的示意 圖。以下參照圖1至圖3說明本發明之一較佳具體例。 在開發可延伸式韌體介面之系統時,程式開發者可藉由 可延伸式韌體介面之系統中之一診斷應用程式(Diagnostic Application)22來選擇如初始化階段中之全部或其中的驅 7 326\專利說明書(補件)\92-04\TF924507 動程式以進行測試(步驟s 1 02),當程式開發者選擇所要測 試的驅動程式後,診斷應用程式2 2會依據被測試的驅動程 式建立相對應之一選擇變數(步驟S 1 0 4 ),並將此選擇變數 存放於一非揮發性隨機存取記憶體(Non Volatile RAM) 26 中。將選擇變數存放於非揮發性隨機存取記憶體26之目的 是因爲存放於非揮發性隨機存取記憶體2 6中的資料不會 因電腦關機或沒有電源而消失掉,並且在可延伸式韌體介 面之系統的每一個操作階段隨時皆可從非揮發性隨機存取 記憶體2 6讀取資料而不受限制。 此時,將電腦系統關機再重新開機後,由可延伸式韌體 介面之一核心驅動程式2 0讀取在非揮發性隨機存取記憶 體26中的選擇變數(步驟S1 06),核心驅動程式20根據此 選擇參數以選擇對初始化階段的所有驅動程式或部分指定 的驅動程式進行測試。在測試之前,核心驅動程式20會呼 叫可延伸式韌體介面之一服務程式庫驅動程式2 8,由服務 程式庫驅動程式28於一隨機存取記憶體24中建立一全球 唯一識別碼型控制區塊(步驟S 1 08)。其中,服務程式庫驅 動程式2 8可提供建立和使用全球唯一識別碼型控制區塊 的功能,以及記錄各個被測試之驅動程式之測試結果的功 能。使用全球唯一識別碼型控制區塊的目的是因爲在可延 伸式韌體介面的環境下每個階段是各自獨立的,而且彼此 間的資料是不能直接傳送,被測試之驅動程式的測試結果 可存放在全球唯一識別碼型控制區塊中’而在其他的操作 階段可由讀取全球唯一*識別碼型控制區塊中的測i式結果就 8 326\專利說明書(補件)\92-04\TF924507 1222557 可到先前操作喈段的各項資料;並且使用全球唯一識別碼 型控制區塊’對程式開發者而言是不需要知道現在到底測 試了那些驅動程式,只要找到全球唯一識別碼型控制區 塊’其中記錄了被測試之驅動程式的名稱、測試過程中的 訊息和測試結果,就可以知道那些驅動程式被測試,以及 測試結果;又’全球唯一識別碼型控制區塊是存在於隨機 存取記憶體24中,其位置和大小是由可延伸式韌體介面之 一記憶體管理程式(M e m 〇 r y M a n a g e r)之一交換區塊 (H and-Off Block)管理程式來動態決定的,所以不用擔心是 否會與其他資料重疊或空間不夠。 接奢’由核心驅動程式2 0執行被測試之驅動程式,並且 呼叫專屬於各個被測試之驅動程式的一個別診斷驅動程式 (Individual Diagnostic Driver)27,由此個別診斷驅動程式 2 7對被測試之驅動程式進行測試(步驟s 1 1 〇)。核心驅動程 式2 0將被測試之驅動程式的名稱、測試過程中的訊息和測 試結果藉由服務程式庫驅動程式2 8記錄及將其存放於隨 機存取記憶體2 4中的全球唯一識別碼型控制區塊(步驟 S 1 1 2 )。其中,全球唯一識別碼型控制區塊的結構如圖3 所示,全球唯一識別碼型控制區塊3 0會隨著記憶體管理程 式所指定之交換區塊管理程式的位置,將被測試之驅動程 式之全球唯一識別碼(GUID , Globally Unique Identifier)34、名稱(Name)35、第一測試結果 36、第二測 g式結果3 7、…依序地存放’以保存各個被測試之驅動程式 的測試資料。 9 326\專利說明書(補件)\92-04\TF924507 1222557 其次,由診斷應用程式22搜尋相對應於被測試之驅動程 式的全球唯一識別碼3 4與名稱3 5之全球唯一識別碼型控 制區塊3 0,並可讀取到被測試之驅動程式在測試過程中的 訊息和測試結果(步驟S 1 1 4)。當於可延伸式韌體介面之一 啓動階段(Boot Phase)或一操作系統啓動階段(OS Boot P h a s e)時’可由電腦之顯示裝置(未繪示)來顯示被測試之 驅動程式的測試結果(步驟S 1 1 6 ),如此,程式開發者便可 淸楚明瞭所設計之系統程式是否功能正常。 目前在可延伸式韌體介面之初始化階段的核心驅動程式 是必須放在唯讀記憶體中,當程式開發者每修改一次初始 化階段的驅動程式時,就必須將其重新燒錄於唯讀記憶體 中,如此將浪費不少的時間,可以將被測試之驅動程式存 放在唯讀記憶體以外的儲存裝置,例如軟式磁碟機(FDD, Floppy Disk Drive)或萬用串列匯流排(USB,Universal Serial Bus)裝置等,在核心驅動程式執行時,再到儲存裝 置上找對應被測試之驅動程式的映射檔案(Image File)即 可,如此對程式開發者可以增加使用的便利性。 本發明的優點在於提供一種可延伸式韌體介面之診斷 方法,其在可延伸式韌體介面的每個階段獨立之情況下, 在不同的操作階段可以得知初始化階段之各個驅動程式的 測試結果,而且可以選擇僅對需要測試的驅動程式進行測 試’使得系統開發的彈性度增加,並且可減少在系統開發 時所需要的測試時間。 雖然本發明已參照較佳具體例及舉例性附圖敘述如 10 326\專利說明書(補件)\92-〇4\TF924507 1222557 上’惟其應不被視爲係限制性者。熟悉本技藝者對其形態 及具體例之內容做各種修改、省略及變化,均不離開本發 明之範圍。 【圖式之簡單說明】 圖1爲本發明之流程圖; 圖2爲本發明之系統操作的示意圖;及 圖3爲本發明之全球唯一識別碼型控制區塊的示意圖。 【元件符號之說明】 20................核心驅動程式 22................診斷應用程式 2 4................隨機存取記憶體 26 ................非揮發性隨機存取記憶體 27 ................個SU診斷驅動程式 28 ................服務程式庫驅動程式 3〇................全球唯一識別碼型控制區塊 34 ................全球唯一識別碼 35 ................名稱 36 ................第一測試結果 3 7................第二測試結果 11 32(5\專利說明書(補件)\92-〇4\TF9245071222557 发明 Description of the invention [Technical field to which the invention belongs] The present invention relates to a diagnostic method, and particularly to a diagnostic method of an extensible firmware interface. [Previous technology] In computer systems, there is a lower-level firmware, generally known as the Basic Input / Output System (BIOS), which comes with the host computer and is placed in read-only memory A program on the ROM (Read Only Memory) contains many basic subroutines for computer input and output, and after the computer power is turned on, the basic input and output system will be executed first to perform initial settings and boot self-test (ie, POST, Powei-on Self Test), and read data from CMOS 'Complementary Metal-Oxide Semiconductor (hard disk size, drive availability, system time, whether to use mapped random access memory (S had 〇w RA Μ) and other information). Due to the rapid progress of computer technology, the traditional basic input / output system (Legacy BIOS) with the development of computer systems has also reached its limit. Therefore, in order to overcome the development bottleneck of the traditional basic input / output system, Intel Corporation has developed a specification of an extensible firmware interface, which can dispense with the inherent limitation of the basic input / output system. In addition, this extensible firmware interface allows the use of standard programming language tools to add new components, has better extensibility, and is written in the C language. The program is easy to maintain and read. 5 326 \ Patent Specification (Supplement) \ 92-04 \ TF924507 1222557 Under the operating environment of the extensible firmware interface, it is divided into several different phases (P hase). For example, the extensible firmware will be executed during the initialization phase. The EFI boot manager of the system interface performs initial system settings and loads the extensible firmware interface driver and application program one by one. During the startup phase or an operating system startup phase, the user can choose the desired The operating system and environment, and each phase is independent, that is, the action to be performed in the previous stage is finished, a message is sent to notify the next stage to start the action, but the operation result of the previous stage is not sent. To the next stage. As mentioned above, in the process of developing the extensible firmware interface system, since each stage is independent of each other, when testing the extensible firmware interface program, The test results of the driver are not known, because the test results of each driver in the initialization phase cannot be transmitted to the startup phase or an operating system startup phase to display the results; if the driver is only in the initialization phase, The program needs to be revised and tested. It still tests all the drivers in the initialization phase, and it is impossible to choose to test only the drivers that need to be tested, so it takes a lot of time to develop the time required for the development. SUMMARY OF THE INVENTION The object of the present invention is to provide a method for diagnosing an extensible firmware interface. Under the condition that each stage of the extensible firmware interface is independent, the test results of each driver in the initialization phase can be known. , And you can choose to test only the drivers you need to test. The invention provides a diagnostic method for an extensible firmware interface, which is used in a computer system of 6 326 \ Patent Specification (Supplement) \ 92-04 \ TF924507 1222557 during the initialization phase of the extensible firmware interface, and Test one of the drivers executed during this phase. The diagnostic method first selects a driver to be tested by a diagnostic application of one of the extensible firmware interfaces, and establishes a selection variable based on a globally unique identifier of one of the drivers to be tested, and stores it in a non-volatile In memory; after rebooting, a core driver in the extensible firmware interface reads the selection variables in non-volatile memory; then, it is served by one of the extensible primitive interfaces The Service Library Driver creates a Globally Unique Identifier Type Control Block5 Guid Type Control Block in a memory, and the tested driver is executed by the core driver, and Record the name of the tested driver, the information during the test and the test results, and store it in the global unique identification pattern control block. Then, the diagnostic application searches for the name corresponding to the tested driver, The globally unique identification pattern control block of the message and test results during the test One of the start-up phases of the extended firmware interface or an operating system displays the test results of the tested driver. [Embodiment] FIG. 1 is a flowchart of the present invention, FIG. 2 is a schematic view of a system operation of the present invention, and FIG. 3 is a schematic diagram of a globally unique identification pattern control block of the present invention. A preferred embodiment of the present invention will be described below with reference to FIGS. 1 to 3. When developing an extensible firmware interface system, a program developer can use a diagnostic application 22 in the extensible firmware interface system to select, for example, all or one of the drivers in the initialization phase. 326 \ Patent Specification (Supplements) \ 92-04 \ TF924507 to run the program for testing (step s 1 02). When the program developer selects the driver to be tested, the diagnostic application 2 2 will be based on the tested driver. A corresponding selection variable is established (step S 104), and the selection variable is stored in a non-volatile random access memory (Non Volatile RAM) 26. The purpose of storing the selection variables in the non-volatile random access memory 26 is because the data stored in the non-volatile random access memory 26 will not disappear due to the computer's shutdown or lack of power, and the The firmware interface system can read data from the non-volatile random access memory 26 at any time without restriction. At this time, after the computer system is turned off and then turned on again, the core driver program 20, which is one of the extensible firmware interfaces, reads the selection variable in the non-volatile random access memory 26 (step S1 06). The core driver The program 20 selects all or part of the specified drivers for testing during the initialization phase according to the selection parameter. Prior to testing, the core driver 20 will call one of the extensible firmware interfaces, the service library driver 28, and the service library driver 28 will create a globally unique identification pattern control in a random access memory 24 Block (step S 1 08). Among them, the service library driver 28 can provide the function of creating and using a globally unique identification pattern control block, and the function of recording the test results of each tested driver. The purpose of using the globally unique identification pattern control block is because each stage is independent in the environment of the extensible firmware interface, and the data between each other cannot be directly transmitted. The test results of the tested driver can be Stored in the globally unique identification pattern control block ', and in other operation phases, the test result of the globally unique * identification pattern control block can be read. 8 326 \ Patent Specification (Supplement) \ 92-04 \ TF924507 1222557 You can go to all the data in the previous operation segment; and use the globally unique identification pattern control block 'It is not necessary for program developers to know which drivers are currently tested, as long as they find the globally unique identification pattern The 'Control Block' contains the name of the driver being tested, the messages during the test, and the test results, so you can know which drivers were tested and the test results; and 'The globally unique identification type control block exists in In the random access memory 24, its position and size are controlled by a memory management program (M em 〇ry M) an n a g e r) is dynamically determined by the H and-Off Block management program, so there is no need to worry about whether it will overlap with other data or have insufficient space. “Receiving luxury” The tested driver is executed by the kernel driver 2 0, and a separate diagnostic driver 27 (Individual Diagnostic Driver) dedicated to each tested driver is called, thereby individually diagnosing the driver 2 7 to the tested Test the driver (step s 1 1 0). The core driver 2 0 records the name of the driver to be tested, the messages during the test, and the test results by the service library driver 2 8 and stores it in the random access memory 2 4 as a globally unique identifier. Type control block (step S 1 1 2). Among them, the structure of the globally unique identification pattern control block is shown in Figure 3. The globally unique identification pattern control block 30 will be tested with the location of the swap block management program specified by the memory management program. Driver's Globally Unique Identifier (GUID) 34, Name 35, First Test Result 36, Second Test G-Result 3 7, ... Stored sequentially to save each tested driver Test data for the program. 9 326 \ Patent Specification (Supplement) \ 92-04 \ TF924507 1222557 Secondly, the diagnostic application 22 searches for the globally unique identification code 3 4 and the name 3 5 corresponding to the globally unique identification code control of the driver being tested. Block 30, and can read the information and test results of the tested driver during the test (step S 1 1 4). When in one of the bootable phases of the extensible firmware interface (Boot Phase) or an operating system boot phase (OS Boot P hase), the test results of the tested driver can be displayed by the computer's display device (not shown) (Step S 1 1 6). In this way, the program developer can know clearly whether the designed system program functions normally. At present, the core driver in the initialization stage of the extensible firmware interface must be placed in read-only memory. When a program developer modifies the driver in the initialization stage, it must be re-burned into the read-only memory. In the system, this will waste a lot of time, and the tested driver can be stored in a storage device other than read-only memory, such as a floppy disk drive (FDD, Floppy Disk Drive) or a universal serial bus (USB (Universal Serial Bus) devices, etc., when the core driver is running, then go to the storage device to find the mapping file (Image File) corresponding to the driver being tested, so that it can increase the convenience for program developers. The advantage of the present invention is to provide a method for diagnosing an extensible firmware interface. Under the condition that each stage of the extensible firmware interface is independent, the test of each driver in the initialization phase can be learned in different operation phases. As a result, it is also possible to choose to test only the drivers that need to be tested, so that the flexibility of system development is increased, and the test time required during system development can be reduced. Although the present invention has been described with reference to preferred specific examples and exemplary drawings, such as 10 326 \ Patent Specification (Supplements) \ 92-〇4 \ TF924507 1222557, it should not be construed as limiting. Those skilled in the art can make various modifications, omissions, and changes to their forms and specific examples without departing from the scope of the present invention. [Brief description of the drawings] FIG. 1 is a flowchart of the present invention; FIG. 2 is a schematic diagram of the system operation of the present invention; and FIG. 3 is a schematic diagram of the globally unique identification pattern control block of the present invention. [Description of component symbols] 20 ...... Core driver 22 ...... Diagnostic application 2 4 .. .............. Random Access Memory 26 ...... Non-volatile Random Access Memory 27 ..... ..... SU diagnostic driver 28 ... service library driver 3.. ....... ...... Globally Unique Identification Code Control Block 34 ...... Globally Unique Identification Code 35 ......... .. Name 36 .. First test result 3 7... Second test result 11 32 (5 \ Patent Specification (Supplement) \ 92-〇4 \ TF924507