summaryrefslogtreecommitdiff
path: root/Core/EM/Sredir/SredirBootFail.asm
blob: b8433b9c64de547771b23b7c0f8a141ed7552cdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
;**********************************************************************
;**********************************************************************
;**                                                                  **
;**        (C)Copyright 1985-2014, American Megatrends, Inc.         **
;**                                                                  **
;**                       All Rights Reserved.                       **
;**                                                                  **
;**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093        **
;**                                                                  **
;**                       Phone: (770)-246-8600                      **
;**                                                                  **
;**********************************************************************
;**********************************************************************

;**********************************************************************
; $Header: /Alaska/SOURCE/Modules/Legacy Serial Redirection/SredirBootFail.asm 3     6/16/14 7:40a Divyac $
;
; $Revision: 3 $
;
; $Date: 6/16/14 7:40a $
;**********************************************************************
; Revision History
; ----------------
; $Log: /Alaska/SOURCE/Modules/Legacy Serial Redirection/SredirBootFail.asm $
; 
; 3     6/16/14 7:40a Divyac
; [TAG]  		EIP172120
; [Category]  	Bug Fix
; [Severity]  	Important
; [Symptom]  	 Redirection After BIOS POST feature is not working.
; [RootCause]  	The flag Indicating whether redirection can happen or not
; is not updated.
; 1)The way of Defining signatures and Comparing Signatures are
; different.
; 2)The variables defined in CSM16 files( SreDirBin_Base_Segadd,
; SreDirBin_Base_Offadd, Flag ) are accessed wrongly.
; 
; [Solution]  	a) The pointer used to check for signatures must be
; UINT32* or we should define signatures byte by byte (db
; '$','S','B','F', db '$','S','B','C'). so changed the way of defining
; Signatures in CSM16 files from dd '$SBF' to db '$','S','B','F'.
; b) Variables should be accessed using OFFSET Keyword.
; [Files]  		SerialBootCall.asm, SerialBootFail.asm
; 
; 2     5/29/13 8:54a Srikantakumarp
; [TAG]  		EIP122394
; [Category]  	Bug Fix
; [Severity]  	Normal
; [Symptom]  	0xE0000~0xEFFFF was overwrite by Legacy Serial Redirection
; module.
; [RootCause]  	LegacySerialRedirection driver assumed that
; SerialBootcall.asm will be the first entry in CsmOem16Functions which
; was wrong.
; [Solution]  	Added a Signature check code for SerialBootCall.asm and
; SredirBootFail.asm before it writes to the memory location
; 0xE0000~0xEFFFF.
; [Files]  		LegacySredir.c, SerialBootCall.asm, SredirBootFail.asm
; 
; 1     2/27/12 5:58a Jittenkumarp
; [TAG]  		EIP81401
; [Category]  	New Feature
; [Description]  	Select Redirection After BIOS POST as BootLoader in
; serial redirection, the behaviour is made same as Core8. 
; [Files]  		LegacySredir.c, LegacySredir.mak, LegacySredir.sdl,
; LegacySredir_Setup.c, LegacySredir.h ,SerialBootCall.asm,
; SredirBootFail.asm,GRAPHREDIR.ASM, INT10REDIR.ASM, OR_MOD.EQU,
; SREDIR.ASM
; 
;**********************************************************************
;<AMI_FHDR_START>
;
; Name: SredirBootFail.asm
;
; Description: Call Back function registered for CSM16_OEM_ON_BOOT_FAIL
;                 
;<AMI_FHDR_END>
;**********************************************************************


;----------------------------------------------------------------------------
;       INCLUDE FILES
;----------------------------------------------------------------------------

        include token.equ
       
;----------------------------------------------------------------------------
;       EXTERNS USED
;----------------------------------------------------------------------------
       
.586p
OEM16_CSEG SEGMENT PARA PUBLIC 'CODE' USE16
        ASSUME cs:OEM16_CSEG, ds:OEM16_CSEG
;-------------------------------------------------------------------------
        PUBLIC EnableLegcaySredirModuleStart
EnableLegcaySredirModuleStart LABEL BYTE
        jmp     SHORT EnableLegcaySredirCsm16Api
        db      '$','S','B','F'
SreDirBin_Base_Segadd       dw      0000h ;SreDirBin Segement Address
SreDirBin_Base_Offadd       dw      0000h ;SreDirbin offset Address
Flag                        dw      0000h


;----------------------------------------------------------------------------
; IMPORTANT: Do not put any OEM/CHIPSET code above this, the above code and
;            and data are at fixed locations.
;----------------------------------------------------------------------------

;-------------------------------------------------------------------------
;                      LEGACYSREDIR_CSM16_API_Start
;----------------------------------------------------------------------------
; This routine is implementation of the CSM16 API #6.
; Input:        BX - SreDirBin Segment add
;               BX - SreDirBin  Offset add
;               AX - Flag offset value
;
; Output:       None
;
; Register Usage: Do not destroy any register 
;
;----------------------------------------------------------------------------

EnableLegcaySredirCsm16Api  PROC FAR PUBLIC
; Adjust current IP so that the data offsets are valid
      
        call    $+3             ; Push curent IP
        pop     bx              ; Get current IP in BX
        shr     bx, 4
        mov     ax, cs          ; Always x000h
        add     ax, bx          ; New CS
        push    ax
        push    newOffset-EnableLegcaySredirModuleStart
        retf                    ; Execute from new CS:IP

newOffset:
    
        push    bx
        push    si
        push    ax
        push    es
        push    0
        pop     es
        mov     si, offset SreDirBin_Base_Segadd
        mov     bx, word ptr cs:[si]
        mov     es, bx
        mov     si, offset SreDirBin_Base_Offadd
        mov     bx, word ptr cs:[si]
        mov     si, offset Flag
        mov     ax, word ptr cs:[si]
        mov     si, ax
        add     si, bx
        mov     al, 00h
        mov     byte ptr es:[si], al 

        pop     es
        pop     ax
        pop     si 
        pop     bx

        retf

EnableLegcaySredirCsm16Api  ENDP

OEM16_CSEG ENDS

END

;**********************************************************************
;**********************************************************************
;**                                                                  **
;**        (C)Copyright 1985-2014, American Megatrends, Inc.         **
;**                                                                  **
;**                       All Rights Reserved.                       **
;**                                                                  **
;**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093        **
;**                                                                  **
;**                       Phone: (770)-246-8600                      **
;**                                                                  **
;**********************************************************************
;**********************************************************************