Memory SPD (Serial Presence Detect),记录了一些内存底层信息,如频率,大小,内存内型,内存标示号...等.测试软件SiSoft Sandra Professional中有一个spdinfo.exe,可以查看SPD的内容。本人用soft-ice
跟踪SPDINFO。EXE,发现它是从I/O端口0XC05,0XC06返回SPD内容,又得知IC2 控制芯片用SMBus接口S来管理MEMORY SP,查看Windows98的系统信息,0xc00-0xc0f分一组.而SMBUS只有4种信号,觉的可能每种信号对应二个I/O端口.于是编程向 0xc03,0xc04发送一组数据.发现当向I/O端口0XC04发送0XA1时,I/O端口0xc05返回一个有效值.但和SPDINFO.EXE返 回的数值不同.
It 's difficult to read spd of memory.
The Following asm Example is to show the spd of memory,
But Your pc 's south bridge should be Intel PIIx4.
So, The following is just for you to conference,
In a word , You should follow the 8 steps to read spd.
Test successful On My machine (Notebook)
;***********************************
;function: read spd from DRAM
;spec: PIIX4.pdf 150
;***********************************
.model small
include myhead.asm
.data
pro0 db 'The spd of dram0:$ '
pro1 db 'The spd of dram1:$ '
pro2 db '00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15$ '
base dw ?
num db ?
temp db ?
tag db ?
.code
assume cs:@code,ds:@data
.startup
.386
mov ax,@data
mov ds,ax
mov tag,0
mov eax,80000060h
mov dx,0cf8h
out dx,eax
mov dx,0cfch
in ax,dx
cmp ax,0000h
jz m2
m1:
mov ax,1000h ;power base address
add ax,34h
mov dx,ax
in al,dx
and al,0f3h
out dx,al
PROMPT pro0
mov tag,1
call readspd
crlf
m2:
cmp tag,0
jz read2
mov eax,80000060h
mov dx,0cf8h
out dx,eax
mov dx,0cfeh
in ax,dx
cmp ah,al
jnz read2
.exit
read2:
mov ax,1000h
add ax,34h
mov dx,ax
in al,dx
and al,0f3h
or al,04h
out dx,al
mov tag,0
PROMPT pro1
call readspd
.exit
readspd proc near
mov eax,80003b90h ;dev#=7 fun# =3 bus#=0 address offset:=90h
mov dx,0cf8h
out dx,eax
mov dx,0cfch
in ax,dx
and ax,1111111111110000b
mov base,ax
;ax=1040h
crlf
mov num,0
mov temp,0
mov ax,base
again:
;STEP 1 ***************Specify the byte# of SMBus device--SMBHSTCMD
mov dx,base
add dx,03h ;SMBHSTCMD address
mov al,num
out dx,al ;0-7fh
;STEP 2 ***************Set address of SMBus device--SMBHSTADD
mov dx,base
add dx,04h ;SMBHSTADD address
mov al,0a1h ;read
out dx,al
;STEP 3 ***************Set R/W protocol--SMBHSTCNT
mov dx,base
add dx,02h ;SMBHSTADD address
in al,dx
and al,0e3h
or al,08h
out dx,al
;STEP 4 ***************Clear the host status register--SMBHSTSTS
mov dx,base
add dx,0h ;SMBHSTSTS address
and al,0e0h
or al,1fh
out dx,al
;STEP 5 ***************Clear the slave status register--SMBSLVSTS
mov dx,base
add dx,1h ;SMBSLVSTS address
in al,dx
or al,3ch
out dx,al
;STEP 6 ***************Start the SMBus command--SMBHSTCNT
mov dx,base
add dx,2h ;SMBSLVSTS address
in al,dx
or al,40h
out dx,al
;STEP 7 ***************Wait for INT assert--SMBHSTSTS
mov dx,base
add dx,0h ;SMBSLVSTS address
waitint:
in al,dx
; test al,04h
; jnz changebank
and al,02h
jz waitint
;STEP 8 ***************Get the desired data--SMBHSTDATA0
mov dx,base
add dx,5h ;SMBSLVSTS address
in al,dx
printal al
SHOWCHAR 20H
inc num
inc temp
cmp num,080h
jz readspd_exit
cmp temp,16
jnz k1
mov temp,0
CRLF
k1:
jmp again
readspd_exit:
ret
readspd endp
;*******************read error--changebank
quit:
.exit
end