📄 pcipost.asm
字号:
endif; COMBINE_ISA_ROM
call init_isa_roms ;R23
;R21B call Shadow_C8_To_DF ;R21A
call Shadow_C8_To_DF ;R68
;R82 ifndef CT_SHADOW_RW_HOOK_SUPPORT
;R82 F000_CALL Ct_C8_To_DF_R
;R82 else ;CT_SHADOW_RW_HOOK_SUPPORT
call Shadow_C8_To_DF_R
;R82 endif ;CT_SHADOW_RW_HOOK_SUPPORT
call Invalidate_Shadow_Seg ;invalidate whole shadow seg
;i.e. shadow unit = 16K(32K)
; ==> invalidate whole
; 16k(32k) even if it
; is not totally used!
mov si, 1
call EDisable_UnUsed_Shadow
;R82 - starts
ifdef SHADOW_UNIT_64K
ifdef USB_SUPPORT
;R92B;R92 cmp byte ptr LMEM_RESERVED[bp], 0 ;C8-CF reserved by USB?
;R92B;R92 jne @F ;yes!
;R92B;R92 - start
;R92B test byte ptr LMEM_RESERVED[bp],0f0h ;C8-CF reserved by USB?
;R92B jnz short @F ;yes! ;R92A
;R92B;R92A jz @F ;yes!
;R92B;R92 - end
;R92B ;Set shadow write-protected, if no USB legacy occupied C-segment.
;R92B call F_C000_Shadow_R
;R92B @@:
;R92B - start
cmp byte ptr PCI_VGA_FOUND[bp], VGA_DEVICE_EXIST ;PCI VGA existed
jne short @F
;R92C test byte ptr LMEM_RESERVED[bp],0fh ;C8-CF reserved by USB?
test byte ptr LMEM_RESERVED[bp],0ffh ;C8-CF reserved by USB? ;R92C
jnz short @F ;yes!
;Set shadow write-protected, if no USB legacy occupied C-segment.
call F_C000_Shadow_R
@@:
;R92B - end
endif ;USB_SUPPORT
endif ;SHADOW_UNIT_64K
;R82 - endif
;Enable/Disable VGA Palette snoop according to setup
cmp byte ptr PCI_VGA_FOUND[bp], VGA_DEVICE_EXIST ;PCI VGA existed
jne No_PciVga_Found
mov si, offset Vga_Snoop_Item
call F000_GetItem_Value
or al, al
jz No_VgaSnoop
mov cx, PCI_VGA_INFO[bp] ;ah = bus no. al=dev+fun no
mov bh, ch ;bus no.
xchg ch, cl
mov cl, 04H ;command register
F000_CALL Aget_CfgSpace_Word
or al, 20H ;enable VGA snoop
F000_CALL ASet_CfgSpace_Word
No_VgaSnoop:
No_PciVga_Found:
IF RELEASE_E000_FOR_PCI
;--------------------------------------------------------------
;clear the un-used E0000-E7FFF shadow RAM to FFh for EMM386 UMB
;--------------------------------------------------------------
mov al, LMEM_RESOURCE[bp+3] ;save for atbase.asm
;to check if E000 shadow RAM
; occupied by PCI ROM
mov si, offset E000_USED_BY_PCI
mov cs:[si], al
mov cx, 08000h ;32k to clear
mov di, 0E000h ;starting from E000h
@@:
or al, al
jz @F
shr al, 1
add di, 100h ;update starting addr. to clr
sub cx, 1000h ;add 4k more to clear
jmp @B
@@:
or ch, ch
jz No_Need_Clear_E0
mov es, di ;Clear shadow with 0FFh
xor di, di ;Clear shadow with 0FFh
cld ;Clear shadow with 0FFh
mov al, -1 ;Clear shadow with 0FFh
rep stosb ;Clear shadow with 0FFh
No_Need_Clear_E0:
F000_CALL E000_64k_Shadow_R
ENDIF ;RELEASE_E000_FOR_PCI
mov byte ptr LMEM_FOR_ROM_FLG[bp], 1
;R33;R09 - start
;R33ifdef Trend_AntiVirus
;R33 pushad
;R33;R09A push di
;R33 push es
;R33 push ds
;R33
;R33;R09A - start
;R33 mov si,offset Virus_Item ;virus protection setup item
;R33 call F000_GetItem_Value ;read CMOS setting
;R33 or al,al ;virus protection enabled ?
;R33 jnz Not_trend ;no skip virus ROM initial
;R33;R09A - end
;R33
;R33 mov di, (07h+1)*4 ;Cbrom /vrs number ID
;R33 call POST_decompress ;Decompress to 4000:0
;R33 jc Not_trend
;R33
;R33 push 4000h
;R33 pop ds
;R33 mov cl, ds:[2] ;get rom size of 4000:2
;R33 pop ds
;R33 push ds ;balance stack ;R09A
;R33
;R33 mov al, cl
;R33 shr cl, 3 ;patch 4k rom size
;R33 and al, 07h
;R33 or al, al
;R33 jz short @f
;R33 inc cl
;R33 @@:
;R33 call EGet_Available_LMEM ;ask for LOW MEM
;R33 jc Not_trend ;no shadow available
;R33
;R33 push cx
;R33 dec cx
;R33 mov eax, 0FFFFFFFEh
;R33 shl eax, cl
;R33 not eax
;R33
;R33 mov ecx, AVAIL_LMEM_ADDR[bp]
;R33 shr ecx, 12
;R33 sub cl, 0C8h
;R33 shl eax, cl
;R33 or LMEM_RESERVED[bp], eax
;R33
;R33 push 0f000h
;R33 pop es
;R33 F000_call F000_Shadow_W ;Get a space to save
;R33 mov si, offset Virus_Used_Shadow ;used shadow
;R33
;R33;Enable using shadow block that can be read and write
;R33;R26 pop cx
;R33;R26 push cx
;R33
;R33;R26 - statr
;R33 F000_call Ct_Shadow_Unit
;R33 mov di, 0fch
;R33 mov ax, 4
;R33 cmp cx, 4000h
;R33 je short @F
;R33 mov di, 0f8h
;R33 mov ax, 8
;R33@@:
;R33;R26 - end
;R33;record region of shadow
;R33
;R33 mov ebx, AVAIL_LMEM_ADDR[bp]
;R33 shr ebx, 12 ;BL is Trend_AntiVirus start
;R33 mov bh, bl
;R33;R26 and bh, 0fch ;BH is shadow open start
;R33
;R33 push di ;R26
;R33 pop cx ;R26
;R33 and bh, cl ;R26
;R33
;R33 mov dl, bl
;R33
;R33 pop cx ;R26
;R33 push cx ;R26
;R33
;R33 add dl, cl ;DL is Trend_AntiVirus end
;R33 mov dh, dl
;R33
;R33 push ax ;R26
;R33
;R33 mov ah, dl
;R33 and ah, 03h
;R33 or ah, ah
;R33 jz short @f
;R33 inc dh ;DH is shadow end
;R33 @@:
;R33 pop cx ;R26Get AX value
;R33 push bx
;R33 @@:
;R33 pushad
;R33 mov dh, bh
;R33 F000_Call Ct_Shadow_RW
;R33 popad
;R33 mov ah, bh
;R33;R26 add bh, 04h
;R33 add bh, cl ;R26
;R33 cmp bh, dh
;R33 jb short @b
;R33 pop bx
;R33 mov al, bh
;R33 mov es:[si], ax ;store ax to Virus_Used_Shadow
;R33
;R33 F000_call F000_Shadow_R
;R33
;R33 pop cx
;R33 shl ecx, 11 ;Move times by word
;R33 mov si,4000h ;SI: Source SEG
;R33 mov edi,AVAIL_LMEM_ADDR[bp] ;EDI: available shadow RAM
;R33 shr edi,4 ;DI: destination SEG
;R33 F000_CALL Move_Codes
;R33 call Init_ROM ;invoke virus ROM
;R33
;R33Not_trend: ;R09A
;R33 pop ds ;R09A
;R33 pop es
;R33;R09A pop di
;R33 popad
;R33;R09ANot_trend:
;R33endif; Trend_AntiVirus
;R33;R09 - end
call PatchRomAlignMent ;R22
;R78A call Set_IDE_DMA_Capable ;R78
;R91 - starts
ifdef PciLanROM_Control
call Restore_Onboard_PCI_Lan
endif ;PciLanROM_Control
;R91 - ends
POP_ALL
ret
EPciRom_After_Init endp
;R91 - starts
ifdef PciLanROM_Control
PUBLIC Restore_Onboard_PCI_Lan
Restore_Onboard_PCI_Lan PROC near
mov byte ptr CURRENT_BUS_NO[bp], 0
mov ch, (Onboard_PCI_LAN) shl 3 ;device/function number
mov cl, 04h ;register = 4 (command)
;R91A mov ax,Xgroup_Segment
;R91A mov ds,ax
;R91A lea si,LAN_COMMAND_WORD ;get offset
;R91A mov ax,[si] ;restore value in AX
mov ax,POST_Stack_Temp_Word[bp] ;R91A restore value in AX
call fProc_Set_CfgSpace_Word
ret
Restore_Onboard_PCI_Lan ENDP
endif ;PciLanROM_Control
;R91 - ends
;R78A;R78 start
;R78ASet_IDE_DMA_Capable proc far
;R78A
;R78A xor bh,bh ;bus 0
;R78A xor ch,ch ;start device 0,function 0
;R78ASIDC_Loop:
;R78A mov cl,0ah ;offset 0Ah (class code)
;R78A F000_call AGet_CfgSpace_Word
;R78A cmp ax,0ffffh ;invalid?
;R78A je short Next_Device ;Yes,skip
;R78A
;R78A cmp ax,101h ;IDE device?
;R78A jne short Next_Device ;Yes,skip
;R78A
;R78A mov cl,20h ;offset 20h (DMA base port)
;R78A F000_call AGet_CfgSpace_Word
;R78A and ax,0fff0h ;isolate useful bits
;R78A jz short Next_Device ;invalid then skip
;R78A
;R78A mov dx,ax ;DX = base port
;R78A and dx,0fff0h ;isolate useful bits
;R78A add dl,2 ;set to status register of primary
;R78A in al,dx ;get original data
;R78A or al,60h ;set drive 0,1 DMA capable
;R78A out dx,al ;send to port
;R78A
;R78A add dl,8 ;set to status register of secondary
;R78A in al,dx ;get original data
;R78A or al,60h ;set drive 0,1 DMA capable
;R78A out dx,al ;send to port
;R78ANext_Device:
;R78A inc ch ;next device and function
;R78A jnz short SIDC_Loop ;not exceed then continue
;R78A
;R78A ret
;R78ASet_IDE_DMA_Capable endp
;R78A;R78 end
;R23 START
;[]==============================================================[]
;INIT_ISA_ROMS_ADDR:
;Input : none
;Output: None
;NOTE:This func is CBROM /isa with assign address.(40A0h to 40A3h)
;[]==============================================================[]
ALIGN 4
INIT_ISA_ROMS_ADDR proc near
push ds
push es
push bp
mov bx,Temp_EXP_Seg ;cbrom table segment
mov es,bx
mov di,(0a0h+1)*4 ;cbrom /isa table offset
;start
next_isa_rom_addr:
push di
mov ebx,es:[di+Temp_EXP_Off]
or ebx,ebx
jz short No_rom_exit
cmp bx,0ffffh
je short No_rom_exit
call combined_isa_addr ;cbrom /isa compress address
cli
call E000_A20_On
call E000_Enter_Prot_mode ;enter protected mode
call E000_Back_Real_Mode ;R47
xor edx,edx
mov dx, ds:[ebx+0fh] ;assign address(offset)
shl edx, 4
mov AVAIL_LMEM_ADDR[bp], edx
mov word ptr ds:[ebx+0fh], 0 ;clear offset to decompress
;R47 call E000_Back_Real_Mode
call E000_A20_Off
or edx,edx ;have address?
jz short No_rom_exit
call post_decompress
jc short No_rom_exit ;R23A
call get_rom_size
call lmem_flg_mask
test eax,LMEM_RESOURCE[bp]
jnz short No_rom_exit
or LMEM_RESOURCE[bp], eax
call copy_rom_shadow_init
No_rom_exit:
pop di
add di, 4
cmp di, (0a3h+1)*4 ;cbrom /isa table offset
;end
jb next_isa_rom_addr
pop bp
pop es
pop ds
ret
INIT_ISA_ROMS_ADDR endp
;[]==============================================================[]
;INIT_ISA_ROMS:
;Input : none
;Output: None
;NOTE:This func is CBROM /isa not assign address.(40A4h to 40A7h)
;[]==============================================================[]
ALIGN 4
Init_ISA_ROMS proc near
push ds
push es
push bp
mov bx,Temp_EXP_Seg ;cbrom table segment
mov es,bx
mov di,(0a4h+1)*4 ;cbrom /isa table offset
;start
next_isa_rom:
push di
mov ebx,es:[di+Temp_EXP_Off]
or ebx,ebx
jz short No_isa_rom_exit
cmp bx,0ffffh
je short No_isa_rom_exit
call post_decompress
jc short No_isa_rom_exit ;R23A
call get_rom_size
call EGet_Available_LMEM ;request low mem
jc No_isa_rom_exit ;no shadow available
call copy_rom_shadow_init
No_isa_rom_exit:
pop di
add di, 4
cmp di, (0a7h+1)*4 ;cbrom /isa table offset
;end
jb short next_isa_rom
pop bp
pop es
pop ds
ret
Init_ISA_ROMS endp
;[]==============================================================[]
;combined_isa_addr:
;Input : DI : cbrom number. e.g -> 40A0h , DI = (0A0h+1)*4
;Output: EBX : physical address
;[]==============================================================[]
ALIGN 4
combined_isa_addr proc near
;R55ifdef Flash_2M_support
;R55 mov ebx, 160000h ;extra option ROM temp address
;R55 cmp es:[di+Temp_EXP_Off+2], 8000h ;first segment
;R55 je @F ;Yes, skip
;R55 add ebx, 10000h ;set to next sgment (170000h)
;R55@@:
;R55 add bx, es:[di+Temp_EXP_Off] ;set to physical address
;R55else ;Flash_2M_support
;R55 xor ebx, ebx
;R55 mov bx, es:[di+Temp_EXP_Off+2]
;R55 shl ebx, 4
;R55 add bx, es:[di+Temp_EXP_Off] ;set to physical address
;R55endif ;Flash_2M_support
mov ebx,es:[di+Temp_EXP_Off] ;R55
ifdef Flash_2M_support ;R55
add ebx,0e0000h ;R55
endif ;Flash_2M_support ;R55
ret
combined_isa_addr endp
;[]==========================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -