TW201723849A - Method for allocating memory resource - Google Patents

Method for allocating memory resource Download PDF

Info

Publication number
TW201723849A
TW201723849A TW104142975A TW104142975A TW201723849A TW 201723849 A TW201723849 A TW 201723849A TW 104142975 A TW104142975 A TW 104142975A TW 104142975 A TW104142975 A TW 104142975A TW 201723849 A TW201723849 A TW 201723849A
Authority
TW
Taiwan
Prior art keywords
memory
bit
expansion device
basic input
output system
Prior art date
Application number
TW104142975A
Other languages
Chinese (zh)
Other versions
TWI561986B (en
Inventor
黃靖欽
Original Assignee
神雲科技股份有限公司
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 神雲科技股份有限公司 filed Critical 神雲科技股份有限公司
Priority to TW104142975A priority Critical patent/TWI561986B/en
Application granted granted Critical
Publication of TWI561986B publication Critical patent/TWI561986B/en
Publication of TW201723849A publication Critical patent/TW201723849A/en

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)

Abstract

A method for allocating memory resource is used for a computer system including a BIOS, a memory unit, and a plurality of slots. The slots is able to be inserted by a plurality of expanding devices. The method is implemented by the BIOS and includes: (a) determining whether one of the slots is inserted by an expanding device inserts or not; (b) acquiring a represented memory demand data and a represented format data from the expanding device inserting the slot; (c) determining the memory size of the memory unit for allocating to the expanding device inserting the slot based on the represented memory demand data and the represented format data; so as to achieve the optimization of allocating memory resource.

Description

記憶體資源的配置方法Memory resource configuration method

本發明是有關於一種配置方法,特別是指一種記憶體資源的配置方法。 The present invention relates to a configuration method, and more particularly to a method for configuring a memory resource.

習知的電腦系統包含一個基本輸入輸出系統、供擴充介面卡(Add-On Card)插設的多個插槽(Slot)、及多個記憶體。該等擴充介面卡支援外部連結標準(Peripheral Component Interconnect;PCI、PCI Express)的協定。該電腦系統在開機後,該基本輸入輸出系統會根據一個預先儲存的設定表,將記憶體資源分配給該等擴充介面卡。由於該等擴充介面卡可以支援32位元或64位元二種格式,導致該習知的電腦系統會遇到以下二種問題。 The conventional computer system includes a basic input/output system, a plurality of slots for inserting an Add-On Card, and a plurality of memories. These extended interface cards support the agreement of the Peripheral Component Interconnect (PCI, PCI Express). After the computer system is turned on, the basic input/output system allocates memory resources to the extended interface cards according to a pre-stored setting table. Since the extended interface cards can support both 32-bit or 64-bit formats, the conventional computer system encounters the following two problems.

第一,由於無法預先知道支援64位元的擴充介面卡會插設在哪一個插槽,若該預先儲存的設定表假設所有的擴充介面卡都是支援32位元的格式來分配記憶體資源,可能導致所有擴充介面卡需要的記憶體容量超過32位元格式所能支援的上限,即四十億位元組(4Giga Byte;4GB),而造成部分擴充介面卡沒有被分配到足夠的記憶體 的容量大小。 First, since it is impossible to know in advance which slot the extended interface card supporting 64-bit will be inserted, if the pre-stored setting table assumes that all the extended interface cards support the 32-bit format to allocate memory resources. It may cause the memory capacity of all expansion interface cards to exceed the upper limit supported by the 32-bit format, that is, 4 billion bytes (4Giga Byte; 4GB), and some expansion interface cards are not allocated enough memory. body The size of the capacity.

第二,使用者藉由修改該基本輸入輸出系統的該設定表,如經由BIOS Setup Menu修改,手動將預設為支援32位元格式的部分插槽所插設的擴充介面卡改為支援64位元格式。然而,舉例來說,若擴充介面卡是支援32位元格式,但當使用者卻設定為支援64位元格式時,將導致該電腦系統不穩定。 Second, by modifying the setting table of the basic input/output system, the user manually changes the expansion interface card inserted in the partial slot supporting the 32-bit format to 64 in the BIOS Setup Menu. Bit format. However, for example, if the extended interface card supports the 32-bit format, but the user is set to support the 64-bit format, the computer system will be unstable.

因此,本發明之目的,即在提供一種記憶體資源分配最佳化的配置方法。 Accordingly, it is an object of the present invention to provide a configuration method for optimizing memory resource allocation.

於是,本發明記憶體資源的配置方法,適用於一個電腦系統,該電腦系統包含一個基本輸入輸出系統、一個記憶體單元、及多個插槽。該等插槽可提供多個擴充裝置插設。該記憶體資源的配置方法包含步驟(a)~(c)。 Therefore, the method for configuring the memory resource of the present invention is applicable to a computer system including a basic input/output system, a memory unit, and a plurality of slots. These slots provide multiple expansion device insertions. The method for configuring the memory resource includes steps (a) to (c).

於步驟(a),藉由該基本輸入輸出系統判斷該等插槽之其中一者是否設置有一個擴充裝置。 In step (a), the basic input/output system determines whether one of the slots is provided with an expansion device.

於步驟(b),藉由該基本輸入輸出系統從設置在該等插槽之其中該者的該擴充裝置,獲得一個對應的記憶體需求資料及一個對應的規格資料。 In step (b), the basic input/output system obtains a corresponding memory requirement data and a corresponding specification data from the expansion device disposed in the one of the slots.

於步驟(c),藉由該基本輸入輸出系統根據該對應的記憶體需求資料及該對應的規格資料,決定分配給該設置在該等插槽之其中該者的該擴充裝置的該記憶體單元的記憶體容量大小。 In step (c), the basic input/output system determines the memory allocated to the expansion device of the one of the slots according to the corresponding memory requirement data and the corresponding specification data. The memory capacity of the unit.

