📄 sdramopt.asm
字号:
and eax,01b ; insure only bits we need
shl eax,5 ; shift to proper position
or edx,eax ; or in to saved value
;X-bus round robin
mov cx,TOKEN_SDRAM_XBUSARB
call GetNVRAMValue
and eax,01b ; insure only bits we need
shl eax,5 ; shift to proper position
or edx,eax ; or in to saved value
; mem_ctrl1 set now write it
mov eax, CPU_MC_MEM_CNTRL1
call CpuMemRegWriteStack
; now do mem_ctrl2
mov eax, CPU_MC_MEM_CNTRL2
call CpuMemRegReadStack
and edx, SDCLK_SHIFT_CLR AND 011b ; clear the shift value& rd, fstrdmsk
;SSHFTSDCLK
mov cx,TOKEN_SDRAM_SHIFT
call GetNVRAMValue
and eax,0111b ; insure only bits we need
shl eax,3 ; shift to proper position
or edx,eax ; or in to saved value
;Read data phase
mov cx,TOKEN_SDRAM_RD
call GetNVRAMValue
and eax,01b ; insure only bits we need
shl eax,1 ; shift to proper position
or edx,eax ; or in to saved value
;X-bus round ro
mov cx,TOKEN_SDRAM_FSTRDMSK
call GetNVRAMValue
and eax,01b ; insure only bits we need
or edx,eax ; or in to saved value
; write mem_ctl2
mov eax, CPU_MC_MEM_CNTRL2
call CpuMemRegWriteStack ; write new shift value
; now MC_SYNC_TIM1
mov eax, CPU_MC_SYNC_TIM1
call CpuMemRegReadStack
mov ecx, DWORD PTR cs:[si+8]
AND edx, 08008888Fh ; clear what we change
;CAS Latency
mov cx,TOKEN_CAS_LATENCY
call GetNVRAMValue
and eax,0111b ; insure only bits we need
shl eax,28 ; shift to proper position
or edx,eax ; or in to saved value
;tRC
mov cx,TOKEN_MEM_TRC
call GetNVRAMValue
and eax,01111b ; insure only bits we need
shl eax,24 ; shift to proper position
or edx,eax ; or in to saved value
;tRAS
mov cx,TOKEN_MEM_TRAS
call GetNVRAMValue
and eax,01111b ; insure only bits we need
shl eax,20 ; shift to proper position
or edx,eax ; or in to saved value
;tRP
mov cx,TOKEN_MEM_TRP
call GetNVRAMValue
and eax,0111b ; insure only bits we need
shl eax,16 ; shift to proper position
or edx,eax ; or in to saved value
;tRCD
mov cx,TOKEN_MEM_TRCD
call GetNVRAMValue
and eax,0111b ; insure only bits we need
shl eax,12 ; shift to proper position
or edx,eax ; or in to saved value
;tRRD
mov cx,TOKEN_MEM_TRRD
call GetNVRAMValue
and eax,0111b ; insure only bits we need
shl eax,8 ; shift to proper position
or edx,eax ; or in to saved value
;tDPL
mov cx,TOKEN_MEM_TDPL
call GetNVRAMValue
and eax,0111b ; insure only bits we need
shl eax,4 ; shift to proper position
or edx,eax ; or in to saved value
; write MC_SYNC_TIM1
mov eax, CPU_MC_SYNC_TIM1
call CpuMemRegWriteStack ; write new shift value
; transition start clock
mov eax, CPU_MC_MEM_CNTRL1 ; must transistion start sdclk for
call CpuMemRegReadStack ; new values to take effect
push edx ; save mem_cntrl1 value as enabledimm trashes bit 13
NOSTACK si, CpuEnableDimm ; enable the DIMM as we set cas
pop edx ; get saved mem_cntrl1 value
mov eax, CPU_MC_MEM_CNTRL1 ;
and edx, SDCLK_START_CLR ; must transistion start sdclk for
call CpuMemRegWriteStack ; new values to take effect
or edx, SDCLK_START_SET
call CpuMemRegWriteStack
exit_manual:
pop bx
jmp bx
memRAMoptimize ENDP
;**************************************************************************
;*
;* pc66orPc100
;*
;* Entry:
;* Exit:
;* Destroys:
;*
;**************************************************************************
pc66orPc100 PROC NEAR
mov bp,MEM_ACCESS_BUS ; memory devices are on this access bus
call csInitI2CStack ; set direction of GPIO clk
xor dx, dx
xor cx, cx
push cx
push edx
mov eax, CPU_MC_BANK_CFG
call CpuMemRegReadStack
mov ax, dx
pop edx
pop cx
and ax, 070h
cmp ax, 070h
je checkForDimm1SPD
or dl, 01h
checkForDimm0EESPD:
push cx
push dx
mov bx, 0
mov bl, cs:DimmEEPROMAddr[bx] ; array of EEPROM address
shl bl, 1
or bl, 0A0h
mov cx, 126 ; PC100-PC66 identifier
call csGetSPDByte ; read value is in bx
pop dx
pop cx
mov cl, bl ; save Dimm0 PC-speed
jc checkForDimm1SPD
or dl, 02h
mov cl, bl ; save Dimm0 PC-speed
checkForDimm1SPD:
push cx
push edx
mov eax, CPU_MC_BANK_CFG
call CpuMemRegReadStack
shr edx, 16
mov ax, dx
pop edx
pop cx
and ax, 070h
cmp ax, 070h
je verifySPD
or dl, 04h
push cx
push dx
mov bx, 1
mov bl, cs:DimmEEPROMAddr[bx] ; array of EEPROM address
shl bl, 1
or bl, 0A0h
mov cx, 126 ; PC100-66 identifier
call csGetSPDByte ; read value is in bx
pop dx
pop cx
mov ch, bl ; Save Dimm1 PC-Speed
jc verifySPD
or dl, 08h
mov ch, bl ; Save Dimm1 PC-Speed
verifySPD:
mov al, 0
and dl, 0Fh
cmp dl, 03h ; Dimm0 with EEPROM / no Dimm1
je FoundPC
cmp dl, 0Ch ; no Dimm0 / Dimm1 with EEPROM
je FoundPC
cmp dl, 0Fh ; Dimm0 with EEPROM/ Dimm1 with EEPROM
jne NoPc
FoundPC:
add cl, ch
cmp cl, 200 ; 200 total? Got two PC-100 dimms
je FoundPc100
cmp cl, 100
jne NoPc ; Found something but not pc100
; Otherwise, we're golden
FoundPc100:
mov al, 064h
NoPc:
ret
pc66orPc100 ENDP
;**************************************************************************
;*
;* ckPC133
;*
;* Entry:
;* Exit:
;* Destroys:
;*
;**************************************************************************
ckPC133 PROC NEAR
mov bp,MEM_ACCESS_BUS ; memory devices are on this access bus
call csInitI2CStack ; set direction of GPIO clk
xor dx, dx
xor cx, cx
push cx
push edx
mov eax, CPU_MC_BANK_CFG
call CpuMemRegReadStack
mov ax, dx
pop edx
pop cx
and ax, 070h
cmp ax, 070h
je checkForDimm1SPD133
or dl, 01h
checkForDimm0EESPD133:
push cx
push dx
mov bx, 0
mov bl, cs:DimmEEPROMAddr[bx] ; array of EEPROM address
shl bl, 1
or bl, 0A0h
mov cx, 09h ; PC133 identifier
call csGetSPDByte ; read value is in bx
pop dx
pop cx
mov cl, bl ; save Dimm0 PC-speed
jc checkForDimm1SPD133
or dl, 02h
mov cl, bl ; save Dimm0 PC-speed
checkForDimm1SPD133:
push cx
push edx
mov eax, CPU_MC_BANK_CFG
call CpuMemRegReadStack
shr edx, 16
mov ax, dx
pop edx
pop cx
and ax, 070h
cmp ax, 070h
je verifySPD133
or dl, 04h
push cx
push dx
mov bx, 1
mov bl, cs:DimmEEPROMAddr[bx] ; array of EEPROM address
shl bl, 1
or bl, 0A0h
mov cx, 09h ; PC133 identifier
call csGetSPDByte ; read value is in bx
pop dx
pop cx
mov ch, bl ; Save Dimm1 PC-Speed
jc verifySPD133
or dl, 08h
mov ch, bl ; Save Dimm1 PC-Speed
verifySPD133:
mov al, 0
and dl, 0Fh
cmp dl, 03h ; Dimm0 with EEPROM / no Dimm1
je FoundPC133
cmp dl, 0Ch ; no Dimm0 / Dimm1 with EEPROM
je FoundPC133
cmp dl, 0Fh ; Dimm0 with EEPROM/ Dimm1 with EEPROM
jne NoPc133
FoundPC133:
add cl, ch
cmp cl, 0EAh ; 200 total? Got two PC-100 dimms
je DonePc133
cmp cl, 075h
jne NoPc133 ; Found something but not pc100
; Otherwise, we're golden
DonePc133:
mov al, 075h
NoPc133:
ret
ckPC133 ENDP
_TEXT ENDS
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -