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

📄 nruntime.asm

📁 AMI 主板的BIOS源码。
💻 ASM
📖 第 1 页 / 共 5 页
字号:
        page    ,132
        title   RUNTIME HOOKS (NO PORTING NEEDED IN GENERAL)
;---------------------------------------------------------------;
; NOTE: Do not destroy EBP,SS,DS,ES,FS,GS 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.     **;
;**                                                             **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------;
        extrn   ide_prim_base_addr:word
        extrn   ide_sec_base_addr:word
        extrn   ide_prim_irq    :byte
        extrn   ide_sec_irq     :byte
        extrn   misc_info       :byte
;---------------------------------------;
        extrn   check_cmos_data:near
        extrn   proc_shutdown:near
        extrn   cmos_data_in_x:near
        extrn   cmos_data_out_x:near
        extrn   cmos_data_in:near
        extrn   cmos_data_out:near

        extrn   enable_l1_cache_wt:near
        extrn   enable_l1_cache_wb:near
        extrn   disable_l1_cache:near
        extrn   enable_l2_cache_wt:near
        extrn   enable_l2_cache_wb:near
        extrn   disable_l2_cache:near
        extrn   low_speed:near
        extrn   high_speed:near
;---------------------------------------;
        include mbiosmac.mac
        include mbiosequ.equ
        include cf.equ
        include silent.equ
        include makeflag.equ
        include setupequ.ext
;---------------------------------------;
cgroup  group   _text
_text   segment word    public  'CODE'
        assume  cs:cgroup
.486p
;---------------------------------------;
        public  _NRUNTIMEX_STARTS
_NRUNTIMEX_STARTS       label   byte            ; marks start of module
;-----------------------------------------------------------------------;
;                       SET_SCRATCH_SEGMENT_SETUP                       ;
;-----------------------------------------------------------------------;
;  this routine is called from hot key setup. this routine returns the  ;
;  segment value (of length at least 32k) which can be used as scratch  ;
;  ram during setup.                                                    ;
;  input :                                                              ;
;       ds      0040h                                                   ;
;       stack   available                                               ;
;  output:                                                              ;
;       nc      scratch segment found                                   ;
;               ax  scratch segment                                     ;
;       cy      scratch segment not found                               ;
;  register usage..do not destroy any register except AX                ;
;                                                                       ;
;  SUGGESTED USE:                                                       ;
;  * this routine is supposed to look for any ram which can be used as  ;
;  scratch ram. use of shadow ram is suggested. if shadow is currently  ;
;  enabled then first disable the shadow and then make that segment R/W ;
;  and return the value of segment. the segment will be restored in     ;
;  RESTORE_SCRATCH_SEGMENT_SETUP routine.                               ;
;-----------------------------------------------------------------------;
        public  set_scratch_segment_setup
set_scratch_segment_setup       proc    near
        stc
        ret
set_scratch_segment_setup       endp
;-----------------------------------------------------------------------;
;                       RESTORE_SCRATCH_SEGMENT_SETUP                   ;
;-----------------------------------------------------------------------;
;  this routine is called from hot key setup. this routine restores the ;
;  segment value which is used as scratch ram during setup.             ;
;  input :                                                              ;
;       ax      scratch segment to be restored                          ;
;       stack   available                                               ;
;  output:                                                              ;
;       nc      scratch segment restored                                ;
;       cy      scratch segment not restored                            ;
;  register usage..do not destroy any register except AX                ;
;                                                                       ;
;  SUGGESTED USE:                                                       ;
;  * this routine is supposed to restore the contents of segment which  ;
;  was returned as scratch ram by SET_SCRATCH_SEGMENT_SETUP. if shadow  ;
;  was originally enabled then enable the shadow properly before return.;
;  make sure the shadow ram is write-protected before return.           ;
;-----------------------------------------------------------------------;
        public  restore_scratch_segment_setup
restore_scratch_segment_setup   proc    near
        stc
        ret
restore_scratch_segment_setup   endp
;-----------------------------------------------------------------------;
;                       FORCE_NO_OF_SECTORS                             ;
;-----------------------------------------------------------------------;
; check point           : 91                                            ;
; this routine is called from hard_disk_setup during POST. this routine ;
; will force the number of sectors which can be xferred at a time to a  ;
; working value. this routines is needed because some hard disk does not;
; work with the value it returned from identify drive command.          ;
; input :                                                               ;
;       AL      #of sectors that can be xferred at a time as obtained   ;
;               from identify drive command                             ;
;       SS      0030H                                                   ;
;       DS      0040H                                                   ;
;       ES      0000H                                                   ;
;       stack   available                                               ;
; output:                                                               ;
;       AL      #of sectors that can be xferred at a time               ;
; register usage : can not destroy any register except AL               ;
;-----------------------------------------------------------------------;
        public  force_no_of_sectors
force_no_of_sectors     proc    near
;  if it is > 8, force it to 8..
;;      cmp     al,08h
;;      jbe     setm_04
;;      mov     al,08h
;;setm_04:
        ret
