Intel ICH9 Memory SPD读取
根据bios代码写了个SPD读取,就是不出结果,每次调试输出host status register都是FF,代码基本和bios一样,机器也是ICH9的机器,代码如下:.model small
.386
CFG_ADDR EQU 0CF8h
CFG_DATA EQU 0CFCh
SMBUS_BUS EQU 0
SMBUS_DEVICE EQU 31
SMBUS_FUNC EQU 3
.stack 100h
.data
base dw ?;smbus I/O space
numdb 0;byte select
SmbStatus db ?
.code
LF_CR MACRO
pusha
mov dl,0dh
mov ah,2
int 21h
mov dl,0ah ;next line
mov ah,2
int 21h
popa
ENDM
main proc far
mov ax,@data
mov ds,ax
mov eax,8000FB20h ;Bus 0,Device 32,Function 3,20h
mov dx,CFG_ADDR
out dx,eax
mov dx,CFG_DATA
in eax,dx
shr ax,5 ;bit 15-5,the base address
and ax,0000011111111111b
mov base,ax
call ReadSpd
exit:
mov ax,4c00h
int 21h
main endp
ReadSpd proc
pusha
Again:
mov ah,num
and ah,00001111b
.if(ah==15d) ;CR_LF
LF_CR
.endif
.repeat
mov dx,base ;reset host,claim host in use
add dx,0
mov al,40h
out dx,al
mov dx,base
in al,dx
mov SmbStatus,al
mov dx,base ;clear all status bits
mov al,1Eh ;host status register
out dx,al
mov dx,base ;set offset to read
add dx,3 ;host command register
mov al,num
out dx,al
mov dx,base ;Transimit Slave Address register
add dx,4
mov al,0a1h
out dx,al
mov dx,base ;set "Read Word" protocol and start bit
add dx,2 ;Host Control register
mov al,48h
out dx,al
mov dx,base
in al,dx
mov SmbStatus,al
and al,1Eh
.while (al==0) ;check repeatly until any of
mov dx,base ;FAIL,BERR,DERR,INTR
in al,dx
mov SmbStatus,al
and al,1Eh
.ENDW
mov al,SmbStatus
and al,1Ch
.if (al!=0) ;check for errors
mov al,SmbStatus
and al,08h
.continue .if (al!=0)
jmp @F
.else
mov dx,base
add dx,5h
in al,dx
call binhex
.break
.endif
.until (0)
mov dl,20h ;output a space
mov ah,2
pusha
int 21h
popa
inc num
cmp num,80h ;get first spd 128 bytes
jnz Again
@@:
popa
ret
ReadSpd endp
binhex proc
pusha
mov ch,2 ;2 hexadecimal digits to be printed
loop3:
mov cl,4 ;bits to be shifted
rol al,cl
mov bl,al
and bl,0fh ;mask the 4-bit Msb
add bl,30h
cmp bl,3ah
jl next1;number or alpha?
add bl,7
next1:
mov ah,2;print one hexadecimal digit
mov dl,bl
pusha
int 21h
popa
dec ch
jnz loop3
popa
ret
binhex endp
end main 问题已解决 我做过一个可以支持SIS968/962/961 VIA8235 Intel ICHx/ICH7/8/9 ATI SB400/600 NV CK804的SPD tool.ICH9的读法应该是和ICH7/8一致的:)
页:
[1]