⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oempost.asm

📁 <BIOS研发技术剖析>书的源代码,包括完整的BIOS汇编语言源程序.
💻 ASM
📖 第 1 页 / 共 5 页
字号:
row_end:
       inc     bh
       cmp     bh,4                            ; 3 DIMM
        jnz     start_row

       mov     bx,di                           ; BL = Byte 3

check_dimm_done:

	mov	al,Q_SPREAD_SPECTRUM
	call	get_cmos_item
	mov	cl,00000000b		; Spread Spectrum Enabled (ICS)
	jz	short spread_function_disable
	mov	cl,00000010b		; Spread Spectrum Disabled (ICS)
	dec	al
	shl	al,7			; to position
	or	cl,al			; set it
spread_function_disable:

	mov	al,Q_FREQ_SELECT
	call	get_cmos_item
	jz	short hardware_select_freq
	or	cl,00001000b
hardware_select_freq:

	mov	al,Q_CPU_FREQ
	call	get_cmos_item
	cmp	al,8
	jb	short asyn_mode
	or	cl,00000100b
asyn_mode:
	and	al,not 08h
	shl	al,4
	or	cl,al

;; PaiLin debug {
;;      mov     al,Q_CLKGEN_PCI_DIMM
;;      call    get_cmos_item
;;      mov     ch,11111111b            ; Ch = Byte 2
;;      jz      slot3_done 
;       mov     ch,11111000b            ; PCICLK_F/PCI4/PCI3 Always used.
;;; Check PCI Slot use or not
;       mov     dx,0048h
;       call    read_pci_slot
;       jz      slot1_done
;       or      ch,00000001b
;slot1_done:
;       add     dl,10h
;       call    read_pci_slot
;       jz      slot2_done
;       or      ch,00000010b
;slot2_done:
;       add     dl,10h
;       call    read_pci_slot
;       jz      slot3_done
;       or      ch,00000100b
;slot3_done:
;; } PaiLin debug

;; Program ICS 9248-59

;Reset Host Status Register 
	mov	ax,0107h			; Clear Status High Byte
	call	write_smbus_reg
	mov	ax,00f0h			; Clear Status Low Byte
	call	write_smbus_reg

;Clock generator address = D2h 
	mov	ax,04d2h
	call	write_smbus_reg

;Command byte = 0
	mov	ax,0500h
	call	write_smbus_reg

;Number of bytes to program 
	mov	ax,0706h		;Data Count = 6 
	call	write_smbus_reg

	mov	al,cl			; Byte 0 
	mov	ah,08h
	call	write_smbus_reg

	mov	ax,09ffh		; Byte 1   
	call	write_smbus_reg

;	mov	al,ch			; Byte 2
	mov	al,0ffh			; always on
	mov	ah,0ah			; PCI Clock
	call	write_smbus_reg

	mov	al,bl			; SDRAM Clock
	mov	ah,0bh			; (Byte 3) 
	call	write_smbus_reg

	mov	al,bh			; SDRAM Clock
	mov	ah,0ch			; (Byte 4) 
	call	write_smbus_reg

	mov	ax,0dffh		; Byte 5
	call	write_smbus_reg

	mov	ax,021ah		; Start Block Write
	call	write_smbus_reg

	mov	cx,13333
	extrn	fixed_delay:near
	call	fixed_delay
~

;; PaiLin debug {
;; for system Fan
        mov     dx,MKF_LM78_BASE_ADDRESS
	mov	al,47h
	out	dx,al
	jmp	short $+2
	inc	dx
	in	al,dx
	jmp	short $+2
	or	al,030h
	jmp	short $+2
	out	dx,al
;; } PaiLin debug

        ret
COMMENT ~
read_pci_slot:
	push	dx
	xchg	dl,dh
	movzx	eax,dx
	bts	eax,31
	mov	dx,0cf8h
	out	dx,eax
	jcxz	short $+2
	mov	dl,0fch
	in	eax,dx
	inc	eax
	pop	dx
	ret
~

row2bankconvert label byte
        db      0,1,2,3         ; DIMM 0
        db      4,5,6,7         ; DIMM 1
        db      8,9,10,11       ; DIMM 2

write_smbus_reg proc near
;; Input:
;; AH = SMBus Register Index
;; AL = Write Value
;; Modified: None							       ;
	push	dx
	mov	dx,MKF_PM_BASE_ADDRESS+38h
	xchg	al,ah
	out	dx,al
	jcxz	short $+2
	jcxz	short $+2
	inc	dx
	xchg	al,ah
	out	dx,al
	pop	dx
	ret
write_smbus_reg endp
;-----------------------------------------------------------------------;
;                               BEFORE_VECTOR                           ;
;-----------------------------------------------------------------------;
; check_point           : 24                                            ;
; This routine ia called from RM.ASM and can be used for any init before;
; interrupt vector table is initialised by BIOS after base 64k memory   ;
; test is passed.                                                       ;
; input :                                                               ;
;       SS      0030H                                                   ;
;       DS      0040H                                                   ;
;       ES      0000H                                                   ;
;       stack   available                                               ;
; register usage : can destroy any register except EBP,DS,ES,FS,GS      ;
;-----------------------------------------------------------------------;
        extrn   cpu_freq:word
        extrn   cpu_freq_x100:word
	extrn	cpu_clock		:near
	extrn	CatProcPRating		:near
        extrn   rt_cmos_byte:byte
        public  before_vector
