OVMF ResetVector: Modify interface with SEC module

Previously it was:
  ESI/RSI - SEC Core entry point
  EDI/RDI - PEI Core entry point
  EBP/RBP - Start of BFV

Now it is:
  RAX/EAX  Initial value of the EAX register
           (BIST: Built-in Self Test)
  DI       'BP': boot-strap processor, or
           'AP': application processor
  RBP/EBP  Address of Boot Firmware Volume (BFV)

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9571 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jljusten
2009-12-16 23:29:15 +00:00
parent 8861fc792c
commit 7a55c43b07
21 changed files with 479 additions and 333 deletions

View File

@@ -1,6 +1,8 @@
;------------------------------------------------------------------------------
; @file
; Transition from 32 bit flat protected mode into 64 bit flat protected mode
;
; Copyright (c) 2008, Intel Corporation
; Copyright (c) 2008 - 2009, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -9,18 +11,13 @@
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; 32FlatTo64Flat.asm
;
; Abstract:
;
; Transition from 32 bit flat protected mode into 64 bit flat protected mode
;
;------------------------------------------------------------------------------
BITS 32
;
; Modified: EAX
;
Transition32FlatTo64Flat:
mov eax, ((ADDR_OF_START_OF_RESET_CODE & ~0xfff) - 0x1000)
@@ -43,9 +40,7 @@ Transition32FlatTo64Flat:
BITS 64
jumpTo64BitAndLandHere:
writeToSerialPort '6'
writeToSerialPort '4'
writeToSerialPort ' '
debugShowPostCode POSTCODE_64BIT_MODE
OneTimeCallRet Transition32FlatTo64Flat

View File

@@ -1,6 +1,8 @@
;------------------------------------------------------------------------------
; @file
; Search for the Boot Firmware Volume (BFV) base address
;
; Copyright (c) 2008, Intel Corporation
; Copyright (c) 2008 - 2009, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -9,14 +11,6 @@
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; SearchForBfvBase.asm
;
; Abstract:
;
; Search for the Boot FV Base Address
;
;------------------------------------------------------------------------------
;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \
@@ -29,21 +23,21 @@
BITS 32
;
; Input:
; None
; Modified: EAX, EBX
; Preserved: EDI, ESP
;
; Output:
; EBP - BFV Base Address
;
; Modified:
; EAX, EBX
; @param[out] EBP Address of Boot Firmware Volume (BFV)
;
Flat32SearchForBfvBase:
xor eax, eax
searchingForBfvHeaderLoop:
;
; We check for a firmware volume at every 4KB address in the top 16MB
; just below 4GB. (Addresses at 0xffHHH000 where H is any hex digit.)
;
sub eax, 0x1000
cmp eax, 0xff800000
cmp eax, 0xff000000
jb searchedForBfvHeaderButNotFound
;
@@ -70,19 +64,23 @@ searchingForBfvHeaderLoop:
jmp searchedForBfvHeaderAndItWasFound
searchedForBfvHeaderButNotFound:
writeToSerialPort '!'
xor eax, eax
;
; Hang if the SEC entry point was not found
;
debugShowPostCode POSTCODE_BFV_NOT_FOUND
;
; 0xbfbfbfbf in the EAX & EBP registers helps signal what failed
; for debugging purposes.
;
mov eax, 0xBFBFBFBF
mov ebp, eax
jmp $
searchedForBfvHeaderAndItWasFound:
mov ebp, eax
writeToSerialPort 'B'
writeToSerialPort 'F'
writeToSerialPort 'V'
writeToSerialPort ' '
or ebp, ebp
jz $
debugShowPostCode POSTCODE_BFV_FOUND
OneTimeCallRet Flat32SearchForBfvBase

View File

@@ -1,6 +1,8 @@
;------------------------------------------------------------------------------
; @file
; Search for the SEC Core entry point
;
; Copyright (c) 2008, Intel Corporation
; Copyright (c) 2008 - 2009, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -9,40 +11,26 @@
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; SearchForSecAndPeiEntry.asm
;
; Abstract:
;
; Search for the SEC Core and PEI Core entry points
;
;------------------------------------------------------------------------------
BITS 32
%define EFI_FV_FILETYPE_SECURITY_CORE 0x03
%define EFI_FV_FILETYPE_PEI_CORE 0x04
;
; Input:
; EBP - BFV Base Address
; Modified: EAX, EBX, ECX, EDX
; Preserved: EDI, EBP, ESP
;
; Output:
; ESI - SEC Core Entry Point Address (or 0 if not found)
; EDI - PEI Core Entry Point Address (or 0 if not found)
; @param[in] EBP Address of Boot Firmware Volume (BFV)
; @param[out] ESI SEC Core Entry Point Address
;
; Modified:
; EAX, EBX, ECX
;
Flat32SearchForSecAndPeiEntries:
Flat32SearchForSecEntryPoint:
;
; Initialize EBP and ESI to 0
;
xor ebx, ebx
mov esi, ebx
mov edi, ebx
;
; Pass over the BFV header
@@ -50,7 +38,7 @@ Flat32SearchForSecAndPeiEntries:
mov eax, ebp
mov bx, [ebp + 0x30]
add eax, ebx
jc doneSeachingForSecAndPeiEntries
jc secEntryPointWasNotFound
jmp searchingForFfsFileHeaderLoop
@@ -59,17 +47,17 @@ moveForwardWhileSearchingForFfsFileHeaderLoop:
; Make forward progress in the search
;
inc eax
jc doneSeachingForSecAndPeiEntries
jc secEntryPointWasNotFound
searchingForFfsFileHeaderLoop:
test eax, eax
jz doneSeachingForSecAndPeiEntries
jz secEntryPointWasNotFound
;
; Ensure 8 byte alignment
;
add eax, 7
jc doneSeachingForSecAndPeiEntries
jc secEntryPointWasNotFound
and al, 0xf8
;
@@ -82,7 +70,6 @@ searchingForFfsFileHeaderLoop:
and ecx, 0x00ffffff
or ecx, ecx
jz moveForwardWhileSearchingForFfsFileHeaderLoop
; jmp $
add ecx, eax
jz jumpSinceWeFoundTheLastFfsFile
jc moveForwardWhileSearchingForFfsFileHeaderLoop
@@ -91,53 +78,41 @@ jumpSinceWeFoundTheLastFfsFile:
;
; There seems to be a valid file at eax
;
mov bl, [eax + 0x12] ; BL - File Type
cmp bl, EFI_FV_FILETYPE_PEI_CORE
je fileTypeIsPeiCore
cmp bl, EFI_FV_FILETYPE_SECURITY_CORE
cmp byte [eax + 0x12], EFI_FV_FILETYPE_SECURITY_CORE ; Check File Type
jne readyToTryFfsFileAtEcx
fileTypeIsSecCore:
callEdx GetEntryPointOfFfsFileReturnEdx
OneTimeCall GetEntryPointOfFfsFile
test eax, eax
jz readyToTryFfsFileAtEcx
mov esi, eax
jmp readyToTryFfsFileAtEcx
fileTypeIsPeiCore:
callEdx GetEntryPointOfFfsFileReturnEdx
test eax, eax
jz readyToTryFfsFileAtEcx
mov edi, eax
jnz doneSeachingForSecEntryPoint
readyToTryFfsFileAtEcx:
;
; Try the next FFS file at ECX
;
mov eax, ecx
jmp searchingForFfsFileHeaderLoop
doneSeachingForSecAndPeiEntries:
secEntryPointWasNotFound:
xor eax, eax
doneSeachingForSecEntryPoint:
mov esi, eax
test esi, esi
jnz secCoreEntryPointWasFound
writeToSerialPort '!'
secCoreEntryPointWasNotFound:
;
; Hang if the SEC entry point was not found
;
debugShowPostCode POSTCODE_SEC_NOT_FOUND
jz $
secCoreEntryPointWasFound:
writeToSerialPort 'S'
writeToSerialPort 'E'
writeToSerialPort 'C'
writeToSerialPort ' '
test edi, edi
jnz peiCoreEntryPointWasFound
writeToSerialPort '!'
peiCoreEntryPointWasFound:
writeToSerialPort 'P'
writeToSerialPort 'E'
writeToSerialPort 'I'
writeToSerialPort ' '
OneTimeCallRet Flat32SearchForSecAndPeiEntries
debugShowPostCode POSTCODE_SEC_FOUND
OneTimeCallRet Flat32SearchForSecEntryPoint
%define EFI_SECTION_PE32 0x10
@@ -152,7 +127,7 @@ peiCoreEntryPointWasFound:
; Modified:
; EBX
;
GetEntryPointOfFfsFileReturnEdx:
GetEntryPointOfFfsFile:
test eax, eax
jz getEntryPointOfFfsFileErrorReturn
add eax, 0x18 ; EAX = Start of section
@@ -217,6 +192,5 @@ getEntryPointOfFfsFileErrorReturn:
mov eax, 0
getEntryPointOfFfsFileReturn:
jmp edx
OneTimeCallRet GetEntryPointOfFfsFile