• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#------------------------------------------------------------------------------
2#
3# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
4# This program and the accompanying materials
5# are licensed and made available under the terms and conditions of the BSD License
6# which accompanies this distribution.  The full text of the license may be found at
7# http://opensource.org/licenses/bsd-license.php.
8#
9# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11#
12# Abstract:
13#
14#   Provide FSP helper function.
15#
16#------------------------------------------------------------------------------
17
18#
19# FspInfoHeaderRelativeOff is patched during build process and initialized to offset of the  AsmGetFspBaseAddress
20# from the FSP Info header.
21#
22ASM_GLOBAL ASM_PFX(FspInfoHeaderRelativeOff)
23ASM_PFX(FspInfoHeaderRelativeOff):
24   #
25   # This value will be pached by the build script
26   #
27   .long    0x012345678
28
29#
30# Returns FSP Base Address.
31#
32# This function gets the FSP Info Header using relative addressing and returns the FSP Base from the header structure
33#
34ASM_GLOBAL ASM_PFX(AsmGetFspBaseAddress)
35ASM_PFX(AsmGetFspBaseAddress):
36   mov    $AsmGetFspBaseAddress, %eax
37   sub    FspInfoHeaderRelativeOff, %eax
38   add    $0x01C, %eax
39   mov    (%eax), %eax
40   ret
41
42#
43# No stack counter part of AsmGetFspBaseAddress. Return address is in edi.
44#
45ASM_GLOBAL ASM_PFX(AsmGetFspBaseAddressNoStack)
46ASM_PFX(AsmGetFspBaseAddressNoStack):
47   mov    $AsmGetFspBaseAddress, %eax
48   sub    FspInfoHeaderRelativeOff, %eax
49   add    $0x01C, %eax
50   mov    (%eax), %eax
51   jmp    *%edi
52
53#
54# Returns FSP Info Header.
55#
56# This function gets the FSP Info Header using relative addressing and returns it
57#
58ASM_GLOBAL ASM_PFX(AsmGetFspInfoHeader)
59ASM_PFX(AsmGetFspInfoHeader):
60   mov    $AsmGetFspBaseAddress, %eax
61   sub    FspInfoHeaderRelativeOff, %eax
62   ret
63
64#
65# No stack counter part of AsmGetFspInfoHeader. Return address is in edi.
66#
67ASM_GLOBAL ASM_PFX(AsmGetFspInfoHeaderNoStack)
68ASM_PFX(AsmGetFspInfoHeaderNoStack):
69   mov    $AsmGetFspBaseAddress, %eax
70   sub    FspInfoHeaderRelativeOff, %eax
71   jmp    *%edi
72