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

📄 oempost.asm

📁 <BIOS研发技术剖析>书的源代码,包括完整的BIOS汇编语言源程序.
💻 ASM
📖 第 1 页 / 共 5 页
字号:
        page    ,132
        title   OEM POST HOOKS
;-----------------------------------------------------------------------;
; This file is derived from POST.ASM and NPOST.ASM files.               ;
; ======================== NOTE === NOTE === NOTE ===================== ;
; If the routine name in this file starts with "OEM_", then this routine;
; is called from the corresponding generic chipset hook (in POST.ASM or ;
; NPOST.ASM file). For example, OEM_DO_MEMORY_SIZE routine is called    ;
; from DO_MEMORY_SIZE hook in POST.ASM file.                            ;
; ======================== NOTE === NOTE === NOTE ===================== ;
; If the routine name in this file does not start with "OEM_", then this;
; routine is called directly from Core file. For example, BEFORE_VECTOR ;
; is called from core file RM.ASM.                                      ;
;-----------------------------------------------------------------------;
; NOTE: Do not destroy EBP,FS,GS,SS,DS,ES unless otherwise specified.   ;
;-----------------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;**                                                             **;
;**     (C)Copyright 1985-1996, American Megatrends Inc.        **;
;**                                                             **;
;**                     All Rights Reserved.                    **;
;**                                                             **;
;**             6145-F, Northbelt Parkway, Norcross,            **;
;**                                                             **;
;**             Georgia - 30071, USA. Phone-(770)-246-8600.     **;
;**                                                             **;
;*****************************************************************;
;*****************************************************************;
;*****************************************************************;
; $Header: /BIOS/OEM/GENERIC/630/Intel/440BX/Desktop CR/OEMPORT/oempost.asm 4     9/19/97 3:43p Juand $
;
; $Revision: 4 $
;
; $Date: 9/19/97 3:43p $
;*****************************************************************;
;*****************************************************************;
; Revision History
; ----------------
; $Log: /BIOS/OEM/GENERIC/630/Intel/440BX/Desktop CR/OEMPORT/oempost.asm $
; 
; (CORE0228) James Tue 06-01-1999
; * DC.ASM + DEVINFO.ASM = module to create more room for POST+RUNTIME
; - dc_oem_arrangement is using equates instead of offset.
; - Any OEM routine used to display is put to
;   dc_oem_routines_table and the equate should start
;   from dc_oem_index_start.  See the example.
; - Must use display_dc_colon to display string "xxxx :" in OEM
;   display routine.
; see DC.ASM DC.EQU+ GS1.ASM PI.ASM PI.EQU JMP.ASM
;     ME5.ASM ME5.EQU+
;     DEVINFO.ASM OEMPOST.ASM
;     DC.MAK+ CORE.MAK BIOS.MAK OBJ.MAK
;
; (CORE0218) James Fri 02-26-1999
; Build event logs in buffer at LOG_BUFFER_SEG:0000 before
; running Setup.
;
; (CORE0206) James Tue 01-19-1999
; Added sc_items_table for customizing system configuration screen.
; You can add or arrange any item from that split screen.
;
; 4     9/19/97 3:43p Juand
; Added programming of Search DMA Resources in cp_init setup table.
;
; 3     9/18/97 7:09p Juand
;
; 2     9/16/97 11:23a Juand
; Enabled IRQ8# signal in PIIX4 reg B1h
;
; 1     9/15/97 5:57p Juand
;
; 1     9/11/97 6:41p Juand
;
; 1     6/05/97 12:43p Debkumar
;
; 5     5/20/97 5:03p Debkumar
; Beep is removed from CHANGE_DISPLAY_TO_OEM routine to make it silent.
;
; 4     3/14/97 9:52a Debkumar
; OEM_INIT_SILENT_BOOT, OEM_DYNAMIC_SILENT_BOOT_DISPLAY hooks are added
; to allow OEM to display any dynamic information durin OEM display mode.
;
; 3     3/12/97 4:01p Debkumar
; Hooks for Silent Boot added.
;
; 2     2/04/97 3:09p Debkumar
; GET_HD_STANDBY_VALUE routines for PM,PS,SM,SS moved to OEMRUN.ASM file
; from OEMPOST.ASM file.
;
; 1     1/31/97 1:15p Debkumar
; New files for 62700.
;
; 1     1/13/97 2:22p Debkumar
; New file for 6.27.00.
;
;*****************************************************************;
;---------------------------------------;
        include mbiosmac.mac
        include mbiosequ.equ
        include cf.equ
        include setupequ.ext
        include makeflag.equ