在一些實施態樣中,該等插槽及該等擴充裝置 支援外部連結標準(PCI、PCI Express)的協定。其中,在步驟(b)中,該記憶體需求資料指示該擴充裝置所需要的記憶體容量大小,該規格資料指示該擴充裝置是支援32位元的格式及64位元的格式之其中一者。 In some implementations, the slots and the expansion devices Agreement to support external connection standards (PCI, PCI Express). Wherein, in the step (b), the memory demand data indicates a memory capacity required by the expansion device, and the specification data indicates that the expansion device supports one of a 32-bit format and a 64-bit format. .

在一些實施態樣中,每一個擴充裝置包含一個組態空間暫存器(Configuration Space Register;CSR),每一個組態空間暫存器包括多個基址暫存器(Base Address Register;BAR)。其中,在步驟(b)中,該基本輸入輸出系統將一個第一指令分別傳送至該擴充裝置的每一個基址暫存器,並分別接收該擴充裝置的每一個基址暫存器的一個第二指令,而獲得該擴充裝置的該記憶體需求資料及該規格資料。 In some implementations, each expansion device includes a Configuration Space Register (CSR), and each configuration space register includes a plurality of Base Address Registers (BARs). . Wherein, in step (b), the basic input/output system transmits a first instruction to each of the base address registers of the expansion device, and respectively receives one of each of the base address registers of the expansion device The second instruction obtains the memory requirement data of the expansion device and the specification data.

在一些實施態樣中,該記憶體資源的配置方法還包含在步驟(b)及(c)之間的步驟(d)及(e)。 In some implementations, the method of configuring the memory resource further includes steps (d) and (e) between steps (b) and (c).

於步驟(d),藉由該基本輸入輸出系統判斷該等插槽之其中另一者是否設置有另一個擴充裝置。 In step (d), the basic input/output system determines whether the other of the slots is provided with another expansion device.

於步驟(e),當在步驟(d)中,該基本輸入輸出系統判斷該等插槽之其中另一者有另一個擴充裝置時,再重新執行步驟(b)及(d),直到在步驟(d)中,該基本輸入輸出系統判斷該等插槽之其中另一者沒有另一個擴充裝置。 In step (e), when the basic input/output system determines in step (d) that the other of the slots has another expansion device, steps (b) and (d) are re-executed until In step (d), the basic input/output system determines that the other of the slots does not have another expansion device.

其中,在步驟(c)中,藉由該基本輸入輸出系統計算全部的該等擴充裝置所需要的記憶體容量的總和。當該總和不大於一個上限值時,該基本輸入輸出系統分別依照該等擴充裝置的該等記憶體需求資料,將對應該上限值 以下的記憶體位址的記憶體容量分配給該等擴充裝置。當該總和大於該上限值時,該基本輸入輸出系統分別依照指示支援32位元的該等擴充裝置的該等規格資料及該等記憶體需求資料,將對應該上限值以下的記憶體位址的記憶體容量分配給該等擴充裝置,並分別依照指示支援64位元的該等擴充裝置的該等規格資料及該等記憶體需求資料,將對應該上限值以上的記憶體位址的記憶體容量分配給該等擴充裝置。 Wherein, in step (c), the sum of the memory capacities required by all of the expansion devices is calculated by the basic input/output system. When the sum is not greater than an upper limit value, the basic input/output system respectively corresponds to the memory demand data of the expansion devices, and corresponds to the upper limit value. The memory capacity of the following memory addresses is allocated to the expansion devices. When the sum is greater than the upper limit value, the basic input/output system respectively corresponds to the specification data of the 32-bit extended expansion devices and the memory demand data, and corresponds to the memory level below the upper limit value. The memory capacity of the address is allocated to the expansion devices, and the memory addresses corresponding to the upper limit value are corresponding to the specification data of the expansion devices supporting the 64-bit device and the memory demand data. The memory capacity is allocated to the expansion devices.

在一些實施態樣中,其中,在步驟(b)中,該第一指令為0xFFFFFFFF,每一個第二指令包括32個位元,且由MSB至LSB依序為第三十一位元至第零位元,該第二指令的該第零位元為一個記憶體空間指示,該第二指令的該第二位元及該第一位元的邏輯值為該規格資料。 In some implementations, wherein, in the step (b), the first instruction is 0xFFFFFFFF, each second instruction includes 32 bits, and the MSB to the LSB are sequentially the thirty-first bit to the first The zero bit, the zeroth bit of the second instruction is a memory space indication, and the second bit of the second instruction and the logical value of the first bit are the specification data.

當該第二指令的該第二位元及該第一位元為邏輯值00時,該擴充裝置支援32位元的格式。當該第二指令的該第二位元及該第一位元為邏輯值10時,該擴充裝置支援64位元的格式。 When the second bit of the second instruction and the first bit are logical values 00, the expansion device supports a 32-bit format. When the second bit of the second instruction and the first bit are logical values of 10, the expansion device supports a format of 64 bits.

該基本輸入輸出系統將該第零位元為邏輯值0的每一個第二指令的該第三十一位元至該第四位元的邏輯值所對應的一個數值相加,而獲得該記憶體需求資料。 The basic input/output system adds the zeroth bit to a value corresponding to the logical value of the third eleventh to the fourth bit of each second instruction of the logical value 0, and obtains the memory. Physical requirements data.

在步驟(c)中,該上限值是四十億位元組(4 Giga Byte;4GB)。 In step (c), the upper limit is four billion bytes (4 Giga Byte; 4 GB).

或者在一些實施態樣中,其中,在步驟(c)中,該基本輸入輸出系統分別依照指示支援32位元的該等擴充 裝置的該等規格資料及該等記憶體需求資料,將對應一個上限值以下的記憶體位址的記憶體容量分配給該等擴充裝置,並分別依照指示支援64位元的該等擴充裝置的該等規格資料及該等記憶體需求資料,將對應該上限值以上的記憶體位址的記憶體容量分配給該等擴充裝置。 Or in some implementations, wherein in step (c), the basic input/output system supports the 32-bit expansion according to the indication The specification data of the device and the memory requirement data, the memory capacity corresponding to a memory address below the upper limit value is allocated to the expansion devices, and the expansion devices supporting the 64-bit device respectively according to the instructions The specification data and the memory requirement data are allocated to the expansion devices for the memory capacity of the memory address above the upper limit.

或者在一些實施態樣中,該記憶體資源的配置方法還包含在步驟(c)之後的步驟(d)及(e)。 Or in some implementations, the method of configuring the memory resource further includes steps (d) and (e) subsequent to step (c).

於步驟(d),藉由該基本輸入輸出系統判斷該等插槽之其中另一者是否設置有另一個擴充裝置。 In step (d), the basic input/output system determines whether the other of the slots is provided with another expansion device.

於步驟(e),當在步驟(d)中,該基本輸入輸出系統判斷該等插槽之其中另一者有另一個擴充裝置時,再重新執行步驟(b)~(d),直到在步驟(d)中,該基本輸入輸出系統判斷該等插槽之其中另一者沒有另一個擴充裝置。 In the step (e), when the basic input/output system determines in step (d) that the other of the slots has another expansion device, the steps (b) to (d) are re-executed until In step (d), the basic input/output system determines that the other of the slots does not have another expansion device.

本發明之功效是藉由該基本輸入輸出系統判斷該等插槽是否插設有該等擴充裝置,並由該等擴充裝置獲得對應的該記憶體需求資料及該規格資料,使得該基本輸入輸出系統能據以決定分配給該等擴充裝置的該記憶體單元的容量大小,而能達成記憶體資源分配的最佳化。 The function of the present invention is to determine whether the slots are inserted with the expansion devices by the basic input/output system, and obtain the corresponding memory demand data and the specification data by the expansion devices, so that the basic input and output The system can determine the size of the memory unit allocated to the expansion devices to optimize memory resource allocation.

1‧‧‧中央處理器 1‧‧‧Central Processing Unit

2‧‧‧晶片組 2‧‧‧chipset

3‧‧‧基本輸入輸出系統 3‧‧‧Basic input and output system

4‧‧‧記憶體單元 4‧‧‧ memory unit

51‧‧‧第一插槽 51‧‧‧First slot

52‧‧‧第二插槽 52‧‧‧second slot

53‧‧‧第三插槽 53‧‧‧ third slot

54‧‧‧第四插槽 54‧‧‧fourth slot

61‧‧‧第一擴充裝置 61‧‧‧First expansion unit

62‧‧‧第二擴充裝置 62‧‧‧Second expansion unit

S1~S7‧‧‧步驟 S1~S7‧‧‧ steps

S41~S42‧‧‧步驟 S41~S42‧‧‧Steps

S61~S62‧‧‧步驟 S61~S62‧‧‧Steps

本發明之其他的特徵及功效,將於參照圖式的實施方式中清楚地呈現,其中:圖1是一方塊圖,說明本發明記憶體資源的配置方法所適用的一個電腦系統;圖2是一流程圖,說明本發明記憶體資源的配置方法的 一第一實施例;及圖3是一流程圖,說明本發明記憶體資源的配置方法的一第二實施例。 Other features and effects of the present invention will be apparent from the embodiments of the present invention. FIG. 1 is a block diagram illustrating a computer system to which the memory resource configuration method of the present invention is applied. FIG. A flowchart illustrating a method of configuring a memory resource of the present invention A first embodiment; and FIG. 3 is a flow chart illustrating a second embodiment of a method of configuring a memory resource of the present invention.

在本發明被詳細描述之前,應當注意在以下的說明內容中,類似的元件是以相同的編號來表示。 Before the present invention is described in detail, it should be noted that in the following description, similar elements are denoted by the same reference numerals.

參閱圖1,本發明記憶體資源的配置方法,適用於一個電腦系統,該電腦系統包含一個中央處理器(CPU)1、一個晶片組(Chipset)2、一個基本輸入輸出系統(Basic Input/Output System;BIOS)3、一個記憶體單元4、及多個插槽(Slot),該等插槽可以提供多個擴充裝置插設。在本實施例中,該等插槽及該等擴充裝置都支援外部連結標準,即Peripheral Component Interconnect(PCI)或Peripheral Component Interconnect Express(PCIE)的協定,因此,每一個擴充裝置包含一個組態空間暫存器(Configuration Space Register;CSR),每一個組態空間暫存器包括多個,例如六個,基址暫存器(Base Address Register;BAR)。為說明方便起見,該等插槽以電連接該中央處理器1的一個第一插槽51及一個第二插槽52,及電連接該晶片組2的一個第三插槽53及一個第四插槽54為例作說明,但不在此限。相似地,該等擴充裝置以一個插設在該第一插槽51的第一擴充裝置61及一個插設在該第二插槽52的第二擴充裝置62為例作說明,但不在此限。 Referring to FIG. 1, a method for configuring a memory resource according to the present invention is applicable to a computer system including a central processing unit (CPU) 1, a chip set (Chipset) 2, and a basic input/output system (Basic Input/Output). System; BIOS) 3, a memory unit 4, and a plurality of slots (Slots), which can provide multiple expansion device insertions. In this embodiment, the slots and the expansion devices support the external connection standard, that is, the Peripheral Component Interconnect (PCI) or the Peripheral Component Interconnect Express (PCIE) protocol. Therefore, each expansion device includes one configuration space. The Configuration Space Register (CSR), each configuration space register includes multiple, for example, six, Base Address Register (BAR). For convenience of description, the slots are electrically connected to a first slot 51 and a second slot 52 of the central processing unit 1, and a third slot 53 and a first portion electrically connected to the chip set 2. The four slots 54 are for illustrative purposes, but are not limited to this. Similarly, the expansion device is illustrated by a first expansion device 61 inserted in the first slot 51 and a second expansion device 62 inserted in the second slot 52, but not limited thereto. .

參閱圖1與圖2,本發明記憶體資源的配置方 法之第一實施例,藉由該電腦系統實施,並執行步驟S1~S7。 Referring to FIG. 1 and FIG. 2, the configuration side of the memory resource of the present invention The first embodiment of the method is implemented by the computer system and steps S1 to S7 are performed.

於步驟S1,該電腦系統因啟動電源而開機。 In step S1, the computer system is powered on by starting the power.

於步驟S2,藉由該基本輸入輸出系統3判斷該等插槽之其中一者是否設置有一個擴充裝置。更詳細地說,該中央處理器1及該晶片組2在開機後,會分別定義各自所電連接的該等擴充插槽的匯流排號碼(Bus Number),並將相關的資訊儲存於該中央處理器1內。該基本輸入輸出系統3將一個第三指令逐一地經由該中央處理器1傳送至每一個插槽,再根據每一個插槽是否有回覆一個第四指令,以判斷該插槽是否有設置一個擴充裝置。當該基本輸入輸出系統3判斷該等插槽之其中一者設置有一個擴充裝置,如該第一插槽51設置有該第一擴充裝置61時,該電腦系統執行步驟S3。當該基本輸入輸出系統3判斷沒有設置任何一個擴充裝置時,該電腦系統執行步驟S7。 In step S2, the basic input/output system 3 determines whether one of the slots is provided with an expansion device. In more detail, after the power is turned on, the central processing unit 1 and the chipset 2 respectively define the bus numbers of the expansion slots to which the respective expansion slots are electrically connected, and store related information in the center. Inside processor 1. The basic input/output system 3 transmits a third command to each slot one by one via the central processing unit 1, and then according to whether each slot has a fourth command to determine whether the slot has an extension. Device. When the basic input/output system 3 determines that one of the slots is provided with an expansion device, if the first slot 51 is provided with the first expansion device 61, the computer system performs step S3. When the basic input/output system 3 judges that no expansion device is set, the computer system executes step S7.

於步驟S3,藉由該基本輸入輸出系統3從設置在該等插槽之其中該者的該擴充裝置,獲得一個對應的記憶體需求資料。該記憶體需求資料指示該擴充裝置所需要的記憶體容量大小。 In step S3, the basic input/output system 3 obtains a corresponding memory demand data from the expansion device disposed in the one of the slots. The memory demand data indicates the amount of memory capacity required by the expansion device.

更詳細地說,該基本輸入輸出系統3將一個第一指令分別傳送至該擴充裝置的每一個基址暫存器,並分別接收該擴充裝置的每一個基址暫存器的一個第二指令,而獲得該擴充裝置的該記憶體需求資料。該第一指令及每 一個第二指令都包括32個位元,該第一指令為0xFFFFFFFF(以十六進位表示該32個位元),該第二指令由MSB至LSB依序為第三十一位元至第零位元,該第二指令的該第零位元為一個記憶體空間指示(Memory Space Indicator)。 In more detail, the basic input/output system 3 transmits a first instruction to each of the base address registers of the expansion device, and respectively receives a second instruction of each of the base address registers of the expansion device. And obtaining the memory demand data of the expansion device. The first instruction and each A second instruction includes 32 bits, the first instruction is 0xFFFFFFFF (the 32 bits are represented by hexadecimal), and the second instruction is sequentially from the MSB to the LSB to the third eleventh to the zeroth. The bit, the zeroth bit of the second instruction is a Memory Space Indicator.

該基本輸入輸出系統3將該第零位元為邏輯值0的每一個第二指令的該第三十一位元至該第四位元的邏輯值所對應的一個數值相加,而獲得該記憶體需求資料。舉例來說,若該擴充裝置的該六個基址暫存器之其中一個回覆該第二指令為0xF8000000,以二進位表示則為該第三十一位元至該第二十七位元為邏輯1、該第二十六位元至該第零位元為邏輯0,對應的該數值則為227=128(MByte)。相似地,若該六個基址暫存器之其中另一個回覆該第二指令為0xF0000000,以二進位表示則為該第三十一位元至該第二十八位元為邏輯1、該第二十七位元至該第零位元為邏輯0,對應的該數值則為228=256(MByte)。因此,該基本輸入輸出系統3將該二個數值,即128Mbyte與256Mbyte,相加,而獲得該記憶體需求資料,即384Mbyte。 The basic input/output system 3 adds the zeroth bit to a value corresponding to the logical value of the third eleventh to the fourth bit of each second instruction of the logical value 0, and obtains the Memory requirements data. For example, if one of the six base address registers of the expansion device replies to the second instruction is 0xF8000000, and the binary representation is the third eleventh to the twenty-seventh bit Logic 1, the twenty-sixth bit to the zeroth bit is a logic 0, and the corresponding value is 2 27 = 128 (MByte). Similarly, if the other of the six base address registers replies that the second instruction is 0xF0000000, and the binary representation is the third octet to the second octet is logic 1, the The twenty-seventh bit to the zeroth bit is a logical zero, and the corresponding value is 2 28 = 256 (MByte). Therefore, the basic input/output system 3 adds the two values, 128 Mbyte and 256 Mbyte, to obtain the memory demand data, that is, 384 Mbyte.

於步驟S4,藉由該基本輸入輸出系統3從設置在該等插槽之其中該者的該擴充裝置,獲得一個對應的規格資料。該規格資料指示該擴充裝置是支援32位元及64位元之其中哪一種格式。 In step S4, the basic input/output system 3 obtains a corresponding specification data from the expansion device disposed in the one of the slots. The specification data indicates which of the 32-bit and 64-bit formats the expansion device supports.

