www.pudn.com > hpbios.rar > AOL_INIT.INC


;	[]===========================================================[] 
; 
;	NOTICE: THIS PROGRAM BELONGS TO AWARD SOFTWARE INTERNATIONAL(R) 
;	        INC. IT IS CONSIDERED A TRADE SECRET AND IS NOT TO BE 
;	        DIVULGED OR USED BY PARTIES WHO HAVE NOT RECEIVED 
;	        WRITTEN AUTHORIZATION FROM THE OWNER. 
; 
; 	[]===========================================================[] 
; 
 
;		PAGE	60,132 
;		TITLE	POST  -- 386 ROM/BIOS POST 
;---------------------------------------------------------------------------- 
;Rev	Date	 Name	Description 
;--------------------------------------------------------------------------- 
;R01B	02/15/00 DNL	BIOS needs to turn off watchdog timer at same time 
;R01A	02/10/2K DNL	Fixed system always reset when invalid checksum detected 
;			for configuration space of EEPROM. 
;R01	02/01/2K DNL	Fixed some mistakes to let AOL2 function work correctly 
;R00	09/16/99 DNL	Initial version for Alert on LAN 2 
 
SMB_HST_STS     EQU     0	; Host Status 
SMB_SLV_STS	EQU     1	; Slave status 
SMB_HST_CNT	EQU     2	; Host control 
SMB_HST_CMD	EQU     3	; Host command 
SMB_HST_ADD	EQU     4	; Host address 
SMB_HST_DAT0	EQU     5	; Host Data 0 
SMB_HST_DAT1	EQU     6	; Host Data 1 
SMB_BLK_DAT	EQU     7       ; Block data 
PORTB_REFRESH   EQU     61h 
REFRESH_MASK    EQU     10h 
 
MSEC            EQU     43h     ; Number of 15 microsecond intervals in 1ms 
 
		include		AOL.EQU 
 
ifdef	AOL_SUPPORT 
		extrn	AOL_Init_Exit:near 
;---------------------------------------------------------------------- 
; Procedure SmbByteDataRead 
;           This routine performs a SMBUS byte data read command 
;           to a specified SMBUS device address and command byte. 
;           The alerpack uses the command byte as a register number. 
; 
; Input:    BH = device register 
;           BL = SMBUS address 
; 
; Destroys: Nothing 
; 
; Output:   AL = data byte read 
;           AH and Zero Flag = SMBUS status  
;              AH = 0 Success (ZF) 
;              AH !=0 Failure (NZ) 
; 
; Assumes:  Stack is not available 
; 
;---------------------------------------------------------------------- 
SmbByteDataRead PROC NEAR 
 
	mov	ebp,esp 
 
        ; Check for errors and kill incomplete commands 
 
        Rom_call	cleanupHostErrors 
 
        ; Set host command register 
 
        mov     dx, SMBUS_PORT + SMB_HST_CMD 
        mov     al, bh               
        out     dx, al                  ; Set command register 
 
        ; Set SMBUS device address with read attribute 
 
        mov     dx, SMBUS_PORT + SMB_HST_ADD 
        mov     al, bl 
        or      al, 1                   ; Force read operation 
        out     dx, al                  ; Set address + read attribute           
 
        ; Clear data port of previous data 
 
        mov     dx, SMBUS_PORT + SMB_HST_DAT0 
        xor     al, al 
        out     dx, al 
 
        ; Set protocol as byte data read and start transaction 
 
        mov     dx, SMBUS_PORT + SMB_HST_CNT 
        mov     al, 48h 
        out     dx, al     
 
        ; Wait for transaction to start and complete 
 
        Rom_call	waitForHostBusy 
        Rom_call	waitForHostNotBusy      ; SMBUS status returned in AH and ZF 
 
        ; Get data byte requested 
 
        mov     dx, SMBUS_PORT + SMB_HST_DAT0 
        in      al, dx                  ; Get byte read 
 
	mov	esp,ebp 
 
        ret 
 
SmbByteDataRead ENDP 
 
;---------------------------------------------------------------------- 
; Procedure SmbByteDataWrite 
;           This routine performs a SMBUS byte data write command 
;           to a specified SMBUS device address, device register, and  
;           data byte value. 
; 
; Input:    BH = device register 
;           BL = SMBUS address 
;           AL = write value  
; 
; Destroys: None 
; 
; Output:   AH and Zero Flag = SMBUS status  
;              AH = 0 Success (ZF) 
;              AH !=0 Failure (NZ) 
; 
; Assumes:  Stack is not available 
; 
;---------------------------------------------------------------------- 
SmbByteDataWrite        PROC NEAR 
 
	mov	ebp,esp 
 
        mov     ah, al                  ; Save byte value to be written 
 
        ; Check for errors & kill incomplete commands 
 
        Rom_Call	cleanupHostErrors 
 
        ; Set host command register 
 
        mov     dx, SMBUS_PORT + SMB_HST_CMD 
        mov     al, bh               
        out     dx, al                  ; Set command register 
 
        ; Set SMBUS device address with write attribute 
 
        mov     dx, SMBUS_PORT + SMB_HST_ADD 
        mov     al, bl 
        and     al, NOT 1               ; Force write operation 
        out     dx, al                  ; Set address + write attribute           
 
        ; Set data to write 
 
        mov     dx, SMBUS_PORT + SMB_HST_DAT0 
        mov     al, ah 
        out     dx, al 
 
        ; Set protocol as byte data read/write and start  
 
        mov     dx, SMBUS_PORT + SMB_HST_CNT 
        mov     al, 48h 
        out     dx, al     
 
        ; Wait for transaction to start and complete 
 
        Rom_Call	waitForHostBusy 
        Rom_Call	waitForHostNotBusy      ; SMBUS status returned in AH and ZF 
 
	mov	esp,ebp 
 
        ret 
 
SmbByteDataWrite      ENDP 
 
;---------------------------------------------------------------------- 
; Procedure waitForHostNotBusy 
;           This routine waits for the host busy bit to be cleared for 
;           a specific period of time.  If the host busy bit does not  
;           in the maximum time frame, the current transaction is  
;           killed.  The error status is then retrieved from the host 
;           controller. 
; 
; Input:    None 
; 
; Destroys: AL 
; 
; Output:   AH and Zero Flag = SMBUS status  
;              AH = 0 Success (ZF) 
;              AH !=0 Failure (NZ) 
; 
; Assumes:  Stack is not available 
; 
;---------------------------------------------------------------------- 
waitForHostNotBusy      PROC	NEAR 
 
        mov     cx, 500 * MSEC          ; Set maximum wait 
 
        mov     dx, SMBUS_PORT + SMB_HST_STS 
 
        jmp     @f                      ; Start loop with no time delay 
                       
waitFor: 
 
        in      al, PORTB_REFRESH       ; Get refresh toggle state 
        and     al, REFRESH_MASK        ; Isolate refresh toggle 
 
        cmp     al, ah                  ; Refresh detected? 
        je      short waitFor		; Loop if refresh not detected 
 
        mov       ah, al                ; Save current refresh toggle state 
@@: 
        in        al, dx 
        test      al, 01h		; Check for host busy 
  
        loopnz	  waitFor		; Repeat until timer expires 
                                        ;  or until host NOT busy 
 
        ; Either  
        ;    the maximum time expired (CX=0)  
        ;    and the host busy bit is still set (ZF=1) 
        ; or 
        ;    the maximum time has not expired (CX!=0) 
        ;    and the host busy bit is clear (ZF=0) 
        ; 
        ; If the host busy is still set, the SMBUS transaction must  
        ; be terminated via the KILL bit. 
         
 
        jz      @f                      ; Jump if host busy bit is clear 
 
        ; The transaction has not completed in a  
        ; timely fashion and must be killed 
 
        mov     dx, SMBUS_PORT + SMB_HST_CNT 
        mov     al, 02h 
        out     dx, al                  ; Force Host Control register's 
                                        ; kill bit to be set 
@@: 
        ; SMBUS host status must saved and  
        ; cleared from host controller 
 
        mov     dx, SMBUS_PORT + SMB_HST_STS 
        in      al, dx 
        and     al, 1dh 
        xchg    ah, al 
 
        or      ah, ah                  ; Check for errors  
                                        ; ZF=Success NZ=Error 
        ret 
 
waitForHostNotBusy      ENDP 
 
 
;---------------------------------------------------------------------- 
; Procedure waitForHostBusy 
;           This procedure will wait for the host busy bit to be set 
;           to verify that the SMBUS transaction actually starts within 
;           a maximum time frame. 
; 
; Inputs:   None 
; 
; Destroys: None 
; 
; Outputs:  None 
; 
; Assumes:  Stack is not available 
; 
;---------------------------------------------------------------------- 
waitForHostBusy      PROC	NEAR 
 
        mov     cx, 500 * MSEC          ; Set maximum wait time 
 
        mov     dx, SMBUS_PORT + SMB_HST_STS 
 
        jmp     @f                      ; Start loop with no time delay 
 
waitForRefresh: 
 
        in      al, PORTB_REFRESH       ; Get refresh toggle state 
        and     al, REFRESH_MASK        ; Isolate refresh toggle 
 
        cmp     al, ah                  ; Refresh detected? 
        je      waitForRefresh		; Loop if refresh not detected 
 
        mov     ah, al                  ; Save current refresh toggle state 