;---------------------------------------;
	include rt.equ
        include pci.equ
        include escd.equ
        include dim.equ
        include dim.dat
	include sis530.equ
;---------------------------------------;
        extrn   check_cmos_data:near
        extrn   check_cmos_8e:near
        extrn   disable_l1_cache:near
        extrn   enable_l1_cache:near
        extrn   cmos_data_in_x:near
        extrn   cmos_data_out_x:near

        extrn   get_cmos_item:near
	extrn	read_sio_byte:near
	extrn	write_sio_byte:near
	extrn	read_bri_byte:near
	extrn	write_bri_byte:near
	extrn	read_pci_byte:near
	extrn	write_pci_byte:near

;---------------------------------------;
cgroup  group   _text
_text   segment word    public  'CODE'
        assume  cs:cgroup
.486p
;---------------------------------------;
        public  _OEMPOST_STARTS
_OEMPOST_STARTS label   byte            ; marks start of module
;-----------------------------------------------------------------------;
;               THE HOOKS ARE IN ORDER OF EXECUTION                     ;
;-----------------------------------------------------------------------;
;                       INIT_AFTER_KB_BAT                               ;
;-----------------------------------------------------------------------;
; check_point           : 0E                                            ;
; This routine can be used if any special work involved after BAT command
; to 8042 keyboard controller is successful in RM.ASM. The special work ;
; can be many things. e.g. auto-sensing of external keyboard & mouse    ;
; mostly used in laptop, etc.                                           ;
; input:                                                                ;
;       DS      0000H                                                   ;
;       ES      0000H                                                   ;
;       stack   available                                               ;
; register usage -- can destroy any register except BP, DS, ES          ;
;-----------------------------------------------------------------------;
init_after_kb_bat       proc    near
if      MKF_KB_PS2_CONNECTOR_SWAP
        extrn   auto_detect_kb_ms:near
        call    auto_detect_kb_ms
endif
        ret
init_after_kb_bat       endp
;-----------------------------------------------------------------------;
;                         OEM_DETECT_L2_CACHE                           ;
;-----------------------------------------------------------------------;
; check_point           : 13                                            ;
; This routine is called from CP_INIT (POST.ASM) after chipset register ;
; initialization and L2 cache sizing is done.                           ;
; This routine can be used to override the result of L2 cache sizing    ;
; and testing done in CP_INIT. For example, if OEM motherboard always   ;
; has fixed L2 cache (e.g. 512K, as is the case with most Notebooks),   ;
; then L2 cache sizing code can be renoved (which will create some space;
; for some other thing) and L2 cache registers can be programmed with   ;
; fixed L2 cache size. Of course L2 cache testing must be done in either;
; case.                                                                 ;
; Note : Another way is not to do the L2 cache sizing and testing in    ;
;        POST.ASM. Do the L2 cache sizing/testing here according to the ;
;        requirement. In that case, the deafult code here must do the   ;
;        L2 cache sizing and testing. And then the deafult code can be  ;
;        modified according to OEM requirement.                         ;
; input :                                                               ;
;       DS      0000H                                                   ;
;       ES      0000H                                                   ;
;       stack   available                                               ;
; output:                                                               ;
;       BL      bit-0 = 0 cache is bad                                  ;
;                       1 cache is good                                 ;
;               bit7-1= MUST BE returned as 0                           ;
; register usage -- can destroy any register except EBP,DS,ES,FS,GS     ;
; Note: 1. this routine is called from at the end of CP_INIT in POST.ASM;
;       2. this routine should do cache sizing and testing. Use the     ;
;       routines GO_TO_FLAT_MODE_STACK and COMEBACK_FROM_FLAT_MODE_STACK;
;       for going to and coming back from flat mode.                    ;
;       3. if the board has fixed cache size, then do not do the cache  ;
;       sizing (this is the case in almost all Notebooks, it will save  ;
;       a lot of space), do only the testing.                           ;
;-----------------------------------------------------------------------;
        public  oem_detect_l2_cache
oem_detect_l2_cache:
	pushf					; Save Interrupt Flag
	call	open_extend_cmos

;; Calculate checksum
	sub	dx,dx
	mov	cx,6
	mov	ah,90h
@@:
	mov	al,ah
	call	cmos_data_in_x
	or	al,al
	jz	@f
	add	dl,al
	adc	dh,0
	inc	ah
	loop	@b
@@:
	cmp	ah,90h			; first byte is zero?
	jz	keypass_disable

	mov	ax,08e8fh
	call	cmos_data_in_x
	xchg	al,ah
	call	cmos_data_in_x
	cmp	ax,dx
	jnz	keypass_disable

;; Load CMOS Password to Keyboard
	mov	al,0a5h				;  set keyboard pass
	extrn	write_key_board_command:near
	call	write_key_board_command
	mov	ah,90h
	mov	cx,06h
load_cmos_to_key:
	mov	al,ah
	call	cmos_data_in_x
	inc	ah
	or	al,al
	jz	save_in_key_over
	extrn	write_key_board_data:near
	call	write_key_board_data
	loop	load_cmos_to_key
save_in_key_over:
	xor	al,al
	call	write_key_board_data
	
	call	close_extend_cmos
	
	call	open_apc_cmos

	mov	ax,8383h		    	; APC Register 03h
	call	cmos_data_in_x
	test	al,80h				; Power Lost?
	jz 	normal_path     
	and	al,not 80h			; Disabled Power Button
	xchg	ah,al			    
	call	cmos_data_out_x

	mov	ax,8585h		      	; APC Register 05h 
	call	cmos_data_in_x
	or	al,040h			    	; Enabled Keyboard Password
	xchg	ah,al			    
	call	cmos_data_out_x

	call	close_apc_cmos

	mov	al,34h				; Power Off
        mov     dx,MKF_PM_BASE_ADDRESS+5 	
	out	dx,al				 
	jmp	short $

keypass_disable:
	call	close_extend_cmos
;	call	open_apc_cmos
;	mov	ax,8383h		    	; APC Register 03h
;	call	cmos_data_in_x
;	or	al,80h	       			; Enable Power Button
;	xchg	al,ah
;	call	cmos_data_out_x

normal_path:

	call	close_apc_cmos

	popf					; Restore Interrupt Flag 

COMMENT ~
;; Clock Generator ICS 9248-59
;	mov	al,Q_CLKGEN_PCI_DIMM
;	call	get_cmos_item
;; PaiLin debug {
;	mov	bx,0ffffh			; BL = Byte 3 / BH = Byte 4 
;; } PaiLin debug
;;      jz      check_dimm_done


       mov     di,0f000h

       mov     bh,1
        mov     si,offset cgroup:row2bankconvert
start_row:
       mov     al,bh
       call    dmi_mem_module_info
       cmp     bl,7fh
       jz      next_row2bank
       sub     ax,ax
       mov     cx,4
@@:
        db      02eh
        lodsb
        bts     di,ax
       loop    @b
       jmp     short row_end
next_row2bank:
       add     si,4

⌨️ 快捷键说明

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