更詳細地說,該基本輸入輸出系統3接受每一個基址暫存器的該第二指令,還獲得該規格資料。該第二 指令的該第二位元及該第一位元的邏輯值為該規格資料。當該第二指令的該第二位元及該第一位元為邏輯值00b時,該擴充裝置支援32位元的格式。當該第二指令的該第二位元及該第一位元為邏輯值10b時,該擴充裝置支援64位元的格式。特別補充說明的是:「b」是指該邏輯值以二進位表示。要特別補充說明的是:步驟S3及S4都是根據所接收的該等第二指令作判斷,因此,步驟S3及S4的順序不僅可以對調,也可以在同一個步驟中實施。 In more detail, the basic input/output system 3 accepts the second instruction of each of the base register and also obtains the specification data. The second The second bit of the instruction and the logical value of the first bit are the specification data. When the second bit of the second instruction and the first bit are logic value 00b, the expansion device supports a 32-bit format. When the second bit of the second instruction and the first bit are logical values 10b, the expansion device supports a 64-bit format. It is specifically added that "b" means that the logical value is represented by binary. It should be particularly noted that steps S3 and S4 are judged based on the received second commands. Therefore, the order of steps S3 and S4 can be performed not only in the same but also in the same step.

於步驟S5,藉由該基本輸入輸出系統3判斷該等插槽之其中另一者是否設置有另一個擴充裝置。其詳細地作法可參考步驟S2。當該基本輸入輸出系統3判斷該等插槽之其中另一者設置有一個擴充裝置,如該第一插槽51設置有該第二擴充裝置62時,該電腦系統執行步驟S3。當該基本輸入輸出系統3判斷沒有設置任何一個擴充裝置時,該電腦系統執行步驟S6。 In step S5, the basic input/output system 3 determines whether the other of the slots is provided with another expansion device. For detailed implementation, refer to step S2. When the basic input/output system 3 determines that the other of the slots is provided with an expansion device, such as the first slot 51 is provided with the second expansion device 62, the computer system performs step S3. When the basic input/output system 3 judges that no expansion device is set, the computer system executes step S6.

於步驟S6,藉由該基本輸入輸出系統3計算全部的該等擴充裝置所需要的記憶體容量的總和。當該總和大於一個上限值,如四十億位元組(4GB)時,該電腦系統執行步驟S61。當該總和不大於該上限值時,該電腦系統執行步驟S62。 In step S6, the basic input/output system 3 calculates the sum of the memory capacities required by all of the expansion devices. When the sum is greater than an upper limit, such as four billion bytes (4 GB), the computer system performs step S61. When the sum is not greater than the upper limit value, the computer system performs step S62.

於步驟S61,該基本輸入輸出系統3分別依照指示支援32位元的該等擴充裝置的該等規格資料及該等記憶體需求資料,將對應該上限值以下的記憶體位址的記憶體容量分配給該等擴充裝置,並分別依照指示支援64位元 的該等擴充裝置的該等規格資料及該等記憶體需求資料,將對應該上限值以上的記憶體位址的記憶體容量分配給該等擴充裝置。 In step S61, the basic input/output system 3 respectively stores the memory capacity corresponding to the memory address below the upper limit value according to the specification data of the expansion devices supporting the 32-bit device and the memory demand data. Assigned to these expansion devices and support 64-bit units as directed The specification data of the expansion devices and the memory requirement data allocate memory capacity corresponding to the memory address above the upper limit value to the expansion devices.

舉例來說,假設該記憶體單元4的容量有6GB,且假設對應該第一擴充裝置61的該規格資料及該記憶體需求資料分別為支援32位元及3GB,對應該第二擴充裝置62的該規格資料及該記憶體需求資料分別為支援64位元及2GB,則該基本輸入輸出系統3經由該中央處理器1所具有的一個記憶體控制器,將該記憶體單元4的0~3GB的記憶體位址所對應的3GB記憶體容量,分配給該第一擴充裝置61,並將該記憶體單元4的4~6GB的記憶體位址所對應的2GB記憶體容量,分配給該第二擴充裝置62。 For example, it is assumed that the capacity of the memory unit 4 is 6 GB, and it is assumed that the specification data corresponding to the first expansion device 61 and the memory requirement data respectively support 32 bits and 3 GB, corresponding to the second expansion device 62. The specification data and the memory requirement data respectively support 64 bits and 2 GB, and the basic input/output system 3 passes the memory controller 4 of the memory unit 4 via a memory controller of the central processing unit 1. The 3GB memory capacity corresponding to the 3GB memory address is allocated to the first expansion device 61, and the 2GB memory capacity corresponding to the 4~6 GB memory address of the memory unit 4 is allocated to the second Expansion device 62.

於步驟S62,該基本輸入輸出系統3分別依照該等擴充裝置的該等記憶體需求資料,將對應該上限值以下的記憶體位址的記憶體容量分配給該等擴充裝置。 In step S62, the basic input/output system 3 allocates the memory capacity corresponding to the memory address below the upper limit value to the expansion devices in accordance with the memory demand data of the expansion devices.

特別補充說明的是:在本實施例中,分配給支援32位元的格式的擴充裝置的記憶體的該上限值為4GB,而分配給支援64位元的格式的擴充裝置的記憶體的該上限值為2的64次方,即16EB(1EB=1024TB,1TB=1024GB),且在本發明的該實施例中,藉由區分擴充裝置,如PCI裝置所支援的格式,如32或64位元而分配不同區域(如0~4GB給支援32位元的格式的擴充裝置,4GB~16EB給支援64位元的格式的擴充裝置)的記憶體給各個PCI裝置使用。 In particular, in the present embodiment, the upper limit value of the memory allocated to the expansion device supporting the 32-bit format is 4 GB, and is allocated to the memory of the expansion device supporting the format of 64-bit. The upper limit is the 64th power of 2, that is, 16 EB (1 EB = 1024 TB, 1 TB = 1024 GB), and in this embodiment of the present invention, by distinguishing an expansion device, such as a format supported by the PCI device, such as 32 or A 64-bit memory is allocated to each PCI device in a different area (for example, an expansion device that supports a 32-bit format from 0 to 4 GB, and an expansion device that supports a 64-bit format from 4 GB to 16 EB).

於步驟S7,該電腦系統繼續開機的相關程序,並執行進入作業系統(OS)。 In step S7, the computer system continues to boot the relevant program and executes into the operating system (OS).

