Jeff Fan | 3e8ad6b | 2016-07-20 21:56:58 +0800 | [diff] [blame] | 1 | /** @file
|
| 2 | CPU MP Initialize Library common functions.
|
| 3 |
|
| 4 | Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
| 5 | This program and the accompanying materials
|
| 6 | are licensed and made available under the terms and conditions of the BSD License
|
| 7 | which accompanies this distribution. The full text of the license may be found at
|
| 8 | http://opensource.org/licenses/bsd-license.php
|
| 9 |
|
| 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
| 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
| 12 |
|
| 13 | **/
|
| 14 |
|
| 15 | #include "MpLib.h"
|
| 16 |
|
| 17 |
|
| 18 | /**
|
| 19 | MP Initialize Library initialization.
|
| 20 |
|
| 21 | This service will allocate AP reset vector and wakeup all APs to do APs
|
| 22 | initialization.
|
| 23 |
|
| 24 | This service must be invoked before all other MP Initialize Library
|
| 25 | service are invoked.
|
| 26 |
|
| 27 | @retval EFI_SUCCESS MP initialization succeeds.
|
| 28 | @retval Others MP initialization fails.
|
| 29 |
|
| 30 | **/
|
| 31 | EFI_STATUS
|
| 32 | EFIAPI
|
| 33 | MpInitLibInitialize (
|
| 34 | VOID
|
| 35 | )
|
| 36 | {
|
Jeff Fan | f7f85d8 | 2016-07-20 22:56:09 +0800 | [diff] [blame^] | 37 | MP_ASSEMBLY_ADDRESS_MAP AddressMap;
|
| 38 | UINTN ApResetVectorSize;
|
| 39 |
|
| 40 | AsmGetAddressMap (&AddressMap);
|
| 41 | ApResetVectorSize = AddressMap.RendezvousFunnelSize + sizeof (MP_CPU_EXCHANGE_INFO);
|
| 42 | return EFI_SUCCESS;
|
Jeff Fan | 3e8ad6b | 2016-07-20 21:56:58 +0800 | [diff] [blame] | 43 | }
|
| 44 |
|
| 45 | /**
|
| 46 | Gets detailed MP-related information on the requested processor at the
|
| 47 | instant this call is made. This service may only be called from the BSP.
|
| 48 |
|
| 49 | @param[in] ProcessorNumber The handle number of processor.
|
| 50 | @param[out] ProcessorInfoBuffer A pointer to the buffer where information for
|
| 51 | the requested processor is deposited.
|
| 52 | @param[out] HealthData Return processor health data.
|
| 53 |
|
| 54 | @retval EFI_SUCCESS Processor information was returned.
|
| 55 | @retval EFI_DEVICE_ERROR The calling processor is an AP.
|
| 56 | @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.
|
| 57 | @retval EFI_NOT_FOUND The processor with the handle specified by
|
| 58 | ProcessorNumber does not exist in the platform.
|
| 59 | @retval EFI_NOT_READY MP Initialize Library is not initialized.
|
| 60 |
|
| 61 | **/
|
| 62 | EFI_STATUS
|
| 63 | EFIAPI
|
| 64 | MpInitLibGetProcessorInfo (
|
| 65 | IN UINTN ProcessorNumber,
|
| 66 | OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer,
|
| 67 | OUT EFI_HEALTH_FLAGS *HealthData OPTIONAL
|
| 68 | )
|
| 69 | {
|
| 70 | return EFI_UNSUPPORTED;
|
| 71 | }
|
| 72 | /**
|
| 73 | This return the handle number for the calling processor. This service may be
|
| 74 | called from the BSP and APs.
|
| 75 |
|
| 76 | @param[out] ProcessorNumber Pointer to the handle number of AP.
|
| 77 | The range is from 0 to the total number of
|
| 78 | logical processors minus 1. The total number of
|
| 79 | logical processors can be retrieved by
|
| 80 | MpInitLibGetNumberOfProcessors().
|
| 81 |
|
| 82 | @retval EFI_SUCCESS The current processor handle number was returned
|
| 83 | in ProcessorNumber.
|
| 84 | @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.
|
| 85 | @retval EFI_NOT_READY MP Initialize Library is not initialized.
|
| 86 |
|
| 87 | **/
|
| 88 | EFI_STATUS
|
| 89 | EFIAPI
|
| 90 | MpInitLibWhoAmI (
|
| 91 | OUT UINTN *ProcessorNumber
|
| 92 | )
|
| 93 | {
|
| 94 | return EFI_UNSUPPORTED;
|
| 95 | }
|
| 96 | /**
|
| 97 | Retrieves the number of logical processor in the platform and the number of
|
| 98 | those logical processors that are enabled on this boot. This service may only
|
| 99 | be called from the BSP.
|
| 100 |
|
| 101 | @param[out] NumberOfProcessors Pointer to the total number of logical
|
| 102 | processors in the system, including the BSP
|
| 103 | and disabled APs.
|
| 104 | @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical
|
| 105 | processors that exist in system, including
|
| 106 | the BSP.
|
| 107 |
|
| 108 | @retval EFI_SUCCESS The number of logical processors and enabled
|
| 109 | logical processors was retrieved.
|
| 110 | @retval EFI_DEVICE_ERROR The calling processor is an AP.
|
| 111 | @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL and NumberOfEnabledProcessors
|
| 112 | is NULL.
|
| 113 | @retval EFI_NOT_READY MP Initialize Library is not initialized.
|
| 114 |
|
| 115 | **/
|
| 116 | EFI_STATUS
|
| 117 | EFIAPI
|
| 118 | MpInitLibGetNumberOfProcessors (
|
| 119 | OUT UINTN *NumberOfProcessors, OPTIONAL
|
| 120 | OUT UINTN *NumberOfEnabledProcessors OPTIONAL
|
| 121 | )
|
| 122 | {
|
| 123 | return EFI_UNSUPPORTED;
|
| 124 | }
|