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

📄 clkcntl.asm

📁 惠普公司bios完整源代码大机密!
💻 ASM
📖 第 1 页 / 共 2 页
字号:
		mov	si,offset Prg_ClkGen_Num		
		mov	dx,SMBUS_PORT + 00h
		mov	dl,04h
		mov	al,cs:[si]
		out	dx,al
		newiodelay
		newiodelay

;Programe block data
		mov	si,offset Prg_ClkGen_Tbl		
	@@:
		mov	dx,SMBUS_PORT + 06h
		mov	al,cs:[si]
		out	dx,al
		NEWIODELAY
		NEWIODELAY
		add	si,1
		cmp	si,offset Prg_ClkGen_Tbl_End		
		jne	short @B

;R13		mov	dx,SMBUS_PORT + 07h
;R13		mov	al,077h		;set command
;R13		out	dx,al
;R13		NEWIODELAY
;R13		NEWIODELAY

		mov	dx,SMBUS_PORT + 02h
		mov	al,0		;start send
		out	dx,al
		NEWIODELAY
		NEWIODELAY

;R09 - start
		mov	dx,SMBus_Port + 0
		clc

		mov	cx,01000h
Chk_I2C_OK:
		in	al,dx		;get status
;R13		or	al,al
;R13		jz	short Clear_final
;R13		test	al,20h		;Error status
		test	al,60h			;R13;Error status
		jnz	short SMBus_Err	       

;R13		test	al,01h		;busy ?
;R13		jz	short Not_Smbusy
		test	al, 010h		;R13;nz, is successful
		jnz	short Clear_final	;R13
	;Wait bus clean
		push	cx			
		mov	cx,100h
	@@:						
		loop	short @B		
		pop	cx			

;R13Not_Smbusy:
;R13		out 	dx,al
		loop	short Chk_I2C_OK

SMBus_Err:
;R13		out	dx, al
;R13		NEWIODELAY
;R13		NEWIODELAY
;R13		NEWIODELAY
;R13		in	al, dx		;get status
;R13		NEWIODELAY
;R13		NEWIODELAY
;R13		NEWIODELAY
;R13		test	al, 20h
;R13		jnz	short SMBus_Err
Clear_final:
;R09 - end

 		ret
Disable_ClkGen_For_M1543	Endp
endif;	M1543

ifdef	VT586_ACPI					
  IF		VIA_SMBus	EQ	0		;R10
Disable_ClkGen_For_VT586B	Proc	near
		extrn	Dir_Out:Near
		extrn	Set_Start:Near
		extrn	Wr_Byte:Near
		extrn	Wait_ACK:Near
		extrn	Set_Stop:Near

                push    cx			
                push    bx			
                call    Dir_Out
                call    Set_Start
		mov	bl,0D2h			; Slave Address
		call	Wr_Byte			;
		call	Wait_ACK		;

;The following bytes must be sent alough they are "Don't Care" in data sheet.
		mov	bl,0			; Command Code
		call	Wr_Byte			;
		call	Wait_ACK		;

;R12		mov	bl,0			; Byte Count
;R12		call	Wr_Byte			;
;R12		call	Wait_ACK		;

		mov	si,offset Prg_ClkGen_Num		;R12		
                mov     bl,byte ptr cs:[si]			;R12
		call	Wr_Byte					;R12
		call	Wait_ACK				;R12

		mov	si,offset Prg_ClkGen_Num		
		xor	cx, cx					;R12
                mov     cl,byte ptr cs:[si]
@@:
                push    cx
                inc     si
                mov     bl,byte ptr cs:[si]
                call    Wr_Byte
                call    Wait_ACK
                pop     cx
                jc      SetValuesFail
                loop    short @B
                call    Set_Stop
                pop     bx
                pop     cx
                clc
                ret
SetValuesFail:
                pop     bx
                pop     cx
                stc
                ret
Disable_ClkGen_For_VT586B	Endp
  ENDIF;	VIA_SMBus				;R10
endif;	VT586_ACPI

;R10 - starts
if	VIA_SMBus
Disable_ClkGen_For_VT596	Proc    near
                mov     dx,SMBus_Port + 04h
                mov     al,0d2h         ;ID (write)
                out     dx,al
                NEWIODELAY
                NEWIODELAY

                mov     dx,SMBus_Port + 00h