參閱圖1與圖3,本發明記憶體資源的配置方法之第二實施例,大致上是與該第一實施例相似,不同的地方如下。 Referring to FIG. 1 and FIG. 3, the second embodiment of the method for configuring the memory resource of the present invention is substantially similar to the first embodiment, and the different places are as follows.

於步驟S4,藉由該基本輸入輸出系統3從設置在該等插槽之其中該者的該擴充裝置,獲得一個對應的規格資料,並判斷該擴充裝置是否支援64位元的格式。當該基本輸入輸出系統3判斷該擴充裝置有支援64位元的格式時,該電腦系統執行步驟S41。當該基本輸入輸出系統3判斷該擴充裝置沒有支援64位元的格式時,該電腦系統執行步驟S42。 In step S4, the basic input/output system 3 obtains a corresponding specification data from the expansion device disposed in the one of the slots, and determines whether the expansion device supports the 64-bit format. When the basic input/output system 3 determines that the expansion device has a format supporting 64 bits, the computer system executes step S41. When the basic input/output system 3 determines that the expansion device does not support the 64-bit format, the computer system executes step S42.

於步驟S41,該基本輸入輸出系統3依照該等擴充裝置之其中該者的該記憶體需求資料,將對應該上限值以上的記憶體位址的記憶體容量分配給該擴充裝置。 In step S41, the basic input/output system 3 allocates a memory capacity corresponding to the memory address of the upper limit value or more to the expansion device according to the memory demand data of the one of the expansion devices.

於步驟S42,該基本輸入輸出系統3依照該等擴充裝置之其中該者的該記憶體需求資料,將對應該上限值以下的記憶體位址的記憶體容量分配給該擴充裝置。 In step S42, the basic input/output system 3 allocates a memory capacity corresponding to the memory address below the upper limit value to the expansion device according to the memory demand data of the one of the expansion devices.

特別補充說明的是:本發明記憶體資源的配置方法的該第一實施例是先計算該等擴充裝置的記憶體資源的需求總和,再分配記憶體資源,而本發明記憶體資源的配置方法的該第二實施例是針對每一個擴充裝置,逐一判斷而直接分配記憶體資源。但總體來看,該配置方法都是藉由該基本輸入輸出系統3根據該擴充裝置所對應的該記 憶體需求資料及該對應的規格資料,決定分配給該擴充裝置的該記憶體單元4的記憶體容量大小。 In particular, the first embodiment of the method for configuring a memory resource according to the present invention is to first calculate the sum of the memory resources of the expansion devices, and redistribute the memory resources, and the method for configuring the memory resources of the present invention. This second embodiment directly allocates memory resources for each expansion device, one by one. In general, the configuration method is based on the basic input/output system 3 according to the record corresponding to the expansion device. The memory requirement data and the corresponding specification data determine the memory capacity of the memory unit 4 allocated to the expansion device.

綜上所述,藉由該基本輸入輸出系統3判斷該等插槽是否插設有該等擴充裝置,並由該等擴充裝置獲得對應的該記憶體需求資料及該規格資料,使得該基本輸入輸出系統3能據以決定分配給該等擴充裝置的該記憶體單元4的容量大小,而能達成記憶體資源分配的最佳化,故確實能達成本發明之目的。 In summary, the basic input/output system 3 determines whether the expansion devices are inserted into the slots, and the corresponding expansion device obtains the corresponding memory requirement data and the specification data, so that the basic input The output system 3 can determine the size of the memory unit 4 allocated to the expansion devices, and the memory resource allocation can be optimized. Therefore, the object of the present invention can be achieved.

惟以上所述者,僅為本發明之較佳實施例而已,當不能以此限定本發明實施之範圍,凡是依本發明申請專利範圍及專利說明書內容所作之簡單的等效變化與修飾,皆仍屬本發明專利涵蓋之範圍內。 The above is only the preferred embodiment of the present invention, and the scope of the present invention is not limited thereto, and the simple equivalent changes and modifications made by the scope of the patent application and the patent specification of the present invention are It is still within the scope of the invention patent.

S1~S7‧‧‧步驟 S1~S7‧‧‧ steps

S61~S62‧‧‧步驟 S61~S62‧‧‧Steps

Claims (8)