@@: 
        in      al, dx 
        test    al, 01h			; Check for host busy 
  
        loopz   waitForRefresh		; Repeat until timer expires 
                                        ;  or until host busy 
 
        ret 
 
waitForHostBusy      ENDP 
 
;---------------------------------------------------------------------- 
; Procedure wait1ms 
;           This procedure will wait for 1 msec. 
; 
; Inputs:   None 
; 
; Destroys: None 
; 
; Outputs:  None 
; 
; Assumes:  Stack is not available 
; 
;---------------------------------------------------------------------- 
wait1ms     PROC	NEAR 
 
        mov     cx, MSEC                ; Set wait time 
 
waitForRefreshDetect: 
 
        in      al, PORTB_REFRESH       ; Get refresh toggle state 
        and     al, REFRESH_MASK        ; Isolate refresh toggle 
 
        cmp     al, ah                  ; Refresh detected? 
        je      waitForRefreshDetect    ; Loop if refresh not detected 
 
        mov     ah, al                  ; Save current refresh toggle state 
  
        loop    waitForRefreshDetect    ; Repeat until timer expires 
 
        ret 
 
wait1ms     ENDP 
 
 
;---------------------------------------------------------------------- 
; Procedure cleanupHostErrors 
;           This procedure will check a SMBUS host controller for 
;           an incomplete transaction. If one exists, it is killed. 
;           Then all SMBUS host errors are cleared. 
; 
; Inputs:   None 
; 
; Destros:  None 
; 
; Outputs:  None 
; 
; Assumes:  Stack is not available 
; 
;---------------------------------------------------------------------- 
cleanupHostErrors       PROC NEAR 
 
        mov     dx, SMBUS_PORT + SMB_HST_STS 
        in      al, dx 
        test    al, 01h			; Test for host busy set 
 
        jz      @f                      ; Jump if host busy NOT set 
 
        mov     dx, SMBUS_PORT + SMB_HST_CNT 
        mov     al, 02h 
        out     dx, al                  ; Kill current SMBUS command 
@@: 
        mov     dx, SMBUS_PORT + SMB_HST_STS 
        mov     al, 0ffh		; AL = Mask for SMBUS errors 
        out     dx, al                  ; Clear all errors 
 
        ret 
 
cleanupHostErrors       ENDP 
 
;[]==================================================================[] 
; 
; Procedure Name: AOL_Init 
; 
;	This procedure will detect and initialize the Alert on LAN hardware. 
; 
; Input:    none 
; 
; Output:   AX = Watchdog Timer Value (seconds) 
; 
; Name	| Date		| Description 
; ----------------------------------------------------------------- 
; DNL	| 09/16/99	| Initial version for AOL2 
;[]==================================================================[] 
		Public	AOL_Init 
AOL_Init	Proc	Near 
 
		mov	ax,cs 
		mov	es,ax 
		mov	ds,ax 
 
		xor	al,al 
		ROm_Call	AOL_SaveConfigInfo	 
 
		Rom_Call	Find_CapeLookout 
		jc	NotDetected 
 
		Rom_Call	AOL_GetConfigInfo 
 		test	al,80h 
		jnz	short Global_Enable 
 
AOL2_Disable:						;R01 
		mov	cx,SW_HEARTBEAT_STOP 
		Rom_Call	SendSoftware_Message		 
 
		Rom_Call	Get_AOL_Add 
		mov	bh,ENABLE_CONFIGURATION_REG 
		Rom_Call	SmbByteDataRead 
		and	al,not 80h 
		Rom_Call	SmbByteDataWrite 
 
		jmp	NotDetected 
Global_Enable: 
 
        ; Verify that the Cape Lookout Watchdog Timer did not  
        ; expire after the PCI reset. 
 
		Rom_Call	Get_AOL_Add 
		mov	bh,MISC_STATUS_REG 
		Rom_Call	SmbByteDataRead 
		test	al,10h 
        	jz	short OSHungNotExist		; Jump if OSHung bit is NOT set 
AOL_Reset: 
		mov	cx,SW_HEARTBEAT_STOP 
		Rom_Call	SendSoftware_Message		 
 
		Rom_Call	Get_AOL_Add 
		mov	bh,ENABLE_CONFIGURATION_REG 
		Rom_Call	SmbByteDataRead 
		and	al,not 80h 
		Rom_Call	SmbByteDataWrite 
 
 		mov	bh,WATCHDOG_TIMER_REG 
        	mov	al, 01Eh 
		Rom_Call	SmbByteDataWrite 
 
		Rom_Call	Get_AOL_Add 
 		mov	bh,WATCHDOG_TIMER_REG 
        	mov	al, 01Eh 
		Rom_Call	SmbByteDataWrite 
 
;R01B		mov	dx,0CF9h 
;R01B		mov	al,6 
;R01B		out	dx,al 
;R01B 
;R01B		jmp	$ 
		jmp	short Set_AOL_Disable		;R01B 
