Home | History | Annotate | Download | only in Ia32
      1 #------------------------------------------------------------------------------
      2 #
      3 # Copyright (c) 2014, 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 # Module Name:
     13 #
     14 #  PeiCoreEntry.S
     15 #
     16 # Abstract:
     17 #
     18 #   Find and call SecStartup
     19 #
     20 #------------------------------------------------------------------------------
     21 
     22 ASM_GLOBAL ASM_PFX(CallPeiCoreEntryPoint)
     23 ASM_PFX(CallPeiCoreEntryPoint):
     24   #
     25   # Obtain the hob list pointer
     26   #
     27   movl    0x4(%esp), %eax
     28   #
     29   # Obtain the stack information
     30   #   ECX: start of range
     31   #   EDX: end of range
     32   #
     33   movl    0x8(%esp), %ecx
     34   movl    0xC(%esp), %edx
     35 
     36   #
     37   # Platform init
     38   #
     39   pushal
     40   pushl %edx
     41   pushl %ecx
     42   pushl %eax
     43   call  ASM_PFX(PlatformInit)
     44   popl  %eax
     45   popl  %eax
     46   popl  %eax
     47   popal
     48 
     49   #
     50   # Set stack top pointer
     51   #
     52   movl    %edx, %esp
     53 
     54   #
     55   # Push the hob list pointer
     56   #
     57   pushl   %eax
     58 
     59   #
     60   # Save the value
     61   #   ECX: start of range
     62   #   EDX: end of range
     63   #
     64   movl    %esp, %ebp
     65   pushl   %ecx
     66   pushl   %edx
     67 
     68   #
     69   # Push processor count to stack first, then BIST status (AP then BSP)
     70   #
     71   movl    $1, %eax
     72   cpuid
     73   shr     $16, %ebx
     74   andl    $0x000000FF, %ebx
     75   cmp     $1, %bl
     76   jae     PushProcessorCount
     77 
     78   #
     79   # Some processors report 0 logical processors.  Effectively 0 = 1.
     80   # So we fix up the processor count
     81   #
     82   inc     %ebx
     83 
     84 PushProcessorCount:
     85   pushl   %ebx
     86 
     87   #
     88   # We need to implement a long-term solution for BIST capture.  For now, we just copy BSP BIST
     89   # for all processor threads
     90   #
     91   xorl    %ecx, %ecx
     92   movb    %bl, %cl
     93 PushBist:
     94   movd    %mm0, %eax
     95   pushl   %eax
     96   loop    PushBist
     97 
     98   # Save Time-Stamp Counter
     99   movd  %mm5, %eax
    100   pushl %eax
    101 
    102   movd  %mm6, %eax
    103   pushl %eax
    104 
    105   #
    106   # Pass entry point of the PEI core
    107   #
    108   movl    $0xFFFFFFE0, %edi
    109   pushl   %ds:(%edi)
    110 
    111   #
    112   # Pass BFV into the PEI Core
    113   #
    114   movl    $0xFFFFFFFC, %edi
    115   pushl   %ds:(%edi)
    116 
    117   #
    118   # Pass stack size into the PEI Core
    119   #
    120   movl    -4(%ebp), %ecx
    121   movl    -8(%ebp), %edx
    122   pushl   %ecx       # RamBase
    123 
    124   subl    %ecx, %edx
    125   pushl   %edx       # RamSize
    126 
    127   #
    128   # Pass Control into the PEI Core
    129   #
    130   call ASM_PFX(SecStartup)
    131