Aamir Bohra | 30cca6c | 2021-02-04 20:57:51 +0530 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <fsp/api.h> |
| 4 | #include <fsp/ppi/mp_service_ppi.h> |
| 5 | #include <Ppi/MpServices.h> |
| 6 | |
| 7 | typedef EFI_PEI_MP_SERVICES_PPI efi_pei_mp_services_ppi; |
| 8 | |
Jeremy Compostella | 3f43184 | 2024-02-16 13:29:26 -0800 | [diff] [blame^] | 9 | static __efiapi efi_return_status_t mps1_get_number_of_processors(const |
Aamir Bohra | 30cca6c | 2021-02-04 20:57:51 +0530 | [diff] [blame] | 10 | efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, |
| 11 | efi_uintn_t *number_of_processors, efi_uintn_t *number_of_enabled_processors) |
| 12 | { |
| 13 | return mp_get_number_of_processors(number_of_processors, number_of_enabled_processors); |
| 14 | } |
| 15 | |
Jeremy Compostella | 3f43184 | 2024-02-16 13:29:26 -0800 | [diff] [blame^] | 16 | static __efiapi efi_return_status_t mps1_get_processor_info(const |
Aamir Bohra | 30cca6c | 2021-02-04 20:57:51 +0530 | [diff] [blame] | 17 | efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, |
| 18 | efi_uintn_t processor_number, |
| 19 | efi_processor_information *processor_info_buffer) |
| 20 | { |
| 21 | return mp_get_processor_info(processor_number, processor_info_buffer); |
| 22 | } |
| 23 | |
Jeremy Compostella | 3f43184 | 2024-02-16 13:29:26 -0800 | [diff] [blame^] | 24 | static __efiapi efi_return_status_t mps1_startup_all_aps(const |
Aamir Bohra | 30cca6c | 2021-02-04 20:57:51 +0530 | [diff] [blame] | 25 | efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, |
Aamir Bohra | 813a3ba | 2021-02-25 13:25:57 +0530 | [diff] [blame] | 26 | efi_ap_procedure procedure, efi_boolean_t run_serial, |
Aamir Bohra | 30cca6c | 2021-02-04 20:57:51 +0530 | [diff] [blame] | 27 | efi_uintn_t timeout_usec, void *argument) |
| 28 | { |
Aamir Bohra | 813a3ba | 2021-02-25 13:25:57 +0530 | [diff] [blame] | 29 | return mp_startup_all_aps(procedure, run_serial, timeout_usec, argument); |
Aamir Bohra | 30cca6c | 2021-02-04 20:57:51 +0530 | [diff] [blame] | 30 | } |
| 31 | |
Jeremy Compostella | 3f43184 | 2024-02-16 13:29:26 -0800 | [diff] [blame^] | 32 | static __efiapi efi_return_status_t mps1_startup_this_ap(const |
Aamir Bohra | 30cca6c | 2021-02-04 20:57:51 +0530 | [diff] [blame] | 33 | efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, |
| 34 | efi_ap_procedure procedure, efi_uintn_t processor_number, |
| 35 | efi_uintn_t timeout_usec, void *argument) |
| 36 | { |
| 37 | return mp_startup_this_ap(procedure, processor_number, timeout_usec, argument); |
| 38 | } |
| 39 | |
Jeremy Compostella | 3f43184 | 2024-02-16 13:29:26 -0800 | [diff] [blame^] | 40 | static __efiapi efi_return_status_t mps1_switch_bsp(const efi_pei_services **ignored1, |
Aamir Bohra | 30cca6c | 2021-02-04 20:57:51 +0530 | [diff] [blame] | 41 | efi_pei_mp_services_ppi *ignored2, efi_uintn_t ignored3, |
| 42 | efi_boolean_t ignored4) |
| 43 | { |
| 44 | return mp_api_unsupported(); |
| 45 | } |
| 46 | |
Jeremy Compostella | 3f43184 | 2024-02-16 13:29:26 -0800 | [diff] [blame^] | 47 | static __efiapi efi_return_status_t mps1_enable_disable_ap(const |
Aamir Bohra | 30cca6c | 2021-02-04 20:57:51 +0530 | [diff] [blame] | 48 | efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, |
| 49 | efi_uintn_t ignored3, efi_boolean_t ignored4, efi_uint32_t *ignored5) |
| 50 | { |
| 51 | return mp_api_unsupported(); |
| 52 | } |
| 53 | |
Jeremy Compostella | 3f43184 | 2024-02-16 13:29:26 -0800 | [diff] [blame^] | 54 | static __efiapi efi_return_status_t mps1_identify_processor(const |
Aamir Bohra | 30cca6c | 2021-02-04 20:57:51 +0530 | [diff] [blame] | 55 | efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2, |
| 56 | efi_uintn_t *processor_number) |
| 57 | { |
| 58 | return mp_identify_processor(processor_number); |
| 59 | } |
| 60 | |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 61 | /* edk2 UEFIPKG Open Source MP Service PPI to be installed */ |
Aamir Bohra | 30cca6c | 2021-02-04 20:57:51 +0530 | [diff] [blame] | 62 | |
| 63 | static efi_pei_mp_services_ppi mp_service1_ppi = { |
| 64 | mps1_get_number_of_processors, |
| 65 | mps1_get_processor_info, |
| 66 | mps1_startup_all_aps, |
| 67 | mps1_startup_this_ap, |
| 68 | mps1_switch_bsp, |
| 69 | mps1_enable_disable_ap, |
| 70 | mps1_identify_processor, |
| 71 | }; |
| 72 | |
| 73 | void *mp_fill_ppi_services_data(void) |
| 74 | { |
| 75 | return (void *)&mp_service1_ppi; |
| 76 | } |