Chk_Status0:
                in      al,dx           ;get status
                NEWIODELAY
                out     dx,al
                NEWIODELAY
                or      al,al
                jnz     short Chk_Status0

                mov     dx,SMBus_Port + 02h
                in      al,dx           ;reset pointer
                NEWIODELAY
                NEWIODELAY

;Programe block num.
                mov     si,offset Prg_ClkGen_Num
                mov     dx,SMBus_Port + 05h
                mov     al,cs:[si]
                out     dx,al
                newiodelay
                newiodelay

;Programe block data
                mov     si,offset Prg_ClkGen_Tbl
                mov     dx,SMBus_Port + 07h
        @@:
                mov     al,cs:[si]
                out     dx,al
                NEWIODELAY
                NEWIODELAY
                add     si,1
                cmp     si,offset Prg_ClkGen_Tbl_End
                jne     short @B

;Start send.
                mov     dx,SMBus_Port + 02h
                mov     al,54h
                out     dx,al
                newiodelay
                newiodelay

                xor     cx,cx           ;loop count
                mov     dx,SMBus_Port + 00h
Chk_Status_Final0:
                in      al,dx           ;get status
                NEWIODELAY
                test    al,02h          ;Send Ok ?
                jnz     short SendSmbusOk0
        ;check other status 
                loop    short Chk_Status_Final0
SendSmbusOk0:
                ret
Disable_ClkGen_For_VT596	Endp
endif;	VIA_SMBus
;R10 - ends

if	SIS_SMBus
Disable_ClkGen_For_SISSMBus	Proc	near
;R18 - start
ifdef	Hardware_SMBus_Support
ifdef	SiS5595_BVersion
		push    cx
		push    bx

	;; Set SMBus Address
		mov	dx,ACPI_BASE_IO_ADDR+38h	;SMBus IO index
		mov	al,04h
		out	dx,al
		NEWIODELAY

		mov	dx,ACPI_BASE_IO_ADDR+39h	;SMBus IO data
		mov	al,0D2h
		out	dx,al
		NEWIODELAY

	;; Set SMBus Command
		mov	dx,ACPI_BASE_IO_ADDR+38h	;SMBus IO index
		mov	al,05h
		out	dx,al
		NEWIODELAY

		mov	dx,ACPI_BASE_IO_ADDR+39h	;SMBus IO data
		mov	al,00h
		out	dx,al
		NEWIODELAY

		mov	si,offset Prg_ClkGen_Num
		xor	cx,cx
                mov     cl,byte ptr cs:[si]

	;; Set SMBus Bytes Count
		mov	dx,ACPI_BASE_IO_ADDR+38h	;SMBus IO index
		mov	al,07h
		out	dx,al
		NEWIODELAY

		mov	dx,ACPI_BASE_IO_ADDR+39h	;SMBus IO data
		mov	al,cl
		out	dx,al
		NEWIODELAY

		mov	bh,08h
@@:
		inc	si
		mov	ah,byte ptr cs:[si]

		mov	dx,ACPI_BASE_IO_ADDR+38h	;SMBus IO index
		mov	al,bh
		out	dx,al
		NEWIODELAY

		mov	dx,ACPI_BASE_IO_ADDR+39h	;SMBus IO data
		mov	al,ah
		out	dx,al
		NEWIODELAY
		inc	bh
		loop	@b

	;; Write Block Data
		mov	dx,ACPI_BASE_IO_ADDR+38h	;SMBus IO index
		mov	al,02h
		out	dx,al
		NEWIODELAY

		mov	dx,ACPI_BASE_IO_ADDR+39h	;SMBus IO data
		mov	al,1ah
		out	dx,al
		NEWIODELAY

	;; Wait ACK
		mov	dx,ACPI_BASE_IO_ADDR+38h	;SMBus IO index
		mov	al,00h
		out	dx,al
		NEWIODELAY

Wait_SMBus_ACK:
		mov	dx,ACPI_BASE_IO_ADDR+39h	;SMBus IO data
		in	al,dx
		NEWIODELAY
		test	al,40h
		jz	short Wait_SMBus_ACK
		out	dx,al
		NEWIODELAY

		pop	bx
		pop	cx
endif;	SiS5595_BVersion
;R30 - start
ifdef	SIS630_ID

	;; Set SMBus Address
		mov	dx,ACPI_BASE_IO_ADDR+84h	;SMBus IO data
		mov	al,0D2h
		out	dx,al
		NEWIODELAY
		NEWIODELAY

		mov	dx,ACPI_BASE_IO_ADDR+80h	;SMBus IO data