before_vector:

        cmp     cgroup:word ptr cpu_freq,0ffffh
        jnz     bv_00                   ; cpu clock already executed
IF      MKF_BUP6
        call    p6_cpu_clock            ; find P6 CPU clock
ELSE
        call    cpu_clock               ; find CPU clock
bv_01:
ENDIF
; AX = CPU clock in MHZ, BX = CPU Clock x 100 in MHz
        mov     cgroup:cpu_freq,ax
        mov     cgroup:cpu_freq_x100,bx
bv_00:
IFE      MKF_BUP6
; prepare string for display P-Rating  needed for CYRIX and AMD.
; this routine must be here before "RET"
	call	CatProcPRating
endif

        ret
	public	pci_irq_avail_table
pci_irq_avail_table	label byte
if	MKF_ITE8661
	db	Q_IT8661F_COMB_PORT , 3
	db	Q_IT8661F_LPT_PORT , 7
	db	Q_IT8661F_COMA_PORT , 4
	db	Q_IT8661F_FLOPPY_CONTROLLER , 6
endif
if	MKF_WIN877
	db	Q_WIN877_COMB_PORT , 3
	db	Q_WIN877_LPT_PORT , 7
	db	Q_WIN877_COMA_PORT , 4
	db	Q_WIN877_FLOPPY_CONTROLLER , 6
endif
;-----------------------------------------------------------------------;
;                       GET_POST_INFO                                   ;
;-----------------------------------------------------------------------;
;  check point  : 25                                                    ;
;  check point  : 87                                                    ;
;  this routine returns information about POST.                         ;
;  input :                                                              ;
;       none                                                            ;
;  output:                                                              ;
;       ax      POST information                                        ;
;               bit-0 = 0 normal                                        ;
;                       1 clear password                                ;
;               bit-1 = 0 normal                                        ;
;                       1 clear CMOS                                    ;
;               bit-2 = 0 enable setup                                  ;
;                       1 disable setup                                 ;
;               bit15-3..reserved for future use                        ;
;  register usage : do not destroy any register except AX               ;
;-----------------------------------------------------------------------;
        public  get_post_info
get_post_info:
        xor     ax,ax
        ret
;-----------------------------------------------------------------------;
;                               C000_CONTROL_BEFORE                     ;
;-----------------------------------------------------------------------;
; check_point           : 2B                                            ;
; This routine is called for any work before C000 ROM control in RM.ASM.;
; If DIM is present, then this routine will be called only if DIM can not
; initialise the Video ROM i.e. if DIM can initialise video ROM, this   ;
; routine will NOT be called.                                           ;
; If DIM is present, this routine will not be called because DIM will   ;
; initialise the video ROM.                                             ;
; input :                                                               ;
;       SS      0030H                                                   ;
;       DS      0040H                                                   ;
;       ES      0000H                                                   ;
;       stack   available                                               ;
; output :                                                              ;
;       (ZF)    1 -> no further control to C000 ROM                     ;
;               0 -> C000 ROM will get control                          ;
; register usage : can destroy any register except EBP,DS,ES,FS,GS      ;
; The following things can be done here:-                               ;
; 1.    You may want to bypass optional ROM control at C000:0..7FFF by  ;
;       setting (ZF) = 1.                                               ;
; 2.    You may have VIDEO ROM BIOS at  E000 segment, like most of the  ;
;       time Portable PC has this option and you do not want C000:0     ;
;       optional ROM control, you may give control to E000 segment      ;
;       at this point or in the next routine C000_CONTROL_AFTER.        ;
; 3.    You want to shadow C000 segment to E000 segment and give control;
;-----------------------------------------------------------------------;
        public  c000_control_before
c000_control_before:
        or      sp,sp                   ; (ZF) = 0, give control C000 ROM &
        ret                             ; C000_control_after else none.
;-----------------------------------------------------------------------;
;                               C000_CONTROL_AFTER                      ;
;-----------------------------------------------------------------------;
; check_point           : 2D                                            ;
; This routine is called for any special work after C000 ROM control in ;
; RM.ASM. this routine will always be called.                           ;
; input :                                                               ;
;       SS      0030H                                                   ;
;       DS      0040H                                                   ;
;       ES      0000H                                                   ;
;       stack   available                                               ;
; register usage : can destroy any register except EBP,DS,ES,FS,GS      ;
; The following things can be done here:-                               ;
; 1.    If you have E000 VIDEO ROM check for INT 10 vector, if any      ;
;       optional card already present or not, and depending on that you ;
;       may want to give coontrol to E000 VIDEO BIOS                    ;
;-----------------------------------------------------------------------;
        extrn   rt_cmos_byte:byte
        public  c000_control_after
c000_control_after:
	mov	ah,3eh
	call	read_bri_byte
	test	al,08h
	jnz	agp_present
	or	al,04h
	call	write_bri_byte
agp_present:
;; PaiLin debug {
	mov	ah,70h
	call	read_sio_byte
	out	90h,al
;; } PaiLin debug

	ret
;-----------------------------------------------------------------------;
;                         OEM_DO_MEMORY_SIZE                            ;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -