Smbus Utility 需要學會的大小事 :
一、 何謂 Smbus, Spd, DIMM, Clk generator
二、 如何確保Smbus 正常運作
三、 透過DIMM SPD 計算Memory Size
四、 透過 Smbus Controller 操作 Smbus 上的 Device
1. 讀、寫 (Byte, Block)
2. 了解 Smbus 上的狀態 ( Host Status Register , 0x3000 )
3. 如何知道 Slave Address 是空的
五. PCi to PCI bridge 的了解
1. Bridge 掌控的bus 範圍
2. Bridge 的 拓樸 (上、下層)
3. Bridge 底下掌控的I/O , Mem resource
4. Bridge control reg 和 secondery status reg 的功用
一、 何謂 SMBUS, SPD, DIMM, Clk generator
SMBUS
SMbus 最早是由 Intel 公司提出來的. 現在由 SBS 管理維護這一個規格. 此規格是用 Philips 的 I2C 簡化而來. SMbus 是由兩條訊號所組成的一種匯流排.
是為了在系統上較慢速的裝置及電源管理裝置之間的溝通使用. 使系統可取得這些裝置的製造廠商,型號,一些控制資訊,錯誤訊息及狀態.
這兩條訊號為 SMBCLK 和 SMBDATA. 這和 I2C 上的 Clock(SCL) 和 Data(SDA) 是一樣的.
SPD
存在SPD是Serial Presence Detect的縮寫,中文意思是模組存在的串列檢測。也即是通過上面講的I2C串列介面的EEPROM堆記憶體插槽中的模組存在的資訊檢查。這樣的話,模組有關的資訊都必須紀錄在EEPROM中。習慣的,我們把這顆EEPROM IC就稱為SPD了。以往開機時BIOS必須偵測memory,但有了SPD就不必再去作偵測的動作,而由BIOS直接讀取 SPD取得記憶體的相關資料。那我們來看看事物的SPD吧,先看我們的SPD位於記憶體的哪個部位,比如說圖1中紅線框住的地方就是SPD。然後我們再放大來看看我們的SPD,比如說其他記憶體上的SPD放大圖見圖2.
DIMM
A DIMM or dual in-line memory module, comprises a series of dynamic random-access memory integrated circuits. These modules are mounted on a printed circuit board and designed for use in personal computers, workstations and servers.
Clk Generator
The clock generator in a motherboard is often changed by computer enthusiasts to control the speed of their CPU, FSB, GPU and RAM. Typically the programmable clock generator is set by the BIOS at boot time to the selected value; although some systems have dynamic frequency scaling, which frequently re-programs the clock generator.
二、 如何確保Smbus 正常運作
有三件事情需要確認
1. Check Smbus I/O Address D31:F3:Reg 20h
2. Check I/O Space Enable D31:F3:Reg 04h[0]
3. Check SMBus Host Enable D31:F3:Reg 40h[0]
=> 0 = Disable the SMBus Host controller.
1 = Enable.
三、透過DIMM SPD 計算Memory Size
有兩種方式
1. Total Memory Size = Rank Density(0x1F) * Rank(0x05 Bit[2:0] + 1)
2. 透過 Row, Column, Bank, Rank, Data width 計算
ex: Row = 14, Column = 10, Bank = 4, Rank = 1, Data width = 64bits
Total Memory size = (2^14) * (2^10) * (2^2) * (1) * (2^6) = 512MB
SPD 補充
四大時序值
記憶體有非常多的時序值,而像3-3-3-10這種達文西密碼,就是標示出記憶體最重要的四個時序值,意義如下:
一般記憶體的時序值,通常會標示成這樣的四個數字,每個數字都代表一種時序延遲。
1.tCAS(Column Address Select):列位址送出,到資料取得之間的時間。 (offset : 0x12)
2.tRCD(RAS to CAS Delay):送出行位址之後,到送出列位址之間的時間。 (offset : 0x1D)
3.tRP(RAS Precharge):關閉一行,到重新啟動另一行之間的時間。 (offset : 0x1B)
4.tRAS(Row Address Select):啟動一行需要的時間。 (offset : 0x1E)
其中tCAS就是CAS Latency(CAS延遲),簡稱CL值, 這是記憶體最最重要的時序值,很多玩家或廠商甚至只提記憶體的時脈和CL值。雖然存取記憶體需要啟動「行」和「列」,
但某一行被啟動之後,該行所有的資料 都可以被存取,因此tRAS頗重要,但多次下來CL值會最重要,因為同一行的資料通常都是CPU所需的,而CL值是每次抓列裡面的資料都會產生的延遲,
累積下來相當於是CPU對記憶體的讀取延遲,非常非常重要。
五. PCi to PCI bridge 的了解
1. Bridge 掌控的bus 範圍
Bus range : Secondary bus # 到 Subordinate Bus #
2. Bridge 的 拓樸 (上、下層)
Primary bus : 0
Secondary bus : 1
Subordinate bus : 3
3. Bridge 底下掌控的I/O , Mem resource
I/O
假設 I/O base : 0x20
I/O limit : 0x30
把兩個的最高4 bits 取出,然後因為 4 kb alignment
範圍從 0x2000 ~ 0x3FFF
Mem
假設 mem base : 0x1000
mem limit : 0x2000
把兩個的最高12 bits 取出,然後因為 1 mb alignment
範圍從 0x100 00000 ~ 0x200 FFFFF
4. Secondery status reg 和 Bridge control reg 的功用
Secondery status reg

(2). 那它就是用來控制SECONDARY INTERFACE的行為
INTR — R/WC. This bit can only be set by termination of a command. INTR is not
dependent on the INTREN bit (offset SMBASE + 02h, bit 0) of the Host controller
register (offset 02h). It is only dependent on the termination of the command. If the
INTREN bit is not set, then the INTR bit will be set, although the interrupt will not be
generated. Software can poll the INTR bit in this non-interrupt case.
0 = Software clears this bit by writing a 1 to it. The ICH10 then deasserts the interrupt
or SMI#.
1 = The source of the interrupt or SMI# was the successful completion of its last
command.
0 = Disable.
1 = Enable the generation of an interrupt or SMI# upon the completion of the
command.
1 = Software sets this bit to indicate that the next byte will be the last byte to be
received for the block. This causes the ICH10 to send a NACK (instead of an ACK)
after receiving the last byte.
NOTE: Once the SECOND_TO_STS bit in TCO2_STS register (D31:F0, TCOBASE+6h,
bit 1) is set, the LAST_BYTE bit also gets set. While the SECOND_TO_STS bit is
set, the LAST_BYTE bit cannot be cleared. This prevents the ICH10 from
running some of the SMBus commands (Block Read/Write, I2C Read, Block I2C Write).