Chk_Status0:
		in	al,dx		;get status
		NEWIODELAY
		out	dx,al
		NEWIODELAY
		or	al,al
		jnz	short Chk_Status0


	;; Set SMBus Command

		mov	dx,ACPI_BASE_IO_ADDR+85h	;SMBus IO index
		xor	al,al
		out	dx,al
		NEWIODELAY

		mov	si,offset Prg_ClkGen_Num
		xor	cx,cx
                mov     cl,byte ptr cs:[si]
		mov	al,cl

	;; Set SMBus Bytes Count
		mov	dx,ACPI_BASE_IO_ADDR+87h	;SMBus IO index
		out	dx,al
		NEWIODELAY

	;; Write Block Data

		mov	dx,ACPI_BASE_IO_ADDR
		mov	dl,88h
@@:
		inc	si
		mov	al,byte ptr cs:[si]

		out	dx,al
		NEWIODELAY
		NEWIODELAY
		inc	dl
		cmp	si,offset Prg_ClkGen_Tbl_End
		jne	short @B

		mov	dx,ACPI_BASE_IO_ADDR+83h
		mov	al, 15h
		out	dx, al
		NEWIODELAY
		NEWIODELAY

                xor     cx,cx           ;loop count
                mov     dx,ACPI_BASE_IO_ADDR+80h
	_Chk_Status:
                in      al,dx           ;get status
                NEWIODELAY
                NEWIODELAY
                NEWIODELAY
                test    al,11h          ;Block Array
		jnz	short _SendSmbusOk
		loop	short _Chk_Status
_SendSmbusOk:
endif;	SIS630_ID
;R30 - end
;R32 - start
ifdef	SIS540_ID

	;; Set SMBus Address
		mov	dx,ACPI_BASE_IO_ADDR+84h	;SMBus IO data
		mov	al,0D2h
		out	dx,al
		NEWIODELAY
		NEWIODELAY

		mov	dx,ACPI_BASE_IO_ADDR+80h	;SMBus IO data
Chk_Status0:
		in	al,dx		;get status
		NEWIODELAY
		out	dx,al
		NEWIODELAY
		or	al,al
		jnz	short Chk_Status0


	;; Set SMBus Command

		mov	dx,ACPI_BASE_IO_ADDR+85h	;SMBus IO index
		xor	al,al
		out	dx,al
		NEWIODELAY

		mov	si,offset Prg_ClkGen_Num
		xor	cx,cx
                mov     cl,byte ptr cs:[si]
		mov	al,cl

	;; Set SMBus Bytes Count
		mov	dx,ACPI_BASE_IO_ADDR+87h	;SMBus IO index
		out	dx,al
		NEWIODELAY

	;; Write Block Data

		mov	dx,ACPI_BASE_IO_ADDR
		mov	dl,88h
@@:
		inc	si
		mov	al,byte ptr cs:[si]

		out	dx,al
		NEWIODELAY
		NEWIODELAY
		inc	dl
		cmp	si,offset Prg_ClkGen_Tbl_End
		jne	short @B

		mov	dx,ACPI_BASE_IO_ADDR+83h
		mov	al, 15h
		out	dx, al
		NEWIODELAY
		NEWIODELAY

                xor     cx,cx           ;loop count
                mov     dx,ACPI_BASE_IO_ADDR+80h
	_Chk_Status:
                in      al,dx           ;get status
                NEWIODELAY
                NEWIODELAY
                NEWIODELAY
                test    al,11h          ;Block Array
		jnz	short _SendSmbusOk
		loop	short _Chk_Status
_SendSmbusOk:
endif;	SIS540_ID
;R32 - end
else;	Hardware_SMBus_Support
;R18 - end
		extrn	Set_Start:Near
		extrn	Wr_Byte:Near
		extrn	Wait_ACK:Near
		extrn	Set_Stop:Near

                push    cx			
                push    bx			
                call    Set_Start

		mov	bl,0D2h			; Slave Address
		call	Wr_Byte			;
		call	Wait_ACK		;

;The following bytes must be sent alough they are "Don't Care" in data sheet.
		mov	bl,0			; Command Code
		call	Wr_Byte			;
		call	Wait_ACK		;