force_no_of_sectors     endp
;-----------------------------------------------------------------------;
;                       PROGRAM_HD_STANDBY                              ;
;-----------------------------------------------------------------------;
; Check point   : 91                                                    ;
; this routine is called from hard_disk_setup during POST. this programs;
; hard disk standby timer value.                                        ;
; input :                                                               ;
;       AL      timer value in unit of 5 sec                            ;
;       SS      0030H                                                   ;
;       DS      0040H                                                   ;
;       ES      0000H                                                   ;
;       stack   available                                               ;
; output:                                                               ;
;       none                                                            ;
; register usage : can destroy any register except EBP, DS, ES          ;
; NOTE :                                                                ;
; The ATA Spec defines the following power down commands that may be    ;
; issued to the hard disk to set its power consumption mode:            ;
;       SET 1   SET 2                                                   ;
;       -----   -----                                                   ;
;        98h     e5h    Check Power Mode - If drive is in, going to, or ;
;                       recovering from standby mode, Sector Count Reg. ;
;                       is returned with 00h.  If drive is in idle mode,;
;                       return ffh in the Sector Count Reg.             ;
;        97h     e3h    Idle - Place drive in idle mode. If Sector Count;
;                       Reg is nonzero, start automatic power down      ;
;                       timer, if applicable.                           ;
;        95h     e1h    Idle Immediate - Drive immediately enters the   ;
;                       idle power state.                               ;
;        96h     e2h    Standby - Place drive in standby mode.  If Sec- ;
;                       tor Reg is nonzero, start automatic power down  ;
;                       timer, if applicable.                           ;
;        94h     e0h    Standby Immediate - Drive immediately enters the;
;                       standby power state.                            ;
;        99h     e6h    Set Sleep Mode - Place drive in sleep mode.     ;
;-----------------------------------------------------------------------;
        public  program_hd_standby
        extrn   set_standby_multiple:near
program_hd_standby      proc    near
        mov     ah,0e3h                 ; idle w/timer command (set 2)
        pusha                           ; Don't know what set_standby_multiple
                                        ; destroys, so saving all regs.
        call    set_standby_multiple
        popa                            ; Restore all regs.
        jnc     short hd_standby_programmend
        mov     ah,097h                 ; idle w/timer command (set 1)
        call    set_standby_multiple
hd_standby_programmend:
        ret
program_hd_standby      endp
;-----------------------------------------------------------------------;
;                       IDE_PRIM_IRQ_EXTRA                              ;
;-----------------------------------------------------------------------;
; This routine is called from hardware interrupt ISR for primary hard   ;
; disk controller. This routine can implement anything extra to be done ;
; in IRQ ISR. For example, for PCI BIOS the routine may have to read the;
; hard disk status register to clear the interrupt.                     ;
; input :                                                               ;
;       DS                      0040H                                   ;
;       CS:IDE_PRIM_BASE_ADDR   I/O base addr of primary controller     ;
; output:                                                               ;
;       none                                                            ;
; register usage : do not destory any register except AX                ;
;-----------------------------------------------------------------------;
        public  ide_prim_irq_extra
ide_prim_irq_extra      proc    near
        push    dx
        mov     dx,cgroup:ide_prim_base_addr; get I/O base address
        add     dx,07h                  ; status register
        in      al,dx
        pop     dx
        ret
ide_prim_irq_extra      endp
;-----------------------------------------------------------------------;
;                       IDE_SEC_IRQ_EXTRA                               ;
;-----------------------------------------------------------------------;
; This routine is called from hardware interrupt ISR for secondary hard ;
; disk controller. This routine can implement anything extra to be done ;
; in IRQ ISR. For example, for PCI BIOS the routine may have to read the;
; hard disk status register to clear the interrupt.                     ;
; input :                                                               ;
;       DS                      0040H                                   ;
;       CS:IDE_SEC_BASE_ADDR    I/O base addr of secondary controller   ;
; output:                                                               ;
;       none                                                            ;
; register usage : do not destory any register except AX                ;
;-----------------------------------------------------------------------;
        public  ide_sec_irq_extra
ide_sec_irq_extra       proc    near
        push    dx
        mov     dx,cgroup:ide_sec_base_addr; get I/O base address
        add     dx,07h                  ; status register
        in      al,dx
        pop     dx
        ret
ide_sec_irq_extra       endp
;-----------------------------------------------------------------------;
;                               V_TIMER_TICK                            ;
;                               TIMER_TICK                              ;
;-----------------------------------------------------------------------;
; This routine is hardware INT-8 during diagnostics mode. CPU can be in ;
; real or virtual mode, (DS = 40) always. This routine will get control ;
; if diagnostics switch is on and you may do any LED blinking or other  ;
; way of reporting that system is alive.                                ;
; input :                                                               ;
;       DS      0040H                                                   ;
; register usage : save all registers and flag                          ;
; use IRET to return to caller (remember this is INT-8 ISR)             ;
;-----------------------------------------------------------------------;
        public  v_timer_tick            ; INT-8 in virtual mode, diag sw on
        public  timer_tick              ; INT-8 in real mode, diag switch on
v_timer_tick:

⌨️ 快捷键说明

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