OSHungNotExist: 
 
        ; Verify the EEPROM was successfully read and that the  
        ; checksum is valid.  
 
;R01 - start 
ifndef	NO_AOL2_EEPROM_CHECK 
		Rom_Call	Get_AOL_Add 
		mov	bh,EEPROM_CONTROL_REG 
		Rom_Call	SmbByteDataRead 
		test	al,0C0h 
;R01A        	jnz	short AOL_Reset		; Jump if either bit is set 
;R01B		jnz	short Set_AOL_Disable	;R01A 
        	jnz	short AOL_Reset		;R01B 
endif	;NO_AOL2_EEPROM_CHECK 
;R01 - end 
 
        ; Read the System ID word contained within the EEPROM 
        ; byte offset 0xF8. 
        ; (The low order byte of the System ID word is at byte offset  
        ; 0F8h and the high order byte of the System ID word is at byte  
        ; offset 0F9h.   
 
;R01		mov	cl,0F8h 
		mov	cl,0F9h			;R01 
		Rom_Call	Read_AOL_EEPROM 
		movzx	di,al  
		and	di,07fh			;R01 
		shl	di,8 
 
;R01		mov	cl,0F9h 
		mov	cl,0F8h			;R01 
		Rom_Call	Read_AOL_EEPROM 
		xor	ah,ah 
		or	di,ax 
;R01		and	di,07fh 
		cmp	di,REGISTERED_SYSTEM_ID 
		je	short MatchingSystemID 
 
UpdateSystemID: 
  
        ; Since the BIOS and Platform ID are invalid, then  
        ; CL_InitX() will write the corrected System ID with  
        ; the Global Disable Set using the low-level stack-less  
        ; routine EEpromByteWriteX().  
 
;R01 - start 
ifndef	NO_AOL2_EEPROM_CHECK 
		mov	cl,0F8h 
		mov	ax,REGISTERED_SYSTEM_ID 
		Rom_Call	Write_AOL_EEPROM 
 
		mov	ax,REGISTERED_SYSTEM_ID	OR 8000h 
		mov	al,ah 
		mov	cl,0F9h 
		Rom_Call	Write_AOL_EEPROM 
		 
		jmp	NotDetected    
endif	;NO_AOL2_EEPROM_CHECK 
;R01 - end 
MatchingSystemID: 
 
        ; Verify the Global Disable is not set 
 
;R01 - start 
ifndef	NO_AOL2_EEPROM_CHECK 
		mov	cl,0F9h 
		Rom_Call	Read_AOL_EEPROM 
		test	al,80h 
		jz	short AOL2_Enable 
 
Set_AOL_Disable:					;R01A 
		Rom_Call	AOL_GetConfigInfo 
		and	al,Not 80h			;Global Disable 
		Rom_Call	AOL_SaveConfigInfo 
 
		jmp	AOL2_Disable 
AOL2_Enable: 
endif	;NO_AOL2_EEPROM_CHECK 
;R01 - end 
 
        ; Set the ACPI state as PREBOOT 
 
		Rom_Call	Get_AOL_Add 
		mov	bh,APM_CONFIGURATION_REG 
		Rom_Call	SmbByteDataRead 
		or	al,00000111b		;Preboot 
		Rom_Call	SmbByteDataWrite 
 
        ; ****************************************** 
        ; Set implementation specific registers here 
        ; ****************************************** 
         
        ; REVISION_ID_REG is read only 
 
        ; EVENT_STATUS_REG should not be changes since it contains  
        ; valuable status info that may not have been reported 
 
        ; MISC_STATUS_REG should not be changes since it contains  
        ; valuable status info that may not have been reported 
 
        ; EVENT_POLARITY_REG is loaded from the EEPROM 
        ; This register can be programmed here 
 
        ; EVENT_MASK_REG is loaded from the EEPROM 
        ; This register can be programmed here 
 
        ; APM_CONFIGURATION_REG bits 3:0 are loaded from the EEPROM 
        ; This register can be programmed here 
         
        ; WATCHDOG_INFO_BYTE1_REG is used by the Alert on LAN BIOS 
        ; WATCHDOG_INFO_BYTE2_REG is used by the Alert on LAN BIOS 
 
        ; WATCHDOG_TIMER_REG is used by the Alert on LAN BIOS 
 
        ; HEARTBEAT_TIMER_REG is used by the Alert on LAN BIOS 
 
        ; RETRANSMISSION_TIMER_REG is used by the Alert on LAN BIOS 
 
		mov	bh,RETRANSMISSION_TIMER_REG 
		mov	al,02h 
		Rom_Call	SmbByteDataWrite 
 
        ; RETRANSMISSION_PACKET_COUNT_REG is used by the Alert on LAN BIOS 
 
		mov	bh,RETRANSMISSION_PACKET_COUNT_REG 
		mov	al,01h 
		Rom_Call	SmbByteDataWrite 
 
        ; CONTROL_REG  is loaded from EEPROM 
        ; This register can be programmed here 
 
        ; ENABLE_CONFIGURATION_REG bits 6:0 are loaded from the EEPROM 
        ; Bit 7 is used by the Alert on LAN BIOS         
        ; This register can be programmed here 
 
        ; SOFTWARE_STATUS_BYTE1_REG is used by the Alert on LAN BIOS 
        ; SOFTWARE_STATUS_BYTE2_REG is used by the Alert on LAN BIOS 
 
        ; EEPROM_ADDR_REG is used by the Alert on LAN BIOS 
        ; EEPROM_DATA_REG is used by the Alert on LAN BIOS 
        ; EEPROM_CONTROL_REG is used by the Alert on LAN BIOS 
 
        ; FORCED_ACTIONS_REG bit 4 is used by the Alert on LAN BIOS 
        ; Bits 7:5 and 3:0 are not used or not loaded by the EEPROM 
 
        ; SEQUENCE_NUM_REG is automatically reset to zero by reset and  
        ; is used by the Alert on LAN BIOS. 
 
        ; TEST_MODE_REG is not used by the Alert on LAN BIOS. 
 
        ; POLLING_DATA1 is not used by the Alert on LAN BIOS. 
        ; POLLING_DATA2 is not used by the Alert on LAN BIOS. 
        ; POLLING_DATA3 is not used by the Alert on LAN BIOS. 
        ; POLLING_DATA4 is not used by the Alert on LAN BIOS. 
 
        ; RAM_PAGE_MODE_REG BIT 0 is forced to zero to disable Ram  
        ; Page Mode in CL_InitX() and then is not used by the  
        ; Alert on LAN BIOS. 
 
		mov	bh,ENABLE_CONFIGURATION_REG 
		Rom_Call	SmbByteDataRead 
		or	al,80h 
		Rom_Call	SmbByteDataWrite 
 
		mov	cx,SW_SYSTEM_AWAKE 
		Rom_Call	SendSoftware_Message 
			 
 
        ; Convert the index from the Configuration Byte into  
        ; a Cape Lookout SMBus address 
 
		mov	cx,WD_FAIL_START_POST 
		Rom_Call	Update_WDMessage 
NotDetected: 
		jmp	AOL_Init_Exit 
 
AOL_Init	Endp 
 
;[]==================================================================[] 
; 
; Procedure Name: Find_CapeLookout 
; 
;       This routine checks the range of possible Cape Lookout  
;       addresses to find and clearly identify one Cape Lookout  
;       device. 
; 
;       The method for identifying Alert on LAN hardware is by  
;       attempting to read the revision ID that is contained in  
;       register 0x00 for all possible Cape Lookout SMBus  
;       addresses.  Since the Alert on LAN SMBus address range only  
;       includes four possibilities, the detection code will loop  
;       through all available addresses.  For every SMBus device that  
;       responds to this byte read, compare bits 7:3 with the  
;       Cape Lookout revision ID of 11011b.  A match on the revision  
;       ID will indicate a Cape Lookout device is available.   
; 
;       The Cape Lookout device has a special mode called Ram Page Mode  
;       that can prevent the reading of the revision ID in register 0.   
;       To correct for this issue, the detection code will also read  
;       the RAM Page Mode Register that also contains the revision ID.   
; 
; Input:    none 
; 
; Output:   al = Configuration Information Byte 
;	    CF = 1   AOL device is not exist 
;	    CF = 0   AOL device is exist 
; 
; Name	| Date		| Description 
; ----------------------------------------------------------------- 
; DNL	| 09/16/99	| Initial version for AOL2 
;[]==================================================================[] 
 
Find_CapeLookout	Proc	Near 
 
		shl	esp,16 
 
		lea	si,AOL_SMB_add 
Check_AOL_Device: 
		lodsb 
		cmp	al,0FFh 
		je	short AOL_device_End 
		 
		mov	bl,al 
		mov	bh,REVISION_ID_REG 
		Rom_Call	SmbByteDataRead 
		and	al,REVISION_MASK 
		cmp	al,REVISION_ID 
		je	short AOL_device_Found 
 
		mov	bh,RAM_PAGE_MODE_REG 
		Rom_Call	SmbByteDataRead 
		and	al,REVISION_MASK 
		cmp	al,REVISION_ID 
		je	short AOL_device_Found 
 
		lodsb 
		jmp	short Check_AOL_Device 
AOL_device_Found: 
		lodsb 
		and	al,0Fh 
ifdef	ICH 
		or	al,0C0h 
else	;ICH 
		or	al,080h 
endif	;ICH 
		Rom_Call	AOL_SaveConfigInfo 
		 
		shr	esp,16 
		clc 
		ret 
AOL_device_End: 
		shr	esp,16 
		stc 
		ret 
		 
Find_CapeLookout	Endp 
 
AOL_SMB_add: 
		db	0C4h,01h 
		db	0C6h,02h 
		db	0CCh,03h 
		db	0CEh,04h 
		db	-1 
 
Get_AOL_Add:	 
		mov	ebp,esp 
		shl	eax,16 
 
		Rom_Call	AOL_GetConfigInfo 
		and	al,0Fh 
 
		mov	bl,0C4h 
		cmp	al,01h 
		je	short @F 
 
		mov	bl,0C6h 
		cmp	al,02h 
		je	short @F 
 
		mov	bl,0CCh 
		cmp	al,03h 
		je	short @F 
 
		mov	bl,0CEh 
		cmp	al,04h 
		je	short @F 
 
		mov	bl,00h 
@@: 
		shr	eax,16 
		mov	esp,ebp 
		ret 
 
 
 
;[]==================================================================[] 
; 
; Procedure Name: Update_WDMessage 
; 
;       This procedure should be called periodically by the BIOS to  
;       update the watchdog status word. The watchdog status value  
;       will be sent if watchdog (TCO) timer expires before the next  
;       update or reload of the timer. Although the OEM may wish to  
;       specify custom watchdog byte combinations, the Alert on  
;       LAN BIOS software reserves the many combinations (see  
;       Alert on LAN documentation). 
; 
;       The low order byte of the Watchdog Message Word is used in  
;       the Cape Lookout Watchdog Information Byte 1. 
;       The high order byte of the Watchdog Message Word is used in 
;       the Cape Lookout Watchdog Information Byte 2.                 
; 
; Input:    CX = watchdog message word 
; 
; Output:   None 
; 
; Name	| Date		| Description 
; ----------------------------------------------------------------- 
; DNL	| 09/16/99	| Initial version for AOL2 
;[]==================================================================[] 
		Public	Update_WDMessage 
Update_WDMessage	Proc	Near 
 
		shl	esp,16 
		shl	ecx,16 
 
        	Rom_Call	AOL_GetConfigInfo 
		test	al,80h 
        	jz	short @F 
 
        ; Convert the index from the Configuration Byte into  
        ; a Cape Lookout SMBus address 
 
		Rom_Call	Get_AOL_Add 
 		mov	bh,WATCHDOG_INFO_BYTE1_REG 
		shr	ecx,16 
        	mov	al, cl 
		shl	ecx,8 
		Rom_Call	SmbByteDataWrite 
 
 		mov	bh,WATCHDOG_INFO_BYTE2_REG 
		shr	ecx,16 
        	mov	al, cl 
		Rom_Call	SmbByteDataWrite 
 
 		mov	bh,WATCHDOG_TIMER_REG 
        	mov	al,01Eh 
		Rom_Call	SmbByteDataWrite 
 
 		mov	bh,WATCHDOG_TIMER_REG 
        	mov	al,01Fh 
		Rom_Call	SmbByteDataWrite 
 
		mov	bh,HEARTBEAT_TIMER_REG 
		mov	al,03h 
		Rom_Call	SmbByteDataWrite 
 
		mov	bh,SOFTWARE_STATUS_BYTE1_REG 
		mov	ax,SW_HEARTBEAT_START OR 01h 
		Rom_Call	SmbByteDataWrite 
 
		mov	bh,SOFTWARE_STATUS_BYTE2_REG 
		mov	al,(SW_HEARTBEAT_START OR 01h ) shr 8 
		Rom_Call	SmbByteDataWrite 
 
		mov	bh,FORCED_ACTIONS_REG 
		mov	al,10h 
		Rom_Call	SmbByteDataWrite 
@@: 
		shr	esp,16 
		ret 
 
Update_WDMessage	ENDP 
 
;[]==================================================================[] 
; 
; Procedure Name: SendSoftware_Message 
; 
;       The procedure is used to force a network packet containing the 
;       software message word to be sent via the Alert on LAN device  
;       and the network controller.  
; 
;       The low order byte of software message word is used in software  
;       status byte 1 (0x0E) and the high order byte of the software  
;       message word is used in software status byte 2 (0x0F).   
; 
;       The procedure uses the Cape Lookout Force Software Event 
;	(FRC_SWE) to force Cape Lookout to send a network packet.   
; 
; Input:    CX = software message word 
; 
; Output:   None 
; 
; Name	| Date		| Description 
; ----------------------------------------------------------------- 
; DNL	| 09/16/99	| Initial version for AOL2 
;[]==================================================================[] 
		Public	SendSoftware_Message 
SendSoftware_Message	Proc	Near 
 
		shl	esp,16 
 
		shl	ecx,16 
		Rom_Call	Get_AOL_Add 
		mov	bh,SOFTWARE_STATUS_BYTE1_REG 
		shr	ecx,16 
		mov	al,cl 
		shl	ecx,8 
		Rom_Call	SmbByteDataWrite 
 
		shr	ecx,16 
		mov	bh,SOFTWARE_STATUS_BYTE2_REG 
		mov	al,cl 
		Rom_Call	SmbByteDataWrite 
 
		mov	bh,FORCED_ACTIONS_REG 
		mov	al,10h 
		Rom_Call	SmbByteDataWrite 
 
		shr	esp,16 
		ret	 
 
SendSoftware_Message	ENDP 
 
;[]==================================================================[] 
; 
; Procedure Name: Read_AOL_EEPROM	 
; 
;           This routine will read a specified byte from the EEPROM. 
; 
; Input:    CL = EEPROM register to read 
; 
; Output:   AL = EEPROM byte register data 
; 
; Name	| Date		| Description 
; ----------------------------------------------------------------- 
; DNL	| 09/16/99	| Initial version for AOL2 
;[]==================================================================[] 
		Public	Read_AOL_EEPROM 
Read_AOL_EEPROM	Proc	Near 
 
		shl	esp,16 
 
        ;* Read Control register - Verify that EEC_BUSY and EEC_LOAD  
        ;                          bits are cleared 
 
		shl	ecx,16 
 
		Rom_Call	Get_AOL_Add 
        	mov	bh,EEPROM_CONTROL_REG 
		Rom_Call	SmbByteDataRead 
        	and	al,90h 
		mov	al,0FFh 
        	jnz	short @F 
 
        ;* Write Address register with desired EEPROM address 
			 
		shr	ecx,16 
		mov	bh,EEPROM_ADDR_REG 
        	mov	al,cl 
		Rom_Call	SmbByteDataWrite 
 
        ;* Write Control register with Read command 
 
	        mov	bh,EEPROM_CONTROL_REG 
	        mov	al,READ_COMMAND 
		Rom_Call	SmbByteDataWrite 
 
        ;* Read Control register - Wait for EEC_BUSY to clear 
 
		Rom_Call	EEpromWaitForNotBusy 
 
        ;* Read Data register to get EEPROM data 
 
        	mov	bh,EEPROM_DATA_REG 
		Rom_Call	SmbByteDataRead 
@@: 
		shr	esp,16 
		ret 
 
Read_AOL_EEPROM	Endp 
 
 
;[]==================================================================[] 
; 
; Procedure Name: Write_AOL_EEPROM	 
; 
;           This routine will write a specified byte to the EEPROM. 
; 
; Input:    CL = EEPROM register to write 
;	    AL = EEPROM byte register data 
; 
; Output:   None 
; 
; Name	| Date		| Description 
; ----------------------------------------------------------------- 
; DNL	| 09/16/99	| Initial version for AOL2 
;[]==================================================================[] 
		Public	Write_AOL_EEPROM 
Write_AOL_EEPROM	Proc	Near 
 
		shl	esp,16 
		 
        ;* Read Control register - Verify that EEC_BUSY and EEC_LOAD  
        ;                          bits are cleared 
		mov	ch,al 
		shl	ecx,16 
	 
		Rom_Call	Get_AOL_Add 
        	mov	bh,EEPROM_CONTROL_REG 
		Rom_Call	SmbByteDataRead 
        	and	al,90h 
        	jnz	@F 
 
        ;* Write Address register with Write Enable Address 
 
        	mov	bh,EEPROM_ADDR_REG 
		mov	al,WRITE_ENABLE_ADDRESS 
		Rom_Call	SmbByteDataWrite 
 
        ;* Write Control register with Write Enable Command 
 
        	mov	bh,EEPROM_CONTROL_REG 
		mov	al,WRITE_ENABLE_COMMAND 
		Rom_Call	SmbByteDataWrite 
 
        ;* Read Control register - Wait for EEC_BUSY to clear 
 
		mov	eax,ecx 
		Rom_Call	EEpromWaitForNotBusy 
 
        ;* Write Adress register with desired EEPROM address 
 
		mov	ecx,eax 
		mov	bh,EEPROM_ADDR_REG 
		shr	eax,16 
		Rom_Call	SmbByteDataWrite 
 
        ;* Write Data register wih desired write data 
 
		mov	bh,EEPROM_DATA_REG 
        	shr	ecx,24 
		mov	al,cl 
		Rom_Call	SmbByteDataWrite 
 
        ;* Write Control register with the Write command 
 
        	mov	bh,EEPROM_CONTROL_REG 
		mov	al,WRITE_COMMAND 
		Rom_Call	SmbByteDataWrite 
 
        ;* Read Control register - Wait for EEC_BUSY to clear 
 
		Rom_Call	EEpromWaitForNotBusy 
 
        ;* Write Address register with Write Disable Address 
 
        	mov	bh,EEPROM_ADDR_REG 
		mov	al,WRITE_DISABLE_ADDRESS 
		Rom_Call	SmbByteDataWrite 
 
        ;* Write Control register with Write Disable Command  
 
        	mov	bh,EEPROM_CONTROL_REG 
		mov	al,WRITE_DISABLE_COMMAND 
		Rom_Call	SmbByteDataWrite 
 
        ;* Read Control register - Wait for EEC_BUSY to clear 
 
		Rom_Call	EEpromWaitForNotBusy 
 
		shr	esp,16 
 
		ret 
Write_AOL_EEPROM	Endp 
 
 
;[]==================================================================[] 
; 
; Procedure Name: EEpromWaitForNotBusy 
; 
;       This procedure will wait a set maximum time for the EEPROM 
;       busy bit to clear indicating the last command has successfully  
;       completed.   
; 
;       This procedure is not designed to be called externally.  
;       It is used for code support and is intended for use by  
;       higher level stack-less EEprom routines within this file. 
 
; Input:    None 
; 
; Output:   None 
; 
; Name	| Date		| Description 
; ----------------------------------------------------------------- 
; DNL	| 09/16/99	| Initial version for AOL2 
;[]==================================================================[] 
EEpromWaitForNotBusy	PROC    Near 
 
		mov	dr1,esp 
        ;* Read Control register - Wait for EEC_BUSY to clear 
 
		mov	cx,100h 
@@: 
		shl	ecx,16 
	        mov	bh,EEPROM_CONTROL_REG 
		Rom_Call	SmbByteDataRead 
		shr	ecx,16 
        	test	al,10h 
 		loopnz	short @B 
 
		mov	esp,dr1 
 		ret 
 
EEpromWaitForNotBusy	ENDP 
 
;[]==================================================================[] 
; 
; Procedure Name: AOL_SaveConfigInfo 
; 
;	This routine is called by the Alert on LAN BIOS to store one byte of  
;	configuration information. 
; 
;       Bit 7   Global Enable State 
;               1 = Enabled  
;               0 = Disabled 
;       Bit 6   ICH Detected 
;               1 = ICH detected 
;               0 = ICH not detected 
;       Bit 5:4 Unused  
;       Bit 3-0 Encoded address for the Alert on LAN device 
;		0000 = No AOL device 
;		0001 = 0x1100010b	(C4h) 
;		0010 = 0x1100011b	(C6h) 
;		0011 = 0x1100110b	(CCh) 
;		0100 = 0x1100111b	(CEh) 
; 
; Input:    AL = Configuration Information Byte 
; 
; Output:   None 
; 
; Name	| Date		| Description 
; ----------------------------------------------------------------- 
; DNL	| 09/16/99	| Initial version for AOL2 
;[]==================================================================[] 
		Public	AOL_SaveConfigInfo 
AOL_SaveConfigInfo	Proc	Near 
 
		xchg	al,ah 
		mov	al,AOL_CMOS OR 80h 
		out	70h,al 
		NEWIODELAY 
		xchg	al,ah 
		out	71h,al 
		NEWIODELAY 
 
		ret 
 
AOL_SaveConfigInfo	Endp 
 
;[]==================================================================[] 
; 
; Procedure Name: AOL_GetConfigInfo 
; 
;	This routine is called by the Alert on LAN BIOS to get one byte of  
;	configuration information. 
; 
;       Bit 7   Global Enable State 
;               1 = Enabled  
;               0 = Disabled 
;       Bit 6   ICH Detected 
;               1 = ICH detected 
;               0 = ICH not detected 
;       Bit 5:4 Unused  
;       Bit 3-0 Encoded address for the Alert on LAN device 
;		0000 = No AOL device 
;		0001 = 0x1100010b	(C4h) 
;		0010 = 0x1100011b	(C6h) 
;		0011 = 0x1100110b	(CCh) 
;		0100 = 0x1100111b	(CEh) 
; 
; Input:    None 
; 
; Output:   AL = Configuration Information Byte 
; 
; Name	| Date		| Description 
; ----------------------------------------------------------------- 
; DNL	| 09/16/99	| Initial version for AOL2 
;[]==================================================================[] 
		Public	AOL_GetConfigInfo 
AOL_GetConfigInfo	Proc	Near 
 
		mov	al,AOL_CMOS OR 80h 
		out	70h,al 
		NEWIODELAY 
		in	al,71h 
 
		ret 
 
AOL_GetConfigInfo	Endp 
endif	;AOL_SUPPORT