;R11		mov	bl,0			; Byte Count
;R11		call	Wr_Byte			;
;R11		call	Wait_ACK		;

		mov	si,offset Prg_ClkGen_Num ;R11
                mov     bl,byte ptr cs:[si]	 ;R11Byte Count
		call	Wr_Byte			 ;R11
		call	Wait_ACK	       	 ;R11

		mov	si,offset Prg_ClkGen_Num		
		xor	cx, cx			 ;R11
                mov     cl,byte ptr cs:[si]
	@@:
                push    cx
                inc     si
                mov     bl,byte ptr cs:[si]
                call    Wr_Byte
                call    Wait_ACK
                pop     cx
                jc      SetValuesFail
                loop    short @B
                call    Set_Stop
                pop     bx
                pop     cx
                clc
                ret
SetValuesFail:
                pop     bx
                pop     cx
                stc
endif;	Hardware_SMBus_Support				;R18
                ret
Disable_ClkGen_For_SISSMBus	Endp
endif;	SIS_SMBus

;R29 -starts
if	COBRA_SMBus
Disable_ClkGen_For_COBRASMBus	Proc    near

;R29A -starts
	;- clear status 
                mov     dx,SMBus_Port 	;clear status
		mov	al,37h
		out	dx,al
;R29A -ends

;R29A                mov     dx,SMBus_Port + 04h
;R29A                mov     al,0d2h         ;ID (write)
;R29A                out     dx,al
;R29A                NEWIODELAY
;R29A                NEWIODELAY

                mov     dx,SMBus_Port + 00h
Chk_Status0:
                in      al,dx           ;get status
                NEWIODELAY
                out     dx,al
                NEWIODELAY
                or      al,al
                jnz     short Chk_Status0

;R29A -starts
	;- Send ID (write) & zero HST10BA
                mov     dx,SMBus_Port + 04h
                mov     ax,0d2h         	
		out	dx,ax			
                NEWIODELAY
                NEWIODELAY
;R29A -ends

;R29A                mov     dx,SMBus_Port + 02h
;R29A                in      al,dx           ;reset pointer
;R29A                NEWIODELAY
;R29A                NEWIODELAY

;R29A -starts
	;- Send Register Index start from Byte0
		mov	dx,SMBus_Port +08h
		mov	al,0			
		out	dx,al			
		NEWIODELAY
		NEWIODELAY
;R29A -ends

;Programe block num.
                mov     si,offset Prg_ClkGen_Num
                mov     dx,SMBus_Port + 06h
                mov     al,cs:[si]
                out     dx,al
                newiodelay
                newiodelay

;Programe block data
                mov     si,offset Prg_ClkGen_Tbl
                mov     dx,SMBus_Port + 09h
        @@:
                mov     al,cs:[si]
                out     dx,al
                NEWIODELAY
                NEWIODELAY

                inc     si
                cmp     si,offset Prg_ClkGen_Tbl_End
                jne     short @B

;Start send.
                mov     dx,SMBus_Port + 02h
                mov     al,0Dh			;Block W
                out     dx,al
                newiodelay
                newiodelay

                xor     cx,cx           ;loop count
                mov     dx,SMBus_Port + 00h
	_Chk_Status:
                in      al,dx           ;get status

                NEWIODELAY
                NEWIODELAY
                NEWIODELAY
                test    al,08h          ;is Host Controller Busy ?

;R29A -starts
		jnz	short _Loop_Chk_Status	;yes

		test	al,37h			;?Valid cycle
		jnz	short _Chk_Other_Status
_Loop_Chk_Status:
		loop	_Chk_Status
	;check other status
_Chk_Other_Status:
		test	al,27h			;?Error
		jnz	_SendSmbusErr

		test	al,10h			;?Host Cycle Complete
		jz	_Loop_Chk_Status
_SendSmbusOk:
_SendSmbusErr:
;R29A -ends

;R29A                jz     short _SendSmbusOk
;R29A        ;check other status 
;R29A		out	dx,al
;R29A                NEWIODELAY
;R29A                loop    short _Chk_Status
;R29A_SendSmbusOk:
;R29A		;------ clear command port ------------
;R29A		mov	dx,SMBus_Port +04h		
;R29A	@@:
;R29A		mov	al,0				
;R29A		out	dx,al				
;R29A
;R29A		in	al,dx				
;R29A		cmp	al,0				
;R29A		jne	short	@b			
;R29A
;R29A		mov	cx,100			
;R29A	@@:					
;R29A		NEWIODELAY			
;R29A		loop	short @b		
;R29A
                ret
Disable_ClkGen_For_COBRASMBus	Endp
endif;	COBRA_SMBus
;R29 -ends

ENDIF;	CLKCNTL_KERNEL

ECODE		ENDS
		END

⌨️ 快捷键说明

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