一種記憶體資源的配置方法,適用於一個電腦系統,該電腦系統包含一個基本輸入輸出系統、一個記憶體單元、及多個插槽,該等插槽可提供多個擴充裝置插設,該記憶體資源的配置方法包含下列步驟:(a)藉由該基本輸入輸出系統判斷該等插槽之其中一者是否設置有一個擴充裝置;(b)藉由該基本輸入輸出系統從設置在該等插槽之其中該者的該擴充裝置,獲得一個對應的記憶體需求資料及一個對應的規格資料;及(c)藉由該基本輸入輸出系統根據該對應的記憶體需求資料及該對應的規格資料,決定分配給該設置在該等插槽之其中該者的該擴充裝置的該記憶體單元的記憶體容量大小。 A method for configuring a memory resource, which is applicable to a computer system including a basic input/output system, a memory unit, and a plurality of slots, the slots providing a plurality of expansion device insertions, the memory The method for configuring a physical resource includes the following steps: (a) determining, by the basic input/output system, whether one of the slots is provided with an expansion device; (b) setting the system by the basic input/output system The expansion device of the slot obtains a corresponding memory requirement data and a corresponding specification data; and (c) the basic input/output system according to the corresponding memory requirement data and the corresponding specification The data determines the amount of memory capacity of the memory unit allocated to the expansion device of the one of the slots. 如請求項1所述的記憶體資源的配置方法,該等插槽及該等擴充裝置支援外部連結標準(PCI、PCI Express)的協定,其中,在步驟(b)中,該記憶體需求資料指示該擴充裝置所需要的記憶體容量大小,該規格資料指示該擴充裝置是支援32位元的格式及64位元的格式之其中一者。 The method for configuring a memory resource according to claim 1, wherein the slots and the expansion devices support an agreement of an external connection standard (PCI, PCI Express), wherein in step (b), the memory requirement data Indicates the amount of memory capacity required by the expansion device, the specification data indicating that the expansion device supports one of a 32-bit format and a 64-bit format. 如請求項2所述的記憶體資源的配置方法,每一個擴充裝置包含一個組態空間暫存器(Configuration Space Register;CSR),每一個組態空間暫存器包括多個基址暫存器(Base Address Register;BAR),其中,在步驟(b) 中,該基本輸入輸出系統將一個第一指令分別傳送至該擴充裝置的每一個基址暫存器,並分別接收該擴充裝置的每一個基址暫存器的一個第二指令,而獲得該擴充裝置的該記憶體需求資料及該規格資料。 For the configuration method of the memory resource described in claim 2, each expansion device includes a configuration space register (CSR), and each configuration space register includes a plurality of base address registers. (Base Address Register; BAR), where, in step (b) The basic input/output system transmits a first instruction to each of the base address registers of the expansion device, and respectively receives a second instruction of each of the base address registers of the expansion device, and obtains the The memory requirement data of the expansion device and the specification data. 如請求項3所述的記憶體資源的配置方法,還包含在步驟(b)及(c)之間的下列步驟:(d)藉由該基本輸入輸出系統判斷該等插槽之其中另一者是否設置有另一個擴充裝置;及(e)當在步驟(d)中,該基本輸入輸出系統判斷該等插槽之其中另一者有另一個擴充裝置時,再重新執行步驟(b)及(d),直到在步驟(d)中,該基本輸入輸出系統判斷該等插槽之其中另一者沒有另一個擴充裝置;其中,在步驟(c)中,藉由該基本輸入輸出系統計算全部的該等擴充裝置所需要的記憶體容量的總和,當該總和不大於一個上限值時,該基本輸入輸出系統分別依照該等擴充裝置的該等記憶體需求資料,將對應該上限值以下的記憶體位址的記憶體容量分配給該等擴充裝置,當該總和大於該上限值時,該基本輸入輸出系統分別依照指示支援32位元的該等擴充裝置的該等規格資料及該等記憶體需求資料,將對應該上限值以下的記憶體位址的記憶體容量分配給該等擴充裝置,並分別依照指示支援64位元的該等擴充裝置的該等規格資料及該等記憶體需求資料,將對應該上限值以上的記 憶體位址的記憶體容量分配給該等擴充裝置。 The method for configuring a memory resource according to claim 3, further comprising the following steps between steps (b) and (c): (d) determining, by the basic input/output system, one of the other slots Whether it is provided with another expansion device; and (e) when in step (d), the basic input/output system determines that the other of the slots has another expansion device, and then performs step (b) again. And (d), until in step (d), the basic input/output system determines that the other of the slots does not have another expansion device; wherein, in step (c), the basic input/output system Calculating the sum of the memory capacities required by all of the expansion devices. When the sum is not greater than an upper limit value, the basic input/output system respectively corresponds to the memory demand data of the expansion devices. The memory capacity of the memory address below the limit value is allocated to the expansion devices, and when the sum is greater than the upper limit value, the basic input/output system respectively according to the specification data of the expansion devices supporting the 32-bit support And the memory Requesting information, the memory capacity of the memory address below the upper limit value is allocated to the expansion devices, and the specification data of the expansion devices supporting the 64-bit device and the memory demand data are respectively instructed according to the instructions. , will correspond to the above upper limit The memory capacity of the memory address is assigned to the expansion devices. 如請求項4所述的記憶體資源的配置方法,其中,在步驟(b)中,該第一指令為0xFFFFFFFF,每一個第二指令包括32個位元,且由MSB至LSB依序為第三十一位元至第零位元,該第二指令的該第零位元為一個記憶體空間指示,該第二指令的該第二位元及該第一位元的邏輯值為該規格資料,當該第二指令的該第二位元及該第一位元為邏輯值00時,該擴充裝置支援32位元的格式,當該第二指令的該第二位元及該第一位元為邏輯值10時,該擴充裝置支援64位元的格式,該基本輸入輸出系統將該第零位元為邏輯值0的每一個第二指令的該第三十一位元至該第四位元的邏輯值所對應的一個數值相加,而獲得該記憶體需求資料,在步驟(c)中,該上限值是四十億位元組(4Giga Byte;4GB)。 The method for configuring a memory resource according to claim 4, wherein, in the step (b), the first instruction is 0xFFFFFFFF, each second instruction includes 32 bits, and the MSB to the LSB are sequentially The thirty-oneth to the zeroth bit, the zeroth bit of the second instruction is a memory space indication, and the second bit of the second instruction and the logical value of the first bit are the specification Data, when the second bit of the second instruction and the first bit are logic value 00, the expansion device supports a 32-bit format, when the second bit of the second instruction and the first When the bit is a logical value of 10, the expansion device supports a 64-bit format, and the basic input/output system sets the zeroth bit to the third eleventh bit of each second instruction of the logical value 0 to the first The value corresponding to the logical value of the four bits is added to obtain the memory requirement data. In the step (c), the upper limit is four billion bytes (4 Giga Byte; 4 GB). 如請求項3所述的記憶體資源的配置方法,其中,在步驟(c)中,該基本輸入輸出系統分別依照指示支援32位元的該等擴充裝置的該等規格資料及該等記憶體需求資料,將對應一個上限值以下的記憶體位址的記憶體容量分配給該等擴充裝置,並分別依照指示支援64位元的該等擴充裝置的該等規格資料及該等記憶體需求資料,將對應該上限值以上的記憶體位址的記憶體容 量分配給該等擴充裝置。 The method for configuring a memory resource according to claim 3, wherein, in the step (c), the basic input/output system respectively supports the specification data and the memory of the expansion device supporting 32 bits. The demand data, the memory capacity corresponding to a memory address below the upper limit value is allocated to the expansion devices, and the specification data and the memory requirement data of the expansion devices supporting the 64-bit device are respectively instructed according to the instructions. Will remember the memory address of the memory address above the upper limit The amount is allocated to the expansion devices. 如請求項6所述的記憶體資源的配置方法,還包含在步驟(c)之後的下列步驟:(d)藉由該基本輸入輸出系統判斷該等插槽之其中另一者是否設置有另一個擴充裝置;及(e)當在步驟(d)中,該基本輸入輸出系統判斷該等插槽之其中另一者有另一個擴充裝置時,再重新執行步驟(b)~(d),直到在步驟(d)中,該基本輸入輸出系統判斷該等插槽之其中另一者沒有另一個擴充裝置。 The method for configuring a memory resource according to claim 6, further comprising the following steps after the step (c): (d) determining, by the basic input/output system, whether the other one of the slots is set to another An expansion device; and (e) when in step (d), the basic input/output system determines that the other of the slots has another expansion device, and then performs steps (b) to (d) again, Until in step (d), the basic input output system determines that the other of the slots does not have another expansion device. 如請求項7所述的記憶體資源的配置方法,其中,在步驟(b)中,該第一指令為0xFFFFFFFF,每一個第二指令包括32個位元,且由MSB至LSB依序為第三十一位元至第零位元,該第二指令的第零位元為一個記憶體空間指示,該第二指令的該第二位元及該第一位元的邏輯值為該規格資料,當該第二指令的該第二位元及該第一位元為邏輯值00時,該擴充裝置支援32位元的格式,當該第二指令的該第二位元及該第一位元為邏輯值10時,該擴充裝置支援64位元的格式,該基本輸入輸出系統將該第零位元為邏輯值0的每一個第二指令的該第三十一位元至該第四位元的邏輯值所對應的一個數值相加,而獲得該記憶體需求資料,在步驟(c)中,該上限值是四十億位元組(4Giga Byte;4GB)。 The method for configuring a memory resource according to claim 7, wherein in the step (b), the first instruction is 0xFFFFFFFF, each second instruction includes 32 bits, and the MSB to the LSB are sequentially The thirty-oneth to the zeroth bit, the zeroth bit of the second instruction is a memory space indication, and the second bit of the second instruction and the logical value of the first bit are the specification data. When the second bit of the second instruction and the first bit are logic value 00, the expansion device supports a 32-bit format, when the second bit of the second instruction and the first bit When the element is a logical value of 10, the expansion device supports a 64-bit format, and the basic input/output system sets the zeroth bit to the third eleventh of each second instruction of the logical value 0 to the fourth The value corresponding to the logical value of the bit is added to obtain the memory requirement data. In the step (c), the upper limit is 4 billion bytes (4Giga) Byte; 4GB).
TW104142975A 2015-12-21 2015-12-21 Method for allocating memory resource TWI561986B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW104142975A TWI561986B (en) 2015-12-21 2015-12-21 Method for allocating memory resource

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW104142975A TWI561986B (en) 2015-12-21 2015-12-21 Method for allocating memory resource

Publications (2)

Publication Number Publication Date
TWI561986B TWI561986B (en) 2016-12-11
TW201723849A true TW201723849A (en) 2017-07-01

Family

ID=58227310

Family Applications (1)

Application Number Title Priority Date Filing Date
TW104142975A TWI561986B (en) 2015-12-21 2015-12-21 Method for allocating memory resource

Country Status (1)

Country Link
TW (1) TWI561986B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6898686B1 (en) * 2000-08-24 2005-05-24 International Business Machines Corporation Memory map adjustment to support the need of adapters with large memory requirements
US7565398B2 (en) * 2002-06-27 2009-07-21 International Business Machines Corporation Procedure for dynamic reconfiguration of resources of logical partitions
US8117350B2 (en) * 2009-11-03 2012-02-14 Oracle America, Inc. Configuration space compaction
US9940291B2 (en) * 2013-01-29 2018-04-10 Hewlett Packard Enterprise Development Lp Assigning processors to memory mapped configuration

Also Published As

Publication number Publication date
TWI561986B (en) 2016-12-11

Similar Documents

Publication Publication Date Title
US9690739B2 (en) Method and apparatus for extending PCIe domain
US8751713B2 (en) Executing virtual functions using memory-based data in a PCI express SR-IOV and MR-IOV environment
US9531668B2 (en) Micro server, method of allocating MAC address, and computer readable recording medium
US9423958B2 (en) System and method for managing expansion read-only memory and management host thereof
TW200912755A (en) Method and system for dynamically reconfiguring PCIe-CardBus controllers
CN107180001B (en) Method and bus for accessing Dynamic Random Access Memory (DRAM)
TWI439869B (en) Method for adjusting link speed and computer system
TWI569147B (en) Apparatus, system and method for allocating identifiers to components of a control system
WO2020206879A1 (en) Method and device for automatically adapting link width of pcie port, electronic apparatus and storage medium
WO2016000475A1 (en) Resource allocating method and apparatus related thereto
CN107102952B (en) Memory resource allocation method
US11144305B2 (en) Method for updating IC firmware
CN112347012B (en) NVMe controller and method supporting SR-IOV
CN106648878B (en) System and method for dynamically allocating MMIO resources
CN111177046B (en) Method and device for multi-bus device fusion access
TW201723849A (en) Method for allocating memory resource
CN116346781B (en) Address space allocation method, server, electronic equipment and storage medium
TWI767266B (en) Automatic memory allocation method based on memory mapped input and output
US8219736B2 (en) Method and apparatus for a data bridge in a computer system
US6622196B1 (en) Method of controlling semiconductor memory device having memory areas with different capacities
US20120124323A1 (en) Method for setting memory address space
JP4854050B2 (en) Node control device, control method for node control device, information processing system, and computer program
JP4291368B2 (en) Memory bus check procedure
TWI615720B (en) Resource allocation system, apparatus allocation controller, and apparatus recognizing method
CN107688494B (en) Memory allocation method and device