[OpenBIOS] code for starting up 440gx memory

Ronald G. Minnich rminnich at lanl.gov
Tue Feb 15 15:26:25 CET 2000


here we go. 

caveats: this was generated by a script, using a linux system, to dump
register values. Except for register 76, which was done from the
programming manuals. 

I need to get a macro in here, I know. If you find this useless let me
know and I'll try to do the macro. 

here goes. 

First, though: 
1) set reg 76 to 30 (power + nop), delay 200 us
2) set up the other regs
3) set up reg 76 to 50, then the other values as shown.


generic_init: PORT_80 0xd0
; now the fun begins.
; turn on the dram and wait a while (this from the intel book)
        mov dx, 0xcf8
        mov eax, 0x80000074
        out dx, eax
        mov dx, 0xcfe
; turn power and and set the nop bit too.
        mov al, 0x30
        out dx, al
; delay 200 us
        mov ecx, 0x20000
.loop:  loop .loop
; First, set registers we can set once to reasonable values
; note -- this code auto-generated ...
; note -- we need to grab the nice macro from the other chipset file.
; set it for sdram, 31 microsecond refresh (? ok? )
; should we be doing this just yet? who knows?
        mov dx, 0xcf8
        mov eax, 0x80000054
        out dx, eax
        mov dx, 0xcff
        mov al, 0x12
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000058
        out dx, eax
        mov dx, 0xcfd
        mov al, 0x0
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000060
        out dx, eax
        mov dx, 0xcfc
        mov al, 0x10
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000060
        out dx, eax
        mov dx, 0xcfd
        mov al, 0x20
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000060
        out dx, eax
        mov dx, 0xcfe
        mov al, 0x30
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000060
        out dx, eax
        mov dx, 0xcff
        mov al, 0x40
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000064
        out dx, eax
        mov dx, 0xcfc
        mov al, 0x50
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000064
        out dx, eax
        mov dx, 0xcfd
        mov al, 0x60
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000064
        out dx, eax
        mov dx, 0xcfe
        mov al, 0x70
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000064
        out dx, eax
        mov dx, 0xcff
        mov al, 0x80
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000068
        out dx, eax
        mov dx, 0xcfd
        mov al, 0x0
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000068
        out dx, eax
        mov dx, 0xcfe
        mov al, 0x0
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000068
        out dx, eax
        mov dx, 0xcff
        mov al, 0x0
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x8000006c
        mov dx, 0xcfc
        mov al, 0x0
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x8000006c
        out dx, eax
        mov dx, 0xcfd
        mov al, 0x0
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x8000006c
        out dx, eax
        mov dx, 0xcfe
        mov al, 0x0
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000074
        out dx, eax
        mov dx, 0xcfc
        mov al, 0x22
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000074
        out dx, eax
        mov dx, 0xcfd
        mov al, 0x22
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000078
        out dx, eax
        mov dx, 0xcfc
        mov al, 0x7
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x80000078
        out dx, eax
        mov dx, 0xcfd
        mov al, 0x55
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x800000c8
        out dx, eax
        mov dx, 0xcfe
        mov al, 0x0
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x800000c8
        out dx, eax
        mov dx, 0xcff
        mov al, 0x0
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x800000c8
        out dx, eax
        mov dx, 0xcff
        mov al, 0x0
        out dx, al
        mov dx, 0xcf8
        mov eax, 0x800000cc
        out dx, eax
        mov dx, 0xcfc
        mov al, 0x1e
        out dx, al
; standard init of sdram at this point:
; it is on and the bridge is configured for 256M dimms.
; now we have to do a precharge all (see the pc100 sdram book
        mov dx, 0xcf8
        mov eax, 0x80000074
        out dx, eax
; now we stick to reg 76, so no more of that
        mov dx, 0xcfe
; we're going to use es to ref dram
        xor     eax, eax
        mov     es, eax
; do the nop cycle
        mov eax, [es:0x400]
; now we have to kick the dram to do this? so what, I guess we hit it,
; but we're not in bigreal, wonder what will happen. Just to bank 0 for
; now. A10 has to be high. (pc100 sdram book)
; this should be a Precharge all
        mov al, 0x50
        out dx, al
; meaningless delay
        PORT_80 0xdf
        mov [es:0x400], eax
; now we do the eight CBRs
        mov al, 0x90
        out dx, al
        PORT_80 0xdf
        mov eax, [es:0x400]
        mov eax, [es:0x400]
        mov eax, [es:0x400]
        mov eax, [es:0x400]
        mov eax, [es:0x400]
        mov eax, [es:0x400]
        mov eax, [es:0x400]
        mov eax, [es:0x400]
; now a mode register set
        mov al, 0x70
        out dx, al
        PORT_80 0xdf
; we have to do a memory reference that sets things up.
; ok -- we go with burst length 4 (?) wrap type 0, ltmode 3
; ltmod 3 matches the other mode in the bridge. This is slow,
; we fix later if possible
; now we reference the dram to issue the mrs
        mov eax, 0x32
        mov [es:0x00], eax
; well, maybe it is working now.

              mov ax, cs
              mov ss, ax
              mov sp, .stack


---------------------


anyways, i can store and load, but I'm only seeing an 8-byte memory.

ron

-
To unsubscribe: send mail to majordomo at freiburg.linux.de
with 'unsubscribe openbios' in the body of the message



More information about the openbios mailing list